TurbulenceModels::derivedFvPatchFields: standardized the cell index of the 'faceCell'

This commit is contained in:
Henry Weller
2016-08-04 10:51:09 +01:00
parent 4652677f76
commit 273197e20e
13 changed files with 52 additions and 47 deletions

View File

@ -138,9 +138,9 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs()
scalarField& htc = *this; scalarField& htc = *this;
forAll(htc, facei) forAll(htc, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar Re = rhow[facei]*mag(Uc[faceCelli] - Uw[facei])*L_/muw[facei]; scalar Re = rhow[facei]*mag(Uc[celli] - Uw[facei])*L_/muw[facei];
if (Re < 5.0E+05) if (Re < 5.0E+05)
{ {

View File

@ -239,9 +239,9 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
// Populate boundary values // Populate boundary values
forAll(alphatw, facei) forAll(alphatw, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[faceCelli]); scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/(muw[facei]/rhow[facei]); scalar yPlus = uTau*y[facei]/(muw[facei]/rhow[facei]);

View File

@ -236,10 +236,10 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
scalarField& alphatw = *this; scalarField& alphatw = *this;
forAll(alphatw, facei) forAll(alphatw, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
// y+ // y+
scalar yPlus = Cmu25*sqrt(k[faceCelli])*y[facei]/nuw[facei]; scalar yPlus = Cmu25*sqrt(k[celli])*y[facei]/nuw[facei];
// Molecular-to-turbulent Prandtl number ratio // Molecular-to-turbulent Prandtl number ratio
scalar Prat = Pr/Prt_; scalar Prat = Pr/Prt_;

View File

@ -327,10 +327,10 @@ void LRR<BasicTurbulenceModel>::correct()
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
label faceCelli = curPatch.faceCells()[facei]; label celli = curPatch.faceCells()[facei];
P[faceCelli] *= min P[celli] *= min
( (
G[faceCelli]/(0.5*mag(tr(P[faceCelli])) + SMALL), G[celli]/(0.5*mag(tr(P[celli])) + SMALL),
1.0 1.0
); );
} }

View File

@ -337,10 +337,10 @@ void SSG<BasicTurbulenceModel>::correct()
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
label faceCelli = curPatch.faceCells()[facei]; label celli = curPatch.faceCells()[facei];
P[faceCelli] *= min P[celli] *= min
( (
G[faceCelli]/(0.5*mag(tr(P[faceCelli])) + SMALL), G[celli]/(0.5*mag(tr(P[celli])) + SMALL),
1.0 1.0
); );
} }

View File

@ -204,18 +204,18 @@ void fWallFunctionFvPatchScalarField::updateCoeffs()
// Set f wall values // Set f wall values
forAll(f, facei) forAll(f, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[faceCelli]); scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/nuw[facei]; scalar yPlus = uTau*y[facei]/nuw[facei];
if (yPlus > yPlusLam_) if (yPlus > yPlusLam_)
{ {
scalar N = 6.0; scalar N = 6.0;
scalar v2c = v2[faceCelli]; scalar v2c = v2[celli];
scalar epsc = epsilon[faceCelli]; scalar epsc = epsilon[celli];
scalar kc = k[faceCelli]; scalar kc = k[celli];
f[facei] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL); f[facei] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL);
f[facei] /= sqr(uTau) + ROOTVSMALL; f[facei] /= sqr(uTau) + ROOTVSMALL;

View File

