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