Skip to content

Commit

Permalink
add error checking for swarm/mesh BC consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Sep 27, 2024
1 parent 1df8805 commit 21c0c5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/mesh/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,16 @@ void Mesh::SetBCNames_(ParameterInput *pin) {
pin->GetOrAddString("parthenon/swarm", "ox2_bc", mesh_bc_names[3]),
pin->GetOrAddString("parthenon/swarm", "ix3_bc", mesh_bc_names[4]),
pin->GetOrAddString("parthenon/swarm", "ox3_bc", mesh_bc_names[5])};
// JMM: A consequence of having only one boundary flag array but
// multiple boundary function arrays is that swarms *must* be
// periodic if the mesh is periodic but otherwise mesh and swarm
// boundaries are decoupled.
for (int i = 0; i < BOUNDARY_NFACES; ++i) {
if (mesh_bc_names[i] == "periodic") {
PARTHENON_REQUIRE(mesh_swarm_bc_names == "periodic",
"If the mesh is periodic, swarms must be also.");
}
}
}

std::array<BoundaryFlag, BOUNDARY_NFACES>
Expand Down
4 changes: 0 additions & 4 deletions src/mesh/mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ class Mesh {
BValNames_t mesh_swarm_bc_names;

// these are flags not boundary functions
// JMM: A consequence of having only one boundary flag array but
// multiple boundary function arrays is that swarms *must* be
// periodic if the mesh is periodic but otherwise mesh and swarm
// boundaries are decoupled.
std::array<BoundaryFlag, BOUNDARY_NFACES> mesh_bcs;
int ndim; // number of dimensions
const bool adaptive, multilevel, multigrid;
Expand Down

0 comments on commit 21c0c5d

Please sign in to comment.