41 template<
class TrackCloudType>
44 bool valid = c.size();
54 c.checkFieldIOobject(c, origProcId);
60 c.checkFieldIOobject(c,
origId);
67 p.origProc_ = origProcId[i];
74 template<
class TrackCloudType>
97 origId[i] = iter().origId_;
106 template<
class TrackCloudType>
109 const vector& displacement,
110 const scalar fraction,
111 TrackCloudType& cloud,
120 typename TrackCloudType::particleType&
p =
121 static_cast<typename TrackCloudType::particleType&
>(*this);
122 typename TrackCloudType::particleType::trackingData& ttd =
123 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
135 forAll(cloud.patchNonConformalCyclicPatches()[p.patch()], i)
139 p.hitNonConformalCyclicPatch
143 cloud.patchNonConformalCyclicPatches()[p.patch()][i],
153 if (!p.hitPatch(cloud, ttd))
157 if (isA<wedgePolyPatch>(patch))
159 p.hitWedgePatch(cloud, ttd);
161 else if (isA<symmetryPlanePolyPatch>(patch))
163 p.hitSymmetryPlanePatch(cloud, ttd);
165 else if (isA<symmetryPolyPatch>(patch))
167 p.hitSymmetryPatch(cloud, ttd);
169 else if (isA<cyclicPolyPatch>(patch))
171 p.hitCyclicPatch(cloud, ttd);
173 else if (isA<cyclicAMIPolyPatch>(patch))
175 p.hitCyclicAMIPatch(displacement, fraction, cloud, ttd);
177 else if (isA<processorPolyPatch>(patch))
179 p.hitProcessorPatch(cloud, ttd);
181 else if (isA<wallPolyPatch>(patch))
183 p.hitWallPatch(cloud, ttd);
194 template<
class TrackCloudType>
197 const vector& displacement,
198 const scalar fraction,
199 TrackCloudType& cloud,
210 hitFace(displacement, fraction, cloud, td);
216 template<
class TrackCloudType>
223 template<
class TrackCloudType>
227 <<
"Hitting a wedge patch should not be possible." 234 template<
class TrackCloudType>
237 TrackCloudType& cloud,
245 template<
class TrackCloudType>
253 template<
class TrackCloudType>
265 tetPti_ = mesh_.
faces()[tetFacei_].
size() - 1 - tetPti_;
278 template<
class TrackCloudType>
281 const vector& displacement,
282 const scalar fraction,
283 TrackCloudType& cloud,
293 Info<<
"Particle " <<
origId() <<
" crossing AMI from " << cpp.
name()
298 vector sendNormal, sendDisplacement;
307 displacement - fraction*sendDisplacement,
315 if (receiveFacei < 0)
319 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
320 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
321 <<
" failed at position " << pos <<
" and with displacement " 322 << (displacement - fraction*sendDisplacement) <<
nl 323 <<
" A receiving face could not be found" <<
nl 324 <<
" The particle has been removed" <<
nl <<
endl;
329 facei_ = tetFacei_ = receiveFacei + receiveCpp.
start();
337 "Particle crossed between " + cyclicAMIPolyPatch::typeName +
338 " patches " + cpp.
name() +
" and " + receiveCpp.
name() +
339 " to a location outside of the mesh." 347 vector displacementT = displacement;
357 displacementT = AMITransform.
transform(displacementT);
370 vector receiveNormal, receiveDisplacement;
371 patchData(receiveNormal, receiveDisplacement);
373 if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
377 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
378 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
379 <<
" failed at position " << pos <<
" and with displacement " 380 << (displacementT - fraction*receiveDisplacement) <<
nl 381 <<
" The displacement points into both the source and " 382 <<
"receiving faces, so the tracking cannot proceed" <<
nl 383 <<
" The particle has been removed" <<
nl <<
endl;
390 template<
class TrackCloudType>
393 const vector& displacement,
394 const scalar fraction,
396 TrackCloudType& cloud,
407 vector sendNormal, sendDisplacement;
418 displacement - fraction*sendDisplacement,
425 if (receiveProcFace.
proci == -1)
return false;
443 receiveProcFace.
facei 454 template<
class TrackCloudType>
464 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.
const polyMesh & mesh() const
Return the mesh database.
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
bool onBoundaryFace() const
Is the particle on a boundary face?
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Structure to conveniently store processor and face indices.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
label facei
The face index.
void correctAfterNonConformalCyclicTransfer(const label sendToPatch)
Make changes following a transfer across a non conformal cyclic.
Templated form of IOobject providing type information for file reading and header type checking...
#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.
label proci
The processor index.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
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.
Pair< scalar > stepFractionSpan() const
Return the step fraction change within the overall time-step.
virtual const transformer & transform() const
Return transformation between the coupled patches.
const cyclicPolyPatch & nbrPatch() const
label sendFromPatch
Patch from which to send the particle.
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.
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)
An ordered pair of two objects of type <T> with first() and second() elements.
label face() const
Return current face particle is on otherwise -1.
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.
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.
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.
label sendToPatch
Patch to which to send the particle.
#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?
label index() const
Return the index of this patch in the boundaryMesh.
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.
void prepareForNonConformalCyclicTransfer(const label sendToPatch, const label sendToPatchFace)
Make changes prior to a transfer across a non conformal cyclic.
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.
bool hitNonConformalCyclicPatch(const vector &displacement, const scalar fraction, const label patchi, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting an.
label sendToProc
Processor to send the particle to. -1 indicates that this.
const Type & first() const
Return first.
A primitive field of type <T> with automated input and output.
vector position() const
Return current particle position.
virtual label nbrPatchID() const
Neighbour patchID.
label patch() const
Return the index of patch that the particle is on.
label sendToPatchFace
Patch face to which to send the particle.
label whichFace(const label l) const
Return label of face in patch from global face label.