Rosenbrock12.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::Rosenbrock12
29
30Group
31 grpODESolvers
32
33Description
34 L-stable embedded Rosenbrock ODE solver of order (1)2.
35
36 References:
37 \verbatim
38 Verwer, J. G., Spee, E. J., Blom, J. G., & Hundsdorfer, W. (1999).
39 A second-order Rosenbrock method applied to
40 photochemical dispersion problems.
41 SIAM Journal on Scientific Computing, 20(4), 1456-1480.
42 \endverbatim
43
44SourceFiles
45 Rosenbrock12.C
46
47\*---------------------------------------------------------------------------*/
48
49#ifndef Rosenbrock12_H
50#define Rosenbrock12_H
51
52#include "ODESolver.H"
53#include "adaptiveSolver.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59
60/*---------------------------------------------------------------------------*\
61 Class Rosenbrock12 Declaration
62\*---------------------------------------------------------------------------*/
64class Rosenbrock12
65:
66 public ODESolver,
67 public adaptiveSolver
68{
69 // Private data
70
71 mutable scalarField k1_;
72 mutable scalarField k2_;
73 mutable scalarField err_;
74 mutable scalarField dydx_;
75 mutable scalarField dfdx_;
76 mutable scalarSquareMatrix dfdy_;
77 mutable scalarSquareMatrix a_;
78 mutable labelList pivotIndices_;
79
80 static const scalar
81 a21,
82 c21,
83 b1, b2,
84 gamma,
85 c2,
86 e1, e2,
87 d1, d2;
88
89
90public:
91
92 //- Runtime type information
93 TypeName("Rosenbrock12");
94
95
96 // Constructors
97
98 //- Construct from ODESystem
100
101
102 //- Destructor
103 virtual ~Rosenbrock12() = default;
104
105
106 // Member Functions
107
108 //- Inherit solve from ODESolver
109 using ODESolver::solve;
110
111 //- Resize the ODE solver
112 virtual bool resize();
113
114 //- Solve a single step dx and return the error
115 virtual scalar solve
116 (
117 const scalar x0,
118 const scalarField& y0,
119 const scalarField& dydx0,
120 const scalar dx,
122 ) const;
123
124 //- Solve the ODE system and the update the state
125 virtual void solve
126 (
127 scalar& x,
128 scalarField& y,
129 scalar& dxTry
130 ) const;
131};
132
133
134// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136} // End namespace Foam
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140#endif
141
142// ************************************************************************* //
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 (1)2.
Definition: Rosenbrock12.H:67
TypeName("Rosenbrock12")
Runtime type information.
virtual bool resize()
Resize the ODE solver.
Definition: Rosenbrock12.C:72
virtual ~Rosenbrock12()=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