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

This commit is contained in:
andy
2009-07-23 16:40:50 +01:00
parent 01903e5e8f
commit 85b9b3e38a
12 changed files with 49 additions and 50 deletions

View File

@ -67,8 +67,7 @@ scalar mutRoughWallFunctionFvPatchScalarField::fnRough
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutRoughWallFunctionFvPatchScalarField:: mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -80,8 +79,7 @@ mutRoughWallFunctionFvPatchScalarField
{} {}
mutRoughWallFunctionFvPatchScalarField:: mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField
( (
const mutRoughWallFunctionFvPatchScalarField& ptf, const mutRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -95,8 +93,7 @@ mutRoughWallFunctionFvPatchScalarField
{} {}
mutRoughWallFunctionFvPatchScalarField:: mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -109,8 +106,7 @@ mutRoughWallFunctionFvPatchScalarField
{} {}
mutRoughWallFunctionFvPatchScalarField:: mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField
( (
const mutRoughWallFunctionFvPatchScalarField& rwfpsf const mutRoughWallFunctionFvPatchScalarField& rwfpsf
) )
@ -121,8 +117,7 @@ mutRoughWallFunctionFvPatchScalarField
{} {}
mutRoughWallFunctionFvPatchScalarField:: mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutRoughWallFunctionFvPatchScalarField
( (
const mutRoughWallFunctionFvPatchScalarField& rwfpsf, const mutRoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -221,6 +216,7 @@ tmp<scalarField> mutRoughWallFunctionFvPatchScalarField::calcMut() const
void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
writeLocalEntries(os);
Cs_.writeEntry("Cs", os); Cs_.writeEntry("Cs", os);
Ks_.writeEntry("Ks", os); Ks_.writeEntry("Ks", os);
writeEntry("value", os); writeEntry("value", os);

View File

@ -48,6 +48,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcYPlus
const label patchI = patch().index(); const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI]; const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI]; const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
@ -122,7 +123,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcYPlus
scalar denom = 1.0 + log(E_*yp) - G - yPlusGPrime; scalar denom = 1.0 + log(E_*yp) - G - yPlusGPrime;
if (mag(denom) > VSMALL) if (mag(denom) > VSMALL)
{ {
yp = kappaRe + yp*(1 - yPlusGPrime))/denom; yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
} }
} while } while
@ -298,8 +299,7 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
) const ) const
{ {
fixedValueFvPatchScalarField::write(os); fixedValueFvPatchScalarField::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessHeight") os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl; << roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant") os.writeKeyword("roughnessConstant")

View File

@ -42,7 +42,7 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> tmp<scalarField>
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
( (
const scalarField& magUp const scalarField& magUp
) const ) const
@ -60,7 +60,7 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
forAll(yPlus, faceI) 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 yp = yPlusLam;
scalar ryPlusLam = 1.0/yp; scalar ryPlusLam = 1.0/yp;
@ -75,11 +75,10 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10); } while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10);
yPlus[facei] = max(0.0, yp); yPlus[faceI] = max(0.0, yp);
} }
return tyPlus; return tyPlus;
} }
@ -151,10 +150,8 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_); const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw); const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI]; const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
tmp<scalarField> tyPlus = calcYPlus(magUp); tmp<scalarField> tyPlus = calcYPlus(magUp);
@ -165,10 +162,10 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
forAll(yPlus, faceI) forAll(yPlus, faceI)
{ {
if (yPlus[facei] > yPlusLam) if (yPlus[faceI] > yPlusLam)
{ {
mutw[faceI] = 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 ) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -39,7 +39,7 @@ namespace compressible
namespace RASModels namespace RASModels
{ {
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
( (
@ -173,11 +173,8 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField::calcMut() const
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradU = mag(Uw.snGrad()); const scalarField magGradU = mag(Uw.snGrad());
const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI]; const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return max(0.0, rhow*sqr(calcUTau(magGradU))/magGradU - muw); 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 RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI]; const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI]; const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow); return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
@ -208,8 +202,7 @@ void mutSpalartAllmarasWallFunctionFvPatchScalarField::write
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -189,10 +189,16 @@ tmp<scalarField> mutWallFunctionFvPatchScalarField::yPlus() const
void mutWallFunctionFvPatchScalarField::write(Ostream& os) const void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); 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("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
} }

View File

@ -79,6 +79,9 @@ protected:
//- Calculate the turbulence viscosity //- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const; virtual tmp<scalarField> calcMut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public: public:

View File

@ -223,9 +223,7 @@ tmp<scalarField> nutRoughWallFunctionFvPatchScalarField::calcNut() const
void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
Cs_.writeEntry("Cs", os); Cs_.writeEntry("Cs", os);
Ks_.writeEntry("Ks", os); Ks_.writeEntry("Ks", os);
writeEntry("value", os); writeEntry("value", os);

View File

@ -294,15 +294,15 @@ void nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fixedValueFvPatchScalarField::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessHeight") os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl; << roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant") os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl; << roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFudgeFactor") os.writeKeyword("roughnessFudgeFactor")
<< roughnessFudgeFactor_ << token::END_STATEMENT << nl; << roughnessFudgeFactor_ << token::END_STATEMENT << nl;
writeEntry("value", os);
} }

View File

@ -189,9 +189,9 @@ void nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fixedValueFvPatchScalarField::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; writeEntry("value", os);
} }

View File

@ -51,8 +51,7 @@ tmp<scalarField> nutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
const fvPatchVectorField& Uw = const fvPatchVectorField& Uw =
rasModel.U().boundaryField()[patch().index()]; rasModel.U().boundaryField()[patch().index()];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField& nuw = rasModel.nu().boundaryField()[patch().index()]; const scalarField& nuw = rasModel.nu().boundaryField()[patch().index()];
const scalarField& nutw = *this; const scalarField& nutw = *this;
@ -193,9 +192,9 @@ void nutSpalartAllmarasWallFunctionFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fixedValueFvPatchScalarField::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; writeLocalEntries(os);
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; writeEntry("value", os);
} }

View File

@ -40,7 +40,7 @@ namespace incompressible
namespace RASModels namespace RASModels
{ {
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::checkType() void nutWallFunctionFvPatchScalarField::checkType()
{ {
@ -158,7 +158,6 @@ tmp<scalarField> nutWallFunctionFvPatchScalarField::calcNut() const
const scalar Cmu25 = pow(Cmu_, 0.25); const scalar Cmu25 = pow(Cmu_, 0.25);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0)); tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw(); scalarField& nutw = tnutw();
@ -197,10 +196,16 @@ tmp<scalarField> nutWallFunctionFvPatchScalarField::yPlus() const
void nutWallFunctionFvPatchScalarField::write(Ostream& os) const void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); 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("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
} }

View File

@ -79,6 +79,9 @@ protected:
//- Calculate the turbulence viscosity //- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const; virtual tmp<scalarField> calcNut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public: public: