Refactored mutWallFunctionFvPatchScalarField
This class is now abstract base class from which all other mut wall functions will derive. Similar organization as for nutWallFunctionFvPatchField
This commit is contained in:
parent
335d25ad1d
commit
e7af83c8da
3 changed files with 41 additions and 108 deletions
|
@ -17,13 +17,7 @@ alphatWallFunctions = $(wallFunctions)/alphatWallFunctions
|
||||||
$(alphatWallFunctions)/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C
|
$(alphatWallFunctions)/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
mutWallFunctions = $(wallFunctions)/mutWallFunctions
|
mutWallFunctions = $(wallFunctions)/mutWallFunctions
|
||||||
$(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
|
|
||||||
$(mutWallFunctions)/mutWallFunction/mutWallFunctionFvPatchScalarField.C
|
$(mutWallFunctions)/mutWallFunction/mutWallFunctionFvPatchScalarField.C
|
||||||
$(mutWallFunctions)/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C
|
|
||||||
$(mutWallFunctions)/mutSpalartAllmarasWallFunction/mutSpalartAllmarasWallFunctionFvPatchScalarField.C
|
|
||||||
$(mutWallFunctions)/mutSpalartAllmarasStandardWallFunction/mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
|
||||||
$(mutWallFunctions)/mutSpalartAllmarasStandardRoughWallFunction/mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
|
|
||||||
$(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C
|
|
||||||
|
|
||||||
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
||||||
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
||||||
|
@ -42,6 +36,4 @@ derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupl
|
||||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
|
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
|
||||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
|
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
|
||||||
|
|
||||||
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels
|
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels
|
||||||
|
|
|
@ -44,7 +44,7 @@ void mutWallFunctionFvPatchScalarField::checkType()
|
||||||
{
|
{
|
||||||
if (!patch().isWall())
|
if (!patch().isWall())
|
||||||
{
|
{
|
||||||
FatalErrorIn("mutWallFunctionFvPatchScalarField::checkType()")
|
FatalErrorIn(this->type() + "FvPatchScalarField::checkType()")
|
||||||
<< "Invalid wall function specification" << nl
|
<< "Invalid wall function specification" << nl
|
||||||
<< " Patch type for patch " << patch().name()
|
<< " Patch type for patch " << patch().name()
|
||||||
<< " must be wall" << nl
|
<< " must be wall" << nl
|
||||||
|
@ -62,7 +62,7 @@ scalar mutWallFunctionFvPatchScalarField::calcYPlusLam
|
||||||
{
|
{
|
||||||
scalar ypl = 11.0;
|
scalar ypl = 11.0;
|
||||||
|
|
||||||
for (int i=0; i<10; i++)
|
for (label i = 0; i < 10; ++i)
|
||||||
{
|
{
|
||||||
ypl = log(E*ypl)/kappa;
|
ypl = log(E*ypl)/kappa;
|
||||||
}
|
}
|
||||||
|
@ -71,38 +71,6 @@ scalar mutWallFunctionFvPatchScalarField::calcYPlusLam
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField> mutWallFunctionFvPatchScalarField::calcMut() const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
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);
|
|
||||||
|
|
||||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
|
||||||
scalarField& mutw = tmutw();
|
|
||||||
|
|
||||||
forAll(mutw, faceI)
|
|
||||||
{
|
|
||||||
label faceCellI = patch().faceCells()[faceI];
|
|
||||||
|
|
||||||
scalar yPlus =
|
|
||||||
Cmu25*y[faceI]*sqrt(k[faceCellI])/(muw[faceI]/rhow[faceI]);
|
|
||||||
|
|
||||||
if (yPlus > yPlusLam_)
|
|
||||||
{
|
|
||||||
mutw[faceI] = muw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmutw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
void mutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||||
{
|
{
|
||||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||||
|
@ -124,7 +92,26 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
kappa_(0.41),
|
kappa_(0.41),
|
||||||
E_(9.8),
|
E_(9.8),
|
||||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||||
{}
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF, dict),
|
||||||
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
|
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||||
|
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||||
|
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||||
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
|
@ -140,22 +127,9 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
kappa_(ptf.kappa_),
|
kappa_(ptf.kappa_),
|
||||||
E_(ptf.E_),
|
E_(ptf.E_),
|
||||||
yPlusLam_(ptf.yPlusLam_)
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
{}
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchScalarField(p, iF, dict),
|
|
||||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
|
||||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
|
||||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
|
||||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
|
@ -168,7 +142,9 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
kappa_(wfpsf.kappa_),
|
kappa_(wfpsf.kappa_),
|
||||||
E_(wfpsf.E_),
|
E_(wfpsf.E_),
|
||||||
yPlusLam_(wfpsf.yPlusLam_)
|
yPlusLam_(wfpsf.yPlusLam_)
|
||||||
{}
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
|
@ -182,36 +158,26 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
|
||||||
kappa_(wfpsf.kappa_),
|
kappa_(wfpsf.kappa_),
|
||||||
E_(wfpsf.E_),
|
E_(wfpsf.E_),
|
||||||
yPlusLam_(wfpsf.yPlusLam_)
|
yPlusLam_(wfpsf.yPlusLam_)
|
||||||
{}
|
{
|
||||||
|
checkType();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void mutWallFunctionFvPatchScalarField::updateCoeffs()
|
void mutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||||
{
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
operator==(calcMut());
|
operator==(calcMut());
|
||||||
|
|
||||||
fixedValueFvPatchScalarField::updateCoeffs();
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fvPatchField<scalar>::write(os);
|
fvPatchField<scalar>::write(os);
|
||||||
|
@ -220,10 +186,6 @@ void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makePatchTypeField(fvPatchScalarField, mutWallFunctionFvPatchScalarField);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace RASModels
|
} // End namespace RASModels
|
||||||
|
|
|
@ -25,8 +25,8 @@ Class
|
||||||
Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField
|
Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Boundary condition for turbulent (kinematic) viscosity when using wall
|
Abstract base class for boundary condition for turbulent (dynamic)
|
||||||
functions
|
viscosity when using wall functions
|
||||||
- replicates OpenFOAM v1.5 (and earlier) behaviour
|
- replicates OpenFOAM v1.5 (and earlier) behaviour
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
@ -73,7 +73,7 @@ protected:
|
||||||
scalar yPlusLam_;
|
scalar yPlusLam_;
|
||||||
|
|
||||||
|
|
||||||
// Protected member functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Check the type of the patch
|
//- Check the type of the patch
|
||||||
virtual void checkType();
|
virtual void checkType();
|
||||||
|
@ -82,7 +82,7 @@ protected:
|
||||||
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
||||||
|
|
||||||
//- Calculate the turbulence viscosity
|
//- Calculate the turbulence viscosity
|
||||||
virtual tmp<scalarField> calcMut() const;
|
virtual tmp<scalarField> calcMut() const = 0;
|
||||||
|
|
||||||
//- Write local wall function variables
|
//- Write local wall function variables
|
||||||
virtual void writeLocalEntries(Ostream&) const;
|
virtual void writeLocalEntries(Ostream&) const;
|
||||||
|
@ -128,15 +128,6 @@ public:
|
||||||
const mutWallFunctionFvPatchScalarField&
|
const mutWallFunctionFvPatchScalarField&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
|
||||||
virtual tmp<fvPatchScalarField> clone() const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchScalarField>
|
|
||||||
(
|
|
||||||
new mutWallFunctionFvPatchScalarField(*this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
mutWallFunctionFvPatchScalarField
|
mutWallFunctionFvPatchScalarField
|
||||||
(
|
(
|
||||||
|
@ -144,25 +135,13 @@ public:
|
||||||
const DimensionedField<scalar, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone setting internal field reference
|
|
||||||
virtual tmp<fvPatchScalarField> clone
|
|
||||||
(
|
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return tmp<fvPatchScalarField>
|
|
||||||
(
|
|
||||||
new mutWallFunctionFvPatchScalarField(*this, iF)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
//- Calculate and return the yPlus at the boundary
|
//- Calculate and return the yPlus at the boundary
|
||||||
virtual tmp<scalarField> yPlus() const;
|
virtual tmp<scalarField> yPlus() const = 0;
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
virtual void updateCoeffs();
|
virtual void updateCoeffs();
|
||||||
|
|
Reference in a new issue