From 2952a99d5d17fa197684d89bd8467ccf9725a0c6 Mon Sep 17 00:00:00 2001 From: Zhi Date: Wed, 23 Oct 2024 14:22:48 -0400 Subject: [PATCH] update checks on bc for spherical2d --- Source/driver/Castro.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index 8ea195e8d2..6149e7f988 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -306,14 +306,26 @@ Castro::read_params () #elif (AMREX_SPACEDIM == 2) if ( dgeom.IsSPHERICAL() ) { + if ( (lo_bc[1] != amrex::PhysBCType::symmetry) && (dgeom.ProbLo(1) == 0.0) ) + { + std::cerr << "ERROR:Castro::read_params: must set theta=0 boundary condition to Symmetry for spherical\n"; + amrex::Error(); + } + + if ( (hi_bc[1] != amrex::PhysBCType::symmetry) && (std::abs(dgeom.ProbHi(1) - M_PI) <= 1.e-4_rt) ) + { + std::cerr << "ERROR:Castro::read_params: must set theta=pi boundary condition to Symmetry for spherical\n"; + amrex::Error(); + } + if ( (dgeom.ProbLo(1) < 0.0_rt) && (dgeom.ProbHi(1) > M_PI) ) { - amrex::Abort("Theta must be within [0, Pi] for spherical coordinate system in 2D"); + amrex::Abort("ERROR:Castro::read_params: Theta must be within [0, Pi] for spherical coordinate system in 2D"); } if ( dgeom.ProbLo(0) < static_cast(NUM_GROW) * dgeom.CellSize(0) ) { - amrex::Abort("R-min must be large enough so ghost cells doesn't extend to negative R"); + amrex::Abort("ERROR:Castro::read_params: R-min must be large enough so ghost cells doesn't extend to negative R"); } } #elif (AMREX_SPACEDIM == 3)