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 "LaunderSharmaKE.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "backwardsCompatibilityWallFunctions.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(LaunderSharmaKE, 0);
43 addToRunTimeSelectionTable(RASModel, LaunderSharmaKE, dictionary);
45 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
47 tmp<volScalarField> LaunderSharmaKE::fMu() const
49 return exp(-3.4/sqr(scalar(1) + sqr(k_)/(nu()*epsilonTilda_)/50.0));
53 tmp<volScalarField> LaunderSharmaKE::f2() const
57 - 0.3*exp(-min(sqr(sqr(k_)/(nu()*epsilonTilda_)), scalar(50.0)));
61 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 LaunderSharmaKE::LaunderSharmaKE
65 const volVectorField& U,
66 const surfaceScalarField& phi,
67 transportModel& transport,
68 const word& turbulenceModelName,
72 RASModel(modelName, U, phi, transport, turbulenceModelName),
76 dimensioned<scalar>::lookupOrAddToDict
85 dimensioned<scalar>::lookupOrAddToDict
94 dimensioned<scalar>::lookupOrAddToDict
103 dimensioned<scalar>::lookupOrAddToDict
147 autoCreateLowReNut("nut", mesh_)
151 bound(epsilonTilda_, epsilonMin_);
153 nut_ = Cmu_*fMu()*sqr(k_)/epsilonTilda_;
154 nut_.correctBoundaryConditions();
160 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
162 tmp<volSymmTensorField> LaunderSharmaKE::R() const
164 return tmp<volSymmTensorField>
166 new volSymmTensorField
176 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
177 k_.boundaryField().types()
183 tmp<volSymmTensorField> LaunderSharmaKE::devReff() const
185 return tmp<volSymmTensorField>
187 new volSymmTensorField
197 -nuEff()*dev(twoSymm(fvc::grad(U_)))
203 tmp<fvVectorMatrix> LaunderSharmaKE::divDevReff(volVectorField& U) const
207 - fvm::laplacian(nuEff(), U)
208 - fvc::div(nuEff()*dev(T(fvc::grad(U))))
213 bool LaunderSharmaKE::read()
215 if (RASModel::read())
217 Cmu_.readIfPresent(coeffDict());
218 C1_.readIfPresent(coeffDict());
219 C2_.readIfPresent(coeffDict());
220 sigmaEps_.readIfPresent(coeffDict());
231 void LaunderSharmaKE::correct()
240 tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_)));
242 volScalarField G("RASModel::G", nut_*S2);
244 const volScalarField E(2.0*nu()*nut_*fvc::magSqrGradGrad(U_));
245 const volScalarField D(2.0*nu()*magSqr(fvc::grad(sqrt(k_))));
248 // Dissipation rate equation
250 tmp<fvScalarMatrix> epsEqn
252 fvm::ddt(epsilonTilda_)
253 + fvm::div(phi_, epsilonTilda_)
254 - fvm::laplacian(DepsilonEff(), epsilonTilda_)
256 C1_*G*epsilonTilda_/k_
257 - fvm::Sp(C2_*f2()*epsilonTilda_/k_, epsilonTilda_)
263 bound(epsilonTilda_, epsilonMin_);
266 // Turbulent kinetic energy equation
268 tmp<fvScalarMatrix> kEqn
272 - fvm::laplacian(DkEff(), k_)
274 G - fvm::Sp((epsilonTilda_ + D)/k_, k_)
282 // Re-calculate viscosity
283 nut_ == Cmu_*fMu()*sqr(k_)/epsilonTilda_;
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 } // End namespace RASModels
290 } // End namespace incompressible
291 } // End namespace Foam
293 // ************************************************************************* //