41template<
class ParticleType>
42void Foam::Cloud<ParticleType>::checkPatches()
const
44 for (
const polyPatch&
pp : polyMesh_.boundaryMesh())
46 const auto* camipp = isA<cyclicAMIPolyPatch>(
pp);
48 if (camipp && camipp->owner() && camipp->AMI().distributed())
51 <<
"Particle tracking across AMI patches is only currently "
52 <<
"supported for cases where the AMI patches reside on a "
53 <<
"single processor" <<
abort(FatalError);
62template<
class ParticleType>
65 const polyMesh& pMesh,
72 geometryType_(cloud::geometryType::COORDINATES)
76 (void)polyMesh_.tetBasePtIs();
77 (void)polyMesh_.oldCellCentres();
81template<
class ParticleType>
93 IDLList<ParticleType>::operator=(particles);
100template<
class ParticleType>
107template<
class ParticleType>
114template<
class ParticleType>
117 for (ParticleType&
p : *
this)
122 <<
"deleting lost particle at position " <<
p.position()
131template<
class ParticleType>
136 ParticleType::particleCount_ = 0;
141template<
class ParticleType>
142template<
class TrackCloudType>
145 TrackCloudType&
cloud,
146 typename ParticleType::trackingData&
td,
147 const scalar trackTime
164 for (ParticleType&
p : *
this)
170 globalPositionsPtr_.
clear();
198 forAll(UOPstreamPtrs, proci)
200 auto* osptr = UOPstreamPtrs.get(proci);
208 for (ParticleType&
p : *
this)
211 const bool keepParticle =
p.move(
cloud,
td, trackTime);
217 if (
td.switchProcessor)
223 || !
p.onBoundaryFace()
224 || procPatchNeighbours[
p.patch()] < 0
228 <<
"Switch processor flag is true when no parallel "
229 <<
"transfer is possible. This is a bug."
234 const label patchi =
p.patch();
236 const label toProci =
243 auto* osptr = UOPstreamPtrs.
get(toProci);
247 UOPstreamPtrs.set(toProci, osptr);
250 p.prepareForParallelTransfer();
253 (*osptr) << procPatchNeighbours[patchi] <<
p;
279 for (
const label proci : neighbourProcs)
289 auto* newp =
new ParticleType(polyMesh_, is);
292 patchi = procPatches[patchi];
294 (*newp).correctAfterParallelTransfer(patchi,
td);
303template<
class ParticleType>
306 if (!globalPositionsPtr_)
309 <<
"Global positions are not available. "
310 <<
"Cloud::storeGlobalPositions has not been called."
316 cellWallFacesPtr_.clear();
321 (void)polyMesh_.tetBasePtIs();
322 (void)polyMesh_.oldCellCentres();
324 const vectorField& positions = globalPositionsPtr_();
327 for (ParticleType&
p : *
this)
329 p.autoMap(positions[i], mapper);
335template<
class ParticleType>
340 this->db().time().
path()/this->
name() +
"_positions.obj"
343 for (
const ParticleType&
p : *
this)
345 const point position(
p.position());
347 << position.
x() <<
' '
348 << position.
y() <<
' '
349 << position.
z() <<
nl;
354template<
class ParticleType>
362 globalPositionsPtr_.reset(
new vectorField(this->size()));
366 for (
const ParticleType&
p : *
this)
368 positions[i] =
p.position();
const word cloudName(propsDict.get< word >("cloud"))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
Base cloud calls templated on particle type.
void writePositions() const
Write positions to <cloudName>_positions.obj file.
void deleteParticle(ParticleType &p)
Remove particle from cloud and delete.
void deleteLostParticles()
Remove lost particles from cloud and delete.
Cloud(const polyMesh &mesh, const Foam::zero, const word &cloudName)
Construct without particles.
void move(TrackCloudType &cloud, typename ParticleType::trackingData &td, const scalar trackTime)
Move the particles.
void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
void cloudReset(const Cloud< ParticleType > &c)
Reset the particles.
const polyMesh & pMesh() const noexcept
Return the polyMesh reference.
cloud::geometryType geometryType_
Geometry type.
void storeGlobalPositions() const
Call this before a topology change.
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
label size() const noexcept
The number of elements in list.
void operator=(const ILList< DLListBase, T > &lst)
const objectRegistry & db() const noexcept
Return the local objectRegistry.
bool eof() const noexcept
True if end of input seen.
void clear()
Clear the list, i.e. set size to zero.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
bool allowClearRecv() const noexcept
Is clearStorage of individual receive buffer by external hooks allowed? (default: true).
bool hasRecvData() const
True if any (local) recv buffers have unconsumed data. Must call finishedSends() or other finished....
label recvDataCount(const label proci) const
Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other fi...
void clear()
Clear all send/recv buffers and reset states.
void finishedNeighbourSends(const labelUList &neighProcs, const bool wait=true)
Mark the send phase as being finished, with communication being limited to a known subset of send/rec...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Input inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
bool get(const label i) const
Return bool value at specified position, always false for out-of-range access.
Output inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static bool & parRun() noexcept
Test if this a parallel run.
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
A cloud is a registry collection of lagrangian particles.
geometryType
Cloud geometry type (internal or IO representations).
cloud(const cloud &)=delete
No copy construct.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelList & processorPatches() const noexcept
Return list of processor patch labels.
const labelList & processorPatchNeighbours() const noexcept
Return processorPatchIndices of the neighbours processor patches. -1 if not running parallel.
const processorTopology & topology() const noexcept
The processor to processor topology.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const Time & time() const noexcept
Return time registry.
A traits class, which is primarily used for primitives and vector-space.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
const labelList & procNeighbours() const
The neighbour processor connections (ascending order) associated with the local rank.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
#define WarningInFunction
Report a warning using Foam::Warning.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
ILList< DLListBase, T > IDLList
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
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)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.