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 scalar Cmu25 =
pow025(wallCoeffs_.Cmu());
193 const scalar Cmu75 =
pow(wallCoeffs_.Cmu(), 0.75);
194 const scalar
kappa = wallCoeffs_.kappa();
195 const scalar yPlusLam = wallCoeffs_.yPlusLam();
201 const tmp<scalarField> tnuw = turbModel.nu(patchi);
204 const tmp<volScalarField> tk = turbModel.k();
208 const auto yPlus = [&](
const label facei) -> scalar
212 Cmu25*
y[facei]*
sqrt(
k[faceCells[facei]])/nuw[facei]
217 const auto epsilonVis = [&](
const label facei) -> scalar
221 cornerWeights[facei]*2.0*
k[faceCells[facei]]*nuw[facei]
227 const auto epsilonLog = [&](
const label facei) -> scalar
231 cornerWeights[facei]*Cmu75*
pow(
k[faceCells[facei]], 1.5)
238 case blenderType::STEPWISE:
242 if (lowReCorrection_ &&
yPlus(facei) < yPlusLam)
244 epsilon0[faceCells[facei]] += epsilonVis(facei);
248 epsilon0[faceCells[facei]] += epsilonLog(facei);
254 case blenderType::BINOMIAL:
262 pow(epsilonVis(facei), n_) +
pow(epsilonLog(facei), n_),
269 case blenderType::MAX:
275 max(epsilonVis(facei), epsilonLog(facei));
280 case blenderType::EXPONENTIAL:
285 const scalar yPlusFace =
yPlus(facei);
287 0.001*
pow4(yPlusFace)/(scalar(1) + yPlusFace);
288 const scalar invGamma = scalar(1)/(Gamma + ROOTVSMALL);
292 epsilonVis(facei)*
exp(-Gamma)
293 + epsilonLog(facei)*
exp(-invGamma)
299 case blenderType::TANH:
304 const scalar epsilonVisFace = epsilonVis(facei);
305 const scalar epsilonLogFace = epsilonLog(facei);
306 const scalar b1 = epsilonVisFace + epsilonLogFace;
310 pow(epsilonVisFace, 1.2) +
pow(epsilonLogFace, 1.2),
315 epsilon0[faceCells[facei]] += phiTanh*b1 + (1 - phiTanh)*b2;
324 const tmp<scalarField> tnutw = turbModel.nut(patchi);
329 if (!lowReCorrection_ || (
yPlus(facei) > yPlusLam))
331 G0[faceCells[facei]] +=
333 *(nutw[facei] + nuw[facei])
335 *Cmu25*
sqrt(
k[faceCells[facei]])
349 wallCoeffs_.writeEntries(
os);
364 lowReCorrection_(false),
385 lowReCorrection_(ptf.lowReCorrection_),
388 wallCoeffs_(ptf.wallCoeffs_),
405 lowReCorrection_(
dict.getOrDefault(
"lowReCorrection", false)),
426 lowReCorrection_(ewfpsf.lowReCorrection_),
429 wallCoeffs_(ewfpsf.wallCoeffs_),
445 lowReCorrection_(ewfpsf.lowReCorrection_),
448 wallCoeffs_(ewfpsf.wallCoeffs_),
462 if (
patch().index() == master_)
472 return epsilonPatch(master_).G();
481 if (
patch().index() == master_)
491 return epsilonPatch(master_).epsilon(init);
507 internalField().
group()
513 if (
patch().index() == master_)
515 createAveragingWeights();
516 calculateTurbulenceFields(turbModel,
G(
true),
epsilon(
true));
522 typedef DimensionedField<scalar, volMesh> FieldType;
524 FieldType&
G = db().lookupObjectRef<FieldType>(turbModel.GName());
526 FieldType&
epsilon =
const_cast<FieldType&
>(internalField());
530 const label celli =
patch().faceCells()[facei];
532 G[celli] =
G0[celli];
555 internalField().
group()
561 if (
patch().index() == master_)
563 createAveragingWeights();
564 calculateTurbulenceFields(turbModel,
G(
true),
epsilon(
true));
570 typedef DimensionedField<scalar, volMesh> FieldType;
572 FieldType&
G = db().lookupObjectRef<FieldType>(turbModel.GName());
574 FieldType&
epsilon =
const_cast<FieldType&
>(internalField());
581 const scalar w = weights[facei];
585 const label celli =
patch().faceCells()[facei];
587 G[celli] = (1.0 - w)*
G[celli] + w*
G0[celli];
589 epsilonf[facei] =
epsilon[celli];
599 fvMatrix<scalar>& matrix
602 if (manipulatedMatrix())
619 if (manipulatedMatrix())
624 DynamicList<label> constraintCells(weights.
size());
625 DynamicList<scalar> constraintValues(weights.
size());
628 const DimensionedField<scalar, volMesh>&
fld = internalField();
633 if (weights[facei] > tolerance_)
635 const label celli = faceCells[facei];
637 constraintCells.append(celli);
638 constraintValues.append(
fld[celli]);
645 <<
": number of constrained cells = " << constraintCells.size()
646 <<
" out of " <<
patch().size()
662 writeLocalEntries(
os);
674 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.
static bool initialised_(false)
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.
void extrapolateInternal()
Assign the patch field from the internal 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 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.
#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 a time name for the given scalar time value formatted with the given precision.
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 const-reference to the dimensioned internal field.
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.
Do not request registration (bool: false)
scalarField & epsilon(bool init=false)
Return non-const access to the master's epsilon field.
static constexpr const zero Zero
Global zero (0)