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 \*---------------------------------------------------------------------------*/
28 #include "addToRunTimeSelectionTable.H"
30 #include "backwardsCompatibilityWallFunctions.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace incompressible
41 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 defineTypeNameAndDebug(kEpsilon, 0);
44 addToRunTimeSelectionTable(RASModel, kEpsilon, dictionary);
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
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
104 autoCreateK("k", mesh_)
116 autoCreateEpsilon("epsilon", mesh_)
128 autoCreateNut("nut", mesh_)
131 nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
132 nut_.correctBoundaryConditions();
138 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
140 tmp<volSymmTensorField> kEpsilon::R() const
142 return tmp<volSymmTensorField>
144 new volSymmTensorField
154 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
155 k_.boundaryField().types()
161 tmp<volSymmTensorField> kEpsilon::devReff() const
163 return tmp<volSymmTensorField>
165 new volSymmTensorField
175 -nuEff()*dev(twoSymm(fvc::grad(U_)))
181 tmp<fvVectorMatrix> kEpsilon::divDevReff(volVectorField& U) const
185 - fvm::laplacian(nuEff(), U)
186 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
191 bool kEpsilon::read()
193 if (RASModel::read())
195 Cmu_.readIfPresent(coeffDict());
196 C1_.readIfPresent(coeffDict());
197 C2_.readIfPresent(coeffDict());
198 sigmaEps_.readIfPresent(coeffDict());
209 void kEpsilon::correct()
218 volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
220 // Update espsilon and G at the wall
221 epsilon_.boundaryField().updateCoeffs();
223 // Dissipation equation
224 tmp<fvScalarMatrix> epsEqn
227 + fvm::div(phi_, epsilon_)
228 - fvm::Sp(fvc::div(phi_), epsilon_)
229 - fvm::laplacian(DepsilonEff(), epsilon_)
232 - fvm::Sp(C2_*epsilon_/k_, epsilon_)
237 epsEqn().boundaryManipulate(epsilon_.boundaryField());
240 bound(epsilon_, epsilon0_);
243 // Turbulent kinetic energy equation
244 tmp<fvScalarMatrix> kEqn
248 - fvm::Sp(fvc::div(phi_), k_)
249 - fvm::laplacian(DkEff(), k_)
252 - fvm::Sp(epsilon_/k_, k_)
260 // Re-calculate viscosity
261 nut_ = Cmu_*sqr(k_)/epsilon_;
262 nut_.correctBoundaryConditions();
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 } // End namespace RASModels
269 } // End namespace incompressible
270 } // End namespace Foam
272 // ************************************************************************* //