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 label nLocateBoundaryHits;
289 forAll(sampledSetPtr_(), i)
296 sampledSetPtr_().positions()[i],
297 sampledSetPtr_().
cells()[i],
307 Info <<
" Seeded " << nSeeds <<
" particles" <<
endl;
317 UIndex != -1 ? vectorInterp[UIndex] : UInterp(),
318 trackDirection_ == trackDirection::forward,
334 if (trackDirection_ == trackDirection::both)
341 if (trackDirection_ == trackDirection::both)
358 #define GatherAndFlattenAllTypes(Type, nullArg) \
359 if (Type##Interp.set(fieldi)) \
361 gatherAndFlatten(all##Type##s[fieldi]); \
364 #undef GatherAndFlattenAllTypes
369 Info<<
" Sampled " << allPositions.
size() <<
" locations" <<
endl;
375 const label nTracks =
max(allTracks) + 1;
376 const label trackParti0 =
min(allTrackParts);
377 const label trackParti1 =
max(allTrackParts) + 1;
384 forAll(allPositions, samplei)
386 const label tracki = allTracks[samplei];
387 const label trackParti = -trackParti0 + allTrackParts[samplei];
388 trackPartCounts[tracki][trackParti] ++;
397 forAll(trackPartOffsets, tracki)
399 forAll(trackPartOffsets[tracki], trackParti)
401 trackPartOffsets[tracki][trackParti] +=
offset;
402 offset += trackPartCounts[tracki][trackParti];
406 forAll(trackPartCounts, tracki)
408 trackPartCounts[tracki] = 0;
411 forAll(allPositions, samplei)
413 const label tracki = allTracks[samplei];
414 const label trackParti = -trackParti0 + allTrackParts[samplei];
417 trackPartOffsets[tracki][trackParti]
418 + trackPartCounts[tracki][trackParti];
420 trackPartCounts[tracki][trackParti] ++;
459 allTrackParts.
rmap(allTrackParts,
order);
463 #define RMapAllTypes(Type, nullArg) \
464 if (Type##Interp.set(fieldi)) \
466 all##Type##s[fieldi].rmap(all##Type##s[fieldi], order); \
479 label samplei = 0, tracki = 0;
480 forAll(allPositions, samplej)
482 const label trackj = allTracks[samplej];
483 const label trackPartj = allTrackParts[samplej];
485 allPositions[samplei] = allPositions[samplej];
486 allTracks[samplei] = tracki;
487 allTrackParts[samplei] = 0;
488 allAges[samplei] = allAges[samplej];
491 #define ShuffleUpAllTypes(Type, nullArg) \
492 if (Type##Interp.set(fieldi)) \
494 all##Type##s[fieldi][samplei] = \
495 all##Type##s[fieldi][samplej]; \
498 #undef ShuffleUpAllTypes
501 const bool joinNewParts =
502 samplej != allPositions.
size() - 1
504 && allTrackParts[samplej + 1] == 0;
506 if (!joinNewParts) samplei ++;
509 samplej == allPositions.
size() - 1
510 || trackj != allTracks[samplej + 1]
511 || trackPartj != allTrackParts[samplej + 1];
513 if (!joinNewParts && newPart) tracki ++;
516 allPositions.
resize(samplei);
517 allTracks.
resize(samplei);
518 allTrackParts.
resize(samplei);
522 #define ResizeAllTypes(Type, nullArg) \
523 if (Type##Interp.set(fieldi)) \
525 all##Type##s[fieldi].resize(samplei); \
528 #undef ResizeAllTypes
549 #define DeclareTypeValueSets(Type, nullArg) \
550 UPtrList<const Field<Type>> Type##ValueSets(nValueSets);
552 #undef DeclareTypeValueSets
555 valueSetNames[0] =
"age";
556 scalarValueSets.set(0, &allAges);
560 valueSetNames[fieldi + writeAge_] =
fieldNames[fieldi];
562 #define SetTypeValueSetPtr(Type, nullArg) \
563 if (Type##Interp.set(fieldi)) \
565 Type##ValueSets.set \
567 fieldi + writeAge_, \
568 &all##Type##s[fieldi] \
572 #undef SetTypeValueSetPtr
605 if (&map.
mesh() == &mesh_)
617 if (&map.
mesh() == &mesh_)
629 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.
word name(const bool)
Return a word representation of a bool.
int order(const scalar s)
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,.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
void offset(label &lst, const label o)
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)