42inline void Foam::particle::movingTetGeometry
44 const scalar fraction,
51 const triFace triIs(currentTetIndices().faceTriIs(mesh_));
63 const vector ccOld = mesh_.oldCellCentres()[celli_];
64 const vector ccNew = mesh_.cellCentres()[celli_];
70 const scalar f0 =
s[0] + stepFraction_*
s[1], f1 = fraction*
s[1];
72 centre[0] = ccOld + f0*(ccNew - ccOld);
73 base[0] = ptsOld[triIs[0]] + f0*(ptsNew[triIs[0]] - ptsOld[triIs[0]]);
74 vertex1[0] = ptsOld[triIs[1]] + f0*(ptsNew[triIs[1]] - ptsOld[triIs[1]]);
75 vertex2[0] = ptsOld[triIs[2]] + f0*(ptsNew[triIs[2]] - ptsOld[triIs[2]]);
77 centre[1] = f1*(ccNew - ccOld);
78 base[1] = f1*(ptsNew[triIs[0]] - ptsOld[triIs[0]]);
79 vertex1[1] = f1*(ptsNew[triIs[1]] - ptsOld[triIs[1]]);
80 vertex2[1] = f1*(ptsNew[triIs[2]] - ptsOld[triIs[2]]);
84inline Foam::Pair<Foam::barycentricTensor> Foam::particle::movingTetTransform
90 movingTetGeometry(fraction, centre, base, vertex1, vertex2);
105 label
id = particleCount_++;
110 <<
"Particle counter has overflowed. This might cause problems"
111 <<
" when reconstructing particle tracks." <<
endl;
179 return stepFraction_;
185 return stepFraction_;
215 if (mesh_.time().subCycling())
218 const TimeState& tsOld = mesh_.time().prevTimeState();
239 return s[0] + stepFraction_*
s[1];
245 return tetIndices(celli_, tetFacei_, tetPti_);
251 if (mesh_.moving() && stepFraction_ != 1)
253 return movingTetTransform(0)[0];
256 return stationaryTetTransform();
274 return onFace() && mesh_.isInternalFace(facei_);
280 return onFace() && !mesh_.isInternalFace(facei_);
286 return onFace() ? mesh_.boundaryMesh().whichPatch(facei_) : -1;
306 if (!onBoundaryFace())
309 <<
"Patch data was requested for a particle that isn't on a patch"
313 if ((mesh_.moving() && stepFraction_ != 1))
315 Pair<vector> centre, base, vertex1, vertex2;
316 movingTetGeometry(1, centre, base, vertex1, vertex2);
323 coordinates_.b()*base[1]
324 + coordinates_.c()*vertex1[1]
325 + coordinates_.d()*vertex2[1];
329 U /= mesh_.time().deltaTValue();
333 n = currentTetIndices().faceTri(mesh_).unitNormal();
An ordered pair of two objects of type <T> with first() and second() elements.
The time value with time-stepping information, user-defined remapping, etc.
scalar deltaTValue() const noexcept
Return time step value.
const Type & value() const noexcept
Return const reference to value.
tetIndices currentTetIndices() const noexcept
Return indices of the current tet that the particle occupies.
barycentricTensor currentTetTransform() const
Return the current tet transformation tensor.
vector position() const
Return current particle position.
label face() const noexcept
Return current face particle is on otherwise -1.
label tetPt() const noexcept
Return current tet face particle is in.
bool onFace() const noexcept
Is the particle on a face?
const polyMesh & mesh() const noexcept
Return the mesh database.
label tetFace() const noexcept
Return current tet face particle is in.
const barycentric & coordinates() const noexcept
Return current particle coordinates.
bool onBoundaryFace() const noexcept
Is the particle on a boundary face?
label patch() const
Return the index of patch that the particle is on.
scalar stepFraction() const noexcept
Return the fraction of time-step completed.
void patchData(vector &n, vector &U) const
Get the normal and velocity of the current patch location.
Pair< scalar > stepFractionSpan() const
Return the step fraction change within the overall time-step.
static label particleCount_
Cumulative particle counter - used to provide unique ID.
bool onInternalFace() const noexcept
Is the particle on an internal face?
label getNewParticleID() const
Get unique particle creation id.
label origId() const noexcept
Return the particle ID on the originating processor.
label cell() const noexcept
Return current cell particle is in.
void reset()
Reset particle data.
vector normal() const
The (unit) normal of the tri on tetFacei_ for the current tet.
scalar currentTimeFraction() const
Return the current fraction within the timestep. This differs.
label origProc() const noexcept
Return the originating processor ID.
Mesh consisting of general polyhedral cells.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
tetPointRef tet(const polyMesh &mesh) const
The tet geometry for this tet, where point0 is the cell centre.
A triangular face using a FixedList of labels corresponding to mesh vertices.
vector unitNormal() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
#define WarningInFunction
Report a warning using Foam::Warning.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
BarycentricTensor< scalar > barycentricTensor
A scalar version of the templated BarycentricTensor.