Refactorization of incompressible/compressible nut/mut wall functions. Author: Vuko Vukcevic. Merge: Hrvoje Jasak.

This commit is contained in:
Hrvoje Jasak 2018-06-20 13:34:29 +01:00
commit e01e16c943
98 changed files with 2790 additions and 2119 deletions

View file

@ -17,13 +17,17 @@ alphatWallFunctions = $(wallFunctions)/alphatWallFunctions
$(alphatWallFunctions)/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C
mutWallFunctions = $(wallFunctions)/mutWallFunctions
$(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutWallFunction/mutWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutSpalartAllmarasWallFunction/mutSpalartAllmarasWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutSpalartAllmarasStandardWallFunction/mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutSpalartAllmarasStandardRoughWallFunction/mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutSpalartAllmarasWallFunction/mutSpalartAllmarasWallFunctionFvPatchScalarField.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
@ -42,6 +46,4 @@ derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupl
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels

View file

@ -27,7 +27,7 @@ License
#include "calculatedFvPatchField.H"
#include "alphatWallFunctionFvPatchScalarField.H"
#include "mutWallFunctionFvPatchScalarField.H"
#include "mutkWallFunctionFvPatchScalarField.H"
#include "mutLowReWallFunctionFvPatchScalarField.H"
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "kqRWallFunctionFvPatchField.H"
@ -158,7 +158,7 @@ tmp<volScalarField> autoCreateMut
if (bm[patchI].isWall())
{
mutBoundaryTypes[patchI] =
RASModels::mutWallFunctionFvPatchScalarField::typeName;
RASModels::mutkWallFunctionFvPatchScalarField::typeName;
}
else
{

View file

@ -100,6 +100,25 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> mutLowReWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
const scalarField& rhow = turbModel.rho().boundaryField()[patchI];
const scalarField nuw = muw/rhow;
return y*sqrt(nuw*mag(Uw.snGrad()))/nuw;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField

View file

@ -28,7 +28,19 @@ Description
Boundary condition for turbulent (kinematic) viscosity when for use with
low Reynolds number models.
Sets mut to zero, and provides an access to calculate y+.
Sets mut to zero, and provides an access function to calculate y+.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type mutLowReWallFunction;
}
\endverbatim
See also
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
mutLowReWallFunctionFvPatchScalarField.C
@ -59,7 +71,7 @@ class mutLowReWallFunctionFvPatchScalarField
{
protected:
// Private member functions
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
@ -132,6 +144,12 @@ public:
new mutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};

View file

@ -38,171 +38,6 @@ namespace compressible
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 * * * * * * * * * * * * * * //
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
@ -212,10 +47,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero),
roughnessFudgeFactor_(pTraits<scalar>::zero)
mutURoughWallFunctionFvPatchScalarField(p, iF)
{}
@ -228,10 +60,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
mutURoughWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -243,10 +72,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor")))
mutURoughWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -256,10 +82,7 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& rwfpsf
)
:
mutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
mutURoughWallFunctionFvPatchScalarField(rwfpsf)
{}
@ -270,44 +93,10 @@ mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
mutURoughWallFunctionFvPatchScalarField(rwfpsf, iF)
{}
// * * * * * * * * * * * * * * * 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

View file

@ -26,7 +26,9 @@ Class
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
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
mutSpalartAllamarasStandardWallFunctionFvPatchScalarField.C
@ -36,7 +38,7 @@ SourceFiles
#ifndef compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"
#include "mutURoughWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,33 +55,8 @@ Class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration
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:
//- 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;
};

View file

@ -38,77 +38,6 @@ namespace compressible
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 * * * * * * * * * * * * * * //
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
@ -118,7 +47,19 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
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
)
:
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict)
mutUWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -153,7 +82,7 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf
)
:
mutWallFunctionFvPatchScalarField(sawfpsf)
mutUWallFunctionFvPatchScalarField(sawfpsf)
{}
@ -164,37 +93,10 @@ mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
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
(
fvPatchScalarField,

View file

@ -26,7 +26,9 @@ Class
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
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
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
@ -36,7 +38,7 @@ SourceFiles
#ifndef compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"
#include "mutUWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,19 +55,8 @@ namespace RASModels
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:
//- 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;
};

View file

