64 void printMeshData(
const polyMesh& mesh)
91 label maxProcCells = 0;
92 label totProcFaces = 0;
93 label maxProcPatches = 0;
94 label totProcPatches = 0;
95 label maxProcFaces = 0;
100 <<
"Processor " << proci <<
nl
101 <<
" Number of cells = " << globalCells.localSize(proci)
104 label nProcFaces = 0;
106 const labelList& nei = patchNeiProcNo[proci];
108 forAll(patchNeiProcNo[proci], i)
110 Info<<
" Number of faces shared with processor "
111 << patchNeiProcNo[proci][i] <<
" = " << patchSize[proci][i]
114 nProcFaces += patchSize[proci][i];
117 Info<<
" Number of processor patches = " << nei.
size() <<
nl
118 <<
" Number of processor faces = " << nProcFaces <<
nl
119 <<
" Number of boundary faces = "
120 << globalBoundaryFaces.localSize(proci) <<
endl;
122 maxProcCells =
max(maxProcCells, globalCells.localSize(proci));
123 totProcFaces += nProcFaces;
124 totProcPatches += nei.
size();
125 maxProcPatches =
max(maxProcPatches, nei.
size());
126 maxProcFaces =
max(maxProcFaces, nProcFaces);
136 if (totProcPatches == 0)
140 if (totProcFaces == 0)
146 <<
"Number of processor faces = " << totProcFaces/2 <<
nl
147 <<
"Max number of cells = " << maxProcCells
148 <<
" (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells
149 <<
"% above average " << avgProcCells <<
")" <<
nl
150 <<
"Max number of processor patches = " << maxProcPatches
151 <<
" (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches
152 <<
"% above average " << avgProcPatches <<
")" <<
nl
153 <<
"Max number of faces between processors = " << maxProcFaces
154 <<
" (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces
155 <<
"% above average " << avgProcFaces <<
")" <<
nl
161 void writeDecomposition
168 Info<<
"Writing wanted cell distribution to volScalarField " <<
name
169 <<
" for postprocessing purposes." <<
nl <<
endl;
184 extrapolatedCalculatedFvPatchScalarField::typeName
189 procCells[cI] = decomp[cI];
191 procCells.correctBoundaryConditions();
197 template<
class GeoField>
201 const typename GeoField::Mesh& mesh,
220 <<
"differing fields of type " << GeoField::typeName
221 <<
" on processors." <<
endl
222 <<
"Master has:" << masterNames <<
endl
227 fields.setSize(masterNames.size());
239 fields.set(i,
new GeoField(io, mesh));
242 if (subsetterPtr.
valid())
249 if (!haveMesh[proci])
282 mesh.thisDb().time().name(),
306 fields.set(i,
new GeoField(io, mesh));
312 int main(
int argc,
char *argv[])
322 if (
env(
"FOAM_SIGFPE"))
325 <<
"Detected floating point exception trapping (FOAM_SIGFPE)."
326 <<
" This might give" <<
nl
327 <<
" problems when mapping fields. Switch it off in case"
328 <<
" of problems." <<
endl;
345 runTime.setTime(times[0], 0);
358 Info<<
"Using mesh subdirectory " << meshSubDir <<
nl <<
endl;
369 masterInstDir = runTime.findInstance(meshSubDir,
"points");
374 const fileName meshPath = runTime.
path()/masterInstDir/meshSubDir;
376 Info<<
"Found points in " << meshPath <<
nl <<
endl;
383 Info<<
"Per processor mesh availability : " << haveMesh <<
endl;
384 const bool allHaveMesh = (
findIndex(haveMesh,
false) == -1);
400 Info<<
"Before distribution:" <<
endl;
416 finalDecomp = distributor().decompose(mesh, mesh.
cellCentres());
422 writeDecomposition(
"decomposition", mesh, finalDecomp);
452 <<
"Cannot find non-processor patch on processor "
460 subsetterPtr().setLargeCellSubset(
labelHashSet(0), nonProci,
false);
504 volSphereTensorFields
557 surfSphereTensorFields
612 pointSphereTensorFields
622 pointSymmTensorFields
653 Info<<
"After distribution:" <<
endl;
665 Info<<
"Writing redistributed mesh to " << runTime.name() <<
nl <<
endl;
679 <<
"You can pick up the redecomposed mesh from the polyMesh directory"
680 <<
" in " << runTime.name() <<
"." <<
nl
681 <<
"If you redecomposed the mesh to less processors you can delete"
683 <<
"the processor directories with 0 sized meshes in them." <<
nl
684 <<
"Below is a sample set of commands to do this."
685 <<
" Take care when issuing these" <<
nl
686 <<
"commands." <<
nl <<
endl;
692 if (nFaces[proci] == 0)
694 Info<<
" rm -r " << procDir.c_str() <<
nl;
699 fileName constDir = procDir/runTime.constant()/meshSubDir;
701 Info<<
" rm -r " << constDir.c_str() <<
nl
702 <<
" mv " << timeDir.c_str()
703 <<
' ' << constDir.c_str() <<
nl;
Inter-processor communication reduction functions.
#define forAll(list, i)
Loop across all elements in list.
static pointMesh & New(const polyMesh &mesh)
Generic GeometricField class.
HashTable< IOobject *, word, string::hash >::iterator iterator
List of IOobjects with searching and retrieving facilities.
IOobjectList lookupClass(const word &className) const
Return the list for all IOobjects of a given class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
writeOption writeOpt() const
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Input inter-processor communications stream.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Output inter-processor communications stream.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static int masterNo()
Process index of the master.
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 int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
bool optionFound(const word &opt) const
Return true if the named option is found.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
fileName path() const
Return the path to the caseName.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
static autoPtr< decompositionMethod > NewDistributor(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
static dictionary decomposeParDict(const Time &time)
Read and return the decomposeParDict.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const word & name() const
Return const reference to name.
A class for handling file names.
word name() const
Return file name (part beyond last /)
fileName path() const
Return directory path name (part before last /)
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells,...
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
const labelList & processorPatches() const
Return list of processor patch labels.
Mesh representing a set of points created from polyMesh.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
const globalMeshData & globalData() const
Return parallel info.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void setInstance(const fileName &)
Set the instance for mesh files.
const vectorField & cellCentres() const
label nInternalFaces() const
Neighbour processor patch.
int neighbProcNo() const
Return neighbour processor number.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0)
A class for managing temporary objects.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fvPatchList & patches
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Load or create (0 size) a mesh. Used in distributing meshes to a larger number of processors.
#define WarningInFunction
Report a warning using Foam::Warning.
bool env(const word &)
Return true if environment variable of given name is defined.
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.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
errorManip< error > abort(error &err)
const dimensionSet dimless
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
autoPtr< fvMesh > loadOrCreateMesh(const IOobject &io)
Load (if it exists) or create zero cell mesh given an IOobject:
Foam::argList args(argc, argv)