41 template<
class ParticleType>
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 " 62 template<
class ParticleType>
72 geometryType_(
cloud::geometryType::COORDINATES)
76 (void)polyMesh_.tetBasePtIs();
77 (void)polyMesh_.oldCellCentres();
81 template<
class ParticleType>
93 IDLList<ParticleType>::operator=(particles);
100 template<
class ParticleType>
107 template<
class ParticleType>
110 delete(this->
remove(&
p));
114 template<
class ParticleType>
117 for (ParticleType&
p : *
this)
122 <<
"deleting lost particle at position " <<
p.position()
131 template<
class ParticleType>
136 ParticleType::particleCount_ = 0;
141 template<
class ParticleType>
142 template<
class TrackCloudType>
145 TrackCloudType&
cloud,
146 typename ParticleType::trackingData&
td,
147 const scalar trackTime
164 for (ParticleType&
p : *
this)
170 globalPositionsPtr_.clear();
185 PstreamBuffers pBufs;
186 pBufs.allowClearRecv(
false);
189 PtrList<UOPstream> UOPstreamPtrs(Pstream::nProcs());
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 =
238 refCast<const processorPolyPatch>(
pbm[patchi])
243 auto* osptr = UOPstreamPtrs.get(toProci);
246 osptr =
new UOPstream(toProci, pBufs);
247 UOPstreamPtrs.set(toProci, osptr);
250 p.prepareForParallelTransfer();
253 (*osptr) << procPatchNeighbours[patchi] <<
p;
265 if (!Pstream::parRun())
270 pBufs.finishedNeighbourSends(neighbourProcs);
279 for (
const label proci : neighbourProcs)
281 if (pBufs.recvDataCount(proci))
283 UIPstream is(proci, pBufs);
288 label patchi = pTraits<label>(is);
289 auto* newp =
new ParticleType(polyMesh_, is);
292 patchi = procPatches[patchi];
294 (*newp).correctAfterParallelTransfer(patchi,
td);
303 template<
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);
335 template<
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;
354 template<
class ParticleType>
362 globalPositionsPtr_.reset(
new vectorField(this->size()));
366 for (
const ParticleType&
p : *
this)
368 positions[i] =
p.position();
Template class for intrusive linked lists.
const polyBoundaryMesh & pbm
void cloudReset(const Cloud< ParticleType > &c)
Reset the particles.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
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.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
#define forAll(list, i)
Loop across all elements in list.
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void storeGlobalPositions() const
Call this before a topology change.
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
A cloud is a registry collection of lagrangian particles.
Cloud(const polyMesh &mesh, const Foam::zero, const word &cloudName)
Construct without particles.
errorManip< error > abort(error &err)
Base cloud calls templated on particle type.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
void deleteLostParticles()
Remove lost particles from cloud and delete.
const labelList & processorPatchNeighbours() const noexcept
Return processorPatchIndices of the neighbours processor patches. -1 if not running parallel...
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
const labelList & procNeighbours() const
The neighbour processor connections (ascending order) associated with the local rank.
void move(TrackCloudType &cloud, typename ParticleType::trackingData &td, const scalar trackTime)
Move the particles.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
const processorTopology & topology() const noexcept
The processor to processor topology.
const dimensionedScalar c
Speed of light in a vacuum.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Field< vector > vectorField
Specialisation of Field<T> for vector.
Mesh consisting of general polyhedral cells.
void deleteParticle(ParticleType &p)
Remove particle from cloud and delete.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
void writePositions() const
Write positions to <cloudName>_positions.obj file.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())