@ -40,24 +40,46 @@ namespace RASModels
// * * * * * * * * * * * * 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
(
const scalarField& magGradU
) const
{
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patch().index()];
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
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 =
rasModel.rho().boundaryField()[patch().index()];
const fvPatchScalarField& muw =
rasModel.mu().boundaryField()[patch().index()];
const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchI];
const scalarField& mutw = *this;
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
@ -65,32 +87,32 @@ tmp<scalarField> mutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
forAll(mutw, faceI)
{
scalar magUpara = magUp[faceI];
const scalar& magUpara = magUp[faceI];
scalar ut =
sqrt((mutw[faceI] + muw[faceI])*magGradU[faceI]/rhow[faceI]);
if (ut > VSMALL)
{
int iter = 0;
label iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa_*magUpara/ut, 50);
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
const scalar kUu = min(kappa_*magUpara/ut, 50);
const scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
const scalar f =
- ut*y[faceI]/(muw[faceI]/rhow[faceI])
+ magUpara/ut
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
const scalar df =
y[faceI]/(muw[faceI]/rhow[faceI])
+ magUpara/sqr(ut)
+ 1/E_*kUu*fkUu/ut;
scalar uTauNew = ut + f/df;
const scalar uTauNew = ut + f/df;
err = mag((ut - uTauNew)/ut);
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 * * * * * * * * * * * * * * //
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
(
@ -149,18 +164,6 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField
{}
mutSpalartAllmarasWallFunctionFvPatchScalarField::
mutSpalartAllmarasWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
mutSpalartAllmarasWallFunctionFvPatchScalarField::
mutSpalartAllmarasWallFunctionFvPatchScalarField
(
@ -189,30 +192,25 @@ mutSpalartAllmarasWallFunctionFvPatchScalarField::yPlus() 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& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[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);
}
void mutSpalartAllmarasWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutSpalartAllmarasWallFunctionFvPatchScalarField);
makePatchTypeField
(
fvPatchScalarField,
mutSpalartAllmarasWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -141,12 +141,6 @@ public:
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};

View file

@ -0,0 +1,316 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mutURoughWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
const fvPatchScalarField& rho = turbModel.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;
label 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 *= roughnessFactor_;
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;
label 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> mutURoughWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
const fvPatchScalarField& rho = turbModel.rho().boundaryField()[patchI];
// The flow velocity at the adjacent cell centre
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
tmp<scalarField> tyPlus = calcYPlus(magUp);
const 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] + ROOTVSMALL;
mutw[faceI] = muw[faceI]*(sqr(yPlus[faceI])/Re - 1);
}
}
return tmutw;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(0.0),
roughnessConstant_(0.0),
roughnessFactor_(0.0)
{}
mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
(
const mutURoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFactor_(ptf.roughnessFactor_)
{}
mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
{}
mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
(
const mutURoughWallFunctionFvPatchScalarField& rwfpsf
)
:
mutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
(
const mutURoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
return calcYPlus(magUp);
}
void mutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
mutWallFunctionFvPatchScalarField::write(os);
writeLocalEntries(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFactor")
<< roughnessFactor_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
mutURoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,237 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutURoughWallFunctionFvPatchScalarField
Description
This boundary condition provides a turbulent (dynamic) viscosity condition
when using wall functions for rough walls, based on velocity.
Usage
\table
Property | Description | Required | Default value
roughnessHeight | roughness height | yes |
roughnessConstant | roughness constanr | yes |
roughnessFactor | scaling factor | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type mutURoughWallFunction;
roughnessHeight 1e-5;
roughnessConstant 0.5;
roughnessFactor 1;
}
\endverbatim
See also
Foam::mutWallFunctionFvPatchScalarField
SourceFiles
mutURoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef mutURoughWallFunctionFvPatchScalarField_H
#define mutURoughWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutURoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutURoughWallFunctionFvPatchScalarField
:
public mutWallFunctionFvPatchScalarField
{
// Private Data
// Roughness model parameters
//- Height
scalar roughnessHeight_;
//- Constant
scalar roughnessConstant_;
//- Scale factor
scalar roughnessFactor_;
// Protected Member Functions
//- Calculate yPLus
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
public:
//- Runtime type information
TypeName("mutURoughWallFunction");
// Constructors
//- Construct from patch and internal field
mutURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// mutURoughWallFunctionFvPatchScalarField
// onto a new patch
mutURoughWallFunctionFvPatchScalarField
(
const mutURoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutURoughWallFunctionFvPatchScalarField
(
const mutURoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mutURoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutURoughWallFunctionFvPatchScalarField
(
const mutURoughWallFunctionFvPatchScalarField&,
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 mutURoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// 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 roughnessFactor_;
}
//- Return reference to the roughness scale factor to allow
// adjustment
scalar& roughnessFactor()
{
return roughnessFactor_;
}
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mutUWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchI];
const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchI];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
forAll(yPlus, faceI)
{
const scalar kappaRe =
kappa_*magUp[faceI]*y[faceI]/(muw[faceI]/rhow[faceI]);
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
label 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> mutUWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const fvPatchScalarField& muw = turbModel.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 * * * * * * * * * * * * * * //
mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(p, iF)
{}
mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
(
const mutUWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
(
const mutUWallFunctionFvPatchScalarField& wfpsf
)
:
mutWallFunctionFvPatchScalarField(wfpsf)
{}
mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
(
const mutUWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> mutUWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
return calcYPlus(magUp);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutUWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutkWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (dynamic) viscosity when using wall
functions, based on velocity.
- replicates OpenFOAM v1.5 (and earlier) behaviour
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type mutUWallFunction;
}
\endverbatim
See also
Foam::mutWallFunctionFvPatchScalarField
SourceFiles
mutUWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef mutUWallFunctionFvPatchScalarField_H
#define mutUWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutUWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutUWallFunctionFvPatchScalarField
:
public mutWallFunctionFvPatchScalarField
{
protected:
// Protected Member Functions
//- Calculate yPLus. Helper function
tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
public:
//- Runtime type information
TypeName("mutUWallFunction");
// Constructors
//- Construct from patch and internal field
mutUWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutUWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// mutUWallFunctionFvPatchScalarField
// onto a new patch
mutUWallFunctionFvPatchScalarField
(
const mutUWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutUWallFunctionFvPatchScalarField
(
const mutUWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mutUWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutUWallFunctionFvPatchScalarField
(
const mutUWallFunctionFvPatchScalarField&,
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 mutUWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -38,13 +38,15 @@ namespace compressible
namespace RASModels
{
defineTypeNameAndDebug(mutWallFunctionFvPatchScalarField, 0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void mutWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
FatalErrorIn("mutWallFunctionFvPatchScalarField::checkType()")
FatalErrorIn(this->type() + "FvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
@ -62,7 +64,7 @@ scalar mutWallFunctionFvPatchScalarField::calcYPlusLam
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
for (label i = 0; i < 10; ++i)
{
ypl = log(E*ypl)/kappa;
}
@ -71,38 +73,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
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
@ -124,7 +94,26 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
kappa_(0.41),
E_(9.8),
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
@ -140,22 +129,9 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{}
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
@ -168,7 +144,9 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{}
{
checkType();
}
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
@ -182,36 +160,26 @@ mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{}
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void mutWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcMut());
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
{
fvPatchField<scalar>::write(os);
@ -220,10 +188,6 @@ void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels

View file

@ -25,8 +25,8 @@ Class
Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when using wall
functions
Abstract base class for boundary condition for turbulent (dynamic)
viscosity when using wall functions
- replicates OpenFOAM v1.5 (and earlier) behaviour
SourceFiles
@ -73,7 +73,7 @@ protected:
scalar yPlusLam_;
// Protected member functions
// Protected Member Functions
//- Check the type of the patch
virtual void checkType();
@ -82,7 +82,7 @@ protected:
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
virtual tmp<scalarField> calcMut() const = 0;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
@ -128,15 +128,6 @@ public:
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
mutWallFunctionFvPatchScalarField
(
@ -144,25 +135,13 @@ public:
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
// Evaluation functions
//- 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
virtual void updateCoeffs();

View file

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mutRoughWallFunctionFvPatchScalarField.H"
#include "mutkRoughWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -38,10 +38,9 @@ namespace compressible
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
scalar mutRoughWallFunctionFvPatchScalarField::fnRough
scalar mutkRoughWallFunctionFvPatchScalarField::fnRough
(
const scalar KsPlus,
const scalar Cs
@ -64,38 +63,46 @@ scalar mutRoughWallFunctionFvPatchScalarField::fnRough
}
tmp<scalarField> mutRoughWallFunctionFvPatchScalarField::calcMut() const
tmp<scalarField> mutkRoughWallFunctionFvPatchScalarField::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 turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalarField& y = turbModel.y()[patchI];
const scalarField& rhow = turbModel.rho().boundaryField()[patchI];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tmutw(new scalarField(*this));
scalarField& mutw = tmutw();
const unallocLabelList& fc = patch().faceCells();
forAll(mutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
const label faceCellI = fc[faceI];
scalar uStar = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = uStar*y[faceI]/(muw[faceI]/rhow[faceI]);
scalar KsPlus = uStar*Ks_[faceI]/(muw[faceI]/rhow[faceI]);
const scalar uStar = Cmu25*sqrt(k[faceCellI]);
const scalar yPlus = uStar*y[faceI]/(muw[faceI]/rhow[faceI]);
const scalar KsPlus = uStar*Ks_[faceI]/(muw[faceI]/rhow[faceI]);
scalar Edash = E_;
scalar yPlusLamNew = yPlusLam_;
if (KsPlus > 2.25)
{
Edash /= fnRough(KsPlus, Cs_[faceI]);
yPlusLamNew = rasModel.yPlusLam(kappa_, Edash);
yPlusLamNew = turbModel.yPlusLam(kappa_, Edash);
}
if (yPlus > yPlusLamNew)
{
mutw[faceI] =
muw[faceI]*(yPlus*kappa_/log(max(Edash*yPlus, 1 + 1e-4)) - 1);
}
if (debug)
@ -104,14 +111,9 @@ tmp<scalarField> mutRoughWallFunctionFvPatchScalarField::calcMut() const
<< ", KsPlus = " << KsPlus
<< ", Edash = " << Edash
<< ", yPlusLam = " << yPlusLam_
<< ", mutw = " << mutw[faceI]
<< endl;
}
if (yPlus > yPlusLamNew)
{
mutw[faceI] =
muw[faceI]*(yPlus*kappa_/log(max(Edash*yPlus, 1+1e-4)) - 1);
}
}
return tmutw;
@ -120,63 +122,63 @@ tmp<scalarField> mutRoughWallFunctionFvPatchScalarField::calcMut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField::mutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(p, iF),
mutkWallFunctionFvPatchScalarField(p, iF),
Ks_(p.size(), 0.0),
Cs_(p.size(), 0.0)
{}
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField::mutkRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField& ptf,
const mutkRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
Ks_(ptf.Ks_, mapper),
Cs_(ptf.Cs_, mapper)
{}
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField::mutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict),
mutkWallFunctionFvPatchScalarField(p, iF, dict),
Ks_("Ks", dict, p.size()),
Cs_("Cs", dict, p.size())
{}
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField::mutkRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField& rwfpsf
const mutkRoughWallFunctionFvPatchScalarField& rwfpsf
)
:
mutWallFunctionFvPatchScalarField(rwfpsf),
mutkWallFunctionFvPatchScalarField(rwfpsf),
Ks_(rwfpsf.Ks_),
Cs_(rwfpsf.Cs_)
{}
mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField::mutkRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField& rwfpsf,
const mutkRoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
mutkWallFunctionFvPatchScalarField(rwfpsf, iF),
Ks_(rwfpsf.Ks_),
Cs_(rwfpsf.Cs_)
{}
@ -184,34 +186,34 @@ mutRoughWallFunctionFvPatchScalarField::mutRoughWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void mutRoughWallFunctionFvPatchScalarField::autoMap
void mutkRoughWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
mutWallFunctionFvPatchScalarField::autoMap(m);
mutkWallFunctionFvPatchScalarField::autoMap(m);
Ks_.autoMap(m);
Cs_.autoMap(m);
}
void mutRoughWallFunctionFvPatchScalarField::rmap
void mutkRoughWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
mutWallFunctionFvPatchScalarField::rmap(ptf, addr);
mutkWallFunctionFvPatchScalarField::rmap(ptf, addr);
const mutRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const mutRoughWallFunctionFvPatchScalarField>(ptf);
const mutkRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const mutkRoughWallFunctionFvPatchScalarField>(ptf);
Cs_.rmap(nrwfpsf.Cs_, addr);
Ks_.rmap(nrwfpsf.Ks_, addr);
Cs_.rmap(nrwfpsf.Cs_, addr);
}
void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
void mutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
@ -223,7 +225,7 @@ void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutRoughWallFunctionFvPatchScalarField);
makePatchTypeField(fvPatchScalarField, mutkRoughWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -22,10 +22,10 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutRoughWallFunctionFvPatchScalarField
Foam::compressible::RASModels::mutkRoughWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when using wall
Boundary condition for turbulent (dynamic) viscosity when using wall
functions for rough walls.
Manipulates the E parameter to account for roughness effects, based on
@ -34,15 +34,32 @@ Description
- roughness height = sand-grain roughness (0 for smooth walls)
- roughness constant = 0.5-1.0 (0.5 default)
Usage
\table
Property | Description | Required | Default value
Ks | sand-grain roughness height | yes |
Cs | roughness constant | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type mutkRoughWallFunction;
Ks uniform 0;
Cs uniform 0.5;
}
\endverbatim
SourceFiles
mutRoughWallFunctionFvPatchScalarField.C
mutkRoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutRoughWallFunctionFvPatchScalarField_H
#define compressibleMutRoughWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"
#include "mutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,12 +71,12 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutRoughWallFunctionFvPatchScalarField Declaration
Class mutkRoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutRoughWallFunctionFvPatchScalarField
class mutkRoughWallFunctionFvPatchScalarField
:
public mutWallFunctionFvPatchScalarField
public mutkWallFunctionFvPatchScalarField
{
protected:
@ -72,7 +89,7 @@ protected:
scalarField Cs_;
// Private member functions
// Protected Member Functions
//- Compute the roughness function
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const;
@ -84,20 +101,20 @@ protected:
public:
//- Runtime type information
TypeName("mutRoughWallFunction");
TypeName("mutkRoughWallFunction");
// Constructors
//- Construct from patch and internal field
mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
@ -105,20 +122,20 @@ public:
);
//- Construct by mapping given
// mutRoughWallFunctionFvPatchScalarField
// mutkRoughWallFunctionFvPatchScalarField
// onto a new patch
mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField&,
const mutkRoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField&
const mutkRoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
@ -126,14 +143,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new mutRoughWallFunctionFvPatchScalarField(*this)
new mutkRoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutRoughWallFunctionFvPatchScalarField
mutkRoughWallFunctionFvPatchScalarField
(
const mutRoughWallFunctionFvPatchScalarField&,
const mutkRoughWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -145,20 +162,32 @@ public:
{
return tmp<fvPatchScalarField>
(
new mutRoughWallFunctionFvPatchScalarField(*this, iF)
new mutkRoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Acces functions
// Return Ks
scalarField& Ks()
{
return Ks_;
}
// Return Cs
scalarField& Cs()
{
return Cs_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap

View file

@ -40,63 +40,37 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void mutkWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
FatalErrorIn("mutkWallFunctionFvPatchScalarField::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 mutkWallFunctionFvPatchScalarField::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> mutkWallFunctionFvPatchScalarField::calcMut() const
{
const label patchi = patch().index();
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const scalarField& y = turbModel.y()[patchI];
const scalarField& rhow = turbModel.rho().boundaryField()[patchI];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
scalarField& mutw = tmutw();
// Get face cells
const unallocLabelList& fc = patch().faceCells();
forAll(mutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
const label faceCellI = fc[faceI];
scalar yPlus =
const 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);
mutw[faceI] = muw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
}
}
@ -104,14 +78,6 @@ tmp<scalarField> mutkWallFunctionFvPatchScalarField::calcMut() const
}
void mutkWallFunctionFvPatchScalarField::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 * * * * * * * * * * * * * * //
mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
@ -120,11 +86,18 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
mutWallFunctionFvPatchScalarField(p, iF)
{}
mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -136,26 +109,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{}
mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
(
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(ptf, p, iF, mapper)
{}
@ -164,11 +118,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const mutkWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
mutWallFunctionFvPatchScalarField(wfpsf)
{}
@ -178,55 +128,30 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
mutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void mutkWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcMut());
fixedValueFvPatchScalarField::updateCoeffs();
}
tmp<scalarField> mutkWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& y = turbModel.y()[patchI];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField kwc(k.boundaryField()[patchi].patchInternalField());
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const scalarField kwc(k.boundaryField()[patchI].patchInternalField());
const scalarField& muw = turbModel.mu().boundaryField()[patchI];
const scalarField& rhow = turbModel.rho().boundaryField()[patchI];
return pow025(Cmu_)*y*sqrt(kwc)/(muw/rhow);
}
void mutkWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutkWallFunctionFvPatchScalarField);

View file

@ -25,10 +25,22 @@ Class
Foam::compressible::RASModels::mutkWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when using wall
Boundary condition for turbulent (dynamic) viscosity when using wall
functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type mutkWallFunction;
}
\endverbatim
See also
Foam::mutWallFunctionFvPatchScalarField
SourceFiles
mutkWallFunctionFvPatchScalarField.C
@ -37,7 +49,7 @@ SourceFiles
#ifndef compressibleMutkWallFunctionFvPatchScalarField_H
#define compressibleMutkWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,39 +66,15 @@ namespace RASModels
class mutkWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
public mutWallFunctionFvPatchScalarField
{
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 Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
@ -159,19 +147,8 @@ public:
// 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;
};

View file

@ -25,13 +25,15 @@ coupledKOmegaSST/coupledKOmegaSST.C
wallFunctions = derivedFvPatchFields/wallFunctions
nutWallFunctions = $(wallFunctions)/nutWallFunctions
$(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutWallFunction/nutWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutCWTWallFunction/nutCWTWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutMEWTWallFunction/nutMEWTWallFunctionFvPatchScalarField.C

View file

@ -26,7 +26,7 @@ License
#include "backwardsCompatibilityWallFunctions.H"
#include "calculatedFvPatchField.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "nutkWallFunctionFvPatchScalarField.H"
#include "nutLowReWallFunctionFvPatchScalarField.H"
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "kqRWallFunctionFvPatchField.H"
@ -77,7 +77,7 @@ tmp<volScalarField> autoCreateNut
if (bm[patchI].isWall())
{
nutBoundaryTypes[patchI] =
RASModels::nutWallFunctionFvPatchScalarField::typeName;
RASModels::nutkWallFunctionFvPatchScalarField::typeName;
}
else
{

View file

@ -40,48 +40,19 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutCWTWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
FatalErrorIn("nutCWTWallFunctionFvPatchScalarField::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 nutCWTWallFunctionFvPatchScalarField::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> nutCWTWallFunctionFvPatchScalarField::calcNut() 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& nuw = rasModel.nu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
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
const vectorField n = patch().nf();
@ -130,8 +101,15 @@ tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::calcNut() const
}
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()
<< nl
<< "If you would like to include pressure gradient effects, set up"
<< " pressureGradient function object."
<< endl;
}
@ -164,8 +142,15 @@ tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::calcNut() const
}
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()
<< nl
<< "If you would like to include convection effects, set up"
<< " velocityConvection function object."
<< endl;
}
@ -206,12 +191,11 @@ tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::calcNut() const
void nutCWTWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
nutkWallFunctionFvPatchScalarField::writeLocalEntries(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "p", "p", pName_);
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;
}
@ -223,17 +207,11 @@ nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
nutkWallFunctionFvPatchScalarField(p, iF),
UName_("U"),
pName_("p"),
nutName_("nut"),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
}
nutName_("nut")
{}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
@ -243,17 +221,11 @@ nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
nutkWallFunctionFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
pName_(dict.lookupOrDefault<word>("p", "p")),
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();
}
nutName_(dict.lookupOrDefault<word>("nut", "nut"))
{}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
@ -264,17 +236,11 @@ nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
pName_(ptf.pName_),
nutName_(ptf.nutName_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
}
nutName_(ptf.nutName_)
{}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
@ -282,17 +248,11 @@ nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
const nutCWTWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
nutkWallFunctionFvPatchScalarField(wfpsf),
UName_(wfpsf.UName_),
pName_(wfpsf.pName_),
nutName_(wfpsf.nutName_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
nutName_(wfpsf.nutName_)
{}
nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
@ -301,51 +261,11 @@ nutCWTWallFunctionFvPatchScalarField::nutCWTWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
nutkWallFunctionFvPatchScalarField(wfpsf, iF),
UName_(wfpsf.UName_),
pName_(wfpsf.pName_),
nutName_(wfpsf.nutName_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutCWTWallFunctionFvPatchScalarField::updateCoeffs()
{
operator==(calcNut());
fixedValueFvPatchScalarField::updateCoeffs();
}
tmp<scalarField> nutCWTWallFunctionFvPatchScalarField::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 nutCWTWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
nutName_(wfpsf.nutName_)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -41,6 +41,18 @@ Description
DOI = {10.1007/s10494-006-9067-x}
}
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutCWTWallFunction;
}
\endverbatim
See also
Foam::nutkWallFunctionFvPatchScalarField
SourceFiles
nutCWTWallFunctionFvPatchScalarField.C
@ -52,7 +64,7 @@ Author
#ifndef nutCWTWallFunctionFvPatchScalarField_H
#define nutCWTWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,11 +81,9 @@ namespace RASModels
class nutCWTWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
public nutkWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Private Data Members
//- Name of velocity field
word UName_;
@ -84,29 +94,10 @@ protected:
//- Name of eddy viscosity field
word nutName_;
//- Name of omega field
word omegaName_;
//- Cmu coefficient
scalar Cmu_;
protected:
//- 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 Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
@ -182,23 +173,6 @@ public:
new nutCWTWallFunctionFvPatchScalarField(*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;
};

View file

@ -100,6 +100,22 @@ nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
return y*sqrt(nuw*mag(Uw.snGrad()))/nuw;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutLowReWallFunctionFvPatchScalarField);

