SIBS.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) 2011-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::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 scalarField& dydx,
94  const scalarField& dfdx,
95  const scalarSquareMatrix& dfdy,
96  const scalar deltaX,
97  const label nSteps,
98  scalarField& yEnd
99  ) const;
100 
101  void polyExtrapolate
102  (
103  const label iest,
104  const scalar xest,
105  const scalarField& yest,
106  scalarField& yz,
107  scalarField& dy,
108  scalarField& x_p,
110  ) const;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("SIBS");
117 
118 
119  // Constructors
120 
121  //- Construct from ODE system
122  SIBS(const ODESystem& ode, const dictionary& dict);
123 
124 
125  //- Destructor
126  virtual ~SIBS()
127  {}
128 
129 
130  // Member Functions
131 
132  //- Resize the ODE solver
133  virtual bool resize();
134 
135  virtual void solve
136  (
137  scalar& x,
138  scalarField& y,
139  scalar& dxTry
140  ) const;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
dictionary dict
virtual void solve(scalar &x, scalarField &y, scalar &dxTry) const
Solve the ODE system as far as possible upto dxTry.
Definition: SIBS.C:92
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
A semi-implicit mid-point solver for stiff systems of ordinary differential equations.
Definition: SIBS.H:58
virtual ~SIBS()
Destructor.
Definition: SIBS.H:125
An ODE solver for chemistry.
Definition: ode.H:50
scalar y
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.