rodas34.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::rodas34
26 
27 Description
28  L-stable, stiffly-accurate embedded Rosenbrock ODE solver of order (3)4.
29 
30  References:
31  \verbatim
32  "Solving Ordinary Differential Equations II: Stiff
33  and Differential-Algebraic Problems, second edition",
34  Hairer, E.,
35  Nørsett, S.,
36  Wanner, G.,
37  Springer-Verlag, Berlin. 1996.
38  \endverbatim
39 
40 SourceFiles
41  rodas34.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef rodas34_H
46 #define rodas34_H
47 
48 #include "ODESolver.H"
49 #include "adaptiveSolver.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class rodas34 Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class rodas34
61 :
62  public ODESolver,
63  public adaptiveSolver
64 {
65  // Private data
66 
67  mutable scalarField k1_;
68  mutable scalarField k2_;
69  mutable scalarField k3_;
70  mutable scalarField k4_;
71  mutable scalarField k5_;
72  mutable scalarField dy_;
73  mutable scalarField err_;
74  mutable scalarField dydx_;
75  mutable scalarField dfdx_;
76  mutable scalarSquareMatrix dfdy_;
77  mutable scalarSquareMatrix a_;
78  mutable labelList pivotIndices_;
79 
80  static const scalar
81  c2, c3, c4,
82  d1, d2, d3, d4,
83  a21, a31, a32,
84  a41, a42, a43,
85  a51, a52, a53, a54,
86  c21, c31, c32,
87  c41, c42, c43,
88  c51, c52, c53, c54,
89  c61, c62, c63, c64, c65,
90  gamma;
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("rodas34");
96 
97 
98  // Constructors
99 
100  //- Construct from ODE
101  rodas34(const ODESystem& ode, const dictionary& dict);
102 
103 
104  // Member Functions
105 
106  //- Inherit solve from ODESolver
107  using ODESolver::solve;
108 
109  //- Solve a single step dx and return the error
110  scalar solve
111  (
112  const scalar x0,
113  const scalarField& y0,
114  const scalarField& dydx0,
115  const scalar dx,
116  scalarField& y
117  ) const;
118 
119  //- Solve the ODE system and the update the state
120  void solve
121  (
122  scalar& x,
123  scalarField& y,
124  scalar& dxTry
125  ) const;
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************************************************************* //
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: rodas34.C:97
dictionary dict
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dimensionedScalar y0(const dimensionedScalar &ds)
An ODE solver for chemistry.
Definition: ode.H:50
scalar y
L-stable, stiffly-accurate embedded Rosenbrock ODE solver of order (3)4.
Definition: rodas34.H:59
rodas34(const ODESystem &ode, const dictionary &dict)
Construct from ODE.
Definition: rodas34.C:75
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible upto dxTry.
Definition: ODESolver.H:178
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
TypeName("rodas34")
Runtime type information.
Namespace for OpenFOAM.