40 safeScale_(
dict.getOrDefault<scalar>(
"safeScale", 0.9)),
41 alphaInc_(
dict.getOrDefault<scalar>(
"alphaIncrease", 0.2)),
42 alphaDec_(
dict.getOrDefault<scalar>(
"alphaDecrease", 0.25)),
43 minScale_(
dict.getOrDefault<scalar>(
"minScale", 0.2)),
44 maxScale_(
dict.getOrDefault<scalar>(
"maxScale", 10)),
79 err =
solve(
x,
y, dydx0_, dx, yTemp_);
84 scalar scale =
max(safeScale_*
pow(err, -alphaDec_), minScale_);
90 <<
"stepsize underflow" 101 if (err >
pow(maxScale_/safeScale_, -1.0/alphaInc_))
103 scalar scale = safeScale_*
pow(err, -alphaInc_);
104 dxTry =
clamp(scale, minScale_, maxScale_)*dx;
108 dxTry = safeScale_*maxScale_*dx;
virtual scalar solve(const scalar x0, const scalarField &y0, const scalarField &dydx0, const scalar dx, scalarField &y) const =0
Solve a single step dx and return the error.
Abstract base class for the systems of ordinary differential equations.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
An ODE solver for chemistry.
Macros for easy insertion into run-time selection tables.
adaptiveSolver(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
bool resize(const label n)
Resize the ODE solver.
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
static void resizeField(UList< Type > &f, const label n)
virtual void derivatives(const scalar x, const scalarField &y, scalarField &dydx) const =0
Calculate the derivatives in dydx.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)