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 scalar Cmu25 =
pow025(wallCoeffs_.Cmu());
192 const scalar
kappa = wallCoeffs_.kappa();
193 const scalar yPlusLam = wallCoeffs_.yPlusLam();
199 const tmp<scalarField> tnutw = turbModel.nut(patchi);
202 const tmp<scalarField> tnuw = turbModel.nu(patchi);
205 const tmp<volScalarField> tk = turbModel.k();
209 const auto yPlus = [&](
const label facei) -> scalar
213 Cmu25*
y[facei]*
sqrt(
k[faceCells[facei]])/nuw[facei]
218 const auto omegaVis = [&](
const label facei) -> scalar
222 cornerWeights[facei]*6.0*nuw[facei]/(beta1_*
sqr(
y[facei]))
227 const auto omegaLog = [&](
const label facei) -> scalar
231 cornerWeights[facei]*
sqrt(
k[faceCells[facei]])
238 case blenderType::STEPWISE:
242 if (
yPlus(facei) > yPlusLam)
244 omega0[faceCells[facei]] += omegaLog(facei);
248 omega0[faceCells[facei]] += omegaVis(facei);
254 case blenderType::BINOMIAL:
258 omega0[faceCells[facei]] +=
261 pow(omegaVis(facei), n_) +
pow(omegaLog(facei), n_),
268 case blenderType::MAX:
273 omega0[faceCells[facei]] +=
274 max(omegaVis(facei), omegaLog(facei));
279 case blenderType::EXPONENTIAL:
284 const scalar yPlusFace =
yPlus(facei);
285 const scalar Gamma = 0.01*
pow4(yPlusFace)/(1 + 5*yPlusFace);
286 const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
288 omega0[faceCells[facei]] +=
290 omegaVis(facei)*
exp(-Gamma)
291 + omegaLog(facei)*
exp(-invGamma)
297 case blenderType::TANH:
302 const scalar omegaVisFace = omegaVis(facei);
303 const scalar omegaLogFace = omegaLog(facei);
304 const scalar b1 = omegaVisFace + omegaLogFace;
308 pow(omegaVisFace, 1.2) +
pow(omegaLogFace, 1.2),
313 omega0[faceCells[facei]] += phiTanh*b1 + (1 - phiTanh)*b2;
324 if (!(blender_ == blenderType::STEPWISE) ||
yPlus(facei) > yPlusLam)
326 G0[faceCells[facei]] +=
328 *(nutw[facei] + nuw[facei])
330 *Cmu25*
sqrt(
k[faceCells[facei]])
344 wallCoeffs_.writeEntries(
os);
381 wallCoeffs_(ptf.wallCoeffs_),
399 beta1_(
dict.getOrDefault<scalar>(
"beta1", 0.075)),
406 this->extrapolateInternal();
419 beta1_(owfpsf.beta1_),
420 wallCoeffs_(owfpsf.wallCoeffs_),
437 beta1_(owfpsf.beta1_),
438 wallCoeffs_(owfpsf.wallCoeffs_),
452 if (
patch().index() == master_)
462 return omegaPatch(master_).G();
471 if (
patch().index() == master_)
481 return omegaPatch(master_).omega(init);
497 internalField().
group()
503 if (
patch().index() == master_)
505 createAveragingWeights();
506 calculateTurbulenceFields(turbModel,
G(
true), omega(
true));
512 typedef DimensionedField<scalar, volMesh> FieldType;
514 FieldType&
G = db().lookupObjectRef<FieldType>(turbModel.GName());
516 FieldType& omega =
const_cast<FieldType&
>(internalField());
520 const label celli =
patch().faceCells()[facei];
522 G[celli] =
G0[celli];
523 omega[celli] = omega0[celli];
545 internalField().
group()
551 if (
patch().index() == master_)
553 createAveragingWeights();
554 calculateTurbulenceFields(turbModel,
G(
true), omega(
true));
560 typedef DimensionedField<scalar, volMesh> FieldType;
562 FieldType&
G = db().lookupObjectRef<FieldType>(turbModel.GName());
564 FieldType& omega =
const_cast<FieldType&
>(internalField());
571 const scalar w = weights[facei];
575 const label celli =
patch().faceCells()[facei];
577 G[celli] = (1.0 - w)*
G[celli] + w*
G0[celli];
578 omega[celli] = (1.0 - w)*omega[celli] + w*omega0[celli];
579 omegaf[facei] = omega[celli];
589 fvMatrix<scalar>& matrix
592 if (manipulatedMatrix())
609 if (manipulatedMatrix())
614 DynamicList<label> constraintCells(weights.
size());
615 DynamicList<scalar> constraintValues(weights.
size());
618 const DimensionedField<scalar, volMesh>&
fld = internalField();
623 if (tolerance_ < weights[facei])
625 const label celli = faceCells[facei];
627 constraintCells.append(celli);
628 constraintValues.append(
fld[celli]);
635 <<
": number of constrained cells = " << constraintCells.size()
636 <<
" out of " <<
patch().size()
652 writeLocalEntries(
os);
664 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.
static bool initialised_(false)
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.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
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 a time name for the given scalar time value 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 const-reference to the dimensioned internal field.
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...
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.
Do not request registration (bool: false)
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)