Skip to content
Snippets Groups Projects
Commit 15709858 authored by Mark Olesen's avatar Mark Olesen
Browse files

decomposePar gets -lazy option

parent 98e1cd02
Branches
Tags
No related merge requests found
...@@ -48,7 +48,15 @@ Usage ...@@ -48,7 +48,15 @@ Usage
@param -force \n @param -force \n
Remove any existing @a processor subdirectories before decomposing the Remove any existing @a processor subdirectories before decomposing the
geometry. geometry. Has precedence over the @a -lazy option.
@param -lazy \n
Only decompose the geometry if the number of domains has changed
from a previous decomposition. Any existing @a processor subdirectories
are removed as necessary. This option can be used to avoid redundant
geometry decomposition (eg, in scripts), but should be used with caution
when the underlying (serial) geometry or the decomposition method etc
have been changed between decompositions.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
...@@ -80,6 +88,7 @@ int main(int argc, char *argv[]) ...@@ -80,6 +88,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("fields", ""); argList::validOptions.insert("fields", "");
argList::validOptions.insert("filterPatches", ""); argList::validOptions.insert("filterPatches", "");
argList::validOptions.insert("force", ""); argList::validOptions.insert("force", "");
argList::validOptions.insert("lazy", "");
# include "setRootCase.H" # include "setRootCase.H"
...@@ -88,6 +97,7 @@ int main(int argc, char *argv[]) ...@@ -88,6 +97,7 @@ int main(int argc, char *argv[])
bool decomposeFieldsOnly(args.options().found("fields")); bool decomposeFieldsOnly(args.options().found("fields"));
bool filterPatches(args.options().found("filterPatches")); bool filterPatches(args.options().found("filterPatches"));
bool forceOverwrite(args.options().found("force")); bool forceOverwrite(args.options().found("force"));
bool lazyDecomposition(args.options().found("lazy"));
# include "createTime.H" # include "createTime.H"
...@@ -115,6 +125,8 @@ int main(int argc, char *argv[]) ...@@ -115,6 +125,8 @@ int main(int argc, char *argv[])
{ {
if (nProcs) if (nProcs)
{ {
bool hasProcDirs = true;
if (forceOverwrite) if (forceOverwrite)
{ {
Info<< "Removing " << nProcs Info<< "Removing " << nProcs
...@@ -130,13 +142,47 @@ int main(int argc, char *argv[]) ...@@ -130,13 +142,47 @@ int main(int argc, char *argv[])
rmDir(procDir); rmDir(procDir);
} }
hasProcDirs = false;
} }
else else if (lazyDecomposition)
{
// lazy decomposition
IOdictionary decompDict
(
IOobject
(
"decomposeParDict",
runTime.time().system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
label nDomains
(
readInt(decompDict.lookup("numberOfSubdomains"))
);
// avoid repeated decomposition
if (nDomains == nProcs)
{
decomposeFieldsOnly = true;
hasProcDirs = false;
Info<< "Using existing processor directories" << nl;
}
}
if (hasProcDirs)
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Case is already decomposed, " << "Case is already decomposed with " << nProcs
"use the -force option or manually remove" << nl << " domains, use the -force option or manually" << nl
<< "processor directories before decomposing. e.g.," << nl << "remove processor directories before decomposing. e.g.,"
<< nl
<< " rm -rf " << runTime.path().c_str() << "/processor*" << " rm -rf " << runTime.path().c_str() << "/processor*"
<< nl << nl
<< exit(FatalError); << exit(FatalError);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment