36 namespace functionObjects
55 "numberConcentration",
57 "volumeConcentration",
73 "projectedAreaDiameter"
83 "numberConcentration",
84 "volumeConcentration",
95 Foam::functionObjects::populationBalanceSizeDistribution::
96 functionTypeSymbolicName()
100 switch (functionType_)
102 case functionType::numberConcentration:
104 functionTypeSymbolicName =
"N";
108 case functionType::numberDensity:
110 functionTypeSymbolicName =
"n";
114 case functionType::volumeConcentration:
116 functionTypeSymbolicName =
"V";
120 case functionType::volumeDensity:
122 functionTypeSymbolicName =
"v";
126 case functionType::areaConcentration:
128 functionTypeSymbolicName =
"A";
132 case functionType::areaDensity:
134 functionTypeSymbolicName =
"a";
140 return functionTypeSymbolicName;
145 Foam::functionObjects::populationBalanceSizeDistribution::
146 coordinateTypeSymbolicName
148 const coordinateType& cType
155 case coordinateType::volume:
157 coordinateTypeSymbolicName =
"v";
161 case coordinateType::area:
163 coordinateTypeSymbolicName =
"a";
167 case coordinateType::diameter:
169 coordinateTypeSymbolicName =
"d";
173 case coordinateType::projectedAreaDiameter:
175 coordinateTypeSymbolicName =
"dPa";
181 return coordinateTypeSymbolicName;
186 Foam::functionObjects::populationBalanceSizeDistribution::filterField
197 return tmp<scalarField>(
new scalarField(field, zone_.zone()));
203 Foam::functionObjects::populationBalanceSizeDistribution::averageCoordinateValue
206 const coordinateType& cType
209 scalar averageCoordinateValue(
Zero);
213 case coordinateType::volume:
215 averageCoordinateValue = fi.
x().
value();
219 case coordinateType::area:
221 averageCoordinateValue =
222 weightedAverage(fi.
a(), fi);
226 case coordinateType::diameter:
228 averageCoordinateValue =
229 weightedAverage(fi.
d(), fi);
233 case coordinateType::projectedAreaDiameter:
235 averageCoordinateValue =
236 weightedAverage(
sqrt(fi.
a()/
pi), fi);
242 return averageCoordinateValue;
247 Foam::functionObjects::populationBalanceSizeDistribution::weightedAverage
253 scalar weightedAverage(
Zero);
257 case weightType::numberConcentration:
264 gSum(filterField(mesh_.V()*
fld))/zone_.V();
274 case weightType::volumeConcentration:
281 gSum(filterField(mesh_.V()*
fld))/zone_.V();
291 case weightType::areaConcentration:
298 gSum(filterField(mesh_.V()*
fld))/zone_.V();
311 gSum(filterField(mesh_.V()*
fld))/zone_.V();
317 return weightedAverage;
335 popBalName_(
dict.lookup(
"populationBalance")),
336 functionType_(functionTypeNames_.
read(
dict.lookup(
"functionType"))),
337 coordinateType_(coordinateTypeNames_.
read(
dict.lookup(
"coordinateType"))),
340 dict.lookupOrDefault<
Switch>(
"allCoordinates", false)
342 normalise_(
dict.lookupOrDefault<
Switch>(
"normalise", false)),
345 dict.lookupOrDefaultBackwardsCompatible<
Switch>
347 {
"logTransform",
"geometric"},
353 dict.found(
"weightType")
354 ? weightTypeNames_.read(
dict.lookup(
"weightType"))
355 : weightType::numberConcentration
357 formatterPtr_(
nullptr)
414 coordinateValues[i] = averageCoordinateValue(fi, coordinateType_);
419 functionType_ == functionType::numberDensity
420 || functionType_ == functionType::volumeDensity
421 || functionType_ == functionType::areaDensity
424 boundaryValues.
first() = coordinateValues.
first();
425 boundaryValues.
last() = coordinateValues.
last();
427 for (
label i = 1; i < boundaryValues.
size() - 1; i++)
430 0.5*(coordinateValues[i] + coordinateValues[i-1]);
435 boundaryValues =
Foam::log(boundaryValues);
439 switch (functionType_)
441 case functionType::numberConcentration:
448 gSum(filterField(mesh_.V()*fi*fi.
phase()/fi.
x()))/zone_.V();
451 if (normalise_ &&
sum(resultValues) != 0)
453 resultValues /=
sum(resultValues);
458 case functionType::numberDensity:
465 gSum(filterField(mesh_.V()*fi*fi.
phase()/fi.
x()))/zone_.V();
468 if (normalise_ &&
sum(resultValues) != 0)
470 resultValues /=
sum(resultValues);
475 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
480 case functionType::volumeConcentration:
487 gSum(filterField(mesh_.V()*fi*fi.
phase()))/zone_.V();
490 if (normalise_ &&
sum(resultValues) != 0)
492 resultValues /=
sum(resultValues);
497 case functionType::volumeDensity:
504 gSum(filterField(mesh_.V()*fi*fi.
phase()))/zone_.V();
507 if (normalise_ &&
sum(resultValues) != 0)
509 resultValues /=
sum(resultValues);
514 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
519 case functionType::areaConcentration:
528 filterField(mesh_.V()*fi.
a().ref()*fi*fi.
phase()/fi.
x())
533 if (normalise_ &&
sum(resultValues) != 0)
535 resultValues /=
sum(resultValues);
540 case functionType::areaDensity:
549 filterField(mesh_.V()*fi.
a().ref()*fi*fi.
phase()/fi.
x())
554 if (normalise_ &&
sum(resultValues) != 0)
556 resultValues /=
sum(resultValues);
561 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
571 wordList otherCoordinateSymbolicNames(coordinateTypeNames_.size());
574 forAll(coordinateTypeNames_, i)
578 otherCoordinateSymbolicNames[cType] =
579 coordinateTypeSymbolicName(cType);
581 otherCoordinateValues.
set
591 otherCoordinateValues[cType][i] =
592 averageCoordinateValue(fi, cType);
605 coordinateTypeSymbolicName(coordinateType_),
608 functionTypeSymbolicName(),
610 otherCoordinateSymbolicNames,
611 otherCoordinateValues
626 coordinateTypeSymbolicName(coordinateType_),
629 functionTypeSymbolicName(),
658 zone_.topoChange(map);
682 zone_.distribute(map);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
void size(const label)
Override size to be inconsistent with allocated storage.
Initialise the NamedEnum HashTable from the static list of names.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
T & first()
Return the first element of the list.
T & last()
Return the last element of the list.
static bool master(const label communicator=0)
Am I the master process.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Holds list of sampling positions.
Model for tracking the evolution of a dispersed phase size distribution due to coalescence (synonymou...
const UPtrList< sizeGroup > & sizeGroups() const
Return the size groups belonging to this populationBalance.
Single size class fraction field representing a fixed particle volume as defined by the user through ...
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
const tmp< volScalarField > a() const
Return representative surface area of the sizeGroup.
const phaseModel & phase() const
Return const-reference to the phase.
const tmp< volScalarField > d() const
Return representative diameter of the sizeGroup.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const Type & value() const
Return const reference to value.
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.
Writes out the size distribution determined by a population balance model, either for the entire doma...
weightType
Enumeration for the weight types.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
populationBalanceSizeDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual void movePoints(const polyMesh &)
Update for mesh motion.
functionType
Function type enumeration.
coordinateType
Coordinate type enumeration.
virtual ~populationBalanceSizeDistribution()
Destructor.
static const NamedEnum< weightType, 4 > weightTypeNames_
Names of the weight types.
static const NamedEnum< functionType, 6 > functionTypeNames_
Function type names.
virtual bool execute()
Execute, currently does nothing.
static const NamedEnum< coordinateType, 4 > coordinateTypeNames_
Coordinate type names.
virtual bool write()
Calculate and write the size distribution.
virtual bool read(const dictionary &)
Read the populationBalanceSizeDistribution data.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const polyMesh & mesh() const
Return polyMesh.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
Mesh consisting of general polyhedral cells.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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))
#define Log
Report write to Foam::Info if the local log switch is true.
scalar cellVolume(const cell &c, const cellEdgeAddressing &cAddr, const point &cPAvg, const vectorField &fAreas, const pointField &fCentres)
Compute the cell-volume.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
Type gSum(const FieldField< Field, Type > &f)
bool read(const char *, int32_t &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.