further updates en-route to run-time selection functionality for incompressible RAS models
This commit is contained in:
@ -31,7 +31,7 @@ derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsi
|
||||
|
||||
derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
|
||||
|
||||
derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C
|
||||
derivedFvPatchFields/wallFunctions/kQRWallFunctions/kQRWallFunction/kQRWallFunctionFvPatchFields.C
|
||||
|
||||
|
||||
/* Patch fields */
|
||||
|
||||
@ -128,7 +128,7 @@ RASModel::~RASModel()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalar RASModel::yPlusLam(const scalar kappa, const scalar E)
|
||||
scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
@ -150,9 +150,7 @@ tmp<scalarField> RASModel::yPlus(const label patchNo) const
|
||||
|
||||
if (typeid(curPatch) == typeid(wallFvPatch))
|
||||
{
|
||||
scalar Cmu(readScalar(coeffDict_.lookup("Cmu")));
|
||||
|
||||
Yp = pow(Cmu, 0.25)*y_[patchNo]
|
||||
Yp = pow(Cmu_.value(), 0.25)*y_[patchNo]
|
||||
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
|
||||
/nu().boundaryField()[patchNo];
|
||||
}
|
||||
@ -161,9 +159,9 @@ tmp<scalarField> RASModel::yPlus(const label patchNo) const
|
||||
WarningIn
|
||||
(
|
||||
"tmp<scalarField> RASModel::yPlus(const label patchNo)"
|
||||
) << "const : " << endl
|
||||
<< "Patch " << patchNo << " is not a wall. Returning blank field"
|
||||
<< endl;
|
||||
) << "const : " << nl
|
||||
<< "Patch " << patchNo << " is not a wall. Returning zero field"
|
||||
<< nl << endl;
|
||||
|
||||
Yp.setSize(0);
|
||||
}
|
||||
@ -187,9 +185,11 @@ bool RASModel::read()
|
||||
{
|
||||
lookup("turbulence") >> turbulence_;
|
||||
coeffDict_ = subDict(type() + "Coeffs");
|
||||
wallFunctionDict_ = subDict("wallFunctionCoeffs");
|
||||
|
||||
kappa_.readIfPresent(subDict("wallFunctionCoeffs"));
|
||||
E_.readIfPresent(subDict("wallFunctionCoeffs"));
|
||||
kappa_.readIfPresent(wallFunctionDict_);
|
||||
E_.readIfPresent(wallFunctionDict_);
|
||||
Cmu_.readIfPresent(wallFunctionDict_);
|
||||
|
||||
yPlusLam_ = yPlusLam(kappa_.value(), E_.value());
|
||||
|
||||
|
||||
@ -93,7 +93,6 @@ protected:
|
||||
dimensionedScalar E_;
|
||||
dimensionedScalar Cmu_;
|
||||
|
||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
scalar yPlusLam_;
|
||||
|
||||
dimensionedScalar k0_;
|
||||
@ -236,6 +235,9 @@ public:
|
||||
return y_;
|
||||
}
|
||||
|
||||
//- Calculate y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam(const scalar kappa, const scalar E) const;
|
||||
|
||||
//- Return y+ at the edge of the laminar sublayer
|
||||
// for use in wall-functions
|
||||
scalar yPlusLam() const
|
||||
|
||||
@ -140,7 +140,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
volScalarField& epsilon = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>("epsilon"));
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||
const volScalarField& k = db().lookupObject<volScalarField>("k");
|
||||
|
||||
const scalarField& nuw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
@ -158,9 +158,9 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||
|
||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa*y[faceCellI]);
|
||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa*y[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
@ -168,7 +168,11 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
(nutw[faceI] + nuw[faceI])
|
||||
*magGradUw[faceI]
|
||||
*Cmu25*sqrt(k[faceCellI])
|
||||
/(kappa*y[faceCellI]);
|
||||
/(kappa*y[faceI]);
|
||||
}
|
||||
else
|
||||
{
|
||||
G[faceCellI] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -100,83 +100,12 @@ fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void fixedInternalValueFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
{
|
||||
if (!this->updated())
|
||||
{
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
Info<< "fixedInternalValueFvPatchField<Type>::evaluate" << endl;
|
||||
zeroGradientFvPatchField<Type>::evaluate();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::valueInternalCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const
|
||||
{
|
||||
Info<< "fixedInternalValueFvPatchField<Type>::valueInternalCoeffs" << endl;
|
||||
return tmp<Field<Type> >
|
||||
(
|
||||
new Field<Type>(this->size(), pTraits<Type>::one)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::valueBoundaryCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const
|
||||
{
|
||||
Info<< "fixedInternalValueFvPatchField<Type>::valueBoundaryCoeffs" << endl;
|
||||
// return tmp<Field<Type> >
|
||||
// (
|
||||
// new Field<Type>(this->size(), pTraits<Type>::zero)
|
||||
// );
|
||||
return this->patchInternalField();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::
|
||||
gradientInternalCoeffs() const
|
||||
{
|
||||
Info<< "fixedInternalValueFvPatchField<Type>::gradientInternalCoeffs"
|
||||
<< endl;
|
||||
return tmp<Field<Type> >
|
||||
(
|
||||
new Field<Type>(this->size(), pTraits<Type>::zero)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type> > fixedInternalValueFvPatchField<Type>::
|
||||
gradientBoundaryCoeffs() const
|
||||
{
|
||||
Info<< "fixedInternalValueFvPatchField<Type>::gradientBoundaryCoeffs"
|
||||
<< endl;
|
||||
return tmp<Field<Type> >
|
||||
(
|
||||
new Field<Type>(this->size(), pTraits<Type>::zero)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void fixedInternalValueFvPatchField<Type>::manipulateMatrix
|
||||
(
|
||||
fvMatrix<Type>& matrix
|
||||
)
|
||||
{
|
||||
Info<< "fixedInternalValueFvPatchField<Type>::manipulateMatrix(...)"
|
||||
<< endl;
|
||||
|
||||
// Apply the patch internal field as a constraint in the matrix
|
||||
matrix.setValues(this->patch().faceCells(), this->patchInternalField());
|
||||
}
|
||||
|
||||
@ -131,34 +131,6 @@ public:
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
|
||||
);
|
||||
|
||||
//- Return the matrix diagonal coefficients corresponding to the
|
||||
// evaluation of the value of this patchField with given weights
|
||||
virtual tmp<Field<Type> > valueInternalCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const;
|
||||
|
||||
//- Return the matrix source coefficients corresponding to the
|
||||
// evaluation of the value of this patchField with given weights
|
||||
virtual tmp<Field<Type> > valueBoundaryCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const;
|
||||
|
||||
//- Return the matrix diagonal coefficients corresponding to the
|
||||
// evaluation of the gradient of this patchField
|
||||
virtual tmp<Field<Type> > gradientInternalCoeffs() const;
|
||||
|
||||
//- Return the matrix source coefficients corresponding to the
|
||||
// evaluation of the gradient of this patchField
|
||||
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
|
||||
|
||||
//-Manipulate a matrix
|
||||
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
|
||||
};
|
||||
|
||||
@ -45,6 +45,7 @@ namespace RASModels
|
||||
scalar nutRoughWallFunctionFvPatchScalarField::fnRough
|
||||
(
|
||||
const scalar KsPlus,
|
||||
const scalar Cs,
|
||||
const scalar kappa
|
||||
) const
|
||||
{
|
||||
@ -58,15 +59,15 @@ scalar nutRoughWallFunctionFvPatchScalarField::fnRough
|
||||
{
|
||||
deltaB =
|
||||
1.0/kappa
|
||||
*log((KsPlus - 2.25)/87.75 + Cs_*KsPlus)
|
||||
*log((KsPlus - 2.25)/87.75 + Cs*KsPlus)
|
||||
*sin(0.4258*(log(KsPlus) - 0.811));
|
||||
}
|
||||
else
|
||||
{
|
||||
deltaB = 1.0/kappa*(1.0 + Cs_*KsPlus);
|
||||
deltaB = 1.0/kappa*log(1.0 + Cs*KsPlus);
|
||||
}
|
||||
|
||||
return exp(deltaB*kappa);
|
||||
return exp(min(deltaB*kappa, 50.0));
|
||||
}
|
||||
|
||||
|
||||
@ -80,8 +81,8 @@ nutRoughWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
Ks_(0.0),
|
||||
Cs_(0.0)
|
||||
Ks_(p.size(), 0.0),
|
||||
Cs_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -95,8 +96,8 @@ nutRoughWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
Ks_(ptf.Ks_),
|
||||
Cs_(ptf.Cs_)
|
||||
Ks_(ptf.Ks_, mapper),
|
||||
Cs_(ptf.Cs_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
@ -109,8 +110,8 @@ nutRoughWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
Ks_(readScalar(dict.lookup("Ks"))),
|
||||
Cs_(readScalar(dict.lookup("Cs")))
|
||||
Ks_("Ks", dict, p.size()),
|
||||
Cs_("Cs", dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
@ -133,12 +134,41 @@ nutRoughWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(nrwfpsf, iF)
|
||||
fixedValueFvPatchScalarField(nrwfpsf, iF),
|
||||
Ks_(nrwfpsf.Ks_),
|
||||
Cs_(nrwfpsf.Cs_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void nutRoughWallFunctionFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
Ks_.autoMap(m);
|
||||
Cs_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void nutRoughWallFunctionFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const nutRoughWallFunctionFvPatchScalarField& nrwfpsf =
|
||||
refCast<const nutRoughWallFunctionFvPatchScalarField>(ptf);
|
||||
|
||||
Cs_.rmap(nrwfpsf.Cs_, addr);
|
||||
Ks_.rmap(nrwfpsf.Ks_, addr);
|
||||
}
|
||||
|
||||
|
||||
void nutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
@ -147,7 +177,6 @@ void nutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
const scalar kappa = ras.kappa().value();
|
||||
const scalar E = ras.E().value();
|
||||
const scalar yPlusLam = ras.yPlusLam();
|
||||
|
||||
const scalarField& y = ras.y()[patch().index()];
|
||||
|
||||
@ -164,11 +193,13 @@ void nutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
|
||||
scalar uStar = Cmu25*sqrt(k[faceCellI]);
|
||||
|
||||
scalar yPlus = uStar*y[faceCellI]/nuw[faceI];
|
||||
scalar yPlus = uStar*y[faceI]/nuw[faceI];
|
||||
|
||||
scalar KsPlus = uStar*Ks_/nuw[faceI];
|
||||
scalar KsPlus = uStar*Ks_[faceI]/nuw[faceI];
|
||||
|
||||
scalar Edash = E/fnRough(KsPlus, kappa);
|
||||
scalar Edash = E/fnRough(KsPlus, Cs_[faceI], kappa);
|
||||
|
||||
scalar yPlusLam = ras.yPlusLam(kappa, Edash);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
|
||||
@ -32,6 +32,9 @@ Description
|
||||
Manipulates the E parameter to account for roughness effects, based on
|
||||
KsPlus.
|
||||
|
||||
- roughness height = sand-grain roughness (0 for smooth walls)
|
||||
- roughness constant = 0.5-1.0 (0.5 default)
|
||||
|
||||
SourceFiles
|
||||
nutRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
@ -62,16 +65,21 @@ class nutRoughWallFunctionFvPatchScalarField
|
||||
// Private data
|
||||
|
||||
//- Roughness height
|
||||
scalar Ks_;
|
||||
scalarField Ks_;
|
||||
|
||||
//- Roughness constant
|
||||
scalar Cs_;
|
||||
scalarField Cs_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Compute the roughness function
|
||||
scalar fnRough(const scalar KsPlus, const scalar kappa) const;
|
||||
scalar fnRough
|
||||
(
|
||||
const scalar KsPlus,
|
||||
const scalar Cs,
|
||||
const scalar kappa
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -145,6 +153,21 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
|
||||
@ -112,7 +112,7 @@ void nutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
|
||||
const scalarField& y = ras.y()[patch().index()];
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||
const volScalarField& k = db().lookupObject<volScalarField>("k");
|
||||
|
||||
const scalarField& nuw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
@ -123,7 +123,7 @@ void nutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
|
||||
@ -130,7 +130,7 @@ kEpsilon::kEpsilon
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
@ -219,6 +219,11 @@ void kEpsilon::correct()
|
||||
|
||||
RASModel::correct();
|
||||
|
||||
if (mesh_.changing())
|
||||
{
|
||||
y_.correct();
|
||||
}
|
||||
|
||||
volScalarField G("G", nut_*2*magSqr(symm(fvc::grad(U_))));
|
||||
|
||||
// Update espsilon and G at the wall
|
||||
|
||||
Reference in New Issue
Block a user