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 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 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)*nu()/(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)*nu()/(sqr(y_)*omega_)
84 return tanh(sqr(arg2));
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92 const volVectorField& U,
93 const surfaceScalarField& phi,
94 transportModel& transport,
95 const word& turbulenceModelName,
99 RASModel(modelName, U, phi, transport, turbulenceModelName),
103 dimensioned<scalar>::lookupOrAddToDict
112 dimensioned<scalar>::lookupOrAddToDict
121 dimensioned<scalar>::lookupOrAddToDict
130 dimensioned<scalar>::lookupOrAddToDict
139 dimensioned<scalar>::lookupOrAddToDict
148 dimensioned<scalar>::lookupOrAddToDict
157 dimensioned<scalar>::lookupOrAddToDict
166 dimensioned<scalar>::lookupOrAddToDict
175 dimensioned<scalar>::lookupOrAddToDict
184 dimensioned<scalar>::lookupOrAddToDict
193 dimensioned<scalar>::lookupOrAddToDict
213 autoCreateK("k", mesh_)
225 autoCreateOmega("omega", mesh_)
237 autoCreateNut("nut", mesh_)
241 bound(omega_, omegaMin_);
249 F2()*sqrt(2.0)*mag(symm(fvc::grad(U_)))
252 nut_.correctBoundaryConditions();
258 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
260 tmp<volSymmTensorField> kOmegaSST::R() const
262 return tmp<volSymmTensorField>
264 new volSymmTensorField
274 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
275 k_.boundaryField().types()
281 tmp<volSymmTensorField> kOmegaSST::devReff() const
283 return tmp<volSymmTensorField>
285 new volSymmTensorField
295 -nuEff()*dev(twoSymm(fvc::grad(U_)))
301 tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const
305 - fvm::laplacian(nuEff(), U)
306 - fvc::div(nuEff()*dev(T(fvc::grad(U))))
311 bool kOmegaSST::read()
313 if (RASModel::read())
315 alphaK1_.readIfPresent(coeffDict());
316 alphaK2_.readIfPresent(coeffDict());
317 alphaOmega1_.readIfPresent(coeffDict());
318 alphaOmega2_.readIfPresent(coeffDict());
319 gamma1_.readIfPresent(coeffDict());
320 gamma2_.readIfPresent(coeffDict());
321 beta1_.readIfPresent(coeffDict());
322 beta2_.readIfPresent(coeffDict());
323 betaStar_.readIfPresent(coeffDict());
324 a1_.readIfPresent(coeffDict());
325 c1_.readIfPresent(coeffDict());
336 void kOmegaSST::correct()
345 if (mesh_.changing())
350 const volScalarField S2(2*magSqr(symm(fvc::grad(U_))));
351 volScalarField G("RASModel::G", nut_*S2);
353 // Update omega and G at the wall
354 omega_.boundaryField().updateCoeffs();
356 const volScalarField CDkOmega
358 (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
361 const volScalarField F1(this->F1(CDkOmega));
363 // Turbulent frequency equation
364 tmp<fvScalarMatrix> omegaEqn
367 + fvm::div(phi_, omega_)
368 - fvm::Sp(fvc::div(phi_), omega_)
369 - fvm::laplacian(DomegaEff(F1), omega_)
372 - fvm::Sp(beta(F1)*omega_, omega_)
375 (F1 - scalar(1))*CDkOmega/omega_,
382 omegaEqn().boundaryManipulate(omega_.boundaryField());
385 bound(omega_, omegaMin_);
387 // Turbulent kinetic energy equation
388 tmp<fvScalarMatrix> kEqn
392 - fvm::Sp(fvc::div(phi_), k_)
393 - fvm::laplacian(DkEff(F1), k_)
395 min(G, c1_*betaStar_*k_*omega_)
396 - fvm::Sp(betaStar_*omega_, k_)
404 // Re-calculate viscosity
405 nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2));
406 nut_.correctBoundaryConditions();
410 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
412 } // End namespace RASModels
413 } // End namespace incompressible
414 } // End namespace Foam
416 // ************************************************************************* //