42 template<
class TrackCloudType>
45 bool valid = c.size();
52 c.checkFieldIOobject(c, origProcId);
58 c.checkFieldIOobject(c,
origId);
65 p.origProc_ = origProcId[i];
72 template<
class TrackCloudType>
95 origId[i] = iter().origId_;
104 template<
class TrackCloudType>
107 const vector& displacement,
108 const scalar fraction,
109 TrackCloudType& cloud,
120 changeToMasterPatch();
127 template<
class TrackCloudType>
130 const vector& displacement,
131 const scalar fraction,
132 TrackCloudType& cloud,
141 typename TrackCloudType::particleType&
p =
142 static_cast<typename TrackCloudType::particleType&
>(*this);
143 typename TrackCloudType::particleType::trackingData& ttd =
144 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
156 if (!p.hitPatch(cloud, ttd))
160 if (isA<wedgePolyPatch>(patch))
162 p.hitWedgePatch(cloud, ttd);
164 else if (isA<symmetryPlanePolyPatch>(patch))
166 p.hitSymmetryPlanePatch(cloud, ttd);
168 else if (isA<symmetryPolyPatch>(patch))
170 p.hitSymmetryPatch(cloud, ttd);
172 else if (isA<cyclicPolyPatch>(patch))
174 p.hitCyclicPatch(cloud, ttd);
176 else if (isA<cyclicACMIPolyPatch>(patch))
178 p.hitCyclicACMIPatch(displacement, fraction, cloud, ttd);
180 else if (isA<cyclicAMIPolyPatch>(patch))
182 p.hitCyclicAMIPatch(displacement, fraction, cloud, ttd);
184 else if (isA<cyclicRepeatAMIPolyPatch>(patch))
186 p.hitCyclicRepeatAMIPatch(displacement, fraction, cloud, ttd);
188 else if (isA<processorPolyPatch>(patch))
190 p.hitProcessorPatch(cloud, ttd);
192 else if (isA<wallPolyPatch>(patch))
194 p.hitWallPatch(cloud, ttd);
205 template<
class TrackCloudType>
208 const vector& displacement,
209 const scalar fraction,
210 TrackCloudType& cloud,
221 hitFace(displacement, fraction, cloud, td);
227 template<
class TrackCloudType>
234 template<
class TrackCloudType>
238 <<
"Hitting a wedge patch should not be possible." 245 template<
class TrackCloudType>
248 TrackCloudType& cloud,
256 template<
class TrackCloudType>
264 template<
class TrackCloudType>
276 tetPti_ = mesh_.
faces()[tetFacei_].
size() - 1 - tetPti_;
289 template<
class TrackCloudType>
292 const vector& displacement,
293 const scalar fraction,
294 TrackCloudType& cloud,
304 Info<<
"Particle " <<
origId() <<
" crossing AMI from " << cpp.
name()
309 vector sendNormal, sendDisplacement;
318 displacement - fraction*sendDisplacement,
326 if (receiveFacei < 0)
330 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
331 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
332 <<
" failed at position " << pos <<
" and with displacement " 333 << (displacement - fraction*sendDisplacement) <<
nl 334 <<
" A receiving face could not be found" <<
nl 335 <<
" The particle has been removed" <<
nl <<
endl;
340 facei_ = tetFacei_ = receiveFacei + receiveCpp.
start();
348 "Particle crossed between " + cyclicAMIPolyPatch::typeName +
349 " patches " + cpp.
name() +
" and " + receiveCpp.
name() +
350 " to a location outside of the mesh." 358 vector displacementT = displacement;
368 displacementT = AMITransform.
transform(displacementT);
381 vector receiveNormal, receiveDisplacement;
382 patchData(receiveNormal, receiveDisplacement);
384 if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
388 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
389 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
390 <<
" failed at position " << pos <<
" and with displacement " 391 << (displacementT - fraction*receiveDisplacement) <<
nl 392 <<
" The displacement points into both the source and " 393 <<
"receiving faces, so the tracking cannot proceed" <<
nl 394 <<
" The particle has been removed" <<
nl <<
endl;
401 template<
class TrackCloudType>
404 const vector& displacement,
405 const scalar fraction,
406 TrackCloudType& cloud,
410 typename TrackCloudType::particleType&
p =
411 static_cast<typename TrackCloudType::particleType&
>(*this);
416 vector patchNormal, patchDisplacement;
417 patchData(patchNormal, patchDisplacement);
423 const scalar mask = cpp.
mask()[localFacei];
424 bool couple = mask >= 1 - cpp.
tolerance();
425 bool nonOverlap = mask <= cpp.
tolerance();
430 if (!couple && !nonOverlap)
437 displacement - fraction*patchDisplacement,
440 nonOverlap = !couple;
445 p.hitCyclicAMIPatch(displacement, fraction, cloud, td);
452 p.hitFaceNoChangeToMasterPatch(displacement, fraction, cloud, td);
457 template<
class TrackCloudType>
460 const vector& displacement,
461 const scalar fraction,
462 TrackCloudType& cloud,
466 typename TrackCloudType::particleType&
p =
467 static_cast<typename TrackCloudType::particleType&
>(*this);
469 p.hitCyclicAMIPatch(displacement, fraction, cloud, td);
473 template<
class TrackCloudType>
478 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
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 dimensionedScalar c
Speed of light in a vacuum.
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.