31 template<
class CloudType>
35 return *cloudCopyPtr_;
39 template<
class CloudType>
43 return atomizationModel_;
47 template<
class CloudType>
51 return *atomizationModel_;
55 template<
class CloudType>
63 template<
class CloudType>
67 return *breakupModel_;
71 template<
class CloudType>
74 return averageParcelMass_;
78 template<
class CloudType>
84 if ((fraction < 0) || (fraction > 1))
87 <<
"fraction should be in the range 0 < fraction < 1" 91 const label nParcel = this->size();
92 const globalIndex globalParcels(nParcel);
93 const label nTotParcel = globalParcels.totalSize();
101 List<scalar> mass(nParcel);
102 List<scalar> dist(nParcel);
107 for (
const parcelType&
p : *
this)
109 scalar m =
p.nParticle()*
p.mass();
110 scalar d =
mag(
p.position() -
p.position0());
119 reduce(mTotal, sumOp<scalar>());
122 globalParcels.gatherInplace(mass);
123 globalParcels.gatherInplace(dist);
125 if (Pstream::master())
136 const SortList<scalar> sortedDist(dist);
138 const scalar mLimit = fraction*mTotal;
139 const labelList& indices = sortedDist.indices();
141 if (mLimit > (mTotal - mass[indices.last()]))
149 const scalar mThreshold = (1.0 - fraction)*mTotal;
155 label indI = indices[i];
157 mCurrent += mass[indI];
159 if (mCurrent > mThreshold)
166 if (i0 == indices.size() - 1)
173 scalar
alpha = (mCurrent - mThreshold)/mass[indices[i0]];
177 +
alpha*(sortedDist[i0+1] - sortedDist[i0])
scalar averageParcelMass() const
Return const-access to the average parcel mass.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const AtomizationModel< SprayCloud< CloudType > > & atomization() const
Return const-access to the atomization model.
Templated atomization model class.
scalar penetration(const scalar fraction) const
Penetration for fraction [0-1] of the current total mass.
const SprayCloud & cloudCopy() const
Return a reference to the cloud copy.
scalar distance(const vector &p1, const vector &p2)
const BreakupModel< SprayCloud< CloudType > > & breakup() const
Return const-access to the breakup model.
Templated base class for spray cloud.
Templated break-up model class.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
List< label > labelList
A List of labels.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.