Skip to content

Commit fc88e50

Browse files
committed
error for asymmetric 1d spherical
1 parent 71da5c3 commit fc88e50

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: src/coordinates/spherical_polar.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ void Coordinates::Initialize(ParameterInput *pin) {
5151
ATHENA_ERROR(msg);
5252
}
5353

54+
// x2 limits must be symmetric about PI/2 in 1D
55+
if (pm->ndim == 1) {
56+
Real dmax = pm->mesh_size.x2max - PI/2.0;
57+
Real dmin = PI/2.0 - pm->mesh_size.x2min;
58+
if (std::abs(dmax - dmin) > std::numeric_limits<Real>::epsilon()) {
59+
std::stringstream msg;
60+
msg << "### FATAL ERROR in BoundaryValues constructor" << std::endl
61+
<< "1D spherical-like coordinates requires x2-limits to be symmetric about "
62+
<< std::setprecision(std::numeric_limits<Real>::max_digits10 -1)
63+
<< std::scientific << PI/2.0 << "\n"
64+
<< "Current x2 domsin limits are: \n"
65+
<< "x2min=" << pm->mesh_size.x2min << "\n"
66+
<< "x2max=" << pm->mesh_size.x2max << std::endl;
67+
ATHENA_ERROR(msg);
68+
}
69+
}
70+
5471
// initialize volume-averaged coordinates and spacing
5572
// x1-direction: x1v = (\int r dV / \int dV) = d(r^4/4)/d(r^3/3)
5673
for (int i=il-ng; i<=iu+ng; ++i) {

0 commit comments

Comments
 (0)