34 Foam::vector Foam::streamlinesParticle::interpolateFields
36 const trackingData& td,
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 label& nLocateBoundaryHits,
136 const label lifeTime,
137 const label trackIndex
142 trackIndex_(trackIndex),
155 is >> lifeTime_ >> trackIndex_ >> trackPartIndex_ >> age_
156 >> transform_ >> sampledPositions_ >> sampledAges_;
158 #define ReadSampledTypes(Type, nullArg) \
159 List<List<Type>> sampled##Type##s; \
160 is >> sampled##Type##s; \
161 sampled##Type##s_.setSize(sampled##Type##s.size()); \
162 forAll(sampled##Type##s, i) \
164 sampled##Type##s_[i].transfer(sampled##Type##s[i]); \
167 #undef ReadSampledTypes
173 "streamlinesParticle::streamlinesParticle"
174 "(const Cloud<streamlinesParticle>&, Istream&, bool)"
185 lifeTime_(
p.lifeTime_),
186 trackIndex_(
p.trackIndex_),
187 trackPartIndex_(
p.trackPartIndex_),
189 transform_(
p.transform_),
190 sampledPositions_(
p.sampledPositions_),
191 sampledAges_(
p.sampledAges_)
193 , sampled##Type##s_(
p.sampled##Type##s_)
224 sampledPositions_.append
230 sampledAges_.append(age_);
238 scalar magU =
mag(
U);
254 else if (subIter == 0)
269 *(1 - trackToAndHitFace(dt*
U, 0,
cloud, td));
285 Pout<<
"streamlinesParticle: Removing stagnant particle:"
287 << sampledPositions_.
size() <<
endl;
294 sampledPositions_.append
300 sampledAges_.append(age_);
305 Pout<<
"streamlinesParticle: Removing particle:"
307 << sampledPositions_.
size() <<
endl;
377 const vector& displacement,
378 const scalar fraction,
396 if (result) endTrack(td);
457 c.checkFieldIOobject(
c, lifeTime);
464 c.checkFieldIOobject(
c, trackIndex);
471 c.checkFieldIOobject(
c, trackPartIndex);
478 c.checkFieldIOobject(
c, age);
492 c.checkFieldIOobject(
c, sampledPositions);
499 c.checkFieldIOobject(
c, sampledAges);
504 iter().lifeTime_ = lifeTime[i];
505 iter().trackIndex_ = trackIndex[i];
506 iter().trackPartIndex_ = trackPartIndex[i];
507 iter().age_ = age[i];
509 iter().sampledPositions_.transfer(sampledPositions[i]);
510 iter().sampledAges_.transfer(sampledAges[i]);
570 lifeTime[i] = iter().lifeTime_;
571 trackIndex[i] = iter().trackIndex_;
572 trackPartIndex[i] = iter().trackPartIndex_;
573 age[i] = iter().age_;
575 sampledPositions[i] = iter().sampledPositions_;
576 sampledAges[i] = iter().sampledAges_;
580 lifeTime.
write(np > 0);
581 trackIndex.
write(np > 0);
582 trackPartIndex.
write(np > 0);
585 sampledPositions.
write(np > 0);
586 sampledAges.
write(np > 0);
595 os << static_cast<const particle&>(
p)
603 #define WriteSampledTypes(Type, nullArg) \
604 << token::SPACE << p.sampled##Type##s_
606 #undef WriteSampledTypes
609 os.
check(
"Ostream& operator<<(Ostream&, const streamlinesParticle&)");
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A primitive field of type <Type> with automated input and output.
A List of objects of type <Type> with automated input and output.
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)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
static direction size()
Return the number of elements in the VectorSpace = Ncmpts.
scalar mag() const
The magnitude of the bounding box span.
A cell is defined as a list of faces with extra functionality.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
virtual const transformer & transform() const
Return transformation between the coupled patches.
Ostream & write(Ostream &os) const
Write.
A face is a list of labels corresponding to mesh vertices.
label sendToProc
Processor to send the particle to. -1 indicates that this.
bool keepParticle
Flag to indicate whether to keep particle (false = delete)
const polyMesh & mesh
Reference to the mesh.
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
void hitCyclicPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a.
void hitProcessorPatch(TrackCloudType &, trackingData &)
Overridable function to handle the particle hitting a.
scalar trackToFace(const polyMesh &mesh, const vector &displacement, const scalar fraction)
As particle::track, but stops when a face is hit.
vector position(const polyMesh &mesh) const
Return current particle position.
bool hitNonConformalCyclicPatch(const vector &displacement, const scalar fraction, const label patchi, TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting an.
static void writeFields(const TrackCloudType &c)
Write the fields associated with the owner cloud.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const boundBox & bounds() const
Return mesh bounding box.
Neighbour processor patch.
virtual const transformer & transform() const
Return null transform between processor patches.
virtual bool write(const bool write=true) const
Write using setting from DB.
A Cloud of streamlines particles.
const scalar trackLength_
Particle class that samples fields as it passes through. Used in streamlines calculation.
bool move(streamlinesCloud &, trackingData &)
Track all particles to their end point.
void hitProcessorPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
bool hitNonConformalCyclicPatch(const vector &displacement, const scalar fraction, const label patchi, streamlinesCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting an.
static void writeFields(const lagrangian::Cloud< streamlinesParticle > &)
Write.
void hitSymmetryPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
void hitCyclicPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
void hitWallPatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
void hitSymmetryPlanePatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a.
streamlinesParticle(const polyMesh &mesh, const vector &position, const label celli, label &nLocateBoundaryHits, const label lifeTime, const label trackIndex)
Construct from components.
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
static void readFields(lagrangian::Cloud< streamlinesParticle > &)
Read.
void hitWedgePatch(streamlinesCloud &, trackingData &)
Overridable function to handle the particle hitting a wedge.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool valid(const PtrList< ModelType > &l)
const dimensionedScalar c
Speed of light in a vacuum.
point position(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the position given the coordinates and tet topology.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
errorManip< error > abort(error &err)
static const Identity< scalar > I
vector point
Point is a vector.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
void reverse(UList< T > &, const label n)
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionSet transform(const dimensionSet &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
prefixOSstream Pout(cout, "Pout")
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
#define InterpolateType(Type, nullArg)
#define WriteSampledTypes(Type, nullArg)
#define EndTrackType(Type, nullArg)
#define SampledTypesInit(Type, nullArg)
#define ReadSampledTypes(Type, nullArg)