View file

@ -30,6 +30,18 @@ Description
Sets nut to zero, and provides an access function to calculate y+.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutLowReWallFunction;
}
\endverbatim
See also
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutLowReWallFunctionFvPatchScalarField.C
@ -59,7 +71,7 @@ class nutLowReWallFunctionFvPatchScalarField
{
protected:
// Protected member functions
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
@ -132,6 +144,12 @@ public:
new nutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};

View file

@ -51,48 +51,19 @@ namespace RASModels
// * * * * * * * * * * * * 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
{
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& nuw = rasModel.nu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
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
const vectorField n = patch().nf();
@ -141,8 +112,15 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
}
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()
<< nl
<< "If you would like to include pressure gradient effects, set up"
<< " pressureGradient function object."
<< endl;
}
@ -175,8 +153,15 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
}
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()
<< nl
<< "If you would like to include convection effects, set up"
<< " velocityConvection function object."
<< endl;
}
@ -254,12 +239,11 @@ tmp<scalarField> nutMEWTWallFunctionFvPatchScalarField::calcNut() const
void nutMEWTWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
nutkWallFunctionFvPatchScalarField::writeLocalEntries(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "p", "p", pName_);
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
)
:
fixedValueFvPatchScalarField(p, iF),
nutkWallFunctionFvPatchScalarField(p, iF),
UName_("U"),
pName_("p"),
nutName_("nut"),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
}
nutName_("nut")
{}
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
@ -291,17 +269,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
nutkWallFunctionFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
pName_(dict.lookupOrDefault<word>("p", "p")),
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();
}
nutName_(dict.lookupOrDefault<word>("nut", "nut"))
{}
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
@ -312,17 +284,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
pName_(ptf.pName_),
nutName_(ptf.nutName_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
}
nutName_(ptf.nutName_)
{}
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
@ -330,17 +296,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
const nutMEWTWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
nutkWallFunctionFvPatchScalarField(wfpsf),
UName_(wfpsf.UName_),
pName_(wfpsf.pName_),
nutName_(wfpsf.nutName_),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
nutName_(wfpsf.nutName_)
{}
nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
@ -349,51 +309,11 @@ nutMEWTWallFunctionFvPatchScalarField::nutMEWTWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
nutkWallFunctionFvPatchScalarField(wfpsf, iF),
UName_(wfpsf.UName_),
pName_(wfpsf.pName_),
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);
}
nutName_(wfpsf.nutName_)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -39,6 +39,18 @@ Description
year = {2017},
}
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutCWTWallFunction;
}
\endverbatim
See also
Foam::nutkWallFunctionFvPatchScalarField
SourceFiles
nutMEWTWallFunctionFvPatchScalarField.C
@ -50,7 +62,7 @@ Author
#ifndef nutMEWTWallFunctionFvPatchScalarField_H
#define nutMEWTWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "nutkWallFunctionFvPatchScalarField.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,19 +80,13 @@ namespace RASModels
class nutMEWTWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
public nutkWallFunctionFvPatchScalarField
{
// Private Data Members
// Private static data member
//- Tolerance for the A dimensionless parameter
//- Static tolerance for the A dimensionless parameter
static const debug::tolerancesSwitch dimlessAFactorTol_;
protected:
// Protected data
//- Name of velocity field
word UName_;
@ -90,29 +96,10 @@ protected:
//- Name of eddy viscosity field
word nutName_;
//- Name of omega field
word omegaName_;
//- Cmu coefficient
scalar Cmu_;
protected:
//- 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 Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
@ -144,8 +131,7 @@ public:
const dictionary&
);
//- Construct by mapping given
// nutMEWTWallFunctionFvPatchScalarField
//- Construct by mapping given nutMEWTWallFunctionFvPatchScalarField
// onto a new patch
nutMEWTWallFunctionFvPatchScalarField
(
@ -188,23 +174,6 @@ public:
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;
};

