39 template<
class TrackData>
47 facei_ = patchFace(patchi, facei_);
51 template<
class TrackData>
59 refCast<const coupledPolyPatch>(mesh_.boundaryMesh()[
patchi]);
75 transformProperties(T);
85 transformProperties(-s);
88 tetFacei_ = facei_ + ppp.
start();
111 tetPtI_ = mesh_.faces()[tetFacei_].size() - 1 - tetPtI_;
114 if (stepFraction_ > (1.0 - SMALL))
121 facei_ += ppp.
start();
128 template<
class CloudType>
138 if (procIO.headerOk())
158 template<
class CloudType>
178 origId[i] = iter().origId_;
187 template<
class TrackData>
202 template<
class TrackData>
205 const vector& endPosition,
209 typedef typename TrackData::cloudType cloudType;
210 typedef typename cloudType::particleType particleType;
212 cloudType& cloud = td.
cloud();
232 scalar trackFraction = 0.0;
280 scalar lambdaMin = VGREAT;
293 scalar lambdaDistanceTolerance =
310 label basePtI = f[tetBasePtI];
321 fPtBI = otherFacePtI;
325 fPtAI = otherFacePtI;
337 if (lambdaMin < SMALL)
343 Pout<<
"tracking rescue using tetCentre from " <<
position();
354 cloud.trackingRescue();
356 return trackFraction;
364 return trackFraction;
369 tetAreas[0] = tet.
Sa();
370 tetAreas[1] = tet.
Sb();
371 tetAreas[2] = tet.
Sc();
372 tetAreas[3] = tet.
Sd();
376 tetPlaneBasePtIs[0] = basePtI;
377 tetPlaneBasePtIs[1] = f[fPtAI];
378 tetPlaneBasePtIs[2] = basePtI;
379 tetPlaneBasePtIs[3] = basePtI;
388 lambdaDistanceTolerance
430 tetPlaneBasePtIs[tI],
434 lambdaDistanceTolerance
504 if (lambdaMin > SMALL)
506 if (lambdaMin <= 1.0)
508 trackFraction += lambdaMin*(1 - trackFraction);
527 particleType&
p =
static_cast<particleType&
>(*this);
581 if (isA<wedgePolyPatch>(patch))
585 static_cast<const wedgePolyPatch&>(patch), td
588 else if (isA<symmetryPlanePolyPatch>(patch))
590 p.hitSymmetryPlanePatch
592 static_cast<const symmetryPlanePolyPatch&>(patch), td
595 else if (isA<symmetryPolyPatch>(patch))
599 static_cast<const symmetryPolyPatch&>(patch), td
602 else if (isA<cyclicPolyPatch>(patch))
606 static_cast<const cyclicPolyPatch&>(patch), td
609 else if (isA<cyclicAMIPolyPatch>(patch))
613 static_cast<const cyclicAMIPolyPatch&>(patch),
618 else if (isA<processorPolyPatch>(patch))
622 static_cast<const processorPolyPatch&>(patch), td
625 else if (isA<wallPolyPatch>(patch))
629 static_cast<const wallPolyPatch&>(patch), td, faceHitTetIs
634 p.hitPatch(patch, td);
639 if (lambdaMin < SMALL)
648 Pout<<
"tracking rescue for lambdaMin:" << lambdaMin
656 cloud.hasWallImpactDistance()
658 && cloud.cellHasWallFaces()[faceHitTetIs.
cell()]
667 if (isA<wallPolyPatch>(patches[patchi]))
687 const scalar r = p.wallImpactDistance(nHat);
708 cloud.trackingRescue();
711 return trackFraction;
715 template<
class CloudType>
732 particleType&
p =
static_cast<particleType&
>(*this);
738 scalar lambdaDistanceTolerance =
745 label fI = thisCell[cFI];
754 if (isA<wallPolyPatch>(patches[patchi]))
777 scalar r = p.wallImpactDistance(nHat);
779 vector toPlusRNHat = to + r*nHat;
793 lambdaDistanceTolerance
796 if ((tetClambda <= 0.0) || (tetClambda >= 1.0))
806 vector fromPlusRNHat = from + r*nHat;
820 lambdaDistanceTolerance
864 scalar lam =
max(0.0,
min(1.0, lambda));
875 point tPtA = tri00.a() + m*(tri.
a() - tri00.a());
876 point tPtB = tri00.b() + m*(tri.
b() - tri00.b());
877 point tPtC = tri00.c() + m*(tri.
c() - tri00.c());
885 hitInfo = t.intersection
887 fromPlusRNHat + m*(to - from),
910 if (lambda < lambdaMin)
916 closestTetIs = tetIs;
925 template<
class TrackData>
930 template<
class TrackData>
944 template<
class TrackData>
952 <<
"Hitting a wedge patch should not be possible." 962 template<
class TrackData>
976 template<
class TrackData>
990 template<
class TrackData>
1021 : receiveCpp.
forwardT()[patchFacei]
1038 template<
class TrackData>
1057 <<
"Particle lost across " << cyclicAMIPolyPatch::typeName
1058 <<
" patches " << cpp.
name() <<
" and " << receiveCpp.
name()
1081 : receiveCpp.
forwardT()[patchFacei]
1098 template<
class TrackData>
1103 template<
class TrackData>
1113 template<
class TrackData>
Symmetry patch for non-planar or multi-plane patches.
void hitSymmetryPlanePatch(const symmetryPlanePolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a.
bool onBoundary() const
Is the particle on the boundary/(or outside the domain)?
const labelList & patchID() const
Per boundary face label the patch index.
const cyclicPolyPatch & neighbPatch() const
vector Sa() const
Return face normal.
void findTris(const vector &position, DynamicList< label > &faceList, const tetPointRef &tet, const FixedList< vector, 4 > &tetAreas, const FixedList< label, 4 > &tetPlaneBasePtIs, const scalar tol) const
Find the tet tri faces between position and tet centre.
#define forAll(list, i)
Loop across all elements in list.
A triangle primitive used to calculate face normals and swept volumes.
label cell() const
Return the cell.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static const scalar trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
virtual void transformPosition(pointField &l) const
Transform a patch-based position from other side to this side.
label whichFace(const label l) const
Return label of face in patch from global face label.
void prepareForParallelTransfer(const label patchi, TrackData &td)
Convert global addressing to the processor patch.
void checkFieldIOobject(const Cloud< ParticleType > &c, const IOField< DataType > &data) const
Check lagrangian data field.
A face is a list of labels corresponding to mesh vertices.
A 1D vector of objects of type <T> with a fixed size <Size>.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual const vectorField & separation() const
If the planes are separated the separation vector.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
const Point & c() const
Return third vertex.
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
scalar tetLambda(const vector &from, const vector &to, const label triI, const vector &tetArea, const label tetPlaneBasePtI, const label celli, const label tetFacei, const label tetPtI, const scalar tol) const
Find the lambda value for the line to-from across the.
void hitWallPatch(const wallPolyPatch &, TrackData &td, const tetIndices &tetIs)
Overridable function to handle the particle hitting a wallPatch.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
label tetPtI_
Index of the point on the face that defines the decomposed.
void hitWallFaces(const CloudType &td, const vector &from, const vector &to, scalar &lambdaMin, tetIndices &closestTetIs)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label track(const vector &endPosition, TrackData &td)
Track particle to end of trajectory.
static const scalar lambdaDistanceToleranceCoeff
Fraction of the cell volume to use in determining tolerance values.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
static void readFields(CloudType &c)
Read the fields associated with the owner cloud.
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
vector position_
Position of particle.
bool hitPatch(const polyPatch &, TrackData &td, const label patchi, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a.
void hitCyclicAMIPatch(const cyclicAMIPolyPatch &, TrackData &td, const vector &direction)
Overridable function to handle the particle hitting a cyclicAMIPatch.
label tetPt() const
Return the characterising tetPtI.
label origId() const
Return const access to the particle id on originating processor.
const cellList & cells() const
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool moving() const
Is mesh moving.
label origId_
Local particle id on originating processor.
bool internalFace(const label facei) const
Is this global face an internal face?
label transformGlobalFace(const label facei) const
virtual const pointField & points() const
Return raw points.
Neighbour processor patch.
label faceBasePt() const
Return the face base point.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
tetPointRef currentTet() const
Return the geometry of the current tet that the.
label origProc_
Originating processor id.
const vector & position() const
Return current particle position.
void hitProcessorPatch(const processorPolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a.
virtual bool separated() const
Are the planes separated.
label patch(const label facei) const
Which patch is particle on.
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))
label start() const
Return start label of this patch in the polyMesh face list.
Point centre() const
Return centre (centroid)
static void writeFields(const CloudType &c)
Write the fields associated with the owner cloud.
static const Identity< scalar > I
const Point & a() const
Return first vertex.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints,-1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){pointMap[i]=i;}for(label i=0;i< nPoints;i++){if(f[i] > 0.0){hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei){if(edges[ei].mag(points)< SMALL){label start=pointMap[edges[ei].start()];while(start!=pointMap[start]){start=pointMap[start];}label end=pointMap[edges[ei].end()];while(end!=pointMap[end]){end=pointMap[end];}label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;}}cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){cellShape &cs=cellShapes[celli];forAll(cs, i){cs[i]=pointMap[cs[i]];}cs.collapse();}label bcIDs[11]={-1, 0, 2, 4,-1, 5,-1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&wallPolyPatch::typeName,&symmetryPolyPatch::typeName,&wedgePolyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&polyPatch::typeName,&symmetryPolyPatch::typeName,&oldCyclicPolyPatch::typeName};enum patchTypeNames{PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={"piston","valve","liner","cylinderHead","axis","wedge","inflow","outflow","presin","presout","symmetryPlane","cyclic"};List< SLList< face > > pFaces[nBCs]
const polyMesh & mesh_
Reference to the polyMesh database.
Wedge front and back plane patch.
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
const vectorField & cellCentres() const
vector normal() const
Return the normal of the tri on tetFacei_ for the.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
virtual bool parallel() const
Are the cyclic planes parallel.
Cyclic patch for Arbitrary Mesh Interface (AMI)
label face() const
Return the face.
void hitWedgePatch(const wedgePolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a wedgePatch.
const word & name() const
Return name.
scalar stepFraction_
Fraction of time-step completed.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
void hitFace(TrackData &td)
Overridable function to handle the particle hitting a face.
label celli_
Index of the cell it is in.
label tetFacei_
Index of the face that owns the decomposed tet that the.
prefixOSstream Pout(cout,"Pout")
label origProc() const
Return const access to the originating processor id.
const labelList & tetBasePtIs() const
Return the tetBasePtIs.
void tetNeighbour(label triI)
Modify the tet owner data by crossing triI.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const scalarField & cellVolumes() const
scalar trackToFace(const vector &endPosition, TrackData &td)
Track particle to a given position and returns 1.0 if the.
const Point & b() const
Return second vertex.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual bool write() const
Write using setting from DB.
virtual void transformPosition(pointField &) const =0
Transform a patch-based position from other side to this side.
const labelUList & faceCells() const
Return face-cell addressing.
A cell is defined as a list of faces with extra functionality.
label pointFace(const label facei, const vector &n, point &p) const
Return face index on neighbour patch which shares point p.
const dimensionedScalar c
Speed of light in a vacuum.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
virtual const tensorField & forwardT() const
Return face transformation tensor.
dimensioned< scalar > mag(const dimensioned< Type > &)
IOobject fieldIOobject(const word &fieldName, const IOobject::readOption r) const
Helper to construct IOobject for field and current time.
void correctAfterParallelTransfer(const label patchi, TrackData &td)
Convert processor patch addressing to the global equivalents.
virtual bool hasWallImpactDistance() const
Switch to specify if particles of the cloud can return.
pointHit intersection(const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const
Fast intersection with a ray.
const PackedBoolList & cellHasWallFaces() const
Whether each cell has any wall faces (demand driven data)
Helper IO class to read and write particle positions.
virtual const labelList & faceOwner() const
Return face owner.
A patch is a list of labels that address the faces in the global face list.
virtual const faceList & faces() const
Return raw faces.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Templated base class for dsmc cloud.
label nInternalFaces() const
A primitive field of type <T> with automated input and output.
void hitCyclicPatch(const cyclicPolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a cyclicPatch.
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet from the.
cloud(const objectRegistry &, const word &cloudName="")
Construct for the given objectRegistry and named cloud instance.
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
void hitSymmetryPatch(const symmetryPolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a.
vector normal() const
Return vector normal.
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.
label facei_
Face index if the particle is on a face otherwise -1.