diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C index 11843958d5..a6d7b44bb5 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C @@ -26,7 +26,6 @@ License #include "SpalartAllmaras.H" #include "addToRunTimeSelectionTable.H" -#include "wallDist.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,7 +53,7 @@ tmp SpalartAllmaras::fv1() const tmp SpalartAllmaras::fv2() const { volScalarField chi = nuTilda_/nu(); - return 1.0/pow3(scalar(1) + chi/Cv2_); + return 1/pow3(scalar(1) + chi/Cv2_); } @@ -71,70 +70,68 @@ tmp SpalartAllmaras::fv3() const } -tmp SpalartAllmaras::calcS(const volTensorField& gradU) +tmp SpalartAllmaras::S(const volTensorField& gradU) const { - return ::sqrt(2.0)*mag(skew(gradU)); + return sqrt(2.0)*mag(skew(gradU)); } -tmp SpalartAllmaras::calcSTilda(const volTensorField& gradU) +tmp SpalartAllmaras::STilda +( + const volScalarField& S, + const volScalarField& dTilda +) const { - return fv3()*calcS(gradU) + fv2()*nuTilda_/sqr(kappa_*dTilda_); + return fv3()*S + fv2()*nuTilda_/sqr(kappa_*dTilda); } tmp SpalartAllmaras::r ( const volScalarField& visc, - const volScalarField& S + const volScalarField& S, + const volScalarField& dTilda ) const { - tmp tr + return min ( - new volScalarField - ( - min - ( - visc - /( - max - ( - S, - dimensionedScalar("SMALL", S.dimensions(), SMALL) - ) - *sqr(kappa_*dTilda_) - + dimensionedScalar - ( - "ROOTVSMALL", - dimensionSet(0, 2 , -1, 0, 0), - ROOTVSMALL - ) - ), - scalar(10.0) - ) - ) + visc + /( + max + ( + S, + dimensionedScalar("SMALL", S.dimensions(), SMALL) + ) + *sqr(kappa_*dTilda) + + dimensionedScalar + ( + "ROOTVSMALL", + dimensionSet(0, 2 , -1, 0, 0), + ROOTVSMALL + ) + ), + scalar(10) ); - - return tr; } -tmp SpalartAllmaras::fw(const volScalarField& S) const +tmp SpalartAllmaras::fw +( + const volScalarField& S, + const volScalarField& dTilda +) const { - volScalarField r = this->r(nuTilda_, S); + volScalarField r = this->r(nuTilda_, S, dTilda); volScalarField g = r + Cw2_*(pow6(r) - r); - return g*pow((1.0 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0); + return g*pow((1 + pow6(Cw3_))/(pow6(g) + pow6(Cw3_)), 1.0/6.0); } -void SpalartAllmaras::dTildaUpdate(const volScalarField&) +tmp SpalartAllmaras::dTilda(const volScalarField&) const { - if (mesh_.changing()) - { - dTilda_ = min(CDES_*delta(), wallDist(mesh_).y()); - } + return min(CDES_*delta(), y_); } @@ -242,6 +239,8 @@ SpalartAllmaras::SpalartAllmaras ) ), + y_(mesh_), + nuTilda_ ( IOobject @@ -255,8 +254,6 @@ SpalartAllmaras::SpalartAllmaras mesh_ ), - dTilda_(min(CDES_*delta(), wallDist(mesh_).y())), - nuSgs_ ( IOobject @@ -277,11 +274,15 @@ void SpalartAllmaras::correct(const tmp& gradU) { LESModel::correct(gradU); - const volScalarField STilda = calcSTilda(gradU); + if (mesh_.changing()) + { + y_.correct(); + y_.boundaryField() = max(y_.boundaryField(), VSMALL); + } - const volScalarField S = calcS(gradU); - - dTildaUpdate(S); + const volScalarField S = this->S(gradU); + const volScalarField dTilda = this->dTilda(S); + const volScalarField STilda = this->STilda(S, dTilda); fvScalarMatrix nuTildaEqn ( @@ -296,7 +297,7 @@ void SpalartAllmaras::correct(const tmp& gradU) - alphaNut_*Cb2_*magSqr(fvc::grad(nuTilda_)) == Cb1_*STilda*nuTilda_ - - fvm::Sp(Cw1_*fw(STilda)*nuTilda_/sqr(dTilda_), nuTilda_) + - fvm::Sp(Cw1_*fw(STilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_) ); nuTildaEqn.relax(); @@ -310,9 +311,15 @@ void SpalartAllmaras::correct(const tmp& gradU) } +tmp SpalartAllmaras::k() const +{ + return sqr(nuSgs()/ck_/dTilda(S(fvc::grad(U())))); +} + + tmp SpalartAllmaras::epsilon() const { - return 2.0*nuEff()*magSqr(symm(fvc::grad(U()))); + return 2*nuEff()*magSqr(symm(fvc::grad(U()))); } diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.H index aa721b1b5c..b813075b1d 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.H @@ -38,6 +38,7 @@ SourceFiles #include "LESModel.H" #include "volFields.H" +#include "wallDist.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -86,30 +87,39 @@ protected: // Fields + wallDist y_; volScalarField nuTilda_; - volScalarField dTilda_; volScalarField nuSgs_; // Protected member functions - // Helper functions + virtual tmp fv1() const; + virtual tmp fv2() const; + virtual tmp fv3() const; + virtual tmp S(const volTensorField& gradU) const; - virtual tmp fv1() const; - virtual tmp fv2() const; - virtual tmp fv3() const; - //- - virtual tmp calcS(const volTensorField& gradU); - virtual tmp calcSTilda(const volTensorField& gradU); - virtual tmp r - ( - const volScalarField& visc, - const volScalarField& S - ) const; - virtual tmp fw(const volScalarField& S) const; + virtual tmp STilda + ( + const volScalarField& S, + const volScalarField& dTilda + ) const; - //- Length scale calculation - virtual void dTildaUpdate(const volScalarField& S); + virtual tmp r + ( + const volScalarField& visc, + const volScalarField& S, + const volScalarField& dTilda + ) const; + + virtual tmp fw + ( + const volScalarField& S, + const volScalarField& dTilda + ) const; + + //- Length scale + virtual tmp dTilda(const volScalarField& S) const; public: @@ -138,10 +148,7 @@ public: // Member Functions //- Return SGS kinetic energy - virtual tmp k() const - { - return sqr(nuSgs()/ck_/dTilda_); - } + virtual tmp k() const; //- Return sub-grid disipation rate virtual tmp epsilon() const; diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C b/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C index 6f5435a268..edba5b1d3c 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C @@ -26,7 +26,6 @@ License #include "SpalartAllmarasDDES.H" #include "addToRunTimeSelectionTable.H" -#include "wallDist.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,51 +49,42 @@ tmp SpalartAllmarasDDES::rd const volScalarField& S ) const { - volScalarField d = wallDist(mesh_).y(); - - tmp trd + return min ( - new volScalarField - ( - min + visc + /( + max ( - visc - /( - max - ( - S, - dimensionedScalar("SMALL", S.dimensions(), SMALL) - )*sqr(kappa_*d) - + dimensionedScalar - ( - "ROOTVSMALL", - dimensionSet(0, 2 , -1, 0, 0), - ROOTVSMALL - ) - ), scalar(10.0) + S, + dimensionedScalar("SMALL", S.dimensions(), SMALL) + )*sqr(kappa_*y_) + + dimensionedScalar + ( + "ROOTVSMALL", + dimensionSet(0, 2 , -1, 0, 0), + ROOTVSMALL ) - ) + ), + scalar(10) ); - - return trd; } -tmp SpalartAllmarasDDES::fd(const volScalarField& S) +tmp SpalartAllmarasDDES::fd(const volScalarField& S) const { - return 1.0 - tanh(pow3(8.0*rd(nuSgs_ + transport().nu(), S))); + return 1 - tanh(pow3(8*rd(nuEff(), S))); } -void SpalartAllmarasDDES::dTildaUpdate(const volScalarField& S) +tmp SpalartAllmarasDDES::dTilda(const volScalarField& S) const { - dTilda_ = - wallDist(mesh_).y() - - fd(S)*max - ( - dimensionedScalar("zero", dimLength, 0.0), - wallDist(mesh_).y() - CDES_*delta() - ); + return max + ( + y_ + - fd(S) + *max(y_ - CDES_*delta(), dimensionedScalar("zero", dimLength, 0)), + dimensionedScalar("small", dimLength, SMALL) + ); } diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H b/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H index ec7eeda68c..52d7c99c6a 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H @@ -62,6 +62,14 @@ class SpalartAllmarasDDES { // Private member functions + tmp fd(const volScalarField& S) const; + + tmp rd + ( + const volScalarField& visc, + const volScalarField& S + ) const; + // Disallow default bitwise copy construct and assignment SpalartAllmarasDDES(const SpalartAllmarasDDES&); SpalartAllmarasDDES& operator=(const SpalartAllmarasDDES&); @@ -71,15 +79,8 @@ protected: // Protected member functions - tmp fd(const volScalarField& S); - tmp rd - ( - const volScalarField& visc, - const volScalarField& S - ) const; - - //- Length scale calculation - virtual void dTildaUpdate(const volScalarField& S); + //- Length scale + virtual tmp dTilda(const volScalarField& S) const; public: diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C index 6912872c9b..4fc7c02057 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C @@ -26,7 +26,6 @@ License #include "SpalartAllmarasIDDES.H" #include "addToRunTimeSelectionTable.H" -#include "wallDist.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,22 +45,29 @@ addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary); tmp SpalartAllmarasIDDES::alpha() const { - return - 0.25 - - wallDist(mesh_).y() - /dimensionedScalar("hMax", dimLength, max(cmptMax(delta()))); + return max + ( + 0.25 - y_/dimensionedScalar("hMax", dimLength, max(cmptMax(delta()))), + scalar(-5) + ); } -tmp SpalartAllmarasIDDES::ft(const volScalarField& S) const +tmp SpalartAllmarasIDDES::ft +( + const volScalarField& S +) const { - return tanh(pow3(sqr(ct_)*r(nuSgs_, S))); + return tanh(pow3(sqr(ct_)*rd(nuSgs_, S))); } -tmp SpalartAllmarasIDDES::fl(const volScalarField& S) const +tmp SpalartAllmarasIDDES::fl +( + const volScalarField& S +) const { - return tanh(pow(sqr(cl_)*r(transport().nu(), S), 10)); + return tanh(pow(sqr(cl_)*rd(nu(), S), 10)); } @@ -71,33 +77,24 @@ tmp SpalartAllmarasIDDES::rd const volScalarField& S ) const { - volScalarField d = wallDist(mesh_).y(); - - tmp trd + return min ( - new volScalarField - ( - min - ( - visc - /( - max - ( - S, - dimensionedScalar("SMALL", S.dimensions(), SMALL) - )*sqr(kappa_*d) - + dimensionedScalar - ( - "ROOTVSMALL", - dimensionSet(0, 2 , -1, 0, 0), - ROOTVSMALL - ) - ), scalar(10.0) - ) - ) + visc + /( + max + ( + S, + dimensionedScalar("SMALL", S.dimensions(), SMALL) + )*sqr(kappa_*y_) + + dimensionedScalar + ( + "ROOTVSMALL", + dimensionSet(0, 2 , -1, 0, 0), + ROOTVSMALL + ) + ), + scalar(10) ); - - return trd; } @@ -105,43 +102,38 @@ tmp SpalartAllmarasIDDES::rd tmp SpalartAllmarasIDDES::fd(const volScalarField& S) const { - return 1.0 - tanh(pow3(8.0*rd(nuSgs_+transport().nu(), S))); + return 1 - tanh(pow3(8*rd(nuEff(), S))); } -void SpalartAllmarasIDDES::dTildaUpdate(const volScalarField& S) +tmp SpalartAllmarasIDDES::dTilda(const volScalarField& S) const { volScalarField alpha = this->alpha(); - volScalarField expTerm = exp(sqr(alpha)); volScalarField fHill = - 2.0*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0)); + 2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0)); + volScalarField fStep = min(2*pow(expTerm, -9.0), scalar(1)); + volScalarField fHyb = max(1 - fd(S), fStep); + volScalarField fAmp = 1 - max(ft(S), fl(S)); + volScalarField fRestore = max(fHill - 1, scalar(0))*fAmp; - volScalarField fStep = min(2.0*pow(expTerm, -9.0), scalar(1)); - volScalarField fHyb = max(1.0 - fd(S), fStep); - - volScalarField fAmp = 1.0 - max(ft(S), fl(S)); - - volScalarField fRestore = max(fHill - 1.0, scalar(0))*fAmp; - - // volScalarField ft2 = IGNORING ft2 terms - + // IGNORING ft2 terms volScalarField Psi = sqrt ( min ( scalar(100), - (1.0 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*fv2())/max(SMALL, fv1()) + (1 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*fv2())/max(SMALL, fv1()) ) ); - dTilda_ = max + return max ( - dimensionedScalar("zero", dimLength, 0.0), - fHyb*(1.0 + fRestore*Psi)*wallDist(mesh_).y() - + (1.0 - fHyb)*CDES_*Psi*delta() + dimensionedScalar("SMALL", dimLength, SMALL), + fHyb*(1 + fRestore*Psi)*y_ + + (1 - fHyb)*CDES_*Psi*delta() ); } diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H index 815d2c28a6..8c7ca63ceb 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H @@ -69,12 +69,16 @@ class SpalartAllmarasIDDES tmp alpha() const; tmp ft(const volScalarField& S) const; tmp fl(const volScalarField& S) const; + tmp rd ( const volScalarField& visc, const volScalarField& S ) const; + //- Delay function + tmp fd(const volScalarField& S) const; + // Disallow default bitwise copy construct and assignment SpalartAllmarasIDDES(const SpalartAllmarasIDDES&); SpalartAllmarasIDDES& operator=(const SpalartAllmarasIDDES&); @@ -84,11 +88,9 @@ protected: // Protected member functions - //- Delay function - tmp fd(const volScalarField& S) const; + //- Length scale + virtual tmp dTilda(const volScalarField& S) const; - //- Length scale calculation - virtual void dTildaUpdate(const volScalarField& S); public: