ENH: wallFunctions: use cornerWeights linear. Fixes #3218.

This commit is contained in:
mattijs
2024-09-18 15:26:28 +01:00
committed by Mattijs Janssens
parent 791796c67f
commit f321fc73ef
2 changed files with 42 additions and 24 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2019 OpenFOAM Foundation Copyright (C) 2011-2019 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -218,7 +218,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
{ {
return return
( (
cornerWeights[facei]*2.0*k[faceCells[facei]]*nuw[facei] 2.0*k[faceCells[facei]]*nuw[facei]
/ sqr(y[facei]) / sqr(y[facei])
); );
}; };
@ -228,7 +228,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
{ {
return return
( (
cornerWeights[facei]*Cmu75*pow(k[faceCells[facei]], 1.5) Cmu75*pow(k[faceCells[facei]], 1.5)
/ (kappa*y[facei]) / (kappa*y[facei])
); );
}; };
@ -241,11 +241,15 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
{ {
if (lowReCorrection_ && yPlus(facei) < yPlusLam) if (lowReCorrection_ && yPlus(facei) < yPlusLam)
{ {
epsilon0[faceCells[facei]] += epsilonVis(facei); epsilon0[faceCells[facei]] +=
cornerWeights[facei]
* epsilonVis(facei);
} }
else else
{ {
epsilon0[faceCells[facei]] += epsilonLog(facei); epsilon0[faceCells[facei]] +=
cornerWeights[facei]
* epsilonLog(facei);
} }
} }
break; break;
@ -257,7 +261,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
{ {
// (ME:Eqs. 15-16) // (ME:Eqs. 15-16)
epsilon0[faceCells[facei]] += epsilon0[faceCells[facei]] +=
pow cornerWeights[facei]
* pow
( (
pow(epsilonVis(facei), n_) + pow(epsilonLog(facei), n_), pow(epsilonVis(facei), n_) + pow(epsilonLog(facei), n_),
scalar(1)/n_ scalar(1)/n_
@ -272,7 +277,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
{ {
// (PH:Eq. 27) // (PH:Eq. 27)
epsilon0[faceCells[facei]] += epsilon0[faceCells[facei]] +=
max(epsilonVis(facei), epsilonLog(facei)); cornerWeights[facei]
* max(epsilonVis(facei), epsilonLog(facei));
} }
break; break;
} }
@ -288,7 +294,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL); const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
epsilon0[faceCells[facei]] += epsilon0[faceCells[facei]] +=
( cornerWeights[facei]
* (
epsilonVis(facei)*exp(-Gamma) epsilonVis(facei)*exp(-Gamma)
+ epsilonLog(facei)*exp(-invGamma) + epsilonLog(facei)*exp(-invGamma)
); );
@ -312,7 +319,9 @@ void Foam::epsilonWallFunctionFvPatchScalarField::calculate
); );
const scalar phiTanh = tanh(pow4(0.1*yPlus(facei))); 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; break;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016, 2019 OpenFOAM Foundation Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd. Copyright (C) 2017-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -219,7 +219,7 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate
{ {
return 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 return
( (
cornerWeights[facei]*sqrt(k[faceCells[facei]]) sqrt(k[faceCells[facei]])
/ (Cmu25*kappa*y[facei]) / (Cmu25*kappa*y[facei])
); );
}; };
@ -241,11 +241,15 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate
{ {
if (yPlus(facei) > yPlusLam) if (yPlus(facei) > yPlusLam)
{ {
omega0[faceCells[facei]] += omegaLog(facei); omega0[faceCells[facei]] +=
cornerWeights[facei]
* omegaLog(facei);
} }
else else
{ {
omega0[faceCells[facei]] += omegaVis(facei); omega0[faceCells[facei]] +=
cornerWeights[facei]
* omegaVis(facei);
} }
} }
break; break;
@ -256,7 +260,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate
forAll(faceCells, facei) forAll(faceCells, facei)
{ {
omega0[faceCells[facei]] += omega0[faceCells[facei]] +=
pow cornerWeights[facei]
* pow
( (
pow(omegaVis(facei), n_) + pow(omegaLog(facei), n_), pow(omegaVis(facei), n_) + pow(omegaLog(facei), n_),
scalar(1)/n_ scalar(1)/n_
@ -271,7 +276,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate
{ {
// (PH:Eq. 27) // (PH:Eq. 27)
omega0[faceCells[facei]] += omega0[faceCells[facei]] +=
max(omegaVis(facei), omegaLog(facei)); cornerWeights[facei]
* max(omegaVis(facei), omegaLog(facei));
} }
break; break;
} }
@ -286,7 +292,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate
const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL); const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
omega0[faceCells[facei]] += omega0[faceCells[facei]] +=
( cornerWeights[facei]
* (
omegaVis(facei)*exp(-Gamma) omegaVis(facei)*exp(-Gamma)
+ omegaLog(facei)*exp(-invGamma) + omegaLog(facei)*exp(-invGamma)
); );
@ -310,7 +317,9 @@ void Foam::omegaWallFunctionFvPatchScalarField::calculate
); );
const scalar phiTanh = tanh(pow4(0.1*yPlus(facei))); 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; break;
} }