33 namespace functionObjects
39 populationBalanceMoments,
53 >::names[] = {
"integerMoment",
"mean",
"variance",
"stdDev"};
72 >::names[] = {
"volume",
"area",
"diameter"};
93 "numberConcentration",
94 "volumeConcentration",
111 const char* NamedEnum
115 >::names[] = {
"arithmetic",
"geometric",
"notApplicable"};
130 Foam::functionObjects::populationBalanceMoments::coordinateTypeSymbolicName()
134 switch (coordinateType_)
136 case coordinateType::volume:
138 coordinateTypeSymbolicName =
"v";
142 case coordinateType::area:
144 coordinateTypeSymbolicName =
"a";
148 case coordinateType::diameter:
150 coordinateTypeSymbolicName =
"d";
156 return coordinateTypeSymbolicName;
161 Foam::functionObjects::populationBalanceMoments::weightTypeSymbolicName()
167 case weightType::numberConcentration:
169 weightTypeSymbolicName =
"N";
173 case weightType::volumeConcentration:
175 weightTypeSymbolicName =
"V";
179 case weightType::areaConcentration:
181 weightTypeSymbolicName =
"A";
187 return weightTypeSymbolicName;
191 Foam::word Foam::functionObjects::populationBalanceMoments::defaultFldName()
195 meanType_ == meanType::geometric
196 ? word(meanTypeNames_[meanType_]).capitalise()
207 + word(momentTypeNames_[momentType_]).capitalise()
209 + weightTypeSymbolicName()
211 + coordinateTypeSymbolicName()
220 Foam::functionObjects::populationBalanceMoments::integerMomentFldName()
227 word(momentTypeNames_[momentType_])
230 + weightTypeSymbolicName()
232 + coordinateTypeSymbolicName()
240 void Foam::functionObjects::populationBalanceMoments::setDimensions
248 case momentType::integerMoment:
250 switch (coordinateType_)
252 case coordinateType::volume:
254 fld.dimensions().reset
261 case coordinateType::area:
263 fld.dimensions().reset
270 case coordinateType::diameter:
272 fld.dimensions().reset
283 case weightType::volumeConcentration:
285 fld.dimensions().reset(fld.dimensions()*
dimVolume);
289 case weightType::areaConcentration:
291 fld.dimensions().reset(fld.dimensions()*
dimArea);
303 case momentType::mean:
305 switch (coordinateType_)
307 case coordinateType::volume:
313 case coordinateType::area:
315 fld.dimensions().reset(
dimArea);
319 case coordinateType::diameter:
329 case momentType::variance:
331 switch (coordinateType_)
333 case coordinateType::volume:
339 case coordinateType::area:
345 case coordinateType::diameter:
353 if (meanType_ == meanType::geometric)
355 fld.dimensions().reset(
dimless);
360 case momentType::stdDev:
362 switch (coordinateType_)
364 case coordinateType::volume:
370 case coordinateType::area:
372 fld.dimensions().reset(
dimArea);
376 case coordinateType::diameter:
384 if (meanType_ == meanType::geometric)
386 fld.dimensions().reset(
dimless);
396 Foam::functionObjects::populationBalanceMoments::totalConcentration()
398 tmp<volScalarField> tTotalConcentration
402 "totalConcentration",
412 case weightType::volumeConcentration:
416 totalConcentration.dimensions()*
dimVolume 421 case weightType::areaConcentration:
423 totalConcentration.dimensions().reset
425 totalConcentration.dimensions()*
dimArea 436 forAll(popBal_.sizeGroups(), i)
442 case weightType::numberConcentration:
444 totalConcentration += fi*fi.
phase()/fi.
x();
448 case weightType::volumeConcentration:
450 totalConcentration += fi*fi.
phase();
454 case weightType::areaConcentration:
456 totalConcentration += fi.
a()*fi*fi.
phase()/fi.
x();
463 return tTotalConcentration;
468 Foam::functionObjects::populationBalanceMoments::mean()
470 tmp<volScalarField> tMean
482 setDimensions(mean, momentType::mean);
486 forAll(popBal_.sizeGroups(), i)
494 case weightType::volumeConcentration:
496 concentration *= fi.
x();
500 case weightType::areaConcentration:
502 concentration *= fi.
a();
514 case meanType::geometric:
516 mean.dimensions().reset(
dimless);
518 switch (coordinateType_)
520 case coordinateType::volume:
526 *concentration/totalConcentration;
530 case coordinateType::area:
536 *concentration/totalConcentration;
540 case coordinateType::diameter:
546 *concentration/totalConcentration;
556 switch (coordinateType_)
558 case coordinateType::volume:
560 mean += fi.
x()*concentration/totalConcentration;
564 case coordinateType::area:
566 mean += fi.
a()*concentration/totalConcentration;
570 case coordinateType::diameter:
572 mean += fi.
d()*concentration/totalConcentration;
583 if (meanType_ == meanType::geometric)
587 setDimensions(mean, momentType::mean);
595 Foam::functionObjects::populationBalanceMoments::variance()
597 tmp<volScalarField> tVariance
609 setDimensions(variance, momentType::variance);
614 forAll(popBal_.sizeGroups(), i)
622 case weightType::volumeConcentration:
624 concentration *= fi.
x();
628 case weightType::areaConcentration:
630 concentration *= fi.
a();
642 case meanType::geometric:
644 switch (coordinateType_)
646 case coordinateType::volume:
650 *concentration/totalConcentration;
654 case coordinateType::area:
658 *concentration/totalConcentration;
662 case coordinateType::diameter:
666 *concentration/totalConcentration;
676 switch (coordinateType_)
678 case coordinateType::volume:
681 sqr(fi.
x() - mean)*concentration/totalConcentration;
686 case coordinateType::area:
689 sqr(fi.
a() - mean)*concentration/totalConcentration;
693 case coordinateType::diameter:
696 sqr(fi.
d() - mean)*concentration/totalConcentration;
712 Foam::functionObjects::populationBalanceMoments::stdDev()
716 case meanType::geometric:
718 return exp(
sqrt(this->variance()));
722 return sqrt(this->variance());
734 const dictionary& dict
737 fvMeshFunctionObject(name, runTime, dict),
740 obr_.lookupObject<
Foam::diameterModels::populationBalanceModel>
742 dict.
lookup(
"populationBalance")
745 momentType_(momentTypeNames_.
read(dict.
lookup(
"momentType"))),
746 coordinateType_(coordinateTypeNames_.
read(dict.
lookup(
"coordinateType"))),
749 dict.
found(
"weightType")
750 ? weightTypeNames_.
read(dict.
lookup(
"weightType"))
751 : weightType::numberConcentration
753 meanType_(meanType::notApplicable),
776 case momentType::integerMoment:
778 order_ = dict.lookup<
int>(
"order");
785 dict.found(
"meanType")
786 ? meanTypeNames_.read(dict.lookup(
"meanType"))
787 : meanType::arithmetic;
795 case momentType::integerMoment:
803 this->integerMomentFldName(),
816 setDimensions(integerMoment, momentType::integerMoment);
820 case momentType::mean:
828 this->defaultFldName(),
840 case momentType::variance:
848 this->defaultFldName(),
860 case momentType::stdDev:
868 this->defaultFldName(),
890 case momentType::integerMoment:
894 integerMoment =
Zero;
896 forAll(popBal_.sizeGroups(), i)
899 popBal_.sizeGroups()[i];
905 case weightType::volumeConcentration:
907 concentration *= fi.
x();
911 case weightType::areaConcentration:
913 concentration *= fi.
a();
923 switch (coordinateType_)
925 case coordinateType::volume:
928 pow(fi.
x(), order_)*concentration;
932 case coordinateType::area:
935 pow(fi.
a(), order_)*concentration;
939 case coordinateType::diameter:
942 pow(fi.
d(), order_)*concentration;
951 case momentType::mean:
953 fldPtr_() = this->mean();
957 case momentType::variance:
959 fldPtr_() = this->variance();
963 case momentType::stdDev:
965 fldPtr_() =
sqrt(this->variance());
#define forAll(list, i)
Loop across all elements in list.
const dimensionSet dimArea
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
virtual bool read(const dictionary &)
Read the data.
dimensionedScalar log(const dimensionedScalar &ds)
bool writeObject(const word &fieldName)
Write field if present in objectRegistry.
weightType
Enumeration for the weight types.
virtual bool write()
Write the moment fields.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
populationBalanceMoments(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< scalar >> &)
Return a temporary field constructed from name,.
dimensionedScalar sqrt(const dimensionedScalar &ds)
static const NamedEnum< momentType, 4 > momentTypeNames_
Names of the moment types.
const tmp< volScalarField > d() const
Return representative diameter of the sizeGroup.
const dimensionSet dimless
const Time & time() const
Return the top-level database.
momentType
Enumeration for the moment types.
Initialise the NamedEnum HashTable from the static list of names.
const phaseModel & phase() const
Return const-reference to the phase.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimLength
static const NamedEnum< coordinateType, 3 > coordinateTypeNames_
Names of the coordinate types.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const tmp< volScalarField > a() const
Return representative surface area of the sizeGroup.
static const NamedEnum< meanType, 3 > meanTypeNames_
Names of the mean types.
const dimensionSet & dimensions() const
Return dimensions.
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar exp(const dimensionedScalar &ds)
Single size class fraction field representing a fixed particle volume as defined by the user through ...
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
static word groupName(Name name, const word &group)
static const NamedEnum< weightType, 3 > weightTypeNames_
Names of the weight types.
static const word null
An empty word.
coordinateType
Enumeration for the coordinate types.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
Internal & ref()
Return a reference to the dimensioned internal field.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void reset(const dimensionSet &)
virtual ~populationBalanceMoments()
Destructor.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimVolume
meanType
Enumeration for the mean types.
A class for managing temporary objects.
const fvMesh & mesh_
Reference to the fvMesh.
virtual bool execute()
Calculate the moment fields.