35 Foam::omegaWallFunctionFvPatchScalarField::calculate
42 const nutWallFunctionFvPatchScalarField& nutw =
47 const tmp<scalarField> tnuw = mtm.nu(
patchi);
50 const tmp<volScalarField> tk = mtm.k();
57 const VolInternalField<scalar>& Gvf =
60 const scalar Cmu25 =
pow025(nutw.Cmu());
61 const scalar Cmu5 =
sqrt(nutw.Cmu());
64 Pair<tmp<scalarField>> GandOmega
77 const scalar
Rey =
y[facei]*
sqrt(
k[celli])/nuw[facei];
83 const scalar lamFrac =
exp(-
Rey/11);
84 const scalar turbFrac = 1 - lamFrac;
86 const scalar uStar =
sqrt
88 lamFrac*nuw[facei]*magGradUw[facei] + turbFrac*Cmu5*
k[celli]
91 const scalar omegaVis = 6*nuw[facei]/(beta1_*
sqr(
y[facei]));
92 const scalar omegaLog = uStar/(Cmu5*nutw.kappa()*
y[facei]);
97 *
sqr(uStar*magGradUw[facei]*
y[facei]/
uPlus)
98 /(nuw[facei]*nutw.kappa()*
yPlus);
100 omega[facei] = lamFrac*omegaVis + turbFrac*omegaLog;
104 if (
yPlus < nutw.yPlusLam())
106 const scalar omegaVis = 6*nuw[facei]/(beta1_*
sqr(
y[facei]));
108 G[facei] = Gvf[celli];
110 omega[facei] = omegaVis;
114 const scalar uStar =
sqrt(Cmu5*
k[celli]);
115 const scalar omegaLog = uStar/(Cmu5*nutw.kappa()*
y[facei]);
118 sqr(uStar*magGradUw[facei]*
y[facei]/
uPlus)
119 /(nuw[facei]*nutw.kappa()*
yPlus);
121 omega[facei] = omegaLog;
130 void Foam::omegaWallFunctionFvPatchScalarField::updateCoeffsMaster()
132 if (patch().index() != masterPatchIndex())
142 VolInternalField<scalar>&
G =
143 db().lookupObjectRef<VolInternalField<scalar>>(mtm.GName());
159 PtrList<scalarField> Gpfs(omegaBf.size());
160 PtrList<scalarField> omegaPfs(omegaBf.size());
163 if (isA<omegaWallFunctionFvPatchScalarField>(omegaBf[
patchi]))
165 const omegaWallFunctionFvPatchScalarField& omegaPf =
166 refCast<const omegaWallFunctionFvPatchScalarField>
169 Pair<tmp<scalarField>> GandOmega = omegaPf.calculate(mtm);
171 Gpfs.set(
patchi, GandOmega.first().ptr());
172 omegaPfs.set(
patchi, GandOmega.second().ptr());
177 wallCellGPtr_.reset(patchFieldsToWallCellField(Gpfs).ptr());
178 wallCellOmegaPtr_.reset(patchFieldsToWallCellField(omegaPfs).ptr());
181 UIndirectList<scalar>(
G, wallCells()) =
183 + wallCellFraction()*wallCellGPtr_();
184 UIndirectList<scalar>(
omega, wallCells()) =
186 + wallCellFraction()*wallCellOmegaPtr_();
190 void Foam::omegaWallFunctionFvPatchScalarField::manipulateMatrixMaster
192 fvMatrix<scalar>& matrix
195 if (patch().index() != masterPatchIndex())
200 matrix.setValues(wallCells(), wallCellOmegaPtr_(), wallCellFraction());
214 beta1_(
dict.lookupOrDefault<scalar>(
"beta1", 0.075)),
215 blended_(
dict.lookupOrDefault<
Switch>(
"blended", false)),
216 wallCellGPtr_(nullptr),
217 wallCellOmegaPtr_(nullptr)
231 blended_(ptf.blended_),
232 wallCellGPtr_(nullptr),
233 wallCellOmegaPtr_(nullptr)
244 beta1_(owfpsf.beta1_),
245 blended_(owfpsf.blended_),
246 wallCellGPtr_(nullptr),
247 wallCellOmegaPtr_(nullptr)
260 wallCellGPtr_.clear();
261 wallCellOmegaPtr_.clear();
271 wallCellGPtr_.clear();
272 wallCellOmegaPtr_.clear();
285 updateCoeffsMaster();
298 if (manipulatedMatrix())
303 if (masterPatchIndex() == -1)
306 <<
"updateCoeffs must be called before manipulateMatrix"
310 manipulateMatrixMaster(matrix);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
GeometricBoundaryField< Type, GeoMesh, PrimitiveField > Boundary
Type of the boundary field.
label size() const
Return the number of elements in the UList.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
An ordered pair of two objects of type <Type> with first() and second() elements.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Abstract base class for field mapping.
virtual void write(Ostream &) const
Write.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const objectRegistry & db() const
Return local objectRegistry.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void manipulateMatrix(fvMatrix< Type > &matrix)
Manipulate matrix.
const fvPatch & patch() const
Return patch.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
label index() const
Return the index of this patch in the fvBoundaryMesh.
virtual const labelUList & faceCells() const
Return faceCells.
static const nutWallFunctionFvPatchScalarField & nutw(const momentumTransportModel &turbModel, const label patchi)
Return the nut patchField for the given wall patch.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
This boundary condition provides a wall constraint on turbulnce specific dissipation,...
virtual void write(Ostream &) const
Write.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual void manipulateMatrix(fvMatrix< scalar > &matrix)
Manipulate matrix.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
omegaWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
Base class for wall functions that modify cell values.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
compressibleMomentumTransportModel momentumTransportModel
const dimensionedScalar G
Newtonian constant of gravitation.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar exp(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
void pow025(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
VolField< scalar > volScalarField
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
fvPatchField< vector > fvPatchVectorField