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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::RKDP45
29
30Group
31 grpODESolvers
32
33Description
34 4/5th Order Dormand-Prince Runge-Kutta ODE solver.
35
36 References:
37 \verbatim
38 Dormand, J. R., & Prince, P. J. (1980).
39 A family of embedded Runge-Kutta formulae.
40 Journal of computational and applied mathematics, 6(1), 19-26.
41
42 Hairer, E., Nørsett, S. P., & Wanner, G. (1993).
43 Solving Ordinary Differential Equations I: Nonstiff Problems,
44 second edition.
45 Springer-Verlag, Berlin.
46 \endverbatim
47
48See also
49 Foam::RKF45
50 Foam::RKCK45
51
52SourceFiles
53 RKDP45.C
54
55\*---------------------------------------------------------------------------*/
56
57#ifndef RKDP45_H
58#define RKDP45_H
59
60#include "ODESolver.H"
61#include "adaptiveSolver.H"
62
63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64
65namespace Foam
66{
67
68/*---------------------------------------------------------------------------*\
69 Class RKDP45 Declaration
70\*---------------------------------------------------------------------------*/
72class RKDP45
73:
74 public ODESolver,
75 public adaptiveSolver
76{
77 // Private data
78
79 //- RKDP Constants
80 static const scalar
81 c2, c3, c4, c5,
82 a21, a31, a32, a41, a42, a43, a51, a52, a53, a54,
83 a61, a62, a63, a64, a65,
84 b1, b3, b4, b5, b6,
85 e1, e3, e4, e5, e6, e7;
86
87 // Temporary fields
88 mutable scalarField yTemp_;
89 mutable scalarField k2_;
90 mutable scalarField k3_;
91 mutable scalarField k4_;
92 mutable scalarField k5_;
93 mutable scalarField k6_;
94
95 //- Error-estimate field
96 mutable scalarField err_;
97
98
99public:
100
101 //- Runtime type information
102 TypeName("RKDP45");
103
104
105 // Constructors
106
107 //- Construct from ODESystem
108 RKDP45(const ODESystem& ode, const dictionary& dict);
109
110
111 //- Destructor
112 virtual ~RKDP45() = default;
113
114
115 // Member Functions
116
117 //- Inherit solve from ODESolver
118 using ODESolver::solve;
119
120 //- Resize the ODE solver
121 virtual bool resize();
122
123 //- Solve a single step dx and return the error
124 virtual scalar solve
125 (
126 const scalar x0,
127 const scalarField& y0,
128 const scalarField& dydx0,
129 const scalar dx,
131 ) const;
132
133 //- Solve the ODE system and the update the state
134 virtual void solve
135 (
136 scalar& x,
137 scalarField& y,
138 scalar& dxTry
139 ) const;
140};
141
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145} // End namespace Foam
146
147// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148
149#endif
150
151// ************************************************************************* //
scalar y
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:57
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:50
4/5th Order Dormand-Prince Runge-Kutta ODE solver.
Definition: RKDP45.H:75
virtual ~RKDP45()=default
Destructor.
virtual bool resize()
Resize the ODE solver.
Definition: RKDP45.C:98
TypeName("RKDP45")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
An ODE solver for chemistry.
Definition: ode.H:55
Namespace for OpenFOAM.
dimensionedScalar y0(const dimensionedScalar &ds)
dictionary dict
CEqn solve()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73