rodas34.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2019 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  Reference:
31  \verbatim
32  Hairer, E., Nørsett, S. P., & Wanner, G. (1996).
33  Solving Ordinary Differential Equations II:
34  Stiff and Differential-Algebraic Problems, second edition",
35  Springer-Verlag, Berlin.
36  \endverbatim
37 
38 SourceFiles
39  rodas34.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef rodas34_H
44 #define rodas34_H
45 
46 #include "ODESolver.H"
47 #include "adaptiveSolver.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class rodas34 Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class rodas34
59 :
60  public ODESolver,
61  public adaptiveSolver
62 {
63  // Private Data
64 
65  mutable scalarField k1_;
66  mutable scalarField k2_;
67  mutable scalarField k3_;
68  mutable scalarField k4_;
69  mutable scalarField k5_;
70  mutable scalarField dy_;
71  mutable scalarField err_;
72  mutable scalarField dydx_;
73  mutable scalarField dfdx_;
74  mutable scalarSquareMatrix dfdy_;
75  mutable scalarSquareMatrix a_;
76  mutable labelList pivotIndices_;
77 
78  static const scalar
79  c2, c3, c4,
80  d1, d2, d3, d4,
81  a21, a31, a32,
82  a41, a42, a43,
83  a51, a52, a53, a54,
84  c21, c31, c32,
85  c41, c42, c43,
86  c51, c52, c53, c54,
87  c61, c62, c63, c64, c65,
88  gamma;
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("rodas34");
94 
95 
96  // Constructors
97 
98  //- Construct from ODESystem
99  rodas34(const ODESystem& ode, const dictionary& dict);
100 
101 
102  //- Destructor
103  virtual ~rodas34()
104  {}
105 
106 
107  // Member Functions
108 
109  //- Inherit solve from ODESolver
110  using ODESolver::solve;
111 
112  //- Resize the ODE solver
113  virtual bool resize();
114 
115  //- Solve a single step dx and return the error
116  virtual scalar solve
117  (
118  const scalar x0,
119  const scalarField& y0,
120  const label li,
121  const scalarField& dydx0,
122  const scalar dx,
123  scalarField& y
124  ) const;
125 
126  //- Solve the ODE system and the update the state
127  virtual void solve
128  (
129  scalar& x,
130  scalarField& y,
131  const label li,
132  scalar& dxTry
133  ) const;
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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:156
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:57
rodas34(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
Definition: rodas34.C:75
virtual scalar solve(const scalar x0, const scalarField &y0, const label li, const scalarField &dydx0, const scalar dx, scalarField &y) const
Solve a single step dx and return the error.
Definition: rodas34.C:125
virtual void solve(scalar &x, scalarField &y, const label li, scalar &dxTry) const
Solve the ODE system from the current state xStart, y.
Definition: ODESolver.C:116
virtual ~rodas34()
Destructor.
Definition: rodas34.H:102
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
TypeName("rodas34")
Runtime type information.
virtual bool resize()
Resize the ODE solver.
Definition: rodas34.C:96
Namespace for OpenFOAM.