105 omegaPatches.append(patchi);
115 cornerWeights_.setSize(bf.size());
116 for (
const auto& patchi : omegaPatches)
119 cornerWeights_[patchi] = 1.0/wf.patchInternalField();
122 G_.setSize(internalField().size(), 0.0);
155 forAll(cornerWeights_, patchi)
157 if (!cornerWeights_[patchi].empty())
168 forAll(cornerWeights_, patchi)
170 if (!cornerWeights_[patchi].empty())
174 opf ==
scalarField(omega0, opf.patch().faceCells());
189 const label patchi =
patch.index();
191 const scalar Cmu25 =
pow025(wallCoeffs_.Cmu());
192 const scalar
kappa = wallCoeffs_.kappa();
193 const scalar yPlusLam = wallCoeffs_.yPlusLam();
209 const auto yPlus = [&](
const label facei) -> scalar
218 const auto omegaVis = [&](
const label facei) -> scalar
222 6.0*nuw[facei]/(beta1_*
sqr(
y[facei]))
227 const auto omegaLog = [&](
const label facei) -> scalar
232 / (Cmu25*kappa*
y[facei])
238 case blenderType::STEPWISE:
242 if (
yPlus(facei) > yPlusLam)
258 case blenderType::BINOMIAL:
266 pow(omegaVis(facei), n_) +
pow(omegaLog(facei), n_),
273 case blenderType::MAX:
280 *
max(omegaVis(facei), omegaLog(facei));
285 case blenderType::EXPONENTIAL:
290 const scalar yPlusFace =
yPlus(facei);
291 const scalar Gamma = 0.01*
pow4(yPlusFace)/(1 + 5*yPlusFace);
292 const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
297 omegaVis(facei)*
exp(-Gamma)
298 + omegaLog(facei)*
exp(-invGamma)
304 case blenderType::TANH:
309 const scalar omegaVisFace = omegaVis(facei);
310 const scalar omegaLogFace = omegaLog(facei);
311 const scalar b1 = omegaVisFace + omegaLogFace;
315 pow(omegaVisFace, 1.2) +
pow(omegaLogFace, 1.2),
322 *(phiTanh*b1 + (1 - phiTanh)*b2);
333 if (!(blender_ == blenderType::STEPWISE) ||
yPlus(facei) > yPlusLam)
337 *(nutw[facei] + nuw[facei])
352 os.writeEntryIfDifferent<scalar>(
"beta1", 0.075,
beta1_);
408 beta1_(
dict.getOrDefault<scalar>(
"beta1", 0.075)),
428 beta1_(owfpsf.beta1_),
446 beta1_(owfpsf.beta1_),
447 wallCoeffs_(owfpsf.wallCoeffs_),
461 if (patch().index() == master_)
471 return omegaPatch(master_).G();
480 if (patch().index() == master_)
490 return omegaPatch(master_).omega(init);
506 internalField().
group()
512 if (
patch().index() == master_)
514 createAveragingWeights();
515 calculateTurbulenceFields(turbModel,
G(
true), omega(
true));
523 FieldType&
G = db().lookupObjectRef<FieldType>(turbModel.GName());
525 FieldType& omega =
const_cast<FieldType&
>(internalField());
529 const label celli =
patch().faceCells()[facei];
531 G[celli] =
G0[celli];
554 internalField().
group()
560 if (
patch().index() == master_)
562 createAveragingWeights();
563 calculateTurbulenceFields(turbModel,
G(
true), omega(
true));
571 FieldType&
G = db().lookupObjectRef<FieldType>(turbModel.GName());
573 FieldType& omega =
const_cast<FieldType&
>(internalField());
580 const scalar w = weights[facei];
584 const label celli =
patch().faceCells()[facei];
586 G[celli] = (1.0 - w)*G[celli] + w*G0[celli];
587 omega[celli] = (1.0 - w)*omega[celli] + w*omega0[celli];
588 omegaf[facei] = omega[celli];
601 if (manipulatedMatrix())
618 if (manipulatedMatrix())
632 if (tolerance_ < weights[facei])
636 constraintCells.append(celli);
637 constraintValues.append(
fld[celli]);
644 <<
": number of constrained cells = " << constraintCells.size()
645 <<
" out of " <<
patch().size()
649 matrix.setValues(constraintCells, constraintValues);
661 writeLocalEntries(
os);
673 omegaWallFunctionFvPatchScalarField
Macros for easy insertion into run-time selection tables.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-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.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
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...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
bool empty() const noexcept
label size() const noexcept
The number of entries 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...
fixedValueFvPatchField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
A special matrix type and solver, designed for finite volume solutions of scalar equations....
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const objectRegistry & db() const
The associated objectRegistry.
const fvPatch & patch() const noexcept
Return the patch.
bool manipulatedMatrix() const noexcept
True if the matrix has already been manipulated.
bool updated() const noexcept
True if the boundary condition has already been updated.
A FieldMapper for finite-volume patch fields.
virtual void write(Ostream &) const
Write.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
const DimensionedField< scalar, volMesh > & internalField() const noexcept
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void manipulateMatrix(fvMatrix< Type > &matrix)
Manipulate matrix.
void extrapolateInternal()
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....
scalarField G_
Local copy of turbulence G field.
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &omega)
Calculate the omega and G.
List< List< scalar > > cornerWeights_
List of averaging corner weights.
omegaWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
void writeLocalEntries(Ostream &) const
Write local wall function variables.
virtual void manipulateMatrix(fvMatrix< scalar > &matrix)
Manipulate matrix.
bool initialised_
Initialised flag.
static scalar tolerance_
Tolerance used in weighted calculations.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void createAveragingWeights()
Create the averaging weights for cells which are bounded by multiple wall function faces.
scalar beta1_
beta1 coefficient
wallFunctionCoefficients wallCoeffs_
Wall-function coefficients.
virtual label & master()
Return non-const access to the master patch ID.
label master_
Master patch ID.
scalarField & G(bool init=false)
Return non-const access to the master's G field.
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.
scalarField omega_
Local copy of turbulence omega field.
virtual void setMaster()
Set the master patch - master is responsible for updating all wall function patches.
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).
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.
wallFunctionBlenders()
Default construct with default coefficients.
blenderType
Options for the blending treatment of viscous and inertial sublayers.
@ BINOMIAL
"Binomial blending (smooth)"
enum blenderType blender_
Blending treatment.
scalar n_
Binomial blending exponent being used when blenderType is blenderType::BINOMIAL.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
constexpr const char *const group
Group name for atomic constants.
const dimensionedScalar G0
Conductance quantum: default SI units: [S].
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
const dimensionedScalar G
Newtonian constant of gravitation.
Namespace for handling debugging switches.
const std::string patch
OpenFOAM patch number as a std::string.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
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)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
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.
dimensionedScalar sqrt(const dimensionedScalar &ds)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
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.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
UList< label > labelUList
A UList of labels.
fvPatchField< vector > fvPatchVectorField
fvPatchField< scalar > fvPatchScalarField
dimensionedScalar pow025(const dimensionedScalar &ds)
static bool initialised_(false)
#define forAll(list, i)
Loop across all elements in list.