37 namespace functionObjects
56 "numberConcentration",
58 "volumeConcentration",
74 "projectedAreaDiameter"
84 "numberConcentration",
85 "volumeConcentration",
96 Foam::functionObjects::populationBalanceSizeDistribution::
97 functionTypeSymbolicName()
101 switch (functionType_)
103 case functionType::numberConcentration:
105 functionTypeSymbolicName =
"N";
109 case functionType::numberDensity:
111 functionTypeSymbolicName =
"n";
115 case functionType::volumeConcentration:
117 functionTypeSymbolicName =
"V";
121 case functionType::volumeDensity:
123 functionTypeSymbolicName =
"v";
127 case functionType::areaConcentration:
129 functionTypeSymbolicName =
"A";
133 case functionType::areaDensity:
135 functionTypeSymbolicName =
"a";
141 return functionTypeSymbolicName;
146 Foam::functionObjects::populationBalanceSizeDistribution::
147 coordinateTypeSymbolicName
149 const coordinateType& cType
158 coordinateTypeSymbolicName =
"v";
164 coordinateTypeSymbolicName =
"a";
168 case coordinateType::diameter:
170 coordinateTypeSymbolicName =
"d";
174 case coordinateType::projectedAreaDiameter:
176 coordinateTypeSymbolicName =
"dPa";
182 return coordinateTypeSymbolicName;
187 Foam::functionObjects::populationBalanceSizeDistribution::filterField
198 return tmp<scalarField>(
new scalarField(field, zone_.zone()));
204 Foam::functionObjects::populationBalanceSizeDistribution::averageCoordinateValue
206 const populationBalanceModel& popBal,
208 const coordinateType& cType
211 scalar averageCoordinateValue(
Zero);
217 averageCoordinateValue = popBal.v(i).value();
223 averageCoordinateValue = weightedAverage(popBal, i, popBal.a(i));
227 case coordinateType::diameter:
229 averageCoordinateValue = weightedAverage(popBal, i, popBal.d(i));
233 case coordinateType::projectedAreaDiameter:
235 averageCoordinateValue =
236 weightedAverage(popBal, i,
sqrt(popBal.a(i)/
pi));
242 return averageCoordinateValue;
247 Foam::functionObjects::populationBalanceSizeDistribution::weightedAverage
249 const populationBalanceModel& popBal,
257 scalar weightedAverage(
Zero);
261 case weightType::numberConcentration:
268 gSum(filterField(mesh_.V()*field))/zone_.V();
273 gSum(Ni*filterField(field))/
gSum(Ni);
278 case weightType::volumeConcentration:
285 gSum(filterField(mesh_.V()*field))/zone_.V();
290 gSum(Vi*filterField(field))/
gSum(Vi);
295 case weightType::areaConcentration:
302 gSum(filterField(mesh_.V()*field))/zone_.V();
307 gSum(Ai*filterField(field))/
gSum(Ai);
315 gSum(filterField(mesh_.V()*field))/zone_.V();
321 return weightedAverage;
339 popBalName_(
dict.
lookup(
"populationBalance")),
340 functionType_(functionTypeNames_.
read(
dict.
lookup(
"functionType"))),
341 coordinateType_(coordinateTypeNames_.
read(
dict.
lookup(
"coordinateType"))),
344 dict.lookupOrDefault<
Switch>(
"allCoordinates", false)
346 normalise_(
dict.lookupOrDefault<
Switch>(
"normalise", false)),
349 dict.lookupOrDefaultBackwardsCompatible<
Switch>
351 {
"logTransform",
"geometric"},
357 dict.found(
"weightType")
358 ? weightTypeNames_.read(
dict.lookup(
"weightType"))
359 : weightType::numberConcentration
361 formatterPtr_(
nullptr)
410 coordinateValues[i] =
411 averageCoordinateValue(popBal, i, coordinateType_);
416 functionType_ == functionType::numberDensity
417 || functionType_ == functionType::volumeDensity
418 || functionType_ == functionType::areaDensity
421 boundaryValues.
first() = coordinateValues.first();
422 boundaryValues.
last() = coordinateValues.last();
424 for (
label i = 1; i < boundaryValues.
size() - 1; i++)
427 0.5*(coordinateValues[i] + coordinateValues[i-1]);
432 boundaryValues =
Foam::log(boundaryValues);
436 switch (functionType_)
438 case functionType::numberConcentration:
447 gSum(filterField(mesh_.V()*fi*
alpha/vi))/zone_.V();
450 if (normalise_ &&
sum(resultValues) != 0)
452 resultValues /=
sum(resultValues);
457 case functionType::numberDensity:
466 gSum(filterField(mesh_.V()*fi*
alpha/vi))/zone_.V();
469 if (normalise_ &&
sum(resultValues) != 0)
471 resultValues /=
sum(resultValues);
476 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
481 case functionType::volumeConcentration:
489 gSum(filterField(mesh_.V()*fi*
alpha))/zone_.V();
492 if (normalise_ &&
sum(resultValues) != 0)
494 resultValues /=
sum(resultValues);
499 case functionType::volumeDensity:
507 gSum(filterField(mesh_.V()*fi*
alpha))/zone_.V();
510 if (normalise_ &&
sum(resultValues) != 0)
512 resultValues /=
sum(resultValues);
517 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
522 case functionType::areaConcentration:
533 filterField(mesh_.V()*popBal.
a(i)()*fi*
alpha/vi)
538 if (normalise_ &&
sum(resultValues) != 0)
540 resultValues /=
sum(resultValues);
545 case functionType::areaDensity:
556 filterField(mesh_.V()*popBal.
a(i)()*fi*
alpha/vi)
561 if (normalise_ &&
sum(resultValues) != 0)
563 resultValues /=
sum(resultValues);
568 resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]);
578 wordList otherCoordinateSymbolicNames(coordinateTypeNames_.size());
581 forAll(coordinateTypeNames_, i)
585 otherCoordinateSymbolicNames[cType] =
586 coordinateTypeSymbolicName(cType);
592 otherCoordinateValues[cType][i] =
593 averageCoordinateValue(popBal, i, cType);
606 coordinateTypeSymbolicName(coordinateType_),
609 functionTypeSymbolicName(),
611 otherCoordinateSymbolicNames,
612 otherCoordinateValues
627 coordinateTypeSymbolicName(coordinateType_),
630 functionTypeSymbolicName(),
659 zone_.topoChange(map);
683 zone_.distribute(map);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
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.
Holds list of sampling positions.
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.
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.
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.
label nGroups() const
Return the number of groups in the population balance.
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 > a(const label i) const
Return the representative surface area of the group.
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)
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
#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.
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.
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.
Type gSum(const UList< Type > &f, const label comm)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
VolField< scalar > volScalarField
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.