53 Info<<
"probes: resetting sample locations" <<
endl;
57 elementList_.setSize(size());
60 faceList_.setSize(size());
64 const vector& location = operator[](probei);
68 elementList_[probei] = celli;
74 scalar minDistance = great;
78 label facei = cellFaces[i];
80 if (
mag(dist) < minDistance)
82 minDistance =
mag(dist);
86 faceList_[probei] = minFaceID;
90 faceList_[probei] = -1;
93 if (debug && (elementList_[probei] != -1 || faceList_[probei] != -1))
95 Pout<<
"probes : found point " << location
96 <<
" in cell " << elementList_[probei]
97 <<
" and face " << faceList_[probei] <<
endl;
103 forAll(elementList_, probei)
105 const vector& location = operator[](probei);
106 label celli = elementList_[probei];
107 label facei = faceList_[probei];
118 <<
"Did not find location " << location
119 <<
" in any cell. Skipping location." <<
endl;
122 else if (facei == -1)
127 <<
"Did not find location " << location
128 <<
" in any face. Skipping location." <<
endl;
134 if (elementList_[probei] != -1 && elementList_[probei] != celli)
137 <<
"Location " << location
138 <<
" seems to be on multiple domains:" 139 <<
" cell " << elementList_[probei]
141 <<
" and cell " << celli <<
" on some other domain." 143 <<
"This might happen if the probe location is on" 144 <<
" a processor patch. Change the location slightly" 145 <<
" to prevent this." <<
endl;
148 if (faceList_[probei] != -1 && faceList_[probei] != facei)
151 <<
"Location " << location
152 <<
" seems to be on multiple domains:" 153 <<
" cell " << faceList_[probei]
155 <<
" and face " << facei <<
" on some other domain." 157 <<
"This might happen if the probe location is on" 158 <<
" a processor patch. Change the location slightly" 159 <<
" to prevent this." <<
endl;
168 const label nFields = classifyFields();
175 currentFields.
insert(scalarFields_);
176 currentFields.
insert(vectorFields_);
177 currentFields.
insert(sphericalTensorFields_);
178 currentFields.
insert(symmTensorFields_);
179 currentFields.
insert(tensorFields_);
181 currentFields.
insert(surfaceScalarFields_);
182 currentFields.
insert(surfaceVectorFields_);
183 currentFields.
insert(surfaceSphericalTensorFields_);
184 currentFields.
insert(surfaceSymmTensorFields_);
185 currentFields.
insert(surfaceTensorFields_);
189 Info<<
"Probing fields: " << currentFields <<
nl 190 <<
"Probing locations: " << *
this <<
nl 200 probeSubDir = probeSubDir/mesh_.
name();
202 probeSubDir =
"postProcessing"/probeSubDir/mesh_.time().timeName();
204 probeDir = mesh_.time().globalPath()/probeSubDir;
209 if (!currentFields.
erase(iter.key()))
213 Info<<
"close probe stream: " << iter()->name() <<
endl;
216 delete probeFilePtrs_.remove(iter);
223 const word& fieldName = iter.key();
236 probeFilePtrs_.insert(fieldName, fPtr);
239 os <<
setf(ios_base::left);
243 os<<
"# Probe " << probei <<
' ' << operator[](probei)
247 os <<
setw(w) <<
"# Time";
251 os<<
' ' <<
setw(w) << probei;
274 refCast<const fvMesh>
282 loadFromFiles_(
false),
284 fixedLocations_(
true),
285 interpolationScheme_(
"cell")
296 const bool loadFromFiles
301 mesh_(refCast<const fvMesh>(obr)),
302 loadFromFiles_(loadFromFiles),
304 fixedLocations_(
true),
305 interpolationScheme_(
"cell")
321 dict.
lookup(
"probeLocations") >> *
this;
322 dict.
lookup(
"fields") >> fieldSelection_;
325 if (dict.
readIfPresent(
"interpolationScheme", interpolationScheme_))
327 if (!fixedLocations_ && interpolationScheme_ !=
"cell")
330 <<
"Only cell interpolation can be applied when " 331 <<
"not using fixedLocations. InterpolationScheme " 332 <<
"entry will be ignored";
353 if (size() && prepare())
355 sampleAndWrite(scalarFields_);
356 sampleAndWrite(vectorFields_);
357 sampleAndWrite(sphericalTensorFields_);
358 sampleAndWrite(symmTensorFields_);
359 sampleAndWrite(tensorFields_);
361 sampleAndWriteSurfaceFields(surfaceScalarFields_);
362 sampleAndWriteSurfaceFields(surfaceVectorFields_);
363 sampleAndWriteSurfaceFields(surfaceSphericalTensorFields_);
364 sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
365 sampleAndWriteSurfaceFields(surfaceTensorFields_);
376 if (&mpm.
mesh() != &mesh_)
389 Info<<
"probes: remapping sample locations" <<
endl;
399 label celli = elementList_[i];
400 label newCelli = reverseMap[celli];
405 else if (newCelli < -1)
408 elems.
append(-newCelli - 2);
413 elems.append(newCelli);
417 elementList_.transfer(elems);
427 label facei = faceList_[i];
428 label newFacei = reverseMap[facei];
433 else if (newFacei < -1)
436 elems.
append(-newFacei - 2);
441 elems.append(newFacei);
445 faceList_.transfer(elems);
455 if (fixedLocations_ && &mesh == &mesh_)
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
virtual bool write()
Sample and write.
label prepare()
Classify field type and Open/close file streams,.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
virtual bool execute()
Execute, currently does nothing.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
static unsigned int defaultPrecision()
Return the default precision.
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.
static bool master(const label communicator=0)
Am I the master process.
const cellList & cells() const
A HashTable specialisation for hashing pointers.
Abstract base-class for Time/database functionObjects.
const fileName & name() const
Return the name of the stream.
bool insert(const Key &key)
Insert a new entry.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
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.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool read(const char *, int32_t &)
vectorField pointField
pointField is a vectorField.
A class for handling words, derived from string.
virtual void findElements(const fvMesh &)
Find cells and faces containing probes.
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.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
const vectorField & cellCentres() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
#define DebugInfo
Report an information message using Foam::Info.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
const labelList & reverseCellMap() const
Reverse cell map.
defineTypeNameAndDebug(combustionModel, 0)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
const vectorField & faceCentres() const
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
const polyMesh & mesh() const
Return polyMesh.
virtual bool read(const dictionary &)
Read the probes.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
dimensioned< scalar > mag(const dimensioned< Type > &)
probes(const word &name, const Time &time, const dictionary &dict)
Construct from Time and dictionary.
Mesh consisting of general polyhedral cells.
Omanip< int > setw(const int i)
Registry of regIOobjects.
virtual ~probes()
Destructor.
const labelList & reverseFaceMap() const
Reverse face map.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.