Skip to content

Commit

Permalink
remove extra timestep limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWibking committed Aug 2, 2023
1 parent 86a9590 commit 7ef99a9
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/ShockCloud/cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ template <> struct SimulationData<ShockCloud> {
};

static bool enable_cooling = true;
static bool limitDtByCooling = true;
static bool sharp_cloud_edge = false;

template <> void RadhydroSimulation<ShockCloud>::setInitialConditionsAtLevel(int lev)
Expand Down Expand Up @@ -230,43 +229,6 @@ AMRSimulation<ShockCloud>::setCustomBoundaryConditions(const amrex::IntVect &iv,
}
}

template <> auto RadhydroSimulation<ShockCloud>::computeExtraPhysicsTimestep(int const lev) -> amrex::Real
{
// return minimum cooling time on level 'lev'
amrex::Real dt_extra = std::numeric_limits<amrex::Real>::max();
const amrex::Real tcool_safety_fac = 0.1;

if (::limitDtByCooling) {
auto const &mf = state_new_[lev];
auto const &state = mf.const_arrays();
amrex::MultiFab tcool_mf(mf.boxArray(), mf.DistributionMap(), 1, 0);
auto const &tcool = tcool_mf.arrays();
auto tables = userData_.cloudyTables.const_tables();

amrex::ParallelFor(mf, [=] AMREX_GPU_DEVICE(int bx, int i, int j, int k) noexcept {
const Real rho = state[bx](i, j, k, HydroSystem<ShockCloud>::density_index);
const Real x1Mom = state[bx](i, j, k, HydroSystem<ShockCloud>::x1Momentum_index);
const Real x2Mom = state[bx](i, j, k, HydroSystem<ShockCloud>::x2Momentum_index);
const Real x3Mom = state[bx](i, j, k, HydroSystem<ShockCloud>::x3Momentum_index);
const Real Egas = state[bx](i, j, k, HydroSystem<ShockCloud>::energy_index);
const Real Eint = RadSystem<ShockCloud>::ComputeEintFromEgas(rho, x1Mom, x2Mom, x3Mom, Egas);

Real T = ComputeTgasFromEgas(rho, Eint, HydroSystem<ShockCloud>::gamma_, tables);
Real Edot = cloudy_cooling_function(rho, T, tables);
tcool[bx](i, j, k) = std::abs(Eint / Edot);
});
amrex::Gpu::streamSynchronizeAll();

amrex::Real min_tcool = tcool_mf.min(0);
if (verbose) {
amrex::Print() << "\tMinimum cooling time on level " << lev << ": " << min_tcool << "\n";
}
dt_extra = tcool_safety_fac * min_tcool;
}

return dt_extra;
}

template <>
void HydroSystem<ShockCloud>::EnforceInternalEnergyFloor(amrex::Real const internalEnergyFloor,
amrex::MultiFab &state_mf,
Expand Down Expand Up @@ -948,11 +910,6 @@ auto problem_main() -> int
pp.query("enable_cooling", enable_cooling);
::enable_cooling = enable_cooling == 1;

// limit timestep based on cooling time?
int limit_timestep_by_cooling_time = 1;
pp.query("limit_timestep_by_cooling_time", limit_timestep_by_cooling_time);
::limitDtByCooling = limit_timestep_by_cooling_time == 1;

// use a sharp cloud edge?
int sharp_cloud_edge = 0;
pp.query("sharp_cloud_edge", sharp_cloud_edge);
Expand Down

0 comments on commit 7ef99a9

Please sign in to comment.