RKCK45.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::RKCK45
26 
27 Description
28  4/5th Order Cash-Karp Runge-Kutta ODE solver.
29 
30  References:
31  \verbatim
32  "A variable order Runge-Kutta method for initial value problems
33  with rapidly varying right-hand sides"
34  Cash, J.R.,
35  Karp, A.H.
36  ACM Transactions on Mathematical Software, vol. 16, 1990, pp. 201–222.
37 
38  "Solving Ordinary Differential Equations I: Nonstiff Problems,
39  second edition",
40  Hairer, E.,
41  Nørsett, S.,
42  Wanner, G.,
43  Springer-Verlag, Berlin. 1993, ISBN 3-540-56670-8.
44  \endverbatim
45 
46 SourceFiles
47  RKCK45.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef RKCK45_H
52 #define RKCK45_H
53 
54 #include "ODESolver.H"
55 #include "adaptiveSolver.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class RKCK45 Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class RKCK45
67 :
68  public ODESolver,
69  public adaptiveSolver
70 {
71  // Private data
72 
73  //- RKCK Constants
74  static const scalar
75  c2, c3, c4, c5, c6,
76  a21, a31, a32, a41, a42, a43, a51, a52, a53, a54,
77  a61, a62, a63, a64, a65,
78  b1, b3, b4, b6,
79  e1, e3, e4, e5, e6;
80 
81  // Temporary fields
83  mutable scalarField k2_;
84  mutable scalarField k3_;
85  mutable scalarField k4_;
86  mutable scalarField k5_;
87  mutable scalarField k6_;
88 
89  //- Error-estimate field
90  mutable scalarField err_;
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("RKCK45");
97 
98 
99  // Constructors
100 
101  //- Construct from ODE
102  RKCK45(const ODESystem& ode, const dictionary& dict);
103 
104 
105  // Member Functions
106 
107  //- Inherit solve from ODESolver
108  using ODESolver::solve;
109 
110  //- Solve a single step dx and return the error
111  scalar solve
112  (
113  const scalar x0,
114  const scalarField& y0,
115  const scalarField& dydx0,
116  const scalar dx,
117  scalarField& y
118  ) const;
119 
120  //- Solve the ODE system and the update the state
121  void solve
122  (
123  scalar& x,
124  scalarField& y,
125  scalar& dxTry
126  ) const;
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
Foam::RKCK45::a53
static const scalar a53
Definition: RKCK45.H:75
Foam::RKCK45::b6
static const scalar b6
Definition: RKCK45.H:77
Foam::ODESolver
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Foam::RKCK45::a65
static const scalar a65
Definition: RKCK45.H:76
Foam::RKCK45::k6_
scalarField k6_
Definition: RKCK45.H:86
Foam::RKCK45::a63
static const scalar a63
Definition: RKCK45.H:76
Foam::RKCK45::k4_
scalarField k4_
Definition: RKCK45.H:84
Foam::RKCK45::k3_
scalarField k3_
Definition: RKCK45.H:83
Foam::RKCK45::e3
static const scalar e3
Definition: RKCK45.H:78
Foam::RKCK45::a31
static const scalar a31
Definition: RKCK45.H:75
Foam::RKCK45::k2_
scalarField k2_
Definition: RKCK45.H:82
Foam::RKCK45::a51
static const scalar a51
Definition: RKCK45.H:75
Foam::RKCK45::a41
static const scalar a41
Definition: RKCK45.H:75
Foam::RKCK45::a54
static const scalar a54
Definition: RKCK45.H:75
adaptiveSolver.H
Foam::RKCK45::c2
static const scalar c2
RKCK Constants.
Definition: RKCK45.H:74
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::RKCK45::RKCK45
RKCK45(const ODESystem &ode, const dictionary &dict)
Construct from ODE.
Definition: RKCK45.C:74
Foam::RKCK45::b4
static const scalar b4
Definition: RKCK45.H:77
Foam::RKCK45::a21
static const scalar a21
Definition: RKCK45.H:75
Foam::RKCK45
4/5th Order Cash-Karp Runge-Kutta ODE solver.
Definition: RKCK45.H:65
Foam::RKCK45::a61
static const scalar a61
Definition: RKCK45.H:76
Foam::RKCK45::a64
static const scalar a64
Definition: RKCK45.H:76
Foam::y0
dimensionedScalar y0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
Foam::RKCK45::c3
static const scalar c3
Definition: RKCK45.H:74
Foam::RKCK45::err_
scalarField err_
Error-estimate field.
Definition: RKCK45.H:89
Foam::RKCK45::a32
static const scalar a32
Definition: RKCK45.H:75
Foam::ode
An ODE solver for chemistry.
Definition: ode.H:50
Foam::RKCK45::k5_
scalarField k5_
Definition: RKCK45.H:85
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::RKCK45::e4
static const scalar e4
Definition: RKCK45.H:78
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
ODESolver.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::RKCK45::TypeName
TypeName("RKCK45")
Runtime type information.
Foam::RKCK45::a62
static const scalar a62
Definition: RKCK45.H:76
Foam::RKCK45::b1
static const scalar b1
Definition: RKCK45.H:77
Foam::RKCK45::c5
static const scalar c5
Definition: RKCK45.H:74
Foam::RKCK45::c6
static const scalar c6
Definition: RKCK45.H:74
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
Foam::RKCK45::e5
static const scalar e5
Definition: RKCK45.H:78
Foam::RKCK45::a43
static const scalar a43
Definition: RKCK45.H:75
Foam::RKCK45::c4
static const scalar c4
Definition: RKCK45.H:74
Foam::ODESolver::solve
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible upto dxTry.
Definition: ODESolver.H:178
Foam::RKCK45::e1
static const scalar e1
Definition: RKCK45.H:78
Foam::RKCK45::e6
static const scalar e6
Definition: RKCK45.H:78
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::RKCK45::a42
static const scalar a42
Definition: RKCK45.H:75
Foam::RKCK45::solve
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.
Definition: RKCK45.C:91
Foam::RKCK45::a52
static const scalar a52
Definition: RKCK45.H:75
Foam::RKCK45::yTemp_
scalarField yTemp_
Definition: RKCK45.H:81
Foam::RKCK45::b3
static const scalar b3
Definition: RKCK45.H:77
Foam::adaptiveSolver
Definition: adaptiveSolver.H:47
y
scalar y
Definition: LISASMDCalcMethod1.H:14