41 template<
class TrackCloudType>
44 bool valid = c.size();
51 c.checkFieldIOobject(c, origProcId);
57 c.checkFieldIOobject(c,
origId);
64 p.origProc_ = origProcId[i];
71 template<
class TrackCloudType>
94 origId[i] = iter().origId_;
103 template<
class TrackCloudType>
106 const vector& displacement,
107 const scalar fraction,
108 TrackCloudType& cloud,
119 changeToMasterPatch();
126 template<
class TrackCloudType>
129 const vector& displacement,
130 const scalar fraction,
131 TrackCloudType& cloud,
140 typename TrackCloudType::particleType&
p =
141 static_cast<typename TrackCloudType::particleType&
>(*this);
142 typename TrackCloudType::particleType::trackingData& ttd =
143 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
155 if (!p.hitPatch(cloud, ttd))
159 if (isA<wedgePolyPatch>(patch))
161 p.hitWedgePatch(cloud, ttd);
163 else if (isA<symmetryPlanePolyPatch>(patch))
165 p.hitSymmetryPlanePatch(cloud, ttd);
167 else if (isA<symmetryPolyPatch>(patch))
169 p.hitSymmetryPatch(cloud, ttd);
171 else if (isA<cyclicPolyPatch>(patch))
173 p.hitCyclicPatch(cloud, ttd);
175 else if (isA<cyclicACMIPolyPatch>(patch))
177 p.hitCyclicACMIPatch(displacement, fraction, cloud, ttd);
179 else if (isA<cyclicAMIPolyPatch>(patch))
181 p.hitCyclicAMIPatch(displacement, fraction, cloud, ttd);
183 else if (isA<cyclicRepeatAMIPolyPatch>(patch))
185 p.hitCyclicRepeatAMIPatch(displacement, fraction, cloud, ttd);
187 else if (isA<processorPolyPatch>(patch))
189 p.hitProcessorPatch(cloud, ttd);
191 else if (isA<wallPolyPatch>(patch))
193 p.hitWallPatch(cloud, ttd);
204 template<
class TrackCloudType>
207 const vector& displacement,
208 const scalar fraction,
209 TrackCloudType& cloud,
220 hitFace(displacement, fraction, cloud, td);
226 template<
class TrackCloudType>
233 template<
class TrackCloudType>
237 <<
"Hitting a wedge patch should not be possible." 244 template<
class TrackCloudType>
247 TrackCloudType& cloud,
255 template<
class TrackCloudType>
263 template<
class TrackCloudType>
275 tetPti_ = mesh_.
faces()[tetFacei_].
size() - 1 - tetPti_;
288 template<
class TrackCloudType>
291 const vector& displacement,
292 const scalar fraction,
293 TrackCloudType& cloud,
303 Info<<
"Particle " <<
origId() <<
" crossing AMI from " << cpp.
name()
308 vector sendNormal, sendDisplacement;
317 displacement - fraction*sendDisplacement,
325 if (receiveFacei < 0)
329 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
330 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
331 <<
" failed at position " << pos <<
" and with displacement " 332 << (displacement - fraction*sendDisplacement) <<
nl 333 <<
" A receiving face could not be found" <<
nl 334 <<
" The particle has been removed" <<
nl <<
endl;
339 facei_ = tetFacei_ = receiveFacei + receiveCpp.
start();
347 "Particle crossed between " + cyclicAMIPolyPatch::typeName +
348 " patches " + cpp.
name() +
" and " + receiveCpp.
name() +
349 " to a location outside of the mesh." 357 vector displacementT = displacement;
367 displacementT = AMITransform.
transform(displacementT);
380 vector receiveNormal, receiveDisplacement;
381 patchData(receiveNormal, receiveDisplacement);
383 if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
387 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
388 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
389 <<
" failed at position " << pos <<
" and with displacement " 390 << (displacementT - fraction*receiveDisplacement) <<
nl 391 <<
" The displacement points into both the source and " 392 <<
"receiving faces, so the tracking cannot proceed" <<
nl 393 <<
" The particle has been removed" <<
nl <<
endl;
400 template<
class TrackCloudType>
403 const vector& displacement,
404 const scalar fraction,
405 TrackCloudType& cloud,
409 typename TrackCloudType::particleType&
p =
410 static_cast<typename TrackCloudType::particleType&
>(*this);
415 vector patchNormal, patchDisplacement;
416 patchData(patchNormal, patchDisplacement);
422 const scalar mask = cpp.
mask()[localFacei];
423 bool couple = mask >= 1 - cpp.
tolerance();
424 bool nonOverlap = mask <= cpp.
tolerance();
429 if (!couple && !nonOverlap)
436 displacement - fraction*patchDisplacement,
439 nonOverlap = !couple;
444 p.hitCyclicAMIPatch(displacement, fraction, cloud, td);
451 p.hitFaceNoChangeToMasterPatch(displacement, fraction, cloud, td);
456 template<
class TrackCloudType>
459 const vector& displacement,
460 const scalar fraction,
461 TrackCloudType& cloud,
465 typename TrackCloudType::particleType&
p =
466 static_cast<typename TrackCloudType::particleType&
>(*this);
468 p.hitCyclicAMIPatch(displacement, fraction, cloud, td);
472 template<
class TrackCloudType>
477 template<
class TrackCloudType>
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
void hitFace(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Hit the current face. If the current face is internal than this.
label origProc() const
Return the originating processor ID.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
bool typeHeaderOk(const bool checkType=true)
Read header (uses typeFilePath to find file) and check header.
bool onBoundaryFace() const
Is the particle on a boundary face?
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
scalar trackToFace(const vector &displacement, const scalar fraction)
As particle::track, but stops when a face is hit.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelPair pointAMIAndFace(const label facei, const vector &n, point &p) const
Return the transform and face indices on neighbour patch which.
scalar trackToAndHitFace(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
void hitWallPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
void hitSymmetryPlanePatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a.
virtual const transformer & transform() const
Return transformation between the coupled patches.
const cyclicPolyPatch & nbrPatch() const
const dimensionedScalar & c
Speed of light in a vacuum.
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
void hitSymmetryPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a symmetryPatch.
const List< transformer > & AMITransforms() const
Return a reference to the AMI transforms.
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
virtual const cyclicAMIPolyPatch & nbrPatch() const
Return a reference to the neighbour patch.
vector normal() const
Return the normal of the tri on tetFacei_ for the.
void patchData(vector &normal, vector &displacement) const
Get the normal and displacement of the current patch location.
dimensionedScalar pos(const dimensionedScalar &ds)
void hitFaceNoChangeToMasterPatch(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
As above, but does not change the master patch. Needed in order for.
An ordered pair of two objects of type <T> with first() and second() elements.
static const Identity< scalar > I
void hitProcessorPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
virtual bool write(const bool write=true) const
Write using setting from DB.
void hitCyclicACMIPatch(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
virtual const labelList & faceOwner() const
Return face owner.
virtual const transformer & transform() const
Return transformation between the coupled patches.
void hitCyclicPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a cyclicPatch.
Cyclic patch for Arbitrary Mesh Interface (AMI)
virtual const faceList & faces() const
Return raw faces.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
label origId() const
Return the particle ID on the originating processor.
bool onFace() const
Is the particle on a face?
const Type & second() const
Return second.
void hitWedgePatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a wedgePatch.
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
#define WarningInFunction
Report a warning using Foam::Warning.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
virtual bool owner() const
Does this side own the patch?
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
label start() const
Return start label of this patch in the polyMesh face list.
bool hitPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a patch.
bool onInternalFace() const
Is the particle on an internal face?
void hitCyclicAMIPatch(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a cyclicAMIPatch.
label transformGlobalFace(const label facei) const
For a given patch face index, return the corresponding index of the.
Helper IO class to read and write particle positions.
A patch is a list of labels that address the faces in the global face list.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const Type & first() const
Return first.
A primitive field of type <T> with automated input and output.
vector position() const
Return current particle position.
label patch() const
Return the index of patch that the particle is on.
void hitCyclicRepeatAMIPatch(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting an.
static scalar tolerance()
Overlap tolerance.
label whichFace(const label l) const
Return label of face in patch from global face label.