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 | Copyright (C) 2013-2015 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::Rosenbrock23
26 
27 Description
28  L-stable embedded Rosenbrock ODE solver of order (2)3.
29 
30  References:
31  \verbatim
32  Sandu et al,
33  "Benchmarking stiff ODE solvers for atmospheric chemistry problems II
34  Rosenbrock solvers",
35  A. Sandu,
36  J.G. Verwer,
37  J.G. Blom,
38  E.J. Spee,
39  G.R. Carmichael,
40  F.A. Potra,
41  Atmospheric Environment, Volume 31, 1997, Issue 20, Pages 3459-3472
42  \endverbatim
43 
44 SourceFiles
45  Rosenbrock23.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef Rosenbrock23_H
50 #define Rosenbrock23_H
51 
52 #include "ODESolver.H"
53 #include "adaptiveSolver.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class Rosenbrock23 Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class Rosenbrock23
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 err_;
75  mutable scalarField dydx_;
76  mutable scalarField dfdx_;
79  mutable labelList pivotIndices_;
80 
81  static const scalar
82  a21, a31, a32,
83  c21, c31, c32,
84  b1, b2, b3,
85  e1, e2, e3,
87  c2, c3,
88  d1, d2, d3;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("Rosenbrock23");
95 
96 
97  // Constructors
98 
99  //- Construct from ODE
100  Rosenbrock23(const ODESystem& ode, const dictionary& dict);
101 
102 
103  // Member Functions
104 
105  //- Inherit solve from ODESolver
106  using ODESolver::solve;
107 
108  //- Solve a single step dx and return the error
109  scalar solve
110  (
111  const scalar x0,
112  const scalarField& y0,
113  const scalarField& dydx0,
114  const scalar dx,
115  scalarField& y
116  ) const;
117 
118  //- Solve the ODE system and the update the state
119  void solve
120  (
121  scalar& x,
122  scalarField& y,
123  scalar& dxTry
124  ) const;
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
Foam::Rosenbrock23::TypeName
TypeName("Rosenbrock23")
Runtime type information.
Foam::ODESolver
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Foam::Rosenbrock23::c31
static const scalar c31
Definition: Rosenbrock23.H:82
Foam::Rosenbrock23::e2
static const scalar e2
Definition: Rosenbrock23.H:84
Foam::Rosenbrock23::dfdy_
scalarSquareMatrix dfdy_
Definition: Rosenbrock23.H:76
Foam::Rosenbrock23::d2
static const scalar d2
Definition: Rosenbrock23.H:87
Foam::Rosenbrock23::solve
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: Rosenbrock23.C:83
Foam::Rosenbrock23::k3_
scalarField k3_
Definition: Rosenbrock23.H:72
Foam::Rosenbrock23::a_
scalarSquareMatrix a_
Definition: Rosenbrock23.H:77
Foam::Rosenbrock23::b1
static const scalar b1
Definition: Rosenbrock23.H:83
Foam::Rosenbrock23::Rosenbrock23
Rosenbrock23(const ODESystem &ode, const dictionary &dict)
Construct from ODE.
Definition: Rosenbrock23.C:64
Foam::Rosenbrock23
L-stable embedded Rosenbrock ODE solver of order (2)3.
Definition: Rosenbrock23.H:63
Foam::Rosenbrock23::e1
static const scalar e1
Definition: Rosenbrock23.H:84
Foam::Rosenbrock23::gamma
static const scalar gamma
Definition: Rosenbrock23.H:85
Foam::Rosenbrock23::d3
static const scalar d3
Definition: Rosenbrock23.H:87
adaptiveSolver.H
Foam::Rosenbrock23::c32
static const scalar c32
Definition: Rosenbrock23.H:82
Foam::Rosenbrock23::e3
static const scalar e3
Definition: Rosenbrock23.H:84
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Rosenbrock23::b2
static const scalar b2
Definition: Rosenbrock23.H:83
Foam::Rosenbrock23::a32
static const scalar a32
Definition: Rosenbrock23.H:81
Foam::y0
dimensionedScalar y0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
Foam::Rosenbrock23::a21
static const scalar a21
Definition: Rosenbrock23.H:81
Foam::ode
An ODE solver for chemistry.
Definition: ode.H:50
Foam::Rosenbrock23::pivotIndices_
labelList pivotIndices_
Definition: Rosenbrock23.H:78
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::Rosenbrock23::c2
static const scalar c2
Definition: Rosenbrock23.H:86
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
ODESolver.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::Rosenbrock23::k2_
scalarField k2_
Definition: Rosenbrock23.H:71
Foam::Rosenbrock23::a31
static const scalar a31
Definition: Rosenbrock23.H:81
Foam::SquareMatrix< scalar >
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
Foam::Rosenbrock23::c3
static const scalar c3
Definition: Rosenbrock23.H:86
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::ODESolver::solve
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible upto dxTry.
Definition: ODESolver.H:178
Foam::Rosenbrock23::b3
static const scalar b3
Definition: Rosenbrock23.H:83
Foam::Rosenbrock23::dfdx_
scalarField dfdx_
Definition: Rosenbrock23.H:75
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::Rosenbrock23::d1
static const scalar d1
Definition: Rosenbrock23.H:87
Foam::Rosenbrock23::k1_
scalarField k1_
Definition: Rosenbrock23.H:70
Foam::Rosenbrock23::err_
scalarField err_
Definition: Rosenbrock23.H:73
Foam::Rosenbrock23::c21
static const scalar c21
Definition: Rosenbrock23.H:82
Foam::Rosenbrock23::dydx_
scalarField dydx_
Definition: Rosenbrock23.H:74
Foam::adaptiveSolver
Definition: adaptiveSolver.H:47
y
scalar y
Definition: LISASMDCalcMethod1.H:14