37 const trackingData& td,
39 const tetIndices& tetIs
50 tetIs.barycentricToPoint(this->mesh(), tetCoords)
59 sampledPositions_.
empty()
67 sampledScalars_.resize(td.vsInterp_.size());
70 sampledScalars_[i].append
72 td.vsInterp_[i].interpolate(tetCoords, tetIs, tetIs.face())
77 sampledVectors_.resize(td.vvInterp_.size());
80 sampledVectors_[i].append
82 td.vvInterp_[i].interpolate(tetCoords, tetIs, tetIs.face())
85 if (td.vvInterp_.get(i) == &(td.UInterp_))
88 U = sampledVectors_[i].last();
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]);
156 const streamLineParticle&
p 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++)
196 interpolateFields(td,
coordinates(), currentTetIndices());
198 const scalar magU =
mag(
U);
214 if (td.trackLength_ < GREAT)
217 dt = td.trackLength_;
219 else if (subIter == 0)
222 particle copy(*
this);
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()
276 td.allPositions_.last().transfer(sampledPositions_);
279 forAll(sampledScalars_, i)
282 td.allScalars_[i].last().transfer(sampledScalars_[i]);
284 forAll(sampledVectors_, i)
287 td.allVectors_[i].last().transfer(sampledVectors_[i]);
291 return td.keepParticle;
309 td.keepParticle =
false;
320 td.keepParticle =
false;
331 td.keepParticle =
false;
342 td.keepParticle =
false;
354 td.keepParticle =
false;
366 td.keepParticle =
false;
377 td.switchProcessor =
true;
388 td.keepParticle =
false;
394 const bool valid =
c.size();
403 c.checkFieldIOobject(
c, lifeTime);
410 c.checkFieldIOobject(
c, sampledPositions);
415 p.lifeTime_ = lifeTime[i];
416 p.sampledPositions_.
transfer(sampledPositions[i]);
426 const label np =
c.size();
427 const bool valid =
c.size();
429 IOField<label> lifeTime
441 for (
const streamLineParticle&
p :
c)
443 lifeTime[i] =
p.lifeTime_;
444 sampledPositions[i] =
p.sampledPositions_;
449 sampledPositions.write(valid);
457 os << static_cast<const particle&>(
p)
void hitProcessorPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
static void writeFields(const Cloud< streamLineParticle > &)
Write.
void size(const label n)
Older name for setAddressableSize.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void hitWedgePatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a wedge.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
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.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void hitCyclicACMIPatch(streamLineParticleCloud &, trackingData &, const vector &direction)
Overridable function to handle the particle hitting a.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
bool hitPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a patch.
List< vector > vectorList
A List of vectors.
#define forAll(list, i)
Loop across all elements in list.
void hitSymmetryPlanePatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a.
A cloud is a registry collection of lagrangian particles.
Particle class that samples fields as it passes through. Used in streamline calculation.
scalar mag() const
The magnitude/length of the bounding box diagonal.
List< scalar > scalarList
A List of scalars.
void append(const T &val)
Copy append an element to the end of this list.
errorManip< error > abort(error &err)
static void readFields(Cloud< streamLineParticle > &)
Read.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
T & last()
Access last element of the list, position [size()-1].
A Cloud of streamLine particles.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
const boundBox & bounds() const
Return mesh bounding box.
PtrList< coordinateSystem > coordinates(solidRegions.size())
vector point
Point is a vector.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
const dimensionedScalar c
Speed of light in a vacuum.
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
bool move(streamLineParticleCloud &, trackingData &, const scalar)
Track all particles to their end point.
streamLineParticle(const polyMesh &mesh, const vector &position, const label celli, const bool trackForward, const label lifeTime)
Construct from components.
Mesh consisting of general polyhedral cells.
void hitCyclicAMIPatch(streamLineParticleCloud &, trackingData &, const vector &direction)
Overridable function to handle the particle hitting a.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type.
IOField< vectorField > vectorFieldIOField
vectorFieldField with IO.
virtual bool write(const bool valid=true) const
Write using setting from DB.
void hitWallPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
A primitive field of type <T> with automated input and output.
vector position() const
Return current particle position.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void hitSymmetryPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
void hitCyclicPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
static constexpr const zero Zero
Global zero (0)