View file

@ -38,165 +38,6 @@ namespace incompressible
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField>
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::calcNut() 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& nuw = rasModel.nu().boundaryField()[patchI];
// The flow velocity at the adjacent cell centre
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(yPlus, facei)
{
if (yPlus[facei] > yPlusLam_)
{
const scalar Re = magUp[facei]*y[facei]/nuw[facei];
nutw[facei] = nuw[facei]*(sqr(yPlus[facei])/Re - 1);
}
}
return tnutw;
}
tmp<scalarField>
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::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& nuw = rasModel.nu().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 = magUpara*y[facei]/nuw[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 = magUpara*y[facei]/nuw[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;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
@ -206,10 +47,7 @@ nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero),
roughnessFudgeFactor_(pTraits<scalar>::zero)
nutURoughWallFunctionFvPatchScalarField(p, iF)
{}
@ -222,10 +60,7 @@ nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
nutURoughWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -237,10 +72,7 @@ nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor")))
nutURoughWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -250,10 +82,7 @@ nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& rwfpsf
)
:
nutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
nutURoughWallFunctionFvPatchScalarField(rwfpsf)
{}
@ -264,45 +93,10 @@ nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFudgeFactor_(rwfpsf.roughnessFudgeFactor_)
nutURoughWallFunctionFvPatchScalarField(rwfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField>
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::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 nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::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;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField

View file

@ -26,7 +26,9 @@ Class
nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
Description
Wall function boundary condition for rough walls
This boundary condition is the same as nutURoughWallFunction. We will simply
derive from nutURoughWallFunctionFvPatchScalarField to enable backward
compatibility.
SourceFiles
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
@ -36,7 +38,7 @@ SourceFiles
#ifndef nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#define nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
#include "nutURoughWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,31 +55,8 @@ Class nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration
class nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
public nutURoughWallFunctionFvPatchScalarField
{
// Private data
// Roughness model 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> calcNut() const;
public:
//- Runtime type information
@ -152,63 +131,6 @@ public:
)
);
}
// Member functions
// Access
//- Return the roughness height
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_;
}
// I-O
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};

