From 68c1a153749723bcf41d15530f33c31c1d5b6931 Mon Sep 17 00:00:00 2001 From: Zhi Chen <62574124+zhichen3@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:29:11 -0400 Subject: [PATCH] remove 2d spherical geometry abort and add some asserts for 2d spherical geometry setup. (#2973) --- Source/driver/Castro.cpp | 10 +++++++++- Source/gravity/Gravity.cpp | 7 ------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index d3fe48b979..11d10c1b9d 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -306,7 +306,15 @@ Castro::read_params () #elif (AMREX_SPACEDIM == 2) if ( dgeom.IsSPHERICAL() ) { - amrex::Abort("We don't support spherical coordinate systems in 2D"); + 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"); + } + + 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"); + } } #elif (AMREX_SPACEDIM == 3) if ( dgeom.IsRZ() ) diff --git a/Source/gravity/Gravity.cpp b/Source/gravity/Gravity.cpp index edeb7359d2..82003be86f 100644 --- a/Source/gravity/Gravity.cpp +++ b/Source/gravity/Gravity.cpp @@ -121,13 +121,6 @@ Gravity::read_params () amrex::Abort("Options are ConstantGrav, PoissonGrav, or MonopoleGrav"); } - if ( gravity::gravity_type == "ConstantGrav") - { - if ( dgeom.IsSPHERICAL() ) { - amrex::Abort("Can't use constant direction gravity with non-Cartesian coordinates"); - } - } - #if (AMREX_SPACEDIM == 1) if (gravity::gravity_type == "PoissonGrav") {