From 01c4469d4b59de187dae3a1d4e7919dae9b6d5e2 Mon Sep 17 00:00:00 2001 From: Ryan Brady Date: Thu, 5 Sep 2024 17:02:35 -0400 Subject: [PATCH] add subch_planar 1D support --- Exec/science/subch_planar/Problem_Derive.cpp | 28 ++++++++----------- .../problem_initialize_state_data.H | 4 ++- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Exec/science/subch_planar/Problem_Derive.cpp b/Exec/science/subch_planar/Problem_Derive.cpp index 2e97187e44..cafe5d591c 100644 --- a/Exec/science/subch_planar/Problem_Derive.cpp +++ b/Exec/science/subch_planar/Problem_Derive.cpp @@ -23,10 +23,10 @@ void ca_dergradpoverp(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int /*nco #if AMREX_SPACEDIM == 3 amrex::Error("3D not supported"); +#elif AMREX_SPACEDIM == 1 + return; // Skip for 1D #endif -#if AMREX_SPACEDIM == 1 - amrex::Error("1D not supported"); -#endif + Real dxinv = 1.0_rt / dx[0]; Real dyinv = 1.0_rt / dx[1]; @@ -226,9 +226,8 @@ void ca_dergradpoverp1(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int /*nc #if AMREX_SPACEDIM == 3 amrex::Error("3D not supported"); -#endif -#if AMREX_SPACEDIM == 1 - amrex::Error("1D not supported"); +#elif AMREX_SPACEDIM == 1 + return; // Skip for 1D #endif Real dxinv = 1.0_rt / dx[0]; @@ -429,9 +428,8 @@ void ca_dergradpx(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int /*ncomp*/ #if AMREX_SPACEDIM == 3 amrex::Error("3D not supported"); -#endif -#if AMREX_SPACEDIM == 1 - amrex::Error("1D not supported"); +#elif AMREX_SPACEDIM == 1 + return; // Skip for 1D #endif Real dxinv = 1.0_rt / dx[0]; @@ -540,9 +538,8 @@ void ca_dergradpy(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int /*ncomp*/ #if AMREX_SPACEDIM == 3 amrex::Error("3D not supported"); -#endif -#if AMREX_SPACEDIM == 1 - amrex::Error("1D not supported"); +#elif AMREX_SPACEDIM == 1 + return; // Skip for 1D #endif Real dxinv = 1.0_rt / dx[0]; @@ -653,9 +650,8 @@ void ca_dergradrhooverrho(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int / #if AMREX_SPACEDIM == 3 amrex::Error("3D not supported"); -#endif -#if AMREX_SPACEDIM == 1 - amrex::Error("1D not supported"); +#elif AMREX_SPACEDIM == 1 + return; // Skip for 1D #endif Real dxinv = 1.0_rt / dx[0]; @@ -714,4 +710,4 @@ void ca_dergradrhooverrho(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int / }); -} +} \ No newline at end of file diff --git a/Exec/science/subch_planar/problem_initialize_state_data.H b/Exec/science/subch_planar/problem_initialize_state_data.H index f002f1339c..48f0aceac3 100644 --- a/Exec/science/subch_planar/problem_initialize_state_data.H +++ b/Exec/science/subch_planar/problem_initialize_state_data.H @@ -25,7 +25,9 @@ void problem_initialize_state_data (int i, int j, int k, Real z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); #endif -#if AMREX_SPACEDIM == 2 +#if AMREX_SPACEDIM == 1 + Real height = x; +#elif AMREX_SPACEDIM == 2 Real height = y; #else Real height = z;