Skip to content
Snippets Groups Projects
Select Git revision
  • 52448dcefe42c4d69ae41edb6ab7488624380fec
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

DecomposeInSimplex.h

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    maxwell_solver.cpp 1.60 KiB
    #include "gmsh.h"
    #include "silo_output.hpp"
    #include "maxwell_interface.h"
    
    static void
    make_geometry(int order, double mesh_h)
    {
        gm::add("difftest");
    
        std::vector<std::pair<int,int>> objects;
    
        objects.push_back(
            std::make_pair(3, gmo::addBox(0.0, 0.0, 0.0, 1.0, 1.0, 0.05) )
            );
        objects.push_back(
            std::make_pair(3, gmo::addBox(0.0, 0.0, 0.05, 1.0, 1.0, 0.05) )
            );
    
        std::vector<std::pair<int, int>> tools;
        gmsh::vectorpair odt;
        std::vector<gmsh::vectorpair> odtm;
        gmo::fragment(objects, tools, odt, odtm);
    
        gmo::synchronize();
    
        gvp_t vp;
        gm::getEntities(vp);
        gmm::setSize(vp, mesh_h);
    }
    
    template<typename State>
    void test_it(const model& mod, State& state)
    {
        auto E = [](const point_3d& pt) -> vec3d {
            vec3d ret;
            ret(0) = 0;
            ret(1) = 0;
            ret(2) = std::sin(M_PI*pt.x()) * std::sin(M_PI*pt.y());
            return ret;
        };
    
        maxwell::init_from_model(mod, state);
        maxwell::init_E_field(mod, state, E);
    
        state.delta_t = 0.001;
    
        for(size_t i = 0; i < 10000; i++)
        {
            timestep(state);
            std::stringstream ss;
            ss << "maxwell_" << i << ".silo";
    
            if (i%10 == 0)
                maxwell::export_to_silo(mod, state, ss.str());
            
            std::swap(state.emf_curr, state.emf_next);
        }
    
        
    }
    
    int main(int argc, const char *argv[])
    {
        gmsh::initialize();
        make_geometry(1, 0.1);
    
        model mod(1,3);
        
        maxwell::solver_state state_c;
        test_it(mod, state_c);
    
        //maxwell::solver_state_gpu state_g;
        //test_it(mod, state_g);
    
        //gmsh::finalize();
    
        return 0;
    }