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))
91 if (odes_.nEqns() != n_)
93 if (odes_.nEqns() > maxN_)
96 <<
"Specified number of equations " << odes_.nEqns()
97 <<
" greater than maximum " << maxN_
103 resizeField(absTol_);
104 resizeField(relTol_);
155 for (
label nStep=0; nStep<maxSteps_; nStep++)
158 scalar dxTry0 = step.
dxTry;
163 if ((
x + step.
dxTry - xEnd)*(
x + step.
dxTry - xStart) > 0)
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
#define forAll(list, i)
Loop across all elements in list.
Abstract base-class for ODE system solvers.
scalarField absTol_
Absolute convergence tolerance per step.
ODESolver(const ODESystem &ode, const dictionary &dict)
Construct for given ODESystem.
scalarField relTol_
Relative convergence tolerance per step.
virtual void solve(scalar &x, scalarField &y, const label li, scalar &dxTry) const
Solve the ODE system from the current state xStart, y.
scalar normaliseError(const scalarField &y0, const scalarField &y, const scalarField &err) const
Return the normalised scalar error.
virtual bool resize()=0
Resize the ODE solver.
Abstract base class for the systems of ordinary differential equations.
A list of keyword definitions, which are a keyword followed by any number of values (e....
An ODE solver for chemistry.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedScalar y0(const dimensionedScalar &ds)
errorManip< error > abort(error &err)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.