33 namespace functionObjects
39 populationBalanceSizeDistribution,
53 "numberConcentration",
55 "volumeConcentration",
78 "projectedAreaDiameter" 98 "numberConcentration",
99 "volumeConcentration",
119 Foam::functionObjects::populationBalanceSizeDistribution::
120 functionTypeSymbolicName()
124 switch (functionType_)
126 case functionType::numberConcentration:
128 functionTypeSymbolicName =
"N";
132 case functionType::numberDensity:
134 functionTypeSymbolicName =
"n";
138 case functionType::volumeConcentration:
140 functionTypeSymbolicName =
"V";
144 case functionType::volumeDensity:
146 functionTypeSymbolicName =
"v";
150 case functionType::areaConcentration:
152 functionTypeSymbolicName =
"A";
156 case functionType::areaDensity:
158 functionTypeSymbolicName =
"a";
164 return functionTypeSymbolicName;
169 Foam::functionObjects::populationBalanceSizeDistribution::
170 coordinateTypeSymbolicName
172 const coordinateType& cType
179 case coordinateType::volume:
181 coordinateTypeSymbolicName =
"v";
185 case coordinateType::area:
187 coordinateTypeSymbolicName =
"a";
191 case coordinateType::diameter:
193 coordinateTypeSymbolicName =
"d";
197 case coordinateType::projectedAreaDiameter:
199 coordinateTypeSymbolicName =
"dPa";
205 return coordinateTypeSymbolicName;
210 Foam::functionObjects::populationBalanceSizeDistribution::filterField
221 return tmp<scalarField>(
new scalarField(field, cellIDs()));
227 Foam::functionObjects::populationBalanceSizeDistribution::averageCoordinateValue
230 const coordinateType& cType
233 scalar averageCoordinateValue(
Zero);
237 case coordinateType::volume:
239 averageCoordinateValue = fi.
x().
value();
243 case coordinateType::area:
245 averageCoordinateValue =
246 weightedAverage(fi.
a(), fi);
250 case coordinateType::diameter:
252 averageCoordinateValue =
253 weightedAverage(fi.
d(), fi);
257 case coordinateType::projectedAreaDiameter:
259 averageCoordinateValue =
260 weightedAverage(
sqrt(fi.
a()/
pi), fi);
266 return averageCoordinateValue;
271 Foam::functionObjects::populationBalanceSizeDistribution::weightedAverage
277 scalar weightedAverage(
Zero);
281 case weightType::numberConcentration:
288 gSum(filterField(mesh_.V()*
fld))/this->V();
298 case weightType::volumeConcentration:
305 gSum(filterField(mesh_.V()*
fld))/this->V();
315 case weightType::areaConcentration:
322 gSum(filterField(mesh_.V()*
fld))/this->V();
332 case weightType::cellVolume:
335 gSum(filterField(mesh_.V()*
fld))/this->V();
341 return weightedAverage;
352 const dictionary& dict
355 fvMeshFunctionObject(name, runTime, dict),
356 volRegion(fvMeshFunctionObject::mesh_, dict),
358 mesh_(fvMeshFunctionObject::mesh_),
361 obr_.lookupObject<
Foam::diameterModels::populationBalanceModel>
363 dict.
lookup(
"populationBalance")
366 functionType_(functionTypeNames_.
read(dict.
lookup(
"functionType"))),
367 coordinateType_(coordinateTypeNames_.
read(dict.
lookup(
"coordinateType"))),
370 dict.lookupOrDefault<Switch>(
"allCoordinates", false)
372 normalise_(dict.lookupOrDefault<Switch>(
"normalise", false)),
375 dict.lookupOrDefaultBackwardsCompatible<Switch>
377 {
"logTransform",
"geometric"},
383 dict.found(
"weightType")
387 formatterPtr_(
nullptr)
404 const dictionary& dict
427 const UPtrList<diameterModels::sizeGroup>& sizeGroups =
436 const diameterModels::sizeGroup& fi = sizeGroups[i];
438 coordinateValues[i] = averageCoordinateValue(fi, coordinateType_);
443 functionType_ == functionType::numberDensity
444 || functionType_ == functionType::volumeDensity
445 || functionType_ == functionType::areaDensity
448 boundaryValues.first() = coordinateValues.first();
449 boundaryValues.last() = coordinateValues.last();
451 for (
label i = 1; i < boundaryValues.size() - 1; i++)
454 0.5*(coordinateValues[i] + coordinateValues[i-1]);
459 boundaryValues =
Foam::log(boundaryValues);
463 switch (functionType_)
465 case functionType::numberConcentration:
469 const diameterModels::sizeGroup& fi = sizeGroups[i];
472 gSum(filterField(
mesh_.
V()*fi*fi.phase()/fi.x()))/this->V();
475 if (normalise_ &&
sum(resultValues) != 0)
477 resultValues /=
sum(resultValues);
482 case functionType::numberDensity:
486 const diameterModels::sizeGroup& fi = sizeGroups[i];
489 gSum(filterField(
mesh_.
V()*fi*fi.phase()/fi.x()))/this->V();
492 if (normalise_ &&
sum(resultValues) != 0)
494 resultValues /=
sum(resultValues);
499 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
504 case functionType::volumeConcentration:
508 const diameterModels::sizeGroup& fi = sizeGroups[i];
511 gSum(filterField(
mesh_.
V()*fi*fi.phase()))/this->V();
514 if (normalise_ &&
sum(resultValues) != 0)
516 resultValues /=
sum(resultValues);
521 case functionType::volumeDensity:
525 const diameterModels::sizeGroup& fi = sizeGroups[i];
528 gSum(filterField(
mesh_.
V()*fi*fi.phase()))/this->V();
531 if (normalise_ &&
sum(resultValues) != 0)
533 resultValues /=
sum(resultValues);
538 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
543 case functionType::areaConcentration:
547 const diameterModels::sizeGroup& fi = sizeGroups[i];
552 filterField(
mesh_.
V()*fi.a().ref()*fi*fi.phase()/fi.x())
557 if (normalise_ &&
sum(resultValues) != 0)
559 resultValues /=
sum(resultValues);
564 case functionType::areaDensity:
568 const diameterModels::sizeGroup& fi = sizeGroups[i];
573 filterField(
mesh_.
V()*fi.a().ref()*fi*fi.phase()/fi.x())
578 if (normalise_ &&
sum(resultValues) != 0)
580 resultValues /=
sum(resultValues);
585 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
597 typedef NamedEnum<coordinateType, 4> namedEnumCoordinateType;
603 otherCoordinateSymbolicNames[cType] =
604 coordinateTypeSymbolicName(cType);
606 otherCoordinateValues.set
614 const diameterModels::sizeGroup& fi = sizeGroups[i];
616 otherCoordinateValues[cType][i] =
617 averageCoordinateValue(fi, cType);
630 coordinateTypeSymbolicName(coordinateType_),
633 functionTypeSymbolicName(),
635 otherCoordinateSymbolicNames,
636 otherCoordinateValues
651 coordinateTypeSymbolicName(coordinateType_),
654 functionTypeSymbolicName(),
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
static const NamedEnum< functionType, 6 > functionTypeNames_
Function type names.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool write()
Calculate and write the size distribution.
virtual bool execute()
Execute, currently does nothing.
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
virtual bool read(const dictionary &)
Read the data.
dimensionedScalar log(const dimensionedScalar &ds)
const word & name() const
Return the name of this functionObject.
virtual bool read(const dictionary &)
Read the populationBalanceSizeDistribution data.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
dimensionedScalar sqrt(const dimensionedScalar &ds)
static const NamedEnum< coordinateType, 4 > coordinateTypeNames_
Coordinate type names.
static bool master(const label communicator=0)
Am I the master process.
const tmp< volScalarField > d() const
Return representative diameter of the sizeGroup.
coordinateType
Coordinate type enumeration.
weightType
Enumeration for the weight types.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
Initialise the NamedEnum HashTable from the static list of names.
const phaseModel & phase() const
Return const-reference to the phase.
label size() const
Return number of elements in table.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static const NamedEnum< coordinateType, 3 > coordinateTypeNames_
Names of the coordinate types.
static const NamedEnum< weightType, 4 > weightTypeNames_
Names of the weight types.
const tmp< volScalarField > a() const
Return representative surface area of the sizeGroup.
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
stressControl lookup("compactNormalStress") >> compactNormalStress
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Type gSum(const FieldField< Field, Type > &f)
populationBalanceSizeDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Single size class fraction field representing a fixed particle volume as defined by the user through ...
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const word & type() const =0
Runtime type information.
const Type & value() const
Return const reference to value.
static const NamedEnum< weightType, 3 > weightTypeNames_
Names of the weight types.
static const word null
An empty word.
virtual ~populationBalanceSizeDistribution()
Destructor.
coordinateType
Enumeration for the coordinate types.
functionType
Function type enumeration.
const UPtrList< sizeGroup > & sizeGroups() const
Return the size groups belonging to this populationBalance.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
List< word > wordList
A List of words.
#define Log
Report write to Foam::Info if the local log switch is true.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
A class for managing temporary objects.
const fvMesh & mesh_
Reference to the fvMesh.