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-2015 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
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  );
174 
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 // ************************************************************************* //
Foam::fv::SLTSDdtScheme
Stabilised local time-step first-order Euler implicit/explicit ddt. The time-step is adjusted locally...
Definition: SLTSDdtScheme.H:63
Foam::fv::SLTSDdtScheme::fvmDdt
tmp< fvMatrix< Type > > fvmDdt(const GeometricField< Type, fvPatchField, volMesh > &)
Definition: SLTSDdtScheme.C:442
Foam::fv::SLTSDdtScheme::phiName_
word phiName_
Name of the flux field used to calculate the local time-step.
Definition: SLTSDdtScheme.H:70
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::SLTSDdtScheme::SLrDeltaT
tmp< volScalarField > SLrDeltaT() const
Return the reciprocal of the stabilised local time-step.
Definition: SLTSDdtScheme.C:90
Foam::fv::SLTSDdtScheme::SLTSDdtScheme
SLTSDdtScheme(const SLTSDdtScheme &)
Disallow default bitwise copy construct.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::fv::SLTSDdtScheme::alpha_
scalar alpha_
Under-relaxation factor.
Definition: SLTSDdtScheme.H:77
U
U
Definition: pEqn.H:46
Foam::fv::SLTSDdtScheme::TypeName
TypeName("SLTS")
Runtime type information.
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fv::SLTSDdtScheme::operator=
void operator=(const SLTSDdtScheme &)
Disallow default bitwise assignment.
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::dimensioned< Type >
Foam::fv::SLTSDdtScheme::fvcDdtUfCorr
tmp< fluxFieldType > fvcDdtUfCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
Definition: SLTSDdtScheme.C:598
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::ddtScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: ddtScheme.H:135
rho
rho
Definition: pEqn.H:3
ddtScheme.H
fv
labelList fv(nPoints)
Foam::fv::SLTSDdtScheme::mesh
const fvMesh & mesh() const
Return mesh reference.
Definition: SLTSDdtScheme.H:116
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
Foam::readScalar
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
Foam::fv::SLTSDdtScheme::meshPhi
tmp< surfaceScalarField > meshPhi(const GeometricField< Type, fvPatchField, volMesh > &)
Definition: SLTSDdtScheme.C:795
Foam::fv::SLTSDdtScheme::fluxFieldType
ddtScheme< Type >::fluxFieldType fluxFieldType
Definition: SLTSDdtScheme.H:174
Foam::fv::SLTSDdtScheme::rhoName_
word rhoName_
Name of the density field used to obtain the volumetric flux.
Definition: SLTSDdtScheme.H:74
Foam::fv::SLTSDdtScheme::relaxedDiag
void relaxedDiag(scalarField &rD, const surfaceScalarField &phi) const
Calculate a relaxed diagonal from the given flux field.
Definition: SLTSDdtScheme.C:44
Foam::fv::ddtScheme
Abstract base class for ddt schemes.
Definition: ddtScheme.H:64
Foam::fv::SLTSDdtScheme::fvcDdt
tmp< GeometricField< Type, fvPatchField, volMesh > > fvcDdt(const dimensioned< Type > &)
Definition: SLTSDdtScheme.C:156
SLTSDdtScheme.C
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Uf
Uf
Definition: pEqn.H:78
Foam::fv::SLTSDdtScheme::fvcDdtPhiCorr
tmp< fluxFieldType > fvcDdtPhiCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const fluxFieldType &phi)
Definition: SLTSDdtScheme.C:635
Foam::fv::SLTSDdtScheme::SLTSDdtScheme
SLTSDdtScheme(const fvMesh &mesh, Istream &is)
Construct from mesh and Istream.
Definition: SLTSDdtScheme.H:104