mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
decomposePar gets -lazy option
This commit is contained in:
@ -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[])
|
|||||||
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[])
|
|||||||
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[])
|
|||||||
{
|
{
|
||||||
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[])
|
|||||||
|
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user