34 namespace functionObjects
47 >::names[] = {
"cellZone",
"all"};
59 "numberConcentration",
69 >::names[] = {
"diameter",
"volume"};
94 const dictionary& dict
97 switch (functionType_)
122 <<
"Unknown functionType. Valid types are:" 127 switch (abszissaType_)
142 <<
"Unknown abszissaType. Valid types are:" 153 << selectionModeTypeNames_[selectionModeType_]
154 <<
"(" << selectionModeTypeName_ <<
"):" << nl
161 << selectionModeTypeNames_[selectionModeType_]
162 <<
"(" << selectionModeTypeName_ <<
"):" << nl
163 <<
" total cells = " << nCells_ << nl
164 <<
" total volume = " << volume_
171 switch (selectionModeType_)
175 dict().lookup(
"cellZone") >> selectionModeTypeName_;
178 mesh().cellZones().findZoneID(selectionModeTypeName_);
183 <<
"Unknown cellZone name: " << selectionModeTypeName_
184 <<
". Valid cellZone names are: " 185 <<
mesh().cellZones().names()
189 cellId_ =
mesh().cellZones()[zoneId];
204 <<
"Unknown selectionMode type. Valid selectionMode types are:" 213 return gSum(filterField(
mesh().V()));
228 ListListOps::combine<scalarField>
231 accessOp<scalarField>()
243 return tmp<scalarField>(
new scalarField(field, cellId_));
252 OFstream& file = this->file();
254 switch (functionType_)
258 writeHeader(file,
"Number density function");
264 writeHeader(file,
"Volume density function");
270 writeHeader(file,
"Number concentration");
276 writeHeader(file,
"Moments");
281 switch (abszissaType_)
285 writeCommented(file,
"Time/volume");
291 writeCommented(file,
"Time/diameter");
296 switch (functionType_)
300 for (
label i = 0; i <= momentOrder_; i++)
309 forAll(popBal_.sizeGroups(), sizeGroupi)
311 const diameterModels::sizeGroup& fi =
312 popBal_.sizeGroups()[sizeGroupi];
314 switch (abszissaType_)
318 file() <<
tab << fi.d().value();
325 file() <<
tab << fi.x().value();
346 const dictionary& dict
349 fvMeshFunctionObject(name, runTime, dict),
350 logFiles(obr_, name),
354 selectionModeTypeNames_.
read(dict.
lookup(
"selectionMode"))
356 selectionModeTypeName_(word::null),
357 functionType_(functionTypeNames_.
read(dict.
lookup(
"functionType"))),
358 abszissaType_(abszissaTypeNames_.
read(dict.
lookup(
"abszissaType"))),
362 writeVolume_(dict.lookupOrDefault(
"writeVolume", false)),
365 obr_.lookupObject<
Foam::diameterModels::populationBalanceModel>
367 dict.
lookup(
"populationBalance")
370 N_(popBal_.sizeGroups().size()),
371 momentOrder_(dict.lookupOrDefault<
label>(
"momentOrder", 0)),
372 normalize_(dict.lookupOrDefault(
"normalize", false)),
438 combineFields(values);
444 N_[i] =
sum(V*values)/
sum(V);
449 sumV_ += N_[i]*fi.
x().
value();
454 switch (functionType_)
458 for (
label m = 0; m <= momentOrder_; m++)
465 popBal_.sizeGroups()[i];
467 switch (abszissaType_)
485 file() <<
tab << result;
493 forAll(popBal_.sizeGroups(), i)
496 popBal_.sizeGroups()[i];
501 switch (abszissaType_)
505 delta = popBal_.v()[i+1].value()
506 - popBal_.v()[i].value();
513 const scalar& formFactor =
519 popBal_.v()[i+1].value()
525 popBal_.v()[i].value()
534 switch (functionType_)
538 if (normalize_ ==
true)
540 result = N_[i]/
delta/sumN_;
544 result = N_[i]/
delta;
552 if (normalize_ ==
true)
566 if (normalize_ ==
true)
568 result = N_[i]/sumN_;
584 file()<<
tab << result;
tmp< scalarField > filterField(const scalarField &field) const
Filter field according to cellIds.
#define forAll(list, i)
Loop across all elements in list.
virtual bool write()
Write function.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool read(const dictionary &dict)
Read the input data.
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const word & name() const
Return the name of this functionObject.
virtual ~sizeDistribution()
Destructor.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
static const NamedEnum< functionTypes, 4 > functionTypeNames_
Function type names.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
void combineFields(scalarField &field)
Combine fields from all processor domains into single field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
static const NamedEnum< abszissaTypes, 2 > abszissaTypeNames_
Abszissa type names.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
virtual bool read(const dictionary &dict)
Read from dictionary.
void initialise(const dictionary &dict)
Initialise, e.g. cell addressing.
Initialise the NamedEnum HashTable from the static list of names.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
stressControl lookup("compactNormalStress") >> compactNormalStress
const phaseModel & phase() const
Return the phase.
Type gSum(const FieldField< Field, Type > &f)
This class represents a single sizeGroup belonging to a velocityGroup. The main property of a sizeGro...
virtual void writeFileHeader(const label i)
Output file header information.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
scalar volume() const
Calculate and return volume of the evaluated cell zone.
virtual const word & type() const =0
Runtime type information.
const Type & value() const
Return const reference to value.
virtual bool execute()
Execute.
const dimensionedScalar & formFactor() const
Return the form factor.
virtual bool write()
Write.
selectionModeTypes
Selection mode type enumeration.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
sizeDistribution(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void setCellZoneCells()
Set cells to evaluate based on a cell zone.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static const NamedEnum< selectionModeTypes, 2 > selectionModeTypeNames_
Selection mode type names.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
#define Log
Report write to Foam::Info if the local log switch is true.
abszissaTypes
abszissa type enumeration
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const dimensionedScalar & d() const
Return representative diameter of the sizeGroup.
A class for managing temporary objects.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
functionTypes
Function type enumeration.
const velocityGroup & VelocityGroup() const
Return const-reference to the velocityGroup.