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
117 autoCreateEpsilon("epsilon", mesh_)
122 Rt_(sqr(k_)/(nu()*epsilon_)),
126 sqr(scalar(1) - exp(-0.0165*(sqrt(k_)*y_/nu())))
127 *(scalar(1) + 20.5/(Rt_ + SMALL))
140 autoCreateNut("nut", mesh_)
143 nut_ = Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_);
144 nut_.correctBoundaryConditions();
150 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
152 tmp<volSymmTensorField> LamBremhorstKE::R() const
154 return tmp<volSymmTensorField>
156 new volSymmTensorField
166 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
167 k_.boundaryField().types()
173 tmp<volSymmTensorField> LamBremhorstKE::devReff() const
175 return tmp<volSymmTensorField>
177 new volSymmTensorField
187 -nuEff()*dev(twoSymm(fvc::grad(U_)))
193 tmp<fvVectorMatrix> LamBremhorstKE::divDevReff(volVectorField& U) const
197 - fvm::laplacian(nuEff(), U)
198 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
203 bool LamBremhorstKE::read()
205 if (RASModel::read())
207 Cmu_.readIfPresent(coeffDict());
208 C1_.readIfPresent(coeffDict());
209 C2_.readIfPresent(coeffDict());
210 sigmaEps_.readIfPresent(coeffDict());
221 void LamBremhorstKE::correct()
230 if (mesh_.changing())
235 volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
237 // Calculate parameters and coefficients for low-Reynolds number model
239 Rt_ = sqr(k_)/(nu()*epsilon_);
240 volScalarField Ry = sqrt(k_)*y_/nu();
242 fMu_ = sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt_ + SMALL));
244 volScalarField f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
245 volScalarField f2 = scalar(1) - exp(-sqr(Rt_));
247 // Update espsilon and G at the wall
248 epsilon_.boundaryField().updateCoeffs();
250 // Dissipation equation
252 tmp<fvScalarMatrix> epsEqn
255 + fvm::div(phi_, epsilon_)
256 - fvm::laplacian(DepsilonEff(), epsilon_)
259 - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
264 epsEqn().boundaryManipulate(epsilon_.boundaryField());
267 bound(epsilon_, epsilon0_);
270 // Turbulent kinetic energy equation
272 tmp<fvScalarMatrix> kEqn
276 - fvm::laplacian(DkEff(), k_)
278 G - fvm::Sp(epsilon_/k_, k_)
286 // Re-calculate viscosity
287 nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
288 nut_.correctBoundaryConditions();
292 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 } // End namespace RASModels
295 } // End namespace incompressible
296 } // End namespace Foam
298 // ************************************************************************* //