Refactored nutMEWTWallFunction according to the new interface
This commit is contained in:
parent
a598804c79
commit
5c16db8055
2 changed files with 60 additions and 171 deletions
|
@ -51,48 +51,19 @@ namespace RASModels
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void nutMEWTWallFunctionFvPatchScalarField::checkType()
|
|
||||||
{
|
|
||||||
if (!patch().isWall())
|
|
||||||
{
|
|
||||||
FatalErrorIn("nutMEWTWallFunctionFvPatchScalarField::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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
scalar nutMEWTWallFunctionFvPatchScalarField::calcYPlusLam
|
|
||||||
(
|
|
||||||
const scalar kappa,
|
|
||||||
const scalar E
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
scalar ypl = 11.0;
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
ypl = log(E*ypl)/kappa;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ypl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
|
tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
|
||||||
{
|
{
|
||||||
const label patchI = patch().index();
|
const label patchI = patch().index();
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const turbulenceModel& turbModel =
|
||||||
const scalarField& y = rasModel.y()[patchI];
|
db().lookupObject<turbulenceModel>("turbulenceModel");
|
||||||
const tmp<volScalarField> tk = rasModel.k();
|
|
||||||
const volScalarField& k = tk();
|
|
||||||
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
|
|
||||||
|
|
||||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
const scalarField& y = turbModel.y()[patchI];
|
||||||
|
const tmp<volScalarField> tk = turbModel.k();
|
||||||
|
const volScalarField& k = tk();
|
||||||
|
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalar Cmu25 = pow025(Cmu_);
|
||||||
|
|
||||||
// Get normals
|
// Get normals
|
||||||
const vectorField n = patch().nf();
|
const vectorField n = patch().nf();
|
||||||
|
@ -141,8 +112,15 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Field pressureGradient not found. Neglecting pressure gradient "
|
InfoIn
|
||||||
|
(
|
||||||
|
"tmp<scalarField>"
|
||||||
|
"nutCWTWallFunctionFvPatchScalarField::calcNut() const"
|
||||||
|
) << "Field pressureGradient not found. Neglecting pressure gradient "
|
||||||
<< "effects for wall functions at patch: " << patch().name()
|
<< "effects for wall functions at patch: " << patch().name()
|
||||||
|
<< nl
|
||||||
|
<< "If you would like to include pressure gradient effects, set up"
|
||||||
|
<< " pressureGradient function object."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,8 +153,15 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Field velocityConvection not found. Neglecting convection "
|
InfoIn
|
||||||
|
(
|
||||||
|
"tmp<scalarField>"
|
||||||
|
"nutCWTWallFunctionFvPatchScalarField::calcNut() const"
|
||||||
|
) << "Field velocityConvection not found. Neglecting convection "
|
||||||
<< "effects for wall functions at patch: " << patch().name()
|
<< "effects for wall functions at patch: " << patch().name()
|
||||||
|
<< nl
|
||||||
|
<< "If you would like to include convection effects, set up"
|
||||||
|
<< " velocityConvection function object."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,12 +239,11 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
|
||||||
|
|
||||||
void nutMEWTWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
void nutMEWTWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
nutkWallFunctionFvPatchScalarField::writeLocalEntries(os);
|
||||||
|
|
||||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||||
writeEntryIfDifferent<word>(os, "p", "p", pName_);
|
writeEntryIfDifferent<word>(os, "p", "p", pName_);
|
||||||
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
|
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
|
||||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,17 +255,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(p, iF),
|
nutkWallFunctionFvPatchScalarField(p, iF),
|
||||||
UName_("U"),
|
UName_("U"),
|
||||||
pName_("p"),
|
pName_("p"),
|
||||||
nutName_("nut"),
|
nutName_("nut")
|
||||||
Cmu_(0.09),
|
{}
|
||||||
kappa_(0.41),
|
|
||||||
E_(9.8),
|
|
||||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
|
@ -291,17 +269,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(p, iF, dict),
|
nutkWallFunctionFvPatchScalarField(p, iF, dict),
|
||||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||||
pName_(dict.lookupOrDefault<word>("p", "p")),
|
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||||
nutName_(dict.lookupOrDefault<word>("nut", "nut")),
|
nutName_(dict.lookupOrDefault<word>("nut", "nut"))
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
|
@ -312,17 +284,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
UName_(ptf.UName_),
|
UName_(ptf.UName_),
|
||||||
pName_(ptf.pName_),
|
pName_(ptf.pName_),
|
||||||
nutName_(ptf.nutName_),
|
nutName_(ptf.nutName_)
|
||||||
Cmu_(ptf.Cmu_),
|
{}
|
||||||
kappa_(ptf.kappa_),
|
|
||||||
E_(ptf.E_),
|
|
||||||
yPlusLam_(ptf.yPlusLam_)
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
|
@ -330,17 +296,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
const nutMEWTWallFunctionFvPatchScalarField& wfpsf
|
const nutMEWTWallFunctionFvPatchScalarField& wfpsf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(wfpsf),
|
nutkWallFunctionFvPatchScalarField(wfpsf),
|
||||||
UName_(wfpsf.UName_),
|
UName_(wfpsf.UName_),
|
||||||
pName_(wfpsf.pName_),
|
pName_(wfpsf.pName_),
|
||||||
nutName_(wfpsf.nutName_),
|
nutName_(wfpsf.nutName_)
|
||||||
Cmu_(wfpsf.Cmu_),
|
{}
|
||||||
kappa_(wfpsf.kappa_),
|
|
||||||
E_(wfpsf.E_),
|
|
||||||
yPlusLam_(wfpsf.yPlusLam_)
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
|
@ -349,51 +309,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(wfpsf, iF),
|
nutkWallFunctionFvPatchScalarField(wfpsf, iF),
|
||||||
UName_(wfpsf.UName_),
|
UName_(wfpsf.UName_),
|
||||||
pName_(wfpsf.pName_),
|
pName_(wfpsf.pName_),
|
||||||
nutName_(wfpsf.nutName_),
|
nutName_(wfpsf.nutName_)
|
||||||
Cmu_(wfpsf.Cmu_),
|
{}
|
||||||
kappa_(wfpsf.kappa_),
|
|
||||||
E_(wfpsf.E_),
|
|
||||||
yPlusLam_(wfpsf.yPlusLam_)
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void nutMEWTWallFunctionFvPatchScalarField::updateCoeffs()
|
|
||||||
{
|
|
||||||
operator==(calcNut());
|
|
||||||
|
|
||||||
fixedValueFvPatchScalarField::updateCoeffs();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::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& nuw = rasModel.nu().boundaryField()[patchI];
|
|
||||||
|
|
||||||
return pow(Cmu_, 0.25)*y*sqrt(kwc)/nuw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void nutMEWTWallFunctionFvPatchScalarField::write(Ostream& os) const
|
|
||||||
{
|
|
||||||
fvPatchField<scalar>::write(os);
|
|
||||||
writeLocalEntries(os);
|
|
||||||
writeEntry("value", os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
|
@ -39,6 +39,18 @@ Description
|
||||||
year = {2017},
|
year = {2017},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Usage
|
||||||
|
Example of the boundary condition specification:
|
||||||
|
\verbatim
|
||||||
|
<patchName>
|
||||||
|
{
|
||||||
|
type nutCWTWallFunction;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::nutkWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
nutMEWTWallFunctionFvPatchScalarField.C
|
nutMEWTWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
@ -50,7 +62,7 @@ Author
|
||||||
#ifndef nutMEWTWallFunctionFvPatchScalarField_H
|
#ifndef nutMEWTWallFunctionFvPatchScalarField_H
|
||||||
#define nutMEWTWallFunctionFvPatchScalarField_H
|
#define nutMEWTWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "nutkWallFunctionFvPatchScalarField.H"
|
||||||
#include "tolerancesSwitch.H"
|
#include "tolerancesSwitch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
@ -68,19 +80,13 @@ namespace RASModels
|
||||||
|
|
||||||
class nutMEWTWallFunctionFvPatchScalarField
|
class nutMEWTWallFunctionFvPatchScalarField
|
||||||
:
|
:
|
||||||
public fixedValueFvPatchScalarField
|
public nutkWallFunctionFvPatchScalarField
|
||||||
{
|
{
|
||||||
|
// Private Data Members
|
||||||
|
|
||||||
// Private static data member
|
//- Static tolerance for the A dimensionless parameter
|
||||||
|
|
||||||
//- Tolerance for the A dimensionless parameter
|
|
||||||
static const debug::tolerancesSwitch dimlessAFactorTol_;
|
static const debug::tolerancesSwitch dimlessAFactorTol_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Name of velocity field
|
//- Name of velocity field
|
||||||
word UName_;
|
word UName_;
|
||||||
|
|
||||||
|
@ -90,29 +96,10 @@ protected:
|
||||||
//- Name of eddy viscosity field
|
//- Name of eddy viscosity field
|
||||||
word nutName_;
|
word nutName_;
|
||||||
|
|
||||||
//- Name of omega field
|
|
||||||
word omegaName_;
|
|
||||||
|
|
||||||
//- Cmu coefficient
|
protected:
|
||||||
scalar Cmu_;
|
|
||||||
|
|
||||||
//- Von Karman constant
|
// Protected Member Functions
|
||||||
scalar kappa_;
|
|
||||||
|
|
||||||
//- E coefficient
|
|
||||||
scalar E_;
|
|
||||||
|
|
||||||
//- Y+ at the edge of the laminar sublayer
|
|
||||||
scalar yPlusLam_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected member functions
|
|
||||||
|
|
||||||
//- Check the type of the patch
|
|
||||||
virtual void checkType();
|
|
||||||
|
|
||||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
|
||||||
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
|
||||||
|
|
||||||
//- Calculate the turbulence viscosity
|
//- Calculate the turbulence viscosity
|
||||||
virtual tmp<scalarField> calcNut() const;
|
virtual tmp<scalarField> calcNut() const;
|
||||||
|
@ -144,8 +131,7 @@ public:
|
||||||
const dictionary&
|
const dictionary&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by mapping given
|
//- Construct by mapping given nutMEWTWallFunctionFvPatchScalarField
|
||||||
// nutMEWTWallFunctionFvPatchScalarField
|
|
||||||
// onto a new patch
|
// onto a new patch
|
||||||
nutMEWTWallFunctionFvPatchScalarField
|
nutMEWTWallFunctionFvPatchScalarField
|
||||||
(
|
(
|
||||||
|
@ -188,23 +174,6 @@ public:
|
||||||
new nutMEWTWallFunctionFvPatchScalarField(*this, iF)
|
new nutMEWTWallFunctionFvPatchScalarField(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
// 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();
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write(Ostream&) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue