55 ListListOps::combine<List<Type>>
72 {
"forward",
"backward",
"both"};
74 namespace functionObjects
119 dict.
lookup(
"fields") >> fields_;
125 trackDirection_ = trackDirectionNames_[
word(dict.
lookup(
"direction"))];
129 dict.
lookup(
"lifeTime") >> lifeTime_;
134 <<
"Illegal value " << lifeTime_ <<
" for lifeTime" 138 bool subCycling = dict.
found(
"nSubCycle");
139 bool fixedLength = dict.
found(
"trackLength");
140 if (subCycling && fixedLength)
143 <<
"Cannot both specify automatic time stepping (through '" 144 <<
"nSubCycle' specification) and fixed track length (through '" 150 nSubCycle_ =
max(dict.
lookup<scalar>(
"nSubCycle"), 1);
151 trackLength_ = vGreat;
152 Info<<
" automatic track length specified through" 153 <<
" number of sub cycles : " << nSubCycle_ << nl <<
endl;
158 dict.
lookup(
"trackLength") >> trackLength_;
159 Info<<
" fixed track length specified : " 160 << trackLength_ << nl <<
endl;
163 interpolationScheme_ =
166 "interpolationScheme",
220 fieldNames.
append(fields_[fieldi]);
224 cannotFindObject(fields_[fieldi]);
229 #define DeclareTypeInterpolator(Type, nullArg) \ 230 PtrList<interpolation<Type>> Type##Interp(fieldNames.size()); 232 #undef DeclareTypeInterpolator 233 forAll(fieldNames, fieldi)
235 #define ConstructTypeInterpolator(Type, nullArg) \ 236 if (mesh_.foundObject<VolField<Type>>(fieldNames[fieldi])) \ 241 interpolation<Type>::New \ 243 interpolationScheme_, \ 244 mesh_.lookupObject<VolField<Type>>(fieldNames[fieldi]) \ 249 #undef ConstructTypeInterpolator 262 interpolationScheme_,
273 #define DeclareAllTypes(Type, nullArg) \ 274 List<DynamicField<Type>> all##Type##s(fieldNames.size()); 276 #undef DeclareAllTypes 286 forAll(sampledSetPtr_(), i)
293 sampledSetPtr_().positions()[i],
294 sampledSetPtr_().
cells()[i],
303 Info <<
" Seeded " << nSeeds <<
" particles" <<
endl;
313 UIndex != -1 ? vectorInterp[UIndex] : UInterp(),
314 trackDirection_ == trackDirection::forward,
330 if (trackDirection_ == trackDirection::both)
332 initialParticles = particles;
335 particles.
move(particles, td, rootGreat);
337 if (trackDirection_ == trackDirection::both)
341 particles.
move(particles, td, rootGreat);
352 forAll(fieldNames, fieldi)
354 #define GatherAndFlattenAllTypes(Type, nullArg) \ 355 if (Type##Interp.set(fieldi)) \ 357 gatherAndFlatten(all##Type##s[fieldi]); \ 360 #undef GatherAndFlattenAllTypes 365 Info<<
" Sampled " << allPositions.size() <<
" locations" <<
endl;
371 const label nTracks =
max(allTracks) + 1;
372 const label trackParti0 =
min(allTrackParts);
373 const label trackParti1 =
max(allTrackParts) + 1;
380 forAll(allPositions, samplei)
382 const label tracki = allTracks[samplei];
383 const label trackParti = -trackParti0 + allTrackParts[samplei];
384 trackPartCounts[tracki][trackParti] ++;
393 forAll(trackPartOffsets, tracki)
395 forAll(trackPartOffsets[tracki], trackParti)
397 trackPartOffsets[tracki][trackParti] += offset;
398 offset += trackPartCounts[tracki][trackParti];
402 forAll(trackPartCounts, tracki)
404 trackPartCounts[tracki] = 0;
407 forAll(allPositions, samplei)
409 const label tracki = allTracks[samplei];
410 const label trackParti = -trackParti0 + allTrackParts[samplei];
413 trackPartOffsets[tracki][trackParti]
414 + trackPartCounts[tracki][trackParti];
416 trackPartCounts[tracki][trackParti] ++;
453 allPositions.rmap(allPositions, order);
454 allTracks.
rmap(allTracks, order);
455 allTrackParts.
rmap(allTrackParts, order);
456 allAges.
rmap(allAges, order);
457 forAll(fieldNames, fieldi)
459 #define RMapAllTypes(Type, nullArg) \ 460 if (Type##Interp.set(fieldi)) \ 462 all##Type##s[fieldi].rmap(all##Type##s[fieldi], order); \ 475 label samplei = 0, tracki = 0;
476 forAll(allPositions, samplej)
478 const label trackj = allTracks[samplej];
479 const label trackPartj = allTrackParts[samplej];
481 allPositions[samplei] = allPositions[samplej];
482 allTracks[samplei] = tracki;
483 allTrackParts[samplei] = 0;
484 allAges[samplei] = allAges[samplej];
485 forAll(fieldNames, fieldi)
487 #define ShuffleUpAllTypes(Type, nullArg) \ 488 if (Type##Interp.set(fieldi)) \ 490 all##Type##s[fieldi][samplei] = \ 491 all##Type##s[fieldi][samplej]; \ 494 #undef ShuffleUpAllTypes 497 const bool joinNewParts =
498 samplej != allPositions.size() - 1
500 && allTrackParts[samplej + 1] == 0;
502 if (!joinNewParts) samplei ++;
505 samplej == allPositions.size() - 1
506 || trackj != allTracks[samplej + 1]
507 || trackPartj != allTrackParts[samplej + 1];
509 if (!joinNewParts && newPart) tracki ++;
512 allPositions.resize(samplei);
513 allTracks.
resize(samplei);
514 allTrackParts.
resize(samplei);
516 forAll(fieldNames, fieldi)
518 #define ResizeAllTypes(Type, nullArg) \ 519 if (Type##Interp.set(fieldi)) \ 521 all##Type##s[fieldi].resize(samplei); \ 524 #undef ResizeAllTypes 540 outputPath = outputPath/mesh_.
name();
542 outputPath = outputPath/mesh_.time().timeName();
546 const label nValueSets = fieldNames.
size() + writeAge_;
548 #define DeclareTypeValueSets(Type, nullArg) \ 549 UPtrList<const Field<Type>> Type##ValueSets(nValueSets); 551 #undef DeclareTypeValueSets 554 valueSetNames[0] =
"age";
555 scalarValueSets.set(0, &allAges);
557 forAll(fieldNames, fieldi)
559 valueSetNames[fieldi + writeAge_] = fieldNames[fieldi];
561 #define SetTypeValueSetPtr(Type, nullArg) \ 562 if (Type##Interp.set(fieldi)) \ 564 Type##ValueSets.set \ 566 fieldi + writeAge_, \ 567 &all##Type##s[fieldi] \ 571 #undef SetTypeValueSetPtr 604 if (&map.
mesh() == &mesh_)
616 if (&map.
mesh() == &mesh_)
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
Template class for intrusive linked lists.
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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
A class for handling file names.
void gatherAndFlatten(DynamicField< Type > &field)
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define SetTypeValueSetPtr(Type, nullArg)
#define TypeValueSetsParameter(Type, nullArg)
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.
void resize(const label)
Alter the addressed list size.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
streamlines(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
#define DeclareTypeValueSets(Type, nullArg)
static autoPtr< interpolation< Type > > New(const word &interpolationType, const GeometricField< Type, fvPatchField, volMesh > &psi)
Return a reference to the specified interpolation scheme.
void size(const label)
Override size to be inconsistent with allocated storage.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static word defaultRegion
Return the default region name.
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.
#define FoundTypeField(Type, nullArg)
Generic GeometricField class.
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.
Initialise the NamedEnum HashTable from the static list of names.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
#define AllTypesParameter(Type, nullArg)
static List< word > fieldNames
virtual bool execute()
Do nothing.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
This functionObject tracks a particle cloud in the specified velocity field of an incompressible flow...
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
bool read(const char *, int32_t &)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void addParticle(ParticleType *pPtr)
Transfer particle to cloud.
Holds list of sampling positions.
static const word outputPrefix
Directory prefix.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
#define TypeInterpolatorParameter(Type, nullArg)
void append(const T &)
Append an element at the end of the list.
A Cloud of streamlines particles.
word name() const
Return file name (part beyond last /)
static const word null
An empty word.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
#define ShuffleUpAllTypes(Type, nullArg)
List< label > labelList
A List of labels.
Particle class that samples fields as it passes through. Used in streamlines calculation.
const polyMesh & mesh() const
Return polyMesh.
virtual bool write()
Calculate and write the streamlines.
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)
#define DeclareAllTypes(Type, nullArg)
A class for managing temporary objects without reference counting.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
virtual wordList fields() const
Return the list of fields required.
virtual ~streamlines()
Destructor.
label toGlobal(const label i) const
From local to global.
void rmap(const UList< T > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
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...
#define ConstructTypeInterpolator(Type, nullArg)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define GatherAndFlattenAllTypes(Type, nullArg)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define DeclareTypeInterpolator(Type, nullArg)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
#define RMapAllTypes(Type, nullArg)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual bool read(const dictionary &)
Read the field average data.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Mesh consisting of general polyhedral cells.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
static const NamedEnum< trackDirection, 3 > trackDirectionNames_
Track direction enumeration names.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
#define ResizeAllTypes(Type, nullArg)
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.