101 void decomposeUniform
103 const bool copyUniform,
108 const fileName uniformDir(regionDir/
"uniform");
127 procTimePath/uniformDir
134 string parentPath =
string(
"..")/
"..";
138 parentPath = parentPath/
"..";
180 Info<<
"Wrote decomposition as volScalarField::Internal to "
181 << cellProc.name() <<
" for use in postprocessing"
207 if (!dnl.first_) os <<
nl;
218 int main(
int argc,
char *argv[])
222 "decompose a mesh and fields of a case for parallel execution"
231 "write cell processor indices as a volScalarField::Internal for "
237 "Copy \a 0 directory to processor* rather than decompose the fields"
242 "copy any uniform/ directories too"
247 "use existing geometry decomposition and convert fields only"
252 "opposite of -fields; only decompose geometry"
257 "skip decomposing cellSets, faceSets, pointSets"
262 "remove existing processor*/ subdirs before decomposing the geometry"
279 if (decomposeGeomOnly)
281 Info<<
"Skipping decomposing fields" <<
nl <<
endl;
283 if (decomposeFieldsOnly || copyZero)
286 <<
"Cannot combine geometry-only decomposition (-noFields)"
287 <<
" with field decomposition (-fields or -copyZero)"
308 <<
"Cannot force the decomposition of a single region"
312 const label nProcs0 =
315 Info<<
"Removing " << nProcs0
316 <<
" existing processor directories" <<
nl <<
endl;
332 if (d.find(
"processors") == 0)
341 if (d.find(
"processor") == 0)
363 const label nProcs0 =
366 if (nProcs0 && nProcs0 != runTimes.
nProcs())
369 <<
"Case is already decomposed with " << nProcs0
370 <<
" domains, use the -force option or manually" <<
nl
371 <<
"remove processor directories before decomposing. e.g.,"
388 const word regionDir =
396 const label nDomains =
397 decomposeParDict.
lookup<
label>(
"numberOfSubdomains");
403 if (decomposeFieldsOnly && nProcs != nDomains)
406 <<
"Specified -fields, but the case was decomposed with "
407 << nProcs <<
" domains" <<
nl <<
"instead of " << nDomains
408 <<
" domains as specified in decomposeParDict" <<
nl
417 !(decomposeFieldsOnly && copyZero)
418 && regionMeshes.readDecompose(decomposeSets)
427 writeDecomposition(regionMeshes[regioni]());
435 const bool distributed =
442 runTimes.
setTime(times[timei], timei);
449 !(decomposeFieldsOnly && copyZero)
450 ? regionMeshes.readUpdateDecompose()
455 if (!decomposeFieldsOnly)
457 regionMeshes.writeProcs(decomposeSets);
465 writeDecomposition(regionMeshes[regioni]());
472 if (decomposeGeomOnly)
485 for (
label proci = 0; proci < runTimes.
nProcs(); proci++)
505 if (procTimePath != prevProcTimePath)
507 Info<<
"Processor " << proci
508 <<
": copying " << completeTimePath <<
nl
509 <<
" to " << procTimePath <<
endl;
511 prevProcTimePath = procTimePath;
526 const word regionDir =
529 const delayedNewLine dnl;
534 regionMeshes[regioni];
539 meshes().completeMesh(),
544 Info<< dnl <<
"Decomposing FV fields" <<
endl;
550 meshes().completeMesh(),
551 meshes().procMeshes(),
552 meshes().procFaceAddressing(),
553 meshes().procCellAddressing(),
554 meshes().procFaceAddressingBf()
557 #define DO_FV_VOL_INTERNAL_FIELDS_TYPE(Type, nullArg) \
558 fvDecomposer.decomposeVolInternalFields<Type> \
561 #undef DO_FV_VOL_INTERNAL_FIELDS_TYPE
563 #define DO_FV_VOL_FIELDS_TYPE(Type, nullArg) \
564 fvDecomposer.decomposeVolFields<Type> \
567 #undef DO_FV_VOL_FIELDS_TYPE
569 #define DO_FV_SURFACE_FIELDS_TYPE(Type, nullArg) \
570 fvDecomposer.decomposeFvSurfaceFields<Type> \
573 #undef DO_FV_SURFACE_FIELDS_TYPE
577 Info<< dnl <<
" (no FV fields)" <<
endl;
582 Info<< dnl <<
"Decomposing point fields" <<
endl;
589 meshes().procMeshes(),
590 meshes().procPointAddressing()
593 #define DO_POINT_FIELDS_TYPE(Type, nullArg) \
594 pointDecomposer.decomposeFields<Type> \
597 #undef DO_POINT_FIELDS_TYPE
601 Info<< dnl <<
" (no point fields)" <<
endl;
625 meshes().completeMesh(),
634 if (cloudObjs.lookup(
word(
"positions")))
636 cloudsObjects.
insert(cloudDirs[i], cloudObjs);
641 if (cloudsObjects.
size())
651 string::validate<word>(iter.key());
655 Info<< dnl <<
"Decomposing lagrangian fields for "
669 meshes().completeMesh(),
670 meshes().procMeshes(),
671 meshes().procFaceAddressing(),
672 meshes().procCellAddressing(),
676 #define DO_CLOUD_FIELDS_TYPE(Type, nullArg) \
677 lagrangianDecomposer.decomposeFields<Type> \
679 DO_CLOUD_FIELDS_TYPE(
label, );
681 #undef DO_CLOUD_FIELDS_TYPE
685 Info<< dnl <<
" (no lagrangian fields)"
697 if (haveUniform(runTimes))
699 Info<<
"Distributing uniform files" <<
endl;
703 copyUniform || distributed,
716 const word regionDir =
719 if (haveUniform(runTimes, regionDir))
724 regionMeshes[regioni];
726 Info<<
"Distributing uniform files" <<
endl;
730 copyUniform || distributed,
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An STL-conforming hash table.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName path() const
Explicitly inherit path from TimePaths to disambiguate from.
word userTimeName() const
Return current user time name with units.
static word controlDictName
The default control dictionary name (normally "controlDict")
fileName timePath() const
Return current time path.
static void addNote(const string &)
Add extra notes for the usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
static void noParallel()
Remove the parallel options.
static const word prefix
The prefix to local: lagrangian.
static IOdictionary 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....
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const word & name() const
Return const reference to name.
Automatic domain decomposition class for finite-volume meshes.
const labelList & cellProc() const
Return the distribution as an FV field for writing.
const fvMesh & completeMesh() const
Access the global mesh.
A class for handling file names.
virtual bool rmDir(const fileName &) const =0
Remove a directory and its contents.
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const =0
Copy, recursively if necessary, the source to the destination.
virtual bool ln(const fileName &src, const fileName &dst) const =0
Create a softlink. dst should not exist. Returns true if.
virtual label nProcs(const fileName &dir, const fileName &local="") const
Get number of processor directories/results. Used for e.g.
virtual bool isDir(const fileName &, const bool followLink=true) const =0
Does the name exist as a directory in the file system?
virtual bool mkDir(const fileName &, mode_t=0777) const =0
Make directory.
virtual fileName filePath(const bool globalFile, const IOobject &, const word &typeName) const =0
Search for an object. globalFile : also check undecomposed case.
Finite Volume volume and surface field decomposer.
static bool decomposes(const IOobjectList &objects)
Return whether anything in the object list gets decomposed.
const Time & time() const
Return the top-level database.
readUpdateState
Enumeration defining the state of the mesh after a read update.
Lagrangian field decomposer.
static bool decomposes(const IOobjectList &objects)
Return whether anything in the object list gets decomposed.
static bool decomposes(const IOobjectList &objects)
Return whether anything in the object list gets decomposed.
static word defaultRegion
Return the default region name.
instantList selectComplete(const argList &args)
Select the time.
label nProcs() const
Return the number of processors.
const PtrList< Time > & procTimes() const
Access the processor run times.
void setTime(const instant &inst, const label newIndex)
Set the time.
const Time & completeTime() const
Access the complete run time.
A class for handling character strings derived from std::string.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
fileName cwd()
Return current working directory path name.
List< word > wordList
A List of words.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
const word & regionName(const solver ®ion)
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
List< scalar > scalarList
A List of scalars.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
bool chDir(const fileName &dir)
Change the current directory to the one given and return true,.
const Foam::wordList regionNames(args.optionFound("allRegions") ? runTime .controlDict().subDict("regionSolvers").toc() :wordList(1, args.optionFound("region") ? args.optionRead< word >("region") :polyMesh::defaultRegion))
Foam::argList args(argc, argv)
const word cloudName(propsDict.lookup("cloudName"))