integrationScheme.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::integrationScheme
26 
27 Description
28  Base for a set of schemes which integrate simple ODEs which arise from
29  semi-implcit rate expressions.
30 
31  \f[
32  \frac{d \phi}{d t} = A - B \phi
33  \f]
34 
35  The methods are defined in terms of the effective time-step \f$\Delta
36  t_e\f$ by which the explicit rate is multiplied. The effective time-step is
37  a function of the actual time step and the implicit coefficient, which must
38  be implemented in each derived scheme.
39 
40  \f[
41  \Delta t_e = f(\Delta t, B)
42  \f]
43  \f[
44  \Delta \phi = (A - B \phi^n) \Delta t_e
45  \f]
46 
47  This class also facilitates integration in stages. If the explicit and
48  implicit coefficients, \f$A\f$ and \f$B\f$, are a summation of differing
49  contributions, \f$\sum \alpha_i\f$ and \f$\sum \beta_i\f$, then the
50  integration can be split up to determine the effect of each contribution.
51 
52  \f[
53  \frac{d \phi_i}{d t} = \alpha_i - \beta_i \phi
54  \f]
55  \f[
56  \Delta \phi_i = \alpha_i \Delta t -
57  \beta_i \int_0^{\Delta t} \phi d t
58  \f]
59  \f[
60  \Delta \phi_i = (\alpha_i - \beta_i \phi^n) \Delta t -
61  \beta_i (A - B \phi^n) \int_0^{\Delta t} t_e dt
62  \f]
63 
64  These partial calculations are defined in terms of the integral of the
65  effective time-step, \f$\int_0^{\Delta t} t_e dt\f$, which is also
66  implemented in every derivation.
67 
68 SourceFiles
69  integrationScheme.C
70 
71 \*---------------------------------------------------------------------------*/
72 
73 #ifndef integrationScheme_H
74 #define integrationScheme_H
75 
76 #include "autoPtr.H"
77 #include "runTimeSelectionTables.H"
78 #include "dictionary.H"
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class integrationScheme Declaration
87 \*---------------------------------------------------------------------------*/
88 
90 {
91 public:
92 
93  //- Runtime type information
94  TypeName("integrationScheme");
95 
96 
97  //- Declare runtime constructor selection table
98 
100  (
101  autoPtr,
103  word,
104  (),
105  ()
106  );
107 
108 
109  // Constructors
110 
111  //- Construct
113 
114  //- Construct and return clone
115  virtual autoPtr<integrationScheme> clone() const = 0;
116 
117 
118  // Selectors
119 
120  //- Select an integration scheme
122  (
123  const word& phiName,
124  const dictionary& dict
125  );
126 
127 
128  //- Destructor
129  virtual ~integrationScheme();
130 
131 
132  // Member Functions
133 
134  //- Perform the integration explicitly
135  template<class Type>
136  static Type explicitDelta
137  (
138  const Type& phi,
139  const scalar dtEff,
140  const Type& Alpha,
141  const scalar Beta
142  );
143 
144  //- Perform the integration
145  template<class Type>
146  Type delta
147  (
148  const Type& phi,
149  const scalar dt,
150  const Type& Alpha,
151  const scalar Beta
152  ) const;
153 
154  //- Perform a part of the integration
155  template<class Type>
156  Type partialDelta
157  (
158  const Type& phi,
159  const scalar dt,
160  const Type& Alpha,
161  const scalar Beta,
162  const Type& alphai,
163  const scalar betai
164  ) const;
165 
166  //- Return the integration effective time step
167  virtual scalar dtEff(const scalar dt, const scalar Beta) const = 0;
168 
169  //- Return the integral of the effective time step
170  virtual scalar sumDtEff(const scalar dt, const scalar Beta) const = 0;
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #ifdef NoRepository
182 #endif
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
dictionary dict
surfaceScalarField & phi
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
Type delta(const Type &phi, const scalar dt, const Type &Alpha, const scalar Beta) const
Perform the integration.
declareRunTimeSelectionTable(autoPtr, integrationScheme, word,(),())
Declare runtime constructor selection table.
virtual ~integrationScheme()
Destructor.
virtual scalar sumDtEff(const scalar dt, const scalar Beta) const =0
Return the integral of the effective time step.
static Type explicitDelta(const Type &phi, const scalar dtEff, const Type &Alpha, const scalar Beta)
Perform the integration explicitly.
A class for handling words, derived from string.
Definition: word.H:59
TypeName("integrationScheme")
Runtime type information.
Type partialDelta(const Type &phi, const scalar dt, const Type &Alpha, const scalar Beta, const Type &alphai, const scalar betai) const
Perform a part of the integration.
virtual scalar dtEff(const scalar dt, const scalar Beta) const =0
Return the integration effective time step.
Base for a set of schemes which integrate simple ODEs which arise from semi-implcit rate expressions...
static autoPtr< integrationScheme > New(const word &phiName, const dictionary &dict)
Select an integration scheme.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
virtual autoPtr< integrationScheme > clone() const =0
Construct and return clone.
Namespace for OpenFOAM.