47 Info<<
"probes: resetting sample locations" <<
endl;
51 elementList_.setSize(size());
54 faceList_.setSize(size());
58 const vector& location = operator[](probeI);
62 elementList_[probeI] = cellI;
68 scalar minDistance = GREAT;
72 label faceI = cellFaces[i];
74 if (
mag(dist) < minDistance)
76 minDistance =
mag(dist);
80 faceList_[probeI] = minFaceID;
84 faceList_[probeI] = -1;
87 if (debug && (elementList_[probeI] != -1 || faceList_[probeI] != -1))
89 Pout<<
"probes : found point " << location
90 <<
" in cell " << elementList_[probeI]
91 <<
" and face " << faceList_[probeI] <<
endl;
97 forAll(elementList_, probeI)
99 const vector& location = operator[](probeI);
100 label cellI = elementList_[probeI];
101 label faceI = faceList_[probeI];
111 WarningIn(
"findElements::findElements(const fvMesh&)")
112 <<
"Did not find location " << location
113 <<
" in any cell. Skipping location." <<
endl;
116 else if (faceI == -1)
120 WarningIn(
"probes::findElements(const fvMesh&)")
121 <<
"Did not find location " << location
122 <<
" in any face. Skipping location." <<
endl;
128 if (elementList_[probeI] != -1 && elementList_[probeI] != cellI)
130 WarningIn(
"probes::findElements(const fvMesh&)")
131 <<
"Location " << location
132 <<
" seems to be on multiple domains:" 133 <<
" cell " << elementList_[probeI]
135 <<
" and cell " << cellI <<
" on some other domain." 137 <<
"This might happen if the probe location is on" 138 <<
" a processor patch. Change the location slightly" 139 <<
" to prevent this." <<
endl;
142 if (faceList_[probeI] != -1 && faceList_[probeI] != faceI)
144 WarningIn(
"probes::findElements(const fvMesh&)")
145 <<
"Location " << location
146 <<
" seems to be on multiple domains:" 147 <<
" cell " << faceList_[probeI]
149 <<
" and face " << faceI <<
" on some other domain." 151 <<
"This might happen if the probe location is on" 152 <<
" a processor patch. Change the location slightly" 153 <<
" to prevent this." <<
endl;
162 const label nFields = classifyFields();
169 currentFields.
insert(scalarFields_);
170 currentFields.
insert(vectorFields_);
171 currentFields.
insert(sphericalTensorFields_);
172 currentFields.
insert(symmTensorFields_);
173 currentFields.
insert(tensorFields_);
175 currentFields.
insert(surfaceScalarFields_);
176 currentFields.
insert(surfaceVectorFields_);
177 currentFields.
insert(surfaceSphericalTensorFields_);
178 currentFields.
insert(surfaceSymmTensorFields_);
179 currentFields.
insert(surfaceTensorFields_);
183 Info<<
"Probing fields: " << currentFields <<
nl 184 <<
"Probing locations: " << *
this <<
nl 194 probeSubDir = probeSubDir/mesh_.
name();
196 probeSubDir =
"postProcessing"/probeSubDir/mesh_.time().timeName();
202 probeDir = mesh_.time().
path()/
".."/probeSubDir;
206 probeDir = mesh_.time().
path()/probeSubDir;
212 if (!currentFields.
erase(iter.key()))
216 Info<<
"close probe stream: " << iter()->name() <<
endl;
219 delete probeFilePtrs_.remove(iter);
226 const word& fieldName = iter.key();
240 probeFilePtrs_.insert(fieldName, fPtr);
246 fout<<
"# Probe " << probeI <<
' ' << operator[](probeI)
255 fout<<
' ' <<
setw(w) << probeI;
275 const bool loadFromFiles
280 mesh_(refCast<const fvMesh>(obr)),
281 loadFromFiles_(loadFromFiles),
283 fixedLocations_(
true),
284 interpolationScheme_(
"cell")
318 if (size() && prepare())
320 sampleAndWrite(scalarFields_);
321 sampleAndWrite(vectorFields_);
322 sampleAndWrite(sphericalTensorFields_);
323 sampleAndWrite(symmTensorFields_);
324 sampleAndWrite(tensorFields_);
326 sampleAndWriteSurfaceFields(surfaceScalarFields_);
327 sampleAndWriteSurfaceFields(surfaceVectorFields_);
328 sampleAndWriteSurfaceFields(surfaceSphericalTensorFields_);
329 sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
330 sampleAndWriteSurfaceFields(surfaceTensorFields_);
337 dict.
lookup(
"probeLocations") >> *
this;
338 dict.
lookup(
"fields") >> fieldSelection_;
341 if (dict.
readIfPresent(
"interpolationScheme", interpolationScheme_))
343 if (!fixedLocations_ && interpolationScheme_ !=
"cell")
345 WarningIn(
"void Foam::probes::read(const dictionary&)")
346 <<
"Only cell interpolation can be applied when " 347 <<
"not using fixedLocations. InterpolationScheme " 348 <<
"entry will be ignored";
363 Info<<
"probes: updateMesh" <<
endl;
374 Info<<
"probes: remapping sample locations" <<
endl;
384 label cellI = elementList_[i];
385 label newCellI = reverseMap[cellI];
390 else if (newCellI < -1)
393 elems.
append(-newCellI - 2);
398 elems.append(newCellI);
402 elementList_.transfer(elems);
412 label faceI = faceList_[i];
413 label newFaceI = reverseMap[faceI];
418 else if (newFaceI < -1)
421 elems.
append(-newFaceI - 2);
426 elems.append(newFaceI);
430 faceList_.transfer(elems);
440 Info<<
"probes: movePoints" <<
endl;
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static bool & parRun()
Is this a parallel run?
word name() const
Return file name (part beyond last /)
Mesh data needed to do the Finite Volume discretisation.
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
const labelList & reverseFaceMap() const
Reverse face map.
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
dimensioned< scalar > mag(const dimensioned< Type > &)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
#define forAllIter(Container, container, iter)
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const cellList & cells() const
label prepare()
Classify field type and Open/close file streams,.
const vectorField & cellCentres() const
virtual void end()
Execute at the final time-loop, currently does nothing.
fileName path() const
Return directory path name (part before last /)
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual void write()
Sample and write.
virtual void findElements(const fvMesh &)
Find cells and faces containing probes.
virtual void read(const dictionary &)
Read the probes.
vectorField pointField
pointField is a vectorField.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
const fileName & name() const
Return the name of the stream.
virtual ~probes()
Destructor.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
Omanip< int > setw(const int i)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Istream and Ostream manipulators taking arguments.
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
static word defaultRegion
Return the default region name.
Mesh consisting of general polyhedral cells.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Registry of regIOobjects.
A class for handling file names.
A HashTable with keys but without contents.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
const labelList & reverseCellMap() const
Reverse cell map.
static bool master(const label communicator=0)
Am I the master process.
bool read(const char *, int32_t &)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
static unsigned int defaultPrecision()
Return the default precision.
virtual void execute()
Execute, currently does nothing.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
const vectorField & faceCentres() const
A HashTable specialization for hashing pointers.
bool insert(const Key &key)
Insert a new entry.