54 maxErr =
max(maxErr,
mag(err[i])/tol);
68 absTol_(n_,
dict.getOrDefault<scalar>(
"absTol", SMALL)),
69 relTol_(n_,
dict.getOrDefault<scalar>(
"relTol", 1
e-4)),
70 maxSteps_(
dict.getOrDefault<label>(
"maxSteps", 10000))
94 if (odes_.nEqns() != n_)
96 if (odes_.nEqns() > maxN_)
99 <<
"Specified number of equations " << odes_.nEqns()
100 <<
" greater than maximum " << maxN_
106 resizeField(absTol_);
107 resizeField(relTol_);
150 stepState step(dxTry);
153 for (label nStep=0; nStep<maxSteps_; ++nStep)
156 scalar dxTry0 = step.
dxTry;
161 if ((
x + step.
dxTry - xEnd)*(
x + step.
dxTry - xStart) > 0)
171 if ((
x - xEnd)*(xEnd - xStart) >= 0)
173 if (nStep > 0 && step.
last)
193 <<
"Integration steps greater than maximum " << maxSteps_ <<
nl 194 <<
" xStart = " << xStart <<
", xEnd = " << xEnd
195 <<
", x = " <<
x <<
", dxDid = " << step.
dxDid <<
nl virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible up to dxTry.
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)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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.
constexpr char nl
The newline '\n' character (0x0a)
dimensionedScalar y0(const dimensionedScalar &ds)
An ODE solver for chemistry.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
errorManip< error > abort(error &err)
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
scalarField relTol_
Relative convergence tolerance per step.
scalar normalizeError(const scalarField &y0, const scalarField &y, const scalarField &err) const
Return the nomalized scalar error.
Abstract base-class for ODE system solvers.
scalarField absTol_
Absolute convergence tolerance per step.
ODESolver(const ODESolver &)=delete
No copy construct.