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 "kOmegaSST.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "backwardsCompatibilityWallFunctions.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace compressible
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(kOmegaSST, 0);
43 addToRunTimeSelectionTable(RASModel, kOmegaSST, dictionary);
45 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
47 tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const
49 tmp<volScalarField> CDkOmegaPlus = max
52 dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10)
55 tmp<volScalarField> arg1 = min
61 (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_),
62 scalar(500)*(mu()/rho_)/(sqr(y_)*omega_)
64 (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_))
69 return tanh(pow4(arg1));
72 tmp<volScalarField> kOmegaSST::F2() const
74 tmp<volScalarField> arg2 = min
78 (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_),
79 scalar(500)*(mu()/rho_)/(sqr(y_)*omega_)
84 return tanh(sqr(arg2));
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92 const volScalarField& rho,
93 const volVectorField& U,
94 const surfaceScalarField& phi,
95 const basicThermo& thermophysicalModel,
96 const word& turbulenceModelName,
100 RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName),
104 dimensioned<scalar>::lookupOrAddToDict
113 dimensioned<scalar>::lookupOrAddToDict
122 dimensioned<scalar>::lookupOrAddToDict
131 dimensioned<scalar>::lookupOrAddToDict
140 dimensioned<scalar>::lookupOrAddToDict
149 dimensioned<scalar>::lookupOrAddToDict
158 dimensioned<scalar>::lookupOrAddToDict
167 dimensioned<scalar>::lookupOrAddToDict
176 dimensioned<scalar>::lookupOrAddToDict
185 dimensioned<scalar>::lookupOrAddToDict
194 dimensioned<scalar>::lookupOrAddToDict
203 dimensioned<scalar>::lookupOrAddToDict
223 autoCreateK("k", mesh_)
235 autoCreateOmega("omega", mesh_)
247 autoCreateMut("mut", mesh_)
259 autoCreateAlphat("alphat", mesh_)
263 bound(omega_, omegaMin_);
271 F2()*sqrt(2.0*magSqr(symm(fvc::grad(U_))))
274 mut_.correctBoundaryConditions();
277 alphat_.correctBoundaryConditions();
283 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
285 tmp<volSymmTensorField> kOmegaSST::R() const
287 return tmp<volSymmTensorField>
289 new volSymmTensorField
299 ((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))),
300 k_.boundaryField().types()
306 tmp<volSymmTensorField> kOmegaSST::devRhoReff() const
308 return tmp<volSymmTensorField>
310 new volSymmTensorField
320 -muEff()*dev(twoSymm(fvc::grad(U_)))
326 tmp<fvVectorMatrix> kOmegaSST::divDevRhoReff(volVectorField& U) const
330 - fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(T(fvc::grad(U))))
335 bool kOmegaSST::read()
337 if (RASModel::read())
339 alphaK1_.readIfPresent(coeffDict());
340 alphaK2_.readIfPresent(coeffDict());
341 alphaOmega1_.readIfPresent(coeffDict());
342 alphaOmega2_.readIfPresent(coeffDict());
343 Prt_.readIfPresent(coeffDict());
344 gamma1_.readIfPresent(coeffDict());
345 gamma2_.readIfPresent(coeffDict());
346 beta1_.readIfPresent(coeffDict());
347 beta2_.readIfPresent(coeffDict());
348 betaStar_.readIfPresent(coeffDict());
349 a1_.readIfPresent(coeffDict());
350 c1_.readIfPresent(coeffDict());
361 void kOmegaSST::correct()
365 // Re-calculate viscosity
368 /max(a1_*omega_, F2()*sqrt(2.0*magSqr(symm(fvc::grad(U_)))));
369 mut_.correctBoundaryConditions();
371 // Re-calculate thermal diffusivity
373 alphat_.correctBoundaryConditions();
380 volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_)));
382 if (mesh_.changing())
389 divU += fvc::div(mesh_.phi());
392 tmp<volTensorField> tgradU = fvc::grad(U_);
393 volScalarField S2(2*magSqr(symm(tgradU())));
394 volScalarField GbyMu((tgradU() && dev(twoSymm(tgradU()))));
395 volScalarField G("RASModel::G", mut_*GbyMu);
398 // Update omega and G at the wall
399 omega_.boundaryField().updateCoeffs();
401 volScalarField CDkOmega
403 (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
406 volScalarField F1(this->F1(CDkOmega));
407 volScalarField rhoGammaF1(rho_*gamma(F1));
409 // Turbulent frequency equation
410 tmp<fvScalarMatrix> omegaEqn
412 fvm::ddt(rho_, omega_)
413 + fvm::div(phi_, omega_)
414 - fvm::laplacian(DomegaEff(F1), omega_)
417 - fvm::SuSp((2.0/3.0)*rhoGammaF1*divU, omega_)
418 - fvm::Sp(rho_*beta(F1)*omega_, omega_)
421 rho_*(F1 - scalar(1))*CDkOmega/omega_,
428 omegaEqn().boundaryManipulate(omega_.boundaryField());
431 bound(omega_, omegaMin_);
433 // Turbulent kinetic energy equation
434 tmp<fvScalarMatrix> kEqn
438 - fvm::laplacian(DkEff(F1), k_)
440 min(G, (c1_*betaStar_)*rho_*k_*omega_)
441 - fvm::SuSp(2.0/3.0*rho_*divU, k_)
442 - fvm::Sp(rho_*betaStar_*omega_, k_)
450 // Re-calculate viscosity
451 mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(S2));
452 mut_.correctBoundaryConditions();
454 // Re-calculate thermal diffusivity
456 alphat_.correctBoundaryConditions();
460 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
462 } // End namespace RASModels
463 } // End namespace compressible
464 } // End namespace Foam
466 // ************************************************************************* //