mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
updates to compressible wall functions
This commit is contained in:
@ -74,13 +74,7 @@ mutRoughWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
rhoName_("rho"),
|
||||
muName_("mu"),
|
||||
kName_("k"),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
mutWallFunctionFvPatchScalarField(p, iF),
|
||||
Ks_(p.size(), 0.0),
|
||||
Cs_(p.size(), 0.0)
|
||||
{}
|
||||
@ -95,13 +89,7 @@ mutRoughWallFunctionFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_),
|
||||
kName_(ptf.kName_),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
Ks_(ptf.Ks_, mapper),
|
||||
Cs_(ptf.Cs_, mapper)
|
||||
{}
|
||||
@ -115,13 +103,7 @@ mutRoughWallFunctionFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
mutWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
Ks_("Ks", dict, p.size()),
|
||||
Cs_("Cs", dict, p.size())
|
||||
{}
|
||||
@ -133,13 +115,7 @@ mutRoughWallFunctionFvPatchScalarField
|
||||
const mutRoughWallFunctionFvPatchScalarField& rwfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(rwfpsf),
|
||||
rhoName_(rwfpsf.rhoName_),
|
||||
muName_(rwfpsf.muName_),
|
||||
kName_(rwfpsf.kName_),
|
||||
Cmu_(rwfpsf.Cmu_),
|
||||
kappa_(rwfpsf.kappa_),
|
||||
E_(rwfpsf.E_),
|
||||
mutWallFunctionFvPatchScalarField(rwfpsf),
|
||||
Ks_(rwfpsf.Ks_),
|
||||
Cs_(rwfpsf.Cs_)
|
||||
{}
|
||||
@ -152,13 +128,7 @@ mutRoughWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(rwfpsf, iF),
|
||||
rhoName_(rwfpsf.rhoName_),
|
||||
muName_(rwfpsf.muName_),
|
||||
kName_(rwfpsf.kName_),
|
||||
Cmu_(rwfpsf.Cmu_),
|
||||
kappa_(rwfpsf.kappa_),
|
||||
E_(rwfpsf.E_),
|
||||
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
|
||||
Ks_(rwfpsf.Ks_),
|
||||
Cs_(rwfpsf.Cs_)
|
||||
{}
|
||||
@ -171,7 +141,7 @@ void mutRoughWallFunctionFvPatchScalarField::autoMap
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
mutWallFunctionFvPatchScalarField::autoMap(m);
|
||||
Ks_.autoMap(m);
|
||||
Cs_.autoMap(m);
|
||||
}
|
||||
@ -183,7 +153,7 @@ void mutRoughWallFunctionFvPatchScalarField::rmap
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
mutWallFunctionFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const mutRoughWallFunctionFvPatchScalarField& nrwfpsf =
|
||||
refCast<const mutRoughWallFunctionFvPatchScalarField>(ptf);
|
||||
@ -193,23 +163,22 @@ void mutRoughWallFunctionFvPatchScalarField::rmap
|
||||
}
|
||||
|
||||
|
||||
void mutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
tmp<scalarField> mutRoughWallFunctionFvPatchScalarField::calcMut() const
|
||||
{
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>(kName_);
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
|
||||
scalarField& mutw = *this;
|
||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& mutw = tmutw();
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
@ -243,23 +212,15 @@ void mutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
mutw[faceI] =
|
||||
muw[faceI]*(yPlus*kappa_/log(max(Edash*yPlus, 1+1e-4)) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
return tmutw;
|
||||
}
|
||||
|
||||
|
||||
void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
writeEntryIfDifferent<word>(os, "k", "k", kName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
Cs_.writeEntry("Cs", os);
|
||||
Ks_.writeEntry("Ks", os);
|
||||
writeEntry("value", os);
|
||||
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
#ifndef mutRoughWallFunctionFvPatchScalarField_H
|
||||
#define mutRoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "mutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -60,27 +60,11 @@ namespace RASModels
|
||||
|
||||
class mutRoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public mutWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Name of turbulence kinetic energy field
|
||||
word kName_;
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von-karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
// Protected data
|
||||
|
||||
//- Roughness height
|
||||
scalarField Ks_;
|
||||
@ -92,7 +76,10 @@ class mutRoughWallFunctionFvPatchScalarField
|
||||
// Private member functions
|
||||
|
||||
//- Compute the roughness function
|
||||
scalar fnRough(const scalar KsPlus, const scalar Cs) const;
|
||||
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const;
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcMut() const;
|
||||
|
||||
|
||||
public:
|
||||
@ -181,16 +168,11 @@ public:
|
||||
const labelList&
|
||||
);
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "RASModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -47,12 +48,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
rhoName_("rho"),
|
||||
muName_("mu"),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
mutWallFunctionFvPatchScalarField(p, iF),
|
||||
roughnessHeight_(pTraits<scalar>::zero),
|
||||
roughnessConstant_(pTraits<scalar>::zero),
|
||||
roughnessFudgeFactor_(pTraits<scalar>::zero)
|
||||
@ -68,12 +64,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
roughnessHeight_(ptf.roughnessHeight_),
|
||||
roughnessConstant_(ptf.roughnessConstant_),
|
||||
roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
|
||||
@ -88,12 +79,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
mutWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
|
||||
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
|
||||
roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor")))
|
||||
@ -106,12 +92,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& rwfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(rwfpsf),
|
||||
UName_(rwfpsf.UName_),
|
||||
rhoName_(rwfpsf.rhoName_),
|
||||
muName_(rwfpsf.muName_),
|
||||
kappa_(rwfpsf.kappa_),
|
||||
E_(rwfpsf.E_),
|
||||
mutWallFunctionFvPatchScalarField(rwfpsf),
|
||||
roughnessHeight_(rwfpsf.roughnessHeight_),
|
||||
roughnessConstant_(rwfpsf.roughnessConstant_),
|
||||
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
|
||||
@ -125,12 +106,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(rwfpsf, iF),
|
||||
UName_(rwfpsf.UName_),
|
||||
rhoName_(rwfpsf.rhoName_),
|
||||
muName_(rwfpsf.muName_),
|
||||
kappa_(rwfpsf.kappa_),
|
||||
E_(rwfpsf.E_),
|
||||
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
|
||||
roughnessHeight_(rwfpsf.roughnessHeight_),
|
||||
roughnessConstant_(rwfpsf.roughnessConstant_),
|
||||
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
|
||||
@ -139,28 +115,24 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
tmp<scalarField>
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcMut() const
|
||||
{
|
||||
const scalar yPlusLam = 11.225;
|
||||
const label patchI = patch().index();
|
||||
|
||||
// The reciprical of the distance to the adjacent cell centre.
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
const fvPatchScalarField& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
||||
|
||||
// The flow velocity at the adjacent cell centre.
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
scalarField& mutw = *this;
|
||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& mutw = tmutw();
|
||||
|
||||
if (roughnessHeight_ > 0.0)
|
||||
{
|
||||
@ -177,7 +149,7 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
forAll(mutw, facei)
|
||||
{
|
||||
const scalar magUpara = magUp[facei];
|
||||
const scalar Re = rho[facei]*magUpara/(muw[facei]*ry[facei]);
|
||||
const scalar Re = rho[facei]*magUpara*y[facei]/muw[facei];
|
||||
const scalar kappaRe = kappa_*Re;
|
||||
|
||||
scalar yPlus = yPlusLam;
|
||||
@ -185,7 +157,7 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
|
||||
int iter = 0;
|
||||
scalar yPlusLast = 0.0;
|
||||
scalar dKsPlusdYPlus = roughnessHeight_*ry[facei];
|
||||
scalar dKsPlusdYPlus = roughnessHeight_/y[facei];
|
||||
|
||||
// Enforce the roughnessHeight to be less than the distance to
|
||||
// the first cell centre.
|
||||
@ -194,18 +166,17 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
dKsPlusdYPlus = 1;
|
||||
}
|
||||
|
||||
// Fudge factor to get results to be similar to fluent
|
||||
// (at least difference between rough and smooth).
|
||||
// Additional tuning parameter (fudge factor) - nominally = 1
|
||||
dKsPlusdYPlus *= roughnessFudgeFactor_;
|
||||
|
||||
do
|
||||
{
|
||||
yPlusLast = yPlus;
|
||||
|
||||
// The non-dimensional roughness height.
|
||||
// The non-dimensional roughness height
|
||||
scalar KsPlus = yPlus*dKsPlusdYPlus;
|
||||
|
||||
// The extra term in the law-of-the-wall.
|
||||
// The extra term in the law-of-the-wall
|
||||
scalar G = 0.0;
|
||||
|
||||
scalar yPlusGPrime = 0.0;
|
||||
@ -238,7 +209,7 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure immediate end and mutw = 0.
|
||||
// Ensure immediate end and mutw = 0
|
||||
yPlus = 0;
|
||||
}
|
||||
|
||||
@ -253,20 +224,16 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
{
|
||||
mutw[facei] = muw[facei]*(yPlus*yPlus/Re - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[facei] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Smooth Walls.
|
||||
// Smooth Walls
|
||||
forAll(mutw, facei)
|
||||
{
|
||||
const scalar magUpara = magUp[facei];
|
||||
const scalar Re = rho[facei]*magUpara/(muw[facei]*ry[facei]);
|
||||
const scalar Re = rho[facei]*magUpara*y[facei]/muw[facei];
|
||||
const scalar kappaRe = kappa_*Re;
|
||||
|
||||
scalar yPlus = yPlusLam;
|
||||
@ -290,12 +257,23 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
{
|
||||
mutw[facei] = muw[facei]*(yPlus*yPlus/Re - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[facei] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tmutw;
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField>
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::yPlus()"
|
||||
"const"
|
||||
);
|
||||
|
||||
return tmp<scalarField>(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -305,11 +283,6 @@ void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
|
||||
) const
|
||||
{
|
||||
fixedValueFvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("roughnessHeight")
|
||||
<< roughnessHeight_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("roughnessConstant")
|
||||
|
||||
@ -37,7 +37,7 @@ SourceFiles
|
||||
#ifndef mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||
#define mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "mutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,25 +54,11 @@ Class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration
|
||||
|
||||
class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public mutWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Roughness parameters
|
||||
|
||||
@ -86,6 +72,12 @@ class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
scalar roughnessFudgeFactor_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcMut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -206,13 +198,12 @@ public:
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
@ -48,12 +48,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
rhoName_("rho"),
|
||||
muName_("mu"),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
mutWallFunctionFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
@ -66,12 +61,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
@ -83,12 +73,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
mutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
@ -98,12 +83,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(sawfpsf),
|
||||
UName_(sawfpsf.UName_),
|
||||
rhoName_(sawfpsf.rhoName_),
|
||||
muName_(sawfpsf.muName_),
|
||||
kappa_(sawfpsf.kappa_),
|
||||
E_(sawfpsf.E_)
|
||||
mutWallFunctionFvPatchScalarField(sawfpsf)
|
||||
{}
|
||||
|
||||
|
||||
@ -114,46 +94,37 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(sawfpsf, iF),
|
||||
UName_(sawfpsf.UName_),
|
||||
rhoName_(sawfpsf.rhoName_),
|
||||
muName_(sawfpsf.muName_),
|
||||
kappa_(sawfpsf.kappa_),
|
||||
E_(sawfpsf.E_)
|
||||
mutWallFunctionFvPatchScalarField(sawfpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
tmp<scalarField>
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
|
||||
{
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
||||
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
scalarField& mutw = *this;
|
||||
|
||||
scalarField magFaceGradU = mag(U.snGrad());
|
||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& mutw = tmutw();
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
scalar magUpara = magUp[faceI];
|
||||
|
||||
scalar kappaRe = kappa_*magUpara/((muw[faceI]/rhow[faceI])*ry[faceI]);
|
||||
scalar kappaRe = kappa_*magUpara*y[faceI]/(muw[faceI]/rhow[faceI]);
|
||||
|
||||
scalar yPlus = yPlusLam;
|
||||
scalar ryPlusLam = 1.0/yPlus;
|
||||
@ -166,17 +137,28 @@ void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::evaluate
|
||||
yPlusLast = yPlus;
|
||||
yPlus = (kappaRe + yPlus)/(1.0 + log(E_*yPlus));
|
||||
|
||||
} while (mag(ryPlusLam*(yPlus - yPlusLast)) > 0.01 && ++iter < 10 );
|
||||
} while (mag(ryPlusLam*(yPlus - yPlusLast)) > 0.01 && ++iter < 10);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
mutw[faceI] = muw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0.0;
|
||||
mutw[faceI] = muw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
return tmutw;
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField>
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::yPlus() "
|
||||
"const"
|
||||
);
|
||||
|
||||
return tmp<scalarField>(NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -186,9 +168,6 @@ void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
|
||||
@ -37,7 +37,7 @@ SourceFiles
|
||||
#ifndef mutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||
#define mutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "mutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,24 +54,14 @@ namespace RASModels
|
||||
|
||||
class mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public mutWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
// Protected member functions
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcMut() const;
|
||||
|
||||
|
||||
public:
|
||||
@ -154,11 +144,11 @@ public:
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "mutSpalartAllmarasWallFunctionFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "RASModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -38,6 +39,72 @@ namespace compressible
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
|
||||
(
|
||||
const scalarField& magGradU
|
||||
) const
|
||||
{
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
rasModel.U().boundaryField()[patch().index()];
|
||||
|
||||
scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
||||
|
||||
const fvPatchScalarField& rhow =
|
||||
rasModel.rho().boundaryField()[patch().index()];
|
||||
|
||||
const fvPatchScalarField& muw =
|
||||
rasModel.mu().boundaryField()[patch().index()];
|
||||
const scalarField& mutw = *this;
|
||||
|
||||
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
|
||||
scalarField& uTau = tuTau();
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
scalar magUpara = magUp[faceI];
|
||||
|
||||
scalar ut =
|
||||
sqrt((mutw[faceI] + muw[faceI])*magGradU[faceI]/rhow[faceI]);
|
||||
|
||||
if (ut > VSMALL)
|
||||
{
|
||||
int iter = 0;
|
||||
scalar err = GREAT;
|
||||
|
||||
do
|
||||
{
|
||||
scalar kUu = min(kappa_*magUpara/ut, 50);
|
||||
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
|
||||
|
||||
scalar f =
|
||||
- ut*y[faceI]/(muw[faceI]/rhow[faceI])
|
||||
+ magUpara/ut
|
||||
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
|
||||
|
||||
scalar df =
|
||||
y[faceI]/(muw[faceI]/rhow[faceI])
|
||||
+ magUpara/sqr(ut)
|
||||
+ 1/E_*kUu*fkUu/ut;
|
||||
|
||||
scalar uTauNew = ut + f/df;
|
||||
err = mag((ut - uTauNew)/ut);
|
||||
ut = uTauNew;
|
||||
|
||||
} while (ut > VSMALL && err > 0.01 && ++iter < 10);
|
||||
|
||||
uTau[faceI] = max(0.0, ut);
|
||||
}
|
||||
}
|
||||
|
||||
return tuTau;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||
@ -47,12 +114,7 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
rhoName_("rho"),
|
||||
muName_("mu"),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
mutWallFunctionFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
@ -65,12 +127,7 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
@ -82,12 +139,7 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
mutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
@ -97,12 +149,7 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField& wfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(wfpsf),
|
||||
UName_(wfpsf.UName_),
|
||||
rhoName_(wfpsf.rhoName_),
|
||||
muName_(wfpsf.muName_),
|
||||
kappa_(wfpsf.kappa_),
|
||||
E_(wfpsf.E_)
|
||||
mutWallFunctionFvPatchScalarField(wfpsf)
|
||||
{}
|
||||
|
||||
|
||||
@ -113,83 +160,45 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(wfpsf, iF),
|
||||
UName_(wfpsf.UName_),
|
||||
rhoName_(wfpsf.rhoName_),
|
||||
muName_(wfpsf.muName_),
|
||||
kappa_(wfpsf.kappa_),
|
||||
E_(wfpsf.E_)
|
||||
mutWallFunctionFvPatchScalarField(wfpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutSpalartAllmarasWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
tmp<scalarField>
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::calcMut() const
|
||||
{
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
const label patchI = patch().index();
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
const scalarField magGradU = mag(Uw.snGrad());
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
scalarField& mutw = *this;
|
||||
return max(0.0, rhow*sqr(calcUTau(magGradU))/magGradU - muw);
|
||||
}
|
||||
|
||||
scalarField magFaceGradU = mag(U.snGrad());
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
scalar magUpara = magUp[faceI];
|
||||
tmp<scalarField>
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchI = patch().index();
|
||||
|
||||
scalar utau =
|
||||
sqrt((mutw[faceI] + muw[faceI])*magFaceGradU[faceI]/rhow[faceI]);
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
if (utau > VSMALL)
|
||||
{
|
||||
int iter = 0;
|
||||
scalar err = GREAT;
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
do
|
||||
{
|
||||
scalar kUu = min(kappa_*magUpara/utau, 50);
|
||||
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
scalar f =
|
||||
- utau/(ry[faceI]*(muw[faceI]/rhow[faceI]))
|
||||
+ magUpara/utau
|
||||
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
scalar df =
|
||||
1.0/(ry[faceI]*(muw[faceI]/rhow[faceI]))
|
||||
+ magUpara/sqr(utau)
|
||||
+ 1/E_*kUu*fkUu/utau;
|
||||
|
||||
scalar utauNew = utau + f/df;
|
||||
err = mag((utau - utauNew)/utau);
|
||||
utau = utauNew;
|
||||
|
||||
} while (utau > VSMALL && err > 0.01 && ++iter < 10);
|
||||
|
||||
mutw[faceI] = max
|
||||
(
|
||||
rhow[faceI]*sqr(max(utau, 0))/magFaceGradU[faceI] - muw[faceI],
|
||||
0.0
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0;
|
||||
}
|
||||
}
|
||||
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
|
||||
}
|
||||
|
||||
|
||||
@ -199,9 +208,6 @@ void mutSpalartAllmarasWallFunctionFvPatchScalarField::write
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
|
||||
@ -37,7 +37,7 @@ SourceFiles
|
||||
#ifndef mutSpalartAllmarasWallFunctionFvPatchScalarField_H
|
||||
#define mutSpalartAllmarasWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "mutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,24 +54,17 @@ namespace RASModels
|
||||
|
||||
class mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public mutWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
// Protected member functions
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcMut() const;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
//- Calculate the friction velocity
|
||||
virtual tmp<scalarField> calcUTau(const scalarField& magGradU) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -147,11 +140,11 @@ public:
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -39,27 +40,38 @@ namespace compressible
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void mutWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("mutWallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
rhoName_("rho"),
|
||||
muName_("mu"),
|
||||
kName_("k"),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
@ -68,17 +80,13 @@ mutWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_),
|
||||
kName_(ptf.kName_),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
@ -86,42 +94,31 @@ mutWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField& wfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(wfpsf),
|
||||
rhoName_(wfpsf.rhoName_),
|
||||
muName_(wfpsf.muName_),
|
||||
kName_(wfpsf.kName_),
|
||||
Cmu_(wfpsf.Cmu_),
|
||||
kappa_(wfpsf.kappa_),
|
||||
E_(wfpsf.E_)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField& wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(wfpsf, iF),
|
||||
rhoName_(wfpsf.rhoName_),
|
||||
muName_(wfpsf.muName_),
|
||||
kName_(wfpsf.kName_),
|
||||
Cmu_(wfpsf.Cmu_),
|
||||
kappa_(wfpsf.kappa_),
|
||||
E_(wfpsf.E_)
|
||||
@ -132,21 +129,27 @@ mutWallFunctionFvPatchScalarField
|
||||
|
||||
void mutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
operator==(calcMut());
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> mutWallFunctionFvPatchScalarField::calcMut() const
|
||||
{
|
||||
const label patchI = patch().index();
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
const volScalarField& k = db().lookupObject<volScalarField>(kName_);
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
|
||||
scalarField& mutw = *this;
|
||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& mutw = tmutw();
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
@ -160,20 +163,32 @@ void mutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
mutw[faceI] = muw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
return tmutw;
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> mutWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
const scalarField kwc = k.boundaryField()[patchI].patchInternalField();
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
return pow(Cmu_, 0.25)*y*sqrt(kwc)/(muw/rhow);
|
||||
}
|
||||
|
||||
|
||||
void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
writeEntryIfDifferent<word>(os, "k", "k", kName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
|
||||
@ -57,16 +57,9 @@ class mutWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Name of turbulence kinetic energy field
|
||||
word kName_;
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
@ -78,6 +71,15 @@ class mutWallFunctionFvPatchScalarField
|
||||
scalar E_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcMut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -151,6 +153,9 @@ public:
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user