diff --git a/Source/driver/timestep.cpp b/Source/driver/timestep.cpp index 31144a7e9e..fd7e029a4b 100644 --- a/Source/driver/timestep.cpp +++ b/Source/driver/timestep.cpp @@ -36,7 +36,8 @@ Castro::estdt_cfl (int is_new) const auto dx = geom.CellSizeArray(); const auto problo = geom.ProbLoArray(); - amrex::ignore_unused(problo); + const auto coord = geom.Coord(); + amrex::ignore_unused(problo, coord); const MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type); @@ -84,7 +85,7 @@ Castro::estdt_cfl (int is_new) Real dt2; #if AMREX_SPACEDIM >= 2 dt2 = dx[1]/(c + std::abs(uy)); - if (geom.IsSPHERICAL()) { + if (coord == 2) { // dx[1] in Spherical2D is just dtheta, need rdtheta for physical length // so just multiply by the smallest r dt2 *= problo[0] + 0.5_rt * dx[0]; @@ -135,7 +136,8 @@ Castro::estdt_mhd (int is_new) // MHD timestep limiter const auto dx = geom.CellSizeArray(); const auto problo = geom.ProbLoArray(); - amrex::ignore_unused(problo); + const auto coord = geom.Coord(); + amrex::ignore_unused(problo, coord); const MultiFab& U_state = is_new ? get_new_data(State_Type) : get_old_data(State_Type); @@ -215,7 +217,7 @@ Castro::estdt_mhd (int is_new) Real dt2; #if AMREX_SPACEDIM >= 2 dt2 = dx[1]/(cy + std::abs(uy)); - if (geom.IsSPHERICAL()) { + if (coord == 2) { dt2 *= problo[0] + 0.5_rt * dx[0]; } #else @@ -251,7 +253,8 @@ Castro::estdt_temp_diffusion (int is_new) const auto dx = geom.CellSizeArray(); const auto problo = geom.ProbLoArray(); - amrex::ignore_unused(problo); + const auto coord = geom.Coord(); + amrex::ignore_unused(problo, coord); const MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type); @@ -301,7 +304,7 @@ Castro::estdt_temp_diffusion (int is_new) Real dt2; #if AMREX_SPACEDIM >= 2 dt2 = 0.5_rt * dx[1]*dx[1] / D; - if (geom.IsSPHERICAL()) { + if (coord == 2) { Real r = problo[0] + 0.5_rt * dx[0]; dt2 *= r * r; } @@ -339,7 +342,8 @@ Castro::estdt_burning (int is_new) const auto dx = geom.CellSizeArray(); const auto problo = geom.ProbLoArray(); - amrex::ignore_unused(problo); + const auto coord = geom.Coord(); + amrex::ignore_unused(problo, coord); MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type); @@ -388,13 +392,13 @@ Castro::estdt_burning (int is_new) #if AMREX_SPACEDIM == 1 burn_state.dx = dx[0]; #else - Real r = 1.0_rt; + Real dx1 = dx[1]; #if AMREX_SPACEDIM >= 2 - if (geom.IsSPHERICAL()) { - r = problo[0] + 0.5_rt * dx[0]; + if (coord == 2) { + dx1 *= problo[0] + 0.5_rt * dx[0]; } #endif - burn_state.dx = amrex::min(AMREX_D_DECL(dx[0], r * dx[1], dx[2])); + burn_state.dx = amrex::min(AMREX_D_DECL(dx[0], dx1, dx[2])); #endif burn_state.rho = S(i,j,k,URHO); @@ -491,7 +495,8 @@ Castro::estdt_rad (int is_new) { auto dx = geom.CellSizeArray(); const auto problo = geom.ProbLoArray(); - amrex::ignore_unused(problo); + const auto coord = geom.Coord(); + amrex::ignore_unused(problo, coord); const MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type); const MultiFab& radMF = is_new ? get_new_data(Rad_Type) : get_old_data(Rad_Type); @@ -551,7 +556,7 @@ Castro::estdt_rad (int is_new) Real dt1 = dx[0] / (c + std::abs(ux)); #if AMREX_SPACEDIM >= 2 Real dt2 = dx[1] / (c + std::abs(uy)); - if (geom.IsSPHERICAL()) { + if (coord == 2) { dt2 *= problo[0] + 0.5_rt * dx[0]; } #else diff --git a/Source/hydro/Castro_hydro.cpp b/Source/hydro/Castro_hydro.cpp index 11dfe7fa72..0e2250ed20 100644 --- a/Source/hydro/Castro_hydro.cpp +++ b/Source/hydro/Castro_hydro.cpp @@ -238,14 +238,15 @@ Castro::check_for_cfl_violation(const MultiFab& State, const Real dt) auto dx = geom.CellSizeArray(); const auto problo = geom.ProbLoArray(); - amrex::ignore_unused(problo); + const auto coord = geom.Coord(); + amrex::ignore_unused(problo, coord); Real dtdx = dt / dx[0]; Real dtdy = 0.0_rt; if (AMREX_SPACEDIM >= 2) { dtdy = dt / dx[1]; - if (geom.IsSPHERICAL()) { + if (coord == 2) { // dx[1] in Spherical2D is just rdtheta, need rdtheta for physical length // Just choose to divide by the smallest r dtdy /= problo[0] + 0.5_rt * dx[0];