View file

@ -38,76 +38,6 @@ namespace incompressible
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField>
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::calcNut() 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 scalarField& nuw = rasModel.nu().boundaryField()[patchI];
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(yPlus, facei)
{
if (yPlus[facei] > yPlusLam_)
{
nutw[facei] =
nuw[facei]*(yPlus[facei]*kappa_/log(E_*yPlus[facei]) - 1.0);
}
}
return tnutw;
}
tmp<scalarField>
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::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& nuw = rasModel.nu().boundaryField()[patchI];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
forAll(yPlus, facei)
{
scalar kappaRe = kappa_*magUp[facei]*y[facei]/nuw[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;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
@ -117,7 +47,7 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF)
nutUWallFunctionFvPatchScalarField(p, iF)
{}
@ -130,7 +60,7 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
nutUWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -142,7 +72,7 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict)
nutUWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -152,7 +82,7 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& sawfpsf
)
:
nutWallFunctionFvPatchScalarField(sawfpsf)
nutUWallFunctionFvPatchScalarField(sawfpsf)
{}
@ -163,35 +93,10 @@ nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(sawfpsf, iF)
nutUWallFunctionFvPatchScalarField(sawfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField>
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::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 nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField

View file

@ -26,7 +26,9 @@ Class
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
Description
Wall function boundary condition for walls
This boundary condition is the same as nutUWallFunction. We will simply
derive from nutUWallFunctionFvPatchScalarField to enable backward
compatibility.
SourceFiles
nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
@ -36,7 +38,7 @@ SourceFiles
#ifndef nutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#define nutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
#include "nutUWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,19 +55,8 @@ namespace RASModels
class nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
public nutUWallFunctionFvPatchScalarField
{
protected:
// Protected member functions
//- Calculate yPLus
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- 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;
};

View file

@ -45,14 +45,16 @@ nutSpalartAllmarasWallFunctionFvPatchScalarField::calcNut() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField magGradU = mag(Uw.snGrad());
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
return max
(
scalar(0),
0.0,
sqr(calcUTau(magGradU))/(magGradU + ROOTVSMALL) - nuw
);
}
@ -63,51 +65,56 @@ tmp<scalarField> nutSpalartAllmarasWallFunctionFvPatchScalarField::calcUTau
const scalarField& magGradU
) const
{
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patch().index()];
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const fvPatchVectorField& Uw =
rasModel.U().boundaryField()[patch().index()];
turbModel.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField& nuw = rasModel.nu().boundaryField()[patch().index()];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
const scalarField& nutw = *this;
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
scalarField& uTau = tuTau();
forAll(uTau, facei)
forAll(uTau, faceI)
{
scalar magUpara = magUp[facei];
const scalar& magUpara = magUp[faceI];
scalar ut = sqrt((nutw[facei] + nuw[facei])*magGradU[facei]);
scalar ut = sqrt((nutw[faceI] + nuw[faceI])*magGradU[faceI]);
if (ut > VSMALL)
{
int iter = 0;
label iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa_*magUpara/ut, 50);
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
const scalar kUu = min(kappa_*magUpara/ut, 50);
const scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
- ut*y[facei]/nuw[facei]
const scalar f =
- ut*y[faceI]/nuw[faceI]
+ magUpara/ut
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
y[facei]/nuw[facei]
const scalar df =
y[faceI]/nuw[faceI]
+ magUpara/sqr(ut)
+ 1/E_*kUu*fkUu/ut;
scalar uTauNew = ut + f/df;
const scalar uTauNew = ut + f/df;
err = mag((ut - uTauNew)/ut);
ut = uTauNew;
} while (ut > VSMALL && err > 0.01 && ++iter < 10);
uTau[facei] = max(0.0, ut);
uTau[faceI] = max(0.0, ut);
}
}
@ -128,6 +135,18 @@ nutSpalartAllmarasWallFunctionFvPatchScalarField
{}
nutSpalartAllmarasWallFunctionFvPatchScalarField::
nutSpalartAllmarasWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutSpalartAllmarasWallFunctionFvPatchScalarField::
nutSpalartAllmarasWallFunctionFvPatchScalarField
(
@ -141,18 +160,6 @@ nutSpalartAllmarasWallFunctionFvPatchScalarField
{}
nutSpalartAllmarasWallFunctionFvPatchScalarField::
nutSpalartAllmarasWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutSpalartAllmarasWallFunctionFvPatchScalarField::
nutSpalartAllmarasWallFunctionFvPatchScalarField
(
@ -181,26 +188,17 @@ nutSpalartAllmarasWallFunctionFvPatchScalarField::yPlus() 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& nuw = rasModel.nu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
return y*calcUTau(mag(Uw.snGrad()))/nuw;
}
void nutSpalartAllmarasWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField

View file

@ -141,12 +141,6 @@ public:
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};

View file

