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_;
287 : receiveCpp.
forwardT()[receiveFacei]
304 template<
class TrackCloudType>
307 const vector& displacement,
308 const scalar fraction,
309 TrackCloudType& cloud,
319 Info<<
"Particle " <<
origId() <<
" crossing AMI from " << cpp.
name()
324 vector sendNormal, sendDisplacement;
333 displacement - fraction*sendDisplacement,
341 if (receiveFacei < 0)
345 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
346 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
347 <<
" failed at position " << pos <<
" and with displacement " 348 << (displacement - fraction*sendDisplacement) <<
nl 349 <<
" A receiving face could not be found" <<
nl 350 <<
" The particle has been removed" <<
nl <<
endl;
355 facei_ = tetFacei_ = receiveFacei + receiveCpp.
start();
363 "Particle crossed between " + cyclicAMIPolyPatch::typeName +
364 " patches " + cpp.
name() +
" and " + receiveCpp.
name() +
365 " to a location outside of the mesh." 373 vector displacementT = displacement;
379 if (AMITransform.
hasR())
382 displacementT =
transform(AMITransform.
R(), displacementT);
398 displacementT =
transform(T, displacementT);
415 vector receiveNormal, receiveDisplacement;
416 patchData(receiveNormal, receiveDisplacement);
418 if (((displacementT - fraction*receiveDisplacement)&receiveNormal) > 0)
422 <<
"Particle transfer from " << cyclicAMIPolyPatch::typeName
423 <<
" patches " << cpp.
name() <<
" to " << receiveCpp.
name()
424 <<
" failed at position " << pos <<
" and with displacement " 425 << (displacementT - fraction*receiveDisplacement) <<
nl 426 <<
" The displacement points into both the source and " 427 <<
"receiving faces, so the tracking cannot proceed" <<
nl 428 <<
" The particle has been removed" <<
nl <<
endl;
435 template<
class TrackCloudType>
438 const vector& displacement,
439 const scalar fraction,
440 TrackCloudType& cloud,
444 typename TrackCloudType::particleType&
p =
445 static_cast<typename TrackCloudType::particleType&
>(*this);
450 vector patchNormal, patchDisplacement;
451 patchData(patchNormal, patchDisplacement);
457 const scalar mask = cpp.
mask()[localFacei];
458 bool couple = mask >= 1 - cpp.
tolerance();
459 bool nonOverlap = mask <= cpp.
tolerance();
464 if (!couple && !nonOverlap)
471 displacement - fraction*patchDisplacement,
474 nonOverlap = !couple;
479 p.hitCyclicAMIPatch(displacement, fraction, cloud, td);
486 p.hitFaceNoChangeToMasterPatch(displacement, fraction, cloud, td);
491 template<
class TrackCloudType>
494 const vector& displacement,
495 const scalar fraction,
496 TrackCloudType& cloud,
500 typename TrackCloudType::particleType&
p =
501 static_cast<typename TrackCloudType::particleType&
>(*this);
503 p.hitCyclicAMIPatch(displacement, fraction, cloud, td);
507 template<
class TrackCloudType>
512 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.
virtual bool separated() const
Are the planes separated.
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 void transformProperties(const tensor &T)
Transform the physical properties of the particle.
void hitSymmetryPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a symmetryPatch.
virtual const vectorField & separation() const
If the planes are separated the separation vector.
virtual const tensorField & forwardT() const
Return face transformation tensor.
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
const List< vectorTensorTransform > & AMITransforms() const
Return a reference to the AMI transforms.
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.
virtual bool parallel() const
Are the cyclic planes parallel.
dimensionedScalar pos(const dimensionedScalar &ds)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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.
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?
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
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)
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
virtual bool owner() const
Does this side own the patch?
const dimensionedScalar c
Speed of light in a vacuum.
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
Helper IO class to read and write particle positions.
const cyclicPolyPatch & neighbPatch() const
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.
static const Vector< scalar > zero
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.
dimensionSet transform(const dimensionSet &)
label whichFace(const label l) const
Return label of face in patch from global face label.