LamBremhorstKE.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 "LamBremhorstKE.H"
30 #include "wallDist.H"
31 #include "bound.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace incompressible
39 {
40 namespace RASModels
41 {
42 
43 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
44 
45 defineTypeNameAndDebug(LamBremhorstKE, 0);
46 addToRunTimeSelectionTable(RASModel, LamBremhorstKE, dictionary);
47 
48 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
49 
50 tmp<volScalarField> LamBremhorstKE::Rt() const
51 {
52  return sqr(k_)/(nu()*epsilon_);
53 }
54 
55 
56 tmp<volScalarField> LamBremhorstKE::fMu(const volScalarField& Rt) const
57 {
58  tmp<volScalarField> Ry(sqrt(k_)*y_/nu());
59  return sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt + SMALL));
60 }
61 
62 
63 tmp<volScalarField> LamBremhorstKE::f1(const volScalarField& fMu) const
64 {
65  return scalar(1) + pow3(0.05/(fMu + SMALL));
66 }
67 
68 
69 tmp<volScalarField> LamBremhorstKE::f2(const volScalarField& Rt) const
70 {
71  return scalar(1) - exp(-sqr(Rt));
72 }
73 
74 
76 {
77  nut_ = Cmu_*fMu*sqr(k_)/epsilon_;
79 }
80 
81 
82 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
83 
85 {
86  correctNut(fMu(Rt()));
87 }
88 
89 
90 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
91 
92 LamBremhorstKE::LamBremhorstKE
93 (
94  const geometricOneField& alpha,
95  const geometricOneField& rho,
96  const volVectorField& U,
97  const surfaceScalarField& alphaRhoPhi,
98  const surfaceScalarField& phi,
99  const transportModel& transport,
100  const word& propertiesName,
101  const word& type
102 )
103 :
105  (
106  type,
107  alpha,
108  rho,
109  U,
110  alphaRhoPhi,
111  phi,
112  transport,
113  propertiesName
114  ),
115 
116  Cmu_
117  (
119  (
120  "Cmu",
121  coeffDict_,
122  0.09
123  )
124  ),
125  Ceps1_
126  (
128  (
129  "Ceps1",
130  coeffDict_,
131  1.44
132  )
133  ),
134  Ceps2_
135  (
137  (
138  "Ceps2",
139  coeffDict_,
140  1.92
141  )
142  ),
143  sigmaEps_
144  (
146  (
147  "alphaEps",
148  coeffDict_,
149  1.3
150  )
151  ),
152 
153  k_
154  (
155  IOobject
156  (
157  IOobject::groupName("k", alphaRhoPhi.group()),
158  runTime_.timeName(),
159  mesh_,
162  ),
163  mesh_
164  ),
165 
166  epsilon_
167  (
168  IOobject
169  (
170  IOobject::groupName("epsilon", alphaRhoPhi.group()),
171  runTime_.timeName(),
172  mesh_,
175  ),
176  mesh_
177  ),
178 
179  y_(wallDist::New(mesh_).y())
180 {
181  bound(k_, kMin_);
182  bound(epsilon_, epsilonMin_);
183 
184  if (type == typeName)
185  {
186  printCoeffs(type);
187  }
188 }
189 
190 
191 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
192 
194 {
196  {
197  Cmu_.readIfPresent(coeffDict());
198  Ceps1_.readIfPresent(coeffDict());
199  Ceps2_.readIfPresent(coeffDict());
200  sigmaEps_.readIfPresent(coeffDict());
201 
202  return true;
203  }
204 
205  return false;
206 }
207 
208 
210 {
211  if (!turbulence_)
212  {
213  return;
214  }
215 
217 
218  tmp<volTensorField> tgradU = fvc::grad(U_);
219  volScalarField G(GName(), nut_*(twoSymm(tgradU()) && tgradU()));
220  tgradU.clear();
221 
222  // Update epsilon and G at the wall
223  epsilon_.boundaryFieldRef().updateCoeffs();
224 
225  const volScalarField Rt(this->Rt());
226  const volScalarField fMu(this->fMu(Rt));
227 
228  // Dissipation equation
229  tmp<fvScalarMatrix> epsEqn
230  (
232  + fvm::div(phi_, epsilon_)
234  ==
235  Ceps1_*f1(fMu)*G*epsilon_/k_
236  - fvm::Sp(Ceps2_*f2(Rt)*epsilon_/k_, epsilon_)
237  );
238 
239  epsEqn.ref().relax();
240  epsEqn.ref().boundaryManipulate(epsilon_.boundaryFieldRef());
241  solve(epsEqn);
242  bound(epsilon_, epsilonMin_);
243 
244  // Turbulent kinetic energy equation
246  (
247  fvm::ddt(k_)
248  + fvm::div(phi_, k_)
249  - fvm::laplacian(DkEff(), k_)
250  ==
251  G - fvm::Sp(epsilon_/k_, k_)
252  );
253 
254  kEqn.ref().relax();
255  solve(kEqn);
256  bound(k_, kMin_);
257 
258  // Update nut with latest available k,epsilon
259  correctNut();
260 }
261 
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 } // End namespace RASModels
266 } // End namespace incompressible
267 } // End namespace Foam
268 
269 // ************************************************************************* //
wallDist.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
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::tmp::clear
void clear() const noexcept
Definition: tmpI.H:287
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::MeshObject< fvMesh, UpdateableMeshObject, wallDist >::New
static const wallDist & New(const fvMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
Definition: MeshObject.C:48
Foam::Ry
tensor Ry(const scalar &omega)
Rotational transformation tensor about the y-axis by omega radians.
Definition: transform.H:99
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::LamBremhorstKE::DkEff
tmp< volScalarField > DkEff() const
Return the effective diffusivity for k.
Definition: LamBremhorstKE.H:141
Foam::incompressible::RASModels::LamBremhorstKE::Ceps1_
dimensionedScalar Ceps1_
Definition: LamBremhorstKE.H:91
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::incompressible::RASModels::LamBremhorstKE::sigmaEps_
dimensionedScalar sigmaEps_
Definition: LamBremhorstKE.H:93
rho
rho
Definition: readInitialConditions.H:88
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::incompressible::RASModels::LamBremhorstKE::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition: LamBremhorstKE.C:193
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::incompressible::RASModels::LamBremhorstKE::correctNut
virtual void correctNut()
Definition: LamBremhorstKE.C:84
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
Foam::incompressible::RASModels::LamBremhorstKE::epsilon_
volScalarField epsilon_
Definition: LamBremhorstKE.H:96
bound.H
Bound the given scalar field if it has gone unbounded.
Foam::incompressible::RASModels::LamBremhorstKE::correct
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
Definition: LamBremhorstKE.C:209
Foam::solve
SolverPerformance< Type > solve(faMatrix< Type > &, Istream &)
Solve returning the solution statistics given convergence tolerance.
Foam::incompressible::RASModels::defineTypeNameAndDebug
defineTypeNameAndDebug(kkLOmega, 0)
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
LamBremhorstKE.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:53
Foam::GeometricField::correctBoundaryConditions
void correctBoundaryConditions()
Correct boundary field.
Definition: GeometricField.C:940
Foam::incompressible::RASModels::LamBremhorstKE::DepsilonEff
tmp< volScalarField > DepsilonEff() const
Return the effective diffusivity for epsilon.
Definition: LamBremhorstKE.H:150
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::incompressible::RASModels::LamBremhorstKE::Ceps2_
dimensionedScalar Ceps2_
Definition: LamBremhorstKE.H:92
Foam::GeometricField::boundaryFieldRef
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Definition: GeometricField.C:783
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::incompressible::RASModels::LamBremhorstKE::Cmu_
dimensionedScalar Cmu_
Definition: LamBremhorstKE.H:90
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::incompressible::RASModels::LamBremhorstKE::k_
volScalarField k_
Definition: LamBremhorstKE.H:95
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::GeometricField< vector, fvPatchField, volMesh >
Foam::fvm::div
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:48
Foam::twoSymm
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:95
Foam::incompressible::RASModels::LamBremhorstKE::y_
const volScalarField & y_
Wall distance.
Definition: LamBremhorstKE.H:101
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::IOobject::MUST_READ
Definition: IOobject.H:185