Loading...
Searching...
No Matches
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{
60/*---------------------------------------------------------------------------*\
61 Class Rosenbrock12 Declaration
62\*---------------------------------------------------------------------------*/
63
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;
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
ODESolver(const ODESolver &)=delete
No copy construct.
friend class ODESystem
Definition ODESolver.H:114
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible up to dxTry.
Definition ODESolver.C:110
TypeName("Rosenbrock12")
Runtime type information.
Rosenbrock12(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
virtual bool resize()
Resize the ODE solver.
virtual ~Rosenbrock12()=default
Destructor.
adaptiveSolver(const ODESystem &ode, const dictionary &dict)
Construct from ODESystem.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
An ODE solver for chemistry.
Definition ode.H:51
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
dimensionedScalar y0(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
SquareMatrix< scalar > scalarSquareMatrix
dictionary dict
CEqn solve()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68