37 const trackingData&
td,
38 const barycentric& tetCoords,
39 const tetIndices& tetIs
50 tetIs.barycentricToPoint(this->mesh(), tetCoords)
59 sampledPositions_.empty()
64 sampledPositions_.push_back(
position);
67 sampledScalars_.resize(
td.vsInterp_.size());
70 sampledScalars_[i].push_back
72 td.vsInterp_[i].interpolate(tetCoords, tetIs, tetIs.face())
77 sampledVectors_.resize(
td.vvInterp_.size());
80 sampledVectors_[i].push_back
82 td.vvInterp_[i].interpolate(tetCoords, tetIs, tetIs.face())
85 if (
td.vvInterp_.get(i) == &(
td.UInterp_))
88 U = sampledVectors_[i].back();
95 U =
td.UInterp_.interpolate(tetCoords, tetIs, tetIs.face());
109 const bool trackForward,
114 trackForward_(trackForward),
134 is >> trackForward_ >> lifeTime_
135 >> sampledPositions_ >> sampledScalars
138 sampledScalars_.resize(sampledScalars.
size());
141 sampledScalars_[i].transfer(sampledScalars[i]);
143 sampledVectors_.resize(sampledVectors.
size());
146 sampledVectors_[i].transfer(sampledVectors[i]);
160 trackForward_(
p.trackForward_),
161 lifeTime_(
p.lifeTime_),
162 sampledPositions_(
p.sampledPositions_),
163 sampledScalars_(
p.sampledScalars_),
164 sampledVectors_(
p.sampledVectors_)
177 td.switchProcessor =
false;
178 td.keepParticle =
true;
182 while (
td.keepParticle && !
td.switchProcessor && lifeTime_ > 0)
190 for (label subIter = 0; subIter <
max(1,
td.nSubCycle_); subIter++)
198 const scalar magU =
mag(
U);
214 if (
td.trackLength_ < GREAT)
217 dt =
td.trackLength_;
219 else if (subIter == 0)
223 copy.trackToFace(maxDt*
U, 1);
224 dt *= (copy.stepFraction() - stepFraction())/
td.nSubCycle_;
226 else if (subIter ==
td.nSubCycle_ - 1)
232 trackToAndHitFace(dt*
U, 0,
cloud,
td);
238 ||
td.switchProcessor
247 if (!
td.keepParticle || lifeTime_ == 0)
254 Pout<<
"streamLineParticle: Removing stagnant particle:"
255 << position() <<
" sampled positions:"
256 << sampledPositions_.size() <<
endl;
258 td.keepParticle =
false;
263 (void)interpolateFields(
td,
coordinates(), currentTetIndices());
267 Pout<<
"streamLineParticle: Removing particle:" << position()
268 <<
" sampled positions:" << sampledPositions_.size()
275 td.allPositions_.emplace_back().transfer(sampledPositions_);
278 forAll(sampledScalars_, i)
280 td.allScalars_[i].emplace_back().transfer(sampledScalars_[i]);
282 forAll(sampledVectors_, i)
284 td.allVectors_[i].emplace_back().transfer(sampledVectors_[i]);
288 return td.keepParticle;
306 td.keepParticle =
false;
317 td.keepParticle =
false;
328 td.keepParticle =
false;
339 td.keepParticle =
false;
351 td.keepParticle =
false;
363 td.keepParticle =
false;
374 td.switchProcessor =
true;
385 td.keepParticle =
false;
391 const bool readOnProc = c.size();
400 c.checkFieldIOobject(c, lifeTime);
407 c.checkFieldIOobject(c, sampledPositions);
412 p.lifeTime_ = lifeTime[i];
413 p.sampledPositions_.transfer(sampledPositions[i]);
423 const label np = c.size();
424 const bool writeOnProc = c.size();
426 IOField<label> lifeTime
438 for (
const streamLineParticle&
p : c)
440 lifeTime[i] =
p.lifeTime_;
441 sampledPositions[i] =
p.sampledPositions_;
445 lifeTime.write(writeOnProc);
446 sampledPositions.write(writeOnProc);
Base cloud calls templated on particle type.
A primitive field of type <T> with automated input and output.
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void size(const label n)
Older name for setAddressableSize.
scalar mag() const
The magnitude/length of the bounding box diagonal.
A cloud is a registry collection of lagrangian particles.
tetIndices currentTetIndices() const noexcept
Return indices of the current tet that the particle occupies.
scalar trackToFace(const vector &displacement, const scalar fraction)
As particle::track, but also stops on internal faces.
vector position() const
Return current particle position.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
bool onFace() const noexcept
Is the particle on a face?
const polyMesh & mesh() const noexcept
Return the mesh database.
scalar stepFraction() const noexcept
Return the fraction of time-step completed.
void trackToAndHitFace(const vector &direction, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
Mesh consisting of general polyhedral cells.
const boundBox & bounds() const noexcept
Return mesh bounding box.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
A Cloud of streamLine particles.
Particle class that samples fields as it passes through. Used in streamline calculation.
static void writeFields(const Cloud< streamLineParticle > &)
Write.
void hitCyclicACMIPatch(streamLineParticleCloud &, trackingData &, const vector &direction)
Overridable function to handle the particle hitting a.
void hitSymmetryPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a.
void hitSymmetryPlanePatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a.
void hitCyclicPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
void hitCyclicAMIPatch(streamLineParticleCloud &, trackingData &, const vector &direction)
Overridable function to handle the particle hitting a.
static void readFields(Cloud< streamLineParticle > &)
Read.
streamLineParticle(const polyMesh &mesh, const vector &position, const label celli, const bool trackForward, const label lifeTime)
Construct from components.
void hitWedgePatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a wedge.
void hitProcessorPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
bool move(streamLineParticleCloud &, trackingData &, const scalar)
Track all particles to their end point.
bool hitPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a patch.
void hitWallPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
PtrList< coordinateSystem > coordinates(solidRegions.size())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for handling debugging switches.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
IOField< vectorField > vectorFieldIOField
IO for a Field of vectorField.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
vector point
Point is a vector.
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...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
#define forAll(list, i)
Loop across all elements in list.