Rosenbrock23.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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::Rosenbrock23
29
30Group
31 grpODESolvers
32
33Description
34 L-stable 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
45SourceFiles
46 Rosenbrock23.C
47
48\*---------------------------------------------------------------------------*/
49
50#ifndef Rosenbrock23_H
51#define Rosenbrock23_H
52
53#include "ODESolver.H"
54#include "adaptiveSolver.H"
55
56// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57
58namespace Foam
59{
60
61/*---------------------------------------------------------------------------*\
62 Class Rosenbrock23 Declaration
63\*---------------------------------------------------------------------------*/
65class Rosenbrock23
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 err_;
76 mutable scalarField dydx_;
77 mutable scalarField dfdx_;
78 mutable scalarSquareMatrix dfdy_;
79 mutable scalarSquareMatrix a_;
80 mutable labelList pivotIndices_;
81
82 static const scalar
83 a21, a31, a32,
84 c21, c31, c32,
85 b1, b2, b3,
86 e1, e2, e3,
87 gamma,
88 c2, c3,
89 d1, d2, d3;
90
91
92public:
93
94 //- Runtime type information
95 TypeName("Rosenbrock23");
96
97
98 // Constructors
99
100 //- Construct from ODESystem
101 Rosenbrock23(const ODESystem& ode, const dictionary& dict);
102
103
104 //- Destructor
105 virtual ~Rosenbrock23() = 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,
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// ************************************************************************* //
scalar y
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:57
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:50
L-stable embedded Rosenbrock ODE solver of order (2)3.
Definition: Rosenbrock23.H:68
TypeName("Rosenbrock23")
Runtime type information.
virtual bool resize()
Resize the ODE solver.
Definition: Rosenbrock23.C:85
virtual ~Rosenbrock23()=default
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
An ODE solver for chemistry.
Definition: ode.H:55
Namespace for OpenFOAM.
dimensionedScalar y0(const dimensionedScalar &ds)
dictionary dict
CEqn solve()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73