56 if (isA<omegaWallFunctionFvPatchScalarField>(bf[patchi]))
78 const fvMesh&
mesh = omega.mesh();
100 DynamicList<label> omegaPatches(bf.size());
103 if (isA<omegaWallFunctionFvPatchScalarField>(bf[patchi]))
105 omegaPatches.append(patchi);
107 const labelUList& faceCells = bf[patchi].patch().faceCells();
108 for (
const auto& celli : faceCells)
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);
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())
172 omegaWallFunctionFvPatchScalarField& opf = omegaPatch(patchi);
183 const List<scalar>& cornerWeights,
184 const fvPatch&
patch,
189 const label patchi =
patch.index();
191 const tmp<scalarField> tnutw = turbModel.nut(patchi);
196 const tmp<scalarField> tnuw = turbModel.nu(patchi);
199 const tmp<volScalarField> tk = turbModel.k();
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));
468 typedef DimensionedField<scalar, volMesh> FieldType;
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));
516 typedef DimensionedField<scalar, volMesh> FieldType;
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];
545 fvMatrix<scalar>& matrix
548 if (manipulatedMatrix())
565 if (manipulatedMatrix())
570 DynamicList<label> constraintCells(weights.
size());
571 DynamicList<scalar> constraintValues(weights.
size());
574 const DimensionedField<scalar, volMesh>&
fld = internalField();
579 if (tolerance_ < weights[facei])
581 const label celli = faceCells[facei];
583 constraintCells.append(celli);
584 constraintValues.append(
fld[celli]);
591 <<
": number of constrained cells = " << constraintCells.size()
592 <<
" out of " <<
patch().size()
608 writeLocalEntries(
os);
609 writeEntry(
"value",
os);
620 omegaWallFunctionFvPatchScalarField
dimensionedScalar tanh(const dimensionedScalar &ds)
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
void size(const label n)
Older name for setAddressableSize.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fvPatchField< vector > fvPatchVectorField
const dimensionedScalar G0
Conductance quantum: default SI units: [S].
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const fvPatch & patch() const noexcept
Return the patch.
omegaWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
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.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual void updateWeightedCoeffs(const scalarField &weights)
Update the coefficients associated with the patch field.
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
dimensionedScalar pow025(const dimensionedScalar &ds)
virtual void createAveragingWeights()
Create the averaging weights for cells which are bounded by multiple wall function faces...
scalarField & omega(bool init=false)
Return non-const access to the master's omega field.
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
Type of boundary fields.
label k
Boltzmann constant.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
Smooth ATC in cells next to a set of patches supplied by type.
const Time & time() const
Return the top-level database.
virtual void write(Ostream &) const
Write.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Abstract base class for turbulence models (RAS, LES and laminar).
virtual omegaWallFunctionFvPatchScalarField & omegaPatch(const label patchi)
Helper function to return non-const access to an omega patch.
The class wallFunctionBlenders is a base class that hosts common entries for various derived wall-fun...
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
constexpr const char *const group
Group name for atomic constants.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
dimensionedScalar exp(const dimensionedScalar &ds)
fvPatchField< scalar > fvPatchScalarField
static const word propertiesName
Default name of the turbulence properties dictionary.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
static scalar tolerance_
Tolerance used in weighted calculations.
virtual void write(Ostream &) const
Write.
virtual void calculateTurbulenceFields(const turbulenceModel &turbulence, scalarField &G0, scalarField &omega0)
Main driver to calculate the turbulence fields.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
virtual void manipulateMatrix(fvMatrix< Type > &matrix)
Manipulate matrix.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
scalarField & G(bool init=false)
Return non-const access to the master's G field.
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 time name of given scalar time formatted with the given precision.
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
bool changing() const noexcept
Is mesh changing (topology changing and/or moving)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeLocalEntries(Ostream &) const
Write local wall function variables.
This boundary condition provides a wall function for the specific dissipation rate (i...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void writeEntries(Ostream &) const
Write wall-function blending data as dictionary entries.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensionedScalar pow4(const dimensionedScalar &ds)
const DimensionedField< scalar, volMesh > & internalField() const noexcept
Return dimensioned internal field reference.
const std::string patch
OpenFOAM patch number as a std::string.
virtual void setMaster()
Set the master patch - master is responsible for updating all wall function patches.
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
label master_
Master patch ID.
virtual label & master()
Return non-const access to the master patch ID.
virtual void manipulateMatrix(fvMatrix< scalar > &matrix)
Manipulate matrix.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &omega)
Calculate the omega and G.
static constexpr const zero Zero
Global zero (0)