SLTSDdtScheme.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::fv::SLTSDdtScheme
26 
27 Description
28  Stabilised local time-step first-order Euler implicit/explicit ddt.
29  The time-step is adjusted locally so that an advective equations remains
30  diagonally dominant.
31 
32  This scheme should only be used for steady-state computations
33  using transient codes where local time-stepping is preferably to
34  under-relaxation for transport consistency reasons.
35 
36 See also
37  Foam::fv::CoEulerDdtScheme
38 
39 SourceFiles
40  SLTSDdtScheme.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef SLTSDdtScheme_H
45 #define SLTSDdtScheme_H
46 
47 #include "ddtScheme.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace fv
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class SLTSDdtScheme Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class Type>
64 class SLTSDdtScheme
65 :
66  public fv::ddtScheme<Type>
67 {
68  // Private Data
69 
70  //- Name of the flux field used to calculate the local time-step
71  word phiName_;
72 
73  //- Name of the density field used to obtain the volumetric flux
74  // from the mass flux if required
75  word rhoName_;
76 
77  //- Under-relaxation factor
78  scalar alpha_;
79 
80 
81  // Private Member Functions
82 
83  //- Disallow default bitwise copy construct
85 
86  //- Disallow default bitwise assignment
87  void operator=(const SLTSDdtScheme&);
88 
89  //- Calculate a relaxed diagonal from the given flux field
90  void relaxedDiag(scalarField& rD, const surfaceScalarField& phi) const;
91 
92  //- Return the reciprocal of the stabilised local time-step
93  tmp<volScalarField> SLrDeltaT() const;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("SLTS");
100 
101 
102  // Constructors
103 
104  //- Construct from mesh and Istream
105  SLTSDdtScheme(const fvMesh& mesh, Istream& is)
106  :
107  ddtScheme<Type>(mesh, is),
108  phiName_(is),
109  rhoName_(is),
110  alpha_(readScalar(is))
111  {}
112 
113 
114  // Member Functions
115 
116  //- Return mesh reference
117  const fvMesh& mesh() const
118  {
119  return fv::ddtScheme<Type>::mesh();
120  }
121 
123  (
124  const dimensioned<Type>&
125  );
126 
128  (
130  );
131 
133  (
134  const dimensionedScalar&,
136  );
137 
139  (
140  const volScalarField&,
142  );
143 
145  (
146  const volScalarField& alpha,
147  const volScalarField& rho,
149  );
150 
152  (
154  );
155 
157  (
158  const dimensionedScalar&,
160  );
161 
163  (
164  const volScalarField&,
166  );
167 
169  (
170  const volScalarField& alpha,
171  const volScalarField& rho,
173  );
176 
178  (
181  );
182 
184  (
186  const fluxFieldType& phi
187  );
188 
190  (
191  const volScalarField& rho,
194  );
195 
197  (
198  const volScalarField& rho,
200  const fluxFieldType& phi
201  );
202 
204  (
206  );
207 };
208 
209 
210 template<>
212 (
215 );
216 
217 template<>
219 (
220  const volScalarField& U,
221  const surfaceScalarField& phi
222 );
223 
224 template<>
226 (
227  const volScalarField& rho,
228  const volScalarField& U,
229  const surfaceScalarField& Uf
230 );
231 
232 template<>
234 (
235  const volScalarField& rho,
236  const volScalarField& U,
237  const surfaceScalarField& phi
238 );
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 } // End namespace fv
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #ifdef NoRepository
252  #include "SLTSDdtScheme.C"
253 #endif
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #endif
258 
259 // ************************************************************************* //
surfaceScalarField & phi
U
Definition: pEqn.H:83
const fvMesh & mesh() const
Return mesh reference.
Definition: ddtScheme.H:135
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Uf
Definition: pEqn.H:67
Generic dimensioned Type class.
Abstract base class for ddt schemes.
Definition: ddtScheme.H:64
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
tmp< GeometricField< Type, fvPatchField, volMesh > > fvcDdt(const dimensioned< Type > &)
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
tmp< fluxFieldType > fvcDdtUfCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
TypeName("SLTS")
Runtime type information.
ddtScheme< Type >::fluxFieldType fluxFieldType
const fvMesh & mesh() const
Return mesh reference.
tmp< surfaceScalarField > meshPhi(const GeometricField< Type, fvPatchField, volMesh > &)
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const volScalarField & psi
Stabilised local time-step first-order Euler implicit/explicit ddt. The time-step is adjusted locally...
Definition: SLTSDdtScheme.H:63
A class for managing temporary objects.
Definition: PtrList.H:54
tmp< fluxFieldType > fvcDdtPhiCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const fluxFieldType &phi)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< fvMatrix< Type > > fvmDdt(const GeometricField< Type, fvPatchField, volMesh > &)
Namespace for OpenFOAM.