seulex.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 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::seulex
26 
27 Description
28  An extrapolation-algorithm, based on the linearly implicit Euler method
29  with step size control and order selection.
30 
31  The implementation is based on the SEULEX algorithm in
32  \verbatim
33  "Solving Ordinary Differential Equations II: Stiff
34  and Differential-Algebraic Problems, second edition",
35  Hairer, E.,
36  Nørsett, S.,
37  Wanner, G.,
38  Springer-Verlag, Berlin. 1996.
39  \endverbatim
40 
41 SourceFiles
42  seulex.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef seulex_H
47 #define seulex_H
48 
49 #include "ODESolver.H"
50 #include "scalarMatrices.H"
51 #include "labelField.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class seulex Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class seulex
63 :
64  public ODESolver
65 {
66  // Private data
67 
68  // Static constants
69 
70  static const label kMaxx_ = 12;
71  static const label iMaxx_ = kMaxx_ + 1;
72 
73  static const scalar
77 
78  // Evaluated constants
79 
80  scalar jacRedo_;
84 
85  // Temporary storage
86  // held to avoid dynamic memory allocation between calls
87  // and to transfer internal values between functions
88 
89  mutable scalar theta_;
90  mutable label kTarg_;
92 
93  mutable scalarField dfdx_;
96  mutable labelList pivotIndices_;
97 
98  // Fields space for "solve" function
100  mutable scalarField y0_, ySequence_, scale_;
101 
102  // Fields used in "seul" function
103  mutable scalarField dy_, yTemp_, dydx_;
104 
105 
106  // Private Member Functions
107 
108  //- Computes the j-th line of the extrapolation table
109  bool seul
110  (
111  const scalar x0,
112  const scalarField& y0,
113  const scalar dxTot,
114  const label k,
115  scalarField& y,
116  const scalarField& scale
117  ) const;
118 
119  //- Polynomial extrpolation
120  void extrapolate
121  (
122  const label k,
124  scalarField& y
125  ) const;
126 
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("seulex");
132 
133 
134  // Constructors
135 
136  //- Construct from ODE
137  seulex(const ODESystem& ode, const dictionary& dict);
138 
139 
140  // Member Functions
141 
142  //- Solve the ODE system and the update the state
143  void solve
144  (
145  scalar& x,
146  scalarField& y,
147  stepState& step
148  ) const;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
Foam::seulex::y0_
scalarField y0_
Definition: seulex.H:99
Foam::seulex::stepFactor3_
static const scalar stepFactor3_
Definition: seulex.H:73
Foam::ODESolver::stepState
Definition: ODESolver.H:95
Foam::seulex::stepFactor5_
static const scalar stepFactor5_
Definition: seulex.H:74
Foam::seulex::ySequence_
scalarField ySequence_
Definition: seulex.H:99
Foam::seulex::table_
scalarRectangularMatrix table_
Definition: seulex.H:90
Foam::seulex::coeff_
scalarSquareMatrix coeff_
Definition: seulex.H:82
Foam::ODESolver
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
Foam::seulex::stepFactor4_
static const scalar stepFactor4_
Definition: seulex.H:74
Foam::seulex::kMaxx_
static const label kMaxx_
Definition: seulex.H:69
Foam::seulex::solve
void solve(scalar &x, scalarField &y, stepState &step) const
Solve the ODE system and the update the state.
Definition: seulex.C:207
Foam::seulex::stepFactor1_
static const scalar stepFactor1_
Definition: seulex.H:73
Foam::seulex::dydx_
scalarField dydx_
Definition: seulex.H:102
Foam::seulex::scale_
scalarField scale_
Definition: seulex.H:99
Foam::seulex::yTemp_
scalarField yTemp_
Definition: seulex.H:102
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::seulex::dfdx_
scalarField dfdx_
Definition: seulex.H:92
Foam::seulex::nSeq_
labelField nSeq_
Definition: seulex.H:80
Foam::seulex::dxOpt_
scalarField dxOpt_
Definition: seulex.H:98
Foam::y0
dimensionedScalar y0(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
Foam::seulex::a_
scalarSquareMatrix a_
Definition: seulex.H:94
Foam::seulex::TypeName
TypeName("seulex")
Runtime type information.
Foam::RectangularMatrix< scalar >
Foam::seulex::jacRedo_
scalar jacRedo_
Definition: seulex.H:79
Foam::ode
An ODE solver for chemistry.
Definition: ode.H:50
dict
dictionary dict
Definition: searchingEngine.H:14
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::seulex::dy_
scalarField dy_
Definition: seulex.H:102
Foam::seulex::iMaxx_
static const label iMaxx_
Definition: seulex.H:70
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::seulex::kTarg_
label kTarg_
Definition: seulex.H:89
Foam::seulex::dfdy_
scalarSquareMatrix dfdy_
Definition: seulex.H:93
Foam::SquareMatrix< scalar >
Foam::seulex::extrapolate
void extrapolate(const label k, scalarRectangularMatrix &table, scalarField &y) const
Polynomial extrpolation.
Definition: seulex.C:184
Foam::seulex::stepFactor2_
static const scalar stepFactor2_
Definition: seulex.H:73
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
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::seulex::kFactor1_
static const scalar kFactor1_
Definition: seulex.H:75
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::seulex::pivotIndices_
labelList pivotIndices_
Definition: seulex.H:95
x
x
Definition: LISASMDCalcMethod2.H:52
scalarMatrices.H
Foam::seulex::seul
bool seul(const scalar x0, const scalarField &y0, const scalar dxTot, const label k, scalarField &y, const scalarField &scale) const
Computes the j-th line of the extrapolation table.
Definition: seulex.C:104
Foam::seulex::kFactor2_
static const scalar kFactor2_
Definition: seulex.H:75
Foam::seulex
An extrapolation-algorithm, based on the linearly implicit Euler method with step size control and or...
Definition: seulex.H:61
Foam::seulex::cpu_
scalarField cpu_
Definition: seulex.H:81
labelField.H
Foam::seulex::temp_
scalarField temp_
Definition: seulex.H:98
Foam::seulex::seulex
seulex(const ODESystem &ode, const dictionary &dict)
Construct from ODE.
Definition: seulex.C:50
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::seulex::theta_
scalar theta_
Definition: seulex.H:88