Public Member Functions | Private Attributes | Static Private Attributes
RKF45 Class Reference

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

Inheritance diagram for RKF45:
Inheritance graph
[legend]
Collaboration diagram for RKF45:
Collaboration graph
[legend]

Public Member Functions

 TypeName ("RKF45")
 Runtime type information. More...
 
 RKF45 (const ODESystem &ode, const dictionary &dict)
 Construct from ODE. More...
 
scalar solve (const scalar x0, const scalarField &y0, const scalarField &dydx0, const scalar dx, scalarField &y) const
 Solve a single step dx and return the error. More...
 
void solve (scalar &x, scalarField &y, scalar &dxTry) const
 Solve the ODE system and the update the state. More...
 
virtual void solve (scalar &x, scalarField &y, scalar &dxTry) const
 Inherit solve from ODESolver. More...
 
virtual void solve (scalar &x, scalarField &y, stepState &step) const
 Inherit solve from ODESolver. More...
 
virtual void solve (const scalar xStart, const scalar xEnd, scalarField &y, 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...
 
virtual ~ODESolver ()
 Destructor. More...
 
scalarFieldabsTol ()
 
scalarFieldrelTol ()
 
virtual void solve (scalar &x, scalarField &y, stepState &step) const
 Solve the ODE system as far as possible upto 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...
 
- Public Member Functions inherited from adaptiveSolver
 adaptiveSolver (const ODESystem &ode, const dictionary &dict)
 Construct from ODESystem. More...
 
virtual ~adaptiveSolver ()
 Destructor. More...
 
void solve (const ODESystem &ode, scalar &x, scalarField &y, scalar &dxTry) const
 Solve the ODE system and the update the state. More...
 

Private Attributes

scalarField yTemp_
 
scalarField k2_
 
scalarField k3_
 
scalarField k4_
 
scalarField k5_
 
scalarField k6_
 
scalarField err_
 Error-estimate field. More...
 

Static Private Attributes

static const scalar c2 = 1.0/4.0
 RKF45 Constants. More...
 
static const scalar c3 = 3.0/8.0
 
static const scalar c4 = 12.0/13.0
 
static const scalar c5 = 1.0
 
static const scalar c6 = 1.0/2.0
 
static const scalar a21 = 1.0/4.0
 
static const scalar a31 = 3.0/32.0
 
static const scalar a32 = 9.0/32.0
 
static const scalar a41 = 1932.0/2197.0
 
static const scalar a42 = -7200.0/2197.0
 
static const scalar a43 = 7296.0/2197.0
 
static const scalar a51 = 439.0/216.0
 
static const scalar a52 = -8.0
 
static const scalar a53 = 3680.0/513.0
 
static const scalar a54 = -845.0/4104.0
 
static const scalar a61 = -8.0/27.0
 
static const scalar a62 = 2.0
 
static const scalar a63 = -3544.0/2565.0
 
static const scalar a64 = 1859.0/4104.0
 
static const scalar a65 = -11.0/40.0
 
static const scalar b1 = 16.0/135.0
 
static const scalar b3 = 6656.0/12825.0
 
static const scalar b4 = 28561.0/56430.0
 
static const scalar b5 = -9.0/50.0
 
static const scalar b6 = 2.0/55.0
 
static const scalar e1 = 25.0/216.0 - RKF45::b1
 
static const scalar e3 = 1408.0/2565.0 - RKF45::b3
 
static const scalar e4 = 2197.0/4104.0 - RKF45::b4
 
static const scalar e5 = -1.0/5.0 - RKF45::b5
 
static const scalar e6 = -RKF45::b6
 

Additional Inherited Members

- Static Public Member Functions inherited from ODESolver
static autoPtr< ODESolverNew (const ODESystem &ode, const dictionary &dict)
 Select null constructed. More...
 
- Protected Member Functions inherited from ODESolver
scalar normalizeError (const scalarField &y0, const scalarField &y, const scalarField &err) const
 Return the nomalized scalar error. More...
 
 ODESolver (const ODESolver &)
 Disallow default bitwise copy construct. More...
 
void operator= (const ODESolver &)
 Disallow default bitwise assignment. More...
 
- Protected Attributes inherited from ODESolver
const ODESystemodes_
 Reference to ODESystem. More...
 
label n_
 Size of the ODESystem. 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:

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

    "Solving Ordinary Differential Equations I: Nonstiff Problems,
     second edition",
    Hairer, E.,
    Nørsett, S.,
    Wanner, G.,
    Springer-Verlag, Berlin. 1993, ISBN 3-540-56670-8.

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

Source files

Definition at line 68 of file RKF45.H.

Constructor & Destructor Documentation

◆ RKF45()

RKF45 ( const ODESystem ode,
const dictionary dict 
)

Construct from ODE.

Definition at line 75 of file RKF45.C.

Member Function Documentation

◆ TypeName()

TypeName ( "RKF45"  )

Runtime type information.

◆ solve() [1/5]

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

Solve a single step dx and return the error.

Implements adaptiveSolver.

Definition at line 92 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,
scalar &  dxTry 
) const
virtual

