33 template<
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);
70 td.keepParticle =
false;
78 template<
class TrackCloudType>
81 TrackCloudType&
cloud,
107 scalar trackFraction = 0.0;
109 if (!
td.isWallPatch_[tetFace()])
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;
254 const tetIndices ti(currentTetIndices());
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;
380 template<
class TrackCloudType>
383 TrackCloudType&
cloud,
388 td.switchProcessor =
true;
397 if (meshEdgeStart_ != -1)
399 meshEdgeStart_ =
f.
size() - meshEdgeStart_-1;
409 template<
class TrackCloudType>
418 template<
class TrackCloudType>
428 IOField<point> localPosition
432 c.checkFieldIOobject(
c, localPosition);
434 IOField<label> meshEdgeStart
438 c.checkFieldIOobject(
c, meshEdgeStart);
440 IOField<label> diagEdge
444 c.checkFieldIOobject(
c, diagEdge);
447 for (wallBoundedParticle&
p :
c)
449 p.localPosition_ = localPosition[i];
450 p.meshEdgeStart_ = meshEdgeStart[i];
451 p.diagEdge_ = diagEdge[i];
458 template<
class TrackCloudType>
463 const label np =
c.size();
465 IOField<point> localPosition
470 IOField<label> meshEdgeStart
475 IOField<label> diagEdge
482 for (
const wallBoundedParticle&
p :
c)
484 localPosition[i] =
p.localPosition_;
485 meshEdgeStart[i] =
p.meshEdgeStart_;
486 diagEdge[i] =
p.diagEdge_;
491 localPosition.
write();
492 meshEdgeStart.write();
Class used to pass tracking data to the trackToFace function.
void size(const label n)
Older name for setAddressableSize.
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
triPointRef faceTri(const polyMesh &mesh) const
The triangle geometry for the face for this tet. The normal of the tri points out of the cell...
void patchInteraction(TrackCloudType &cloud, trackingData &td, const scalar trackFraction)
Do all patch interaction.
static void readFields(CloudType &)
Read.
tetPointRef tet(const polyMesh &mesh) const
The tet geometry for this tet, where point0 is the cell centre.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
virtual const pointField & points() const
Return raw points.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
void hitProcessorPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a processorPatch.
static vector areaNormal(const Point &p0, const Point &p1, const Point &p2)
The area normal for a triangle defined by three points (right-hand rule). Magnitude equal to area of ...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
scalar trackToEdge(TrackCloudType &cloud, trackingData &td, const vector &endPosition)
Equivalent of trackToFace.
A cloud is a registry collection of lagrangian particles.
scalar mag() const
Return volume.
virtual const labelList & faceOwner() const
Return face owner.
virtual bool write(const bool writeOnProc=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...
virtual const faceList & faces() const
Return raw faces.
errorManip< error > abort(error &err)
static void writeFields(const CloudType &)
Write.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const vectorField & faceCentres() const
void hitWallPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
const polyMesh & mesh() const noexcept
Return the mesh database.
vector point
Point is a vector.
A cell is defined as a list of faces with extra functionality.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
const dimensionedScalar c
Speed of light in a vacuum.
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
label face() const noexcept
Return current face particle is on otherwise -1.
A patch is a list of labels that address the faces in the global face list.
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
label patch() const
Return the index of patch that the particle is on.