From 43f91a1415d1d698d9649a6d6df733fd4e36477b Mon Sep 17 00:00:00 2001 From: Andrew Heather <a.heather@opencfd.co.uk> Date: Mon, 30 Nov 2015 16:18:17 +0000 Subject: [PATCH] CONTRIBUTION: Turbulence - new kOmegaSST DES, DDES and IDDES model variants - Initial code supplied by CFD Software E+F GmbH - Refactored and integrated into the new templated Turbulence structure by OpenCFD References: - kOmegaSSTDES model: Strelets, M. (2001) Detached Eddy Simulation of Massively Separated Flows, 39th AIAA Aerospace Sciences Meeting and Exhibit, Reno, NV - kOmegaSSTDDES model: Gritskevich, M.S., Garbaruk, A.V., Schuetze, J., Menter, F.R. (2011) Development of DDES and IDDES Formulations for the k-omega Shear Stress Transport Model, Flow, Turbulence and Combustion, pp. 1-19 - kOmegaSSTIDDES model: Gritskevich, M.S., Garbaruk, A.V., Schuetze, J., Menter, F.R. (2011) Development of DDES and IDDES Formulations for the k-omega Shear Stress Transport Model, Flow, Turbulence and Combustion, pp. 1-19 --- .../turbulentFluidThermoModels.C | 9 + .../turbulentTransportModels.C | 9 + .../DES/kOmegaSSTDDES/kOmegaSSTDDES.C | 173 +++++++++++ .../DES/kOmegaSSTDDES/kOmegaSSTDDES.H | 154 ++++++++++ .../DES/kOmegaSSTDES/kOmegaSSTDES.C | 289 ++++++++++++++++++ .../DES/kOmegaSSTDES/kOmegaSSTDES.H | 162 ++++++++++ .../DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C | 254 +++++++++++++++ .../DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H | 167 ++++++++++ .../turbulenceModels/LES/LESModel/LESModel.C | 11 + .../turbulenceModels/LES/LESModel/LESModel.H | 5 +- 10 files changed, 1232 insertions(+), 1 deletion(-) create mode 100644 src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C create mode 100644 src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H create mode 100644 src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C create mode 100644 src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H create mode 100644 src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C create mode 100644 src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C index db2d4140700..2f15cab1158 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C @@ -129,5 +129,14 @@ makeLESModel(SpalartAllmarasIDDES); #include "DeardorffDiffStress.H" makeLESModel(DeardorffDiffStress); +#include "kOmegaSSTDES.H" +makeLESModel(kOmegaSSTDES); + +#include "kOmegaSSTDDES.H" +makeLESModel(kOmegaSSTDDES); + +#include "kOmegaSSTIDDES.H" +makeLESModel(kOmegaSSTIDDES); + // ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C index 1a3dc38620b..db4f1ab3985 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C @@ -121,5 +121,14 @@ makeLESModel(SpalartAllmarasIDDES); #include "DeardorffDiffStress.H" makeLESModel(DeardorffDiffStress); +#include "kOmegaSSTDES.H" +makeLESModel(kOmegaSSTDES); + +#include "kOmegaSSTDDES.H" +makeLESModel(kOmegaSSTDDES); + +#include "kOmegaSSTIDDES.H" +makeLESModel(kOmegaSSTIDDES); + // ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C new file mode 100644 index 00000000000..9256590ddb1 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kOmegaSSTDDES.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTDDES<BasicTurbulenceModel>::rd +( + const volScalarField& nur, + const volScalarField& magGradU +) const +{ + tmp<volScalarField> tr + ( + min + ( + nur + /( + max + ( + magGradU, + dimensionedScalar("SMALL", magGradU.dimensions(), SMALL) + ) + *sqr(this->kappa_*this->y_) + ), + scalar(10) + ) + ); + tr().boundaryField() == 0.0; + + return tr; +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTDDES<BasicTurbulenceModel>::fd +( + const volScalarField& magGradU +) const +{ + return 1 - tanh(pow(cd1_*rd(this->nuEff(), magGradU), cd2_)); +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTDDES<BasicTurbulenceModel>::dTilda +( + const volScalarField& magGradU, + const volScalarField& CDES +) const +{ + const volScalarField& k = this->k_; + const volScalarField& omega = this->omega_; + + const volScalarField lRAS(sqrt(k)/(this->betaStar_*omega)); + const volScalarField lLES(CDES*this->delta()); + const dimensionedScalar d0("SMALL", dimLength, SMALL); + + return max(lRAS - fd(magGradU)*max(lRAS - lLES, d0), d0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +kOmegaSSTDDES<BasicTurbulenceModel>::kOmegaSSTDDES +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName, + const word& type +) +: + kOmegaSSTDES<BasicTurbulenceModel> + ( + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName, + type + ), + + cd1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "cd1", + this->coeffDict_, + 20 + ) + ), + cd2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "cd2", + this->coeffDict_, + 3 + ) + ) +{ + if (type == typeName) + { + this->printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +bool kOmegaSSTDDES<BasicTurbulenceModel>::read() +{ + if (kOmegaSSTDES<BasicTurbulenceModel>::read()) + { + cd1_.readIfPresent(this->coeffDict()); + cd2_.readIfPresent(this->coeffDict()); + + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H new file mode 100644 index 00000000000..ebc3e3ab12a --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::LESModels::kOmegaSSTDDES + +Group + grpDESTurbulence + +Description + k-omega-SST DDES turbulence model for incompressible and compressible flows + + Reference: + \verbatim + Gritskevich, M.S., Garbaruk, A.V., Schuetze, J., Menter, F.R. (2011) + Development of DDES and IDDES Formulations for the k-omega + Shear Stress Transport Model, Flow, Turbulence and Combustion, + pp. 1-19 + \endverbatim + +SourceFiles + kOmegaSSTDDES.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kOmegaSSTDDES_H +#define kOmegaSSTDDES_H + +#include "kOmegaSSTDES.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +/*---------------------------------------------------------------------------*\ + Class kOmegaSSTDDES Declaration +\*---------------------------------------------------------------------------*/ + +template<class BasicTurbulenceModel> +class kOmegaSSTDDES +: + public kOmegaSSTDES<BasicTurbulenceModel> +{ + // Private Member Functions + + tmp<volScalarField> rd + ( + const volScalarField& nur, + const volScalarField& magGradU + ) const; + + tmp<volScalarField> fd(const volScalarField& magGradU) const; + + // Disallow default bitwise copy construct and assignment + kOmegaSSTDDES(const kOmegaSSTDDES&); + kOmegaSSTDDES& operator=(const kOmegaSSTDDES&); + + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar cd1_; + dimensionedScalar cd2_; + + + // Protected Member Functions + + //- Length scale + virtual tmp<volScalarField> dTilda + ( + const volScalarField& magGradU, + const volScalarField& CDES + ) const; + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("kOmegaSSTDDES"); + + + // Constructors + + //- Construct from components + kOmegaSSTDDES + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~kOmegaSSTDDES() + {} + + + // Member Functions + + //- Re-read model coefficients if they have changed + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "kOmegaSSTDDES.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C new file mode 100644 index 00000000000..6045b886abe --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C @@ -0,0 +1,289 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kOmegaSSTDES.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +void kOmegaSSTDES<BasicTurbulenceModel>::correctNut(const volScalarField& S2) +{ + // Correct the turbulence viscosity + kOmegaSSTBase<DESModel<BasicTurbulenceModel> >::correctNut(S2); + + // Correct the turbulence thermal diffusivity + BasicTurbulenceModel::correctNut(); +} + + +template<class BasicTurbulenceModel> +void kOmegaSSTDES<BasicTurbulenceModel>::correctNut() +{ + correctNut(2*magSqr(symm(fvc::grad(this->U_)))); +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTDES<BasicTurbulenceModel>::dTilda +( + const volScalarField& magGradU, + const volScalarField& CDES +) const +{ + const volScalarField& k = this->k_; + const volScalarField& omega = this->omega_; + + return min(CDES*this->delta(), sqrt(k)/(this->betaStar_*omega)); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +kOmegaSSTDES<BasicTurbulenceModel>::kOmegaSSTDES +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName, + const word& type +) +: + kOmegaSSTBase<DESModel<BasicTurbulenceModel> > + ( + type, + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName + ), + + kappa_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "kappa", + this->coeffDict_, + 0.41 + ) + ), + CDESkom_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CDESkom", + this->coeffDict_, + 0.78 + ) + ), + CDESkeps_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CDESkeps", + this->coeffDict_, + 0.61 + ) + ) +{ + correctNut(); + + if (type == typeName) + { + this->printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +bool kOmegaSSTDES<BasicTurbulenceModel>::read() +{ + if (kOmegaSSTBase<DESModel<BasicTurbulenceModel> >::read()) + { + CDESkom_.readIfPresent(this->coeffDict()); + CDESkeps_.readIfPresent(this->coeffDict()); + + return true; + } + else + { + return false; + } +} + + +template<class BasicTurbulenceModel> +void kOmegaSSTDES<BasicTurbulenceModel>::correct() +{ + if (!this->turbulence_) + { + return; + } + + // Local references + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; + const volVectorField& U = this->U_; + volScalarField& k = this->k_; + volScalarField& omega = this->omega_; + volScalarField& nut = this->nut_; + + DESModel<BasicTurbulenceModel>::correct(); + + volScalarField divU(fvc::div(fvc::absolute(this->phi(), U))); + + tmp<volTensorField> tgradU = fvc::grad(U); + volScalarField magGradU(mag(tgradU())); + volScalarField S2(2*magSqr(symm(tgradU()))); + volScalarField GbyNu((tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(this->GName(), nut*GbyNu); + tgradU.clear(); + + // Update omega and G at the wall + omega.boundaryField().updateCoeffs(); + + volScalarField CDkOmega + ( + (2*this->alphaOmega2_)*(fvc::grad(k) & fvc::grad(omega))/omega + ); + + volScalarField F1(this->F1(CDkOmega)); + + { + volScalarField gamma(this->gamma(F1)); + volScalarField beta(this->beta(F1)); + + // Turbulent frequency equation + tmp<fvScalarMatrix> omegaEqn + ( + fvm::ddt(alpha, rho, omega) + + fvm::div(alphaRhoPhi, omega) + - fvm::laplacian(alpha*rho*this->DomegaEff(F1), omega) + == + alpha*rho*gamma*GbyNu // Using unlimited GybNu + - fvm::SuSp((2.0/3.0)*alpha*rho*gamma*divU, omega) + - fvm::Sp(alpha*rho*beta*omega, omega) + - fvm::SuSp(alpha*rho*(F1 - scalar(1))*CDkOmega/omega, omega) + + this->omegaSource() + ); + + omegaEqn().relax(); + + omegaEqn().boundaryManipulate(omega.boundaryField()); + + solve(omegaEqn); + bound(omega, this->omegaMin_); + } + + { + volScalarField CDES(this->CDES(F1)); + volScalarField dTilda(this->dTilda(magGradU, CDES)); + + // Turbulent kinetic energy equation + tmp<fvScalarMatrix> kEqn + ( + fvm::ddt(alpha, rho, k) + + fvm::div(alphaRhoPhi, k) + - fvm::laplacian(alpha*rho*this->DkEff(F1), k) + == + min(alpha*rho*G, (this->c1_*this->betaStar_)*alpha*rho*k*omega) + - fvm::SuSp((2.0/3.0)*alpha*rho*divU, k) + - fvm::Sp(alpha*rho*sqrt(k)/dTilda, k) // modified for DES + + this->kSource() + ); + + kEqn().relax(); + solve(kEqn); + bound(k, this->kMin_); + } + + this->correctNut(S2); +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTDES<BasicTurbulenceModel>::LESRegion() const +{ + const volScalarField& k = this->k_; + const volScalarField& omega = this->omega_; + const volVectorField& U = this->U_; + + const volScalarField CDkOmega + ( + (2*this->alphaOmega2_)*(fvc::grad(k) & fvc::grad(omega))/omega + ); + + const volScalarField F1(this->F1(CDkOmega)); + + tmp<volScalarField> tLESRegion + ( + new volScalarField + ( + IOobject + ( + "DES::LESRegion", + this->mesh_.time().timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + neg + ( + dTilda + ( + mag(fvc::grad(U)), + F1*CDESkom_ + (1 - F1)*CDESkeps_ + ) + - sqrt(k)/(this->betaStar_*omega) + ) + ) + ); + + return tLESRegion; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H new file mode 100644 index 00000000000..219c041c044 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::LESModels::kOmegaSSTDES + +Group + grpDESTurbulence + +Description + k-omega-SST DES turbulence model for incompressible and compressible flows + + Reference: + \verbatim + Strelets, M. (2001) + Detached Eddy Simulation of Massively Separated Flows, + 39th AIAA Aerospace Sciences Meeting and Exhibit, Reno, NV + \endverbatim + +SourceFiles + kOmegaSSTDES.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kOmegaSSTDES_H +#define kOmegaSSTDES_H + +#include "DESModel.H" +#include "kOmegaSSTBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +/*---------------------------------------------------------------------------*\ + class kOmegaSSTDES Declaration +\*---------------------------------------------------------------------------*/ + +template<class BasicTurbulenceModel> +class kOmegaSSTDES +: + public kOmegaSSTBase<DESModel<BasicTurbulenceModel> > +{ + // Private Member Functions + + // Disallow default bitwise copy construct and assignment + kOmegaSSTDES(const kOmegaSSTDES&); + kOmegaSSTDES& operator=(const kOmegaSSTDES&); + + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar kappa_; + dimensionedScalar CDESkom_; + dimensionedScalar CDESkeps_; + + + // Protected Member Functions + + //- Blending for CDES parameter + virtual tmp<volScalarField> CDES(const volScalarField& F1) const + { + return this->blend(F1, CDESkom_, CDESkeps_); + } + + virtual void correctNut(const volScalarField& S2); + virtual void correctNut(); + + //- Length scale + virtual tmp<volScalarField> dTilda + ( + const volScalarField& magGradU, + const volScalarField& CDES + ) const; + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("kOmegaSSTDES"); + + + // Constructors + + //- Construct from components + kOmegaSSTDES + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~kOmegaSSTDES() + {} + + + // Member Functions + + //- Re-read model coefficients if they have changed + virtual bool read(); + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Return the LES field indicator + virtual tmp<volScalarField> LESRegion() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "kOmegaSSTDES.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C new file mode 100644 index 00000000000..3c4bb99ce77 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C @@ -0,0 +1,254 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kOmegaSSTIDDES.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +const IDDESDelta& kOmegaSSTIDDES<BasicTurbulenceModel>::setDelta() const +{ + if (!isA<IDDESDelta>(this->delta_())) + { + FatalErrorIn + ( + "const kOmegaSSTIDDES<BasicTurbulenceModel>::setDelta() const" + ) + << "The delta function must be set to a " << IDDESDelta::typeName + << " -based model" << exit(FatalError); + } + + return refCast<const IDDESDelta>(this->delta_()); +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::alpha() const +{ + return max + ( + 0.25 - this->y_/static_cast<const volScalarField&>(IDDESDelta_.hmax()), + scalar(-5) + ); +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::ft +( + const volScalarField& magGradU +) const +{ + return tanh(pow3(sqr(ct_)*rd(this->nut_, magGradU))); +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::fl +( + const volScalarField& magGradU +) const +{ + return tanh(pow(sqr(cl_)*rd(this->nu(), magGradU), 10)); +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::rd +( + const volScalarField& nur, + const volScalarField& magGradU +) const +{ + tmp<volScalarField> tr + ( + min + ( + nur + /( + max + ( + magGradU, + dimensionedScalar("SMALL", magGradU.dimensions(), SMALL) + ) + *sqr(this->kappa_*this->y_) + ), + scalar(10) + ) + ); + tr().boundaryField() == 0.0; + + return tr; +} + + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::fd +( + const volScalarField& magGradU +) const +{ + return 1 - tanh(pow(cdt1_*rd(this->nuEff(), magGradU), cdt2_)); +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +tmp<volScalarField> kOmegaSSTIDDES<BasicTurbulenceModel>::dTilda +( + const volScalarField& magGradU, + const volScalarField& CDES +) const +{ + const volScalarField& k = this->k_; + const volScalarField& omega = this->omega_; + + const volScalarField lRAS(sqrt(k)/(this->betaStar_*omega)); + const volScalarField lLES(CDES*this->delta()); + const dimensionedScalar d0("SMALL", dimLength, SMALL); + + const volScalarField alpha(this->alpha()); + const volScalarField expTerm(exp(sqr(alpha))); + + tmp<volScalarField> fStep = min(2*pow(expTerm, -9.0), scalar(1)); + const volScalarField fHyb(max(1 - fd(magGradU), fStep)); + // Simplified version where fRestore = 0 + // return max(d0, fHyb*lRAS + (1 - fHyb)*lLES); + + // Original form + tmp<volScalarField> fHill = + 2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0)); + tmp<volScalarField> fAmp = 1 - max(ft(magGradU), fl(magGradU)); + tmp<volScalarField> fRestore = max(fHill - 1, scalar(0))*fAmp; + return max(d0, fHyb*(1 + fRestore)*lRAS + (1 - fHyb)*lLES); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +kOmegaSSTIDDES<BasicTurbulenceModel>::kOmegaSSTIDDES +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName, + const word& type +) +: + kOmegaSSTDES<BasicTurbulenceModel> + ( + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName, + type + ), + cdt1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "cdt1", + this->coeffDict_, + 20 + ) + ), + cdt2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "cdt2", + this->coeffDict_, + 3 + ) + ), + cl_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "cl", + this->coeffDict_, + 5 + ) + ), + ct_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "ct", + this->coeffDict_, + 1.87 + ) + ), + IDDESDelta_(setDelta()) +{ + if (type == typeName) + { + this->printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +bool kOmegaSSTIDDES<BasicTurbulenceModel>::read() +{ + if (kOmegaSSTDES<BasicTurbulenceModel>::read()) + { + cdt1_.readIfPresent(this->coeffDict()); + cdt2_.readIfPresent(this->coeffDict()); + cl_.readIfPresent(this->coeffDict()); + ct_.readIfPresent(this->coeffDict()); + + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H new file mode 100644 index 00000000000..fe5e50a304c --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::LESModels::kOmegaSSTIDDES + +Group + grpDESTurbulence + +Description + k-omega-SST IDDES turbulence model for incompressible and compressible + flows + + Reference: + \verbatim + Gritskevich, M.S., Garbaruk, A.V., Schuetze, J., Menter, F.R. (2011) + Development of DDES and IDDES Formulations for the k-omega + Shear Stress Transport Model, Flow, Turbulence and Combustion, + pp. 1-19 + \endverbatim + +SourceFiles + kOmegaSSTIDDES.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kOmegaSSTIDDES_H +#define kOmegaSSTIDDES_H + +#include "kOmegaSSTDES.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +/*---------------------------------------------------------------------------*\ + class kOmegaSSTIDDES Declaration +\*---------------------------------------------------------------------------*/ + +template<class BasicTurbulenceModel> +class kOmegaSSTIDDES +: + public kOmegaSSTDES<BasicTurbulenceModel> +{ + // Private Member Functions + + //- Check that the supplied delta is an IDDESDelta + const IDDESDelta& setDelta() const; + + tmp<volScalarField> alpha() const; + tmp<volScalarField> ft(const volScalarField& magGradU) const; + tmp<volScalarField> fl(const volScalarField& magGradU) const; + + tmp<volScalarField> rd + ( + const volScalarField& nur, + const volScalarField& magGradU + ) const; + + //- Delay function + tmp<volScalarField> fd(const volScalarField& maggradU) const; + + // Disallow default bitwise copy construct and assignment + kOmegaSSTIDDES(const kOmegaSSTIDDES&); + kOmegaSSTIDDES& operator=(const kOmegaSSTIDDES&); + + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar cdt1_; + dimensionedScalar cdt2_; + dimensionedScalar cl_; + dimensionedScalar ct_; + + // Fields + + const IDDESDelta& IDDESDelta_; + + + //- Length scale + virtual tmp<volScalarField> dTilda + ( + const volScalarField& magGradU, + const volScalarField& CDES + ) const; + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("kOmegaSSTIDDES"); + + + // Constructors + + //- Construct from components + kOmegaSSTIDDES + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName, + const word& type = typeName + ); + + + //- Destructor + virtual ~kOmegaSSTIDDES() + {} + + + // Member Functions + + //- Re-read model coefficients if they have changed + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "kOmegaSSTIDDES.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C index 9955478f419..3135d1d6541 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C @@ -80,6 +80,17 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel ) ), + omegaMin_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "omegaMin", + LESDict_, + dimless/dimTime, + SMALL + ) + ), + delta_ ( LESdelta::New diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H index cefb8dd70e9..5ecfeecee30 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,6 +78,9 @@ protected: //- Lower limit of k dimensionedScalar kMin_; + //- Lower limit of omega + dimensionedScalar omegaMin_; + //- Run-time selectable delta model autoPtr<Foam::LESdelta> delta_; -- GitLab