Solve the ODE system and the update the state.

Reimplemented from ODESolver.

Definition at line 160 of file RKF45.C.

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

Here is the call graph for this function:

◆ solve() [3/5]

virtual void solve
inline

Inherit solve from ODESolver.

Definition at line 178 of file ODESolver.H.

◆ solve() [4/5]

void solve

Inherit solve from ODESolver.

Definition at line 86 of file ODESolver.C.

◆ solve() [5/5]

void solve

Inherit solve from ODESolver.

Definition at line 99 of file ODESolver.C.

Field Documentation

◆ c2

const scalar c2 = 1.0/4.0
staticprivate

RKF45 Constants.

Definition at line 77 of file RKF45.H.

◆ c3

const scalar c3 = 3.0/8.0
staticprivate

Definition at line 77 of file RKF45.H.

◆ c4

const scalar c4 = 12.0/13.0
staticprivate

Definition at line 77 of file RKF45.H.

◆ c5

const scalar c5 = 1.0
staticprivate

Definition at line 77 of file RKF45.H.

◆ c6

const scalar c6 = 1.0/2.0
staticprivate

Definition at line 77 of file RKF45.H.

◆ a21

const scalar a21 = 1.0/4.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a31

const scalar a31 = 3.0/32.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a32

const scalar a32 = 9.0/32.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a41

const scalar a41 = 1932.0/2197.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a42

const scalar a42 = -7200.0/2197.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a43

const scalar a43 = 7296.0/2197.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a51

const scalar a51 = 439.0/216.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a52

const scalar a52 = -8.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a53

const scalar a53 = 3680.0/513.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a54

const scalar a54 = -845.0/4104.0
staticprivate

Definition at line 78 of file RKF45.H.

◆ a61

const scalar a61 = -8.0/27.0
staticprivate

Definition at line 79 of file RKF45.H.

◆ a62

const scalar a62 = 2.0
staticprivate

Definition at line 79 of file RKF45.H.

◆ a63

const scalar a63 = -3544.0/2565.0
staticprivate

Definition at line 79 of file RKF45.H.

◆ a64

const scalar a64 = 1859.0/4104.0
staticprivate

Definition at line 79 of file RKF45.H.

◆ a65

const scalar a65 = -11.0/40.0
staticprivate

Definition at line 79 of file RKF45.H.

◆ b1

const scalar b1 = 16.0/135.0
staticprivate

Definition at line 80 of file RKF45.H.

◆ b3

const scalar b3 = 6656.0/12825.0
staticprivate

Definition at line 80 of file RKF45.H.

◆ b4

const scalar b4 = 28561.0/56430.0
staticprivate

Definition at line 80 of file RKF45.H.

◆ b5

const scalar b5 = -9.0/50.0
staticprivate

Definition at line 80 of file RKF45.H.

◆ b6

const scalar b6 = 2.0/55.0
staticprivate

Definition at line 80 of file RKF45.H.

◆ e1

const scalar e1 = 25.0/216.0 - RKF45::b1
staticprivate

Definition at line 81 of file RKF45.H.

◆ e3

const scalar e3 = 1408.0/2565.0 - RKF45::b3
staticprivate

Definition at line 81 of file RKF45.H.

◆ e4

const scalar e4 = 2197.0/4104.0 - RKF45::b4
staticprivate

Definition at line 81 of file RKF45.H.

◆ e5

const scalar e5 = -1.0/5.0 - RKF45::b5
staticprivate

Definition at line 81 of file RKF45.H.

◆ e6

const scalar e6 = -RKF45::b6
staticprivate

Definition at line 81 of file RKF45.H.

◆ yTemp_

scalarField yTemp_
mutableprivate

Definition at line 85 of file RKF45.H.

◆ k2_

scalarField k2_
mutableprivate

Definition at line 86 of file RKF45.H.

◆ k3_

scalarField k3_
mutableprivate

Definition at line 87 of file RKF45.H.

◆ k4_

scalarField k4_
mutableprivate

Definition at line 88 of file RKF45.H.

◆ k5_

scalarField k5_
mutableprivate

Definition at line 89 of file RKF45.H.

◆ k6_

scalarField k6_
mutableprivate

Definition at line 90 of file RKF45.H.

◆ err_

scalarField err_
mutableprivate

Error-estimate field.

Definition at line 93 of file RKF45.H.


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