FreeFOAM The Cross-Platform CFD Toolkit
RK.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) 1991-2010 OpenCFD Ltd.
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::RK
26 
27 Description
28  Foam::RK
29 
30 SourceFiles
31  RKCK.C
32  RKQS.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef RK_H
37 #define RK_H
38 
39 #include <ODE/ODESolver.H>
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class RK Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class RK
51 :
52  public ODESolver
53 {
54  // Private data
55 
56  mutable scalarField yTemp_;
57  mutable scalarField ak2_;
58  mutable scalarField ak3_;
59  mutable scalarField ak4_;
60  mutable scalarField ak5_;
61  mutable scalarField ak6_;
62 
63  mutable scalarField yErr_;
64  mutable scalarField yTemp2_;
65 
66  static const scalar safety, pGrow, pShrink, errCon;
67 
68  static const scalar
69  a2, a3, a4, a5, a6,
70  b21, b31, b32, b41, b42, b43,
71  b51, b52, b53, b54, b61, b62, b63, b64, b65,
72  c1, c3, c4, c6,
73  dc1, dc3, dc4, dc5, dc6;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("RK");
80 
81 
82  // Constructors
83 
84  //- Construct from ODE
85  RK(const ODE& ode);
86 
87 
88  // Member Functions
89 
90  void solve
91  (
92  const ODE& ode,
93  const scalar x,
94  const scalarField& y,
95  const scalarField& dydx,
96  const scalar h,
97  scalarField& yout,
98  scalarField& yerr
99  ) const;
100 
101 
102  void solve
103  (
104  const ODE& ode,
105  scalar& x,
106  scalarField& y,
107  scalarField& dydx,
108  const scalar eps,
109  const scalarField& yScale,
110  const scalar hTry,
111  scalar& hDid,
112  scalar& hNext
113  ) const;
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #endif
124 
125 // ************************ vim: set sw=4 sts=4 et: ************************ //