LienCubicKE.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 | 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 \*---------------------------------------------------------------------------*/
25 
26 #include "LienCubicKE.H"
27 #include "wallDist.H"
28 #include "bound.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace incompressible
36 {
37 namespace RASModels
38 {
39 
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 
42 defineTypeNameAndDebug(LienCubicKE, 0);
43 addToRunTimeSelectionTable(RASModel, LienCubicKE, dictionary);
44 
45 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
46 
48 {
49  const volScalarField yStar(sqrt(k_)*y_/nu());
50 
51  return
52  (scalar(1) - exp(-Anu_*yStar))
53  *(scalar(1) + (2*kappa_/(pow(Cmu_, 0.75))/(yStar + SMALL)));
54 }
55 
56 
58 {
60 
61  return scalar(1) - 0.3*exp(-sqr(Rt));
62 }
63 
64 
66 {
67  const volScalarField yStar(sqrt(k_)*y_/nu());
68  const volScalarField le
69  (
70  kappa_*y_/(scalar(1) + (2*kappa_/(pow(Cmu_, 0.75))/(yStar + SMALL)))
71  );
72 
73  return
74  (Ceps2_*pow(Cmu_, 0.75))
75  *(f2*sqrt(k_)*epsilon_/le)*exp(-AE_*sqr(yStar));
76 }
77 
78 
80 {
82 }
83 
84 
86 {
87  volSymmTensorField S(symm(gradU));
88  volTensorField W(skew(gradU));
89 
90  volScalarField sBar((k_/epsilon_)*sqrt(2.0)*mag(S));
91  volScalarField wBar((k_/epsilon_)*sqrt(2.0)*mag(W));
92 
93  volScalarField Cmu((2.0/3.0)/(Cmu1_ + sBar + Cmu2_*wBar));
94  volScalarField fMu(this->fMu());
95 
96  nut_ = Cmu*fMu*sqr(k_)/epsilon_;
98 
100  fMu*k_
101  *(
102  // Quadratic terms
103  sqr(k_/epsilon_)/(Cbeta_ + pow3(sBar))
104  *(
105  Cbeta1_*dev(innerSqr(S))
106  + Cbeta2_*twoSymm(S&W)
107  + Cbeta3_*dev(symm(W&W))
108  )
109 
110  // Cubic terms
111  - pow3(Cmu*k_/epsilon_)
112  *(
113  (Cgamma1_*magSqr(S) - Cgamma2_*magSqr(W))*S
114  + Cgamma4_*twoSymm((innerSqr(S)&W))
115  )
116  );
117 }
118 
119 
120 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
121 
123 (
124  const geometricOneField& alpha,
125  const geometricOneField& rho,
126  const volVectorField& U,
127  const surfaceScalarField& alphaRhoPhi,
128  const surfaceScalarField& phi,
129  const transportModel& transport,
130  const word& propertiesName,
131  const word& type
132 )
133 :
135  (
136  type,
137  alpha,
138  rho,
139  U,
140  alphaRhoPhi,
141  phi,
142  transport,
143  propertiesName
144  ),
145 
146  Ceps1_
147  (
149  (
150  "Ceps1",
151  coeffDict_,
152  1.44
153  )
154  ),
155  Ceps2_
156  (
158  (
159  "Ceps2",
160  coeffDict_,
161  1.92
162  )
163  ),
164  sigmak_
165  (
167  (
168  "sigmak",
169  coeffDict_,
170  1.0
171  )
172  ),
173  sigmaEps_
174  (
176  (
177  "sigmaEps",
178  coeffDict_,
179  1.3
180  )
181  ),
182  Cmu1_
183  (
185  (
186  "Cmu1",
187  coeffDict_,
188  1.25
189  )
190  ),
191  Cmu2_
192  (
194  (
195  "Cmu2",
196  coeffDict_,
197  0.9
198  )
199  ),
200  Cbeta_
201  (
203  (
204  "Cbeta",
205  coeffDict_,
206  1000.0
207  )
208  ),
209  Cbeta1_
210  (
212  (
213  "Cbeta1",
214  coeffDict_,
215  3.0
216  )
217  ),
218  Cbeta2_
219  (
221  (
222  "Cbeta2",
223  coeffDict_,
224  15.0
225  )
226  ),
227  Cbeta3_
228  (
230  (
231  "Cbeta3",
232  coeffDict_,
233  -19.0
234  )
235  ),
236  Cgamma1_
237  (
239  (
240  "Cgamma1",
241  coeffDict_,
242  16.0
243  )
244  ),
245  Cgamma2_
246  (
248  (
249  "Cgamma2",
250  coeffDict_,
251  16.0
252  )
253  ),
254  Cgamma4_
255  (
257  (
258  "Cgamma4",
259  coeffDict_,
260  -80.0
261  )
262  ),
263  Cmu_
264  (
266  (
267  "Cmu",
268  coeffDict_,
269  0.09
270  )
271  ),
272  kappa_
273  (
275  (
276  "kappa",
277  coeffDict_,
278  0.41
279  )
280  ),
281  Anu_
282  (
284  (
285  "Anu",
286  coeffDict_,
287  0.0198
288  )
289  ),
290  AE_
291  (
293  (
294  "AE",
295  coeffDict_,
296  0.00375
297  )
298  ),
299 
300  k_
301  (
302  IOobject
303  (
304  IOobject::groupName("k", U.group()),
305  runTime_.timeName(),
306  mesh_,
309  ),
310  mesh_
311  ),
312 
313  epsilon_
314  (
315  IOobject
316  (
317  IOobject::groupName("epsilon", U.group()),
318  runTime_.timeName(),
319  mesh_,
322  ),
323  mesh_
324  ),
325 
326  y_(wallDist::New(mesh_).y())
327 {
328  bound(k_, kMin_);
329  bound(epsilon_, epsilonMin_);
330 
331  if (type == typeName)
332  {
333  correctNut();
334  printCoeffs(type);
335  }
336 }
337 
338 
339 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
340 
342 {
344  {
345  Ceps1_.readIfPresent(coeffDict());
346  Ceps2_.readIfPresent(coeffDict());
347  sigmak_.readIfPresent(coeffDict());
348  sigmaEps_.readIfPresent(coeffDict());
349  Cmu1_.readIfPresent(coeffDict());
350  Cmu2_.readIfPresent(coeffDict());
351  Cbeta_.readIfPresent(coeffDict());
352  Cbeta1_.readIfPresent(coeffDict());
353  Cbeta2_.readIfPresent(coeffDict());
354  Cbeta3_.readIfPresent(coeffDict());
355  Cgamma1_.readIfPresent(coeffDict());
356  Cgamma2_.readIfPresent(coeffDict());
357  Cgamma4_.readIfPresent(coeffDict());
358  Cmu_.readIfPresent(coeffDict());
359  kappa_.readIfPresent(coeffDict());
360  Anu_.readIfPresent(coeffDict());
361  AE_.readIfPresent(coeffDict());
362 
363  return true;
364  }
365  else
366  {
367  return false;
368  }
369 }
370 
371 
373 {
374  if (!turbulence_)
375  {
376  return;
377  }
378 
380 
381  tmp<volTensorField> tgradU = fvc::grad(U_);
382  const volTensorField& gradU = tgradU();
383 
385  (
386  GName(),
387  (nut_*twoSymm(gradU) - nonlinearStress_) && gradU
388  );
389 
390 
391  // Update epsilon and G at the wall
392  epsilon_.boundaryField().updateCoeffs();
393 
394  const volScalarField f2(this->f2());
395 
396  // Dissipation equation
397  tmp<fvScalarMatrix> epsEqn
398  (
400  + fvm::div(phi_, epsilon_)
402  ==
403  Ceps1_*G*epsilon_/k_
405  + E(f2)
406  );
407 
408  epsEqn().relax();
409  epsEqn().boundaryManipulate(epsilon_.boundaryField());
410  solve(epsEqn);
411  bound(epsilon_, epsilonMin_);
412 
413 
414  // Turbulent kinetic energy equation
416  (
417  fvm::ddt(k_)
418  + fvm::div(phi_, k_)
419  - fvm::laplacian(DkEff(), k_)
420  ==
421  G
422  - fvm::Sp(epsilon_/k_, k_)
423  );
424 
425  kEqn().relax();
426  solve(kEqn);
427  bound(k_, kMin_);
428 
429 
430  // Re-calculate viscosity and non-linear stress
431  correctNonlinearStress(gradU);
432 }
433 
434 
435 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
436 
437 } // End namespace RASModels
438 } // End namespace incompressible
439 } // End namespace Foam
440 
441 // ************************************************************************* //
dimensionedScalar sqrt(const dimensionedScalar &ds)
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:46
dimensionedScalar pow3(const dimensionedScalar &ds)
virtual bool read()
Read RASProperties dictionary.
Definition: LienCubicKE.C:341
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:46
dimensionedTensor skew(const dimensionedTensor &dt)
dimensioned< scalar > mag(const dimensioned< Type > &)
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
const volScalarField & y_
Wall distance.
Definition: LienCubicKE.H:117
Bound the given scalar field if it has gone unbounded.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
static const wallDist & New(const fvMesh &mesh)
tmp< volScalarField > f2() const
Definition: LienCubicKE.C:57
volScalarField & bound(volScalarField &, const dimensionedScalar &lowerBound)
Bound the given scalar field if it has gone unbounded.
Definition: bound.C:33
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
Definition: LienCubicKE.C:372
A class for handling words, derived from string.
Definition: word.H:59
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:46
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
dimensionedScalar exp(const dimensionedScalar &ds)
tmp< volScalarField > fMu() const
Definition: LienCubicKE.C:47
tmp< volScalarField > E(const volScalarField &f2) const
Definition: LienCubicKE.C:65
dimensionedSymmTensor innerSqr(const dimensionedSymmTensor &dt)
tmp< fvMatrix< Type > > Sp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
Namespace for OpenFOAM.
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
static word groupName(Name name, const word &group)
Generic dimensioned Type class.
virtual void correctNonlinearStress(const volTensorField &gradU)
Definition: LienCubicKE.C:85
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
tmp< volScalarField > DepsilonEff() const
Return the effective diffusivity for epsilon.
Definition: LienCubicKE.H:171
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< volScalarField > DkEff() const
Return the effective diffusivity for k.
Definition: LienCubicKE.H:162
bool readIfPresent(const dictionary &)
Update the value of dimensioned<Type> if found in the dictionary.
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(RASModel, kkLOmega, dictionary)
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
surfaceScalarField & phi
LienCubicKE(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: LienCubicKE.C:123
solverPerformance solve(fvMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
scalar y
void correctBoundaryConditions()
Correct boundary field.
incompressible::RASModel::transportModel transportModel
Definition: eddyViscosity.H:75
volScalarField & nu
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A class for managing temporary objects.
Definition: PtrList.H:118
RASModel< turbulenceModel > RASModel
const dimensionedScalar G
Newtonian constant of gravitation.
U
Definition: pEqn.H:82