ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_FixedDtCFLLimit.H File Reference
#include <AMReX_Algorithm.H>
#include <AMReX_BoxArray.H>
#include <AMReX_REAL.H>
Include dependency graph for ERF_FixedDtCFLLimit.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double FixedDtCFLLimitValue (double cfl)
 
double FixedDtCFLScale (double fixed_dt, double cfl_rate, double cfl)
 
bool FixedDtSameCells (const amrex::BoxArray &a, const amrex::BoxArray &b)
 

Function Documentation

◆ FixedDtCFLLimitValue()

double FixedDtCFLLimitValue ( double  cfl)
inline

Courant number a fixed step may not exceed (erf-model/ERF#5238): min(erf.cfl, 0.8). An erf.cfl below 0.8 is honored; a larger one is capped at 0.8, a margin below the stability limit.

Parameters
[in]cflerf.cfl
17 {
18  return amrex::min(cfl, 0.8);
19 }

Referenced by ERF::CheckFixedDtCFLLimit(), and FixedDtCFLScale().

Here is the caller graph for this function:

◆ FixedDtCFLScale()

double FixedDtCFLScale ( double  fixed_dt,
double  cfl_rate,
double  cfl 
)
inline

Factor by which to scale erf.fixed_dt (and erf.fixed_fast_dt) on a level so that the fixed step respects the CFL limit (erf-model/ERF#5238). The fixed step exceeds the limit when its Courant number fixed_dt * cfl_rate is above FixedDtCFLLimitValue(erf.cfl) = min(erf.cfl, 0.8), and is then scaled to exactly that Courant number, so the scaled step is continuous in the Courant number. Returns 1 when the fixed step is within the limit, or when there is no fixed step, no CFL limit (cfl <= 0) or no constraining rate on the level.

Parameters
[in]fixed_dtfixed time step of the level
[in]cfl_rateinverse time step at a Courant number of one on the level (the rate the adaptive dt of estTimeStep is based on)
[in]cflerf.cfl
36 {
37  if (fixed_dt <= 0.0 || cfl_rate <= 0.0 || cfl <= 0.0) { return 1.0; }
38  const double limit = FixedDtCFLLimitValue(cfl);
39  const double courant = fixed_dt * cfl_rate;
40  // Relative tolerance, so a step already set to the limit is not scaled again by round-off
41  if (courant <= limit * (1.0 + 1.e-10)) { return 1.0; }
42  return limit / courant;
43 }
double FixedDtCFLLimitValue(double cfl)
Definition: ERF_FixedDtCFLLimit.H:16

Referenced by ERF::CheckFixedDtCFLLimit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FixedDtSameCells()

bool FixedDtSameCells ( const amrex::BoxArray &  a,
const amrex::BoxArray &  b 
)
inline

Whether two sets of grids cover the same cells, whatever their box layout. A level whose grids only change layout (re-chopped by a new amr.max_grid_size or rank count, as a restart may do) keeps the CFL check of a fixed dt it had, so the dt does not depend on the layout and a restart takes the steps the uninterrupted run takes (erf-model/ERF#5238, #5228).

Parameters
[in]agrids the CFL limit was last checked on
[in]bcurrent grids
56 {
57  if (a == b) { return true; }
58  // ERF grids are disjoint, so the same number of cells and one covering the other is equality
59  return a.numPts() == b.numPts() && (a.empty() || a.contains(b, true));
60 }

Referenced by ERF::CheckFixedDtCFLLimit(), and ERF::CheckFixedDtCFLLimitAfterRegrid().

Here is the caller graph for this function: