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].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]);
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()
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_;
446 sampledPositions.write(writeOnProc);
454 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 List 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.
IOField< vectorField > vectorFieldIOField
IO for a Field of vectorField.
bool hitPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a patch.
#define forAll(list, i)
Loop across all elements in list.
void hitSymmetryPlanePatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a.
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.
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.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
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)
void push_back(const T &val)
Copy append an element to the end of this list.
A Cloud of streamLine particles.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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.
T & back()
Access last element of the list, position [size()-1].
const boundBox & bounds() const noexcept
Return mesh bounding box.
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 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.
void hitCyclicPatch(streamLineParticleCloud &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
static constexpr const zero Zero
Global zero (0)