50 scalar tol = absTol_[i] + relTol_[i]*
max(
mag(y0[i]),
mag(y[i]));
51 maxErr =
max(maxErr,
mag(err[i])/tol);
65 absTol_(n_, dict.lookupOrDefault<scalar>(
"absTol", small)),
66 relTol_(n_, dict.lookupOrDefault<scalar>(
"relTol", 1
e-4)),
67 maxSteps_(dict.lookupOrDefault<scalar>(
"maxSteps", 10000))
96 <<
"Specified number of equations " <<
odes_.
nEqns()
97 <<
" greater than maximum " <<
maxN_ 124 solve(x, y, li, step);
158 scalar dxTry0 = step.
dxTry;
163 if ((x + step.
dxTry - xEnd)*(x + step.
dxTry - xStart) > 0)
170 solve(x, y, li, step);
173 if ((x - xEnd)*(xEnd - xStart) >= 0)
175 if (nStep > 0 && step.
last)
195 <<
"Integration steps greater than maximum " << maxSteps_ <<
nl 196 <<
" xStart = " << xStart <<
", xEnd = " << xEnd
197 <<
", x = " << x <<
", dxDid = " << step.
dxDid <<
nl
ODESolver(const ODESystem &ode, const dictionary &dict)
Construct for given ODESystem.
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Abstract base class for the systems of ordinary differential equations.
virtual bool resize()=0
Resize the ODE solver.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar normaliseError(const scalarField &y0, const scalarField &y, const scalarField &err) const
Return the normalised scalar error.
const ODESystem & odes_
Reference to ODESystem.
label maxSteps_
The maximum number of sub-steps allowed for the integration step.
errorManip< error > abort(error &err)
const label maxN_
Maximum size of the ODESystem.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
virtual void solve(scalar &x, scalarField &y, const label li, scalar &dxTry) const
Solve the ODE system from the current state xStart, y.
scalarField relTol_
Relative convergence tolerance per step.
scalarField absTol_
Absolute convergence tolerance per step.
dimensioned< scalar > mag(const dimensioned< Type > &)
static void resizeField(UList< Type > &f, const label n)
const doubleScalar e
Elementary charge.
virtual label nEqns() const =0
Return the number of equations in the system.
label n_
Size of the ODESystem (adjustable)