qZeta.C
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-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2020 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 \*---------------------------------------------------------------------------*/
28 
29 #include "qZeta.H"
30 #include "bound.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace incompressible
38 {
39 namespace RASModels
40 {
41 
42 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 
44 defineTypeNameAndDebug(qZeta, 0);
45 addToRunTimeSelectionTable(RASModel, qZeta, dictionary);
46 
47 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
48 
50 {
51  const volScalarField Rt(q_*k_/(2.0*nu()*zeta_));
52 
53  if (anisotropic_)
54  {
55  return exp((-scalar(2.5) + Rt/20.0)/pow3(scalar(1) + Rt/130.0));
56  }
57  else
58  {
59  return
60  exp(-6.0/sqr(scalar(1) + Rt/50.0))
61  *(scalar(1) + 3.0*exp(-Rt/10.0));
62  }
63 }
64 
65 
67 {
68  tmp<volScalarField> Rt = q_*k_/(2.0*nu()*zeta_);
69  return scalar(1) - 0.3*exp(-sqr(Rt));
70 }
71 
72 
74 {
75  nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
77 }
78 
79 
80 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
81 
83 (
84  const geometricOneField& alpha,
85  const geometricOneField& rho,
86  const volVectorField& U,
87  const surfaceScalarField& alphaRhoPhi,
88  const surfaceScalarField& phi,
89  const transportModel& transport,
90  const word& propertiesName,
91  const word& type
92 )
93 :
95  (
96  type,
97  alpha,
98  rho,
99  U,
100  alphaRhoPhi,
101  phi,
102  transport,
103  propertiesName
104  ),
105 
106  Cmu_
107  (
109  (
110  "Cmu",
111  coeffDict_,
112  0.09
113  )
114  ),
115  C1_
116  (
118  (
119  "C1",
120  coeffDict_,
121  1.44
122  )
123  ),
124  C2_
125  (
127  (
128  "C2",
129  coeffDict_,
130  1.92
131  )
132  ),
133  sigmaZeta_
134  (
136  (
137  "sigmaZeta",
138  coeffDict_,
139  1.3
140  )
141  ),
142  anisotropic_
143  (
145  (
146  "anisotropic",
147  coeffDict_,
148  false
149  )
150  ),
151 
152  qMin_("qMin", sqrt(kMin_)),
153  zetaMin_("zetaMin", epsilonMin_/(2*qMin_)),
154 
155  k_
156  (
157  IOobject
158  (
159  IOobject::groupName("k", alphaRhoPhi.group()),
160  runTime_.timeName(),
161  mesh_,
164  ),
165  mesh_
166  ),
167 
168  epsilon_
169  (
170  IOobject
171  (
172  IOobject::groupName("epsilon", alphaRhoPhi.group()),
173  runTime_.timeName(),
174  mesh_,
177  ),
178  mesh_
179  ),
180 
181  q_
182  (
183  IOobject
184  (
185  IOobject::groupName("q", alphaRhoPhi.group()),
186  runTime_.timeName(),
187  mesh_,
190  ),
191  sqrt(bound(k_, kMin_)),
192  k_.boundaryField().types()
193  ),
194 
195  zeta_
196  (
197  IOobject
198  (
199  IOobject::groupName("zeta", alphaRhoPhi.group()),
200  runTime_.timeName(),
201  mesh_,
204  ),
205  bound(epsilon_, epsilonMin_)/(2.0*q_),
206  epsilon_.boundaryField().types()
207  )
208 {
209  bound(zeta_, zetaMin_);
210 
211  if (type == typeName)
212  {
213  printCoeffs(type);
214  }
215 }
216 
217 
218 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
219 
221 {
223  {
224  Cmu_.readIfPresent(coeffDict());
225  C1_.readIfPresent(coeffDict());
226  C2_.readIfPresent(coeffDict());
227  sigmaZeta_.readIfPresent(coeffDict());
228  anisotropic_.readIfPresent("anisotropic", coeffDict());
229 
230  qMin_.readIfPresent(*this);
231  zetaMin_.readIfPresent(*this);
232 
233  return true;
234  }
235 
236  return false;
237 }
238 
239 
241 {
242  if (!turbulence_)
243  {
244  return;
245  }
246 
248 
249  volScalarField G(GName(), nut_/(2.0*q_)*2*magSqr(symm(fvc::grad(U_))));
251 
252  // Zeta equation
253  tmp<fvScalarMatrix> zetaEqn
254  (
255  fvm::ddt(zeta_)
256  + fvm::div(phi_, zeta_)
258  ==
259  (2.0*C1_ - 1)*G*zeta_/q_
260  - fvm::SuSp((2.0*C2_*f2() - dimensionedScalar(1.0))*zeta_/q_, zeta_)
261  + E
262  );
263 
264  zetaEqn.ref().relax();
265  solve(zetaEqn);
266  bound(zeta_, zetaMin_);
267 
268 
269  // q equation
271  (
272  fvm::ddt(q_)
273  + fvm::div(phi_, q_)
274  - fvm::laplacian(DqEff(), q_)
275  ==
276  G - fvm::Sp(zeta_/q_, q_)
277  );
278 
279  qEqn.ref().relax();
280  solve(qEqn);
281  bound(q_, qMin_);
282 
283 
284  // Re-calculate k and epsilon
285  k_ = sqr(q_);
287 
288  epsilon_ = 2*q_*zeta_;
290 
291  correctNut();
292 }
293 
294 
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 
297 } // End namespace RASModels
298 } // End namespace incompressible
299 } // End namespace Foam
300 
301 // ************************************************************************* //
Foam::incompressible::RASModels::qZeta::zetaMin_
dimensionedScalar zetaMin_
Lower limit of zeta.
Definition: qZeta.H:97
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::symm
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:84
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:194
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:54
Foam::incompressible::RASModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(RASModel, kkLOmega, dictionary)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::incompressible::RASModel
RASModel< turbulenceModel > RASModel
Definition: turbulentTransportModel.H:63
Foam::incompressible::RASModels::qZeta::Cmu_
dimensionedScalar Cmu_
Definition: qZeta.H:87
Foam::constant::universal::G
const dimensionedScalar G
Newtonian constant of gravitation.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::bound
volScalarField & bound(volScalarField &, const dimensionedScalar &lowerBound)
Bound the given scalar field if it has gone unbounded.
Definition: bound.C:35
Foam::incompressible::RASModels::qZeta::C1_
dimensionedScalar C1_
Definition: qZeta.H:88
Foam::geometricOneField
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Definition: geometricOneField.H:55
Foam::incompressible::RASModels::qZeta::DqEff
tmp< volScalarField > DqEff() const
Return the effective diffusivity for q.
Definition: qZeta.H:170
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::incompressible::RASModels::qZeta::qMin_
dimensionedScalar qMin_
Lower limit of q.
Definition: qZeta.H:94
Foam::incompressible::RASModels::qZeta::DzetaEff
tmp< volScalarField > DzetaEff() const
Return the effective diffusivity for epsilon.
Definition: qZeta.H:179
rho
rho
Definition: readInitialConditions.H:88
Foam::Switch::readIfPresent
bool readIfPresent(const word &key, const dictionary &dict)
Update the value of the Switch if it is found in the dictionary.
Definition: Switch.C:335
qZeta.H
Foam::incompressible::RASModels::qZeta::qZeta
qZeta(const geometricOneField &alpha, const geometricOneField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName=turbulenceModel::propertiesName, const word &type=typeName)
Construct from components.
Definition: qZeta.C:83
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::incompressible::RASModels::qZeta::epsilon_
volScalarField epsilon_
Definition: qZeta.H:102
Foam::incompressible::RASModels::qZeta::q_
volScalarField q_
Definition: qZeta.H:104
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::fvm::SuSp
tmp< fvMatrix< Type > > SuSp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::fvm::Sp
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
Foam::dimensioned::readIfPresent
bool readIfPresent(const dictionary &dict)
Definition: dimensionedType.C:483
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::fvm::laplacian
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:48
bound.H
Bound the given scalar field if it has gone unbounded.
Foam::incompressible::RASModels::qZeta::k_
volScalarField k_
Definition: qZeta.H:101
Foam::solve
SolverPerformance< Type > solve(faMatrix< Type > &, Istream &)
Solve returning the solution statistics given convergence tolerance.
Foam::incompressible::RASModels::qZeta::f2
tmp< volScalarField > f2() const
Definition: qZeta.C:66
Foam::incompressible::RASModels::defineTypeNameAndDebug
defineTypeNameAndDebug(kkLOmega, 0)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::incompressible::RASModels::qZeta::sigmaZeta_
dimensionedScalar sigmaZeta_
Definition: qZeta.H:90
Foam::incompressible::RASModels::qZeta::anisotropic_
Switch anisotropic_
Definition: qZeta.H:91
Foam::incompressible::RASModels::qZeta::C2_
dimensionedScalar C2_
Definition: qZeta.H:89
Foam::incompressible::RASModels::qZeta::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition: qZeta.C:220
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::incompressible::RASModels::qZeta::fMu
tmp< volScalarField > fMu() const
Definition: qZeta.C:49
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:53
Foam::incompressible::RASModels::qZeta::correct
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
Definition: qZeta.C:240
Foam::GeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Correct boundary field.
Definition: GeometricField.C:940
U
U
Definition: pEqn.H:72
Foam::fvm::ddt
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:48
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::fvc::magSqrGradGrad
tmp< volScalarField > magSqrGradGrad(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcMagSqrGradGrad.C:46
Foam::incompressible::RASModels::qZeta::correctNut
virtual void correctNut()
Definition: qZeta.C:73
Foam::eddyViscosity< incompressible::RASModel >
Foam::eddyViscosity::correct
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
Definition: eddyViscosity.C:134
Foam::eddyViscosity< incompressible::RASModel >::nut_
volScalarField nut_
Definition: eddyViscosity.H:66
Foam::IOobject::groupName
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Foam::incompressible::RASModels::qZeta::zeta_
volScalarField zeta_
Definition: qZeta.H:105
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::fvm::div
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:48
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62
Foam::Switch::getOrAddToDict
static Switch getOrAddToDict(const word &key, dictionary &dict, const Switch deflt=switchType::FALSE)
Definition: Switch.C:164
Foam::IOobject::MUST_READ
Definition: IOobject.H:185