48 {
"forward",
"backward",
"both"};
50 namespace functionObjects
64 Foam::functionObjects::streamlines::wallPatch()
const 72 if (isA<wallPolyPatch>(patches[
patchi]))
84 if (isA<wallPolyPatch>(patches[
patchi]))
90 addressing[nFaces++] = pp.
start()+i;
110 void Foam::functionObjects::streamlines::track()
120 const sampledSet& seedPoints = sampledSetPtr_();
130 seedPoints.
cells()[i],
138 Info <<
" seeded " << nSeeds <<
" particles" <<
endl;
164 <<
"Cannot find field " << fields_[i] <<
nl 165 <<
"Valid scalar fields are:" 167 <<
"Valid vector fields are:" 190 interpolationScheme_,
202 if (f.
name() == UName_)
212 interpolationScheme_,
220 scalarNames_.setSize(vsInterp.
size());
223 scalarNames_[i] = vsInterp[i].psi().name();
228 vectorNames_[i] = vvInterp[i].psi().name();
236 <<
"Cannot find field to move particles with : " << UName_ <<
nl 237 <<
"This field has to be present in the sampled fields " << fields_
238 <<
" and in the objectRegistry." 247 allTracks_.setCapacity(nSeeds);
249 allAges_.setCapacity(nSeeds);
250 allScalars_.setSize(vsInterp.
size());
253 allScalars_[i].clear();
254 allScalars_[i].setCapacity(nSeeds);
256 allVectors_.setSize(vvInterp.
size());
259 allVectors_[i].clear();
260 allVectors_[i].setCapacity(nSeeds);
272 trackDirection_ == trackDirection::forward,
288 if (trackDirection_ == trackDirection::both)
290 initialParticles = particles;
293 particles.
move(particles, td, trackTime);
295 if (trackDirection_ == trackDirection::both)
299 particles.
move(particles, td, trackTime);
338 dict.
lookup(
"fields") >> fields_;
344 <<
"Velocity field for tracking " << UName_
345 <<
" should be present in the list of fields " << fields_
352 if (!dict.
found(
"direction") && dict.
found(
"trackForward"))
355 dict.
lookup<
bool>(
"trackForward")
356 ? trackDirection::forward
357 : trackDirection::backward;
361 trackDirection_ = trackDirectionNames_[
word(dict.
lookup(
"direction"))];
364 dict.
lookup(
"lifeTime") >> lifeTime_;
368 <<
"Illegal value " << lifeTime_ <<
" for lifeTime" 373 bool subCycling = dict.
found(
"nSubCycle");
374 bool fixedLength = dict.
found(
"trackLength");
376 if (subCycling && fixedLength)
379 <<
"Cannot both specify automatic time stepping (through '" 380 <<
"nSubCycle' specification) and fixed track length (through '" 389 trackLength_ = vGreat;
394 Info<<
" automatic track length specified through" 395 <<
" number of sub cycles : " << nSubCycle_ << nl <<
endl;
399 dict.
lookup(
"trackLength") >> trackLength_;
401 Info<<
" fixed track length specified : " 402 << trackLength_ << nl <<
endl;
408 "interpolationScheme",
423 sampledSetAxis_ = sampledSetPtr_->axis();
468 fromProc.
setSize(globalTrackIDs.localSize(proci));
471 fromProc[i] = trackI++;
477 toMaster.
setSize(globalTrackIDs.localSize());
485 globalTrackIDs.size(),
497 distMap.constructSize(),
500 distMap.constructMap(),
511 distMap.constructSize(),
514 distMap.constructMap(),
521 forAll(allScalars_, scalari)
523 allScalars_[scalari].shrink();
528 distMap.constructSize(),
531 distMap.constructMap(),
533 allScalars_[scalari],
536 allScalars_[scalari].setCapacity(allScalars_[scalari].size());
539 forAll(allVectors_, vectori)
541 allVectors_[vectori].shrink();
546 distMap.constructSize(),
549 distMap.constructMap(),
551 allVectors_[vectori],
554 allVectors_[vectori].setCapacity(allVectors_[vectori].size());
560 forAll(allTracks_, trackI)
562 n += allTracks_[trackI].size();
565 Info<<
" Tracks:" << allTracks_.size() << nl
566 <<
" Total samples:" << n
583 vtkPath = vtkPath/mesh_.
name();
585 vtkPath = vtkPath/mesh_.time().timeName();
591 forAll(allTracks_, trackI)
602 tracks[trackI].transfer(allTracks_[trackI]);
607 if (allScalars_.size() > 0 || writeAge_)
611 allScalars_.size() + writeAge_
613 wordList ageAndScalarNames(allScalars_.size() + writeAge_);
619 ageAndScalarValues[0].
setSize(allTrackAges.
size());
620 forAll(allTrackAges, trackI)
622 ageAndScalarValues[0][trackI].transfer
628 ageAndScalarNames[0] =
"age";
631 forAll(allScalars_, scalari)
633 const label ageAndScalari = scalari + writeAge_;
637 ageAndScalarValues[ageAndScalari].
setSize(allTrackVals.
size());
638 forAll(allTrackVals, trackI)
640 ageAndScalarValues[ageAndScalari][trackI].transfer
646 ageAndScalarNames[ageAndScalari] = scalarNames_[scalari];
652 / scalarFormatterPtr_().getFileName
661 scalarFormatterPtr_().
write 673 if (allVectors_.size() > 0)
677 forAll(allVectors_, vectori)
681 vectorValues[vectori].
setSize(allTrackVals.
size());
682 forAll(allTrackVals, trackI)
684 vectorValues[vectori][trackI].transfer
694 / vectorFormatterPtr_().getFileName
703 vectorFormatterPtr_().
write 720 if (&mpm.
mesh() == &mesh_)
Template class for intrusive linked lists.
Class containing functor to negate primitives. Dummy for all other types.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
virtual Ostream & write(const char)=0
Write character.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
A class for handling file names.
bool set(const label) const
Is element set.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const char *const typeName
streamlines(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
void size(const label)
Override size to be inconsistent with allocated storage.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
static word defaultRegion
Return the default region name.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
static bool master(const label communicator=0)
Am I the master process.
label size() const
Return the number of particles in the cloud.
Field reading functions for post-processing utilities.
Abstract base-class for Time/database functionObjects.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
PtrList< volVectorField > vvFlds
Initialise the NamedEnum HashTable from the static list of names.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
virtual bool execute()
Do nothing.
PtrList< volScalarField > vsFlds
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
bool read(const char *, int32_t &)
void setSize(const label)
Alter the addressed list size.
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
Holds list of sampling positions.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Holds list of sampling points which is filled at construction time. Various implementations of this b...
static const word outputPrefix
Directory prefix.
A class for handling words, derived from string.
A Cloud of streamlines particles.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for.
word name() const
Return file name (part beyond last /)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Particle class that samples fields as it passes through. Used in streamlines calculation.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
virtual bool write()
Calculate and write the streamlines.
const Time & time() const
Return time.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
static autoPtr< setWriter > New(const word &writeFormat)
Return a reference to the selected setWriter.
fileName globalPath() const
Return the global path.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
label size() const
Return the number of elements in the UPtrList.
virtual ~streamlines()
Destructor.
void setSize(const label)
Reset size of List.
void move(TrackCloudType &cloud, typename ParticleType::trackingData &td, const scalar trackTime)
Move the particles.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
Class containing processor-to-processor mapping information.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const polyMesh & mesh() const
Return polyMesh.
label start() const
Return start label of this patch in the polyMesh face list.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Abstract base class for interpolation.
fileName path() const
Return directory path name (part before last /)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual bool read(const dictionary &)
Read the field average data.
Mesh consisting of general polyhedral cells.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
A patch is a list of labels that address the faces in the global face list.
static const NamedEnum< trackDirection, 3 > trackDirectionNames_
Track direction enumeration names.
const labelList & cells() const
A List with indirect addressing.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.