1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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"
29 #include "wallFvPatch.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(kEpsilon, 0);
43 addToRunTimeSelectionTable(RASModel, kEpsilon, dictionary);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 // Construct from components
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
120 nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_))
122 # include "wallViscosityI.H"
128 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 tmp<volSymmTensorField> kEpsilon::R() const
132 return tmp<volSymmTensorField>
134 new volSymmTensorField
144 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
145 k_.boundaryField().types()
151 tmp<volSymmTensorField> kEpsilon::devReff() const
153 return tmp<volSymmTensorField>
155 new volSymmTensorField
165 -nuEff()*dev(twoSymm(fvc::grad(U_)))
171 tmp<fvVectorMatrix> kEpsilon::divDevReff(volVectorField& U) const
175 - fvm::laplacian(nuEff(), U)
176 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
181 bool kEpsilon::read()
183 if (RASModel::read())
185 Cmu_.readIfPresent(coeffDict_);
186 C1_.readIfPresent(coeffDict_);
187 C2_.readIfPresent(coeffDict_);
188 alphaEps_.readIfPresent(coeffDict_);
199 void kEpsilon::correct()
201 transportModel_.correct();
210 volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_)));
212 # include "wallFunctionsI.H"
214 // Dissipation equation
215 tmp<fvScalarMatrix> epsEqn
218 + fvm::div(phi_, epsilon_)
219 - fvm::Sp(fvc::div(phi_), epsilon_)
220 - fvm::laplacian(DepsilonEff(), epsilon_)
223 - fvm::Sp(C2_*epsilon_/k_, epsilon_)
228 # include "wallDissipationI.H"
231 bound(epsilon_, epsilon0_);
234 // Turbulent kinetic energy equation
235 tmp<fvScalarMatrix> kEqn
239 - fvm::Sp(fvc::div(phi_), k_)
240 - fvm::laplacian(DkEff(), k_)
243 - fvm::Sp(epsilon_/k_, k_)
251 // Re-calculate viscosity
252 nut_ = Cmu_*sqr(k_)/epsilon_;
254 # include "wallViscosityI.H"
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 } // End namespace RASModels
262 } // End namespace incompressible
263 } // End namespace Foam
265 // ************************************************************************* //