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, scalar &dxTry) const |
Solve the ODE system as far as possible up to dxTry. More... | |
virtual void | solve (scalar &x, scalarField &y, stepState &step) const |
Solve the ODE system as far as possible up to dxTry. More... | |
virtual void | solve (const scalar xStart, const scalar xEnd, scalarField &y, scalar &dxEst) const |
Solve the ODE system from xStart to xEnd, update the state. 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 | normalizeError (const scalarField &y0, const scalarField &y, const scalarField &err) const |
Return the nomalized 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.
Referenced by ODESolver::stepState::stepState().
ODESolver | ( | const ODESystem & | ode, |
const scalarField & | absTol, | ||
const scalarField & | relTol | ||
) |
Construct for given ODESystem specifying tolerances.
Definition at line 72 of file ODESolver.C.
|
inlinevirtual |
Destructor.
Definition at line 159 of file ODESolver.H.
References ODESolver::absTol(), ODESolver::stepState::dxTry, f(), n, ODESolver::nEqns(), ODESolver::operator=(), ODESolver::relTol(), ODESolver::resize(), ODESolver::resizeField(), ODESolver::resizeMatrix(), ODESolver::solve(), x, and y.
|
protected |
Return the nomalized scalar error.
Definition at line 40 of file ODESolver.C.
References forAll, Foam::mag(), and Foam::max().
Referenced by Trapezoid::solve(), Euler::solve(), EulerSI::solve(), Rosenbrock12::solve(), Rosenbrock23::solve(), rodas23::solve(), RKCK45::solve(), rodas34::solve(), RKDP45::solve(), RKF45::solve(), and Rosenbrock34::solve().
TypeName | ( | "ODESolver" | ) |
Runtime type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
ODESolver | , | ||
dictionary | , | ||
(const ODESystem &ode, const dictionary &dict) | , | ||
(ode, dict) | |||
) |
|
static |
Select null constructed.
Definition at line 31 of file ODESolverNew.C.
References dict, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::Info, dictionary::lookup(), and Foam::nl.
Referenced by ODESolver::stepState::stepState().
|
inline |
Return the number of equations to solve.
Definition at line 29 of file ODESolverI.H.
References ODESolver::n_.
Referenced by ODESolver::~ODESolver().
|
inline |
Return access to the absolute tolerance field.
Definition at line 35 of file ODESolverI.H.
References ODESolver::absTol_.
Referenced by ODESolver::stepState::stepState(), and ODESolver::~ODESolver().
|
inline |
Return access to the relative tolerance field.
Definition at line 41 of file ODESolverI.H.
References ODESolver::relTol_.
Referenced by ODESolver::stepState::stepState(), and ODESolver::~ODESolver().
|
pure virtual |
Resize the ODE solver.
Implemented in seulex, SIBS, Rosenbrock34, RKF45, RKDP45, RKCK45, rodas34, rodas23, Rosenbrock23, Rosenbrock12, EulerSI, Euler, and Trapezoid.
Definition at line 89 of file ODESolver.C.
References Foam::abort(), ODESolver::absTol_, Foam::FatalError, FatalErrorInFunction, ODESolver::maxN_, ODESolver::n_, ODESystem::nEqns(), ODESolver::odes_, ODESolver::relTol_, ODESolver::resizeField(), and ODESolver::solve().
Referenced by Trapezoid::resize(), Euler::resize(), EulerSI::resize(), Rosenbrock12::resize(), Rosenbrock23::resize(), rodas23::resize(), rodas34::resize(), RKCK45::resize(), RKDP45::resize(), RKF45::resize(), Rosenbrock34::resize(), SIBS::resize(), seulex::resize(), and ODESolver::~ODESolver().
Definition at line 48 of file ODESolverI.H.
References UList< T >::begin(), n, and UList< T >::shallowCopy().
Referenced by adaptiveSolver::resize(), Trapezoid::resize(), Euler::resize(), EulerSI::resize(), Rosenbrock12::resize(), rodas23::resize(), Rosenbrock23::resize(), rodas34::resize(), RKCK45::resize(), RKDP45::resize(), RKF45::resize(), Rosenbrock34::resize(), SIBS::resize(), seulex::resize(), ODESolver::resize(), ODESolver::resizeField(), and ODESolver::~ODESolver().
|
inline |
Definition at line 55 of file ODESolverI.H.
References ODESolver::n_, and ODESolver::resizeField().
|
inline |
Definition at line 61 of file ODESolverI.H.
References ODESolver::n_, and SquareMatrix< Type >::shallowResize().
Referenced by EulerSI::resize(), Rosenbrock12::resize(), rodas23::resize(), Rosenbrock23::resize(), rodas34::resize(), Rosenbrock34::resize(), SIBS::resize(), seulex::resize(), and ODESolver::~ODESolver().
|
virtual |
Solve the ODE system 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 SIBS, Rosenbrock34, RKF45, RKDP45, RKCK45, rodas34, rodas23, Rosenbrock23, Rosenbrock12, EulerSI, Euler, and Trapezoid.
Definition at line 116 of file ODESolver.C.
References ODESolver::stepState::dxTry.
Referenced by ODESolver::resize(), ODESolver::solve(), Euler::~Euler(), EulerSI::~EulerSI(), ODESolver::~ODESolver(), RKCK45::~RKCK45(), RKDP45::~RKDP45(), RKF45::~RKF45(), rodas23::~rodas23(), rodas34::~rodas34(), Rosenbrock12::~Rosenbrock12(), Rosenbrock23::~Rosenbrock23(), Rosenbrock34::~Rosenbrock34(), and Trapezoid::~Trapezoid().
|
virtual |
Solve the ODE system 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 seulex.
Definition at line 129 of file ODESolver.C.
References ODESolver::stepState::dxDid, ODESolver::stepState::dxTry, ODESolver::solve(), and x.
|
virtual |
Solve the ODE system from xStart to xEnd, update the state.
and return an estimate for the next step in dxTry
Definition at line 142 of file ODESolver.C.
References ODESolver::stepState::dxDid, ODESolver::stepState::dxTry, Foam::exit(), Foam::FatalError, FatalErrorInFunction, ODESolver::stepState::first, ODESolver::stepState::last, ODESolver::maxSteps_, Foam::nl, ODESolver::stepState::prevReject, ODESolver::stepState::reject, ODESolver::solve(), and x.
|
delete |
Disallow default bitwise assignment.
Referenced by ODESolver::~ODESolver().
|
friend |
Definition at line 89 of file ODESolver.H.
|
protected |
Reference to ODESystem.
Definition at line 58 of file ODESolver.H.
Referenced by ODESolver::resize(), seulex::seulex(), Trapezoid::solve(), EulerSI::solve(), Euler::solve(), Rosenbrock12::solve(), Rosenbrock23::solve(), rodas23::solve(), rodas34::solve(), RKCK45::solve(), RKDP45::solve(), RKF45::solve(), Rosenbrock34::solve(), SIBS::solve(), and seulex::solve().
|
protected |
Maximum size of the ODESystem.
Definition at line 61 of file ODESolver.H.
Referenced by ODESolver::resize().
|
mutableprotected |
Size of the ODESystem (adjustable)
Definition at line 64 of file ODESolver.H.
Referenced by ODESolver::nEqns(), Trapezoid::resize(), Euler::resize(), EulerSI::resize(), Rosenbrock12::resize(), Rosenbrock23::resize(), rodas23::resize(), RKCK45::resize(), rodas34::resize(), RKDP45::resize(), RKF45::resize(), Rosenbrock34::resize(), seulex::resize(), ODESolver::resize(), ODESolver::resizeField(), ODESolver::resizeMatrix(), seulex::seulex(), EulerSI::solve(), Rosenbrock12::solve(), Rosenbrock23::solve(), rodas23::solve(), rodas34::solve(), Rosenbrock34::solve(), SIBS::solve(), and seulex::solve().
|
protected |
Absolute convergence tolerance per step.
Definition at line 67 of file ODESolver.H.
Referenced by ODESolver::absTol(), ODESolver::resize(), SIBS::solve(), and seulex::solve().
|
protected |
Relative convergence tolerance per step.
Definition at line 70 of file ODESolver.H.
Referenced by ODESolver::relTol(), ODESolver::resize(), SIBS::solve(), and seulex::solve().
|
protected |
The maximum number of sub-steps allowed for the integration step.
Definition at line 73 of file ODESolver.H.
Referenced by ODESolver::solve().