All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIBS.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) 2011-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::SIBS
26 
27 Description
28  A semi-implicit mid-point solver for stiff systems of ordinary differential
29  equations.
30 
31  Reference:
32  \verbatim
33  Bader, G., & Deuflhard, P. (1983).
34  A semi-implicit mid-point rule for stiff systems
35  of ordinary differential equations.
36  Numerische Mathematik, 41(3), 373-398.
37  \endverbatim
38 
39 SourceFiles
40  SIMPR.C
41  polyExtrapolate.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef SIBS_H
46 #define SIBS_H
47 
48 #include "ODESolver.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class SIBS Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class SIBS
60 :
61  public ODESolver
62 {
63  // Private Data
64 
65  static const label kMaxX_ = 7, iMaxX_ = kMaxX_ + 1;
66  static const label nSeq_[iMaxX_];
67 
68  static const scalar safe1, safe2, redMax, redMin, scaleMX;
69 
70  mutable scalarField a_;
71  mutable scalarSquareMatrix alpha_;
72  mutable scalarRectangularMatrix d_p_;
73  mutable scalarField x_p_;
74  mutable scalarField err_;
75 
76  mutable scalarField yTemp_;
77  mutable scalarField ySeq_;
78  mutable scalarField yErr_;
79  mutable scalarField dydx0_;
80  mutable scalarField dfdx_;
81  mutable scalarSquareMatrix dfdy_;
82 
83  mutable label first_, kMax_, kOpt_;
84  mutable scalar epsOld_, xNew_;
85 
86 
87  // Private Member Functions
88 
89  void SIMPR
90  (
91  const scalar xStart,
92  const scalarField& y,
93  const label li,
94  const scalarField& dydx,
95  const scalarField& dfdx,
96  const scalarSquareMatrix& dfdy,
97  const scalar deltaX,
98  const label nSteps,
99  scalarField& yEnd
100  ) const;
101 
102  void polyExtrapolate
103  (
104  const label iest,
105  const scalar xest,
106  const scalarField& yest,
107  scalarField& yz,
108  scalarField& dy,
109  scalarField& x_p,
111  ) const;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("SIBS");
118 
119 
120  // Constructors
121 
122  //- Construct from ODE system
123  SIBS(const ODESystem& ode, const dictionary& dict);
124 
125 
126  //- Destructor
127  virtual ~SIBS()
128  {}
129 
130 
131  // Member Functions
132 
133  //- Resize the ODE solver
134  virtual bool resize();
135 
136  virtual void solve
137  (
138  scalar& x,
139  scalarField& y,
140  const label li,
141  scalar& dxTry
142  ) const;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
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:158
A semi-implicit mid-point solver for stiff systems of ordinary differential equations.
Definition: SIBS.H:58
virtual ~SIBS()
Destructor.
Definition: SIBS.H:126
An ODE solver for chemistry.
Definition: ode.H:50
scalar y
virtual void solve(scalar &x, scalarField &y, const label li, scalar &dxTry) const
Solve the ODE system from the current state xStart, y.
Definition: SIBS.C:92
SIBS(const ODESystem &ode, const dictionary &dict)
Construct from ODE system.
Definition: SIBS.C:49
TypeName("SIBS")
Runtime type information.
Abstract base-class for ODE system solvers.
Definition: ODESolver.H:50
virtual bool resize()
Resize the ODE solver.
Definition: SIBS.C:71
Namespace for OpenFOAM.