65 void printMeshData(
const polyMesh& mesh)
92 label maxProcCells = 0;
93 label totProcFaces = 0;
94 label maxProcPatches = 0;
95 label totProcPatches = 0;
96 label maxProcFaces = 0;
101 <<
"Processor " << proci <<
nl
102 <<
" Number of cells = " << globalCells.localSize(proci)
105 label nProcFaces = 0;
107 const labelList& nei = patchNeiProcNo[proci];
109 forAll(patchNeiProcNo[proci], i)
111 Info<<
" Number of faces shared with processor "
112 << patchNeiProcNo[proci][i] <<
" = " << patchSize[proci][i]
115 nProcFaces += patchSize[proci][i];
118 Info<<
" Number of processor patches = " << nei.
size() <<
nl
119 <<
" Number of processor faces = " << nProcFaces <<
nl
120 <<
" Number of boundary faces = "
121 << globalBoundaryFaces.localSize(proci) <<
endl;
123 maxProcCells =
max(maxProcCells, globalCells.localSize(proci));
124 totProcFaces += nProcFaces;
125 totProcPatches += nei.
size();
126 maxProcPatches =
max(maxProcPatches, nei.
size());
127 maxProcFaces =
max(maxProcFaces, nProcFaces);
137 if (totProcPatches == 0)
141 if (totProcFaces == 0)
147 <<
"Number of processor faces = " << totProcFaces/2 <<
nl
148 <<
"Max number of cells = " << maxProcCells
149 <<
" (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells
150 <<
"% above average " << avgProcCells <<
")" <<
nl
151 <<
"Max number of processor patches = " << maxProcPatches
152 <<
" (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches
153 <<
"% above average " << avgProcPatches <<
")" <<
nl
154 <<
"Max number of faces between processors = " << maxProcFaces
155 <<
" (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces
156 <<
"% above average " << avgProcFaces <<
")" <<
nl
162 void writeDecomposition
169 Info<<
"Writing wanted cell distribution to volScalarField " <<
name
170 <<
" for postprocessing purposes." <<
nl <<
endl;
185 extrapolatedCalculatedFvPatchScalarField::typeName
190 procCells[cI] = decomp[cI];
192 procCells.correctBoundaryConditions();
198 template<
class GeoField>
202 const typename GeoField::Mesh& mesh,
221 <<
"differing fields of type " << GeoField::typeName
222 <<
" on processors." <<
endl
223 <<
"Master has:" << masterNames <<
endl
228 fields.setSize(masterNames.size());
240 fields.set(i,
new GeoField(io, mesh));
243 if (subsetterPtr.
valid())
250 if (!haveMesh[proci])
283 mesh.thisDb().time().name(),
307 fields.set(i,
new GeoField(io, mesh));
313 int main(
int argc,
char *argv[])
323 if (
env(
"FOAM_SIGFPE"))
326 <<
"Detected floating point exception trapping (FOAM_SIGFPE)."
327 <<
" This might give" <<
nl
328 <<
" problems when mapping fields. Switch it off in case"
329 <<
" of problems." <<
endl;
346 runTime.setTime(times[0], 0);
359 Info<<
"Using mesh subdirectory " << meshSubDir <<
nl <<
endl;
370 masterInstDir = runTime.findInstance(meshSubDir,
"points");
375 const fileName meshPath = runTime.
path()/masterInstDir/meshSubDir;
377 Info<<
"Found points in " << meshPath <<
nl <<
endl;
384 Info<<
"Per processor mesh availability : " << haveMesh <<
endl;
385 const bool allHaveMesh = (
findIndex(haveMesh,
false) == -1);
401 Info<<
"Before distribution:" <<
endl;
417 finalDecomp = distributor().decompose(mesh, mesh.
cellCentres());
423 writeDecomposition(
"decomposition", mesh, finalDecomp);
453 <<
"Cannot find non-processor patch on processor "
461 subsetterPtr().setLargeCellSubset(
labelHashSet(0), nonProci,
false);
505 volSphereTensorFields
558 surfSphereTensorFields
613 pointSphereTensorFields
623 pointSymmTensorFields
654 Info<<
"After distribution:" <<
endl;
666 Info<<
"Writing redistributed mesh to " << runTime.name() <<
nl <<
endl;
680 <<
"You can pick up the redecomposed mesh from the polyMesh directory"
681 <<
" in " << runTime.name() <<
"." <<
nl
682 <<
"If you redecomposed the mesh to less processors you can delete"
684 <<
"the processor directories with 0 sized meshes in them." <<
nl
685 <<
"Below is a sample set of commands to do this."
686 <<
" Take care when issuing these" <<
nl
687 <<
"commands." <<
nl <<
endl;
693 if (nFaces[proci] == 0)
695 Info<<
" rm -r " << procDir.c_str() <<
nl;
700 fileName constDir = procDir/runTime.constant()/meshSubDir;
702 Info<<
" rm -r " << constDir.c_str() <<
nl
703 <<
" mv " << timeDir.c_str()
704 <<
' ' << constDir.c_str() <<
nl;
Inter-processor communication reduction functions.
#define forAll(list, i)
Loop across all elements in list.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
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...
label size() const
Return the number of elements in the UList.
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 IOdictionary decomposeParDict(const Time &time)
Read and return the decomposeParDict.
static autoPtr< decompositionMethod > NewDistributor(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
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
const word & regionName(const solver ®ion)
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)