1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "LaunderSharmaKE.H"
28 #include "addToRunTimeSelectionTable.H"
30 #include "backwardsCompatibilityWallFunctions.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace incompressible
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(LaunderSharmaKE, 0);
44 addToRunTimeSelectionTable(RASModel, LaunderSharmaKE, dictionary);
46 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
48 tmp<volScalarField> LaunderSharmaKE::fMu() const
50 return exp(-3.4/sqr(scalar(1) + sqr(k_)/(nu()*epsilonTilda_)/50.0));
54 tmp<volScalarField> LaunderSharmaKE::f2() const
58 - 0.3*exp(-min(sqr(sqr(k_)/(nu()*epsilonTilda_)), scalar(50.0)));
62 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 LaunderSharmaKE::LaunderSharmaKE
66 const volVectorField& U,
67 const surfaceScalarField& phi,
68 transportModel& lamTransportModel
71 RASModel(typeName, U, phi, lamTransportModel),
75 dimensioned<scalar>::lookupOrAddToDict
84 dimensioned<scalar>::lookupOrAddToDict
93 dimensioned<scalar>::lookupOrAddToDict
102 dimensioned<scalar>::lookupOrAddToDict
146 autoCreateNut("nut", mesh_)
149 nut_ = Cmu_*fMu()*sqr(k_)/(epsilonTilda_ + epsilonSmall_);
150 nut_.correctBoundaryConditions();
156 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
158 tmp<volSymmTensorField> LaunderSharmaKE::R() const
160 return tmp<volSymmTensorField>
162 new volSymmTensorField
172 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
173 k_.boundaryField().types()
179 tmp<volSymmTensorField> LaunderSharmaKE::devReff() const
181 return tmp<volSymmTensorField>
183 new volSymmTensorField
193 -nuEff()*dev(twoSymm(fvc::grad(U_)))
199 tmp<fvVectorMatrix> LaunderSharmaKE::divDevReff(volVectorField& U) const
203 - fvm::laplacian(nuEff(), U)
204 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
209 bool LaunderSharmaKE::read()
211 if (RASModel::read())
213 Cmu_.readIfPresent(coeffDict());
214 C1_.readIfPresent(coeffDict());
215 C2_.readIfPresent(coeffDict());
216 sigmaEps_.readIfPresent(coeffDict());
227 void LaunderSharmaKE::correct()
236 volScalarField S2 = 2*magSqr(symm(fvc::grad(U_)));
238 volScalarField G = nut_*S2;
240 volScalarField E = 2.0*nu()*nut_*fvc::magSqrGradGrad(U_);
241 volScalarField D = 2.0*nu()*magSqr(fvc::grad(sqrt(k_)));
244 // Dissipation rate equation
246 tmp<fvScalarMatrix> epsEqn
248 fvm::ddt(epsilonTilda_)
249 + fvm::div(phi_, epsilonTilda_)
250 - fvm::laplacian(DepsilonEff(), epsilonTilda_)
252 C1_*G*epsilonTilda_/k_
253 - fvm::Sp(C2_*f2()*epsilonTilda_/k_, epsilonTilda_)
259 bound(epsilonTilda_, epsilon0_);
262 // Turbulent kinetic energy equation
264 tmp<fvScalarMatrix> kEqn
268 - fvm::laplacian(DkEff(), k_)
270 G - fvm::Sp((epsilonTilda_ + D)/k_, k_)
278 // Re-calculate viscosity
279 nut_ = Cmu_*fMu()*sqr(k_)/epsilonTilda_;
280 nut_.correctBoundaryConditions();
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 } // End namespace RASModels
287 } // End namespace incompressible
288 } // End namespace Foam
290 // ************************************************************************* //