56 if (isA<omegaWallFunctionFvPatchScalarField>(bf[patchi]))
103 if (isA<omegaWallFunctionFvPatchScalarField>(bf[patchi]))
105 omegaPatches.
append(patchi);
116 for (
const auto& patchi : omegaPatches)
122 G_.setSize(internalField().size(), 0.0);
123 omega_.setSize(internalField().size(), 0.0);
141 refCast<const omegaWallFunctionFvPatchScalarField>(bf[patchi]);
155 forAll(cornerWeights_, patchi)
157 if (!cornerWeights_[patchi].empty())
168 forAll(cornerWeights_, patchi)
170 if (!cornerWeights_[patchi].empty())
189 const label patchi = patch.index();
206 const scalar Cmu25 =
pow025(wallCoeffs_.Cmu());
207 const scalar kappa = wallCoeffs_.kappa();
208 const scalar yPlusLam = wallCoeffs_.yPlusLam();
213 const label celli = patch.faceCells()[facei];
214 const scalar
yPlus = Cmu25*
y[facei]*
sqrt(
k[celli])/nuw[facei];
215 const scalar w = cornerWeights[facei];
218 const scalar omegaVis = 6.0*nuw[facei]/(beta1_*
sqr(
y[facei]));
221 const scalar omegaLog =
sqrt(
k[celli])/(Cmu25*kappa*
y[facei]);
225 case blenderType::STEPWISE:
227 if (
yPlus > yPlusLam)
229 omega0[celli] += w*omegaLog;
233 omega0[celli] += w*omegaVis;
238 case blenderType::BINOMIAL:
243 pow(omegaVis, n_) +
pow(omegaLog, n_),
249 case blenderType::MAX:
252 omega0[celli] +=
max(omegaVis, omegaLog);
256 case blenderType::EXPONENTIAL:
260 const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
263 w*(omegaVis*
exp(-Gamma) + omegaLog*
exp(-invGamma));
267 case blenderType::TANH:
271 const scalar b1 = omegaVis + omegaLog;
273 pow(
pow(omegaVis, 1.2) +
pow(omegaLog, 1.2), 1.0/1.2);
275 omega0[celli] += phiTanh*b1 + (1 - phiTanh)*b2;
280 if (!(blender_ == blenderType::STEPWISE) ||
yPlus > yPlusLam)
284 *(nutw[facei] + nuw[facei])
286 *Cmu25*
sqrt(
k[celli])
300 wallCoeffs_.writeEntries(
os);
337 wallCoeffs_(ptf.wallCoeffs_),
355 beta1_(
dict.getOrDefault<scalar>(
"beta1", 0.075)),
375 beta1_(owfpsf.beta1_),
376 wallCoeffs_(owfpsf.wallCoeffs_),
393 beta1_(owfpsf.beta1_),
394 wallCoeffs_(owfpsf.wallCoeffs_),
408 if (patch().index() == master_)
418 return omegaPatch(master_).G();
427 if (patch().index() == master_)
437 return omegaPatch(master_).omega(init);
453 internalField().group()
459 if (patch().index() == master_)
461 createAveragingWeights();
462 calculateTurbulenceFields(turbModel, G(
true), omega(
true));
470 FieldType& G = db().lookupObjectRef<FieldType>(turbModel.GName());
472 FieldType& omega =
const_cast<FieldType&
>(internalField());
476 const label celli = patch().faceCells()[facei];
478 G[celli] = G0[celli];
479 omega[celli] = omega0[celli];
501 internalField().group()
507 if (patch().index() == master_)
509 createAveragingWeights();
510 calculateTurbulenceFields(turbModel, G(
true), omega(
true));
518 FieldType& G = db().lookupObjectRef<FieldType>(turbModel.GName());
520 FieldType& omega =
const_cast<FieldType&
>(internalField());
527 const scalar w = weights[facei];
531 const label celli = patch().faceCells()[facei];
533 G[celli] = (1.0 - w)*G[celli] + w*G0[celli];
534 omega[celli] = (1.0 - w)*omega[celli] + w*omega0[celli];
535 omegaf[facei] = omega[celli];
548 if (manipulatedMatrix())
565 if (manipulatedMatrix())
579 if (tolerance_ < weights[facei])
583 constraintCells.
append(celli);
590 Pout<<
"Patch: " << patch().name()
591 <<
": number of constrained cells = " << constraintCells.
size()
592 <<
" out of " << patch().size()
596 matrix.
setValues(constraintCells, constraintValues);
608 writeLocalEntries(
os);
609 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,...
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.
This boundary condition provides a wall function for the specific dissipation rate (i....
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &omega)
Calculate the omega and G.
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 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.
scalarField & omega(bool init=false)
Return non-const access to the master's omega field.
virtual void calculateTurbulenceFields(const turbulenceModel &turbulence, scalarField &G0, scalarField &omega0)
Main driver to calculate the turbulence fields.
virtual omegaWallFunctionFvPatchScalarField & omegaPatch(const label patchi)
Helper function to return non-const access to an omega patch.
bool changing() const noexcept
Is mesh changing (topology changing and/or moving)
const volScalarField & omega() const
Access functions.
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)
#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.