ODESolver Class Referenceabstract

Abstract base-class for ODE system solvers. More...

Inheritance diagram for ODESolver:
[legend]
Collaboration diagram for ODESolver:
[legend]

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...
 
virtual ~ODESolver ()=default
 Destructor. More...
 
label nEqns () const
 Return the number of equations to solve. More...
 
scalarFieldabsTol ()
 Return access to the absolute tolerance field. More...
 
scalarFieldrelTol ()
 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...
 

Static Public Member Functions

static autoPtr< ODESolverNew (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...
 
 ODESolver (const ODESolver &)=delete
 No copy construct. More...
 
void operator= (const ODESolver &)=delete
 No copy assignment. More...
 

Protected Attributes

const ODESystemodes_
 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
 

Detailed Description

Abstract base-class for ODE system solvers.

Source files

Definition at line 56 of file ODESolver.H.

Constructor & Destructor Documentation

◆ ODESolver() [1/3]

ODESolver ( const ODESolver )
protecteddelete

No copy construct.

◆ ODESolver() [2/3]

ODESolver ( const ODESystem ode,
const dictionary dict 
)

Construct for given ODESystem.

Definition at line 63 of file ODESolver.C.

◆ ODESolver() [3/3]

ODESolver ( const ODESystem ode,
const scalarField absTol,
const scalarField relTol 
)

Construct for given ODESystem specifying tolerances.

Definition at line 74 of file ODESolver.C.

◆ ~ODESolver()

virtual ~ODESolver ( )
virtualdefault

Destructor.

Member Function Documentation

◆ normalizeError()

Foam::scalar normalizeError ( const scalarField y0,
const scalarField y,
const scalarField err 
) const
protected

Return the nomalized scalar error.

Definition at line 42 of file ODESolver.C.

References ODESolver::absTol_, forAll, Foam::mag(), Foam::max(), ODESolver::relTol_, y, and Foam::y0().

Here is the call graph for this function:

◆ operator=()

void operator= ( const ODESolver )
protecteddelete

No copy assignment.

◆ TypeName()

TypeName ( "ODESolver"  )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr  ,
ODESolver  ,
dictionary  ,
(const ODESystem &ode, const dictionary &dict ,
(ode, dict  
)

◆ New()

Foam::autoPtr< Foam::ODESolver > New ( const ODESystem ode,
const dictionary dict 
)
static

Select null constructed.

Definition at line 33 of file ODESolverNew.C.

References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, dictionary::get(), and Foam::Info.

Here is the call graph for this function:

◆ nEqns()

Foam::label nEqns ( ) const
inline

Return the number of equations to solve.

Definition at line 31 of file ODESolverI.H.

References ODESolver::n_.

◆ absTol()

Foam::scalarField & absTol ( )
inline

Return access to the absolute tolerance field.

Definition at line 37 of file ODESolverI.H.

◆ relTol()

Foam::scalarField & relTol ( )
inline

Return access to the relative tolerance field.

Definition at line 43 of file ODESolverI.H.

◆ resize()

bool resize ( )
pure virtual

Resize the ODE solver.

Implemented in Euler, EulerSI, RKCK45, RKDP45, RKF45, rodas23, rodas34, Rosenbrock12, Rosenbrock23, Rosenbrock34, seulex, SIBS, and Trapezoid.

Definition at line 92 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resizeField() [1/2]

void resizeField ( UList< Type > &  f,
const label  n 
)
inlinestatic

Definition at line 50 of file ODESolverI.H.

References UList< T >::begin(), f(), n, and List< T >::shallowCopy().

Referenced by adaptiveSolver::resize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resizeField() [2/2]

void resizeField ( UList< Type > &  f) const
inline

Definition at line 57 of file ODESolverI.H.

References f().

Here is the call graph for this function:

◆ resizeMatrix()

void resizeMatrix ( scalarSquareMatrix m) const
inline

Definition at line 63 of file ODESolverI.H.

References SquareMatrix< Type >::shallowResize().

Here is the call graph for this function:

◆ solve() [1/3]

void solve ( scalar &  x,
scalarField y,
scalar &  dxTry 
) const
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 Euler, Euler, EulerSI, EulerSI, RKCK45, RKCK45, RKDP45, RKDP45, RKF45, RKF45, rodas23, rodas23, rodas34, rodas34, Rosenbrock12, Rosenbrock12, Rosenbrock23, Rosenbrock23, Rosenbrock34, Rosenbrock34, SIBS, Trapezoid, and Trapezoid.

Definition at line 116 of file ODESolver.C.

References ODESolver::stepState::dxTry, solve(), x, and y.

Here is the call graph for this function:

◆ solve() [2/3]

void solve ( scalar &  x,
scalarField y,
stepState step 
) const
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 Euler, EulerSI, RKCK45, RKDP45, RKF45, rodas23, rodas34, Rosenbrock12, Rosenbrock23, Rosenbrock34, seulex, and Trapezoid.

Definition at line 129 of file ODESolver.C.

References ODESolver::stepState::dxDid, ODESolver::stepState::dxTry, solve(), x, and y.

Here is the call graph for this function:

◆ solve() [3/3]

void solve ( const scalar  xStart,
const scalar  xEnd,
scalarField y,
scalar &  dxEst 
) const
virtual

Solve the ODE system from xStart to xEnd, update the state.

and return an estimate for the next step in dxTry

Reimplemented in Euler, EulerSI, RKCK45, RKDP45, RKF45, rodas23, rodas34, Rosenbrock12, Rosenbrock23, Rosenbrock34, and Trapezoid.

Definition at line 142 of file ODESolver.C.

References ODESolver::stepState::dxDid, ODESolver::stepState::dxTry, FatalErrorInFunction, ODESolver::stepState::first, ODESolver::stepState::last, Foam::nl, ODESolver::stepState::prevReject, ODESolver::stepState::reject, solve(), x, and y.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ ODESystem

friend class ODESystem
friend

Definition at line 101 of file ODESolver.H.

Member Data Documentation

◆ odes_

const ODESystem& odes_
protected

Reference to ODESystem.

Definition at line 64 of file ODESolver.H.

◆ maxN_

const label maxN_
protected

Maximum size of the ODESystem.

Definition at line 67 of file ODESolver.H.

◆ n_

label n_
mutableprotected

Size of the ODESystem (adjustable)

Definition at line 70 of file ODESolver.H.

Referenced by ODESolver::nEqns().

◆ absTol_

scalarField absTol_
protected

Absolute convergence tolerance per step.

Definition at line 73 of file ODESolver.H.

Referenced by ODESolver::normalizeError().

◆ relTol_

scalarField relTol_
protected

Relative convergence tolerance per step.

Definition at line 76 of file ODESolver.H.

Referenced by ODESolver::normalizeError().

◆ maxSteps_

label maxSteps_
protected

The maximum number of sub-steps allowed for the integration step.

Definition at line 79 of file ODESolver.H.


The documentation for this class was generated from the following files: