1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "addToRunTimeSelectionTable.H"
29 #include "backwardsCompatibilityWallFunctions.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(qZeta, 0);
43 addToRunTimeSelectionTable(RASModel, qZeta, dictionary);
45 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
47 tmp<volScalarField> qZeta::fMu() const
49 const volScalarField Rt(q_*k_/(2.0*nu()*zeta_));
53 return exp((-scalar(2.5) + Rt/20.0)/pow(scalar(1) + Rt/130.0, 3.0));
58 exp(-6.0/sqr(scalar(1) + Rt/50.0))
59 *(scalar(1) + 3.0*exp(-Rt/10.0));
64 tmp<volScalarField> qZeta::f2() const
66 tmp<volScalarField> Rt = q_*k_/(2.0*nu()*zeta_);
67 return scalar(1) - 0.3*exp(-sqr(Rt));
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 const volVectorField& U,
76 const surfaceScalarField& phi,
77 transportModel& transport,
78 const word& turbulenceModelName,
82 RASModel(modelName, U, phi, transport, turbulenceModelName),
86 dimensioned<scalar>::lookupOrAddToDict
95 dimensioned<scalar>::lookupOrAddToDict
104 dimensioned<scalar>::lookupOrAddToDict
113 dimensioned<scalar>::lookupOrAddToDict
122 Switch::lookupOrAddToDict
130 qMin_("qMin", dimVelocity, SMALL),
131 zetaMin_("zetaMin", dimVelocity/dimTime, SMALL),
170 k_.boundaryField().types()
183 epsilon_/(2.0*bound(q_, qMin_)),
184 epsilon_.boundaryField().types()
197 autoCreateNut("nut", mesh_)
201 bound(epsilon_, epsilonMin_);
202 // already bounded: bound(q_, qMin_);
203 bound(zeta_, zetaMin_);
205 nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
206 nut_.correctBoundaryConditions();
212 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
214 tmp<volSymmTensorField> qZeta::R() const
216 return tmp<volSymmTensorField>
218 new volSymmTensorField
228 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
229 k_.boundaryField().types()
235 tmp<volSymmTensorField> qZeta::devReff() const
237 return tmp<volSymmTensorField>
239 new volSymmTensorField
249 -nuEff()*dev(twoSymm(fvc::grad(U_)))
255 tmp<fvVectorMatrix> qZeta::divDevReff(volVectorField& U) const
259 - fvm::laplacian(nuEff(), U)
260 - fvc::div(nuEff()*dev(T(fvc::grad(U))))
267 if (RASModel::read())
269 Cmu_.readIfPresent(coeffDict());
270 C1_.readIfPresent(coeffDict());
271 C2_.readIfPresent(coeffDict());
272 sigmaZeta_.readIfPresent(coeffDict());
273 anisotropic_.readIfPresent("anisotropic", coeffDict());
275 qMin_.readIfPresent(*this);
276 zetaMin_.readIfPresent(*this);
287 void qZeta::correct()
296 tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_)));
298 volScalarField G("RASModel::G", nut_/(2.0*q_)*S2);
299 const volScalarField E(nu()*nut_/q_*fvc::magSqrGradGrad(U_));
304 tmp<fvScalarMatrix> zetaEqn
307 + fvm::div(phi_, zeta_)
308 - fvm::laplacian(DzetaEff(), zeta_)
310 (2.0*C1_ - 1)*G*zeta_/q_
311 - fvm::Sp((2.0*C2_ - dimensionedScalar(1.0))*f2()*zeta_/q_, zeta_)
317 bound(zeta_, zetaMin_);
322 tmp<fvScalarMatrix> qEqn
326 - fvm::laplacian(DqEff(), q_)
328 G - fvm::Sp(zeta_/q_, q_)
336 // Re-calculate k and epsilon
338 k_.correctBoundaryConditions();
340 epsilon_ = 2*q_*zeta_;
341 epsilon_.correctBoundaryConditions();
344 // Re-calculate viscosity
345 nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
346 nut_.correctBoundaryConditions();
350 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
352 } // End namespace RASModels
353 } // End namespace incompressible
354 } // End namespace Foam
356 // ************************************************************************* //