37 namespace functionObjects
51 {selectionModeTypes::rtCellZone,
"cellZone"},
52 {selectionModeTypes::rtAll,
"all"},
62 {functionTypes::ftNdf,
"numberDensity"},
63 {functionTypes::ftVdf,
"volumeDensity"},
64 {functionTypes::ftNc,
"numberConcentration"},
65 {functionTypes::ftMom,
"moments"},
76 {abszissaTypes::atDiameter,
"diameter"},
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];
207 selectionModeTypeNames_
216 return gSum(filterField(
mesh().V()));
231 ListListOps::combine<scalarField>
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)),
368 obr_.lookupObject<
Foam::diameterModels::populationBalanceModel>
373 N_(popBal_.sizeGroups().size()),
374 momentOrder_(
dict.getOrDefault<label>(
"momentOrder", 0)),
375 normalize_(
dict.getOrDefault(
"normalize", false)),
418 writeCurrentTime(file());
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)
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;
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
scalar volume_
Total volume of the evaluated selection.
const Type & value() const noexcept
Return const reference to value.
static const Enum< functionTypes > functionTypeNames_
Function type names.
defineTypeNameAndDebug(ObukhovLength, 0)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
scalar volume() const
Calculate and return volume of the evaluated cell zone.
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
static void writeHeader(Ostream &os, const word &fieldName)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual void resetFile(const word &name)
Reset internal file pointer to new file with new name.
static const Enum< abszissaTypes > abszissaTypeNames_
Abszissa type names.
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
void writeFileHeader(const label i=0)
Output file header information.
constexpr char nl
The newline '\n' character (0x0a)
void combineFields(scalarField &field)
Combine fields from all processor domains into single field.
Object access operator or list access operator (default is pass-through)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void gatherList(const UList< commsStruct > &comms, UList< T > &values, const int tag, const label comm)
Gather data, but keep individual values separate. Uses the specified communication schedule...
virtual bool execute()
Execute.
constexpr char tab
The tab '\t' character(0x09)
virtual bool read(const dictionary &dict)
Read from dictionary.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
const word & name() const noexcept
Return the name of this functionObject.
const dictionary & dict() const
Return the reference to the construction dictionary.
#define forAll(list, i)
Loop across all elements in list.
virtual ~sizeDistribution()
Destructor.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
functionTypes functionType_
Function type.
const phaseModel & phase() const
Return the phase.
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
This class represents a single sizeGroup belonging to a velocityGroup. The main property of a sizeGro...
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...
A class for handling words, derived from Foam::string.
virtual const word & type() const =0
Runtime type information.
static const word null
An empty word.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
const dimensionedScalar & formFactor() const
Return the form factor.
virtual autoPtr< OFstream > newFileAtStartTime(const word &name) const
Return autoPtr to a new file using the simulation start time.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool read(const dictionary &dict)
Read.
selectionModeTypes
Selection mode type enumeration.
sizeDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
label nCells_
Global number of cells.
selectionModeTypes selectionModeType_
Selection mode type.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void setCellZoneCells()
Set cells to evaluate based on a cell zone.
word selectionModeTypeName_
Name of selection.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
virtual bool write()
Write.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
abszissaTypes abszissaType_
Abszissa type.
abszissaTypes
abszissa type enumeration
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const dimensionedScalar & d() const
Return representative diameter of the sizeGroup.
tmp< scalarField > filterField(const scalarField &field) const
Filter field according to cellIds.
static const Enum< selectionModeTypes > selectionModeTypeNames_
Selection mode type names.
A class for managing temporary objects.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Base class for writing single files from the function objects.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
functionTypes
Function type enumeration.
const velocityGroup & VelocityGroup() const
Return const-reference to the velocityGroup.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...