1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-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 <OpenFOAM/addToRunTimeSelectionTable.H>
29 #include <incompressibleRASModels/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_)
238 bound(omega_, omega0_);
240 nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(2.0)*mag(symm(fvc::grad(U_))));
241 nut_.correctBoundaryConditions();
247 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
249 tmp<volSymmTensorField> kOmegaSST::R() const
251 return tmp<volSymmTensorField>
253 new volSymmTensorField
263 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
264 k_.boundaryField().types()
270 tmp<volSymmTensorField> kOmegaSST::devReff() const
272 return tmp<volSymmTensorField>
274 new volSymmTensorField
284 -nuEff()*dev(twoSymm(fvc::grad(U_)))
290 tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const
294 - fvm::laplacian(nuEff(), U)
295 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
300 bool kOmegaSST::read()
302 if (RASModel::read())
304 alphaK1_.readIfPresent(coeffDict());
305 alphaK2_.readIfPresent(coeffDict());
306 alphaOmega1_.readIfPresent(coeffDict());
307 alphaOmega2_.readIfPresent(coeffDict());
308 gamma1_.readIfPresent(coeffDict());
309 gamma2_.readIfPresent(coeffDict());
310 beta1_.readIfPresent(coeffDict());
311 beta2_.readIfPresent(coeffDict());
312 betaStar_.readIfPresent(coeffDict());
313 a1_.readIfPresent(coeffDict());
314 c1_.readIfPresent(coeffDict());
325 void kOmegaSST::correct()
334 if (mesh_.changing())
339 volScalarField S2 = magSqr(symm(fvc::grad(U_)));
340 volScalarField G("RASModel::G", nut_*2*S2);
342 // Update omega and G at the wall
343 omega_.boundaryField().updateCoeffs();
345 volScalarField CDkOmega =
346 (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_;
348 volScalarField F1 = this->F1(CDkOmega);
350 // Turbulent frequency equation
351 tmp<fvScalarMatrix> omegaEqn
354 + fvm::div(phi_, omega_)
355 - fvm::Sp(fvc::div(phi_), omega_)
356 - fvm::laplacian(DomegaEff(F1), omega_)
359 - fvm::Sp(beta(F1)*omega_, omega_)
362 (F1 - scalar(1))*CDkOmega/omega_,
369 omegaEqn().boundaryManipulate(omega_.boundaryField());
372 bound(omega_, omega0_);
374 // Turbulent kinetic energy equation
375 tmp<fvScalarMatrix> kEqn
379 - fvm::Sp(fvc::div(phi_), k_)
380 - fvm::laplacian(DkEff(F1), k_)
382 min(G, c1_*betaStar_*k_*omega_)
383 - fvm::Sp(betaStar_*omega_, k_)
391 // Re-calculate viscosity
392 nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(2*S2));
393 nut_.correctBoundaryConditions();
397 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
399 } // End namespace RASModels
400 } // End namespace incompressible
401 } // End namespace Foam
403 // ************************ vim: set sw=4 sts=4 et: ************************ //