@ -193,9 +193,9 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
// Set k wall values // Set k wall values
forAll(kw, facei) forAll(kw, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[faceCelli]); scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/nuw[facei]; scalar yPlus = uTau*y[facei]/nuw[facei];

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,15 +33,12 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0); defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::checkType() void Foam::nutWallFunctionFvPatchScalarField::checkType()
{ {
if (!isA<wallFvPatch>(patch())) if (!isA<wallFvPatch>(patch()))
{ {
@ -55,7 +52,10 @@ void nutWallFunctionFvPatchScalarField::checkType()
} }
void nutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const void Foam::nutWallFunctionFvPatchScalarField::writeLocalEntries
(
Ostream& os
) const
{ {
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
@ -65,7 +65,7 @@ void nutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -81,7 +81,7 @@ nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
} }
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
( (
const nutWallFunctionFvPatchScalarField& ptf, const nutWallFunctionFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -99,7 +99,7 @@ nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
} }
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -116,7 +116,7 @@ nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
} }
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
( (
const nutWallFunctionFvPatchScalarField& wfpsf const nutWallFunctionFvPatchScalarField& wfpsf
) )
@ -131,7 +131,7 @@ nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
} }
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
( (
const nutWallFunctionFvPatchScalarField& wfpsf, const nutWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -149,7 +149,7 @@ nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalar nutWallFunctionFvPatchScalarField::yPlusLam Foam::scalar Foam::nutWallFunctionFvPatchScalarField::yPlusLam
( (
const scalar kappa, const scalar kappa,
const scalar E const scalar E
@ -166,7 +166,13 @@ scalar nutWallFunctionFvPatchScalarField::yPlusLam
} }
void nutWallFunctionFvPatchScalarField::updateCoeffs() Foam::scalar Foam::nutWallFunctionFvPatchScalarField::yPlusLam() const
{
return yPlusLam_;
}
void Foam::nutWallFunctionFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
{ {
@ -179,7 +185,7 @@ void nutWallFunctionFvPatchScalarField::updateCoeffs()
} }
void nutWallFunctionFvPatchScalarField::write(Ostream& os) const void Foam::nutWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
writeLocalEntries(os); writeLocalEntries(os);
@ -187,8 +193,4 @@ void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -164,6 +164,9 @@ public:
//- Calculate the Y+ at the edge of the laminar sublayer //- Calculate the Y+ at the edge of the laminar sublayer
static scalar yPlusLam(const scalar kappa, const scalar E); static scalar yPlusLam(const scalar kappa, const scalar E);
//- Return the Y+ at the edge of the laminar sublayer
scalar yPlusLam() const;
//- Calculate and return the yPlus at the boundary //- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const = 0; virtual tmp<scalarField> yPlus() const = 0;

View File

@ -61,9 +61,9 @@ tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const
forAll(nutw, facei) forAll(nutw, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar uStar = Cmu25*sqrt(k[faceCelli]); scalar uStar = Cmu25*sqrt(k[celli]);
scalar yPlus = uStar*y[facei]/nuw[facei]; scalar yPlus = uStar*y[facei]/nuw[facei];
scalar Edash = (y[facei] + z0_[facei])/z0_[facei]; scalar Edash = (y[facei] + z0_[facei])/z0_[facei];

View File

@ -84,9 +84,9 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
forAll(nutw, facei) forAll(nutw, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar uStar = Cmu25*sqrt(k[faceCelli]); scalar uStar = Cmu25*sqrt(k[celli]);
scalar yPlus = uStar*y[facei]/nuw[facei]; scalar yPlus = uStar*y[facei]/nuw[facei];
scalar KsPlus = uStar*Ks_[facei]/nuw[facei]; scalar KsPlus = uStar*Ks_[facei]/nuw[facei];

View File

@ -63,9 +63,9 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
forAll(nutw, facei) forAll(nutw, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar yPlus = Cmu25*y[facei]*sqrt(k[faceCelli])/nuw[facei]; scalar yPlus = Cmu25*y[facei]*sqrt(k[celli])/nuw[facei];
if (yPlus > yPlusLam_) if (yPlus > yPlusLam_)
{ {

View File

@ -196,9 +196,9 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs()
// Set v2 wall values // Set v2 wall values
forAll(v2, facei) forAll(v2, facei)
{ {
label faceCelli = patch().faceCells()[facei]; label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[faceCelli]); scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/nuw[facei]; scalar yPlus = uTau*y[facei]/nuw[facei];