31template<
class CloudType>
35 return *cloudCopyPtr_;
39template<
class CloudType>
47template<
class CloudType>
55template<
class CloudType>
63template<
class CloudType>
71template<
class CloudType>
74 return averageParcelMass_;
78template<
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 labelUList& 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])
184 Pstream::broadcast(distance);
Templated atomization model class.
Templated break-up model class.
label size() const noexcept
The number of elements in list.
T & last()
Access last element of the list, position [size()-1].
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
An indirect list with addressing based on sorting. The list is sorted upon construction or when expli...
const labelUList & indices() const noexcept
Return the list of sorted indices (updated every sort).
Templated base class for spray cloud.
autoPtr< BreakupModel< SprayCloud< CloudType > > > breakupModel_
Break-up model.
const BreakupModel< SprayCloud< CloudType > > & breakup() const
Return const-access to the breakup model.
autoPtr< AtomizationModel< SprayCloud< CloudType > > > atomizationModel_
Atomization model.
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
const AtomizationModel< SprayCloud< CloudType > > & atomization() const
Return const-access to the atomization model.
const SprayCloud & cloudCopy() const
Return a reference to the cloud copy.
scalar penetration(const scalar fraction) const
Penetration for fraction [0-1] of the current total mass.
scalar averageParcelMass() const
Return const-access to the average parcel mass.
void size(const label n)
Older name for setAddressableSize.
T & last()
Access last element of the list, position [size()-1].
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label totalSize() const noexcept
The total addressed size, which corresponds to the end offset and also the sum of all localSizes.
static void gatherInplace(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Inplace collect in processor order on master (== procIDs[0]).
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar distance(const vector &p1, const vector &p2)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
#define forAllReverse(list, i)
Reverse loop across all elements in list.