seulex.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2019 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 label li,
112  const scalar dxTot,
113  const label k,
114  scalarField& y,
115  const scalarField& scale
116  ) const;
117 
118  //- Polynomial extrapolation
119  void extrapolate
120  (
121  const label k,
123  scalarField& y
124  ) const;
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("seulex");
131 
132 
133  // Constructors
134 
135  //- Construct from ODESystem
136  seulex(const ODESystem& ode, const dictionary& dict);
137 
138 
139  //- Destructor
140  virtual ~seulex()
141  {}
142 
143 
144  // Member Functions
145 
146  //- Resize the ODE solver
147  virtual bool resize();
148 
149  //- Solve the ODE system and the update the state
150  virtual void solve
151  (
152  scalar& x,
153  scalarField& y,
154  const label li,
155  stepState& step
156  ) const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
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:156
dimensionedScalar y0(const dimensionedScalar &ds)
virtual ~seulex()
Destructor.
Definition: seulex.H:139
virtual void solve(scalar &x, scalarField &y, const label li, stepState &step) const
Solve the ODE system and the update the state.
Definition: seulex.C:247
label k
Boltzmann constant.
An ODE solver for chemistry.
Definition: ode.H:50
scalar y
virtual bool resize()
Resize the ODE solver.
Definition: seulex.C:221
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.