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