diff --git a/src/mesh/mesh.cpp b/src/mesh/mesh.cpp index 49b6d5a520ef..789c1723b25e 100644 --- a/src/mesh/mesh.cpp +++ b/src/mesh/mesh.cpp @@ -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 diff --git a/src/mesh/mesh.hpp b/src/mesh/mesh.hpp index 918d50c175cb..9f50e9a12b28 100644 --- a/src/mesh/mesh.hpp +++ b/src/mesh/mesh.hpp @@ -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 mesh_bcs; int ndim; // number of dimensions const bool adaptive, multilevel, multigrid;