diff --git a/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H index 9f8e148709..ff82ef379b 100644 --- a/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H +++ b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H @@ -30,7 +30,7 @@ Class Description Improved hybrid convection scheme of Travin et al. for hybrid RAS/LES - calculations with enhanced GAM behaviour. + calculations with enhanced Grey Area Mitigation (GAM) behaviour. The scheme provides a blend between two convection schemes, based on local properties including the wall distance, velocity gradient and eddy @@ -55,25 +55,26 @@ Description First published in: \verbatim - A. Travin, M. Shur, M. Strelets, P. Spalart (2000). - Physical and numerical upgrades in the detached-eddy simulation of - complex turbulent flows. - In Proceedings of the 412th Euromech Colloquium on LES and Complex - Transition and Turbulent Flows, Munich, Germany + Travin, A., Shur, M., Strelets, M., & Spalart, P. R. (2000). + Physical and numerical upgrades in the detached-eddy + simulation of complex turbulent flows. + In LES of Complex Transitional and Turbulent Flows. + Proceedings of the Euromech Colloquium 412. Munich, Germany \endverbatim - Original publication contained a typo for C_H3 constant. Corrected version - with minor changes for 2 lower limiters published in: + Original publication contained a typo for \c C_H3 constant. + Corrected version with minor changes for 2 lower limiters published in: \verbatim - P. Spalart, M. Shur, M. Strelets, A. Travin (2012). - Sensitivity of Landing-Gear Noise Predictions by Large-Eddy - Simulation to Numerics and Resolution. - AIAA Paper 2012-1174, 50th AIAA Aerospace Sciences Meeting, - Nashville / TN, Jan. 2012 + Spalart, P., Shur, M., Strelets, M., & Travin, A. (2012). + Sensitivity of landing-gear noise predictions by large-eddy + simulation to numerics and resolution. + In 50th AIAA Aerospace Sciences Meeting Including the + New Horizons Forum and Aerospace Exposition. Nashville, US. + DOI:10.2514/6.2012-1174 \endverbatim - Example of the DEShybrid scheme specification using linear within the LES - region and linearUpwind within the RAS region: + Example of the \c DEShybrid scheme specification using \c linear + within the LES region and \c linearUpwind within the RAS region: \verbatim divSchemes { @@ -100,12 +101,12 @@ Notes be used in the detached/vortex shedding regions. - Scheme 2 should be an upwind/deferred correction/TVD scheme which will be used in the free-stream/Euler/boundary layer regions. - - the scheme is compiled into a separate library, and not available to + - The scheme is compiled into a separate library, and not available to solvers by default. In order to use the scheme, add the library as a run-time loaded library in the \$FOAM\_CASE/system/controlDict dictionary, e.g.: \verbatim - libs ("libturbulenceModelSchemes.so"); + libs (turbulenceModelSchemes); \endverbatim SourceFiles @@ -187,6 +188,7 @@ class DEShybrid // Private Member Functions + //- Check the scheme coefficients void checkValues() { if (U0_.value() <= 0) @@ -231,8 +233,8 @@ class DEShybrid Info<< type() << "coefficients:" << nl << " delta : " << deltaName_ << nl << " CDES : " << CDES_ << nl - << " U0 : " << U0_ << nl - << " LO : " << L0_ << nl + << " U0 : " << U0_.value() << nl + << " L0 : " << L0_.value() << nl << " sigmaMin : " << sigmaMin_ << nl << " sigmaMax : " << sigmaMax_ << nl << " OmegaLim : " << OmegaLim_ << nl @@ -256,63 +258,95 @@ class DEShybrid const volScalarField& delta ) const { - tmp gradU(fvc::grad(U)); - const volScalarField S(sqrt(2.0)*mag(symm(gradU()))); - const volScalarField Omega(sqrt(2.0)*mag(skew(gradU()))); + tmp tgradU = fvc::grad(U); + const volTensorField& gradU = tgradU.cref(); + const volScalarField S(sqrt(2.0)*mag(symm(gradU))); + const volScalarField Omega(sqrt(2.0)*mag(skew(tgradU))); const dimensionedScalar tau0_ = L0_/U0_; - gradU.clear(); - const volScalarField B - ( + tmp tB = CH3_*Omega*max(S, Omega) - /max(0.5*(sqr(S) + sqr(Omega)), sqr(OmegaLim_/tau0_)) - ); + /max(0.5*(sqr(S) + sqr(Omega)), sqr(OmegaLim_/tau0_)); - const volScalarField K - ( - max(Foam::sqrt(0.5*(sqr(S) + sqr(Omega))), 0.1/tau0_) - ); + tmp tg = tanh(pow4(tB)); - const volScalarField lTurb - ( + tmp tK = + max(Foam::sqrt(0.5*(sqr(S) + sqr(Omega))), 0.1/tau0_); + + tmp tlTurb = Foam::sqrt ( max ( (max(nut, min(sqr(Cs_*delta)*S, nutLim_*nut)) + nu) - /(pow(0.09, 1.5)*K), + /(pow(0.09, 1.5)*tK), dimensionedScalar(sqr(dimLength), Zero) ) - ) - ); - - const volScalarField g(tanh(pow4(B))); + ); const volScalarField A ( CH2_*max ( scalar(0), - CDES_*delta/max(lTurb*g, SMALL*L0_) - 0.5 + CDES_*delta/max(tlTurb*tg, SMALL*L0_) - 0.5 ) ); - const volScalarField factor + + const word factorName(IOobject::scopedName(typeName, "Factor")); + const fvMesh& mesh = this->mesh(); + + const IOobject factorIO ( - IOobject::scopedName(typeName, "Factor"), - max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_) + factorName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE ); if (blendedSchemeBaseName::debug) { - factor.write(); - } + auto* factorPtr = mesh.getObjectPtr(factorName); - return tmp::New - ( - vf.name() + "BlendingFactor", - fvc::interpolate(factor) - ); + if (!factorPtr) + { + factorPtr = + new volScalarField + ( + factorIO, + mesh, + dimensionedScalar(dimless, Zero) + ); + + const_cast(mesh).objectRegistry::store(factorPtr); + } + + auto& factor = *factorPtr; + + factor = max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_); + + return tmp::New + ( + vf.name() + "BlendingFactor", + fvc::interpolate(factor) + ); + } + else + { + const volScalarField factor + ( + factorIO, + max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_) + ); + + return tmp::New + ( + vf.name() + "BlendingFactor", + fvc::interpolate(factor) + ); + } } @@ -434,10 +468,10 @@ public: //- Return the face-interpolate of the given cell field - // with explicit correction + //- with explicit correction tmp interpolate(const VolFieldType& vf) const { - surfaceScalarField bf(blendingFactor(vf)); + const surfaceScalarField bf(blendingFactor(vf)); return (scalar(1) - bf)*tScheme1_().interpolate(vf) @@ -498,4 +532,3 @@ public: #endif // ************************************************************************* // - diff --git a/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.C b/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.C index 47a4b7fbcf..48055970df 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.C +++ b/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.C @@ -85,7 +85,8 @@ tmp SpalartAllmarasBase::ft2 "ft2", this->runTime_.timeName(), this->mesh_, - IOobject::NO_READ + IOobject::NO_READ, + IOobject::NO_WRITE ), this->mesh_, dimensionedScalar(dimless, Zero) @@ -111,7 +112,7 @@ tmp SpalartAllmarasBase::r const volScalarField& dTilda ) const { - const dimensionedScalar eps("SMALL", Stilda.dimensions(), SMALL); + const dimensionedScalar eps(Stilda.dimensions(), SMALL); tmp tr = min(nur/(max(Stilda, eps)*sqr(kappa_*dTilda)), scalar(10)); @@ -346,7 +347,7 @@ bool SpalartAllmarasBase::read() if (BasicEddyViscosityModel::read()) { sigmaNut_.readIfPresent(this->coeffDict()); - kappa_.readIfPresent(*this); + kappa_.readIfPresent(this->coeffDict()); Cb1_.readIfPresent(this->coeffDict()); Cb2_.readIfPresent(this->coeffDict()); @@ -355,14 +356,13 @@ bool SpalartAllmarasBase::read() Cw3_.readIfPresent(this->coeffDict()); Cv1_.readIfPresent(this->coeffDict()); Cs_.readIfPresent(this->coeffDict()); - ck_.readIfPresent(this->coeffDict()); ft2_.readIfPresent("ft2", this->coeffDict()); Ct3_.readIfPresent(this->coeffDict()); Ct4_.readIfPresent(this->coeffDict()); - if (mag(Ct3_.value()) > SMALL) + if (ft2_) { Info<< " ft2 term: active" << nl; } @@ -444,47 +444,49 @@ void SpalartAllmarasBase::correct() return; } - // Local references - const alphaField& alpha = this->alpha_; - const rhoField& rho = this->rho_; - const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; - const volVectorField& U = this->U_; - fv::options& fvOptions(fv::options::New(this->mesh_)); + { + // Local references + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; + const volVectorField& U = this->U_; + fv::options& fvOptions(fv::options::New(this->mesh_)); - BasicEddyViscosityModel::correct(); + BasicEddyViscosityModel::correct(); - const volScalarField chi(this->chi()); - const volScalarField fv1(this->fv1(chi)); - const volScalarField ft2(this->ft2(chi)); + const volScalarField chi(this->chi()); + const volScalarField fv1(this->fv1(chi)); + const volScalarField ft2(this->ft2(chi)); - tmp tgradU = fvc::grad(U); - volScalarField dTilda(this->dTilda(chi, fv1, tgradU())); - volScalarField Stilda(this->Stilda(chi, fv1, tgradU(), dTilda)); - tgradU.clear(); + tmp tgradU = fvc::grad(U); + volScalarField dTilda(this->dTilda(chi, fv1, tgradU())); + volScalarField Stilda(this->Stilda(chi, fv1, tgradU(), dTilda)); + tgradU.clear(); - tmp nuTildaEqn - ( - fvm::ddt(alpha, rho, nuTilda_) - + fvm::div(alphaRhoPhi, nuTilda_) - - fvm::laplacian(alpha*rho*DnuTildaEff(), nuTilda_) - - Cb2_/sigmaNut_*alpha()*rho()*magSqr(fvc::grad(nuTilda_)()()) - == - Cb1_*alpha()*rho()*Stilda()*nuTilda_()*(scalar(1) - ft2()) - - fvm::Sp + tmp nuTildaEqn ( - (Cw1_*fw(Stilda, dTilda) - Cb1_/sqr(kappa_)*ft2()) - *alpha()*rho()*nuTilda_()/sqr(dTilda()), - nuTilda_ - ) - + fvOptions(alpha, rho, nuTilda_) - ); + fvm::ddt(alpha, rho, nuTilda_) + + fvm::div(alphaRhoPhi, nuTilda_) + - fvm::laplacian(alpha*rho*DnuTildaEff(), nuTilda_) + - Cb2_/sigmaNut_*alpha()*rho()*magSqr(fvc::grad(nuTilda_)()()) + == + Cb1_*alpha()*rho()*Stilda()*nuTilda_()*(scalar(1) - ft2()) + - fvm::Sp + ( + (Cw1_*fw(Stilda, dTilda) - Cb1_/sqr(kappa_)*ft2()) + *alpha()*rho()*nuTilda_()/sqr(dTilda()), + nuTilda_ + ) + + fvOptions(alpha, rho, nuTilda_) + ); - nuTildaEqn.ref().relax(); - fvOptions.constrain(nuTildaEqn.ref()); - solve(nuTildaEqn); - fvOptions.correct(nuTilda_); - bound(nuTilda_, dimensionedScalar(nuTilda_.dimensions(), Zero)); - nuTilda_.correctBoundaryConditions(); + nuTildaEqn.ref().relax(); + fvOptions.constrain(nuTildaEqn.ref()); + solve(nuTildaEqn); + fvOptions.correct(nuTilda_); + bound(nuTilda_, dimensionedScalar(nuTilda_.dimensions(), Zero)); + nuTilda_.correctBoundaryConditions(); + } correctNut(); } diff --git a/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.H b/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.H index 7b765c1f80..0cdf0f173a 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.H +++ b/src/TurbulenceModels/turbulenceModels/Base/SpalartAllmaras/SpalartAllmarasBase.H @@ -31,15 +31,33 @@ Group grpDESTurbulence Description - SpalartAllmarasBase DES turbulence model for incompressible and - compressible flows + Base class to handle various characteristics for \c SpalartAllmaras based + LES/DES turbulence models for incompressible and compressible flows. - Reference: + References: \verbatim - Spalart, P. R., Jou, W. H., Strelets, M., & Allmaras, S. R. (1997). - Comments on the feasibility of LES for wings, and on a hybrid - RANS/LES approach. - Advances in DNS/LES, 1, 4-8. + Standard model: + Spalart, P.R., & Allmaras, S.R. (1994). + A one-equation turbulence model for aerodynamic flows. + La Recherche Aerospatiale, 1, 5-21. + + Standard model: + Spalart, P. R., Jou, W. H., Strelets, M., & Allmaras, S. R. (1997). + Comments on the feasibility of LES for wings, and on a hybrid + RANS/LES approach. + Advances in DNS/LES, 1, 4-8. + + Estimation expression for k and epsilon (tag:B), Eq. 4.50: + Bourgoin, A. (2019). + Bathymetry induced turbulence modelling the + Alderney Race site: regional approach with TELEMAC-LES. + Normandie Université. + + Estimation expressions for omega (tag:P): + Pope, S. B. (2000). + Turbulent flows. + Cambridge, UK: Cambridge Univ. Press + DOI:10.1017/CBO9780511840531 \endverbatim SourceFiles @@ -56,7 +74,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class SpalartAllmarasBase Declaration + Class SpalartAllmarasBase Declaration \*---------------------------------------------------------------------------*/ template @@ -75,7 +93,7 @@ class SpalartAllmarasBase protected: - // Protected data + // Protected Data // Model constants @@ -98,6 +116,7 @@ protected: // Fields + //- Modified kinematic viscosity [m^2/s] volScalarField nuTilda_; //- Wall distance @@ -199,6 +218,7 @@ public: //- Return the (estimated) specific dissipation rate virtual tmp omega() const; + //- Return the modified kinematic viscosity tmp nuTilda() const { return nuTilda_; diff --git a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C index 9bee486c38..0f4b7756f6 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C +++ b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,7 +48,7 @@ tmp kOmegaSSTBase::F1 tmp CDkOmegaPlus = max ( CDkOmega, - dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10) + dimensionedScalar(dimless/sqr(dimTime), 1.0e-10) ); tmp arg1 = min @@ -406,6 +406,7 @@ kOmegaSSTBase::kOmegaSSTBase ), this->mesh_ ), + decayControl_ ( Switch::getOrAddToDict @@ -515,18 +516,21 @@ void kOmegaSSTBase::correct() BasicEddyViscosityModel::correct(); - volScalarField::Internal divU(fvc::div(fvc::absolute(this->phi(), U))); + const volScalarField::Internal divU + ( + fvc::div(fvc::absolute(this->phi(), U)) + ); - volScalarField CDkOmega + const volScalarField CDkOmega ( (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_ ); - volScalarField F1(this->F1(CDkOmega)); - volScalarField F23(this->F23()); + const volScalarField F1(this->F1(CDkOmega)); + const volScalarField F23(this->F23()); tmp tgradU = fvc::grad(U); - volScalarField S2(this->S2(F1, tgradU())); + const volScalarField S2(this->S2(F1, tgradU())); volScalarField::Internal GbyNu0(this->GbyNu0(tgradU(), F1, S2)); volScalarField::Internal G(this->GName(), nut*GbyNu0); @@ -534,8 +538,8 @@ void kOmegaSSTBase::correct() omega_.boundaryFieldRef().updateCoeffs(); { - volScalarField::Internal gamma(this->gamma(F1)); - volScalarField::Internal beta(this->beta(F1)); + const volScalarField::Internal gamma(this->gamma(F1)); + const volScalarField::Internal beta(this->beta(F1)); GbyNu0 = GbyNu(GbyNu0, F23(), S2()); @@ -568,28 +572,30 @@ void kOmegaSSTBase::correct() bound(omega_, this->omegaMin_); } - // Turbulent kinetic energy equation - tmp kEqn - ( - fvm::ddt(alpha, rho, k_) - + fvm::div(alphaRhoPhi, k_) - - fvm::laplacian(alpha*rho*DkEff(F1), k_) - == - alpha()*rho()*Pk(G) - - fvm::SuSp((2.0/3.0)*alpha()*rho()*divU, k_) - - fvm::Sp(alpha()*rho()*epsilonByk(F1, tgradU()), k_) - + alpha()*rho()*betaStar_*omegaInf_*kInf_ - + kSource() - + fvOptions(alpha, rho, k_) - ); + { + // Turbulent kinetic energy equation + tmp kEqn + ( + fvm::ddt(alpha, rho, k_) + + fvm::div(alphaRhoPhi, k_) + - fvm::laplacian(alpha*rho*DkEff(F1), k_) + == + alpha()*rho()*Pk(G) + - fvm::SuSp((2.0/3.0)*alpha()*rho()*divU, k_) + - fvm::Sp(alpha()*rho()*epsilonByk(F1, tgradU()), k_) + + alpha()*rho()*betaStar_*omegaInf_*kInf_ + + kSource() + + fvOptions(alpha, rho, k_) + ); - tgradU.clear(); + tgradU.clear(); - kEqn.ref().relax(); - fvOptions.constrain(kEqn.ref()); - solve(kEqn); - fvOptions.correct(k_); - bound(k_, this->kMin_); + kEqn.ref().relax(); + fvOptions.constrain(kEqn.ref()); + solve(kEqn); + fvOptions.correct(k_); + bound(k_, this->kMin_); + } correctNut(S2); } diff --git a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H index 4833b51257..96b333ea73 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H +++ b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.H @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -142,7 +142,7 @@ class kOmegaSSTBase protected: - // Protected data + // Protected Data // Model coefficients @@ -175,7 +175,10 @@ protected: // which is for near-wall cells only const volScalarField& y_; + //- Turbulent kinetic energy field [m^2/s^2] volScalarField k_; + + //- Specific dissipation rate field [1/s] volScalarField omega_; @@ -189,6 +192,7 @@ protected: // Protected Member Functions + //- Set decay control with kInf and omegaInf void setDecayControl(const dictionary& dict); virtual tmp F1(const volScalarField& CDkOmega) const; @@ -196,6 +200,7 @@ protected: virtual tmp F3() const; virtual tmp F23() const; + //- Return the blended field tmp blend ( const volScalarField& F1, @@ -206,6 +211,7 @@ protected: return F1*(psi1 - psi2) + psi2; } + //- Return the internal blended field tmp blend ( const volScalarField::Internal& F1, diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C index b216cf1f20..c99d84c6f7 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,19 +92,17 @@ tmp DESModel::Ssigma ) { // Limiter - const dimensionedScalar eps0("eps0", dimless, SMALL); - const dimensionedScalar eps2("eps2", dimless/sqr(dimTime), SMALL); - const dimensionedScalar eps4("eps4", dimless/pow4(dimTime), SMALL); - const dimensionedScalar max2("max2", dimless/sqr(dimTime), GREAT); + const dimensionedScalar eps0(dimless, SMALL); + const dimensionedScalar eps2(dimless/sqr(dimTime), SMALL); + const dimensionedScalar eps4(dimless/pow4(dimTime), SMALL); + const dimensionedScalar max2(dimless/sqr(dimTime), GREAT); const dimensionedTensor maxTen2 ( - "maxTen2", dimless/sqr(dimTime), tensor::max ); const dimensionedTensor minTen2 ( - "minTen2", dimless/sqr(dimTime), tensor::min ); @@ -114,11 +112,12 @@ tmp DESModel::Ssigma // Tensor invariants const volScalarField I1(tr(G)); const volScalarField I2(0.5*(sqr(I1) - tr(G & G))); - const volScalarField I3(det(G)); + tmp tI3 = det(G); const volScalarField alpha1(max(sqr(I1)/9.0 - I2/3.0, eps4)); - const volScalarField alpha2(pow3(min(I1, max2))/27.0 - I1*I2/6.0 + I3/2.0); + tmp talpha2 = + pow3(min(I1, max2))/27.0 - I1*I2/6.0 + 0.5*tI3; const volScalarField alpha3 ( @@ -128,7 +127,7 @@ tmp DESModel::Ssigma max ( scalar(-1) + eps0, - min(scalar(1) - eps0, alpha2/pow(alpha1, 3.0/2.0)) + min(scalar(1) - eps0, talpha2/pow(alpha1, 3.0/2.0)) ) ) ); diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H index 1efac2db0f..c95012f23e 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation - Copyright (C) 2016, 2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2016, 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,9 +58,6 @@ class DESModel public DESModelBase, public LESeddyViscosity { - -private: - // Private Member Functions //- No copy construct @@ -74,6 +71,7 @@ protected: // Protected Data + //- Model-specific transition constant dimensionedScalar Ctrans_; diff --git a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C index 1eec436b36..e30caec019 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -141,8 +141,8 @@ SpalartAllmarasDDES::SpalartAllmarasDDES Cd1_ ( - this->useSigma_ ? - dimensioned::getOrAddToDict + this->useSigma_ + ? dimensioned::getOrAddToDict ( "Cd1Sigma", this->coeffDict_, diff --git a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H index 61b4241237..eaed52f2ff 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,15 +33,16 @@ Group Description SpalartAllmaras DDES turbulence model for incompressible and compressible - flows + flows. Reference: \verbatim - Spalart, P. R., Deck, S., Shur, M. L., Squires, K. D., Strelets, M. K., - & Travin, A. (2006). - A new version of detached-eddy simulation, resistant to ambiguous grid - densities. + Spalart, P. R., Deck, S., Shur, M. L., Squires, + K. D., Strelets, M. K., & Travin, A. (2006). + A new version of detached-eddy simulation, + resistant to ambiguous grid densities. Theoretical and computational fluid dynamics, 20(3), 181-195. + DOI:10.1007/s00162-006-0015-0 \endverbatim SourceFiles @@ -72,7 +73,7 @@ class SpalartAllmarasDDES { // Private Member Functions - //- Shielding function + //- Return the shielding function tmp fd(const volScalarField& magGradU) const; //- No copy construct @@ -84,7 +85,7 @@ class SpalartAllmarasDDES protected: - // Protected data + // Protected Data // Model coefficients @@ -94,7 +95,7 @@ protected: // Protected Member Functions - //- Production term + //- Return the production term virtual tmp Stilda ( const volScalarField& chi, @@ -103,7 +104,7 @@ protected: const volScalarField& dTilda ) const; - //- Length scale + //- Return the length scale virtual tmp dTilda ( const volScalarField& chi, diff --git a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C index 3d9b3d6704..ff9c3d7ea6 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H index 6936c59f03..4706aa40d3 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H @@ -32,7 +32,7 @@ Group Description SpalartAllmarasDES DES turbulence model for incompressible and - compressible flows + compressible flows. Reference: \verbatim @@ -44,11 +44,12 @@ Description Including the low Reynolds number correction documented in \verbatim - Spalart, P. R., Deck, S., Shur, M.L., Squires, K.D., Strelets, M.Kh, - Travin, A. (2006). - A new version of detached-eddy simulation, resistant to ambiguous grid - densities. - Theor. Comput. Fluid Dyn., 20, 181-195. + Spalart, P. R., Deck, S., Shur, M. L., Squires, + K. D., Strelets, M. K., & Travin, A. (2006). + A new version of detached-eddy simulation, + resistant to ambiguous grid densities. + Theoretical and computational fluid dynamics, 20(3), 181-195. + DOI:10.1007/s00162-006-0015-0 \endverbatim Note @@ -94,38 +95,38 @@ class SpalartAllmarasDES protected: - // Protected data + // Protected Data //- Switch to activate grey-area enhanced sigma-(D)DES Switch useSigma_; // Model constants - // DES coefficient + //- DES coefficient dimensionedScalar CDES_; - // Low Reynolds number correction + //- Flag for low Reynolds number correction Switch lowReCorrection_; dimensionedScalar fwStar_; // Protected Member Functions - //- Low Reynolds number correction function + //- Return the low Reynolds number correction function virtual tmp psi ( const volScalarField& chi, const volScalarField& fv1 ) const; - //- LES length scale + //- Return the LES length scale virtual tmp lengthScaleLES ( const volScalarField& chi, const volScalarField& fv1 ) const; - //- Production term + //- Return the production term virtual tmp Stilda ( const volScalarField& chi, @@ -134,7 +135,7 @@ protected: const volScalarField& dTilda ) const; - //- Length scale + //- Return the length scale virtual tmp dTilda ( const volScalarField& chi, diff --git a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H index f3901ad5fe..4980df2d11 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H @@ -31,15 +31,16 @@ Group grpDESTurbulence Description - SpalartAllmaras IDDES turbulence model for incompressible and compressible - flows + SpalartAllmaras IDDES turbulence model + for incompressible and compressible flows. Reference: \verbatim Shur, M. L., Spalart, P. R., Strelets, M. K., & Travin, A. K. (2008). - A hybrid RANS-LES approach with delayed-DES and wall-modelled LES - capabilities. - International Journal of Heat and Fluid Flow, 29(6), 1638-1649. + A hybrid RANS-LES approach with delayed-DES + and wall-modelled LES capabilities. + International journal of heat and fluid flow, 29(6), 1638-1649. + DOI:10.1016/j.ijheatfluidflow.2008.07.001 \endverbatim SourceFiles @@ -92,7 +93,7 @@ class SpalartAllmarasIDDES protected: - // Protected data + // Protected Data // Model coefficients @@ -109,7 +110,7 @@ protected: // Protected Member Functions - //- Length scale + //- Return the length scale virtual tmp dTilda ( const volScalarField& chi, diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C index 16907d266d..6645e17288 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.C @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -153,8 +153,8 @@ kOmegaSSTDDES::kOmegaSSTDDES Cd1_ ( - this->useSigma_ ? - dimensioned::getOrAddToDict + this->useSigma_ + ? dimensioned::getOrAddToDict ( "Cd1Sigma", this->coeffDict_, diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H index 54e4c711a1..4b4f41b40e 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDDES/kOmegaSSTDDES.H @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2019, 2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2019, 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,14 +32,16 @@ Group grpDESTurbulence Description - k-omega-SST DDES turbulence model for incompressible and compressible flows + 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 + Gritskevich, M. S., Garbaruk, A. V., + Schütze, J., & Menter, F. R. (2012). + Development of DDES and IDDES formulations for + the k-ω shear stress transport model. + Flow, turbulence and combustion, 88(3), 431-449. + DOI:10.1007/s10494-011-9378-4 \endverbatim SourceFiles @@ -70,7 +72,7 @@ class kOmegaSSTDDES { // Private Member Functions - //- Shielding function + //- Return the shielding function field tmp fd(const volScalarField& magGradU) const; //- No copy construct @@ -82,7 +84,7 @@ class kOmegaSSTDDES protected: - // Protected data + // Protected Data // Model coefficients diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C index edae6c7b57..bf3d8b1f4e 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.C @@ -6,8 +6,8 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2022 Upstream CFD GmbH + Copyright (C) 2016-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,7 +63,7 @@ tmp kOmegaSSTDES::r const volScalarField& magGradU ) const { - const dimensionedScalar eps("SMALL", magGradU.dimensions(), SMALL); + const dimensionedScalar eps(magGradU.dimensions(), SMALL); tmp tr = min(nur/(max(magGradU, eps)*sqr(this->kappa_*this->y_)), scalar(10)); @@ -71,7 +71,6 @@ tmp kOmegaSSTDES::r tr.ref().boundaryFieldRef() == 0; return tr; - } diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H index b6b035cfca..dfdf077c5b 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTDES/kOmegaSSTDES.H @@ -31,13 +31,13 @@ Group grpDESTurbulence Description - k-omega-SST DES turbulence model for incompressible and compressible flows + 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 + Strelets, M. (2001). + Detached Eddy Simulation of Massively Separated Flows. + 39th AIAA Aerospace Sciences Meeting and Exhibit, Reno, NV. \endverbatim Note @@ -51,8 +51,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef kOmegaSSTDES_H -#define kOmegaSSTDES_H +#ifndef Foam_kOmegaSSTDES_H +#define Foam_kOmegaSSTDES_H #include "DESModel.H" #include "kOmegaSSTBase.H" @@ -65,7 +65,7 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - class kOmegaSSTDES Declaration + Class kOmegaSSTDES Declaration \*---------------------------------------------------------------------------*/ template @@ -84,7 +84,7 @@ class kOmegaSSTDES protected: - // Protected data + // Protected Data //- Switch to activate grey-area enhanced sigma-(D)DES Switch useSigma_; @@ -122,7 +122,7 @@ protected: const volTensorField& gradU ) const; - //- Length scale + //- Return length scale virtual tmp dTilda ( const volScalarField& magGradU, diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C index c955da5132..42c5691e26 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -117,7 +117,7 @@ tmp kOmegaSSTIDDES::dTilda return max ( fdTilda*(1 + fe)*lRAS + (1 - fdTilda)*lLES, - dimensionedScalar("SMALL", dimLength, SMALL) + dimensionedScalar(dimLength, SMALL) ); } @@ -125,7 +125,7 @@ tmp kOmegaSSTIDDES::dTilda return max ( fdTilda*lRAS + (1 - fdTilda)*lLES, - dimensionedScalar("SMALL", dimLength, SMALL) + dimensionedScalar(dimLength, SMALL) ); } diff --git a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H index d5695afba8..4b733524d1 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/kOmegaSSTIDDES/kOmegaSSTIDDES.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,15 +31,17 @@ Group grpDESTurbulence Description - k-omega-SST IDDES turbulence model for incompressible and compressible - flows + 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 + Gritskevich, M. S., Garbaruk, A. V., + Schütze, J., & Menter, F. R. (2012). + Development of DDES and IDDES formulations for + the k-ω shear stress transport model. + Flow, turbulence and combustion, 88(3), 431-449. + DOI:10.1007/s10494-011-9378-4 \endverbatim SourceFiles @@ -47,8 +49,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef kOmegaSSTIDDES_H -#define kOmegaSSTIDDES_H +#ifndef Foam_kOmegaSSTIDDES_H +#define Foam_kOmegaSSTIDDES_H #include "kOmegaSSTDES.H" @@ -89,7 +91,7 @@ class kOmegaSSTIDDES protected: - // Protected data + // Protected Data // Model coefficients @@ -106,7 +108,7 @@ protected: // Protected Member Functions - //- Length scale + //- Return the length scale virtual tmp dTilda ( const volScalarField& magGradU, diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.C index 659e7ab085..29c65071d4 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.C @@ -50,7 +50,8 @@ void Foam::LESModels::DeltaOmegaTildeDelta::calcDelta() const fvMesh& mesh = turbulenceModel_.mesh(); const volVectorField& U0 = turbulenceModel_.U(); - const volVectorField vorticity(fvc::curl(U0)); + tmp tvorticity = fvc::curl(U0); + const volVectorField& vorticity = tvorticity.cref(); const volVectorField nvecvort ( vorticity @@ -58,10 +59,11 @@ void Foam::LESModels::DeltaOmegaTildeDelta::calcDelta() max ( mag(vorticity), - dimensionedScalar("SMALL", dimless/dimTime, SMALL) + dimensionedScalar(dimless/dimTime, SMALL) ) ) ); + tvorticity.clear(); const cellList& cells = mesh.cells(); const vectorField& cellCentres = mesh.cellCentres(); @@ -73,12 +75,12 @@ void Foam::LESModels::DeltaOmegaTildeDelta::calcDelta() const point& cc = cellCentres[celli]; const vector& nv = nvecvort[celli]; - scalar deltaMaxTmp = 0.0; + scalar deltaMaxTmp = 0; for (const label facei : cFaces) { const point& fc = faceCentres[facei]; - scalar tmp = 2.0*mag(nv ^ (fc - cc)); + const scalar tmp = 2.0*mag(nv ^ (fc - cc)); if (tmp > deltaMaxTmp) { @@ -171,7 +173,7 @@ Foam::LESModels::DeltaOmegaTildeDelta::DeltaOmegaTildeDelta void Foam::LESModels::DeltaOmegaTildeDelta::read(const dictionary& dict) { - const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); + const dictionary& coeffsDict = dict.optionalSubDict(type() + "Coeffs"); coeffsDict.readIfPresent("deltaCoeff", deltaCoeff_); coeffsDict.readIfPresent("requireUpdate", requireUpdate_); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.H index fc7ee3ac3d..253b58e0c4 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/DeltaOmegaTildeDelta/DeltaOmegaTildeDelta.H @@ -25,7 +25,7 @@ License along with OpenFOAM. If not, see . Class - Foam::DeltaOmegaTildeDelta + Foam::LESModels::DeltaOmegaTildeDelta Description Delta formulation that accounts for the orientation of the vorticity @@ -37,9 +37,10 @@ Description Reference: \verbatim Shur, M. L., Spalart, P. R., Strelets, M. K., & Travin, A. K. (2015). - An enhanced version of DES with rapid transition from RANS to LES in - separated flows. - Flow, Turbulence and Combustion, 95, 709-737, 2015. + An enhanced version of DES with rapid transition + from RANS to LES in separated flows. + Flow, turbulence and combustion, 95(4), 709-737. + DOI:10.1007/s10494-015-9618-0 \endverbatim SourceFiles @@ -67,7 +68,7 @@ class DeltaOmegaTildeDelta : public LESdelta { - // Private data + // Private Data //- Run-time selectable delta for hmax // Defaults to the maxDeltaxyz model if not supplied @@ -82,15 +83,15 @@ class DeltaOmegaTildeDelta // Private Member Functions + //- Calculate the delta values + void calcDelta(); + //- No copy construct DeltaOmegaTildeDelta(const DeltaOmegaTildeDelta&) = delete; //- No copy assignment void operator=(const DeltaOmegaTildeDelta&) = delete; - //- Calculate the delta values - void calcDelta(); - public: diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.C index 0219dc0373..cdc256c7ec 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.C +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.C @@ -93,7 +93,8 @@ tmp sumNeighbours return tscaling; } -} +} // End namespace Foam + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -101,31 +102,36 @@ namespace Foam { namespace LESModels { - defineTypeNameAndDebug(DeltaSLA, 0); - addToRunTimeSelectionTable(LESdelta, DeltaSLA, dictionary); + defineTypeNameAndDebug(SLADelta, 0); + addToRunTimeSelectionTable(LESdelta, SLADelta, dictionary); } } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::LESModels::DeltaSLA::calcDelta() +void Foam::LESModels::SLADelta::calcDelta() { const fvMesh& mesh = turbulenceModel_.mesh(); - const volVectorField& U0 = turbulenceModel_.U(); - const volVectorField vorticity(fvc::curl(U0)); - const volSymmTensorField S(symm(fvc::grad(U0))); - const volScalarField magGradU(mag(fvc::grad(U0))); - tmp tnut = turbulenceModel_.nut(); - const auto& nut = tnut(); - tmp tnu = turbulenceModel_.nu(); - const auto& nu = tnu(); + const volScalarField& nut = tnut.cref(); + + tmp tnu = turbulenceModel_.nu(); + const volScalarField& nu = tnu.cref(); + + // Calculate vortex tilting measure, VTM + const volVectorField& U0 = turbulenceModel_.U(); + + tmp tvorticity = fvc::curl(U0); + const volVectorField& vorticity = tvorticity.cref(); + + tmp tS = symm(fvc::grad(U0)); + const volSymmTensorField& S = tS.cref(); + + const dimensionedScalar nuMin(nu.dimensions(), SMALL); + const dimensionedScalar eps(dimless/pow3(dimTime), SMALL); - // Vortex tilting measure, VTM - const dimensionedScalar nuMin("SMALL", nu.dimensions(), SMALL); - const dimensionedScalar eps("SMALL", dimless/pow3(dimTime), SMALL); volScalarField vtm ( max(scalar(1), 0.2*nu/max(nut, nuMin)) @@ -133,38 +139,45 @@ void Foam::LESModels::DeltaSLA::calcDelta() /max(magSqr(vorticity)*sqrt(3*magSqr(S) - sqr(tr(S))), eps) ); vtm.correctBoundaryConditions(); + tS.clear(); + + const dimensionedScalar vortMin(dimless/dimTime, SMALL); + const volVectorField nVecVort(vorticity/(max(mag(vorticity), vortMin))); + tvorticity.clear(); - // Averaged VTM - + // Calculate averaged VTM volScalarField vtmAve("vtmAve", vtm); - tmp weights = sumNeighbours(vtm, vtmAve); + tmp tweights = sumNeighbours(vtm, vtmAve); // Add cell centre values vtmAve += vtm; // Weights normalisation (add 1 for cell centres) - vtmAve.primitiveFieldRef() /= weights + 1; + vtmAve.primitiveFieldRef() /= tweights + 1; - // Compute DDES shielding function + // Calculate DDES shielding function, fd const volScalarField& y = wallDist::New(mesh).y(); - const dimensionedScalar Ueps("eps", magGradU.dimensions(), SMALL); - const dimensionedScalar nuEps("eps", nu.dimensions(), ROOTSMALL); - const volScalarField rd - ( + + const dimensionedScalar magGradUeps(dimless/dimTime, SMALL); + const dimensionedScalar nuEps(nu.dimensions(), ROOTSMALL); + + tmp tmagGradU = mag(fvc::grad(U0)); + + tmp trd = min ( - (nut + nu)/(max(magGradU, Ueps)*sqr(kappa_*y) + nuEps), + (nut + nu)/(max(tmagGradU, magGradUeps)*sqr(kappa_*y) + nuEps), scalar(10) - ) - ); - const volScalarField fd(1.0 - tanh(pow(Cd1_*rd, Cd2_))); + ); + tnut.clear(); + tnu.clear(); + + const volScalarField fd(1.0 - tanh(pow(Cd1_*trd, Cd2_))); + // Assemble delta - const dimensionedScalar vortMin("SMALL", dimless/dimTime, SMALL); - const volVectorField nVecVort(vorticity/(max(mag(vorticity), vortMin))); - const cellList& cells = mesh.cells(); const vectorField& cellCentres = mesh.cellCentres(); const vectorField& faceCentres = mesh.faceCentres(); @@ -175,12 +188,12 @@ void Foam::LESModels::DeltaSLA::calcDelta() const point& cc = cellCentres[celli]; const vector& nv = nVecVort[celli]; - scalar deltaMaxTmp = 0.0; + scalar deltaMaxTmp = 0; for (const label facei : cFaces) { const point& fc = faceCentres[facei]; - scalar tmp = 2.0*mag(nv ^ (fc - cc)); + const scalar tmp = 2.0*mag(nv ^ (fc - cc)); if (tmp > deltaMaxTmp) { @@ -208,7 +221,7 @@ void Foam::LESModels::DeltaSLA::calcDelta() delta_[celli] = deltaCoeff_*deltaMaxTmp*FKH; } - label nD = mesh.nGeometricD(); + const label nD = mesh.nGeometricD(); if (nD == 2) { @@ -229,7 +242,7 @@ void Foam::LESModels::DeltaSLA::calcDelta() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::LESModels::DeltaSLA::DeltaSLA +Foam::LESModels::SLADelta::SLADelta ( const word& name, const turbulenceModel& turbulence, @@ -240,7 +253,7 @@ Foam::LESModels::DeltaSLA::DeltaSLA hmaxPtr_(nullptr), deltaCoeff_ ( - dict.optionalSubDict(type() + "Coeffs").lookupOrDefault + dict.optionalSubDict(type() + "Coeffs").getOrDefault ( "deltaCoeff", 1.035 @@ -353,12 +366,20 @@ Foam::LESModels::DeltaSLA::DeltaSLA ) ); } + + if (mag(a2_ - a1_) < SMALL) + { + FatalIOErrorInFunction(dict) + << "Model coefficients a1 = " << a1_ + << ", and a2 = " << a2_ << " cannot be equal." + << abort(FatalIOError); + } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::LESModels::DeltaSLA::read(const dictionary& dict) +void Foam::LESModels::SLADelta::read(const dictionary& dict) { const dictionary& coeffsDict(dict.optionalSubDict(type() + "Coeffs")); @@ -377,7 +398,7 @@ void Foam::LESModels::DeltaSLA::read(const dictionary& dict) } -void Foam::LESModels::DeltaSLA::correct() +void Foam::LESModels::SLADelta::correct() { if (turbulenceModel_.mesh().changing() && requireUpdate_) { diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.H index 94c336d50d..78f288f5f7 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/SLADelta/SLADelta.H @@ -25,7 +25,7 @@ License along with OpenFOAM. If not, see . Class - Foam::LESModels::DeltaSLA + Foam::LESModels::SLADelta Description Delta formulation that accounts for the orientation of the vorticity vector @@ -36,9 +36,10 @@ Description Reference: \verbatim Shur, M. L., Spalart, P. R., Strelets, M. K., & Travin, A. K. (2015). - An enhanced version of DES with rapid transition from RANS to LES in - separated flows. - Flow, Turbulence and Combustion, 95, 709–737, 2015. + An enhanced version of DES with rapid transition + from RANS to LES in separated flows. + Flow, turbulence and combustion, 95(4), 709-737. + DOI:10.1007/s10494-015-9618-0 \endverbatim SourceFiles @@ -46,8 +47,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef LESModels_DeltaSLADelta_H -#define LESModels_DeltaSLADelta_H +#ifndef LESModels_SLADelta_H +#define LESModels_SLADelta_H #include "LESdelta.H" @@ -59,14 +60,14 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class DeltaSLA Declaration + Class SLADelta Declaration \*---------------------------------------------------------------------------*/ -class DeltaSLA +class SLADelta : public LESdelta { - // Private data + // Private Data //- Run-time selectable delta for hmax // Defaults to the maxDeltaxyz model if not supplied @@ -89,15 +90,15 @@ class DeltaSLA // Private Member Functions - //- No copy construct - DeltaSLA(const DeltaSLA&) = delete; - - //- No copy assignment - void operator=(const DeltaSLA&) = delete; - // Calculate the delta values void calcDelta(); + //- No copy construct + SLADelta(const SLADelta&) = delete; + + //- No copy assignment + void operator=(const SLADelta&) = delete; + public: @@ -108,7 +109,7 @@ public: // Constructors //- Construct from name, turbulenceModel and IOdictionary - DeltaSLA + SLADelta ( const word& name, const turbulenceModel& turbulence, @@ -117,7 +118,7 @@ public: //- Destructor - virtual ~DeltaSLA() = default; + virtual ~SLADelta() = default; // Member Functions diff --git a/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.C b/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.C index acdb6658ed..b806ab0719 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.C +++ b/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.C @@ -128,10 +128,8 @@ bool sigma::read() return true; } - else - { - return false; - } + + return false; } diff --git a/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.H b/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.H index 701734f952..c321835db4 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.H +++ b/src/TurbulenceModels/turbulenceModels/LES/sigma/sigma.H @@ -35,10 +35,11 @@ Description Reference: \verbatim - Nicoud, F., Toda, H., Cabrit, O., Bose, S., & Lee, J. (2011). - Using singular values to build a subgrid-scale model for large - eddy simulations. - Physics of Fluids, 23(8), 5106, 2011. + Nicoud, F., Toda, H. B., Cabrit, O., Bose, S., & Lee, J. (2011). + Using singular values to build a subgrid-scale + model for large eddy simulations. + Physics of fluids, 23(8), 085106. + DOI:10.1063/1.3623274 \endverbatim The default model coefficients correspond to the following: @@ -93,7 +94,7 @@ class sigma protected: - // Protected data + // Protected Data dimensionedScalar Ck_; dimensionedScalar Cw_; diff --git a/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.H index 3841682e7d..add1d09e70 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/TurbulenceModels/turbulenceModels/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -52,18 +52,6 @@ Description Spalart-Allmaras One-Equation Model without ft2 Term (SA-noft2). https://turbmodels.larc.nasa.gov/spalart.html#sanoft2 (Retrieved:12-01-2021). - - Estimation expression for k and epsilon (tag:B), Eq. 4.50: - Bourgoin, A. (2019). - Bathymetry induced turbulence modelling the - Alderney Race site: regional approach with TELEMAC-LES. - Normandie Université. - - Estimation expressions for omega (tag:P): - Pope, S. B. (2000). - Turbulent flows. - Cambridge, UK: Cambridge Univ. Press - DOI:10.1017/CBO9780511840531 \endverbatim Usage @@ -146,7 +134,7 @@ protected: // Protected Member Functions - //- Length scale + //- Return the length scale virtual tmp dTilda ( const volScalarField& chi,