Skip to content
Snippets Groups Projects
Commit 85b9b3e3 authored by Andrew Heather's avatar Andrew Heather
Browse files

adding yPlus calcs for compressible S-A models + other small fixes

parent 01903e5e
Branches
Tags
No related merge requests found
Showing
with 49 additions and 50 deletions
......@@ -67,8 +67,7 @@ scalar mutRoughWallFunctionFvPatchScalarField::fnRough
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutRoughWallFunctionFvPatchScalarField::
mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
......@@ -80,8 +79,7 @@ mutRoughWallFunctionFvPatchScalarField
{}
mutRoughWallFunctionFvPatchScalarField::
mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
......@@ -95,8 +93,7 @@ mutRoughWallFunctionFvPatchScalarField
{}
mutRoughWallFunctionFvPatchScalarField::
mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
......@@ -109,8 +106,7 @@ mutRoughWallFunctionFvPatchScalarField
{}
mutRoughWallFunctionFvPatchScalarField::
mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField& rwfpsf
)
......@@ -121,8 +117,7 @@ mutRoughWallFunctionFvPatchScalarField
{}
mutRoughWallFunctionFvPatchScalarField::
mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
......@@ -221,6 +216,7 @@ tmp<scalarField> mutRoughWallFunctionFvPatchScalarField::calcMut() const
void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
Cs_.writeEntry("Cs", os);
Ks_.writeEntry("Ks", os);
writeEntry("value", os);
......
......@@ -48,6 +48,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcYPlus
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
const scalarField& y = rasModel.y()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
......@@ -122,7 +123,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcYPlus
scalar denom = 1.0 + log(E_*yp) - G - yPlusGPrime;
if (mag(denom) > VSMALL)
{
yp = kappaRe + yp*(1 - yPlusGPrime))/denom;
yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
}
} while
......@@ -298,8 +299,7 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
) const
{
fixedValueFvPatchScalarField::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeLocalEntries(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
......
......@@ -42,7 +42,7 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField>
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
......@@ -60,7 +60,7 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
forAll(yPlus, faceI)
{
scalar kappaRe = kappa_*magUp[facei]*y[faceI]/(muw[faceI]/rhow[faceI]);
scalar kappaRe = kappa_*magUp[faceI]*y[faceI]/(muw[faceI]/rhow[faceI]);
scalar yp = yPlusLam;
scalar ryPlusLam = 1.0/yp;
......@@ -75,11 +75,10 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10);
yPlus[facei] = max(0.0, yp);
yPlus[faceI] = max(0.0, yp);
}
return tyPlus;
}
......@@ -151,10 +150,8 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
tmp<scalarField> tyPlus = calcYPlus(magUp);
......@@ -165,10 +162,10 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
forAll(yPlus, faceI)
{
if (yPlus[facei] > yPlusLam)
if (yPlus[faceI] > yPlusLam)
{
mutw[faceI] =
muw[faceI]*(yPlus[facei]*kappa_/log(E_*yPlus[facei]) - 1.0);
muw[faceI]*(yPlus[faceI]*kappa_/log(E_*yPlus[faceI]) - 1.0);
}
}
......@@ -194,8 +191,7 @@ void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeLocalEntries(os);
writeEntry("value", os);
}
......
......@@ -39,7 +39,7 @@ namespace compressible
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
(
......@@ -173,11 +173,8 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField::calcMut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradU = mag(Uw.snGrad());
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return max(0.0, rhow*sqr(calcUTau(magGradU))/magGradU - muw);
......@@ -191,11 +188,8 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField::yPlus() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
......@@ -208,8 +202,7 @@ void mutSpalartAllmarasWallFunctionFvPatchScalarField::write
) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeLocalEntries(os);
writeEntry("value", os);
}
......
......@@ -189,10 +189,16 @@ tmp<scalarField> mutWallFunctionFvPatchScalarField::yPlus() const
void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
void mutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
......
......@@ -79,6 +79,9 @@ protected:
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
......
......@@ -223,9 +223,7 @@ tmp<scalarField> nutRoughWallFunctionFvPatchScalarField::calcNut() const
void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeLocalEntries(os);
Cs_.writeEntry("Cs", os);
Ks_.writeEntry("Ks", os);
writeEntry("value", os);
......
......@@ -294,15 +294,15 @@ void nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
Ostream& os
) const
{
fixedValueFvPatchScalarField::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFudgeFactor")
<< roughnessFudgeFactor_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
......
......@@ -189,9 +189,9 @@ void nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
Ostream& os
) const
{
fixedValueFvPatchScalarField::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
......
......@@ -51,8 +51,7 @@ tmp<scalarField> nutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
const fvPatchVectorField& Uw =
rasModel.U().boundaryField()[patch().index()];
scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField& nuw = rasModel.nu().boundaryField()[patch().index()];
const scalarField& nutw = *this;
......@@ -193,9 +192,9 @@ void nutSpalartAllmarasWallFunctionFvPatchScalarField::write
Ostream& os
) const
{
fixedValueFvPatchScalarField::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
......
......@@ -40,7 +40,7 @@ namespace incompressible
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::checkType()
{
......@@ -158,7 +158,6 @@ tmp<scalarField> nutWallFunctionFvPatchScalarField::calcNut() const
const scalar Cmu25 = pow(Cmu_, 0.25);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
......@@ -197,10 +196,16 @@ tmp<scalarField> nutWallFunctionFvPatchScalarField::yPlus() const
void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
void nutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
......
......@@ -79,6 +79,9 @@ protected:
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment