Skip to content

Commit

Permalink
Remove the cfl_violation parameter (#2522)
Browse files Browse the repository at this point in the history
For the CTU advance, this case is already handled by the retry functionality. For the true SDC advance, which does not yet take advantage of retries, we directly abort if a CFL violation is found.
  • Loading branch information
maxpkatz committed Jul 9, 2023
1 parent 262f79b commit da84929
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 30 deletions.
5 changes: 0 additions & 5 deletions Source/driver/Castro.H
Original file line number Diff line number Diff line change
Expand Up @@ -1337,11 +1337,6 @@ protected:
#endif


///
/// Did we trigger a CFL violation?
///
int cfl_violation;


///
/// State data to hold if we want to do a retry.
Expand Down
14 changes: 0 additions & 14 deletions Source/driver/Castro_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,6 @@ Castro::advance (Real time,
#endif //MHD
}

// Optionally kill the job at this point, if we've detected a violation.

if (cfl_violation == 1 && use_retry != 0) {
amrex::Abort("CFL is too high at this level; go back to a checkpoint and restart with lower CFL number, or set castro.use_retry = 1");
}

// If we didn't kill the job, reset the violation counter.

cfl_violation = 0;

// If the user requests, indicate that we want a regrid at the end of the step.

if (use_post_step_regrid == 1) {
Expand Down Expand Up @@ -137,10 +127,6 @@ Castro::initialize_do_advance (Real time, Real dt)

advance_status status {};

// Reset the CFL violation flag.

cfl_violation = 0;

#ifdef RADIATION
// make sure these are filled to avoid check/plot file errors:
if (do_radiation) {
Expand Down
6 changes: 0 additions & 6 deletions Source/driver/Castro_advance_ctu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,6 @@ Castro::subcycle_advance_ctu(const Real time, const Real dt, int amr_iteration,

sdc_iters = sdc_iters_old;

// If we have hit a CFL violation during this subcycle, we must abort.

if (cfl_violation && !use_retry) {
amrex::Abort("CFL is too high at this level; go back to a checkpoint and restart with lower CFL number, or set castro.use_retry = 1");
}

// If we're allowing for retries, check for that here.

if (use_retry) {
Expand Down
4 changes: 0 additions & 4 deletions Source/driver/Castro_advance_sdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ Castro::do_advance_sdc (Real time,
if (do_hydro) {
// Check for CFL violations.
check_for_cfl_violation(S_old, dt);

// If we detect one, return immediately.
if (cfl_violation)
return dt;
}

// construct the update for the current stage -- this fills
Expand Down
7 changes: 6 additions & 1 deletion Source/hydro/Castro_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ Castro::cons_to_prim_fourth(const Real time)
void
Castro::check_for_cfl_violation(const MultiFab& State, const Real dt)
{

BL_PROFILE("Castro::check_for_cfl_violation()");

int cfl_violation = 0;

auto dx = geom.CellSizeArray();

Real dtdx = dt / dx[0];
Expand Down Expand Up @@ -390,4 +391,8 @@ Castro::check_for_cfl_violation(const MultiFab& State, const Real dt)
cfl_violation = 1;
}

// If we detect a CFL violation, abort.
if (cfl_violation) {
amrex::Abort("CFL is too high at this level; go back to a checkpoint and restart with lower CFL number");
}
}

0 comments on commit da84929

Please sign in to comment.