1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
26 #include "NonlinearKEShih.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "wallFvPatch.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace incompressible
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(NonlinearKEShih, 0);
42 addToRunTimeSelectionTable(RASModel, NonlinearKEShih, dictionary);
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 NonlinearKEShih::NonlinearKEShih
48 const volVectorField& U,
49 const surfaceScalarField& phi,
50 transportModel& transport,
51 const word& turbulenceModelName,
55 RASModel(modelName, U, phi, transport, turbulenceModelName),
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
150 dimensioned<scalar>::lookupOrAddToDict
159 dimensioned<scalar>::lookupOrAddToDict
193 gradU_(fvc::grad(U)),
196 k_/bound(epsilon_, epsilonMin_)
197 *sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))
202 *sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))
204 Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
205 fEta_(A2_ + pow(eta_, 3.0)),
207 nut_("nut", Cmu_*sqr(k_)/epsilon_),
214 pow3(k_)/sqr(epsilon_)
219 + (gradU_ & gradU_)().T()
221 + Ctau2_/fEta_*(gradU_ & gradU_.T())
222 + Ctau3_/fEta_*(gradU_.T() & gradU_)
228 // already bounded: bound(epsilon_, epsilonMin_);
230 #include "wallNonlinearViscosityI.H"
236 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
238 tmp<volSymmTensorField> NonlinearKEShih::R() const
240 return tmp<volSymmTensorField>
242 new volSymmTensorField
252 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)) + nonlinearStress_,
253 k_.boundaryField().types()
259 tmp<volSymmTensorField> NonlinearKEShih::devReff() const
261 return tmp<volSymmTensorField>
263 new volSymmTensorField
273 -nuEff()*dev(twoSymm(fvc::grad(U_))) + nonlinearStress_
279 tmp<fvVectorMatrix> NonlinearKEShih::divDevReff(volVectorField& U) const
283 fvc::div(nonlinearStress_)
284 - fvm::laplacian(nuEff(), U)
285 - fvc::div(nuEff()*dev(T(fvc::grad(U))))
290 bool NonlinearKEShih::read()
292 if (RASModel::read())
294 C1_.readIfPresent(coeffDict());
295 C2_.readIfPresent(coeffDict());
296 sigmak_.readIfPresent(coeffDict());
297 sigmaEps_.readIfPresent(coeffDict());
298 A1_.readIfPresent(coeffDict());
299 A2_.readIfPresent(coeffDict());
300 Ctau1_.readIfPresent(coeffDict());
301 Ctau2_.readIfPresent(coeffDict());
302 Ctau3_.readIfPresent(coeffDict());
303 alphaKsi_.readIfPresent(coeffDict());
305 kappa_.readIfPresent(coeffDict());
306 E_.readIfPresent(coeffDict());
317 void NonlinearKEShih::correct()
326 gradU_ = fvc::grad(U_);
329 tmp<volScalarField> S2 = symm(gradU_) && gradU_;
334 Cmu_*sqr(k_)/epsilon_*S2
335 - (nonlinearStress_ && gradU_)
338 #include "nonLinearWallFunctionsI.H"
340 // Dissipation equation
341 tmp<fvScalarMatrix> epsEqn
344 + fvm::div(phi_, epsilon_)
345 - fvm::laplacian(DepsilonEff(), epsilon_)
348 - fvm::Sp(C2_*epsilon_/k_, epsilon_)
353 #include "wallDissipationI.H"
356 bound(epsilon_, epsilonMin_);
359 // Turbulent kinetic energy equation
361 tmp<fvScalarMatrix> kEqn
365 - fvm::laplacian(DkEff(), k_)
368 - fvm::Sp(epsilon_/k_, k_)
376 // Re-calculate viscosity
378 eta_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())));
379 ksi_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())));
380 Cmu_ = 2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_));
381 fEta_ = A2_ + pow(eta_, 3.0);
383 nut_ = Cmu_*sqr(k_)/epsilon_;
385 #include "wallNonlinearViscosityI.H"
387 nonlinearStress_ = symm
389 pow(k_, 3.0)/sqr(epsilon_)
394 + (gradU_ & gradU_)().T()
396 + Ctau2_/fEta_*(gradU_ & gradU_.T())
397 + Ctau3_/fEta_*(gradU_.T() & gradU_)
403 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405 } // End namespace RASModels
406 } // End namespace incompressible
407 } // End namespace Foam
409 // ************************************************************************* //