33 namespace functionObjects
51 {
"integerMoment",
"mean",
"variance",
"stdDev"};
59 {
"volume",
"area",
"diameter"};
68 "numberConcentration",
69 "volumeConcentration",
79 {
"arithmetic",
"geometric",
"notApplicable"};
85 Foam::functionObjects::populationBalanceMoments::coordinateTypeSymbolicName()
89 switch (coordinateType_)
93 coordinateTypeSymbolicName =
"v";
99 coordinateTypeSymbolicName =
"a";
105 coordinateTypeSymbolicName =
"d";
111 return coordinateTypeSymbolicName;
116 Foam::functionObjects::populationBalanceMoments::weightTypeSymbolicName()
122 case weightType::numberConcentration:
124 weightTypeSymbolicName =
"N";
128 case weightType::volumeConcentration:
130 weightTypeSymbolicName =
"V";
134 case weightType::areaConcentration:
136 weightTypeSymbolicName =
"A";
142 return weightTypeSymbolicName;
146 Foam::word Foam::functionObjects::populationBalanceMoments::defaultFldName()
150 meanType_ == meanType::geometric
151 ? word(meanTypeNames_[meanType_]).capitalise()
162 + word(momentTypeNames_[momentType_]).capitalise()
164 + weightTypeSymbolicName()
166 + coordinateTypeSymbolicName()
175 Foam::functionObjects::populationBalanceMoments::integerMomentFldName()
182 word(momentTypeNames_[momentType_])
185 + weightTypeSymbolicName()
187 + coordinateTypeSymbolicName()
195 void Foam::functionObjects::populationBalanceMoments::setDimensions
203 case momentType::integerMoment:
205 switch (coordinateType_)
209 fld.dimensions().reset
218 fld.dimensions().reset
225 case coordinateType::diameter:
227 fld.dimensions().reset
238 case weightType::volumeConcentration:
244 case weightType::areaConcentration:
258 case momentType::mean:
260 switch (coordinateType_)
274 case coordinateType::diameter:
284 case momentType::variance:
286 switch (coordinateType_)
300 case coordinateType::diameter:
308 if (meanType_ == meanType::geometric)
315 case momentType::stdDev:
317 switch (coordinateType_)
331 case coordinateType::diameter:
339 if (meanType_ == meanType::geometric)
351 Foam::functionObjects::populationBalanceMoments::totalConcentration
353 const populationBalanceModel& popBal
356 tmp<volScalarField> tTotalConcentration
360 "totalConcentration",
370 case weightType::volumeConcentration:
372 totalConcentration.dimensions().reset
374 totalConcentration.dimensions()*
dimVolume
379 case weightType::areaConcentration:
381 totalConcentration.dimensions().reset
383 totalConcentration.dimensions()*
dimArea
402 case weightType::numberConcentration:
404 totalConcentration += fi*
alpha/vi;
408 case weightType::volumeConcentration:
410 totalConcentration += fi*
alpha;
414 case weightType::areaConcentration:
416 totalConcentration += popBal.a(i)*fi*
alpha/vi;
423 return tTotalConcentration;
428 Foam::functionObjects::populationBalanceMoments::mean
430 const populationBalanceModel& popBal
433 tmp<volScalarField> tMean
445 setDimensions(mean, momentType::mean);
447 volScalarField totalConcentration(this->totalConcentration(popBal));
459 case weightType::volumeConcentration:
465 case weightType::areaConcentration:
467 concentration *= popBal.a(i);
479 case meanType::geometric:
481 mean.dimensions().reset(
dimless);
483 switch (coordinateType_)
491 *concentration/totalConcentration;
501 *concentration/totalConcentration;
505 case coordinateType::diameter:
511 *concentration/totalConcentration;
521 switch (coordinateType_)
525 mean += vi*concentration/totalConcentration;
531 mean += popBal.a(i)*concentration/totalConcentration;
535 case coordinateType::diameter:
537 mean += popBal.d(i)*concentration/totalConcentration;
548 if (meanType_ == meanType::geometric)
552 setDimensions(mean, momentType::mean);
560 Foam::functionObjects::populationBalanceMoments::variance
562 const populationBalanceModel& popBal
565 tmp<volScalarField> tVariance
577 setDimensions(variance, momentType::variance);
579 volScalarField totalConcentration(this->totalConcentration(popBal));
592 case weightType::volumeConcentration:
598 case weightType::areaConcentration:
600 concentration *= popBal.a(i);
612 case meanType::geometric:
614 switch (coordinateType_)
620 *concentration/totalConcentration;
628 *concentration/totalConcentration;
632 case coordinateType::diameter:
636 *concentration/totalConcentration;
646 switch (coordinateType_)
651 sqr(vi - mean)*concentration/totalConcentration;
658 sqr(popBal.a(i) - mean)
664 case coordinateType::diameter:
667 sqr(popBal.d(i) - mean)
685 Foam::functionObjects::populationBalanceMoments::stdDev
687 const populationBalanceModel& popBal
692 case meanType::geometric:
694 return exp(
sqrt(this->variance(popBal)));
698 return sqrt(this->variance(popBal));
714 popBalName_(
dict.
lookup(
"populationBalance")),
716 coordinateType_(coordinateTypeNames_.
read(
dict.
lookup(
"coordinateType"))),
746 case momentType::integerMoment:
748 order_ =
dict.lookup<
int>(
"order");
755 dict.found(
"meanType")
756 ? meanTypeNames_.read(
dict.lookup(
"meanType"))
757 : meanType::arithmetic;
765 case momentType::integerMoment:
773 this->integerMomentFldName(),
786 setDimensions(integerMoment, momentType::integerMoment);
790 case momentType::mean:
798 this->defaultFldName(),
809 setDimensions(fldPtr_(), momentType::mean);
813 case momentType::variance:
821 this->defaultFldName(),
832 setDimensions(fldPtr_(), momentType::variance);
836 case momentType::stdDev:
844 this->defaultFldName(),
855 setDimensions(fldPtr_(), momentType::stdDev);
872 case momentType::integerMoment:
876 integerMoment =
Zero;
888 case weightType::volumeConcentration:
894 case weightType::areaConcentration:
896 concentration *= popBal.
a(i);
906 switch (coordinateType_)
911 pow(vi, order_)*concentration;
918 pow(popBal.
a(i), order_)*concentration;
922 case coordinateType::diameter:
925 pow(popBal.
d(i), order_)*concentration;
934 case momentType::mean:
936 fldPtr_() = this->mean(popBal);
940 case momentType::variance:
942 fldPtr_() = this->variance(popBal);
946 case momentType::stdDev:
948 fldPtr_() =
sqrt(this->variance(popBal));
960 writeObject(fldPtr_->name());
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static word groupName(Name name, const word &group)
Initialise the NamedEnum HashTable from the static list of names.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Abstract base-class for Time/database functionObjects.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool read(const dictionary &)
Read optional controls.
Calculates and writes out integral (integer moments) or mean properties (mean, variance,...
static const NamedEnum< coordinateType, 3 > coordinateTypeNames_
Names of the coordinate types.
weightType
Enumeration for the weight types.
static const NamedEnum< meanType, 3 > meanTypeNames_
Names of the mean types.
static const NamedEnum< momentType, 4 > momentTypeNames_
Names of the moment types.
static const NamedEnum< weightType, 3 > weightTypeNames_
Names of the weight types.
coordinateType
Enumeration for the coordinate types.
populationBalanceMoments(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
virtual ~populationBalanceMoments()
Destructor.
meanType
Enumeration for the mean types.
virtual bool execute()
Calculate the moment fields.
virtual bool write()
Write the moment fields.
virtual bool read(const dictionary &)
Read the data.
momentType
Enumeration for the moment types.
Model for tracking the evolution of a dispersed phase size distribution due to coalescence (synonymou...
const volScalarField & f(const label i) const
Access a group fraction.
const dimensionedScalar & v(const label i) const
Access the representative volumes diameters of a group.
const UPtrList< const phaseModel > & phases() const
Access the list of phases associated with each group.
const PtrList< volScalarField > & fs() const
Access the group fractions.
tmp< volScalarField > d(const label i) const
Return the representative diameter of the group.
tmp< volScalarField > a(const label i) const
Return the representative surface area of the group.
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionSet volume
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
dimensionedScalar exp(const dimensionedScalar &ds)
const dimensionSet & dimless
bool read(const char *, int32_t &)
const dimensionSet & dimLength
const dimensionSet & dimVolume
dimensionedScalar log(const dimensionedScalar &ds)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void inv(pointPatchField< tensor > &, const pointPatchField< tensor > &)
VolField< scalar > volScalarField
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
const dimensionSet & dimArea
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.