96template<
class CloudType>
99 const UList<particleInfo>& data
106 getData(data, &particleInfo::position),
110 writerPtr_->open(coords, this->baseTimeDir() /
"zoneParticles");
111 writerPtr_->beginTime(this->owner().time());
114#define writeLocal(field) \
115 writerPtr_->write(#field, getData(data, &particleInfo::field));
127 writerPtr_->endTime();
132template<
class CloudType>
135 this->writeHeaderValue(
os,
"cellZone", cellZoneName_);
136 this->writeHeaderValue(
os,
"time", this->owner().time().timeOutputValue());
137 this->writeHeader(
os,
"");
138 this->writeCommented(
os,
"origID");
139 os <<
tab <<
"origProc"
151template<
class CloudType>
154 return this->owner().mesh().cellZones()[cellZoneId_].whichCell(celli) != -1;
158template<
class CloudType>
161 const particleInfo&
p
166 const auto& d = data_[i];
167 if ((d.origProc ==
p.origProc) && (d.origID ==
p.origID))
179template<
class CloudType>
184 const word& modelName
188 functionObjects::writeFile
194 cellZoneName_(this->coeffDict().getWord(
"cellZone")),
198 maxIDs_(
Pstream::nProcs(), Zero),
204 this->coeffDict().getWord(
"writer"),
205 this->coeffDict().subOrEmptyDict(
"formatOptions")
214 cellZoneId_ = cellZones.findZoneID(cellZoneName_);
215 if (cellZoneId_ == -1)
218 <<
"Unable to find cellZone " << cellZoneName_
219 <<
". Available cellZones are:" << cellZones.names()
223 Info<<
" Processing cellZone" << cellZoneName_ <<
" with id "
224 << cellZoneId_ <<
endl;
238 Info<<
" Restarting with " << data_.size()
239 <<
" particles" <<
endl;
244 <<
"Case restarted with a different number of processors."
245 <<
" Restarting particle statistics." <<
endl;
255template<
class CloudType>
263 cellZoneName_(pzi.cellZoneName_),
264 cellZoneId_(pzi.cellZoneId_),
266 movedParticles_(pzi.movedParticles_),
274template<
class CloudType>
282template<
class CloudType>
289 <<
" Cell zone = " << cellZoneName_ <<
nl
290 <<
" Contributions = "
294 if (!this->writeTime())
299 for (
const auto&
p : movedParticles_)
301 const label
id = getParticleID(
p);
307 maxIDs_[
p.origProc] =
max(maxIDs_[
p.origProc],
p.origID);
316 movedParticles_.
clear();
323template<
class CloudType>
332 if (inZone(
p.cell()))
338 newData.
time0 = this->owner().time().value() + dt;
345 movedParticles_.append(newData);
350template<
class CloudType>
354 this->createFile(
"particles", this->owner().time().timeOutputValue());
368 forAll(procParticles, proci)
370 procParticles[proci].
resize(allMaxIDs[proci] + 1);
374 for (
const auto& d : data_)
376 procParticles[d.origProc][d.origID] = d;
379 for (
auto& particles : procParticles)
382 for (
const auto&
p : particles)
394 writeWriter(globalParticles);
401 for (
const auto&
p : globalParticles)
410 Info<<
" Number of particles = " << nData <<
nl
413 this->setModelProperty(
"data", globalParticles);
414 this->setModelProperty(
"maxIDs", allMaxIDs);
420 this->setModelProperty(
"maxIDs",
labelList());
430 for (
const auto&
p : data_)
435 Info<<
" Number of particles = " << data_.size() <<
nl
438 this->setModelProperty(
"data", data_);
439 this->setModelProperty(
"maxIDs", maxIDs_);
#define writeLocal(field)
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 vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
Generic templated field type.
void resize(const label len)
Adjust allocated size of list.
void clear()
Clear the list, i.e. set size to zero.
virtual void postEvolve()
Post-evolve hook.
virtual const fileName & name() const
Read/write access to the name of the stream.
Reports cloud information for particles passing through a specified cell zone.
virtual void postMove(parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
virtual void write()
Write.
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
Inter-processor communications stream.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Base class for writing coordSet(s) and tracks with fields.
Database for solution data, solver performance and other reduced data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Class used to pass data into container.
bool inZone() const
True if starting point is valid (ie, not point::max)
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
splitCell * master() const
bool getModelProperty(const word &entryName, Type &value) const
Retrieve generic property from the sub-model.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< Type > getData(const Foam::UList< Foam::particleInfo > &data, Type Foam::particleInfo::*field)
List< scalar > scalarList
A List of scalars.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
#define forAll(list, i)
Loop across all elements in list.
void operator()(particleInfo &p1, const particleInfo &p2) const
scalar isOlderThan(const particleInfo &p) const