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