36template<
class CloudType>
39 const label globalPatchi
42 return patchIDs_.find(globalPatchi);
48template<
class CloudType>
54 procTimes[Pstream::myProcNo()] = times_[i];
55 Pstream::gatherList(procTimes);
58 procDiameters[Pstream::myProcNo()] = patchDiameters_[i];
59 Pstream::gatherList(procDiameters);
62 procParticles[Pstream::myProcNo()] = patchParticles_[i];
63 Pstream::gatherList(procParticles);
65 if (Pstream::master())
69 mkDir(this->writeTimeDir());
71 const word& patchName =
mesh.boundaryMesh()[patchIDs_[i]].name();
75 this->writeTimeDir()/patchName +
".post",
77 IOstream::currentVersion,
78 mesh.time().writeCompression()
82 globalTimes = ListListOps::combine<List<scalar>>
89 globalDiameters = ListListOps::combine<List<scalar>>
96 globalParticles = ListListOps::combine<List<scalar>>
104 forAll(globalDiameters, j)
106 const label bini = (globalDiameters[j] - min_)/delta_;
107 if (bini >= 0 && bini < nBins_)
109 nParticles[bini] += globalParticles[j];
110 nParticlesCumulative_[i][bini] += globalParticles[j];
115 <<
"# nBin=" << nBins_
117 <<
"; max=" << max_ <<
nl
118 <<
"# dEdge1 dEdge2 nParticles nParticlesCumulative"
130 << nParticlesCumulative_[i][j]
135 times_[i].clearStorage();
136 patchDiameters_[i].clearStorage();
137 patchParticles_[i].clearStorage();
144template<
class CloudType>
149 const word& modelName
154 min_(
dict.getScalar(
"min")),
155 max_(
dict.getScalar(
"max")),
156 delta_((max_ - min_)/scalar(nBins_)),
157 maxStoredParcels_(
dict.getScalar(
"maxStoredParcels")),
158 binEdges_(nBins_ + 1),
160 nParticlesCumulative_(),
168 <<
"Histogram minimum = " << min_
169 <<
", cannot be larger than histogram maximum = " << max_
173 if (maxStoredParcels_ <= 0)
176 <<
"maxStoredParcels = " << maxStoredParcels_
177 <<
", cannot be equal to or less than zero"
183 for (label i = 0; i < nBins_; ++i)
185 const scalar next = min_ + (i+1)*delta_;
186 binEdges_[i+1] = next;
194 if (patchIDs_.
empty())
197 <<
"No matching patches found: "
202 nParticlesCumulative_ =
205 times_.setSize(patchIDs_.
size());
206 patchDiameters_.setSize(patchIDs_.
size());
207 patchParticles_.setSize(patchIDs_.
size());
211template<
class CloudType>
222 maxStoredParcels_(ppm.maxStoredParcels_),
223 binEdges_(ppm.binEdges_),
224 patchIDs_(ppm.patchIDs_),
225 nParticlesCumulative_(ppm.nParticlesCumulative_),
227 patchDiameters_(ppm.patchDiameters_),
228 patchParticles_(ppm.patchParticles_)
234template<
class CloudType>
242 const label patchi = pp.
index();
243 const label localPatchi = applyToPatch(patchi);
245 if (localPatchi != -1 && times_[localPatchi].size() < maxStoredParcels_)
247 times_[localPatchi].append(this->owner().time().value());
248 patchDiameters_[localPatchi].append(
p.d());
249 patchParticles_[localPatchi].append(
p.nParticle());
Various functions to operate on Lists.
Templated cloud function object base class.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
const fvMesh & mesh() const
Return reference to the mesh.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A min/max value pair with additional methods. In addition to conveniently storing values,...
Output to file stream, using an OSstream.
Computes a histogram for the distribution of particle diameters and corresponding number of particles...
virtual void postPatch(const parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
void write()
Write post-processing info.
PatchParticleHistogram()=delete
No default construct.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Mesh data needed to do the Finite Volume discretisation.
label index() const noexcept
The index of this patch in the boundaryMesh.
wordList names() const
Return a list of patch names.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
const dictionary & dict() const
Return const access to the cloud dictionary.
A List of wordRe with additional matching capabilities.
labelList matching(const UList< StringType > &input, const bool invert=false) const
Return list indices for all matches.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
Operations on lists of strings.