55 Info<<
"probes: resetting sample locations" <<
endl;
59 elementList_.setSize(size());
62 faceList_.setSize(size());
66 const vector& location = operator[](probei);
70 elementList_[probei] = celli;
76 scalar minDistance = great;
80 label facei = cellFaces[i];
82 if (
mag(dist) < minDistance)
84 minDistance =
mag(dist);
88 faceList_[probei] = minFaceID;
92 faceList_[probei] = -1;
95 if (debug && (elementList_[probei] != -1 || faceList_[probei] != -1))
97 Pout<<
"probes : found point " << location
98 <<
" in cell " << elementList_[probei]
99 <<
" and face " << faceList_[probei] <<
endl;
105 forAll(elementList_, probei)
107 const vector& location = operator[](probei);
108 label celli = elementList_[probei];
109 label facei = faceList_[probei];
120 <<
"Did not find location " << location
121 <<
" in any cell. Skipping location." <<
endl;
124 else if (facei == -1)
129 <<
"Did not find location " << location
130 <<
" in any face. Skipping location." <<
endl;
136 if (elementList_[probei] != -1 && elementList_[probei] != celli)
139 <<
"Location " << location
140 <<
" seems to be on multiple domains:" 141 <<
" cell " << elementList_[probei]
143 <<
" and cell " << celli <<
" on some other domain." 145 <<
"This might happen if the probe location is on" 146 <<
" a processor patch. Change the location slightly" 147 <<
" to prevent this." <<
endl;
150 if (faceList_[probei] != -1 && faceList_[probei] != facei)
153 <<
"Location " << location
154 <<
" seems to be on multiple domains:" 155 <<
" cell " << faceList_[probei]
157 <<
" and face " << facei <<
" on some other domain." 159 <<
"This might happen if the probe location is on" 160 <<
" a processor patch. Change the location slightly" 161 <<
" to prevent this." <<
endl;
170 const label nFields = classifyFields();
177 currentFields.
insert(scalarFields_);
178 currentFields.
insert(vectorFields_);
179 currentFields.
insert(sphericalTensorFields_);
180 currentFields.
insert(symmTensorFields_);
181 currentFields.
insert(tensorFields_);
183 currentFields.
insert(surfaceScalarFields_);
184 currentFields.
insert(surfaceVectorFields_);
185 currentFields.
insert(surfaceSphericalTensorFields_);
186 currentFields.
insert(surfaceSymmTensorFields_);
187 currentFields.
insert(surfaceTensorFields_);
191 Info<<
"Probing fields: " << currentFields <<
nl 192 <<
"Probing locations: " << *
this <<
nl 202 probeSubDir = probeSubDir/mesh_.
name();
204 probeSubDir =
"postProcessing"/probeSubDir/mesh_.time().timeName();
210 probeDir = mesh_.time().
path()/
".."/probeSubDir;
214 probeDir = mesh_.time().
path()/probeSubDir;
222 if (!currentFields.
erase(iter.key()))
226 Info<<
"close probe stream: " << iter()->name() <<
endl;
229 delete probeFilePtrs_.remove(iter);
236 const word& fieldName = iter.key();
249 probeFilePtrs_.insert(fieldName, fPtr);
252 os <<
setf(ios_base::left);
256 os<<
"# Probe " << probei <<
' ' << operator[](probei)
260 os <<
setw(w) <<
"# Time";
264 os<<
' ' <<
setw(w) << probei;
287 refCast<const fvMesh>
295 loadFromFiles_(
false),
297 fixedLocations_(
true),
298 interpolationScheme_(
"cell")
309 const bool loadFromFiles
314 mesh_(refCast<const fvMesh>(obr)),
315 loadFromFiles_(loadFromFiles),
317 fixedLocations_(
true),
318 interpolationScheme_(
"cell")
334 dict.
lookup(
"probeLocations") >> *
this;
335 dict.
lookup(
"fields") >> fieldSelection_;
338 if (dict.
readIfPresent(
"interpolationScheme", interpolationScheme_))
340 if (!fixedLocations_ && interpolationScheme_ !=
"cell")
343 <<
"Only cell interpolation can be applied when " 344 <<
"not using fixedLocations. InterpolationScheme " 345 <<
"entry will be ignored";
366 if (size() && prepare())
368 sampleAndWrite(scalarFields_);
369 sampleAndWrite(vectorFields_);
370 sampleAndWrite(sphericalTensorFields_);
371 sampleAndWrite(symmTensorFields_);
372 sampleAndWrite(tensorFields_);
374 sampleAndWriteSurfaceFields(surfaceScalarFields_);
375 sampleAndWriteSurfaceFields(surfaceVectorFields_);
376 sampleAndWriteSurfaceFields(surfaceSphericalTensorFields_);
377 sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
378 sampleAndWriteSurfaceFields(surfaceTensorFields_);
389 if (&mpm.
mesh() != &mesh_)
402 Info<<
"probes: remapping sample locations" <<
endl;
412 label celli = elementList_[i];
413 label newCelli = reverseMap[celli];
418 else if (newCelli < -1)
421 elems.
append(-newCelli - 2);
426 elems.append(newCelli);
430 elementList_.transfer(elems);
440 label facei = faceList_[i];
441 label newFacei = reverseMap[facei];
446 else if (newFacei < -1)
449 elems.
append(-newFacei - 2);
454 elems.append(newFacei);
458 faceList_.transfer(elems);
468 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.
bool clean()
Cleanup file name.
#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 specialization 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.
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.
Istream and Ostream manipulators taking arguments.
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
static bool & parRun()
Is this a parallel run?
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 > &)
fileName path() const
Return directory path name (part before last /)
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.