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);
59 FatalErrorIn(
"void Foam::Cloud<ParticleType>::initCloud(const bool)")
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;
351 label neighbProci = neighbourProcs[i];
353 label nRec = allNTrans[neighbProci][Pstream::myProcNo()];
357 UIPstream particleStream(neighbProci, pBufs);
359 labelList receivePatchIndex(particleStream);
364 typename ParticleType::iNew(polyMesh_)
371 ParticleType& newp = newpIter();
373 label patchI = procPatches[receivePatchIndex[pI++]];
375 newp.correctAfterParallelTransfer(patchI, td);
377 addParticle(newParticles.
remove(&newp));
387 if (nTrackingRescues_ > 0)
389 Info<< nTrackingRescues_ <<
" tracking rescue corrections" <<
endl;
395 template<
class ParticleType>
396 template<
class TrackData>
405 Info<<
"Cloud<ParticleType>::autoMap(TrackData&, const mapPolyMesh&) " 414 cellWallFacesPtr_.
clear();
419 polyMesh_.tetBasePtIs();
424 ParticleType&
p = pIter();
426 if (reverseCellMap[p.cell()] >= 0)
428 p.cell() = reverseCellMap[p.cell()];
430 if (p.face() >= 0 && reverseFaceMap[p.face()] >= 0)
432 p.face() = reverseFaceMap[p.face()];
445 if (trackStartCell < 0)
452 p.cell() = trackStartCell;
457 const_cast<vector&
>(p.position()) =
458 polyMesh_.cellCentres()[trackStartCell];
460 p.stepFraction() = 0;
470 template<
class ParticleType>
475 this->db().time().
path()/this->
name() +
"_positions.obj" 480 const ParticleType&
p = pIter();
481 pObj<<
"v " << p.position().x() <<
" " << p.position().y() <<
" " 482 << p.position().z() <<
nl;
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const labelList & reverseFaceMap() const
Reverse face map.
const labelList & processorPatchIndices() const
Return list of indices into processorPatches_ for each patch.
void autoMap(TrackData &td, const mapPolyMesh &)
Remap the cells of particles corresponding to the.
word name(const complex &)
Return a string representation of a complex.
Output inter-processor communications stream operating on external buffer.
Input inter-processor communications stream operating on external buffer.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
#define forAllIter(Container, container, iter)
A class for handling words, derived from string.
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 size(const label)
Override size to be inconsistent with allocated storage.
T * remove(T *p)
Remove and return element.
void move(TrackData &td, const scalar trackTime)
Move the particles.
const labelList & processorPatchNeighbours() const
Return processorPatchIndices of the neighbours.
const PackedBoolList & cellHasWallFaces() const
Whether each cell has any wall faces (demand driven data)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void clear()
Clear the list, i.e. set size to zero.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void flush()
Flush stream.
label mergedCell(const label oldCellI) const
If cell is removed return cell (on new mesh) it merged into.
void deleteParticle(ParticleType &)
Remove particle from cloud and delete.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
A cloud is a collection of lagrangian particles.
errorManip< error > abort(error &err)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
label nInternalFaces() const
void cloudReset(const Cloud< ParticleType > &c)
Reset the particles.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
const dimensionedScalar c
Speed of light in a vacuum.
const labelList & reverseCellMap() const
Reverse cell map.
Base cloud calls templated on particle type.
void append(const T &)
Append an element at the end of the list.
dimensionedScalar pos(const dimensionedScalar &ds)
Cloud(const polyMesh &mesh, const IDLList< ParticleType > &particles)
Construct from mesh and a list of particles.
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
const labelList & processorPatches() const
Return list of processor patch labels.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
void writePositions() const
Write positions to <cloudName>_positions.obj file.