1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "LamBremhorstKE.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "backwardsCompatibilityWallFunctions.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(LamBremhorstKE, 0);
43 addToRunTimeSelectionTable(RASModel, LamBremhorstKE, dictionary);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 LamBremhorstKE::LamBremhorstKE
49 const volVectorField& U,
50 const surfaceScalarField& phi,
51 transportModel& lamTransportModel
54 RASModel(typeName, U, phi, lamTransportModel),
58 dimensionedScalar::lookupOrAddToDict
67 dimensionedScalar::lookupOrAddToDict
76 dimensionedScalar::lookupOrAddToDict
85 dimensionedScalar::lookupOrAddToDict
121 Rt_(sqr(k_)/(nu()*epsilon_)),
125 sqr(scalar(1) - exp(-0.0165*(sqrt(k_)*y_/nu())))
126 *(scalar(1) + 20.5/(Rt_ + SMALL))
139 autoCreateLowReNut("nut", mesh_)
142 nut_ = Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_);
143 nut_ = min(nut_, nuRatio()*nu());
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()
223 // Bound in case of topological change
225 if (mesh_.changing())
228 bound(epsilon_, epsilon0_);
238 if (mesh_.changing())
243 volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
246 // Calculate parameters and coefficients for low-Reynolds number model
248 Rt_ = sqr(k_)/(nu()*epsilon_);
249 volScalarField Ry = sqrt(k_)*y_/nu();
251 fMu_ = sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt_ + SMALL));
253 volScalarField f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
254 volScalarField f2 = scalar(1) - exp(-sqr(Rt_));
257 // Dissipation equation
259 tmp<fvScalarMatrix> epsEqn
262 + fvm::div(phi_, epsilon_)
263 + fvm::SuSp(-fvc::div(phi_), epsilon_)
264 - fvm::laplacian(DepsilonEff(), epsilon_)
267 - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
272 bound(epsilon_, epsilon0_);
275 // Turbulent kinetic energy equation
277 tmp<fvScalarMatrix> kEqn
281 + fvm::SuSp(-fvc::div(phi_), k_)
282 - fvm::laplacian(DkEff(), k_)
284 G - fvm::Sp(epsilon_/k_, k_)
292 // Re-calculate viscosity
293 nut_ == Cmu_*fMu_*sqr(k_)/epsilon_;
294 nut_ == min(nut_, nuRatio()*nu());
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 } // End namespace RASModels
301 } // End namespace incompressible
302 } // End namespace Foam
304 // ************************************************************************* //