mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
nutWallFunctions: Changed base class of nutkWallFunctions to nutWallFunctions and other improvements
This commit is contained in:
@ -106,11 +106,12 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label patchI = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const turbulenceModel& turbModel =
|
||||||
|
db().lookupObject<turbulenceModel>("turbulenceModel");
|
||||||
|
|
||||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||||
|
|
||||||
const vectorField Ui(Uw.patchInternalField());
|
const vectorField Ui(Uw.patchInternalField());
|
||||||
|
|
||||||
@ -118,9 +119,9 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
|
|||||||
|
|
||||||
const scalarField& ry = patch().deltaCoeffs();
|
const scalarField& ry = patch().deltaCoeffs();
|
||||||
|
|
||||||
tmp<volScalarField> tnuEff = rasModel.nuEff();
|
tmp<volScalarField> tnuEff = turbModel.nuEff();
|
||||||
const volScalarField& nuEff = tnuEff();
|
const volScalarField& nuEff = tnuEff();
|
||||||
const scalarField& nuEffw = nuEff.boundaryField()[patchI];
|
const scalarField& nuEffw = nuEff.boundaryField()[patchi];
|
||||||
|
|
||||||
tmp<vectorField> UwUpdated =
|
tmp<vectorField> UwUpdated =
|
||||||
tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));
|
tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));
|
||||||
@ -130,8 +131,8 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
tmp<vectorField> nHat = this->patch().nf();
|
tmp<vectorField> nHat = this->patch().nf();
|
||||||
volSymmTensorField Reff(rasModel.devReff());
|
volSymmTensorField Reff(turbModel.devReff());
|
||||||
Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl;
|
Info << "tau : " << (nHat & Reff.boundaryField()[patchi])() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedValueFvPatchVectorField::updateCoeffs();
|
fixedValueFvPatchVectorField::updateCoeffs();
|
||||||
|
|||||||
@ -201,21 +201,22 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label patchI = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
// Retrieve turbulence properties from model
|
// Retrieve turbulence properties from model
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const turbulenceModel& turbModel =
|
||||||
|
db().lookupObject<turbulenceModel>("turbulenceModel");
|
||||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||||
const scalarField& y = rasModel.y()[patchI];
|
const scalarField& y = turbModel.y()[patchi];
|
||||||
const tmp<volScalarField> tnu = rasModel.nu();
|
const tmp<volScalarField> tnu = turbModel.nu();
|
||||||
const volScalarField& nu = tnu();
|
const volScalarField& nu = tnu();
|
||||||
const scalarField& nuw = nu.boundaryField()[patchI];
|
const scalarField& nuw = nu.boundaryField()[patchi];
|
||||||
const tmp<volScalarField> tk = rasModel.k();
|
const tmp<volScalarField> tk = turbModel.k();
|
||||||
const volScalarField& k = tk();
|
const volScalarField& k = tk();
|
||||||
|
|
||||||
// Molecular Prandtl number
|
// Molecular Prandtl number
|
||||||
const scalar
|
const scalar
|
||||||
Pr(dimensionedScalar(rasModel.transport().lookup("Pr")).value());
|
Pr(dimensionedScalar(turbModel.transport().lookup("Pr")).value());
|
||||||
|
|
||||||
// Populate boundary values
|
// Populate boundary values
|
||||||
scalarField& kappatw = *this;
|
scalarField& kappatw = *this;
|
||||||
|
|||||||
@ -39,6 +39,11 @@ namespace incompressible
|
|||||||
namespace RASModels
|
namespace RASModels
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void nutWallFunctionFvPatchScalarField::checkType()
|
void nutWallFunctionFvPatchScalarField::checkType()
|
||||||
|
|||||||
@ -41,20 +41,6 @@ namespace RASModels
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void nutkWallFunctionFvPatchScalarField::checkType()
|
|
||||||
{
|
|
||||||
if (!isA<wallFvPatch>(patch()))
|
|
||||||
{
|
|
||||||
FatalErrorIn("nutkWallFunctionFvPatchScalarField::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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
|
tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
|
||||||
{
|
{
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
@ -89,14 +75,6 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nutkWallFunctionFvPatchScalarField::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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||||
@ -105,14 +83,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
|||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(p, iF),
|
nutWallFunctionFvPatchScalarField(p, iF)
|
||||||
Cmu_(0.09),
|
{}
|
||||||
kappa_(0.41),
|
|
||||||
E_(9.8),
|
|
||||||
yPlusLam_(yPlusLam(kappa_, E_))
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||||
@ -123,14 +95,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
Cmu_(ptf.Cmu_),
|
{}
|
||||||
kappa_(ptf.kappa_),
|
|
||||||
E_(ptf.E_),
|
|
||||||
yPlusLam_(ptf.yPlusLam_)
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||||
@ -140,14 +106,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(p, iF, dict),
|
nutWallFunctionFvPatchScalarField(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_(yPlusLam(kappa_, E_))
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||||
@ -155,14 +115,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
|||||||
const nutkWallFunctionFvPatchScalarField& wfpsf
|
const nutkWallFunctionFvPatchScalarField& wfpsf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(wfpsf),
|
nutWallFunctionFvPatchScalarField(wfpsf)
|
||||||
Cmu_(wfpsf.Cmu_),
|
{}
|
||||||
kappa_(wfpsf.kappa_),
|
|
||||||
E_(wfpsf.E_),
|
|
||||||
yPlusLam_(wfpsf.yPlusLam_)
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||||
@ -171,48 +125,12 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
|||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(wfpsf, iF),
|
nutWallFunctionFvPatchScalarField(wfpsf, iF)
|
||||||
Cmu_(wfpsf.Cmu_),
|
{}
|
||||||
kappa_(wfpsf.kappa_),
|
|
||||||
E_(wfpsf.E_),
|
|
||||||
yPlusLam_(wfpsf.yPlusLam_)
|
|
||||||
{
|
|
||||||
checkType();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
scalar nutkWallFunctionFvPatchScalarField::yPlusLam
|
|
||||||
(
|
|
||||||
const scalar kappa,
|
|
||||||
const scalar E
|
|
||||||
)
|
|
||||||
{
|
|
||||||
scalar ypl = 11.0;
|
|
||||||
|
|
||||||
for (int i=0; i<10; i++)
|
|
||||||
{
|
|
||||||
ypl = log(max(E*ypl, 1))/kappa;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ypl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void nutkWallFunctionFvPatchScalarField::updateCoeffs()
|
|
||||||
{
|
|
||||||
if (updated())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator==(calcNut());
|
|
||||||
|
|
||||||
fixedValueFvPatchScalarField::updateCoeffs();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
|
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
|
||||||
{
|
{
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
@ -232,14 +150,6 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nutkWallFunctionFvPatchScalarField::write(Ostream& os) const
|
|
||||||
{
|
|
||||||
fvPatchField<scalar>::write(os);
|
|
||||||
writeLocalEntries(os);
|
|
||||||
writeEntry("value", os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
|
|||||||
@ -37,7 +37,7 @@ SourceFiles
|
|||||||
#ifndef nutkWallFunctionFvPatchScalarField_H
|
#ifndef nutkWallFunctionFvPatchScalarField_H
|
||||||
#define nutkWallFunctionFvPatchScalarField_H
|
#define nutkWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "nutWallFunctionFvPatchScalarField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,36 +54,15 @@ namespace RASModels
|
|||||||
|
|
||||||
class nutkWallFunctionFvPatchScalarField
|
class nutkWallFunctionFvPatchScalarField
|
||||||
:
|
:
|
||||||
public fixedValueFvPatchScalarField
|
public nutWallFunctionFvPatchScalarField
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Cmu coefficient
|
|
||||||
scalar Cmu_;
|
|
||||||
|
|
||||||
//- Von Karman constant
|
|
||||||
scalar kappa_;
|
|
||||||
|
|
||||||
//- E coefficient
|
|
||||||
scalar E_;
|
|
||||||
|
|
||||||
//- Y+ at the edge of the laminar sublayer
|
|
||||||
scalar yPlusLam_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Check the type of the patch
|
|
||||||
virtual void checkType();
|
|
||||||
|
|
||||||
//- 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:
|
||||||
|
|
||||||
@ -156,23 +135,8 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
//- Calculate and return the yPlus at the boundary
|
||||||
static scalar yPlusLam(const scalar kappa, const scalar E);
|
virtual tmp<scalarField> yPlus() const;
|
||||||
|
|
||||||
|
|
||||||
// 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 New Issue
Block a user