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 "LamBremhorstKE.H"
28 #include "addToRunTimeSelectionTable.H"
30 #include "backwardsCompatibilityWallFunctions.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace incompressible
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(LamBremhorstKE, 0);
44 addToRunTimeSelectionTable(RASModel, LamBremhorstKE, dictionary);
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 LamBremhorstKE::LamBremhorstKE
50 const volVectorField& U,
51 const surfaceScalarField& phi,
52 transportModel& lamTransportModel
55 RASModel(typeName, U, phi, lamTransportModel),
59 dimensioned<scalar>::lookupOrAddToDict
68 dimensioned<scalar>::lookupOrAddToDict
77 dimensioned<scalar>::lookupOrAddToDict
86 dimensioned<scalar>::lookupOrAddToDict
122 Rt_(sqr(k_)/(nu()*epsilon_)),
126 sqr(scalar(1) - exp(-0.0165*(sqrt(k_)*y_/nu())))
127 *(scalar(1) + 20.5/(Rt_ + SMALL))
130 nut_(Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_))
136 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
138 tmp<volSymmTensorField> LamBremhorstKE::R() const
140 return tmp<volSymmTensorField>
142 new volSymmTensorField
152 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
153 k_.boundaryField().types()
159 tmp<volSymmTensorField> LamBremhorstKE::devReff() const
161 return tmp<volSymmTensorField>
163 new volSymmTensorField
173 -nuEff()*dev(twoSymm(fvc::grad(U_)))
179 tmp<fvVectorMatrix> LamBremhorstKE::divDevReff(volVectorField& U) const
183 - fvm::laplacian(nuEff(), U)
184 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
189 bool LamBremhorstKE::read()
191 if (RASModel::read())
193 Cmu_.readIfPresent(coeffDict());
194 C1_.readIfPresent(coeffDict());
195 C2_.readIfPresent(coeffDict());
196 sigmaEps_.readIfPresent(coeffDict());
207 void LamBremhorstKE::correct()
216 if (mesh_.changing())
221 volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
224 // Calculate parameters and coefficients for low-Reynolds number model
226 Rt_ = sqr(k_)/(nu()*epsilon_);
227 volScalarField Ry = sqrt(k_)*y_/nu();
229 fMu_ = sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt_ + SMALL));
231 volScalarField f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
232 volScalarField f2 = scalar(1) - exp(-sqr(Rt_));
235 // Dissipation equation
237 tmp<fvScalarMatrix> epsEqn
240 + fvm::div(phi_, epsilon_)
241 - fvm::laplacian(DepsilonEff(), epsilon_)
244 - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
249 bound(epsilon_, epsilon0_);
252 // Turbulent kinetic energy equation
254 tmp<fvScalarMatrix> kEqn
258 - fvm::laplacian(DkEff(), k_)
260 G - fvm::Sp(epsilon_/k_, k_)
268 // Re-calculate viscosity
269 nut_ == Cmu_*fMu_*sqr(k_)/epsilon_;
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 } // End namespace RASModels
276 } // End namespace incompressible
277 } // End namespace Foam
279 // ************************************************************************* //