RKDP45.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::RKDP45
26 
27 Description
28  4/5th Order Dormand–Prince Runge-Kutta ODE solver.
29 
30  References:
31  \verbatim
32  "A family of embedded Runge-Kutta formulae"
33  Dormand, J. R.,
34  Prince, P. J.,
35  Journal of Computational and Applied Mathematics,
36  6 (1), 1980: pp. 19-26.
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 SeeAlso
47  Foam::RKF45
48  Foam::RKCK45
49 
50 SourceFiles
51  RKDP45.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef RKDP45_H
56 #define RKDP45_H
57 
58 #include "ODESolver.H"
59 #include "adaptiveSolver.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class RKDP45 Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class RKDP45
71 :
72  public ODESolver,
73  public adaptiveSolver
74 {
75  // Private data
76 
77  //- RKDP Constants
78  static const scalar
79  c2, c3, c4, c5,
80  a21, a31, a32, a41, a42, a43, a51, a52, a53, a54,
81  a61, a62, a63, a64, a65,
82  b1, b3, b4, b5, b6,
83  e1, e3, e4, e5, e6, e7;
84 
85  // Temporary fields
87  mutable scalarField k2_;
88  mutable scalarField k3_;
89  mutable scalarField k4_;
90  mutable scalarField k5_;
91  mutable scalarField k6_;
92 
93  //- Error-estimate field
94  mutable scalarField err_;
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("RKDP45");
101 
102 
103  // Constructors
104 
105  //- Construct from ODE
106  RKDP45(const ODESystem& ode, const dictionary& dict);
107 
108 
109  // Member Functions
110 
111  //- Inherit solve from ODESolver
112  using ODESolver::solve;
113 
114  //- Solve a single step dx and return the error
115  scalar solve
116  (
117  const scalar x0,
118  const scalarField& y0,
119  const scalarField& dydx0,
120  const scalar dx,
121  scalarField& y
122  ) const;
123 
124  //- Solve the ODE system and the update the state
125  void solve
126  (
127  scalar& x,
128  scalarField& y,
129  scalar& dxTry
130  ) const;
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
Foam::RKDP45::e1
static const scalar e1
Definition: RKDP45.H:82
Foam::RKDP45::b4
static const scalar b4
Definition: RKDP45.H:81
Foam::ODESolver
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Foam::RKDP45::a53
static const scalar a53
Definition: RKDP45.H:79
Foam::RKDP45::k4_
scalarField k4_
Definition: RKDP45.H:88
Foam::RKDP45::a61
static const scalar a61
Definition: RKDP45.H:80
Foam::RKDP45::c5
static const scalar c5
Definition: RKDP45.H:78
Foam::RKDP45::a41
static const scalar a41
Definition: RKDP45.H:79
Foam::RKDP45::a42
static const scalar a42
Definition: RKDP45.H:79
Foam::RKDP45::e4
static const scalar e4
Definition: RKDP45.H:82
Foam::RKDP45::e6
static const scalar e6
Definition: RKDP45.H:82
Foam::RKDP45::e5
static const scalar e5
Definition: RKDP45.H:82
Foam::RKDP45::err_
scalarField err_
Error-estimate field.
Definition: RKDP45.H:93
adaptiveSolver.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::RKDP45::k5_
scalarField k5_
Definition: RKDP45.H:89
Foam::RKDP45::a65
static const scalar a65
Definition: RKDP45.H:80
Foam::RKDP45::k2_
scalarField k2_
Definition: RKDP45.H:86
Foam::RKDP45::RKDP45
RKDP45(const ODESystem &ode, const dictionary &dict)
Construct from ODE.
Definition: RKDP45.C:79
Foam::RKDP45::k3_
scalarField k3_
Definition: RKDP45.H:87
Foam::RKDP45::TypeName
TypeName("RKDP45")
Runtime type information.
Foam::RKDP45::b3
static const scalar b3
Definition: RKDP45.H:81
Foam::y0
dimensionedScalar y0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
Foam::RKDP45::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: RKDP45.C:96
Foam::RKDP45::a52
static const scalar a52
Definition: RKDP45.H:79
Foam::RKDP45::a43
static const scalar a43
Definition: RKDP45.H:79
Foam::RKDP45::e7
static const scalar e7
Definition: RKDP45.H:82
Foam::ode
An ODE solver for chemistry.
Definition: ode.H:50
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::RKDP45::a64
static const scalar a64
Definition: RKDP45.H:80
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::RKDP45::a54
static const scalar a54
Definition: RKDP45.H:79
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::RKDP45::e3
static const scalar e3
Definition: RKDP45.H:82
Foam::RKDP45::b1
static const scalar b1
Definition: RKDP45.H:81
Foam::RKDP45
4/5th Order Dormand–Prince Runge-Kutta ODE solver.
Definition: RKDP45.H:69
Foam::RKDP45::b5
static const scalar b5
Definition: RKDP45.H:81
Foam::RKDP45::yTemp_
scalarField yTemp_
Definition: RKDP45.H:85
Foam::RKDP45::a63
static const scalar a63
Definition: RKDP45.H:80
Foam::RKDP45::c3
static const scalar c3
Definition: RKDP45.H:78
Foam::RKDP45::c4
static const scalar c4
Definition: RKDP45.H:78
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
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::RKDP45::a31
static const scalar a31
Definition: RKDP45.H:79
Foam::RKDP45::a32
static const scalar a32
Definition: RKDP45.H:79
Foam::RKDP45::a62
static const scalar a62
Definition: RKDP45.H:80
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::RKDP45::a21
static const scalar a21
Definition: RKDP45.H:79
Foam::RKDP45::a51
static const scalar a51
Definition: RKDP45.H:79
Foam::RKDP45::c2
static const scalar c2
RKDP Constants.
Definition: RKDP45.H:78
Foam::RKDP45::k6_
scalarField k6_
Definition: RKDP45.H:90
Foam::RKDP45::b6
static const scalar b6
Definition: RKDP45.H:81
Foam::adaptiveSolver
Definition: adaptiveSolver.H:47
y
scalar y
Definition: LISASMDCalcMethod1.H:14