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 \*---------------------------------------------------------------------------*/
27 #include "NonlinearKEShih.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "wallFvPatch.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(NonlinearKEShih, 0);
43 addToRunTimeSelectionTable(RASModel, NonlinearKEShih, dictionary);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 NonlinearKEShih::NonlinearKEShih
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
95 dimensioned<scalar>::lookupOrAddToDict
104 dimensioned<scalar>::lookupOrAddToDict
113 dimensioned<scalar>::lookupOrAddToDict
122 dimensioned<scalar>::lookupOrAddToDict
131 dimensioned<scalar>::lookupOrAddToDict
140 dimensioned<scalar>::lookupOrAddToDict
174 gradU_(fvc::grad(U)),
175 eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))),
176 ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))),
177 Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
178 fEta_(A2_ + pow(eta_, 3.0)),
180 nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)),
187 pow(k_, 3.0)/sqr(epsilon_)
192 + (gradU_ & gradU_)().T()
194 + Ctau2_/fEta_*(gradU_ & gradU_.T())
195 + Ctau3_/fEta_*(gradU_.T() & gradU_)
200 # include "wallNonlinearViscosityI.H"
206 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
208 tmp<volSymmTensorField> NonlinearKEShih::R() const
210 volTensorField gradU_ = fvc::grad(U_);
212 return tmp<volSymmTensorField>
214 new volSymmTensorField
224 ((2.0/3.0)*I)*k_ - nut_*twoSymm(gradU_) + nonlinearStress_,
225 k_.boundaryField().types()
231 tmp<volSymmTensorField> NonlinearKEShih::devReff() const
233 return tmp<volSymmTensorField>
235 new volSymmTensorField
245 -nuEff()*dev(twoSymm(fvc::grad(U_))) + nonlinearStress_
251 tmp<fvVectorMatrix> NonlinearKEShih::divDevReff(volVectorField& U) const
255 fvc::div(nonlinearStress_)
256 - fvm::laplacian(nuEff(), U)
257 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
262 bool NonlinearKEShih::read()
264 if (RASModel::read())
266 C1_.readIfPresent(coeffDict_);
267 C2_.readIfPresent(coeffDict_);
268 alphak_.readIfPresent(coeffDict_);
269 alphaEps_.readIfPresent(coeffDict_);
270 A1_.readIfPresent(coeffDict_);
271 A2_.readIfPresent(coeffDict_);
272 Ctau1_.readIfPresent(coeffDict_);
273 Ctau2_.readIfPresent(coeffDict_);
274 Ctau3_.readIfPresent(coeffDict_);
275 alphaKsi_.readIfPresent(coeffDict_);
286 void NonlinearKEShih::correct()
288 transportModel_.correct();
297 gradU_ = fvc::grad(U_);
300 volScalarField S2 = symm(gradU_) && gradU_;
303 Cmu_*sqr(k_)/epsilon_*S2
304 - (nonlinearStress_ && gradU_);
306 # include "nonLinearWallFunctionsI.H"
308 // Dissipation equation
309 tmp<fvScalarMatrix> epsEqn
312 + fvm::div(phi_, epsilon_)
313 - fvm::laplacian(DepsilonEff(), epsilon_)
316 - fvm::Sp(C2_*epsilon_/k_, epsilon_)
321 # include "wallDissipationI.H"
324 bound(epsilon_, epsilon0_);
327 // Turbulent kinetic energy equation
329 tmp<fvScalarMatrix> kEqn
333 - fvm::laplacian(DkEff(), k_)
336 - fvm::Sp(epsilon_/k_, k_)
344 // Re-calculate viscosity
346 eta_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())));
347 ksi_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())));
348 Cmu_ = 2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_));
349 fEta_ = A2_ + pow(eta_, 3.0);
351 nut_ = Cmu_*sqr(k_)/epsilon_;
353 # include "wallNonlinearViscosityI.H"
355 nonlinearStress_ = symm
357 pow(k_, 3.0)/sqr(epsilon_)
362 + (gradU_ & gradU_)().T()
364 + Ctau2_/fEta_*(gradU_ & gradU_.T())
365 + Ctau3_/fEta_*(gradU_.T() & gradU_)
371 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
373 } // End namespace RASModels
374 } // End namespace incompressible
375 } // End namespace Foam
377 // ************************************************************************* //