33template<
class TrackCloudType>
36 TrackCloudType&
cloud,
38 const scalar trackFraction
41 typename TrackCloudType::particleType&
p =
42 static_cast<typename TrackCloudType::particleType&
>(*this);
43 typename TrackCloudType::particleType::trackingData& ttd =
44 static_cast<typename TrackCloudType::particleType::trackingData&
>(td);
48 label origFacei =
face();
49 label patchi =
patch();
53 if (
face() != origFacei)
60 if (isA<processorPolyPatch>(
patch))
62 p.hitProcessorPatch(
cloud, ttd);
64 else if (isA<wallPolyPatch>(
patch))
66 p.hitWallPatch(
cloud, ttd);
78template<
class TrackCloudType>
81 TrackCloudType&
cloud,
107 scalar trackFraction = 0.0;
113 const edge meshEdge(currentEdge());
117 if (
mesh().isInternalFace(tetFace()))
128 tetIndices nbrTi(nbrCelli, tetFace(), tetPt());
130 const bool posVol = (nbrTi.
tet(
mesh()).
mag() > 0);
131 const vector path(endPosition - localPosition_);
138 this->
cell() = nbrCelli;
139 patchInteraction(
cloud, td, trackFraction);
145 crossEdgeConnectedFace(meshEdge);
146 patchInteraction(
cloud, td, trackFraction);
153 crossEdgeConnectedFace(meshEdge);
154 patchInteraction(
cloud, td, trackFraction);
162 if (
mesh().isInternalFace(tetFace()))
165 <<
"Can only track on boundary faces."
166 <<
" Face:" << tetFace()
171 const triFace tri(currentTetIndices().faceTriIs(
mesh(),
false));
174 point projectedEndPosition = endPosition;
176 const bool posVol = (currentTetIndices().tet(
mesh()).mag() > 0);
181 projectedEndPosition =
182 localPosition_ - (endPosition - localPosition_);
186 const vector d(endPosition - localPosition_);
187 const scalar magD(
mag(d));
188 if (magD > ROOTVSMALL)
193 meshBb.inflate(ROOTSMALL);
196 projectedEndPosition = localPosition_ -
meshBb.mag()*d/magD;
201 bool ok =
meshBb.intersects
203 projectedEndPosition,
204 localPosition_ - projectedEndPosition,
205 projectedEndPosition,
213 projectedEndPosition = intPt;
221 projectedEndPosition -= ((projectedEndPosition - basePt)&
n)*
n;
225 bool doTrack =
false;
226 if (meshEdgeStart_ == -1 && diagEdge_ == -1)
235 doTrack = isTriAlongTrack(
n, projectedEndPosition);
243 trackFraction = trackFaceTri(
n, projectedEndPosition, triEdgei);
251 return trackFraction;
267 const label fp0 = trif[0];
275 meshEdgeStart_ = fp0;
277 crossEdgeConnectedFace(currentEdge());
278 patchInteraction(
cloud, td, trackFraction);
290 crossEdgeConnectedFace(currentEdge());
291 patchInteraction(
cloud, td, trackFraction);
296 diagEdge_ = trif[1] - fp0;
299 diagEdge_ +=
f.
size();
306 else if (triEdgei == 1)
310 meshEdgeStart_ = trif[1];
312 crossEdgeConnectedFace(currentEdge());
313 patchInteraction(
cloud, td, trackFraction);
321 meshEdgeStart_ = trif[2];
323 crossEdgeConnectedFace(currentEdge());
324 patchInteraction(
cloud, td, trackFraction);
333 meshEdgeStart_ = fp0;
335 crossEdgeConnectedFace(currentEdge());
336 patchInteraction(
cloud, td, trackFraction);
342 diagEdge_ = trif[2] - fp0;
345 diagEdge_ +=
f.
size();
357 if (meshEdgeStart_ != -1)
360 crossEdgeConnectedFace(currentEdge());
362 patchInteraction(
cloud, td, trackFraction);
376 return trackFraction;
380template<
class TrackCloudType>
383 TrackCloudType&
cloud,
397 if (meshEdgeStart_ != -1)
399 meshEdgeStart_ =
f.
size() - meshEdgeStart_-1;
404 diagEdge_ =
f.
size() - diagEdge_;
409template<
class TrackCloudType>
412 TrackCloudType&
cloud,
418template<
class TrackCloudType>
432 c.checkFieldIOobject(c, localPosition);
438 c.checkFieldIOobject(c, meshEdgeStart);
444 c.checkFieldIOobject(c, diagEdge);
449 p.localPosition_ = localPosition[i];
450 p.meshEdgeStart_ = meshEdgeStart[i];
451 p.diagEdge_ = diagEdge[i];
458template<
class TrackCloudType>
484 localPosition[i] =
p.localPosition_;
485 meshEdgeStart[i] =
p.meshEdgeStart_;
486 diagEdge[i] =
p.diagEdge_;
491 localPosition.
write();
492 meshEdgeStart.
write();
A primitive field of type <T> with automated input and output.
const PatchInteractionModel< KinematicCloud< CloudType > > & patchInteraction() const
Return const-access to the patch interaction model.
label rcIndex(const label i) const noexcept
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
A cell is defined as a list of faces with extra functionality.
A cloud is a registry collection of lagrangian particles.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
void writeFields() const
Write fields.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
bool switchProcessor
Flag to switch processor.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
label face() const noexcept
Return current face particle is on otherwise -1.
const polyMesh & mesh() const noexcept
Return the mesh database.
label patch() const
Return the index of patch that the particle is on.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const
virtual bool write(const bool valid=true) const
Write using setting from DB.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
label face() const noexcept
Return the face index.
triFace triIs(const polyMesh &mesh, const bool warn=true) const
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
triPointRef faceTri(const polyMesh &mesh) const
scalar mag() const
Return volume.
Standard boundBox with extra functionality for use in octree.
A triangular face using a FixedList of labels corresponding to mesh vertices.
vector unitNormal(const UList< point > &points) const
The unit normal.
Class used to pass tracking data to the trackToFace function.
const bitSet & isWallPatch_
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
void hitProcessorPatch(TrackCloudType &cloud, trackingData &td)
scalar trackToEdge(TrackCloudType &cloud, trackingData &td, const vector &endPosition)
Equivalent of trackToFace.
void hitWallPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))