38 template<
class ParticleType>
41 const polyBoundaryMesh& pbm = polyMesh_.boundaryMesh();
45 if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
47 const cyclicAMIPolyPatch& cami =
48 refCast<const cyclicAMIPolyPatch>(pbm[
patchi]);
52 ok = ok && (cami.AMI().singlePatchProc() != -1);
60 <<
"Particle tracking across AMI patches is only currently " 61 <<
"supported for cases where the AMI patches reside on a " 67 template<
class ParticleType>
70 cellWallFacesPtr_.reset(
new PackedBoolList(pMesh().nCells(),
false));
72 PackedBoolList& cellWallFaces = cellWallFacesPtr_();
74 const polyBoundaryMesh& patches = polyMesh_.boundaryMesh();
78 if (isA<wallPolyPatch>(patches[patchi]))
80 const polyPatch& patch = patches[
patchi];
82 const labelList& pFaceCells = patch.faceCells();
86 cellWallFaces[pFaceCells[pFCI]] =
true;
95 template<
class ParticleType>
114 polyMesh_.tetBasePtIs();
120 template<
class ParticleType>
124 const word& cloudName,
128 cloud(pMesh, cloudName),
140 polyMesh_.tetBasePtIs();
148 template<
class ParticleType>
152 if (!cellWallFacesPtr_.valid())
157 return cellWallFacesPtr_();
161 template<
class ParticleType>
168 template<
class ParticleType>
171 delete(this->
remove(&
p));
175 template<
class ParticleType>
180 ParticleType::particleCount_ = 0;
185 template<
class ParticleType>
186 template<
class TrackData>
203 const labelList& neighbourProcs = pData[Pstream::myProcNo()];
206 labelList neighbourProcIndices(Pstream::nProcs(), -1);
210 neighbourProcIndices[neighbourProcs[i]] = i;
216 pIter().stepFraction() = 0;
220 nTrackingRescues_ = 0;
227 neighbourProcs.
size()
234 neighbourProcs.
size()
245 forAll(patchIndexTransferLists, i)
247 patchIndexTransferLists[i].clear();
253 ParticleType&
p = pIter();
256 bool keepParticle = p.move(td, trackTime);
270 if (procPatchIndices[patchi] != -1)
272 label n = neighbourProcIndices
274 refCast<const processorPolyPatch>
280 p.prepareForParallelTransfer(patchi, td);
282 particleTransferLists[
n].
append(this->
remove(&p));
284 patchIndexTransferLists[
n].append
286 procPatchNeighbours[patchi]
297 if (!Pstream::parRun())
307 forAll(particleTransferLists, i)
309 if (particleTransferLists[i].size())
318 << patchIndexTransferLists[i]
319 << particleTransferLists[i];
326 pBufs.finishedSends(allNTrans);
329 bool transfered =
false;
349 label neighbProci = neighbourProcs[i];
351 label nRec = allNTrans[neighbProci];
355 UIPstream particleStream(neighbProci, pBufs);
357 labelList receivePatchIndex(particleStream);
362 typename ParticleType::iNew(polyMesh_)
369 ParticleType& newp = newpIter();
371 label patchi = procPatches[receivePatchIndex[pI++]];
373 newp.correctAfterParallelTransfer(patchi, td);
375 addParticle(newParticles.
remove(&newp));
385 if (nTrackingRescues_ > 0)
387 Info<< nTrackingRescues_ <<
" tracking rescue corrections" <<
endl;
393 template<
class ParticleType>
394 template<
class TrackData>
411 cellWallFacesPtr_.
clear();
416 polyMesh_.tetBasePtIs();
421 ParticleType&
p = pIter();
423 if (reverseCellMap[p.cell()] >= 0)
425 p.cell() = reverseCellMap[p.cell()];
427 if (p.face() >= 0 && reverseFaceMap[p.face()] >= 0)
429 p.face() = reverseFaceMap[p.face()];
442 if (trackStartCell < 0)
449 p.cell() = trackStartCell;
454 const_cast<vector&
>(p.position()) =
455 polyMesh_.cellCentres()[trackStartCell];
457 p.stepFraction() = 0;
467 template<
class ParticleType>
472 this->db().time().
path()/this->
name() +
"_positions.obj" 477 const ParticleType&
p = pIter();
478 pObj<<
"v " << p.position().x() <<
" " << p.position().y() <<
" " 479 << p.position().z() <<
nl;
void cloudReset(const Cloud< ParticleType > &c)
Reset the particles.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void deleteParticle(ParticleType &)
Remove particle from cloud and delete.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & processorPatches() const
Return list of processor patch labels.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Input inter-processor communications stream operating on external buffer.
dimensionedScalar pos(const dimensionedScalar &ds)
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
Cloud(const polyMesh &mesh, const IDLList< ParticleType > &particles)
Construct from mesh and a list of particles.
const labelList & reverseFaceMap() const
Reverse face map.
void autoMap(TrackData &td, const mapPolyMesh &)
Remap the cells of particles corresponding to the.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
A cloud is a collection of lagrangian particles.
void append(const T &)
Append an element at the end of the list.
virtual void flush()
Flush stream.
List< label > labelList
A List of labels.
T * remove(T *p)
Remove and return element.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
Base cloud calls templated on particle type.
void move(TrackData &td, const scalar trackTime)
Move the particles.
Output inter-processor communications stream operating on external buffer.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
label mergedCell(const label oldCelli) const
If cell is removed return cell (on new mesh) it merged into.
word name(const complex &)
Return a string representation of a complex.
const labelList & processorPatchNeighbours() const
Return processorPatchIndices of the neighbours.
const labelList & processorPatchIndices() const
Return list of indices into processorPatches_ for each patch.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
const dimensionedScalar c
Speed of light in a vacuum.
const labelList & reverseCellMap() const
Reverse cell map.
Mesh consisting of general polyhedral cells.
const PackedBoolList & cellHasWallFaces() const
Whether each cell has any wall faces (demand driven data)
label nInternalFaces() const
void writePositions() const
Write positions to <cloudName>_positions.obj file.
#define InfoInFunction
Report an information message using Foam::Info.