57 Info<<
"probes: resetting sample locations" <<
endl;
80 scalar minDistance = great;
84 label facei = cellFaces[i];
86 if (
mag(dist) < minDistance)
88 minDistance =
mag(dist);
101 Pout<<
"probes : found point " << location
124 <<
"Did not find location " << location
125 <<
" in any cell. Skipping location." <<
endl;
128 else if (facei == -1)
133 <<
"Did not find location " << location
134 <<
" in any face. Skipping location." <<
endl;
143 <<
"Location " << location
144 <<
" seems to be on multiple domains:"
147 <<
" and cell " << celli <<
" on some other domain." <<
endl
148 <<
"This might happen if the probe location is on"
149 <<
" a processor patch. Change the location slightly"
150 <<
" to prevent this." <<
endl;
156 <<
"Location " << location
157 <<
" seems to be on multiple domains:"
160 <<
" and face " << facei <<
" on some other domain." <<
endl
161 <<
"This might happen if the probe location is on"
162 <<
" a processor patch. Change the location slightly"
163 <<
" to prevent this." <<
endl;
172 const label nFields = classifyFields();
179 currentFields.
insert(scalarFields_);
180 currentFields.
insert(vectorFields_);
181 currentFields.
insert(sphericalTensorFields_);
182 currentFields.
insert(symmTensorFields_);
183 currentFields.
insert(tensorFields_);
185 currentFields.
insert(surfaceScalarFields_);
186 currentFields.
insert(surfaceVectorFields_);
187 currentFields.
insert(surfaceSphericalTensorFields_);
188 currentFields.
insert(surfaceSymmTensorFields_);
189 currentFields.
insert(surfaceTensorFields_);
193 Info<<
"Probing fields: " << currentFields <<
nl
194 <<
"Probing locations: " << locations_ <<
nl
199 mesh_.time().globalPath()
203 /mesh_.time().name();
208 if (!currentFields.
erase(iter.key()))
212 Info<<
"close probe stream: " << iter()->name() <<
endl;
215 delete probeFilePtrs_.remove(iter);
222 const word& fieldName = iter.key();
235 probeFilePtrs_.insert(fieldName, fPtr);
238 os <<
setf(ios_base::left);
240 forAll(locations_, probei)
242 os<<
"# Probe " << probei <<
' ' << locations_[probei] <<
endl;
245 os <<
setw(w) <<
"# Time";
247 forAll(locations_, probei)
249 os<<
' ' <<
setw(w) << probei;
266 const bool initialise
281 fixedLocations_(true),
282 interpolationScheme_(
"cell")
305 if (!fixedLocations_ && interpolationScheme_ !=
"cell")
308 <<
"Only cell interpolation can be applied when "
309 <<
"not using fixedLocations. InterpolationScheme "
310 <<
"entry will be ignored";
346 if (locations_.size() && prepare())
348 sampleAndWrite(scalarFields_);
349 sampleAndWrite(vectorFields_);
350 sampleAndWrite(sphericalTensorFields_);
351 sampleAndWrite(symmTensorFields_);
352 sampleAndWrite(tensorFields_);
354 sampleAndWriteSurfaceFields(surfaceScalarFields_);
355 sampleAndWriteSurfaceFields(surfaceVectorFields_);
356 sampleAndWriteSurfaceFields(surfaceSphericalTensorFields_);
357 sampleAndWriteSurfaceFields(surfaceSymmTensorFields_);
358 sampleAndWriteSurfaceFields(surfaceTensorFields_);
369 if (&
mesh != &mesh_)
return;
382 if (&map.
mesh() != &mesh_)
return;
392 Info<<
"probes: remapping sample locations" <<
endl;
403 const label celli = cellList_[i];
404 const label newCelli = reverseMap[celli];
410 else if (newCelli < -1)
413 elems.
append(-newCelli - 2);
422 cellList_.transfer(elems);
433 const label facei = faceList_[i];
434 const label newFacei = reverseMap[facei];
440 else if (newFacei < -1)
443 elems.
append(-newFacei - 2);
452 faceList_.transfer(elems);
462 if (&map.
mesh() != &mesh_)
return;
472 if (&map.
mesh() != &mesh_)
return;
481 const label nOldElements,
486 labelList elementProbes(nOldElements, -1);
487 forAll(probeElements, probei)
489 if (probeElements[probei] != -1)
491 elementProbes[probeElements[probei]] = probei;
495 elementMap.distribute(elementProbes);
498 forAll(elementProbes, elementi)
500 if (elementProbes[elementi] != -1)
502 probeElements[elementProbes[elementi]] = elementi;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
A HashTable specialisation for hashing pointers.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
static unsigned int defaultPrecision()
Return the default precision.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
const fileName & name() const
Return the name of the stream.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
static bool master(const label communicator=0)
Am I the master process.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Class containing processor-to-processor mapping information.
A class for handling file names.
Abstract base-class for Time/database functionObjects.
static const word outputPrefix
Directory prefix.
Mesh data needed to do the Finite Volume discretisation.
Mesh object that implements searches within the local cells and faces.
label findCell(const point &p, const pointInCellShapes=pointInCellShapes::tets) const
Find the cell containing the given point.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
Registry of regIOobjects.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
label nOldCells() const
Number of cells in mesh before distribution.
const distributionMap & cellMap() const
Cell distribute map.
const distributionMap & faceMap() const
Face distribute map.
label nOldFaces() const
Number of faces in mesh before distribution.
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 labelList & reverseCellMap() const
Reverse cell map.
const labelList & reverseFaceMap() const
Reverse face map.
const polyMesh & mesh() const
Return polyMesh.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
const cellList & cells() const
Set of locations to sample.
virtual ~probes()
Destructor.
const fvMesh & mesh_
Const reference to fvMesh.
pointField locations_
Probe locations.
virtual wordList fields() const
Return the list of fields required.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
label prepare()
Classify field type and Open/close file streams,.
virtual void distribute(const polyDistributionMap &)
Update using the given distribution map.
probes(const word &name, const Time &time, const dictionary &dict, const bool initialise=true)
Construct from Time and dictionary.
virtual void findElements(const fvMesh &)
Find cells and faces containing probes.
bool read(const dictionary &, const bool initialise)
Read the probes.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void movePoints(const polyMesh &)
Update topology using the given map.
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Sample and write.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
bool read(const char *, int32_t &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
To & refCast(From &r)
Reference type cast template function.
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.
Omanip< int > setw(const int i)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)