57 ListListOps::combine<List<Type>>
74 {
"forward",
"backward",
"both"};
76 namespace functionObjects
121 dict.lookup(
"fields") >> fields_;
123 UName_ =
dict.lookupOrDefault(
"U",
word(
"U"));
125 writeAge_ =
dict.lookupOrDefault<
Switch>(
"writeAge",
true);
127 trackDirection_ = trackDirectionNames_[
word(
dict.lookup(
"direction"))];
129 trackOutside_ =
dict.lookupOrDefault<
Switch>(
"outside",
false);
131 dict.lookup(
"lifeTime") >> lifeTime_;
136 <<
"Illegal value " << lifeTime_ <<
" for lifeTime"
140 bool subCycling =
dict.found(
"nSubCycle");
141 bool fixedLength =
dict.found(
"trackLength");
142 if (subCycling && fixedLength)
145 <<
"Cannot both specify automatic time stepping (through '"
146 <<
"nSubCycle' specification) and fixed track length (through '"
152 nSubCycle_ =
max(
dict.lookup<scalar>(
"nSubCycle"), 1);
153 trackLength_ = vGreat;
154 Info<<
" automatic track length specified through"
155 <<
" number of sub cycles : " << nSubCycle_ <<
nl <<
endl;
160 dict.lookup(
"trackLength") >> trackLength_;
161 Info<<
" fixed track length specified : "
162 << trackLength_ <<
nl <<
endl;
165 interpolationScheme_ =
168 "interpolationScheme",
172 cloudName_ =
dict.lookupOrDefault<
word>(
"cloudName",
"streamlines");
181 dict.subDict(
"seedSampleSet")
226 cannotFindObject(fields_[fieldi]);
231 #define DeclareTypeInterpolator(Type, nullArg) \
232 PtrList<interpolation<Type>> Type##Interp(fieldNames.size());
234 #undef DeclareTypeInterpolator
237 #define ConstructTypeInterpolator(Type, nullArg) \
238 if (mesh_.foundObject<VolField<Type>>(fieldNames[fieldi])) \
243 interpolation<Type>::New \
245 interpolationScheme_, \
246 mesh_.lookupObject<VolField<Type>>(fieldNames[fieldi]) \
251 #undef ConstructTypeInterpolator
264 interpolationScheme_,
275 #define DeclareAllTypes(Type, nullArg) \
276 List<DynamicField<Type>> all##Type##s(fieldNames.size());
278 #undef DeclareAllTypes
288 forAll(sampledSetPtr_(), i)
295 sampledSetPtr_().positions()[i],
296 sampledSetPtr_().
cells()[i],
305 Info <<
" Seeded " << nSeeds <<
" particles" <<
endl;
315 UIndex != -1 ? vectorInterp[UIndex] : UInterp(),
316 trackDirection_ == trackDirection::forward,
332 if (trackDirection_ == trackDirection::both)
339 if (trackDirection_ == trackDirection::both)
356 #define GatherAndFlattenAllTypes(Type, nullArg) \
357 if (Type##Interp.set(fieldi)) \
359 gatherAndFlatten(all##Type##s[fieldi]); \
362 #undef GatherAndFlattenAllTypes
367 Info<<
" Sampled " << allPositions.
size() <<
" locations" <<
endl;
373 const label nTracks =
max(allTracks) + 1;
374 const label trackParti0 =
min(allTrackParts);
375 const label trackParti1 =
max(allTrackParts) + 1;
382 forAll(allPositions, samplei)
384 const label tracki = allTracks[samplei];
385 const label trackParti = -trackParti0 + allTrackParts[samplei];
386 trackPartCounts[tracki][trackParti] ++;
395 forAll(trackPartOffsets, tracki)
397 forAll(trackPartOffsets[tracki], trackParti)
399 trackPartOffsets[tracki][trackParti] +=
offset;
400 offset += trackPartCounts[tracki][trackParti];
404 forAll(trackPartCounts, tracki)
406 trackPartCounts[tracki] = 0;
409 forAll(allPositions, samplei)
411 const label tracki = allTracks[samplei];
412 const label trackParti = -trackParti0 + allTrackParts[samplei];
415 trackPartOffsets[tracki][trackParti]
416 + trackPartCounts[tracki][trackParti];
418 trackPartCounts[tracki][trackParti] ++;
455 allPositions.
rmap(allPositions, order);
456 allTracks.
rmap(allTracks, order);
457 allTrackParts.
rmap(allTrackParts, order);
458 allAges.
rmap(allAges, order);
461 #define RMapAllTypes(Type, nullArg) \
462 if (Type##Interp.set(fieldi)) \
464 all##Type##s[fieldi].rmap(all##Type##s[fieldi], order); \
477 label samplei = 0, tracki = 0;
478 forAll(allPositions, samplej)
480 const label trackj = allTracks[samplej];
481 const label trackPartj = allTrackParts[samplej];
483 allPositions[samplei] = allPositions[samplej];
484 allTracks[samplei] = tracki;
485 allTrackParts[samplei] = 0;
486 allAges[samplei] = allAges[samplej];
489 #define ShuffleUpAllTypes(Type, nullArg) \
490 if (Type##Interp.set(fieldi)) \
492 all##Type##s[fieldi][samplei] = \
493 all##Type##s[fieldi][samplej]; \
496 #undef ShuffleUpAllTypes
499 const bool joinNewParts =
500 samplej != allPositions.
size() - 1
502 && allTrackParts[samplej + 1] == 0;
504 if (!joinNewParts) samplei ++;
507 samplej == allPositions.
size() - 1
508 || trackj != allTracks[samplej + 1]
509 || trackPartj != allTrackParts[samplej + 1];
511 if (!joinNewParts && newPart) tracki ++;
514 allPositions.
resize(samplei);
515 allTracks.
resize(samplei);
516 allTrackParts.
resize(samplei);
520 #define ResizeAllTypes(Type, nullArg) \
521 if (Type##Interp.set(fieldi)) \
523 all##Type##s[fieldi].resize(samplei); \
526 #undef ResizeAllTypes
547 #define DeclareTypeValueSets(Type, nullArg) \
548 UPtrList<const Field<Type>> Type##ValueSets(nValueSets);
550 #undef DeclareTypeValueSets
553 valueSetNames[0] =
"age";
554 scalarValueSets.set(0, &allAges);
558 valueSetNames[fieldi + writeAge_] =
fieldNames[fieldi];
560 #define SetTypeValueSetPtr(Type, nullArg) \
561 if (Type##Interp.set(fieldi)) \
563 Type##ValueSets.set \
565 fieldi + writeAge_, \
566 &all##Type##s[fieldi] \
570 #undef SetTypeValueSetPtr
603 if (&map.
mesh() == &mesh_)
615 if (&map.
mesh() == &mesh_)
627 if (&map.
mesh() == &mesh_)
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Field reading functions for post-processing utilities.
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
void resize(const label)
Alter the addressed list size.
void rmap(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 reverse-map from the given field
Generic GeometricField class.
Template class for intrusive linked lists.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
Initialise the NamedEnum HashTable from the static list of names.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by any number of values (e....
A class for handling file names.
Abstract base-class for Time/database functionObjects.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
This functionObject tracks a particle cloud in the specified velocity field of an incompressible flow...
Generates streamline data by sampling a set of user-specified fields along a particle track,...
streamlines(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual wordList fields() const
Return the list of fields required.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual ~streamlines()
Destructor.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
static const NamedEnum< trackDirection, 3 > trackDirectionNames_
Track direction enumeration names.
virtual bool execute()
Do nothing.
virtual bool write()
Calculate and write the streamlines.
virtual bool read(const dictionary &)
Read the field average data.
static const word outputPrefix
Directory prefix.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label toGlobal(const label i) const
From local to global.
Given cell centre values and point (vertex) values decompose into tetrahedra and linear interpolate w...
static autoPtr< interpolation< Type > > New(const word &interpolationType, const VolField< Type > &psi)
Return a reference to the specified interpolation scheme.
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const polyMesh & mesh() const
Return polyMesh.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
A Cloud of streamlines particles.
Particle class that samples fields as it passes through. Used in streamlines calculation.
A class for managing temporary objects without reference counting.
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static List< word > fieldNames
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool read(const char *, int32_t &)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FOR_ALL_FIELD_TYPES(DefineContiguousFvWallLocationDataType)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void offset(label &lst, const label o)
word name(const complex &)
Return a string representation of a complex.
void gatherAndFlatten(DynamicField< Type > &field)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
#define FoundTypeField(Type, nullArg)
#define DeclareTypeValueSets(Type, nullArg)
#define SetTypeValueSetPtr(Type, nullArg)
#define DeclareAllTypes(Type, nullArg)
#define AllTypesParameter(Type, nullArg)
#define ResizeAllTypes(Type, nullArg)
#define TypeValueSetsParameter(Type, nullArg)
#define DeclareTypeInterpolator(Type, nullArg)
#define GatherAndFlattenAllTypes(Type, nullArg)
#define ConstructTypeInterpolator(Type, nullArg)
#define RMapAllTypes(Type, nullArg)
#define TypeInterpolatorParameter(Type, nullArg)
#define ShuffleUpAllTypes(Type, nullArg)