32 template<
class CloudType>
36 const label nParcels =
40 Info<<
type() <<
": Not writing the distribution as the cloud "
41 <<
"is empty" <<
nl <<
endl;
46 const scalar d0 = this->owner().Dmin(), d1 = this->owner().Dmax();
49 Info<<
type() <<
": Not writing the distribution as the cloud "
50 <<
"has uniform particle diameters" <<
nl <<
endl;
58 const scalar
f = scalar(i)/(nPoints_ - 1);
59 ds[i] = (1 -
f)*d0 +
f*d1;
63 scalarField particlePDF(nPoints_, 0), parcelPDF(nPoints_, 0);
66 const scalar nParticle = iter().nParticle();
67 const scalar d = iter().d();
69 const scalar
f = (d - d0)/(d1 - d0);
70 const label i =
min(floor(
f*(nPoints_ - 1)), nPoints_ - 2);
71 const scalar g =
f*(nPoints_ - 1) - scalar(i);
73 particlePDF[i] += nParticle*(1 - g);
74 particlePDF[i + 1] += nParticle*g;
76 parcelPDF[i] += 1 - g;
77 parcelPDF[i + 1] += g;
81 Pstream::listCombineScatter(particlePDF);
84 Pstream::listCombineScatter(parcelPDF);
86 particlePDF.first() *= 2;
87 particlePDF.last() *= 2;
88 particlePDF /=
sum(particlePDF)*(d1 - d0)/(nPoints_ - 1);
90 parcelPDF.
first() *= 2;
91 parcelPDF.
last() *= 2;
92 parcelPDF /=
sum(parcelPDF)*(d1 - d0)/(nPoints_ - 1);
94 Info<<
type() <<
": Writing the distribution to "
95 << this->writeTimeDir().relativePath() <<
nl <<
endl;
98 if (Pstream::master())
100 mkDir(this->writeTimeDir());
104 this->writeTimeDir(),
118 template<
class CloudType>
132 template<
class CloudType>
139 nPoints_(vf.nPoints_),
140 formatter_(vf.formatter_, false)
146 template<
class CloudType>
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Templated cloud function object base class.
Templated base class for dsmc cloud.
Creates graphs of a cloud's size distribution.
virtual ~SizeDistribution()
Destructor.
virtual void write()
Write post-processing info.
SizeDistribution(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
T & first()
Return the first element of the list.
T & last()
Return the last element of the list.
Holds list of sampling positions.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Base class for writing coordinate sets with data.
A class for handling words, derived from string.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.