Refactored remaining Spalart Allmaras mut wall functions
1. mutSpalartAllmarasStandardWallFunction: same as mutUWallFunction 2. mutSpalartAllmarasStandardRoughWallFunction: same as mutURoughWallFunction 3. mutSpalartAllmarasWallFunction: refactored such that it derives from mutWallFunction
This commit is contained in:
parent
6681c7e1ee
commit
da6f48e599
6 changed files with 96 additions and 504 deletions
|
@ -23,6 +23,9 @@ $(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
|
||||||
$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C
|
$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C
|
||||||
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
|
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
|
||||||
$(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C
|
$(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C
|
||||||
|
$(mutWallFunctions)/mutSpalartAllmarasStandardWallFunction/mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||||
|
$(mutWallFunctions)/mutSpalartAllmarasStandardRoughWallFunction/mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
|
||||||
|
$(mutWallFunctions)/mutSpalartAllmarasWallFunction/mutSpalartAllmarasWallFunctionFvPatchScalarField.C
|
||||||
|
|
||||||
|
|
||||||
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
||||||
|
|
|
@ -38,171 +38,6 @@ namespace compressible
|
||||||
namespace RASModels
|
namespace RASModels
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcYPlus
|
|
||||||
(
|
|
||||||
const scalarField& magUp
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const scalarField& y = rasModel.y()[patchI];
|
|
||||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
|
||||||
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
|
|
||||||
|
|
||||||
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
|
|
||||||
scalarField& yPlus = tyPlus();
|
|
||||||
|
|
||||||
if (roughnessHeight_ > 0.0)
|
|
||||||
{
|
|
||||||
// Rough Walls
|
|
||||||
const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_;
|
|
||||||
static const scalar c_2 = 2.25/(90 - 2.25);
|
|
||||||
static const scalar c_3 = 2.0*atan(1.0)/log(90/2.25);
|
|
||||||
static const scalar c_4 = c_3*log(2.25);
|
|
||||||
|
|
||||||
//if (KsPlusBasedOnYPlus_)
|
|
||||||
{
|
|
||||||
// If KsPlus is based on YPlus the extra term added to the law
|
|
||||||
// of the wall will depend on yPlus
|
|
||||||
forAll(yPlus, facei)
|
|
||||||
{
|
|
||||||
const scalar magUpara = magUp[facei];
|
|
||||||
const scalar Re = rho[facei]*magUpara*y[facei]/muw[facei];
|
|
||||||
const scalar kappaRe = kappa_*Re;
|
|
||||||
|
|
||||||
scalar yp = yPlusLam_;
|
|
||||||
const scalar ryPlusLam = 1.0/yp;
|
|
||||||
|
|
||||||
int iter = 0;
|
|
||||||
scalar yPlusLast = 0.0;
|
|
||||||
scalar dKsPlusdYPlus = roughnessHeight_/y[facei];
|
|
||||||
|
|
||||||
// Enforce the roughnessHeight to be less than the distance to
|
|
||||||
// the first cell centre.
|
|
||||||
if (dKsPlusdYPlus > 1)
|
|
||||||
{
|
|
||||||
dKsPlusdYPlus = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Additional tuning parameter (fudge factor) - nominally = 1
|
|
||||||
dKsPlusdYPlus *= roughnessFudgeFactor_;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
yPlusLast = yp;
|
|
||||||
|
|
||||||
// The non-dimensional roughness height
|
|
||||||
scalar KsPlus = yp*dKsPlusdYPlus;
|
|
||||||
|
|
||||||
// The extra term in the law-of-the-wall
|
|
||||||
scalar G = 0.0;
|
|
||||||
|
|
||||||
scalar yPlusGPrime = 0.0;
|
|
||||||
|
|
||||||
if (KsPlus >= 90)
|
|
||||||
{
|
|
||||||
const scalar t_1 = 1 + roughnessConstant_*KsPlus;
|
|
||||||
G = log(t_1);
|
|
||||||
yPlusGPrime = roughnessConstant_*KsPlus/t_1;
|
|
||||||
}
|
|
||||||
else if (KsPlus > 2.25)
|
|
||||||
{
|
|
||||||
const scalar t_1 = c_1*KsPlus - c_2;
|
|
||||||
const scalar t_2 = c_3*log(KsPlus) - c_4;
|
|
||||||
const scalar sint_2 = sin(t_2);
|
|
||||||
const scalar logt_1 = log(t_1);
|
|
||||||
G = logt_1*sint_2;
|
|
||||||
yPlusGPrime =
|
|
||||||
(c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*cos(t_2));
|
|
||||||
}
|
|
||||||
|
|
||||||
scalar denom = 1.0 + log(E_*yp) - G - yPlusGPrime;
|
|
||||||
if (mag(denom) > VSMALL)
|
|
||||||
{
|
|
||||||
yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
} while
|
|
||||||
(
|
|
||||||
mag(ryPlusLam*(yp - yPlusLast)) > 0.0001
|
|
||||||
&& ++iter < 10
|
|
||||||
&& yp > VSMALL
|
|
||||||
);
|
|
||||||
|
|
||||||
yPlus[facei] = max(0.0, yp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Smooth Walls
|
|
||||||
forAll(yPlus, facei)
|
|
||||||
{
|
|
||||||
const scalar magUpara = magUp[facei];
|
|
||||||
const scalar Re = rho[facei]*magUpara*y[facei]/muw[facei];
|
|
||||||
const scalar kappaRe = kappa_*Re;
|
|
||||||
|
|
||||||
scalar yp = yPlusLam_;
|
|
||||||
const scalar ryPlusLam = 1.0/yp;
|
|
||||||
|
|
||||||
int iter = 0;
|
|
||||||
scalar yPlusLast = 0.0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
yPlusLast = yp;
|
|
||||||
yp = (kappaRe + yp)/(1.0 + log(E_*yp));
|
|
||||||
|
|
||||||
} while
|
|
||||||
(
|
|
||||||
mag(ryPlusLam*(yp - yPlusLast)) > 0.0001
|
|
||||||
&& ++iter < 10
|
|
||||||
);
|
|
||||||
|
|
||||||
yPlus[facei] = max(0.0, yp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tyPlus;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcMut() const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const scalarField& y = rasModel.y()[patchI];
|
|
||||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
|
||||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
|
||||||
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
|
|
||||||
|
|
||||||
scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
|
||||||
|
|
||||||
tmp<scalarField> tyPlus = calcYPlus(magUp);
|
|
||||||
scalarField& yPlus = tyPlus();
|
|
||||||
|
|
||||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
|
||||||
scalarField& mutw = tmutw();
|
|
||||||
|
|
||||||
forAll(yPlus, facei)
|
|
||||||
{
|
|
||||||
if (yPlus[facei] > yPlusLam_)
|
|
||||||
{
|
|
||||||
const scalar Re = rho[facei]*magUp[facei]*y[facei]/muw[facei];
|
|
||||||
mutw[facei] = muw[facei]*(sqr(yPlus[facei])/Re - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmutw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||||
|
@ -212,10 +47,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(p, iF),
|
mutURoughWallFunctionFvPatchScalarField(p, iF)
|
||||||
roughnessHeight_(pTraits<scalar>::zero),
|
|
||||||
roughnessConstant_(pTraits<scalar>::zero),
|
|
||||||
roughnessFudgeFactor_(pTraits<scalar>::zero)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,10 +60,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
mutURoughWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
roughnessHeight_(ptf.roughnessHeight_),
|
|
||||||
roughnessConstant_(ptf.roughnessConstant_),
|
|
||||||
roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,10 +72,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(p, iF, dict),
|
mutURoughWallFunctionFvPatchScalarField(p, iF, dict)
|
||||||
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
|
|
||||||
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
|
|
||||||
roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor")))
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,10 +82,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& rwfpsf
|
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& rwfpsf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(rwfpsf),
|
mutURoughWallFunctionFvPatchScalarField(rwfpsf)
|
||||||
roughnessHeight_(rwfpsf.roughnessHeight_),
|
|
||||||
roughnessConstant_(rwfpsf.roughnessConstant_),
|
|
||||||
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,44 +93,10 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
|
mutURoughWallFunctionFvPatchScalarField(rwfpsf, iF)
|
||||||
roughnessHeight_(rwfpsf.roughnessHeight_),
|
|
||||||
roughnessConstant_(rwfpsf.roughnessConstant_),
|
|
||||||
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::yPlus() const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
|
||||||
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
|
||||||
|
|
||||||
return calcYPlus(magUp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
|
|
||||||
(
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
fixedValueFvPatchScalarField::write(os);
|
|
||||||
writeLocalEntries(os);
|
|
||||||
os.writeKeyword("roughnessHeight")
|
|
||||||
<< roughnessHeight_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("roughnessConstant")
|
|
||||||
<< roughnessConstant_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("roughnessFudgeFactor")
|
|
||||||
<< roughnessFudgeFactor_ << token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
|
|
|
@ -26,7 +26,9 @@ Class
|
||||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Wall function boundary condition for rough walls
|
This boundary condition is the same as mutURoughWallFunction. We will simply
|
||||||
|
derive from mutURoughWallFunctionFvPatchScalarField to enable backward
|
||||||
|
compatibility.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
mutSpalartAllamarasStandardWallFunctionFvPatchScalarField.C
|
mutSpalartAllamarasStandardWallFunctionFvPatchScalarField.C
|
||||||
|
@ -36,7 +38,7 @@ SourceFiles
|
||||||
#ifndef compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
#ifndef compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||||
#define compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
#define compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
#include "mutWallFunctionFvPatchScalarField.H"
|
#include "mutURoughWallFunctionFvPatchScalarField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -53,33 +55,8 @@ Class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration
|
||||||
|
|
||||||
class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||||
:
|
:
|
||||||
public mutWallFunctionFvPatchScalarField
|
public mutURoughWallFunctionFvPatchScalarField
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
// Roughness parameters
|
|
||||||
|
|
||||||
//- Height
|
|
||||||
scalar roughnessHeight_;
|
|
||||||
|
|
||||||
//- Constant
|
|
||||||
scalar roughnessConstant_;
|
|
||||||
|
|
||||||
//- Scale factor
|
|
||||||
scalar roughnessFudgeFactor_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected member functions
|
|
||||||
|
|
||||||
//- Calculate yPLus
|
|
||||||
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
|
|
||||||
|
|
||||||
//- Calculate the turbulence viscosity
|
|
||||||
virtual tmp<scalarField> calcMut() const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
@ -154,60 +131,6 @@ public:
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the roughness height scale
|
|
||||||
const scalar& roughnessHeight() const
|
|
||||||
{
|
|
||||||
return roughnessHeight_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return reference to the roughness height to allow adjustment
|
|
||||||
scalar& roughnessHeight()
|
|
||||||
{
|
|
||||||
return roughnessHeight_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the roughness constant scale
|
|
||||||
const scalar& roughnessConstant() const
|
|
||||||
{
|
|
||||||
return roughnessConstant_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return reference to the roughness constant to allow adjustment
|
|
||||||
scalar& roughnessConstant()
|
|
||||||
{
|
|
||||||
return roughnessConstant_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the roughness scale factor
|
|
||||||
const scalar& roughnessFudgeFactor() const
|
|
||||||
{
|
|
||||||
return roughnessFudgeFactor_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return reference to the roughness scale factor to allow
|
|
||||||
// adjustment
|
|
||||||
scalar& roughnessFudgeFactor()
|
|
||||||
{
|
|
||||||
return roughnessFudgeFactor_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
|
||||||
|
|
||||||
//- Calculate and return the yPlus at the boundary
|
|
||||||
virtual tmp<scalarField> yPlus() const;
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write(Ostream& os) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,77 +38,6 @@ namespace compressible
|
||||||
namespace RASModels
|
namespace RASModels
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcYPlus
|
|
||||||
(
|
|
||||||
const scalarField& magUp
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const scalarField& y = rasModel.y()[patchI];
|
|
||||||
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
|
||||||
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
|
|
||||||
|
|
||||||
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
|
|
||||||
scalarField& yPlus = tyPlus();
|
|
||||||
|
|
||||||
forAll(yPlus, faceI)
|
|
||||||
{
|
|
||||||
scalar kappaRe = kappa_*magUp[faceI]*y[faceI]/(muw[faceI]/rhow[faceI]);
|
|
||||||
|
|
||||||
scalar yp = yPlusLam_;
|
|
||||||
scalar ryPlusLam = 1.0/yp;
|
|
||||||
|
|
||||||
int iter = 0;
|
|
||||||
scalar yPlusLast = 0.0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
yPlusLast = yp;
|
|
||||||
yp = (kappaRe + yp)/(1.0 + log(E_*yp));
|
|
||||||
|
|
||||||
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10);
|
|
||||||
|
|
||||||
yPlus[faceI] = max(0.0, yp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tyPlus;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcMut() const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
|
||||||
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
|
||||||
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
|
|
||||||
|
|
||||||
tmp<scalarField> tyPlus = calcYPlus(magUp);
|
|
||||||
scalarField& yPlus = tyPlus();
|
|
||||||
|
|
||||||
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
|
|
||||||
scalarField& mutw = tmutw();
|
|
||||||
|
|
||||||
forAll(yPlus, faceI)
|
|
||||||
{
|
|
||||||
if (yPlus[faceI] > yPlusLam_)
|
|
||||||
{
|
|
||||||
mutw[faceI] =
|
|
||||||
muw[faceI]*(yPlus[faceI]*kappa_/log(E_*yPlus[faceI]) - 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmutw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
@ -118,7 +47,19 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(p, iF)
|
mutUWallFunctionFvPatchScalarField(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||||
|
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mutUWallFunctionFvPatchScalarField(p, iF, dict)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,19 +72,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
mutUWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
mutWallFunctionFvPatchScalarField(p, iF, dict)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,7 +82,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf
|
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(sawfpsf)
|
mutUWallFunctionFvPatchScalarField(sawfpsf)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,37 +93,10 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mutWallFunctionFvPatchScalarField(sawfpsf, iF)
|
mutUWallFunctionFvPatchScalarField(sawfpsf, iF)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::yPlus() const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
|
||||||
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
|
||||||
|
|
||||||
return calcYPlus(magUp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
|
|
||||||
(
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
fvPatchField<scalar>::write(os);
|
|
||||||
writeLocalEntries(os);
|
|
||||||
writeEntry("value", os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
(
|
(
|
||||||
fvPatchScalarField,
|
fvPatchScalarField,
|
||||||
|
|
|
@ -26,7 +26,9 @@ Class
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Wall function boundary condition for walls
|
This boundary condition is the same as mutUWallFunction. We will simply
|
||||||
|
derive from nutUWallFunctionFvPatchScalarField to enable backward
|
||||||
|
compatibility.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||||
|
@ -36,7 +38,7 @@ SourceFiles
|
||||||
#ifndef compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
#ifndef compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||||
#define compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
#define compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
#include "mutWallFunctionFvPatchScalarField.H"
|
#include "mutUWallFunctionFvPatchScalarField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -53,19 +55,8 @@ namespace RASModels
|
||||||
|
|
||||||
class mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
class mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||||
:
|
:
|
||||||
public mutWallFunctionFvPatchScalarField
|
public mutUWallFunctionFvPatchScalarField
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected member functions
|
|
||||||
|
|
||||||
//- Calculate yPLus
|
|
||||||
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
|
|
||||||
|
|
||||||
//- Calculate the turbulence viscosity
|
|
||||||
virtual tmp<scalarField> calcMut() const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
@ -140,20 +131,6 @@ public:
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
// Evaluation functions
|
|
||||||
|
|
||||||
//- Calculate and return the yPlus at the boundary
|
|
||||||
virtual tmp<scalarField> yPlus() const;
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write(Ostream& os) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,24 +40,46 @@ namespace RASModels
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tmp<scalarField>
|
||||||
|
mutSpalartAllmarasWallFunctionFvPatchScalarField::calcMut() const
|
||||||
|
{
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
|
const turbulenceModel& turbModel =
|
||||||
|
db().lookupObject<turbulenceModel>("turbulenceModel");
|
||||||
|
|
||||||
|
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
|
||||||
|
const scalarField magGradU = mag(Uw.snGrad());
|
||||||
|
const scalarField& rhow = turbModel.rho().boundaryField()[patchI];
|
||||||
|
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
|
||||||
|
|
||||||
|
return max
|
||||||
|
(
|
||||||
|
0.0,
|
||||||
|
rhow*sqr(calcUTau(magGradU))/(magGradU + ROOTVSMALL) - muw
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
|
tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
|
||||||
(
|
(
|
||||||
const scalarField& magGradU
|
const scalarField& magGradU
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const label patchI = patch().index();
|
||||||
const scalarField& y = rasModel.y()[patch().index()];
|
|
||||||
|
const turbulenceModel& turbModel =
|
||||||
|
db().lookupObject<turbulenceModel>("turbulenceModel");
|
||||||
|
|
||||||
|
const scalarField& y = turbModel.y()[patchI];
|
||||||
|
|
||||||
const fvPatchVectorField& Uw =
|
const fvPatchVectorField& Uw =
|
||||||
rasModel.U().boundaryField()[patch().index()];
|
turbModel.U().boundaryField()[patchI];
|
||||||
|
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
||||||
|
|
||||||
scalarField magUp = mag(Uw.patchInternalField() - Uw);
|
const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchI];
|
||||||
|
|
||||||
const fvPatchScalarField& rhow =
|
const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchI];
|
||||||
rasModel.rho().boundaryField()[patch().index()];
|
|
||||||
|
|
||||||
const fvPatchScalarField& muw =
|
|
||||||
rasModel.mu().boundaryField()[patch().index()];
|
|
||||||
const scalarField& mutw = *this;
|
const scalarField& mutw = *this;
|
||||||
|
|
||||||
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
|
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
|
||||||
|
@ -65,32 +87,32 @@ tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
|
||||||
|
|
||||||
forAll(mutw, faceI)
|
forAll(mutw, faceI)
|
||||||
{
|
{
|
||||||
scalar magUpara = magUp[faceI];
|
const scalar& magUpara = magUp[faceI];
|
||||||
|
|
||||||
scalar ut =
|
scalar ut =
|
||||||
sqrt((mutw[faceI] + muw[faceI])*magGradU[faceI]/rhow[faceI]);
|
sqrt((mutw[faceI] + muw[faceI])*magGradU[faceI]/rhow[faceI]);
|
||||||
|
|
||||||
if (ut > VSMALL)
|
if (ut > VSMALL)
|
||||||
{
|
{
|
||||||
int iter = 0;
|
label iter = 0;
|
||||||
scalar err = GREAT;
|
scalar err = GREAT;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
scalar kUu = min(kappa_*magUpara/ut, 50);
|
const scalar kUu = min(kappa_*magUpara/ut, 50);
|
||||||
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
|
const scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
|
||||||
|
|
||||||
scalar f =
|
const scalar f =
|
||||||
- ut*y[faceI]/(muw[faceI]/rhow[faceI])
|
- ut*y[faceI]/(muw[faceI]/rhow[faceI])
|
||||||
+ magUpara/ut
|
+ magUpara/ut
|
||||||
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
|
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
|
||||||
|
|
||||||
scalar df =
|
const scalar df =
|
||||||
y[faceI]/(muw[faceI]/rhow[faceI])
|
y[faceI]/(muw[faceI]/rhow[faceI])
|
||||||
+ magUpara/sqr(ut)
|
+ magUpara/sqr(ut)
|
||||||
+ 1/E_*kUu*fkUu/ut;
|
+ 1/E_*kUu*fkUu/ut;
|
||||||
|
|
||||||
scalar uTauNew = ut + f/df;
|
const scalar uTauNew = ut + f/df;
|
||||||
err = mag((ut - uTauNew)/ut);
|
err = mag((ut - uTauNew)/ut);
|
||||||
ut = uTauNew;
|
ut = uTauNew;
|
||||||
|
|
||||||
|
@ -104,25 +126,6 @@ tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tmp<scalarField>
|
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::calcMut() const
|
|
||||||
{
|
|
||||||
const label patchI = patch().index();
|
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
|
||||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
|
||||||
const scalarField magGradU = mag(Uw.snGrad());
|
|
||||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
|
||||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
|
||||||
|
|
||||||
return max
|
|
||||||
(
|
|
||||||
scalar(0),
|
|
||||||
rhow*sqr(calcUTau(magGradU))/(magGradU + ROOTVSMALL) - muw
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
@ -136,6 +139,18 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
|
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
(
|
(
|
||||||
|
@ -149,18 +164,6 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
mutWallFunctionFvPatchScalarField(p, iF, dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
(
|
(
|
||||||
|
@ -189,30 +192,25 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField::yPlus() 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 fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
|
||||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
const scalarField& y = turbModel.y()[patchI];
|
||||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
|
||||||
|
const scalarField& rhow = turbModel.rho().boundaryField()[patchI];
|
||||||
|
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
|
||||||
|
|
||||||
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
|
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void mutSpalartAllmarasWallFunctionFvPatchScalarField::write
|
|
||||||
(
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
fvPatchField<scalar>::write(os);
|
|
||||||
writeLocalEntries(os);
|
|
||||||
writeEntry("value", os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
makePatchTypeField(fvPatchScalarField, mutSpalartAllmarasWallFunctionFvPatchScalarField);
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
Reference in a new issue