rodas23.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::rodas23
26 
27 Description
28  L-stable, stiffly-accurate embedded Rosenbrock ODE solver of order (2)3.
29 
30  References:
31  \verbatim
32  Sandu, A., Verwer, J. G., Blom, J. G., Spee, E. J., Carmichael, G. R.,
33  & Potra, F. A. (1997).
34  Benchmarking stiff ODE solvers for atmospheric chemistry problems II:
35  Rosenbrock solvers.
36  Atmospheric environment, 31(20), 3459-3472.
37  \endverbatim
38 
39 SourceFiles
40  rodas23.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef rodas23_H
45 #define rodas23_H
46 
47 #include "ODESolver.H"
48 #include "adaptiveSolver.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class rodas23 Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class rodas23
60 :
61  public ODESolver,
62  public adaptiveSolver
63 {
64  // Private Data
65 
66  mutable scalarField k1_;
67  mutable scalarField k2_;
68  mutable scalarField k3_;
69  mutable scalarField dy_;
70  mutable scalarField err_;
71  mutable scalarField dydx_;
72  mutable scalarField dfdx_;
73  mutable scalarSquareMatrix dfdy_;
74  mutable scalarSquareMatrix a_;
75  mutable labelList pivotIndices_;
76 
77  static const scalar
78  c3,
79  d1, d2,
80  a31,
81  a41,
82  c21, c31, c32,
83  c41, c42, c43,
84  gamma;
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("rodas23");
90 
91 
92  // Constructors
93 
94  //- Construct from ODESystem
95  rodas23(const ODESystem& ode, const dictionary& dict);
96 
97 
98  //- Destructor
99  virtual ~rodas23()
100  {}
101 
102 
103  // Member Functions
104 
105  //- Inherit solve from ODESolver
106  using ODESolver::solve;
107 
108  //- Resize the ODE solver
109  virtual bool resize();
110 
111  //- Solve a single step dx and return the error
112  virtual scalar solve
113  (
114  const scalar x0,
115  const scalarField& y0,
116  const label li,
117  const scalarField& dydx0,
118  const scalar dx,
119  scalarField& y
120  ) const;
121 
122  //- Solve the ODE system and the update the state
123  virtual void solve
124  (
125  scalar& x,
126  scalarField& y,
127  const label li,
128  scalar& dxTry
129  ) const;
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
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
rodas23(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
Definition: rodas23.C:54
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: rodas23.C:100
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
virtual bool resize()
Resize the ODE solver.
Definition: rodas23.C:73
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 ~rodas23()
Destructor.
Definition: rodas23.H:98
L-stable, stiffly-accurate embedded Rosenbrock ODE solver of order (2)3.
Definition: rodas23.H:58
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Namespace for OpenFOAM.
TypeName("rodas23")
Runtime type information.