1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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));
73 tmp<volScalarField> kOmegaSST::F2() const
75 volScalarField arg2 = min
79 (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_),
80 scalar(500)*nu()/(sqr(y_)*omega_)
85 return tanh(sqr(arg2));
89 tmp<volScalarField> kOmegaSST::F3() const
91 tmp<volScalarField> arg3 = min
93 150*nu()/(omega_*sqr(y_)),
97 return 1 - tanh(pow4(arg3));
101 tmp<volScalarField> kOmegaSST::F23() const
103 tmp<volScalarField> f23(F2());
114 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
118 const volVectorField& U,
119 const surfaceScalarField& phi,
120 transportModel& lamTransportModel
123 RASModel(typeName, U, phi, lamTransportModel),
127 dimensionedScalar::lookupOrAddToDict
136 dimensionedScalar::lookupOrAddToDict
145 dimensionedScalar::lookupOrAddToDict
154 dimensionedScalar::lookupOrAddToDict
163 dimensionedScalar::lookupOrAddToDict
172 dimensionedScalar::lookupOrAddToDict
181 dimensionedScalar::lookupOrAddToDict
190 dimensionedScalar::lookupOrAddToDict
199 dimensionedScalar::lookupOrAddToDict
208 dimensionedScalar::lookupOrAddToDict
217 dimensionedScalar::lookupOrAddToDict
226 dimensionedScalar::lookupOrAddToDict
235 Switch::lookupOrAddToDict
255 autoCreateK("k", mesh_, U_.db())
267 autoCreateOmega("omega", mesh_, U_.db())
279 autoCreateNut("nut", mesh_, U_.db())
283 bound(omega_, omega0_);
291 b1_*F23()*sqrt(2.0)*mag(symm(fvc::grad(U_)))
294 nut_.correctBoundaryConditions();
300 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
302 tmp<volSymmTensorField> kOmegaSST::R() const
304 return tmp<volSymmTensorField>
306 new volSymmTensorField
316 ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
317 k_.boundaryField().types()
323 tmp<volSymmTensorField> kOmegaSST::devReff() const
325 return tmp<volSymmTensorField>
327 new volSymmTensorField
337 -nuEff()*dev(twoSymm(fvc::grad(U_)))
343 tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const
347 - fvm::laplacian(nuEff(), U)
348 - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
353 bool kOmegaSST::read()
355 if (RASModel::read())
357 alphaK1_.readIfPresent(coeffDict());
358 alphaK2_.readIfPresent(coeffDict());
359 alphaOmega1_.readIfPresent(coeffDict());
360 alphaOmega2_.readIfPresent(coeffDict());
361 gamma1_.readIfPresent(coeffDict());
362 gamma2_.readIfPresent(coeffDict());
363 beta1_.readIfPresent(coeffDict());
364 beta2_.readIfPresent(coeffDict());
365 betaStar_.readIfPresent(coeffDict());
366 a1_.readIfPresent(coeffDict());
367 b1_.readIfPresent(coeffDict());
368 c1_.readIfPresent(coeffDict());
369 F3_.readIfPresent("F3", coeffDict());
380 void kOmegaSST::correct()
382 // Bound in case of topological change
384 if (mesh_.changing())
387 bound(omega_, omega0_);
397 if (mesh_.changing())
402 const volScalarField S2(2*magSqr(symm(fvc::grad(U_))));
403 volScalarField G("RASModel::G", nut_*S2);
405 // Update omega and G at the wall
406 omega_.boundaryField().updateCoeffs();
408 const volScalarField CDkOmega
410 (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
413 const volScalarField F1(this->F1(CDkOmega));
415 // Turbulent frequency equation
416 fvScalarMatrix omegaEqn
419 + fvm::div(phi_, omega_)
420 + fvm::SuSp(-fvc::div(phi_), omega_)
421 - fvm::laplacian(DomegaEff(F1), omega_)
427 (c1_/a1_)*betaStar_*omega_*max(a1_*omega_, b1_*F23()*sqrt(S2))
429 - fvm::Sp(beta(F1)*omega_, omega_)
432 (F1 - scalar(1))*CDkOmega/omega_,
439 // No longer needed: matrix completes at the point of solution
441 // omegaEqn.completeAssembly();
444 bound(omega_, omega0_);
446 // Turbulent kinetic energy equation
451 + fvm::SuSp(-fvc::div(phi_), k_)
452 - fvm::laplacian(DkEff(F1), k_)
454 min(G, c1_*betaStar_*k_*omega_)
455 - fvm::Sp(betaStar_*omega_, k_)
461 bound(omega_, omega0_);
463 // Re-calculate viscosity
464 // Fixed sqrt(2) error. HJ, 10/Jun/2015
465 nut_ = a1_*k_/max(a1_*omega_, b1_*F23()*sqrt(S2));
466 nut_ = min(nut_, nuRatio()*nu());
467 nut_.correctBoundaryConditions();
471 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
473 } // End namespace RASModels
474 } // End namespace incompressible
475 } // End namespace Foam
477 // ************************************************************************* //