RKF45 Class Reference

4/5th Order Runge-Kutta-Fehlberg ODE solver More...

Inheritance diagram for RKF45:
Collaboration diagram for RKF45:

Public Member Functions

 TypeName ("RKF45")
 Runtime type information. More...
 
 RKF45 (const ODESystem &ode, const dictionary &dict)
 Construct from ODESystem. More...
 
virtual ~RKF45 ()
 Destructor. More...
 
virtual bool resize ()
 Resize the ODE solver. More...
 
virtual scalar solve (const scalar x0, const scalarField &y0, const label li, const scalarField &dydx0, const scalar dx, scalarField &y) const
 Solve a single step dx and return the error. More...
 
virtual void solve (scalar &x, scalarField &y, const label li, scalar &dxTry) const
 Solve the ODE system and the update the state. More...
 
virtual void solve (scalar &x, scalarField &y, const label li, scalar &dxTry) const
 Inherit solve from ODESolver. More...
 
virtual void solve (scalar &x, scalarField &y, const label li, stepState &step) const
 Inherit solve from ODESolver. More...
 
virtual void solve (const scalar xStart, const scalar xEnd, scalarField &y, const label li, scalar &dxEst) const
 Inherit solve from ODESolver. More...
 
- Public Member Functions inherited from ODESolver
 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...
 
scalarFieldabsTol ()
 Return access to the absolute tolerance field. More...
 
scalarFieldrelTol ()
 Return access to the relative tolerance field. 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, 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...
 
- Public Member Functions inherited from adaptiveSolver
 adaptiveSolver (const ODESystem &ode, const dictionary &dict)
 Construct from ODESystem. More...
 
virtual ~adaptiveSolver ()
 Destructor. More...
 
bool resize (const label n)
 Resize the ODE solver. More...
 
void solve (const ODESystem &ode, scalar &x, scalarField &y, const label li, scalar &dxTry) const
 Solve the ODE system and the update the state. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ODESolver
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 inherited from ODESolver
scalar normaliseError (const scalarField &y0, const scalarField &y, const scalarField &err) const
 Return the normalised scalar error. More...
 
- Protected Attributes inherited from ODESolver
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...
 

Detailed Description

4/5th Order Runge-Kutta-Fehlberg ODE solver

References:

    Fehlberg, E. (1969).
    Low-order classical Runge-Kutta formulas with stepsize control
    and their application to some heat transfer problems.
    NASA Technical Report 315.

    Hairer, E., Nørsett, S. P., & Wanner, G. (1993).
    Solving Ordinary Differential Equations I: Nonstiff Problems,
    second edition.
    Springer-Verlag, Berlin.

This method embeds the 4-th order integration step into the 5-th order step and allows to perform an adaptive step-size control using these two order without the need of re-evaluation.

Source files

Definition at line 66 of file RKF45.H.

Constructor & Destructor Documentation

◆ RKF45()

RKF45 ( const ODESystem ode,
const dictionary dict 
)

Construct from ODESystem.

Definition at line 75 of file RKF45.C.

◆ ~RKF45()

virtual ~RKF45 ( )
inlinevirtual

Destructor.

Definition at line 107 of file RKF45.H.

Member Function Documentation

◆ TypeName()

TypeName ( "RKF45"  )

Runtime type information.

◆ resize()

bool resize ( )
virtual

Resize the ODE solver.

Implements ODESolver.

Definition at line 91 of file RKF45.C.

References ODESolver::resize(), and adaptiveSolver::resize().

Here is the call graph for this function:

◆ solve() [1/5]

Foam::scalar solve ( const scalar  x0,
const scalarField y0,
const label  li,
const scalarField dydx0,
const scalar  dx,
scalarField y 
) const
virtual

Solve a single step dx and return the error.

Implements adaptiveSolver.

Definition at line 114 of file RKF45.C.

References Foam::constant::physicoChemical::c2, forAll, y, and Foam::y0().

Here is the call graph for this function:

◆ solve() [2/5]

void solve ( scalar &  x,
scalarField y,
const label  li,
scalar &  dxTry 
) const
virtual

Solve the ODE system and the update the state.

Reimplemented from ODESolver.

Definition at line 183 of file RKF45.C.

References adaptiveSolver::solve(), x, and y.

Here is the call graph for this function:

◆ solve() [3/5]

void solve

Inherit solve from ODESolver.

Definition at line 190 of file ODESolver.C.

◆ solve() [4/5]

void solve

Inherit solve from ODESolver.

Definition at line 204 of file ODESolver.C.

◆ solve() [5/5]

void solve

Inherit solve from ODESolver.

Definition at line 215 of file ODESolver.C.


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