From 4331b98735a6ccaf327dec2747ac6638cb81deca Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 10 Mar 2018 23:46:32 +0000 Subject: [PATCH] omegaWallFunction: Change blending from geometric mean to wall distance Reynolds number based Replaced the ad hoc geometric mean blending with the more physical wall distance Reynolds number blending function. Additionally the part of the production term active for y+ < 11.6 has been reinstated. --- .../epsilonWallFunctionFvPatchScalarField.C | 48 +++---- .../omegaWallFunctionFvPatchScalarField.C | 123 ++++++++++-------- .../omegaWallFunctionFvPatchScalarField.H | 6 +- .../boundaryWallFunctionsProfile/Allclean | 2 +- .../boundaryWallFunctionsProfile/Allrun | 2 +- 5 files changed, 98 insertions(+), 83 deletions(-) diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index b20b2a013..444889828 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -281,30 +281,6 @@ epsilonWallFunctionFvPatchScalarField } -Foam::epsilonWallFunctionFvPatchScalarField:: -epsilonWallFunctionFvPatchScalarField -( - const epsilonWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField(ptf, p, iF, mapper), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_), - yPlusLam_(ptf.yPlusLam_), - G_(), - epsilon_(), - initialised_(false), - master_(-1), - cornerWeights_() -{ - checkType(); -} - - Foam::epsilonWallFunctionFvPatchScalarField:: epsilonWallFunctionFvPatchScalarField ( @@ -331,6 +307,30 @@ epsilonWallFunctionFvPatchScalarField } +Foam::epsilonWallFunctionFvPatchScalarField:: +epsilonWallFunctionFvPatchScalarField +( + const epsilonWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_), + G_(), + epsilon_(), + initialised_(false), + master_(-1), + cornerWeights_() +{ + checkType(); +} + + Foam::epsilonWallFunctionFvPatchScalarField:: epsilonWallFunctionFvPatchScalarField ( diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 5bed4060c..958d14ef7 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -219,6 +219,7 @@ void omegaWallFunctionFvPatchScalarField::calculate const scalarField& y = turbModel.y()[patchi]; const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu5 = sqrt(Cmu_); const tmp tk = turbModel.k(); const volScalarField& k = tk(); @@ -233,49 +234,65 @@ void omegaWallFunctionFvPatchScalarField::calculate const scalarField magGradUw(mag(Uw.snGrad())); + const FieldType& G = + db().lookupObject(turbModel.GName()); + // Set omega and G forAll(nutw, facei) { const label celli = patch.faceCells()[facei]; - - const scalar yPlus = Cmu25*y[facei]*sqrt(k[celli])/nuw[facei]; - const scalar w = cornerWeights[facei]; - const scalar omegaVis = 6*nuw[facei]/(beta1_*sqr(y[facei])); - const scalar omegaLog = sqrt(k[celli])/(Cmu25*kappa_*y[facei]); - - // Switching between the laminar sub-layer and the log-region rather - // than blending has been found to provide more accurate results over a - // range of near-wall y+. - // - // For backward-compatibility the blending method is provided as an - // option + const scalar Rey = y[facei]*sqrt(k[celli])/nuw[facei]; + const scalar yPlus = Cmu25*Rey; + const scalar uPlus = (1/kappa_)*log(E_*yPlus); if (blended_) { - omega0[celli] += w*sqrt(sqr(omegaVis) + sqr(omegaLog)); - } + const scalar lamFrac = exp(-Rey/11); + const scalar turbFrac = 1 - lamFrac; - if (yPlus > yPlusLam_) - { - if (!blended_) - { - omega0[celli] += w*omegaLog; - } + const scalar uStar = sqrt + ( + lamFrac*nuw[facei]*magGradUw[facei] + turbFrac*Cmu5*k[celli] + ); + + const scalar omegaVis = 6*nuw[facei]/(beta1_*sqr(y[facei])); + const scalar omegaLog = uStar/(Cmu5*kappa_*y[facei]); + + omega0[celli] += w*(lamFrac*omegaVis + turbFrac*omegaLog); G0[celli] += w - *(nutw[facei] + nuw[facei]) - *magGradUw[facei] - *Cmu25*sqrt(k[celli]) - /(kappa_*y[facei]); + *( + lamFrac*G[celli] + + + turbFrac + *sqr(uStar*magGradUw[facei]*y[facei]/uPlus) + /(nuw[facei]*kappa_*yPlus) + ); } else { - if (!blended_) + if (yPlus < yPlusLam_) { + const scalar omegaVis = 6*nuw[facei]/(beta1_*sqr(y[facei])); + omega0[celli] += w*omegaVis; + + G0[celli] += w*G[celli]; + } + else + { + const scalar uStar = sqrt(Cmu5*k[celli]); + const scalar omegaLog = uStar/(Cmu5*kappa_*y[facei]); + + omega0[celli] += w*omegaLog; + + G0[celli] += + w* + sqr(uStar*magGradUw[facei]*y[facei]/uPlus) + /(nuw[facei]*kappa_*yPlus); } } } @@ -307,31 +324,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField } -omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField -( - const omegaWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField(ptf, p, iF, mapper), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_), - beta1_(ptf.beta1_), - blended_(ptf.blended_), - yPlusLam_(ptf.yPlusLam_), - G_(), - omega_(), - initialised_(false), - master_(-1), - cornerWeights_() -{ - checkType(); -} - - omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ( const fvPatch& p, @@ -359,6 +351,31 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField } +omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField +( + const omegaWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + beta1_(ptf.beta1_), + blended_(ptf.blended_), + yPlusLam_(ptf.yPlusLam_), + G_(), + omega_(), + initialised_(false), + master_(-1), + cornerWeights_() +{ + checkType(); +} + + omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ( const omegaWallFunctionFvPatchScalarField& owfpsf @@ -465,8 +482,6 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() const scalarField& G0 = this->G(); const scalarField& omega0 = this->omega(); - typedef DimensionedField FieldType; - FieldType& G = const_cast ( @@ -517,8 +532,6 @@ void omegaWallFunctionFvPatchScalarField::updateWeightedCoeffs const scalarField& G0 = this->G(); const scalarField& omega0 = this->omega(); - typedef DimensionedField FieldType; - FieldType& G = const_cast ( diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 7b303e728..a43f2166a 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -126,7 +126,7 @@ protected: //- beta1 coefficient scalar beta1_; - //- beta1 coefficient + //- Blending switch (defaults to false) Switch blended_; //- y+ at the edge of the laminar sublayer @@ -194,6 +194,8 @@ protected: return master_; } + typedef DimensionedField FieldType; + public: diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean index 989087443..e0ed3f7a5 100755 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean @@ -6,7 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory cleanCase -rm -rf logs +rm -rf graphs rm -f *.eps yPlus_vs_uPlus #------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun index e377f675c..f3e3414d8 100755 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun @@ -56,7 +56,7 @@ gnuplot<