56 if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi]))
103 if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi]))
105 epsilonPatches.
append(patchi);
117 for (
const auto& patchi : epsilonPatches)
123 G_.setSize(internalField().size(),
Zero);
124 epsilon_.setSize(internalField().size(),
Zero);
142 refCast<const epsilonWallFunctionFvPatchScalarField>(bf[patchi]);
156 forAll(cornerWeights_, patchi)
158 if (!cornerWeights_[patchi].empty())
169 forAll(cornerWeights_, patchi)
171 if (!cornerWeights_[patchi].empty())
190 const label patchi = patch.index();
207 const scalar Cmu25 =
pow025(wallCoeffs_.Cmu());
208 const scalar Cmu75 =
pow(wallCoeffs_.Cmu(), 0.75);
209 const scalar kappa = wallCoeffs_.kappa();
210 const scalar yPlusLam = wallCoeffs_.yPlusLam();
215 const label celli = patch.faceCells()[facei];
217 const scalar
yPlus = Cmu25*
y[facei]*
sqrt(
k[celli])/nuw[facei];
219 const scalar w = cornerWeights[facei];
222 const scalar epsilonVis = w*2.0*
k[celli]*nuw[facei]/
sqr(
y[facei]);
225 const scalar epsilonLog = w*Cmu75*
pow(
k[celli], 1.5)/(kappa*
y[facei]);
229 case blenderType::STEPWISE:
231 if (lowReCorrection_ &&
yPlus < yPlusLam)
233 epsilon0[celli] += epsilonVis;
237 epsilon0[celli] += epsilonLog;
242 case blenderType::BINOMIAL:
248 pow(epsilonVis, n_) +
pow(epsilonLog, n_),
254 case blenderType::MAX:
257 epsilon0[celli] +=
max(epsilonVis, epsilonLog);
261 case blenderType::EXPONENTIAL:
265 const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
267 epsilonVis*
exp(-Gamma) + epsilonLog*
exp(-invGamma);
271 case blenderType::TANH:
275 const scalar b1 = epsilonVis + epsilonLog;
277 pow(
pow(epsilonVis, 1.2) +
pow(epsilonLog, 1.2), 1.0/1.2);
279 epsilon0[celli] += phiTanh*b1 + (1 - phiTanh)*b2;
284 if (!lowReCorrection_ || (
yPlus > yPlusLam))
288 *(nutw[facei] + nuw[facei])
290 *Cmu25*
sqrt(
k[celli])
304 wallCoeffs_.writeEntries(
os);
310Foam::epsilonWallFunctionFvPatchScalarField::
311epsilonWallFunctionFvPatchScalarField
319 lowReCorrection_(false),
329Foam::epsilonWallFunctionFvPatchScalarField::
330epsilonWallFunctionFvPatchScalarField
340 lowReCorrection_(ptf.lowReCorrection_),
343 wallCoeffs_(ptf.wallCoeffs_),
350Foam::epsilonWallFunctionFvPatchScalarField::
351epsilonWallFunctionFvPatchScalarField
360 lowReCorrection_(
dict.getOrDefault(
"lowReCorrection", false)),
373Foam::epsilonWallFunctionFvPatchScalarField::
374epsilonWallFunctionFvPatchScalarField
381 lowReCorrection_(ewfpsf.lowReCorrection_),
384 wallCoeffs_(ewfpsf.wallCoeffs_),
391Foam::epsilonWallFunctionFvPatchScalarField::
392epsilonWallFunctionFvPatchScalarField
400 lowReCorrection_(ewfpsf.lowReCorrection_),
403 wallCoeffs_(ewfpsf.wallCoeffs_),
417 if (patch().index() == master_)
427 return epsilonPatch(master_).G();
436 if (patch().index() == master_)
446 return epsilonPatch(master_).epsilon(init);
462 internalField().group()
468 if (patch().index() == master_)
470 createAveragingWeights();
471 calculateTurbulenceFields(turbModel, G(
true),
epsilon(
true));
479 FieldType& G = db().lookupObjectRef<FieldType>(turbModel.GName());
481 FieldType&
epsilon =
const_cast<FieldType&
>(internalField());
485 const label celli = patch().faceCells()[facei];
487 G[celli] = G0[celli];
488 epsilon[celli] = epsilon0[celli];
510 internalField().group()
516 if (patch().index() == master_)
518 createAveragingWeights();
519 calculateTurbulenceFields(turbModel, G(
true),
epsilon(
true));
527 FieldType& G = db().lookupObjectRef<FieldType>(turbModel.GName());
529 FieldType&
epsilon =
const_cast<FieldType&
>(internalField());
536 const scalar w = weights[facei];
540 const label celli = patch().faceCells()[facei];
542 G[celli] = (1.0 - w)*G[celli] + w*G0[celli];
544 epsilonf[facei] =
epsilon[celli];
557 if (manipulatedMatrix())
574 if (manipulatedMatrix())
588 if (weights[facei] > tolerance_)
592 constraintCells.
append(celli);
599 Pout<<
"Patch: " << patch().name()
600 <<
": number of constrained cells = " << constraintCells.
size()
601 <<
" out of " << patch().size()
605 matrix.
setValues(constraintCells, constraintValues);
617 writeLocalEntries(
os);
618 writeEntry(
"value",
os);
Macros for easy insertion into run-time selection tables.
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
static word timeName(const scalar t, const int precision=precision_)
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements in the list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
This boundary condition provides wall functions for the turbulent kinetic energy dissipation rate (i....
void writeLocalEntries(Ostream &) const
Write local wall function variables.
virtual void manipulateMatrix(fvMatrix< scalar > &matrix)
Manipulate matrix.
static scalar tolerance_
Tolerance used in weighted calculations.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void createAveragingWeights()
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &epsilon)
Calculate the epsilon and G.
virtual label & master()
Return non-const access to the master patch ID.
label master_
Master patch ID.
virtual void updateWeightedCoeffs(const scalarField &weights)
Update the coefficients associated with the patch field.
virtual epsilonWallFunctionFvPatchScalarField & epsilonPatch(const label patchi)
Helper function to return non-const access to an epsilon patch.
virtual void calculateTurbulenceFields(const turbulenceModel &turbulence, scalarField &G0, scalarField &epsilon0)
Main driver to calculate the turbulence fields.
Smooth ATC in cells next to a set of patches supplied by type.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual bool write()
Write the output fields.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
void setValues(const labelUList &cellLabels, const Type &value)
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
A FieldMapper for finite-volume patch fields.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void manipulateMatrix(fvMatrix< Type > &matrix)
Manipulate matrix.
const DimensionedField< Type, volMesh > & internalField() const
Return dimensioned internal field reference.
const fvPatch & patch() const
Return patch.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual const labelUList & faceCells() const
Return faceCells.
bool changing() const noexcept
Is mesh changing (topology changing and/or moving)
A class for managing temporary objects.
Abstract base class for turbulence models (RAS, LES and laminar).
const volVectorField & U() const
Access function to velocity field.
static const word propertiesName
Default name of the turbulence properties dictionary.
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
virtual tmp< volScalarField > nu() const =0
Return the laminar viscosity.
virtual tmp< volScalarField > nut() const =0
Return the turbulence viscosity.
const nearWallDist & y() const
Return the near wall distances.
The class wallFunctionBlenders is a base class that hosts common entries for various derived wall-fun...
void writeEntries(Ostream &) const
Write wall-function blending data as dictionary entries.
blenderType
Options for the blending treatment of viscous and inertial sublayers.
OBJstream os(runTime.globalPath()/outputName)
compressible::turbulenceModel & turbulence
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
const dimensionedScalar G
Newtonian constant of gravitation.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar exp(const dimensionedScalar &ds)
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar tanh(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensionedScalar pow4(const dimensionedScalar &ds)
static constexpr const zero Zero
Global zero (0)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensionedScalar pow025(const dimensionedScalar &ds)
#define forAll(list, i)
Loop across all elements in list.