From 123c91a50082c0c9726dff20babdf5653c11b4cd Mon Sep 17 00:00:00 2001 From: Matteo Cicuttin <datafl4sh@toxicnet.eu> Date: Thu, 19 Aug 2021 20:09:23 +0200 Subject: [PATCH] Materials from parent entities, sequential OK. --- include/maxwell_common.h | 7 ++++--- src/maxwell_common.cpp | 8 ++++---- src/maxwell_cpu.cpp | 10 +++++----- src/maxwell_gpu.cpp | 10 +++++----- src/maxwell_interface.cpp | 7 ++++++- src/maxwell_solver.cpp | 2 +- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/include/maxwell_common.h b/include/maxwell_common.h index d60047c..b84cde3 100644 --- a/include/maxwell_common.h +++ b/include/maxwell_common.h @@ -17,6 +17,7 @@ eval_boundary_sources(const model& mod, const parameter_loader& mpl, size_t face_num_base = 0; for (auto& e : mod) { + auto etag = e.material_tag(); for (size_t iF = 0; iF < e.num_faces(); iF++) { auto gfnum = face_num_base + iF; @@ -26,13 +27,13 @@ eval_boundary_sources(const model& mod, const parameter_loader& mpl, auto& pf = e.face(iF); auto bar = pf.barycenter(); - auto eps = mpl.epsilon(e.gmsh_tag(), bar); - auto mu = mpl.mu(e.gmsh_tag(), bar); + auto eps = mpl.epsilon(etag, bar); + auto mu = mpl.mu(etag, bar); auto Z = std::sqrt(mu/eps); vec3d n = state.eds[e.number()].normals.row(iF); - switch ( mpl.boundary_type(bd.gmsh_entity) ) + switch ( mpl.boundary_type(bd.material_tag()) ) { case boundary_condition::UNSPECIFIED: break; diff --git a/src/maxwell_common.cpp b/src/maxwell_common.cpp index 8976fd8..bc32155 100644 --- a/src/maxwell_common.cpp +++ b/src/maxwell_common.cpp @@ -79,7 +79,7 @@ init_lax_milgram(const model& mod, const parameter_loader& mpl, { auto& pe = e.cell(iT); auto bar = pe.barycenter(); - auto tag = e.gmsh_tag(); + auto tag = e.material_tag(); auto my_eps = mpl.epsilon(tag, bar); auto my_mu = mpl.mu(tag, bar); @@ -101,7 +101,7 @@ init_lax_milgram(const model& mod, const parameter_loader& mpl, auto& ne_e = mod.entity_at(neigh.iE); auto& ne_pe = ne_e.cell(neigh.iT); auto ne_bar = ne_pe.barycenter(); - auto ne_tag = ne_e.gmsh_tag(); + auto ne_tag = ne_e.material_tag(); auto ne_eps = mpl.epsilon(ne_tag, ne_bar); auto ne_mu = mpl.mu(ne_tag, ne_bar); @@ -233,7 +233,7 @@ void export_J_field_nodal(const model& mod, silo& sdb, const vecxd& Ex, for (auto& e : mod) { - auto etag = e.gmsh_tag(); + auto etag = e.material_tag(); for (size_t iT = 0; iT < e.num_cells(); iT++) { auto& pe = e.cell(iT); @@ -338,7 +338,7 @@ void export_J_field_zonal(const model& mod, silo& sdb, const vecxd& Ex, for (size_t iE = 0; iE < mod.num_entities(); iE++) { auto& e = mod.entity_at(iE); - auto etag = e.gmsh_tag(); + auto etag = e.material_tag(); for (size_t iT = 0; iT < e.num_cells(); iT++) { auto& pe = e.cell(iT); diff --git a/src/maxwell_cpu.cpp b/src/maxwell_cpu.cpp index f826dbb..e1e167a 100644 --- a/src/maxwell_cpu.cpp +++ b/src/maxwell_cpu.cpp @@ -22,15 +22,15 @@ init_matparams(const model& mod, solver_state& state, for (auto& e : mod) { - auto tag = e.gmsh_tag(); + auto etag = e.material_tag(); for (size_t iT = 0; iT < e.num_cells(); iT++) { auto& pe = e.cell(iT); auto& re = e.cell_refelem(pe); auto bar = pe.barycenter(); - auto epsilon = mpl.epsilon(tag, bar); - auto mu = mpl.mu(tag, bar); - auto sigma = mpl.sigma(tag, bar); + auto epsilon = mpl.epsilon(etag, bar); + auto mu = mpl.mu(etag, bar); + auto sigma = mpl.sigma(etag, bar); auto ofs = e.cell_global_dof_offset(iT); for (size_t iD = 0; iD < re.num_basis_functions(); iD++) @@ -543,7 +543,7 @@ eval_volume_sources(const model& mod, const parameter_loader& mpl, solver_state& { for (auto& e : mod) { - auto etag = e.gmsh_tag(); + auto etag = e.material_tag(); if ( not mpl.volume_has_source(etag) ) continue; diff --git a/src/maxwell_gpu.cpp b/src/maxwell_gpu.cpp index 390cbbc..25e0d6b 100644 --- a/src/maxwell_gpu.cpp +++ b/src/maxwell_gpu.cpp @@ -24,15 +24,15 @@ init_matparams(const model& mod, solver_state_gpu& state, for (auto& e : mod) { - auto tag = e.gmsh_tag(); + auto etag = e.material_tag(); for (size_t iT = 0; iT < e.num_cells(); iT++) { auto& pe = e.cell(iT); auto& re = e.cell_refelem(pe); auto bar = pe.barycenter(); - auto v_epsilon = mpl.epsilon(tag, bar); - auto v_mu = mpl.mu(tag, bar); - auto v_sigma = mpl.sigma(tag, bar); + auto v_epsilon = mpl.epsilon(etag, bar); + auto v_mu = mpl.mu(etag, bar); + auto v_sigma = mpl.sigma(etag, bar); auto ofs = e.cell_global_dof_offset(iT); for (size_t iD = 0; iD < re.num_basis_functions(); iD++) @@ -485,7 +485,7 @@ eval_volume_sources(const model& mod, const parameter_loader& mpl, solver_state_ { for (auto& e : mod) { - auto etag = e.gmsh_tag(); + auto etag = e.material_tag(); if ( not mpl.volume_has_source(etag) ) continue; diff --git a/src/maxwell_interface.cpp b/src/maxwell_interface.cpp index 5e5e655..26161c4 100644 --- a/src/maxwell_interface.cpp +++ b/src/maxwell_interface.cpp @@ -403,6 +403,11 @@ parameter_loader::validate_conditions(const model& mod) const if (not validate_interface_condition(mod, bd.gmsh_entity) ) success = false; break; + +#ifdef USE_MPI + case face_type::INTERPROCESS_BOUNDARY: + break; +#endif /* USE_MPI */ } } @@ -415,7 +420,7 @@ parameter_loader::validate_model_params(const model& mod) const bool success = true; for (auto& e : mod) { - auto tag = e.gmsh_tag(); + auto tag = e.material_tag(); bool eps_valid = validate_materials(MAT_EPS, tag); bool mu_valid = validate_materials(MAT_MU, tag); bool sigma_valid = validate_materials(MAT_SIGMA, tag); diff --git a/src/maxwell_solver.cpp b/src/maxwell_solver.cpp index eb2d0b4..dc8315b 100644 --- a/src/maxwell_solver.cpp +++ b/src/maxwell_solver.cpp @@ -166,7 +166,7 @@ reinit_materials(const model& mod, maxwell::solver_state& state, maxwell::parame { for (auto& e : mod) { - auto tag = e.gmsh_tag(); + auto tag = e.material_tag(); for (size_t iT = 0; iT < e.num_cells(); iT++) { auto& pe = e.cell(iT); -- GitLab