34 namespace functionObjects
47 >::names[] = {
"cellZone",
"all"};
59 "numberConcentration",
69 >::names[] = {
"diameter",
"volume"};
94 const dictionary& dict
97 switch (functionType_)
122 <<
"Unknown function type. Valid function types are:" 127 switch (abszissaType_)
142 <<
"Unknown abszissa type. Valid abszissa types are:" 153 << regionTypeNames_[regionType_] <<
"(" << regionName_ <<
"):" << nl
160 << regionTypeNames_[regionType_] <<
"(" << regionName_ <<
"):" << nl
161 <<
" total cells = " << nCells_ << nl
162 <<
" total volume = " << volume_
175 dict().lookup(
"name") >> regionName_;
177 label zoneId =
mesh().cellZones().findZoneID(regionName_);
182 <<
"Unknown cell zone name: " << regionName_
183 <<
". Valid cell zones are: " <<
mesh().cellZones().names()
187 cellId_ =
mesh().cellZones()[zoneId];
202 <<
"Unknown region type. Valid region types are:" 209 Pout<<
"Selected region size = " << cellId_.size() <<
endl;
216 return gSum(filterField(
mesh().V()));
231 ListListOps::combine<scalarField>
234 accessOp<scalarField>()
246 return tmp<scalarField>(
new scalarField(field, cellId_));
255 OFstream& file = this->file();
257 switch (functionType_)
261 writeHeader(file,
"Number density function");
267 writeHeader(file,
"Volume density function");
273 writeHeader(file,
"Number concentration");
279 writeHeader(file,
"Moments");
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();
349 const dictionary& dict
352 fvMeshFunctionObject(name, runTime, dict),
353 logFiles(obr_, name),
355 regionType_(regionTypeNames_.
read(dict.
lookup(
"regionType"))),
356 regionName_(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)),
430 *popBal_.sizeGroups()[i];
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)
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;
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.
static const NamedEnum< regionTypes, 2 > regionTypeNames_
Region type names.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual ~sizeDistribution()
Destructor.
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)
regionTypes
Region type enumeration.
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.
word name(const complex &)
Return a string representation of a complex.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
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.
prefixOSstream Pout(cout, "Pout")
#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.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
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.
addToRunTimeSelectionTable(functionObject, add, dictionary)