51 {selectionModeTypes::rtCellZone,
"cellZone"},
52 {selectionModeTypes::rtAll,
"all"},
62 {functionTypes::ftNdf,
"numberDensity"},
63 {functionTypes::ftVdf,
"volumeDensity"},
64 {functionTypes::ftNc,
"numberConcentration"},
65 {functionTypes::ftMom,
"moments"},
77 {abszissaTypes::atVolume,
"volume"},
163 <<
" total volume = " <<
volume_
170 switch (selectionModeType_)
174 dict().readEntry(
"cellZone", selectionModeTypeName_);
177 mesh().cellZones().findZoneID(selectionModeTypeName_);
182 <<
"Unknown cellZone name: " << selectionModeTypeName_
183 <<
". Valid cellZone names are: "
184 <<
mesh().cellZones().names()
188 cellId_ =
mesh().cellZones()[zoneId];
257 switch (functionType_)
284 switch (abszissaType_)
288 writeCommented(file,
"Time/volume");
294 writeCommented(file,
"Time/diameter");
299 switch (functionType_)
303 for (label i = 0; i <= momentOrder_; i++)
312 forAll(popBal_.sizeGroups(), sizeGroupi)
314 const diameterModels::sizeGroup& fi =
315 popBal_.sizeGroups()[sizeGroupi];
317 switch (abszissaType_)
321 file() <<
tab << fi.d().value();
328 file() <<
tab << fi.x().value();
357 selectionModeTypeNames_.get(
"selectionMode",
dict)
359 selectionModeTypeName_(),
360 functionType_(functionTypeNames_.get(
"functionType",
dict)),
361 abszissaType_(abszissaTypeNames_.get(
"abszissaType",
dict)),
365 writeVolume_(
dict.getOrDefault(
"writeVolume", false)),
373 N_(popBal_.sizeGroups().size()),
374 momentOrder_(
dict.getOrDefault<label>(
"momentOrder", 0)),
375 normalize_(
dict.getOrDefault(
"normalize", false)),
418 writeCurrentTime(file());
439 combineFields(values);
445 N_[i] =
sum(V*values)/
sum(V);
450 sumV_ += N_[i]*fi.
x().
value();
455 switch (functionType_)
459 for (label m = 0; m <= momentOrder_; m++)
466 popBal_.sizeGroups()[i];
468 switch (abszissaType_)
486 file() <<
tab << result;
494 forAll(popBal_.sizeGroups(), i)
496 const Foam::diameterModels::sizeGroup& fi =
497 popBal_.sizeGroups()[i];
502 switch (abszissaType_)
506 delta = popBal_.v()[i+1].value()
507 - popBal_.v()[i].value();
514 const scalar& formFactor =
520 popBal_.v()[i+1].value()
526 popBal_.v()[i].value()
535 switch (functionType_)
539 if (normalize_ ==
true)
541 result = N_[i]/
delta/sumN_;
545 result = N_[i]/
delta;
553 if (normalize_ ==
true)
567 if (normalize_ ==
true)
569 result = N_[i]/sumN_;
585 file()<<
tab << result;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
@ gatherList
gatherList [manual algorithm]
const phaseModel & phase() const
Return the phase.
This class represents a single sizeGroup belonging to a velocityGroup. The main property of a sizeGro...
const dimensionedScalar & d() const
Return representative diameter of the sizeGroup.
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
const velocityGroup & VelocityGroup() const
Return const-reference to the velocityGroup.
const dimensionedScalar & formFactor() const
Return the form factor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const Type & value() const noexcept
Return const reference to value.
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
virtual const word & type() const =0
Runtime type information.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const ObjectType & lookupObject(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
const objectRegistry & obr_
Reference to the region objectRegistry.
This function object calculates and outputs information about the size distribution of the dispersed ...
label nCells_
Global number of cells.
abszissaTypes
Abszissa type enumeration.
word selectionModeTypeName_
Name of selection.
scalar sumN_
Sum of number concentrations.
selectionModeTypes
Selection mode type enumeration.
selectionModeTypes selectionModeType_
Selection mode type.
void setCellZoneCells()
Set cells to evaluate based on a cell zone.
dictionary dict_
Construction dictionary.
scalar sumV_
Volumertic sum.
scalar volume() const
Calculate and return volume of the evaluated cell zone.
abszissaTypes abszissaType_
Abszissa type.
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
functionTypes functionType_
Function type.
bool writeVolume_
Optionally write the volume of the sizeDistribution.
virtual ~sizeDistribution()
Destructor.
static const Enum< selectionModeTypes > selectionModeTypeNames_
Selection mode type names.
List< scalar > N_
Number concentrations.
const Switch normalize_
Normalization switch.
const dictionary & dict() const
Return the reference to the construction dictionary.
void writeFileHeader(const label i=0)
Output file header information.
static const Enum< abszissaTypes > abszissaTypeNames_
Abszissa type names.
static const Enum< functionTypes > functionTypeNames_
Function type names.
sizeDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
label momentOrder_
Write moments up to specified order with respect to abszissaType.
void combineFields(scalarField &field)
Combine fields from all processor domains into single field.
const Foam::diameterModels::populationBalanceModel & popBal_
PopulationBalance.
tmp< scalarField > filterField(const scalarField &field) const
Filter field according to cellIds.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
scalar volume_
Total volume of the evaluated selection.
functionTypes
Function type enumeration.
labelList cellId_
Local list of cell IDs.
Base class for writing single files from the function objects.
virtual autoPtr< OFstream > newFileAtStartTime(const word &name) const
Return autoPtr to a new file using the simulation start time.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
virtual bool read(const dictionary &dict)
Read.
virtual OFstream & file()
Return access to the file (if only 1).
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
virtual void resetFile(const word &name)
Reset internal file pointer to new file with new name.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Type gSum(const FieldField< Field, Type > &f)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
static void writeHeader(Ostream &os, const word &fieldName)
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
#define forAll(list, i)
Loop across all elements in list.
Object access operator or list access operator (default is pass-through).