Skip to content
Snippets Groups Projects
Commit 73ef42f1 authored by Matteo Cicuttin's avatar Matteo Cicuttin
Browse files

Issue a warning on duplicated interfaces.

parent 6cccdf6d
No related branches found
No related tags found
No related merge requests found
...@@ -11,4 +11,10 @@ Cylinder(3) = {0, 0, -d/2-t, 0, 0, t, R}; ...@@ -11,4 +11,10 @@ Cylinder(3) = {0, 0, -d/2-t, 0, 0, t, R};
Sphere(4) = {0, 0, 0, 2*R, -Pi/2, Pi/2, 2*Pi}; Sphere(4) = {0, 0, 0, 2*R, -Pi/2, Pi/2, 2*Pi};
Coherence; Coherence;
Physical Volume(1000) = {1, 3};
Physical Volume(1001) = {2};
Physical Volume(1002) = {4};
Physical Surface(2000) = {1};
MeshSize{ PointsOf{ Volume{2}; } } = 0.0003; MeshSize{ PointsOf{ Volume{2}; } } = 0.0003;
...@@ -38,11 +38,11 @@ for i,v in ipairs(air) do ...@@ -38,11 +38,11 @@ for i,v in ipairs(air) do
end end
-- ** Boundary conditions ** -- ** Boundary conditions **
local absorbing_bcs = {1} --local absorbing_bcs = {1}
for i,v in ipairs(absorbing_bcs) do --for i,v in ipairs(absorbing_bcs) do
bndconds[v] = {} -- bndconds[v] = {}
bndconds[v].kind = "impedance" -- bndconds[v].kind = "impedance"
end --end
local R = 0.01 -- Capacitor disk radius (must match capacitor.geo) local R = 0.01 -- Capacitor disk radius (must match capacitor.geo)
local d = 0.001 -- Dielectric thickness (must match capacitor.geo) local d = 0.001 -- Dielectric thickness (must match capacitor.geo)
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#include "common/mpi_helpers.h" #include "common/mpi_helpers.h"
#endif /* USE_MPI */ #endif /* USE_MPI */
#include "sgr.hpp"
using namespace sgr;
std::string std::string
quadrature_name(int order) quadrature_name(int order)
{ {
...@@ -252,13 +255,14 @@ model::import_gmsh_entities_rank0(void) ...@@ -252,13 +255,14 @@ model::import_gmsh_entities_rank0(void)
flux_base_world += e.num_fluxes(); flux_base_world += e.num_fluxes();
index_base_world += e.num_cells(); index_base_world += e.num_cells();
/* Send entity to the appropriate process */
assert(tag_partition > 0); assert(tag_partition > 0);
int rank = tag_partition - 1; int rank = tag_partition - 1;
e.mpi_send(rank, MPI_COMM_WORLD);
#ifdef ENABLE_DEBUG_PRINT #ifdef ENABLE_DEBUG_PRINT
std::cout << "Sending entity " << tag << " to " << rank << " " << e.num_dofs() << std::endl; std::cout << "Sending entity " << tag << " to " << rank << ", ";
std::cout << e.num_dofs() << " DoFs" << std::endl;
#endif /* ENABLE_DEBUG_PRINT */ #endif /* ENABLE_DEBUG_PRINT */
/* Send entity to the appropriate process */
e.mpi_send(rank, MPI_COMM_WORLD);
/* Save locally the entity */ /* Save locally the entity */
remote_entities[tag_partition].push_back( std::move(e) ); remote_entities[tag_partition].push_back( std::move(e) );
all_entities_tags.push_back(tag); all_entities_tags.push_back(tag);
...@@ -341,13 +345,14 @@ model::import_gmsh_entities_rankN(void) ...@@ -341,13 +345,14 @@ model::import_gmsh_entities_rankN(void)
for (auto& rtag : partition_map.at(mp)) for (auto& rtag : partition_map.at(mp))
{ {
entity e; entity e;
e.mpi_recv(0, MPI_COMM_WORLD);
#ifdef ENABLE_DEBUG_PRINT #ifdef ENABLE_DEBUG_PRINT
std::cout << "Receiving " << rtag << ", rank " << mp-1 << " "; std::cout << "Receiving " << rtag << ", rank " << mp-1 << ", ";
std::cout << e.num_dofs() << std::endl;
#endif /* ENABLE_DEBUG_PRINT */ #endif /* ENABLE_DEBUG_PRINT */
(void) rtag; (void) rtag;
e.mpi_recv(0, MPI_COMM_WORLD);
#ifdef ENABLE_DEBUG_PRINT
std::cout << e.num_dofs() << " DoFs" << std::endl;
#endif /* ENABLE_DEBUG_PRINT */
for (size_t i = 0; i < e.num_cells(); i++) for (size_t i = 0; i < e.num_cells(); i++)
{ {
...@@ -405,17 +410,38 @@ model::get_facekey_tag_pairs(void) ...@@ -405,17 +410,38 @@ model::get_facekey_tag_pairs(void)
void void
model::map_boundaries(void) model::map_boundaries(void)
{ {
#ifdef USE_MPI
//ASSERT_MPI_RANK_0;
#endif /* USE_MPI */
std::vector<bfk_t> bfk = get_facekey_tag_pairs(); std::vector<bfk_t> bfk = get_facekey_tag_pairs();
for (size_t i = 1; i < bfk.size(); i++) for (size_t i = 1; i < bfk.size(); i++)
{ {
if ( bfk[i-1].first == bfk[i].first ) if ( bfk[i-1].first == bfk[i].first )
{ {
std::cout << bfk[i-1].second << " " << bfk[i].second << std::endl; std::cout << redfg << Bon << "WARNING: " << nofg << __FILE__;
std::cout << "(" << __LINE__ << "): Face identified by ";
std::cout << bfk[i].first << " was found on interfaces ";
std::cout << bfk[i-1].second;
#ifdef USE_MPI
if ( is_interprocess_boundary(bfk[i-1].second) )
std::cout << " (IP)";
#endif
std::cout << " and " << bfk[i].second;
#ifdef USE_MPI
if ( is_interprocess_boundary(bfk[i].second) )
std::cout << " (IP)";
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
std::cout << " [MPI rank " << rank << "]";
#endif
std::cout << ". " << reset << std::endl;
/*
#ifdef USE_MPI
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0)
#endif
gmsh::write("crash.msh");
throw 42; throw 42;
*/
} }
} }
......
...@@ -198,6 +198,18 @@ void solver_mainloop(const model& mod, State& state, maxwell::parameter_loader& ...@@ -198,6 +198,18 @@ void solver_mainloop(const model& mod, State& state, maxwell::parameter_loader&
} }
#endif /* USE_MPI */ #endif /* USE_MPI */
#ifdef USE_MPI
size_t my_num_dofs = 6*mod.num_dofs();
size_t num_dofs;
MPI_Reduce(&my_num_dofs, &num_dofs, 1, MPI_UNSIGNED_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
if (proc_rank == 0)
std::cout << "Model has " << num_dofs << " DoFs" << std::endl;
#else /* USE_MPI */
size_t num_dofs = 6*mod.num_dofs();
std::cout << "Model has " << num_dofs << " DoFs" << std::endl;
#endif /* USE_MPI */
mpl.call_initialization_callback(); mpl.call_initialization_callback();
#ifdef ENABLE_EXP_GEOMETRIC_DIODE #ifdef ENABLE_EXP_GEOMETRIC_DIODE
#ifdef USE_MPI #ifdef USE_MPI
...@@ -238,7 +250,7 @@ void solver_mainloop(const model& mod, State& state, maxwell::parameter_loader& ...@@ -238,7 +250,7 @@ void solver_mainloop(const model& mod, State& state, maxwell::parameter_loader&
#else /* USE_MPI */ #else /* USE_MPI */
std::cout << hidecursor << clrline << "Cycle " << i << ": t = "; std::cout << hidecursor << clrline << "Cycle " << i << ": t = ";
std::cout << state.curr_time << " s" << ", DOFs/s: "; std::cout << state.curr_time << " s" << ", DOFs/s: ";
std::cout << dofs_s_proc << cr << std::flush; std::cout << dofs_s_proc << ", avg time: " << time/cycle_print_rate << " s" << cr << std::flush;
#endif /* USE_MPI */ #endif /* USE_MPI */
tc.tic(); tc.tic();
} }
...@@ -369,6 +381,7 @@ int main(int argc, char *argv[]) ...@@ -369,6 +381,7 @@ int main(int argc, char *argv[])
#ifdef USE_MPI #ifdef USE_MPI
if (comm_rank == 0) if (comm_rank == 0)
{ {
std::cout << "Generating mesh..." << std::flush;
if (scaled) if (scaled)
mod.generate_mesh(sf); mod.generate_mesh(sf);
else else
...@@ -376,20 +389,24 @@ int main(int argc, char *argv[]) ...@@ -376,20 +389,24 @@ int main(int argc, char *argv[])
if (comm_size > 1) if (comm_size > 1)
mod.partition_mesh(comm_size); mod.partition_mesh(comm_size);
std::cout << "done" << std::endl;
std::cout << "Distributing mesh partitions..." << std::flush;
mod.populate_from_gmsh(); mod.populate_from_gmsh();
std::cout << "done" << std::endl;
} }
else else
{ {
mod.populate_from_gmsh(); mod.populate_from_gmsh();
} }
#else /* USE_MPI */ #else /* USE_MPI */
std::cout << "Generating mesh..." << std::flush;
if (scaled) if (scaled)
mod.build(sf); mod.build(sf);
else else
mod.build(); mod.build();
std::cout << "done" << std::endl;
#endif /* USE_MPI */ #endif /* USE_MPI */
if ( not mpl.validate_model_params(mod) ) if ( not mpl.validate_model_params(mod) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment