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);
549 FatalErrorIn(
"Particle::trackToFace(const vector&, TrackData&)")
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>
953 "void Foam::particle::hitWedgePatch" 955 "const wedgePolyPatch& wpp, " 958 ) <<
"Hitting a wedge patch should not be possible." 968 template<
class TrackData>
982 template<
class TrackData>
996 template<
class TrackData>
1027 : receiveCpp.
forwardT()[patchFacei]
1044 template<
class TrackData>
1064 "template<class TrackData>" 1065 "void Foam::particle::hitCyclicAMIPatch" 1067 "const cyclicAMIPolyPatch&, " 1072 <<
"Particle lost across " << cyclicAMIPolyPatch::typeName
1073 <<
" patches " << cpp.
name() <<
" and " << receiveCpp.
name()
1096 : receiveCpp.
forwardT()[patchFaceI]
1113 template<
class TrackData>
1118 template<
class TrackData>
1128 template<
class TrackData>
void hitCyclicPatch(const cyclicPolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a cyclicPatch.
virtual const tensorField & forwardT() const
Return face transformation tensor.
void hitProcessorPatch(const processorPolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a.
label cell() const
Return the cell.
Cyclic patch for Arbitrary Mesh Interface (AMI)
virtual bool separated() const
Are the planes separated.
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 ))
const word & name() const
Return name.
dimensioned< scalar > mag(const dimensioned< Type > &)
Wedge front and back plane patch.
A cell is defined as a list of faces with extra functionality.
const labelList & tetBasePtIs() const
Return the tetBasePtIs.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
label faceBasePt() const
Return the face base point.
bool empty() const
Return true if the UList is empty (ie, size() is zero).
static const scalar lambdaDistanceToleranceCoeff
Fraction of the cell volume to use in determining tolerance values.
Symmetry patch for non-planar or multi-plane patches.
static const sphericalTensor I(1)
const labelUList & faceCells() const
Return face-cell addressing.
pointHit intersection(const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const
Fast intersection with a ray.
#define forAllIter(Container, container, iter)
label origId() const
Return const access to the particle id on originating processor.
const Point & c() const
Return third vertex.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const cellList & cells() const
virtual void transformPosition(pointField &) const =0
Transform a patch-based position from other side to this side.
const vectorField & cellCentres() const
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.
void hitWedgePatch(const wedgePolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a wedgePatch.
A 1D vector of objects of type <T> with a fixed size <Size>.
label transformGlobalFace(const label facei) const
A triangle primitive used to calculate face normals and swept volumes.
A patch is a list of labels that address the faces in the global face list.
Point centre() const
Return centre (centroid)
label origId_
Local particle id on originating processor.
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet from the.
const PackedBoolList & cellHasWallFaces() const
Whether each cell has any wall faces (demand driven data)
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.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label tetFaceI_
Index of the face that owns the decomposed tet that the.
static void readFields(CloudType &c)
Read the fields associated with the owner cloud.
A face is a list of labels corresponding to mesh vertices.
void hitFace(TrackData &td)
Overridable function to handle the particle hitting a face.
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Neighbour processor patch.
static const scalar trackingCorrectionTol
Fraction of distance to tet centre to move a particle to.
virtual bool parallel() const
Are the cyclic planes parallel.
static void writeFields(const CloudType &c)
Write the fields associated with the owner cloud.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
cloud(const objectRegistry &, const word &cloudName="")
Construct for the given objectRegistry and named cloud instance.
virtual const pointField & points() const
Return raw points.
vector normal() const
Return the normal of the tri on tetFaceI_ for the.
vector normal() const
Return vector normal.
const vector & position() const
Return current particle position.
tetPointRef currentTet() const
Return the geometry of the current tet that the.
label cellI_
Index of the cell it is in.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Helper IO class to read and write particle positions.
virtual bool hasWallImpactDistance() const
Switch to specify if particles of the cloud can return.
label pointFace(const label faceI, const vector &n, point &p) const
Return face index on neighbour patch which shares point p.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
void hitWallFaces(const CloudType &td, const vector &from, const vector &to, scalar &lambdaMin, tetIndices &closestTetIs)
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 hitCyclicAMIPatch(const cyclicAMIPolyPatch &, TrackData &td, const vector &direction)
Overridable function to handle the particle hitting a cyclicAMIPatch.
virtual const vectorField & separation() const
If the planes are separated the separation vector.
const polyMesh & mesh_
Reference to the polyMesh database.
virtual bool write() const
Write using setting from DB.
scalar stepFraction_
Fraction of time-step completed.
void prepareForParallelTransfer(const label patchI, TrackData &td)
Convert global addressing to the processor patch.
label origProc() const
Return const access to the originating processor id.
scalar trackToFace(const vector &endPosition, TrackData &td)
Track particle to a given position and returns 1.0 if the.
errorManip< error > abort(error &err)
virtual const labelList & faceOwner() const
Return face owner.
bool onBoundary() const
Is the particle on the boundary/(or outside the domain)?
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
void checkFieldIOobject(const Cloud< ParticleType > &c, const IOField< DataType > &data) const
Check lagrangian data field.
label start() const
Return start label of this patch in the polyMesh face list.
label track(const vector &endPosition, TrackData &td)
Track particle to end of trajectory.
label nInternalFaces() const
const labelList & patchID() const
Per boundary face label the patch index.
void hitWallPatch(const wallPolyPatch &, TrackData &td, const tetIndices &tetIs)
Overridable function to handle the particle hitting a wallPatch.
label patch(const label faceI) const
Which patch is particle on.
void hitSymmetryPatch(const symmetryPolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a.
void hitSymmetryPlanePatch(const symmetryPlanePolyPatch &, TrackData &td)
Overridable function to handle the particle hitting a.
const cyclicPolyPatch & neighbPatch() const
vector Sa() const
Return face normal.
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
void correctAfterParallelTransfer(const label patchI, TrackData &td)
Convert processor patch addressing to the global equivalents.
const dimensionedScalar c
Speed of light in a vacuum.
virtual void transformPosition(pointField &l) const
Transform a patch-based position from other side to this side.
const Point & a() const
Return first vertex.
Templated base class for dsmc cloud.
bool internalFace(const label faceI) const
Is this global face an internal face?
virtual const faceList & faces() const
Return raw faces.
label tetPt() const
Return the characterising tetPtI.
const scalarField & cellVolumes() const
label tetPtI_
Index of the point on the face that defines the decomposed.
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 Point & b() const
Return second vertex.
label origProc_
Originating processor id.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual const labelList & faceNeighbour() const
Return face neighbour.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
void tetNeighbour(label triI)
Modify the tet owner data by crossing triI.
bool moving() const
Is mesh moving.
label faceI_
Face index if the particle is on a face otherwise -1.
bool hitPatch(const polyPatch &, TrackData &td, const label patchI, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a.
label whichFace(const label l) const
Return label of face in patch from global face label.
IOobject fieldIOobject(const word &fieldName, const IOobject::readOption r) const
Helper to construct IOobject for field and current time.
vector position_
Position of particle.
prefixOSstream Pout(cout,"Pout")
A primitive field of type <T> with automated input and output.
label face() const
Return the face.