Abstract base-class for ODE system solvers. More...
Classes | |
class | stepState |
Public Member Functions | |
TypeName ("ODESolver") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, ODESolver, dictionary,(const ODESystem &ode, const dictionary &dict),(ode, dict)) | |
ODESolver (const ODESystem &ode, const dictionary &dict) | |
Construct for given ODESystem. More... | |
ODESolver (const ODESystem &ode, const scalarField &absTol, const scalarField &relTol) | |
Construct for given ODESystem specifying tolerances. More... | |
ODESolver (const ODESolver &)=delete | |
Disallow default bitwise copy construction. More... | |
virtual | ~ODESolver () |
Destructor. More... | |
label | nEqns () const |
Return the number of equations to solve. More... | |
scalarField & | absTol () |
Return access to the absolute tolerance field. More... | |
scalarField & | relTol () |
Return access to the relative tolerance field. More... | |
virtual bool | resize ()=0 |
Resize the ODE solver. More... | |
template<class Type > | |
void | resizeField (UList< Type > &f) const |
void | resizeMatrix (scalarSquareMatrix &m) const |
virtual void | solve (scalar &x, scalarField &y, const label li, scalar &dxTry) const |
Solve the ODE system from the current state xStart, y. More... | |
virtual void | solve (scalar &x, scalarField &y, const label li, stepState &step) const |
Solve the ODE system from the current state xStart, y. More... | |
virtual void | solve (const scalar xStart, const scalar xEnd, scalarField &y, const label li, scalar &dxEst) const |
Solve the ODE system from the current state xStart, y. More... | |
void | operator= (const ODESolver &)=delete |
Disallow default bitwise assignment. More... | |
Static Public Member Functions | |
static autoPtr< ODESolver > | New (const ODESystem &ode, const dictionary &dict) |
Select null constructed. More... | |
template<class Type > | |
static void | resizeField (UList< Type > &f, const label n) |
Protected Member Functions | |
scalar | normaliseError (const scalarField &y0, const scalarField &y, const scalarField &err) const |
Return the normalised scalar error. More... | |
Protected Attributes | |
const ODESystem & | odes_ |
Reference to ODESystem. More... | |
const label | maxN_ |
Maximum size of the ODESystem. More... | |
label | n_ |
Size of the ODESystem (adjustable) More... | |
scalarField | absTol_ |
Absolute convergence tolerance per step. More... | |
scalarField | relTol_ |
Relative convergence tolerance per step. More... | |
label | maxSteps_ |
The maximum number of sub-steps allowed for the integration step. More... | |
Friends | |
class | ODESystem |
ODESolver | ( | const ODESystem & | ode, |
const dictionary & | dict | ||
) |
Construct for given ODESystem.
Definition at line 60 of file ODESolver.C.
ODESolver | ( | const ODESystem & | ode, |
const scalarField & | absTol, | ||
const scalarField & | relTol | ||
) |
Construct for given ODESystem specifying tolerances.
Definition at line 71 of file ODESolver.C.
|
inlinevirtual |
Destructor.
Definition at line 159 of file ODESolver.H.
|
protected |
Return the normalised scalar error.
Definition at line 39 of file ODESolver.C.
References ODESolver::absTol_, forAll, Foam::mag(), Foam::max(), ODESolver::relTol_, y, and Foam::y0().
TypeName | ( | "ODESolver" | ) |
Runtime type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
ODESolver | , | ||
dictionary | , | ||
(const ODESystem &ode, const dictionary &dict) | , | ||
(ode, dict) | |||
) |
|
static |
Select null constructed.
Definition at line 30 of file ODESolverNew.C.
References dict, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::Info, and Foam::nl.
|
inline |
Return the number of equations to solve.
Definition at line 29 of file ODESolverI.H.
References ODESolver::n_.
|
inline |
Return access to the absolute tolerance field.
Definition at line 35 of file ODESolverI.H.
|
inline |
Return access to the relative tolerance field.
Definition at line 41 of file ODESolverI.H.
|
pure virtual |
Resize the ODE solver.
Implemented in Trapezoid, SIBS, seulex, Rosenbrock34, Rosenbrock23, Rosenbrock12, rodas34, rodas23, RKF45, RKDP45, RKCK45, EulerSI, and Euler.
Definition at line 89 of file ODESolver.C.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
Referenced by Euler::resize(), EulerSI::resize(), RKCK45::resize(), RKDP45::resize(), RKF45::resize(), rodas23::resize(), rodas34::resize(), Rosenbrock12::resize(), Rosenbrock23::resize(), Rosenbrock34::resize(), seulex::resize(), SIBS::resize(), and Trapezoid::resize().
Definition at line 48 of file ODESolverI.H.
References UList< T >::begin(), f(), n, and List< T >::shallowCopy().
Referenced by adaptiveSolver::resize().
|
inline |
Definition at line 55 of file ODESolverI.H.
References f().
|
inline |
Definition at line 61 of file ODESolverI.H.
References SquareMatrix< Type >::shallowResize().
|
virtual |
Solve the ODE system from the current state xStart, y.
and the optional index into the list of systems to solve li as far as possible up to dxTry adjusting the step as necessary to provide a solution within the specified tolerance. Update the state and return an estimate for the next step in dxTry
Reimplemented in Trapezoid, SIBS, Rosenbrock34, Rosenbrock23, Rosenbrock12, rodas34, rodas23, RKF45, RKDP45, RKCK45, EulerSI, and Euler.
Definition at line 115 of file ODESolver.C.
References ODESolver::stepState::dxTry, Foam::solve(), x, and y.
|
virtual |
Solve the ODE system from the current state xStart, y.
and the optional index into the list of systems to solve li as far as possible up to step.dxTry adjusting the step as necessary to provide a solution within the specified tolerance. Update the state and return the step actually taken in step.dxDid and an estimate for the next step in step.dxTry
Reimplemented in seulex.
Definition at line 129 of file ODESolver.C.
References ODESolver::stepState::dxDid, ODESolver::stepState::dxTry, Foam::solve(), x, and y.
|
virtual |
Solve the ODE system from the current state xStart, y.
and the optional index into the list of systems to solve li to xEnd and return an estimate for the next step in dxTry
Definition at line 143 of file ODESolver.C.
References ODESolver::stepState::dxTry, ODESolver::stepState::first, ODESolver::stepState::last, ODESolver::stepState::reject, Foam::solve(), x, and y.
|
delete |
Disallow default bitwise assignment.
|
friend |
Definition at line 89 of file ODESolver.H.
|
protected |
Reference to ODESystem.
Definition at line 58 of file ODESolver.H.
|
protected |
Maximum size of the ODESystem.
Definition at line 61 of file ODESolver.H.
|
mutableprotected |
Size of the ODESystem (adjustable)
Definition at line 64 of file ODESolver.H.
Referenced by ODESolver::nEqns().
|
protected |
Absolute convergence tolerance per step.
Definition at line 67 of file ODESolver.H.
Referenced by ODESolver::normaliseError().
|
protected |
Relative convergence tolerance per step.
Definition at line 70 of file ODESolver.H.
Referenced by ODESolver::normaliseError().
|
protected |
The maximum number of sub-steps allowed for the integration step.
Definition at line 73 of file ODESolver.H.