From f321fc73ef03cbd193a24bcd48a9d2e88f96eccd Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 18 Sep 2024 15:26:28 +0100 Subject: [PATCH] ENH: wallFunctions: use cornerWeights linear. Fixes #3218. --- .../epsilonWallFunctionFvPatchScalarField.C | 33 ++++++++++++------- .../omegaWallFunctionFvPatchScalarField.C | 33 ++++++++++++------- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 379b109867..8c78d59614 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2019 OpenFOAM Foundation - Copyright (C) 2017-2023 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -218,7 +218,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate { return ( - cornerWeights[facei]*2.0*k[faceCells[facei]]*nuw[facei] + 2.0*k[faceCells[facei]]*nuw[facei] / sqr(y[facei]) ); }; @@ -228,7 +228,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate { return ( - cornerWeights[facei]*Cmu75*pow(k[faceCells[facei]], 1.5) + Cmu75*pow(k[faceCells[facei]], 1.5) / (kappa*y[facei]) ); }; @@ -241,11 +241,15 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate { if (lowReCorrection_ && yPlus(facei) < yPlusLam) { - epsilon0[faceCells[facei]] += epsilonVis(facei); + epsilon0[faceCells[facei]] += + cornerWeights[facei] + * epsilonVis(facei); } else { - epsilon0[faceCells[facei]] += epsilonLog(facei); + epsilon0[faceCells[facei]] += + cornerWeights[facei] + * epsilonLog(facei); } } break; @@ -257,7 +261,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate { // (ME:Eqs. 15-16) epsilon0[faceCells[facei]] += - pow + cornerWeights[facei] + * pow ( pow(epsilonVis(facei), n_) + pow(epsilonLog(facei), n_), scalar(1)/n_ @@ -272,7 +277,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate { // (PH:Eq. 27) epsilon0[faceCells[facei]] += - max(epsilonVis(facei), epsilonLog(facei)); + cornerWeights[facei] + * max(epsilonVis(facei), epsilonLog(facei)); } break; } @@ -288,10 +294,11 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL); epsilon0[faceCells[facei]] += - ( - epsilonVis(facei)*exp(-Gamma) - + epsilonLog(facei)*exp(-invGamma) - ); + cornerWeights[facei] + * ( + epsilonVis(facei)*exp(-Gamma) + + epsilonLog(facei)*exp(-invGamma) + ); } break; } @@ -312,7 +319,9 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate ); const scalar phiTanh = tanh(pow4(0.1*yPlus(facei))); - epsilon0[faceCells[facei]] += phiTanh*b1 + (1 - phiTanh)*b2; + epsilon0[faceCells[facei]] += + cornerWeights[facei] + * (phiTanh*b1 + (1 - phiTanh)*b2); } break; } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index f7769ebc20..2a1770659a 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016, 2019 OpenFOAM Foundation - Copyright (C) 2017-2023 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -219,7 +219,7 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate { return ( - cornerWeights[facei]*6.0*nuw[facei]/(beta1_*sqr(y[facei])) + 6.0*nuw[facei]/(beta1_*sqr(y[facei])) ); }; @@ -228,7 +228,7 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate { return ( - cornerWeights[facei]*sqrt(k[faceCells[facei]]) + sqrt(k[faceCells[facei]]) / (Cmu25*kappa*y[facei]) ); }; @@ -241,11 +241,15 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate { if (yPlus(facei) > yPlusLam) { - omega0[faceCells[facei]] += omegaLog(facei); + omega0[faceCells[facei]] += + cornerWeights[facei] + * omegaLog(facei); } else { - omega0[faceCells[facei]] += omegaVis(facei); + omega0[faceCells[facei]] += + cornerWeights[facei] + * omegaVis(facei); } } break; @@ -256,7 +260,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate forAll(faceCells, facei) { omega0[faceCells[facei]] += - pow + cornerWeights[facei] + * pow ( pow(omegaVis(facei), n_) + pow(omegaLog(facei), n_), scalar(1)/n_ @@ -271,7 +276,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate { // (PH:Eq. 27) omega0[faceCells[facei]] += - max(omegaVis(facei), omegaLog(facei)); + cornerWeights[facei] + * max(omegaVis(facei), omegaLog(facei)); } break; } @@ -286,10 +292,11 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL); omega0[faceCells[facei]] += - ( - omegaVis(facei)*exp(-Gamma) - + omegaLog(facei)*exp(-invGamma) - ); + cornerWeights[facei] + * ( + omegaVis(facei)*exp(-Gamma) + + omegaLog(facei)*exp(-invGamma) + ); } break; } @@ -310,7 +317,9 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate ); const scalar phiTanh = tanh(pow4(0.1*yPlus(facei))); - omega0[faceCells[facei]] += phiTanh*b1 + (1 - phiTanh)*b2; + omega0[faceCells[facei]] += + cornerWeights[facei] + *(phiTanh*b1 + (1 - phiTanh)*b2); } break; }