From fc88e50916957ace3d9064c6d2f5b7d8677c0d80 Mon Sep 17 00:00:00 2001 From: apbailey Date: Thu, 5 Dec 2024 08:53:31 -0700 Subject: [PATCH 1/2] error for asymmetric 1d spherical --- src/coordinates/spherical_polar.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/coordinates/spherical_polar.cpp b/src/coordinates/spherical_polar.cpp index 18d11dea7..5699418fa 100644 --- a/src/coordinates/spherical_polar.cpp +++ b/src/coordinates/spherical_polar.cpp @@ -51,6 +51,23 @@ void Coordinates::Initialize(ParameterInput *pin) { ATHENA_ERROR(msg); } + // x2 limits must be symmetric about PI/2 in 1D + if (pm->ndim == 1) { + Real dmax = pm->mesh_size.x2max - PI/2.0; + Real dmin = PI/2.0 - pm->mesh_size.x2min; + if (std::abs(dmax - dmin) > std::numeric_limits::epsilon()) { + std::stringstream msg; + msg << "### FATAL ERROR in BoundaryValues constructor" << std::endl + << "1D spherical-like coordinates requires x2-limits to be symmetric about " + << std::setprecision(std::numeric_limits::max_digits10 -1) + << std::scientific << PI/2.0 << "\n" + << "Current x2 domsin limits are: \n" + << "x2min=" << pm->mesh_size.x2min << "\n" + << "x2max=" << pm->mesh_size.x2max << std::endl; + ATHENA_ERROR(msg); + } + } + // initialize volume-averaged coordinates and spacing // x1-direction: x1v = (\int r dV / \int dV) = d(r^4/4)/d(r^3/3) for (int i=il-ng; i<=iu+ng; ++i) { From 4638056cdda66596dd07dbb2c08284ebf97710ce Mon Sep 17 00:00:00 2001 From: apbailey Date: Thu, 5 Dec 2024 10:22:47 -0700 Subject: [PATCH 2/2] update x2 limits on 1d mignone radial --- inputs/hydro/athinput.mignone_radial | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inputs/hydro/athinput.mignone_radial b/inputs/hydro/athinput.mignone_radial index 67aa04f2c..aaf0adb23 100644 --- a/inputs/hydro/athinput.mignone_radial +++ b/inputs/hydro/athinput.mignone_radial @@ -34,9 +34,9 @@ ix1_bc = reflecting # inner-X1 boundary flag ox1_bc = outflow # outer-X1 boundary flag x1rat = 1.0 # non-uniform grid ratio -nx2 = 1 # Number of zones in X2-direction -x2min = 0.0 # minimum value of X2 -x2max = 1.0 # maximum value of X2 +nx2 = 1 # Number of zones in X2-direction +x2min = 1.0707963267948966 # minimum value of X2 +x2max = 2.0707963267948966 # maximum value of X2 ix2_bc = periodic # inner-X2 boundary flag ox2_bc = periodic # outer-X2 boundary flag