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 \*---------------------------------------------------------------------------*/
26 #include "kOmegaSST.H"
27 #include "addToRunTimeSelectionTable.H"
29 #include "backwardsCompatibilityWallFunctions.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace incompressible
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 volScalarField CDkOmegaPlus = max
52 dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10)
55 volScalarField arg1 = min
61 (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_),
62 scalar(500)*nu()/(sqr(y_)*omega_)
64 (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_))
69 return tanh(pow4(arg1));
72 tmp<volScalarField> kOmegaSST::F2() const
74 volScalarField arg2 = min
78 (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_),
79 scalar(500)*nu()/(sqr(y_)*omega_)
84 return tanh(sqr(arg2));
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92 const volVectorField& U,
93 const surfaceScalarField& phi,
94 transportModel& lamTransportModel
97 RASModel(typeName, U, phi, lamTransportModel),
101 dimensioned<scalar>::lookupOrAddToDict
110 dimensioned<scalar>::lookupOrAddToDict
119 dimensioned<scalar>::lookupOrAddToDict
128 dimensioned<scalar>::lookupOrAddToDict
137 dimensioned<scalar>::lookupOrAddToDict
146 dimensioned<scalar>::lookupOrAddToDict
155 dimensioned<scalar>::lookupOrAddToDict
164 dimensioned<scalar>::lookupOrAddToDict
173 dimensioned<scalar>::lookupOrAddToDict
182 dimensioned<scalar>::lookupOrAddToDict
191 dimensioned<scalar>::lookupOrAddToDict
211 autoCreateK("k", mesh_)
223 autoCreateOmega("omega", mesh_)
235 autoCreateNut("nut", mesh_)
242 a1_*(omega_ + omegaSmall_),
243 F2()*mag(symm(fvc::grad(U_)))
245 nut_.correctBoundaryConditions();
251 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
253 tmp<volSymmTensorField> kOmegaSST::R() const
255 return tmp<volSymmTensorField>
257 new volSymmTensorField
267 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
268 k_.boundaryField().types()
274 tmp<volSymmTensorField> kOmegaSST::devReff() const
276 return tmp<volSymmTensorField>
278 new volSymmTensorField
288 -nuEff()*dev(twoSymm(fvc::grad(U_)))
294 tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const
298 - fvm::laplacian(nuEff(), U)
299 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
304 bool kOmegaSST::read()
306 if (RASModel::read())
308 alphaK1_.readIfPresent(coeffDict());
309 alphaK2_.readIfPresent(coeffDict());
310 alphaOmega1_.readIfPresent(coeffDict());
311 alphaOmega2_.readIfPresent(coeffDict());
312 gamma1_.readIfPresent(coeffDict());
313 gamma2_.readIfPresent(coeffDict());
314 beta1_.readIfPresent(coeffDict());
315 beta2_.readIfPresent(coeffDict());
316 betaStar_.readIfPresent(coeffDict());
317 a1_.readIfPresent(coeffDict());
318 c1_.readIfPresent(coeffDict());
329 void kOmegaSST::correct()
338 if (mesh_.changing())
343 volScalarField S2 = magSqr(symm(fvc::grad(U_)));
344 volScalarField G("RASModel::G", nut_*2*S2);
346 // Update omega and G at the wall
347 omega_.boundaryField().updateCoeffs();
349 volScalarField F1 = this->F1
351 (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
354 // Epsilon diffusion correction
355 surfaceScalarField CDkPhiOmega
359 *fvc::interpolate(F1 - scalar(1))
360 /fvc::interpolate(omega_)
361 *fvc::snGrad(k_)*mesh_.magSf()
364 forAll (CDkPhiOmega.boundaryField(), patchi)
366 if (!CDkPhiOmega.boundaryField()[patchi].coupled())
368 CDkPhiOmega.boundaryField()[patchi] = 0.0;
372 // Turbulent frequency equation
373 tmp<fvScalarMatrix> omegaEqn
376 + fvm::div(phi_, omega_)
377 - fvm::Sp(fvc::div(phi_), omega_)
378 - fvm::laplacian(DomegaEff(F1), omega_)
379 + fvm::div(CDkPhiOmega, omega_)
380 - fvm::Sp(fvc::div(CDkPhiOmega), omega_)
383 - fvm::Sp(beta(F1)*omega_, omega_)
388 omegaEqn().boundaryManipulate(omega_.boundaryField());
391 bound(omega_, omega0_);
393 // Turbulent kinetic energy equation
394 tmp<fvScalarMatrix> kEqn
398 - fvm::Sp(fvc::div(phi_), k_)
399 - fvm::laplacian(DkEff(F1), k_)
401 min(G, c1_*betaStar_*k_*omega_)
402 - fvm::Sp(betaStar_*omega_, k_)
410 // Re-calculate viscosity
411 nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2));
412 nut_.correctBoundaryConditions();
416 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
418 } // End namespace RASModels
419 } // End namespace incompressible
420 } // End namespace Foam
422 // ************************************************************************* //