1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "LienLeschzinerLowRe.H"
27 #include "wallFvPatch.H"
28 #include "addToRunTimeSelectionTable.H"
30 #include "backwardsCompatibilityWallFunctions.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace incompressible
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(LienLeschzinerLowRe, 0);
44 addToRunTimeSelectionTable(RASModel, LienLeschzinerLowRe, dictionary);
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 LienLeschzinerLowRe::LienLeschzinerLowRe
50 const volVectorField& U,
51 const surfaceScalarField& phi,
52 transportModel& transport,
53 const word& turbulenceModelName,
57 RASModel(modelName, U, phi, transport, turbulenceModelName),
61 dimensioned<scalar>::lookupOrAddToDict
70 dimensioned<scalar>::lookupOrAddToDict
79 dimensioned<scalar>::lookupOrAddToDict
88 dimensioned<scalar>::lookupOrAddToDict
97 dimensioned<scalar>::lookupOrAddToDict
106 dimensioned<scalar>::lookupOrAddToDict
115 dimensioned<scalar>::lookupOrAddToDict
124 dimensioned<scalar>::lookupOrAddToDict
133 dimensioned<scalar>::lookupOrAddToDict
169 yStar_(sqrt(k_)*y_/nu() + SMALL),
181 autoCreateLowReNut("nut", mesh_)
185 bound(epsilon_, epsilonMin_);
187 nut_ = Cmu_*(scalar(1) - exp(-Am_*yStar_))
188 /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)*sqr(k_)
190 nut_.correctBoundaryConditions();
196 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
198 tmp<volSymmTensorField> LienLeschzinerLowRe::R() const
200 tmp<volTensorField> gradU = fvc::grad(U_);
202 return tmp<volSymmTensorField>
204 new volSymmTensorField
214 ((2.0/3.0)*I)*k_ - nut_*twoSymm(gradU),
215 k_.boundaryField().types()
221 tmp<volSymmTensorField> LienLeschzinerLowRe::devReff() const
223 return tmp<volSymmTensorField>
225 new volSymmTensorField
235 -nuEff()*dev(twoSymm(fvc::grad(U_)))
241 tmp<fvVectorMatrix> LienLeschzinerLowRe::divDevReff(volVectorField& U) const
245 - fvm::laplacian(nuEff(), U)
246 //- (fvc::grad(U) & fvc::grad(nuEff()))
247 - fvc::div(nuEff()*T(fvc::grad(U)))
252 bool LienLeschzinerLowRe::read()
254 if (RASModel::read())
256 C1_.readIfPresent(coeffDict());
257 C2_.readIfPresent(coeffDict());
258 sigmak_.readIfPresent(coeffDict());
259 sigmaEps_.readIfPresent(coeffDict());
260 Cmu_.readIfPresent(coeffDict());
261 kappa_.readIfPresent(coeffDict());
262 Am_.readIfPresent(coeffDict());
263 Aepsilon_.readIfPresent(coeffDict());
264 Amu_.readIfPresent(coeffDict());
275 void LienLeschzinerLowRe::correct()
284 if (mesh_.changing())
289 scalar Cmu75 = pow(Cmu_.value(), 0.75);
291 const volTensorField gradU(fvc::grad(U_));
294 tmp<volScalarField> S2 = symm(gradU) && gradU;
296 yStar_ = sqrt(k_)*y_/nu() + SMALL;
297 tmp<volScalarField> Rt = sqr(k_)/(nu()*epsilon_);
301 (scalar(1) - exp(-Am_*yStar_))
302 /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
305 const volScalarField f2(scalar(1) - 0.3*exp(-sqr(Rt)));
307 volScalarField G("RASModel::G", Cmu_*fMu*sqr(k_)/epsilon_*S2);
310 // Dissipation equation
311 tmp<fvScalarMatrix> epsEqn
314 + fvm::div(phi_, epsilon_)
315 - fvm::laplacian(DepsilonEff(), epsilon_)
319 + C2_*f2*Cmu75*sqrt(k_)
320 /(kappa_*y_*(scalar(1) - exp(-Aepsilon_*yStar_)))
321 *exp(-Amu_*sqr(yStar_))*epsilon_
322 - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
327 #include "LienLeschzinerLowReSetWallDissipation.H"
328 #include "wallDissipationI.H"
331 bound(epsilon_, epsilonMin_);
334 // Turbulent kinetic energy equation
336 tmp<fvScalarMatrix> kEqn
340 - fvm::laplacian(DkEff(), k_)
343 - fvm::Sp(epsilon_/k_, k_)
351 // Re-calculate viscosity
352 nut_ = Cmu_*fMu*sqr(k_)/epsilon_;
356 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 } // End namespace RASModels
359 } // End namespace incompressible
360 } // End namespace Foam
362 // ************************************************************************* //