Go to the documentation of this file.
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);
78 template<
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()
167 <<
" at:" <<
mesh().faceCentres()[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;
220 const point& basePt =
mesh().points()[tri[0]];
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];
271 if (trif[1] ==
f.fcIndex(fp0))
275 meshEdgeStart_ = fp0;
277 crossEdgeConnectedFace(currentEdge());
278 patchInteraction(
cloud, td, trackFraction);
280 else if (trif[1] ==
f.rcIndex(fp0))
288 meshEdgeStart_ =
f.rcIndex(fp0);
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);
317 if (trif[2] ==
f.rcIndex(fp0))
321 meshEdgeStart_ = trif[2];
323 crossEdgeConnectedFace(currentEdge());
324 patchInteraction(
cloud, td, trackFraction);
326 else if (trif[2] ==
f.fcIndex(fp0))
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,
397 if (meshEdgeStart_ != -1)
399 meshEdgeStart_ =
f.size() - meshEdgeStart_-1;
404 diagEdge_ =
f.size() - diagEdge_;
409 template<
class TrackCloudType>
412 TrackCloudType&
cloud,
418 template<
class TrackCloudType>
432 c.checkFieldIOobject(
c, localPosition);
449 p.localPosition_ = localPosition[i];
458 template<
class TrackCloudType>
484 localPosition[i] =
p.localPosition_;
485 meshEdgeStart[i] =
p.meshEdgeStart_;
486 diagEdge[i] =
p.diagEdge_;
491 localPosition.write();
492 meshEdgeStart.write();
const bitSet & isWallPatch_
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
triFace triIs(const polyMesh &mesh, const bool warn=true) const
Return the local indices corresponding to the tri on the face.
A primitive field of type <T> with automated input and output.
void hitProcessorPatch(TrackCloudType &cloud, trackingData &td)
void patchInteraction(TrackCloudType &cloud, trackingData &td, const scalar trackFraction)
Do all patch interaction.
static void readFields(CloudType &)
Read.
void hitWallPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
static void writeFields(const CloudType &)
Write.
Standard boundBox with extra functionality for use in octree.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label face() const
Return the face.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
vector unitNormal(const UList< point > &points) const
The unit normal.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
scalar trackToEdge(TrackCloudType &cloud, trackingData &td, const vector &endPosition)
Equivalent of trackToFace.
label meshEdgeStart() const
-1 or label of mesh edge
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
A patch is a list of labels that address the faces in the global face list.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
bool switchProcessor
Flag to switch processor.
errorManip< error > abort(error &err)
Class used to pass tracking data to the trackToFace function.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
A cloud is a registry collection of lagrangian particles.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A triangular face using a FixedList of labels corresponding to mesh vertices.
const std::string patch
OpenFOAM patch number as a std::string.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const dimensionedScalar c
Speed of light in a vacuum.
label diagEdge() const
-1 or diagonal edge
A face is a list of labels corresponding to mesh vertices.
vector areaNormal() const
The area normal - with magnitude equal to area of triangle.
scalar mag() const
Return volume.
A cell is defined as a list of faces with extra functionality.