@ -0,0 +1,308 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nutURoughWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
// The flow velocity at the adjacent cell centre
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
tmp<scalarField> tyPlus = calcYPlus(magUp);
const scalarField& yPlus = tyPlus();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(yPlus, faceI)
{
if (yPlus[faceI] > yPlusLam_)
{
const scalar Re = magUp[faceI]*y[faceI]/nuw[faceI] + ROOTVSMALL;
nutw[faceI] = nuw[faceI]*(sqr(yPlus[faceI])/Re - 1);
}
}
return tnutw;
}
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const scalarField& nuw = turbModel.nu().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 = magUpara*y[faceI]/nuw[faceI];
const scalar kappaRe = kappa_*Re;
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
label iter = 0;
scalar yPlusLast = 0.0;
scalar dKsPlusdYPlus = roughnessHeight_/y[faceI];
// Additional tuning parameter - nominally = 1
dKsPlusdYPlus *= roughnessFactor_;
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 = magUpara*y[faceI]/nuw[faceI];
const scalar kappaRe = kappa_*Re;
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
label 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;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(0.0),
roughnessConstant_(0.0),
roughnessFactor_(0.0)
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFactor_(ptf.roughnessFactor_)
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& rwfpsf
)
:
nutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw);
return calcYPlus(magUp());
}
void nutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFactor")
<< roughnessFactor_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutURoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,238 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::nutURoughWallFunctionFvPatchScalarField
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on velocity.
Usage
\table
Property | Description | Required | Default value
roughnessHeight | roughness height | yes |
roughnessConstant | roughness constanr | yes |
roughnessFactor | scaling factor | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutURoughWallFunction;
roughnessHeight 1e-5;
roughnessConstant 0.5;
roughnessFactor 1;
}
\endverbatim
See also
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutURoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutURoughWallFunctionFvPatchScalarField_H
#define nutURoughWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutURoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutURoughWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
{
// Private data
// Roughness model parameters
//- Height
scalar roughnessHeight_;
//- Constant
scalar roughnessConstant_;
//- Scale factor
scalar roughnessFactor_;
// Protected Member Functions
//- Calculate yPLus
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutURoughWallFunction");
// Constructors
//- Construct from patch and internal field
nutURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutURoughWallFunctionFvPatchScalarField
// onto a new patch
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutURoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&,
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 nutURoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
//- Return the roughness height
scalar roughnessHeight() const
{
return roughnessHeight_;
}
//- Return reference to the roughness height to allow adjustment
scalar& roughnessHeight()
{
return roughnessHeight_;
}
//- Return the roughness constant scale
scalar roughnessConstant() const
{
return roughnessConstant_;
}
//- Return reference to the roughness constant to allow adjustment
scalar& roughnessConstant()
{
return roughnessConstant_;
}
//- Return the roughness scale factor
scalar roughnessFactor() const
{
return roughnessFactor_;
}
//- Return reference to the roughness scale factor to allow
// adjustment
scalar& roughnessFactor()
{
return roughnessFactor_;
}
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,192 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nutUWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchI];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
forAll(yPlus, faceI)
{
const scalar kappaRe = kappa_*magUp[faceI]*y[faceI]/nuw[faceI];
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
label 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> nutUWallFunctionFvPatchScalarField::calcNut() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(yPlus, faceI)
{
if (yPlus[faceI] > yPlusLam_)
{
nutw[faceI] =
nuw[faceI]*(yPlus[faceI]*kappa_/log(E_*yPlus[faceI]) - 1.0);
}
}
return tnutw;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF)
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField& wfpsf
)
:
nutWallFunctionFvPatchScalarField(wfpsf)
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
return calcYPlus(magUp);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutUWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View file

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::nutkWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when using wall
functions, based on velocity.
- replicates OpenFOAM v1.5 (and earlier) behaviour
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutUWallFunction;
}
\endverbatim
See also
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutUWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutUWallFunctionFvPatchScalarField_H
#define nutUWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutUWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutUWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
{
protected:
// Protected Member Functions
//- Calculate yPLus. Helper function
tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutUWallFunction");
// Constructors
//- Construct from patch and internal field
nutUWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutUWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutUWallFunctionFvPatchScalarField
// onto a new patch
nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutUWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField&,
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 nutUWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -38,13 +38,15 @@ namespace incompressible
namespace RASModels
{
defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
FatalErrorIn("nutWallFunctionFvPatchScalarField::checkType()")
FatalErrorIn(this->type() + "FvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
@ -62,7 +64,7 @@ scalar nutWallFunctionFvPatchScalarField::calcYPlusLam
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
for (label i = 0; i < 10; ++i)
{
ypl = log(E*ypl)/kappa;
}
@ -71,37 +73,6 @@ scalar nutWallFunctionFvPatchScalarField::calcYPlusLam
}
tmp<scalarField> nutWallFunctionFvPatchScalarField::calcNut() 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& nuw = rasModel.nu().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(nutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
if (yPlus > yPlusLam_)
{
nutw[faceI] = nuw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
}
}
return tnutw;
}
void nutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
@ -198,28 +169,17 @@ nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
void nutWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcNut());
fixedValueFvPatchScalarField::updateCoeffs();
}
tmp<scalarField> nutWallFunctionFvPatchScalarField::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 nutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
@ -228,10 +188,6 @@ void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels

View file

