56 if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi]))
100 DynamicList<label> epsilonPatches(bf.size());
103 if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi]))
105 epsilonPatches.append(patchi);
107 const labelUList& faceCells = bf[patchi].patch().faceCells();
108 for (
const auto& faceCell : faceCells)
115 cornerWeights_.
setSize(bf.size());
117 for (
const auto& patchi : epsilonPatches)
120 cornerWeights_[patchi] = 1.0/wf.patchInternalField();
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())
173 epsilonWallFunctionFvPatchScalarField& epf = epsilonPatch(patchi);
184 const List<scalar>& cornerWeights,
185 const fvPatch&
patch,
190 const label patchi =
patch.index();
192 const tmp<scalarField> tnutw = turbModel.nut(patchi);
197 const tmp<scalarField> tnuw = turbModel.nu(patchi);
200 const tmp<volScalarField> tk = turbModel.k();
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)
242 case blenderType::BINOMIAL:
248 pow(epsilonVis, n_) +
pow(epsilonLog, n_),
254 case blenderType::MAX:
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);
319 lowReCorrection_(false),
340 lowReCorrection_(ptf.lowReCorrection_),
343 wallCoeffs_(ptf.wallCoeffs_),
360 lowReCorrection_(
dict.getOrDefault(
"lowReCorrection", false)),
381 lowReCorrection_(ewfpsf.lowReCorrection_),
384 wallCoeffs_(ewfpsf.wallCoeffs_),
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));
477 typedef DimensionedField<scalar, volMesh> FieldType;
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];
510 internalField().
group()
516 if (
patch().index() == master_)
518 createAveragingWeights();
519 calculateTurbulenceFields(turbModel,
G(
true),
epsilon(
true));
525 typedef DimensionedField<scalar, volMesh> FieldType;
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];
554 fvMatrix<scalar>& matrix
557 if (manipulatedMatrix())
574 if (manipulatedMatrix())
579 DynamicList<label> constraintCells(weights.
size());
580 DynamicList<scalar> constraintValues(weights.
size());
583 const DimensionedField<scalar, volMesh>&
fld = internalField();
588 if (weights[facei] > tolerance_)
590 const label celli = faceCells[facei];
592 constraintCells.append(celli);
593 constraintValues.append(
fld[celli]);
600 <<
": number of constrained cells = " << constraintCells.size()
601 <<
" out of " <<
patch().size()
617 writeLocalEntries(
os);
618 writeEntry(
"value",
os);
629 epsilonWallFunctionFvPatchScalarField
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.
fvPatchField< vector > fvPatchVectorField
void writeLocalEntries(Ostream &) const
Write local wall function variables.
const dimensionedScalar G0
Conductance quantum: default SI units: [S].
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &epsilon)
Calculate the epsilon and G.
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.
virtual void write(Ostream &) const
Write.
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)
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 manipulateMatrix(fvMatrix< scalar > &matrix)
Manipulate matrix.
static scalar tolerance_
Tolerance used in weighted calculations.
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 epsilon0
Electric constant: default SI units: [F/m].
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Abstract base class for turbulence models (RAS, LES and laminar).
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.
virtual void operator==(const fvPatchField< scalar > &)
#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.
label master_
Master patch ID.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
dimensionedScalar exp(const dimensionedScalar &ds)
virtual label & master()
Return non-const access to the master patch ID.
fvPatchField< scalar > fvPatchScalarField
static const word propertiesName
Default name of the turbulence properties dictionary.
virtual void calculateTurbulenceFields(const turbulenceModel &turbulence, scalarField &G0, scalarField &epsilon0)
Main driver to calculate the turbulence fields.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch 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.
This boundary condition provides wall functions for the turbulent kinetic energy dissipation rate (i...
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.
virtual void updateCoeffs()
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.
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.
virtual tmp< Field< scalar > > patchInternalField() const
Return internal field next to patch as patch field.
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
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)
virtual void updateWeightedCoeffs(const scalarField &weights)
Update the coefficients associated with the patch field.
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.
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
virtual void setMaster()
Set the master patch - master is responsible for updating all wall function patches.
virtual void createAveragingWeights()
Create the averaging weights for cells which are bounded by multiple wall function faces...
epsilonWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
scalarField & epsilon(bool init=false)
Return non-const access to the master's epsilon field.
static constexpr const zero Zero
Global zero (0)