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