SLTSDdtScheme.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-2022 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  //- Calculate a relaxed diagonal from the given flux field
84  void relaxedDiag(scalarField& rD, const surfaceScalarField& phi) const;
85 
86  //- Return the reciprocal of the stabilised local time-step
87  tmp<volScalarField> SLrDeltaT() const;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("SLTS");
94 
95 
96  // Constructors
97 
98  //- Construct from mesh and Istream
99  SLTSDdtScheme(const fvMesh& mesh, Istream& is)
100  :
101  ddtScheme<Type>(mesh, is),
102  phiName_(is),
103  rhoName_(is),
104  alpha_(readScalar(is))
105  {}
106 
107  //- Disallow default bitwise copy construction
108  SLTSDdtScheme(const SLTSDdtScheme&) = delete;
109 
110 
111  // Member Functions
112 
113  //- Return mesh reference
114  const fvMesh& mesh() const
115  {
116  return fv::ddtScheme<Type>::mesh();
117  }
118 
120  (
121  const dimensioned<Type>&
122  );
123 
125  (
127  );
128 
130  (
131  const dimensionedScalar&,
133  );
134 
136  (
137  const volScalarField&,
139  );
140 
142  (
143  const volScalarField& alpha,
144  const volScalarField& rho,
146  );
147 
148  virtual tmp<fvMatrix<Type>> fvmDdt
149  (
151  );
152 
153  virtual tmp<fvMatrix<Type>> fvmDdt
154  (
155  const dimensionedScalar&,
157  );
158 
159  virtual tmp<fvMatrix<Type>> fvmDdt
160  (
161  const volScalarField&,
163  );
164 
165  virtual tmp<fvMatrix<Type>> fvmDdt
166  (
167  const volScalarField& alpha,
168  const volScalarField& rho,
170  );
173 
175  (
178  );
179 
181  (
183  const fluxFieldType& phi
184  );
185 
187  (
188  const volScalarField& rho,
191  );
192 
194  (
195  const volScalarField& rho,
197  const fluxFieldType& phi
198  );
199 
201  (
203  );
204 
205  virtual tmp<scalarField> meshPhi
206  (
208  const label patchi
209  );
210 
211 
212  // Member Operators
213 
214  //- Disallow default bitwise assignment
215  void operator=(const SLTSDdtScheme&) = delete;
216 };
217 
218 
219 template<>
221 (
224 );
225 
226 template<>
228 (
229  const volScalarField& U,
230  const surfaceScalarField& phi
231 );
232 
233 template<>
235 (
236  const volScalarField& rho,
237  const volScalarField& U,
238  const surfaceScalarField& Uf
239 );
240 
241 template<>
243 (
244  const volScalarField& rho,
245  const volScalarField& U,
246  const surfaceScalarField& phi
247 );
248 
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 } // End namespace fv
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 } // End namespace Foam
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #ifdef NoRepository
261  #include "SLTSDdtScheme.C"
262 #endif
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
U
Definition: pEqn.H:72
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Generic dimensioned Type class.
Abstract base class for ddt schemes.
Definition: ddtScheme.H:64
const fvMesh & mesh() const
Return mesh reference.
Definition: ddtScheme.H:129
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcDdt(const dimensioned< Type > &)
const volScalarField & psi
phi
Definition: correctPhi.H:3
autoPtr< surfaceVectorField > Uf
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
Definition: doubleScalar.H:75
virtual 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.
label patchi
virtual tmp< surfaceScalarField > meshPhi(const GeometricField< Type, fvPatchField, volMesh > &)
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
SLTSDdtScheme(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
Definition: SLTSDdtScheme.H:98
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:53
virtual tmp< fluxFieldType > fvcDdtPhiCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const fluxFieldType &phi)
void operator=(const SLTSDdtScheme &)=delete
Disallow default bitwise assignment.
virtual tmp< fvMatrix< Type > > fvmDdt(const GeometricField< Type, fvPatchField, volMesh > &)
Namespace for OpenFOAM.