34void Foam::particle::stationaryTetGeometry
48 vertex1 = pts[triIs[1]];
49 vertex2 = pts[triIs[2]];
55 vector centre, base, vertex1, vertex2;
56 stationaryTetGeometry(centre, base, vertex1, vertex2);
62inline void Foam::particle::movingTetGeometry
64 const scalar fraction,
67 Pair<vector>& vertex1,
71 const triFace triIs(currentTetIndices().faceTriIs(mesh_));
83 const vector ccOld = mesh_.oldCellCentres()[celli_];
84 const vector ccNew = mesh_.cellCentres()[celli_];
89 const Pair<scalar>
s = stepFractionSpan();
90 const scalar f0 =
s[0] + stepFraction_*
s[1], f1 = fraction*
s[1];
92 centre[0] = ccOld + f0*(ccNew - ccOld);
93 base[0] = ptsOld[triIs[0]] + f0*(ptsNew[triIs[0]] - ptsOld[triIs[0]]);
94 vertex1[0] = ptsOld[triIs[1]] + f0*(ptsNew[triIs[1]] - ptsOld[triIs[1]]);
95 vertex2[0] = ptsOld[triIs[2]] + f0*(ptsNew[triIs[2]] - ptsOld[triIs[2]]);
97 centre[1] = f1*(ccNew - ccOld);
98 base[1] = f1*(ptsNew[triIs[0]] - ptsOld[triIs[0]]);
99 vertex1[1] = f1*(ptsNew[triIs[1]] - ptsOld[triIs[1]]);
100 vertex2[1] = f1*(ptsNew[triIs[2]] - ptsOld[triIs[2]]);
106 const scalar fraction
109 Pair<vector> centre, base, vertex1, vertex2;
110 movingTetGeometry(fraction, centre, base, vertex1, vertex2);
113 Pair<barycentricTensor>
125 label
id = particleCount_++;
130 <<
"Particle counter has overflowed. This might cause problems"
131 <<
" when reconstructing particle tracks." <<
endl;
199 return stepFraction_;
205 return stepFraction_;
235 if (mesh_.time().subCycling())
238 const TimeState& tsOld = mesh_.time().prevTimeState();
261 return s[0] + stepFraction_*
s[1];
267 return tetIndices(celli_, tetFacei_, tetPti_);
273 if (mesh_.moving() && stepFraction_ != 1)
275 return movingTetTransform(0)[0];
279 return stationaryTetTransform();
286 return currentTetIndices().faceTri(mesh_).unitNormal();
298 return onFace() && mesh_.isInternalFace(facei_);
304 return onFace() && !mesh_.isInternalFace(facei_);
310 return onFace() ? mesh_.boundaryMesh().whichPatch(facei_) : -1;
316 return currentTetTransform() & coordinates_;
330 if (!onBoundaryFace())
333 <<
"Patch data was requested for a particle that isn't on a patch"
337 if ((mesh_.moving() && stepFraction_ != 1))
340 movingTetGeometry(1, centre, base, vertex1, vertex2);
342 n =
triPointRef(base[0], vertex1[0], vertex2[0]).unitNormal();
347 coordinates_.b()*base[1]
348 + coordinates_.c()*vertex1[1]
349 + coordinates_.d()*vertex2[1];
353 U /= mesh_.time().deltaTValue();
357 vector centre, base, vertex1, vertex2;
358 stationaryTetGeometry(centre, base, vertex1, vertex2);
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can represent a barycentric transfo...
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
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.
Pair< scalar > stepFractionSpan() const
Return the step fraction change within the overall time-step.
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.
const FieldField< Field, Type > & patchData() const
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
const vectorField & cellCentres() const
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#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.
vectorField pointField
pointField is a vectorField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
triangle< point, const point & > triPointRef
A triangle using referred points.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0)
BarycentricTensor< scalar > barycentricTensor
A scalar version of the templated BarycentricTensor.
errorManipArg< error, int > exit(error &err, const int errNo=1)