@ -25,10 +25,37 @@ Class
Foam::incompressible::RASModels::nutWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when using wall
functions
Abstract base class for boundary condition for turbulent (kinematic)
viscosity when using wall functions
- replicates OpenFOAM v1.5 (and earlier) behaviour
Usage
\table
Property | Description | Required | Default value
Cmu | Cmu coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | E coefficient | no | 9.8
\endtable
Examples of the boundary condition specification:
\verbatim
<patchName>
{
type nutWallFunction;
value uniform 0.0;
}
\endverbatim
Reference for the default model coefficients:
\verbatim
H. Versteeg, W. Malalasekera
An Introduction to Computational Fluid Dynamics: The Finite Volume
Method, subsection "3.5.2 k-epsilon model"
\endverbatim
See also
Foam::fixedValueFvPatchField
SourceFiles
nutWallFunctionFvPatchScalarField.C
@ -73,7 +100,7 @@ protected:
scalar yPlusLam_;
// Protected member functions
// Protected Member Functions
//- Check the type of the patch
virtual void checkType();
@ -82,7 +109,7 @@ protected:
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
virtual tmp<scalarField> calcNut() const = 0;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
@ -128,15 +155,6 @@ public:
const nutWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutWallFunctionFvPatchScalarField
(
@ -144,25 +162,13 @@ public:
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 nutWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- 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
virtual void updateCoeffs();

View file

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "nutRoughWallFunctionFvPatchScalarField.H"
#include "nutkRoughWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -40,7 +40,7 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
scalar nutRoughWallFunctionFvPatchScalarField::fnRough
scalar nutkRoughWallFunctionFvPatchScalarField::fnRough
(
const scalar KsPlus,
const scalar Cs
@ -63,28 +63,32 @@ scalar nutRoughWallFunctionFvPatchScalarField::fnRough
}
tmp<scalarField> nutRoughWallFunctionFvPatchScalarField::calcNut() const
tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() 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& nuw = rasModel.nu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
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_);
tmp<scalarField> tnutw(new scalarField(*this));
scalarField& nutw = tnutw();
const unallocLabelList& fc = patch().faceCells();
forAll(nutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
const label faceCellI = fc[faceI];
scalar uStar = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = uStar*y[faceI]/nuw[faceI];
scalar KsPlus = uStar*Ks_[faceI]/nuw[faceI];
const scalar uStar = Cmu25*sqrt(k[faceCellI]);
const scalar yPlus = uStar*y[faceI]/nuw[faceI];
const scalar KsPlus = uStar*Ks_[faceI]/nuw[faceI];
scalar Edash = E_;
@ -105,7 +109,7 @@ tmp<scalarField> nutRoughWallFunctionFvPatchScalarField::calcNut() const
min
(
nuw[faceI]
*(yPlus*kappa_/log(max(Edash*yPlus, 1+1e-4)) - 1),
*(yPlus*kappa_/log(max(Edash*yPlus, 1 + 1e-4)) - 1.0),
2*limitingNutw
), 0.5*limitingNutw
);
@ -127,63 +131,63 @@ tmp<scalarField> nutRoughWallFunctionFvPatchScalarField::calcNut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutRoughWallFunctionFvPatchScalarField::nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF),
nutkWallFunctionFvPatchScalarField(p, iF),
Ks_(p.size(), 0.0),
Cs_(p.size(), 0.0)
{}
nutRoughWallFunctionFvPatchScalarField::nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const nutRoughWallFunctionFvPatchScalarField& ptf,
const nutkRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
Ks_(ptf.Ks_, mapper),
Cs_(ptf.Cs_, mapper)
{}
nutRoughWallFunctionFvPatchScalarField::nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict),
nutkWallFunctionFvPatchScalarField(p, iF, dict),
Ks_("Ks", dict, p.size()),
Cs_("Cs", dict, p.size())
{}
nutRoughWallFunctionFvPatchScalarField::nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const nutRoughWallFunctionFvPatchScalarField& rwfpsf
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf
)
:
nutWallFunctionFvPatchScalarField(rwfpsf),
nutkWallFunctionFvPatchScalarField(rwfpsf),
Ks_(rwfpsf.Ks_),
Cs_(rwfpsf.Cs_)
{}
nutRoughWallFunctionFvPatchScalarField::nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const nutRoughWallFunctionFvPatchScalarField& rwfpsf,
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(rwfpsf, iF),
nutkWallFunctionFvPatchScalarField(rwfpsf, iF),
Ks_(rwfpsf.Ks_),
Cs_(rwfpsf.Cs_)
{}
@ -191,34 +195,34 @@ nutRoughWallFunctionFvPatchScalarField::nutRoughWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutRoughWallFunctionFvPatchScalarField::autoMap
void nutkRoughWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
nutWallFunctionFvPatchScalarField::autoMap(m);
nutkWallFunctionFvPatchScalarField::autoMap(m);
Ks_.autoMap(m);
Cs_.autoMap(m);
}
void nutRoughWallFunctionFvPatchScalarField::rmap
void nutkRoughWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
nutWallFunctionFvPatchScalarField::rmap(ptf, addr);
nutkWallFunctionFvPatchScalarField::rmap(ptf, addr);
const nutRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const nutRoughWallFunctionFvPatchScalarField>(ptf);
const nutkRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const nutkRoughWallFunctionFvPatchScalarField>(ptf);
Ks_.rmap(nrwfpsf.Ks_, addr);
Cs_.rmap(nrwfpsf.Cs_, addr);
}
void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
void nutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
@ -230,7 +234,11 @@ void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutRoughWallFunctionFvPatchScalarField);
makePatchTypeField
(
fvPatchScalarField,
nutkRoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -22,7 +22,7 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::nutRoughWallFunctionFvPatchScalarField
Foam::incompressible::RASModels::nutkRoughWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when using wall
@ -34,15 +34,32 @@ Description
- roughness height = sand-grain roughness (0 for smooth walls)
- roughness constant = 0.5-1.0 (0.5 default)
Usage
\table
Property | Description | Required | Default value
Ks | sand-grain roughness height | yes |
Cs | roughness constant | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutkRoughWallFunction;
Ks uniform 0;
Cs uniform 0.5;
}
\endverbatim
SourceFiles
nutRoughWallFunctionFvPatchScalarField.C
nutkRoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutRoughWallFunctionFvPatchScalarField_H
#define nutRoughWallFunctionFvPatchScalarField_H
#ifndef nutkRoughWallFunctionFvPatchScalarField_H
#define nutkRoughWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,12 +71,12 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutRoughWallFunctionFvPatchScalarField Declaration
Class nutkRoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutRoughWallFunctionFvPatchScalarField
class nutkRoughWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
public nutkWallFunctionFvPatchScalarField
{
protected:
@ -72,7 +89,7 @@ protected:
scalarField Cs_;
// Protected member functions
// Protected Member Functions
//- Compute the roughness function
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const;
@ -84,20 +101,20 @@ protected:
public:
//- Runtime type information
TypeName("nutRoughWallFunction");
TypeName("nutkRoughWallFunction");
// Constructors
//- Construct from patch and internal field
nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
@ -105,20 +122,20 @@ public:
);
//- Construct by mapping given
// nutRoughWallFunctionFvPatchScalarField
// nutkRoughWallFunctionFvPatchScalarField
// onto a new patch
nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField
(
const nutRoughWallFunctionFvPatchScalarField&,
const nutkRoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField
(
const nutRoughWallFunctionFvPatchScalarField&
const nutkRoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
@ -126,14 +143,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new nutRoughWallFunctionFvPatchScalarField(*this)
new nutkRoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField
(
const nutRoughWallFunctionFvPatchScalarField&,
const nutkRoughWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -145,13 +162,28 @@ public:
{
return tmp<fvPatchScalarField>
(
new nutRoughWallFunctionFvPatchScalarField(*this, iF)
new nutkRoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Acces functions
// Return Ks
scalarField& Ks()
{
return Ks_;
}
// Return Cs
scalarField& Cs()
{
return Cs_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object

View file

@ -40,58 +40,31 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutkWallFunctionFvPatchScalarField::checkType()
{
if (!patch().isWall())
{
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);
}
}
scalar nutkWallFunctionFvPatchScalarField::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> nutkWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& y = turbModel.y()[patchI];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField& nuw = turbModel.nu().boundaryField()[patchi];
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
// Get face cells
const unallocLabelList& fc = patch().faceCells();
forAll(nutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
const label faceCellI = fc[faceI];
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
const scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
if (yPlus > yPlusLam_)
{
@ -103,14 +76,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
@ -119,14 +84,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
}
nutWallFunctionFvPatchScalarField(p, iF)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
@ -136,14 +95,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_(calcYPlusLam(kappa_, E_))
{
checkType();
}
nutWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
@ -154,14 +107,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
@ -169,14 +116,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
@ -185,56 +126,29 @@ 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 * * * * * * * * * * * * * //
void nutkWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcNut());
fixedValueFvPatchScalarField::updateCoeffs();
}
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const label patchI = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& y = turbModel.y()[patchI];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField kwc = k.boundaryField()[patchi].patchInternalField();
const scalarField& nuw = turbModel.nu().boundaryField()[patchi];
const scalarField kwc = k.boundaryField()[patchI].patchInternalField();
const scalarField& nuw = turbModel.nu().boundaryField()[patchI];
return pow025(Cmu_)*y*sqrt(kwc)/nuw;
}
void nutkWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutkWallFunctionFvPatchScalarField);

View file

@ -29,6 +29,18 @@ Description
functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type nutkWallFunction;
}
\endverbatim
See also
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutkWallFunctionFvPatchScalarField.C
@ -37,7 +49,7 @@ SourceFiles
#ifndef nutkWallFunctionFvPatchScalarField_H
#define nutkWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,39 +66,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 Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
@ -159,19 +147,8 @@ public:
// 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;
};

View file

@ -23,7 +23,7 @@ boundaryField
{
walls
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
}

View file

@ -23,7 +23,7 @@ boundaryField
{
piston
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -31,7 +31,7 @@ boundaryField
}
liner
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -39,7 +39,7 @@ boundaryField
}
cylinderHead
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,7 +23,7 @@ boundaryField
{
wall
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,22 +23,22 @@ boundaryField
{
front
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
back
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
wall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
porosityWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
inlet

View file

@ -23,7 +23,7 @@ boundaryField
{
movingWall
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -31,7 +31,7 @@ boundaryField
}
fixedWalls
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,13 +23,13 @@ boundaryField
{
rotor
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
stator
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}

View file

@ -23,25 +23,25 @@ boundaryField
{
front
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
back
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
wall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
porosityWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}

View file

@ -23,25 +23,25 @@ boundaryField
{
front
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
back
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
wall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
porosityWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}

View file

@ -43,7 +43,7 @@ boundaryField
}
prismWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
defaultFaces

View file

@ -33,7 +33,7 @@ boundaryField
}
bladeRotor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
shaftRotor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -49,7 +49,7 @@ boundaryField
}
shroudRotor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -57,7 +57,7 @@ boundaryField
}
bladeStator
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -65,7 +65,7 @@ boundaryField
}
shaftStator
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -73,7 +73,7 @@ boundaryField
}
shroudStator
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
bladeRotor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
shaftRotor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -49,7 +49,7 @@ boundaryField
}
shroudRotor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -57,7 +57,7 @@ boundaryField
}
bladeStator
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -65,7 +65,7 @@ boundaryField
}
shaftStator
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -73,7 +73,7 @@ boundaryField
}
shroudStator
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
blade
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
shaft
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -49,7 +49,7 @@ boundaryField
}
shroud
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
blade
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
shaft
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -49,7 +49,7 @@ boundaryField
}
shroud
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -38,7 +38,7 @@ boundaryField
}
GVBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -46,7 +46,7 @@ boundaryField
}
GVHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -54,7 +54,7 @@ boundaryField
}
GVSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -82,7 +82,7 @@ boundaryField
}
RUBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -90,7 +90,7 @@ boundaryField
}
RUHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -98,7 +98,7 @@ boundaryField
}
RUSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -126,7 +126,7 @@ boundaryField
}
DTHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -134,7 +134,7 @@ boundaryField
}
DTSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -38,7 +38,7 @@ boundaryField
}
GVBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -46,7 +46,7 @@ boundaryField
}
GVHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -54,7 +54,7 @@ boundaryField
}
GVSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -82,7 +82,7 @@ boundaryField
}
RUBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -90,7 +90,7 @@ boundaryField
}
RUHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -98,7 +98,7 @@ boundaryField
}
RUSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -126,7 +126,7 @@ boundaryField
}
DTHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -134,7 +134,7 @@ boundaryField
}
DTSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -38,7 +38,7 @@ boundaryField
}
GVBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -46,7 +46,7 @@ boundaryField
}
GVHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -54,7 +54,7 @@ boundaryField
}
GVSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -82,7 +82,7 @@ boundaryField
}
RUBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -90,7 +90,7 @@ boundaryField
}
RUHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -98,7 +98,7 @@ boundaryField
}
RUSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -126,7 +126,7 @@ boundaryField
}
DTHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -134,7 +134,7 @@ boundaryField
}
DTSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -38,7 +38,7 @@ boundaryField
}
GVBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -46,7 +46,7 @@ boundaryField
}
GVHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -54,7 +54,7 @@ boundaryField
}
GVSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -82,7 +82,7 @@ boundaryField
}
RUBLADE
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -90,7 +90,7 @@ boundaryField
}
RUHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -98,7 +98,7 @@ boundaryField
}
RUSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -126,7 +126,7 @@ boundaryField
}
DTHUB
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -134,7 +134,7 @@ boundaryField
}
DTSHROUD
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -127,7 +127,7 @@ boundaryField
{
movingWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -135,7 +135,7 @@ boundaryField
}
left
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -143,7 +143,7 @@ boundaryField
}
right
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -151,7 +151,7 @@ boundaryField
}
bottom
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -127,7 +127,7 @@ boundaryField
{
movingWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -135,7 +135,7 @@ boundaryField
}
left
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -143,7 +143,7 @@ boundaryField
}
right
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -151,7 +151,7 @@ boundaryField
}
bottom
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,17 +23,17 @@ boundaryField
{
floor
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
ceiling
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
fixedWalls
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
}

