42 inline void Foam::particle::movingTetGeometry
44 const scalar fraction,
47 Pair<vector>& vertex1,
51 const triFace triIs(currentTetIndices().faceTriIs(mesh_));
63 const vector ccOld = mesh_.oldCellCentres()[celli_];
64 const vector ccNew = mesh_.cellCentres()[celli_];
69 const Pair<scalar>
s = stepFractionSpan();
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]]);
89 Pair<vector> centre, base, vertex1, vertex2;
90 movingTetGeometry(fraction, centre, base, vertex1, vertex2);
93 Pair<barycentricTensor>
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();
262 return currentTetIndices().faceTri(mesh_).unitNormal();
274 return onFace() && mesh_.isInternalFace(facei_);
280 return onFace() && !mesh_.isInternalFace(facei_);
286 return onFace() ? mesh_.boundaryMesh().whichPatch(facei_) : -1;
292 return currentTetTransform() & coordinates_;
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();
const Type & value() const noexcept
Return const reference to value.
label tetFace() const noexcept
Return current tet face particle is in.
scalar deltaTValue() const noexcept
Return time step value.
label tetPt() const noexcept
Return current tet face particle is in.
errorManipArg< error, int > exit(error &err, const int errNo=1)
The time value with time-stepping information, user-defined remapping, etc.
const barycentric & coordinates() const noexcept
Return current particle coordinates.
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.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
label origId() const noexcept
Return the particle ID on the originating processor.
bool onFace() const noexcept
Is the particle on a face?
Ostream & endl(Ostream &os)
Add newline and flush stream.
Pair< scalar > stepFractionSpan() const
Return the step fraction change within the overall time-step.
tetPointRef tet(const polyMesh &mesh) const
The tet geometry for this tet, where point0 is the cell centre.
vector normal() const
The (unit) normal of the tri on tetFacei_ for the current tet.
vectorField pointField
pointField is a vectorField.
An ordered pair of two objects of type <T> with first() and second() elements.
void patchData(vector &n, vector &U) const
Get the normal and velocity of the current patch location.
vector unitNormal() const
Return unit normal.
void reset()
Reset particle data.
bool onInternalFace() const noexcept
Is the particle on an internal face?
tetIndices currentTetIndices() const noexcept
Return indices of the current tet that the particle occupies.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
barycentricTensor currentTetTransform() const
Return the current tet transformation tensor.
scalar stepFraction() const noexcept
Return the fraction of time-step completed.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
label getNewParticleID() const
Get unique particle creation id.
BarycentricTensor< scalar > barycentricTensor
A scalar version of the templated BarycentricTensor.
label cell() const noexcept
Return current cell particle is in.
label origProc() const noexcept
Return the originating processor ID.
const polyMesh & mesh() const noexcept
Return the mesh database.
#define WarningInFunction
Report a warning using Foam::Warning.
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can represent a barycentric transfo...
Mesh consisting of general polyhedral cells.
label face() const noexcept
Return current face particle is on otherwise -1.
bool onBoundaryFace() const noexcept
Is the particle on a boundary face?
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))
vector position() const
Return current particle position.
label patch() const
Return the index of patch that the particle is on.
static constexpr const zero Zero
Global zero (0)
scalar currentTimeFraction() const
Return the current fraction within the timestep. This differs.