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