34 Foam::vector Foam::streamlinesParticle::interpolateFields
36 const trackingData& td,
37 const point& position,
48 bool interpolatedU =
false;
51 forAll(td.scalarInterp_, fieldi)
53 #define InterpolateType(Type, nullArg) \ 54 if (td.Type##Interp_.set(fieldi)) \ 57 td.Type##Interp_[fieldi].interpolate \ 64 sampled##Type##s_.setSize(td.Type##Interp_.size()); \ 65 sampled##Type##s_[fieldi].append \ 67 td.trackOutside_ ? transform_.invTransform(s) : s \ 71 #undef InterpolateType 75 td.vectorInterp_.set(fieldi)
76 && &td.vectorInterp_[fieldi] == &td.UInterp_
80 U = sampledvectors_[fieldi].last();
87 U = td.UInterp_.interpolate(position, celli, facei);
94 void Foam::streamlinesParticle::endTrack(trackingData& td)
96 const label n = sampledPositions_.size();
98 const label trackPartIndex =
99 td.trackForward_ ? trackPartIndex_ : -1 - trackPartIndex_;
101 if (!td.trackForward_)
reverse(sampledPositions_);
102 td.allPositions_.append(sampledPositions_);
103 sampledPositions_.clear();
105 td.allTracks_.append(List<label>(n, trackIndex_));
106 td.allTrackParts_.append(List<label>(n, trackPartIndex));
109 if (!td.trackForward_)
reverse(sampledAges_);
110 td.allAges_.append(sampledAges_);
111 sampledAges_.
clear();
113 forAll(td.scalarInterp_, fieldi)
115 #define EndTrackType(Type, nullArg) \ 116 if (td.Type##Interp_.set(fieldi)) \ 118 if (!td.trackForward_) reverse(sampled##Type##s_[fieldi]); \ 119 td.all##Type##s_[fieldi].append(sampled##Type##s_[fieldi]); \ 120 sampled##Type##s_[fieldi].clear(); \ 135 const label lifeTime,
136 const label trackIndex
141 trackIndex_(trackIndex),
159 is >> lifeTime_ >> trackIndex_ >> trackPartIndex_ >> age_
160 >> transform_ >> sampledPositions_ >> sampledAges_;
162 #define ReadSampledTypes(Type, nullArg) \ 163 List<List<Type>> sampled##Type##s; \ 164 is >> sampled##Type##s; \ 165 sampled##Type##s_.setSize(sampled##Type##s.size()); \ 166 forAll(sampled##Type##s, i) \ 168 sampled##Type##s_[i].transfer(sampled##Type##s[i]); \ 171 #undef ReadSampledTypes 177 "streamlinesParticle::streamlinesParticle" 178 "(const Cloud<streamlinesParticle>&, Istream&, bool)" 189 lifeTime_(p.lifeTime_),
190 trackIndex_(p.trackIndex_),
191 trackPartIndex_(p.trackPartIndex_),
193 transform_(p.transform_),
194 sampledPositions_(p.sampledPositions_),
195 sampledAges_(p.sampledAges_)
196 #define SampledTypesInit(Type, nullArg) \ 197 , sampled##Type##s_(p.sampled##Type##s_) 199 #undef SampledTypesInit 229 sampledPositions_.append
235 sampledAges_.
append(age_);
243 scalar magU =
mag(U);
259 else if (subIter == 0)
291 Pout<<
"streamlinesParticle: Removing stagnant particle:" 292 <<
position() <<
" sampled positions:" 293 << sampledPositions_.size() <<
endl;
300 sampledPositions_.append
306 sampledAges_.
append(age_);
311 Pout<<
"streamlinesParticle: Removing particle:" <<
position()
312 <<
" sampled positions:" << sampledPositions_.size()
380 const vector& displacement,
381 const scalar fraction,
396 const vector& displacement,
397 const scalar fraction,
415 if (result) endTrack(td);
455 transform_ = transform & transform_;
461 bool valid = c.
size();
517 iter().lifeTime_ = lifeTime[i];
518 iter().trackIndex_ = trackIndex[i];
519 iter().trackPartIndex_ = trackPartIndex[i];
520 iter().age_ = age[i];
521 iter().transform_ = transform[i];
522 iter().sampledPositions_.transfer(sampledPositions[i]);
523 iter().sampledAges_.transfer(sampledAges[i]);
580 lifeTime[i] = iter().lifeTime_;
581 trackIndex[i] = iter().trackIndex_;
582 trackPartIndex[i] = iter().trackPartIndex_;
583 age[i] = iter().age_;
584 transform[i] = iter().transform_;
585 sampledPositions[i] = iter().sampledPositions_;
586 sampledAges[i] = iter().sampledAges_;
590 lifeTime.write(np > 0);
591 trackIndex.write(np > 0);
592 trackPartIndex.write(np > 0);
594 transform.write(np > 0);
595 sampledPositions.write(np > 0);
596 sampledAges.write(np > 0);
605 os << static_cast<const particle&>(
p)
616 #undef WriteSampledTypes 619 os.
check(
"Ostream& operator<<(Ostream&, const streamlinesParticle&)");
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
void hitProcessorPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
const polyMesh & mesh() const
Return the mesh database.
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool move(streamlinesCloud &, trackingData &, const scalar)
Track all particles to their end point.
#define EndTrackType(Type, nullArg)
void hitCyclicAMIPatch(const vector &, const scalar, streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
void hitWallPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
scalar trackToFace(const vector &displacement, const scalar fraction)
As particle::track, but stops when a face is hit.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar trackToAndHitFace(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Convenience function. Combines trackToFace and hitFace.
A List of objects of type <T> with automated input and output.
label size() const
Return the number of particles in the cloud.
virtual const transformer & transform() const
Return transformation between the coupled patches.
Vector< scalar > vector
A scalar version of the templated Vector.
void clear()
Clear the addressed list, i.e. set the size to zero.
const dimensionedScalar c
Speed of light in a vacuum.
#define WriteSampledTypes(Type, nullArg)
const scalar trackLength_
Neighbour processor patch.
static void writeFields(const Cloud< streamlinesParticle > &)
Write.
label cell() const
Return current cell particle is in.
label face() const
Return current face particle is on otherwise -1.
void hitProcessorPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
scalar mag() const
The magnitude of the bounding box span.
A Cloud of streamlines particles.
void hitWedgePatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a wedge.
void hitCyclicPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a cyclicPatch.
Particle class that samples fields as it passes through. Used in streamlines calculation.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void reverse(UList< T > &, const label n)
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
void hitCyclicPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
#define ReadSampledTypes(Type, nullArg)
bool hitNonConformalCyclicPatch(const vector &displacement, const scalar fraction, const label patchi, streamlinesCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting an.
scalar stepFraction() const
Return the fraction of time-step completed.
const boundBox & bounds() const
Return mesh bounding box.
virtual const transformer & transform() const
Return null transform between processor patches.
void hitSymmetryPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
vector point
Point is a vector.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
prefixOSstream Pout(cout, "Pout")
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
Ostream & operator<<(Ostream &, const ensightPart &)
void checkFieldIOobject(const Cloud< ParticleType > &c, const IOField< DataType > &data) const
Check lagrangian data field.
static Vector< scalar > uniform(const scalar &s)
Return a VectorSpace with all elements = s.
dimensioned< scalar > mag(const dimensioned< Type > &)
static void readFields(Cloud< streamlinesParticle > &)
Read.
void hitCyclicAMIPatch(const vector &displacement, const scalar fraction, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a cyclicAMIPatch.
Mesh consisting of general polyhedral cells.
void hitSymmetryPlanePatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
streamlinesParticle(const polyMesh &c, const vector &position, const label celli, const label lifeTime, const label trackIndex)
Construct from components.
bool hitNonConformalCyclicPatch(const vector &displacement, const scalar fraction, const label patchi, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting an.
label sendToProc
Processor to send the particle to. -1 indicates that this.
#define SampledTypesInit(Type, nullArg)
IOobject fieldIOobject(const word &fieldName, const IOobject::readOption r) const
Helper to construct IOobject for field and current time.
A primitive field of type <T> with automated input and output.
vector position() const
Return current particle position.
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label patch() const
Return the index of patch that the particle is on.
#define InterpolateType(Type, nullArg)
dimensionSet transform(const dimensionSet &)