1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "LienCubicKELowRe.H"
27 #include "wallFvPatch.H"
28 #include "addToRunTimeSelectionTable.H"
30 #include "backwardsCompatibilityWallFunctions.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace incompressible
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(LienCubicKELowRe, 0);
44 addToRunTimeSelectionTable(RASModel, LienCubicKELowRe, dictionary);
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 LienCubicKELowRe::LienCubicKELowRe
50 const volVectorField& U,
51 const surfaceScalarField& phi,
52 transportModel& lamTransportModel
55 RASModel(typeName, U, phi, lamTransportModel),
59 dimensionedScalar::lookupOrAddToDict
68 dimensionedScalar::lookupOrAddToDict
77 dimensionedScalar::lookupOrAddToDict
86 dimensionedScalar::lookupOrAddToDict
95 dimensionedScalar::lookupOrAddToDict
104 dimensionedScalar::lookupOrAddToDict
113 dimensionedScalar::lookupOrAddToDict
122 dimensionedScalar::lookupOrAddToDict
131 dimensionedScalar::lookupOrAddToDict
140 dimensionedScalar::lookupOrAddToDict
149 dimensionedScalar::lookupOrAddToDict
158 dimensionedScalar::lookupOrAddToDict
167 dimensionedScalar::lookupOrAddToDict
176 dimensionedScalar::lookupOrAddToDict
185 dimensionedScalar::lookupOrAddToDict
221 gradU_(fvc::grad(U)),
222 eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))),
223 ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))),
224 Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
225 fEta_(A2_ + pow(eta_, 3.0)),
229 -2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0)
230 *(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T()))
233 yStar_(sqrt(k_)*y_/nu() + SMALL),
245 autoCreateLowReNut("nut", mesh_)
254 pow(k_, 3.0)/sqr(epsilon_)
259 + (gradU_ & gradU_)().T()
261 + Ctau2_/fEta_*(gradU_ & gradU_.T())
262 + Ctau3_/fEta_*(gradU_.T() & gradU_)
265 - 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0)
268 ((gradU_ & gradU_) & gradU_.T())
269 + ((gradU_ & gradU_.T()) & gradU_.T())
270 - ((gradU_.T() & gradU_) & gradU_)
271 - ((gradU_.T() & gradU_.T()) & gradU_)
273 // cubic term C5, explicit part
277 dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
284 scalar(1) - exp(-Am_*yStar_))
285 /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL
287 *sqr(k_)/(epsilon_ + epsilonSmall_)
288 // cubic term C5, implicit part
292 dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
295 nut_ = min(nut_, nuRatio()*nu());
296 nut_.correctBoundaryConditions();
302 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
304 tmp<volSymmTensorField> LienCubicKELowRe::R() const
306 return tmp<volSymmTensorField>
308 new volSymmTensorField
318 ((2.0/3.0)*I)*k_ - nut_*twoSymm(gradU_) + nonlinearStress_,
319 k_.boundaryField().types()
325 tmp<volSymmTensorField> LienCubicKELowRe::devReff() const
327 return tmp<volSymmTensorField>
329 new volSymmTensorField
339 -nuEff()*dev(twoSymm(fvc::grad(U_))) + nonlinearStress_
345 tmp<fvVectorMatrix> LienCubicKELowRe::divDevReff(volVectorField& U) const
349 fvc::div(nonlinearStress_)
350 - fvm::laplacian(nuEff(), U)
351 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
356 bool LienCubicKELowRe::read()
358 if (RASModel::read())
360 C1_.readIfPresent(coeffDict());
361 C2_.readIfPresent(coeffDict());
362 sigmak_.readIfPresent(coeffDict());
363 sigmaEps_.readIfPresent(coeffDict());
364 A1_.readIfPresent(coeffDict());
365 A2_.readIfPresent(coeffDict());
366 Ctau1_.readIfPresent(coeffDict());
367 Ctau2_.readIfPresent(coeffDict());
368 Ctau3_.readIfPresent(coeffDict());
369 alphaKsi_.readIfPresent(coeffDict());
370 CmuWall_.readIfPresent(coeffDict());
371 kappa_.readIfPresent(coeffDict());
372 Am_.readIfPresent(coeffDict());
373 Aepsilon_.readIfPresent(coeffDict());
374 Amu_.readIfPresent(coeffDict());
385 void LienCubicKELowRe::correct()
387 // Bound in case of topological change
389 if (mesh_.changing())
392 bound(epsilon_, epsilon0_);
402 if (mesh_.changing())
407 gradU_ = fvc::grad(U_);
410 volScalarField S2 = symm(gradU_) && gradU_;
412 yStar_ = sqrt(k_)*y_/nu() + SMALL;
413 volScalarField Rt = sqr(k_)/(nu()*epsilon_);
416 (scalar(1) - exp(-Am_*yStar_))
417 /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL);
419 volScalarField f2 = scalar(1) - 0.3*exp(-sqr(Rt));
422 Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU_);
424 // Dissipation equation
425 tmp<fvScalarMatrix> epsEqn
428 + fvm::div(phi_, epsilon_)
429 + fvm::SuSp(-fvc::div(phi_), epsilon_)
430 - fvm::laplacian(DepsilonEff(), epsilon_)
434 + C2_*f2*pow(Cmu_, 0.75)*pow(k_, scalar(0.5))
435 /(kappa_*y_*(scalar(1) - exp(-Aepsilon_*yStar_)))
436 *exp(-Amu_*sqr(yStar_))*epsilon_
437 - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
442 # include "LienCubicKELowReSetWallDissipation.H"
443 # include "wallDissipationI.H"
446 bound(epsilon_, epsilon0_);
449 // Turbulent kinetic energy equation
451 tmp<fvScalarMatrix> kEqn
455 + fvm::SuSp(-fvc::div(phi_), k_)
456 - fvm::laplacian(DkEff(), k_)
459 - fvm::Sp(epsilon_/k_, k_)
467 // Re-calculate viscosity
469 eta_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())));
470 ksi_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())));
471 Cmu_ = 2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_));
472 fEta_ = A2_ + pow(eta_, 3.0);
475 - 2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0)
476 *(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T()));
479 Cmu_*fMu*sqr(k_)/epsilon_
484 dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
486 nut_ = min(nut_, nuRatio()*nu());
487 nut_.correctBoundaryConditions();
489 nonlinearStress_ = symm
492 pow(k_, 3.0)/sqr(epsilon_)
497 + (gradU_ & gradU_)().T()
499 + Ctau2_/fEta_*(gradU_ & gradU_.T())
500 + Ctau3_/fEta_*(gradU_.T() & gradU_)
503 - 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0)
506 ((gradU_ & gradU_) & gradU_.T())
507 + ((gradU_ & gradU_.T()) & gradU_.T())
508 - ((gradU_.T() & gradU_) & gradU_)
509 - ((gradU_.T() & gradU_.T()) & gradU_)
511 // cubic term C5, explicit part
515 dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
521 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
523 } // End namespace RASModels
524 } // End namespace incompressible
525 } // End namespace Foam
527 // ************************************************************************* //