View file

@ -23,17 +23,17 @@ boundaryField
{
floor
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
ceiling
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
fixedWalls
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
}

View file

@ -23,25 +23,25 @@ boundaryField
{
ground
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
igloo_region0
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
twoFridgeFreezers_seal_0
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
twoFridgeFreezers_herring_1
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
}

View file

@ -23,17 +23,17 @@ boundaryField
{
floor
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
ceiling
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
fixedWalls
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
}

View file

@ -23,7 +23,7 @@ boundaryField
{
box
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -31,7 +31,7 @@ boundaryField
}
floor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -39,7 +39,7 @@ boundaryField
}
ceiling
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -47,7 +47,7 @@ boundaryField
}
fixedWalls
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,7 +23,7 @@ boundaryField
{
box
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -31,7 +31,7 @@ boundaryField
}
floor
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -39,7 +39,7 @@ boundaryField
}
ceiling
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -47,7 +47,7 @@ boundaryField
}
fixedWalls
{
type mutWallFunction;
type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
5
(
inlet
{
type patch;
nFaces 30;
startFace 24170;
}
outlet
{
type patch;
nFaces 57;
startFace 24200;
}
upperWall
{
type wall;
nFaces 223;
startFace 24257;
}
lowerWall
{
type wall;
nFaces 250;
startFace 24480;
}
frontAndBack
{
type empty;
nFaces 24450;
startFace 24730;
}
)
// ************************************************************************* //

View file

@ -23,7 +23,7 @@ boundaryField
{
pitzDailyIB
{
type nutWallFunction;
type nutkWallFunction;
patchType immersedBoundary;
value uniform 0;
}

View file

@ -38,7 +38,7 @@ boundaryField
}
GVBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -46,7 +46,7 @@ boundaryField
}
GVHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -54,7 +54,7 @@ boundaryField
}
GVSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -82,7 +82,7 @@ boundaryField
}
RUBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -90,7 +90,7 @@ boundaryField
}
RUHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -98,7 +98,7 @@ boundaryField
}
RUSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -126,7 +126,7 @@ boundaryField
}
DTHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -134,7 +134,7 @@ boundaryField
}
DTSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -38,7 +38,7 @@ boundaryField
}
GVBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -46,7 +46,7 @@ boundaryField
}
GVHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -54,7 +54,7 @@ boundaryField
}
GVSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -82,7 +82,7 @@ boundaryField
}
RUBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -90,7 +90,7 @@ boundaryField
}
RUHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -98,7 +98,7 @@ boundaryField
}
RUSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -126,7 +126,7 @@ boundaryField
}
DTHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -134,7 +134,7 @@ boundaryField
}
DTSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,7 +23,7 @@ boundaryField
{
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -31,7 +31,7 @@ boundaryField
}
upperWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,7 +23,7 @@ boundaryField
{
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -31,7 +31,7 @@ boundaryField
}
upperWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
upperWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
upperWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -43,7 +43,7 @@ boundaryField
}
GVBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -51,7 +51,7 @@ boundaryField
}
GVHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -59,7 +59,7 @@ boundaryField
}
GVSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -87,7 +87,7 @@ boundaryField
}
RUBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -95,7 +95,7 @@ boundaryField
}
RUHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -103,7 +103,7 @@ boundaryField
}
RUSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -131,7 +131,7 @@ boundaryField
}
DTHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -139,7 +139,7 @@ boundaryField
}
DTSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -42,8 +42,7 @@ boundaryField
defaultFaces
{
type epsilonWallFunction;
value uniform 0;
type empty;
}
}

View file

@ -42,8 +42,7 @@ boundaryField
defaultFaces
{
type kqRWallFunction;
value uniform 0;
type empty;
}
}

View file

@ -41,8 +41,7 @@ boundaryField
defaultFaces
{
type nutWallFunction;
value uniform 0;
type empty;
}
}

View file

@ -23,12 +23,12 @@ boundaryField
{
movingWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
fixedWalls
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
frontAndBack

View file

@ -23,25 +23,25 @@ boundaryField
{
front
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
back
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
wall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
porosityWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}

View file

@ -23,25 +23,25 @@ boundaryField
{
front
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
back
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
wall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
porosityWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}

View file

@ -41,7 +41,7 @@ boundaryField
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
@ -53,7 +53,7 @@ boundaryField
"motorBike_.*"
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
}

View file

@ -33,7 +33,7 @@ boundaryField
}
upperWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
upperWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -49,7 +49,7 @@ boundaryField
}
lowerWallInterface
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -57,7 +57,7 @@ boundaryField
}
lowerWallInlet
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -43,7 +43,7 @@ boundaryField
}
RUBLADE
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -51,7 +51,7 @@ boundaryField
}
RUHUB
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -59,7 +59,7 @@ boundaryField
}
RUSHROUD
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -33,7 +33,7 @@ boundaryField
}
innerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
@ -41,7 +41,7 @@ boundaryField
}
outerWall
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,17 +23,17 @@ boundaryField
{
top
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
bottom
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
walls
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
symmetry

View file

@ -23,7 +23,7 @@ boundaryField
{
walls
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
inlet

View file

@ -23,7 +23,7 @@ boundaryField
{
walls
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
inlet

View file

@ -23,17 +23,17 @@ boundaryField
{
top
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
bottom
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
walls
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
symmetry

View file

@ -35,7 +35,7 @@ boundaryField
walls
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -23,19 +23,19 @@ boundaryField
{
leftWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
rightWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}
lowerWall
{
type mutWallFunction;
type mutkWallFunction;
value uniform 0;
}

View file

@ -23,17 +23,17 @@ boundaryField
{
leftWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
rightWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
lowerWall
{
type nutWallFunction;
type nutkWallFunction;
value uniform 0;
}
atmosphere

View file

@ -61,7 +61,7 @@ boundaryField
airfoil
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;

View file

@ -61,7 +61,7 @@ boundaryField
airfoil
{
type nutWallFunction;
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;