36 namespace functionObjects
74 "projectedAreaDiameter" 100 return tmp<scalarField>(
new scalarField(field, cellIDs()));
116 switch (coordinateType_)
118 case ctProjectedAreaDiameter:
132 N_[i] =
gSum(V*Ni)/this->V();
133 a_[i] =
gSum(V*ai)/this->V();
134 d_[i] =
gSum(V*di)/this->V();
150 Log <<
" writing moments of size distribution." <<
endl;
157 for (
label k = 0;
k <= maxOrder_;
k++)
163 result +=
pow(bins_[i][binCmpt_],
k)*N_[i];
183 Log <<
" writing standard deviation of size distribution." 209 mean =
sum(bins_.component(binCmpt_)*N_/
sum(N_));
211 var =
sum(
sqr(bins_.component(binCmpt_) - mean)*N_/
sum(N_));
228 switch (functionType_)
232 Log <<
" writing number distribution. " 239 Log <<
" writing volume distribution. " 242 result *= bins_.component(0);
257 result /=
sum(result);
262 if (densityFunction_)
264 List<scalar> bndrs(N_.size() + 1);
266 bndrs.first() = bins_.first()[binCmpt_];
267 bndrs.last() = bins_.last()[binCmpt_];
269 for (
label i = 1; i < N_.size(); i++)
271 bndrs[i] = (bins_[i][binCmpt_] + bins_[i-1][binCmpt_])/2.0;
283 result[i] /= (bndrs[i+1] - bndrs[i]);
290 const coordSet coords
298 writeGraph(coords, functionTypeNames_[functionType_], result);
314 word(coordinateTypeNames_[coordinateType_])
319 switch (functionType_)
323 for (
label k = 0;
k <= maxOrder_;
k++)
325 str += (
" k=" + std::to_string(
k));
333 str +=
" standardDeviation mean variance";
344 writeCommented(
file(), str);
352 const coordSet& coords,
353 const word& functionTypeName,
357 const wordList functionTypeNames(1, functionTypeName);
359 fileName outputPath = file_.baseTimeDir();
364 outputPath/(this->
name() +
".dat")
369 file_.writeCommented(graphFile,
"Volume area diameter " + functionTypeName);
371 if (densityFunction_)
373 graphFile <<
"Density";
377 graphFile <<
"Concentration";
382 List<const scalarField*> yPtrs(1);
384 scalarFormatter_().write(coords, functionTypeNames, yPtrs, graphFile);
394 const dictionary& dict
397 fvMeshFunctionObject(name, runTime, dict),
398 volRegion(fvMeshFunctionObject::mesh_, dict),
399 logFiles(obr_, name),
400 mesh_(fvMeshFunctionObject::mesh_),
404 obr_.lookupObject<
Foam::diameterModels::populationBalanceModel>
406 dict.
lookup(
"populationBalance")
409 functionType_(functionTypeNames_.
read(dict.
lookup(
"functionType"))),
410 coordinateType_(coordinateTypeNames_.
read(dict.
lookup(
"coordinateType"))),
411 N_(popBal_.sizeGroups().size(), 0),
412 a_(popBal_.sizeGroups().size(), 0),
413 d_(popBal_.sizeGroups().size(), 0),
419 switch (coordinateType_)
439 case ctProjectedAreaDiameter:
463 normalise_ = dict.lookupOrDefault<Switch>(
"normalise",
false);
464 densityFunction_ = dict.lookupOrDefault<Switch>(
"densityFunction",
false);
465 geometric_ = dict.lookupOrDefault<Switch>(
"geometric",
false);
466 maxOrder_ = dict.lookupOrDefault(
"maxOrder", 3);
490 correctVolAverages();
492 switch (functionType_)
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.
const dimensionedScalar & x() const
Return representative volume of the sizeGroup.
functionType
Function type enumeration.
dimensionedScalar log(const dimensionedScalar &ds)
const word & name() const
Return the name of this functionObject.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual ~sizeDistribution()
Destructor.
void writeGraph(const coordSet &coords, const word &functionTypeName, const scalarField &values)
Output function for all functionType number/volume.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
const tmp< volScalarField > d() const
Return representative diameter of the sizeGroup.
label k
Boltzmann constant.
virtual bool read(const dictionary &)
Read the sizeDistribution data.
Initialise the NamedEnum HashTable from the static list of names.
const phaseModel & phase() const
Return const-reference to the phase.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void writeStdDev()
Write standard deviation.
const tmp< volScalarField > a() const
Return representative surface area of the sizeGroup.
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
stressControl lookup("compactNormalStress") >> compactNormalStress
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar exp(const dimensionedScalar &ds)
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 for functionType moments.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const word & type() const =0
Runtime type information.
const Type & value() const
Return const reference to value.
virtual bool execute()
Execute, currently does nothing.
coordinateType
Coordinate type enumeration.
virtual bool write()
Calculate and write the size distribution.
static const NamedEnum< coordinateType, 4 > coordinateTypeNames_
Coordinate type names.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
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.
static autoPtr< setWriter > New(const word &writeFormat)
Return a reference to the selected setWriter.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeFileHeader(const writeFile &wf, Ostream &file)
Output file header information.
List< word > wordList
A List of words.
void writeDistribution()
Write distribution.
void correctVolAverages()
Correct volume averages.
vector point
Point is a vector.
#define Log
Report write to Foam::Info if the local log switch is true.
void writeMoments()
Write moments.
dimensioned< scalar > mag(const dimensioned< Type > &)
static const NamedEnum< functionType, 4 > functionTypeNames_
Ordinate type names.
A class for managing temporary objects.
virtual bool end()
Execute at the final time-loop, currently does nothing.