Skip to content
Snippets Groups Projects
Commit 98df99b2 authored by Henry's avatar Henry
Browse files

nutWallFunctions: Changed base class of nutkWallFunctions to nutWallFunctions...

nutWallFunctions: Changed base class of nutkWallFunctions to nutWallFunctions and other improvements
parent e36f6bf7
Branches
Tags
No related merge requests found
......@@ -106,11 +106,12 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
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());
......@@ -118,9 +119,9 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
const scalarField& ry = patch().deltaCoeffs();
tmp<volScalarField> tnuEff = rasModel.nuEff();
tmp<volScalarField> tnuEff = turbModel.nuEff();
const volScalarField& nuEff = tnuEff();
const scalarField& nuEffw = nuEff.boundaryField()[patchI];
const scalarField& nuEffw = nuEff.boundaryField()[patchi];
tmp<vectorField> UwUpdated =
tauHat*(tauHat & (tau0_*(1.0/(ry*nuEffw)) + Ui));
......@@ -130,8 +131,8 @@ void fixedShearStressFvPatchVectorField::updateCoeffs()
if (debug)
{
tmp<vectorField> nHat = this->patch().nf();
volSymmTensorField Reff(rasModel.devReff());
Info << "tau : " << (nHat & Reff.boundaryField()[patchI])() << endl;
volSymmTensorField Reff(turbModel.devReff());
Info << "tau : " << (nHat & Reff.boundaryField()[patchi])() << endl;
}
fixedValueFvPatchVectorField::updateCoeffs();
......
......@@ -201,21 +201,22 @@ void kappatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
return;
}
const label patchI = patch().index();
const label patchi = patch().index();
// 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 scalarField& y = rasModel.y()[patchI];
const tmp<volScalarField> tnu = rasModel.nu();
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const scalarField& nuw = nu.boundaryField()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
// Molecular Prandtl number
const scalar
Pr(dimensionedScalar(rasModel.transport().lookup("Pr")).value());
Pr(dimensionedScalar(turbModel.transport().lookup("Pr")).value());
// Populate boundary values
scalarField& kappatw = *this;
......
......@@ -39,6 +39,11 @@ namespace incompressible
namespace RASModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::checkType()
......
......@@ -41,20 +41,6 @@ namespace RASModels
// * * * * * * * * * * * * 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
{
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 * * * * * * * * * * * * * * //
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
......@@ -105,14 +83,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(yPlusLam(kappa_, E_))
{
checkType();
}
nutWallFunctionFvPatchScalarField(p, iF)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
......@@ -123,14 +95,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
}
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
......@@ -140,14 +106,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
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_(yPlusLam(kappa_, E_))
{
checkType();
}
nutWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
......@@ -155,14 +115,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
const nutkWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
nutWallFunctionFvPatchScalarField(wfpsf)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
......@@ -171,48 +125,12 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
nutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
// * * * * * * * * * * * * * * * 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
{
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
......
......@@ -37,7 +37,7 @@ SourceFiles
#ifndef nutkWallFunctionFvPatchScalarField_H
#define nutkWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -54,36 +54,15 @@ namespace RASModels
class nutkWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
public nutWallFunctionFvPatchScalarField
{
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
//- Check the type of the patch
virtual void checkType();
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
......@@ -156,23 +135,8 @@ public:
// Member functions
//- Calculate the Y+ at the edge of the laminar sublayer
static scalar yPlusLam(const scalar kappa, const scalar E);
// 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;
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment