From fc38b7d75cd17859dc9dce6c567a23343705f925 Mon Sep 17 00:00:00 2001 From: Zhi Date: Mon, 7 Oct 2024 15:17:18 -0400 Subject: [PATCH 1/5] remove 2d spherical abort and add some asserts setup --- Source/driver/Castro.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index d3fe48b979..8e6902bbea 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) <= 3.14159265359_rt) ) + { + 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() ) From f3526346a76e14f37b9a72f23cd71e558d56ae9a Mon Sep 17 00:00:00 2001 From: Zhi Date: Mon, 7 Oct 2024 15:19:56 -0400 Subject: [PATCH 2/5] add some space --- Source/driver/Castro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index 8e6902bbea..a76ed50c78 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -311,7 +311,7 @@ Castro::read_params () 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) ) + 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"); } From 89325c316d4439ec325c4c3e36396b10a1653639 Mon Sep 17 00:00:00 2001 From: Zhi Date: Mon, 7 Oct 2024 15:21:40 -0400 Subject: [PATCH 3/5] fix logic --- Source/driver/Castro.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index a76ed50c78..750d7f0c8a 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -306,12 +306,12 @@ Castro::read_params () #elif (AMREX_SPACEDIM == 2) if ( dgeom.IsSPHERICAL() ) { - if ( (dgeom.ProbLo(1) >= 0.0_rt) && (dgeom.ProbHi(1) <= 3.14159265359_rt) ) + if ( (dgeom.ProbLo(1) < 0.0_rt) && (dgeom.ProbHi(1) > 3.14159265359_rt) ) { 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) ) + 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"); } From 80ea251f6316b0ab51d0a26fb227b2a023bad4a8 Mon Sep 17 00:00:00 2001 From: Zhi Date: Mon, 7 Oct 2024 15:51:15 -0400 Subject: [PATCH 4/5] change to M_PI --- Source/driver/Castro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index 750d7f0c8a..11d10c1b9d 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -306,7 +306,7 @@ Castro::read_params () #elif (AMREX_SPACEDIM == 2) if ( dgeom.IsSPHERICAL() ) { - if ( (dgeom.ProbLo(1) < 0.0_rt) && (dgeom.ProbHi(1) > 3.14159265359_rt) ) + 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"); } From cdaeb3a8166c0975d77249ae80934344374b18df Mon Sep 17 00:00:00 2001 From: Zhi Date: Mon, 7 Oct 2024 16:04:28 -0400 Subject: [PATCH 5/5] delete constgrav abort for spherical geom --- Source/gravity/Gravity.cpp | 7 ------- 1 file changed, 7 deletions(-) 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") {