decomposePar: Fixes to -dict option for multi-region cases
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -287,23 +287,24 @@ int main(int argc, char *argv[])
|
||||
// Set time from database
|
||||
#include "createTime.H"
|
||||
|
||||
fileName dictPath;
|
||||
|
||||
// Check if the dictionary is specified on the command-line
|
||||
fileName dictPath = fileName::null;
|
||||
if (args.optionFound("dict"))
|
||||
{
|
||||
dictPath = args["dict"];
|
||||
|
||||
dictPath =
|
||||
(
|
||||
isDir(dictPath)
|
||||
? dictPath/dictName
|
||||
: dictPath
|
||||
);
|
||||
}
|
||||
else
|
||||
if (!isFile(dictPath))
|
||||
{
|
||||
dictPath = runTime.path()/"system"/dictName;
|
||||
dictPath = dictPath/dictName;
|
||||
}
|
||||
|
||||
if (!isFile(dictPath))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Specified -dict " << args["dict"] << " but neither "
|
||||
<< args["dict"] << " nor " << args["dict"]/dictName
|
||||
<< " could be found" << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow override of time
|
||||
@ -352,17 +353,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
|
||||
|
||||
|
||||
// Determine the existing processor count directly
|
||||
label nProcs = fileHandler().nProcs(runTime.path(), regionDir);
|
||||
|
||||
// Get requested numberOfSubdomains. Note: have no mesh yet so
|
||||
// cannot use decompositionModel::New
|
||||
const label nDomains = readLabel
|
||||
// Get the dictionary IO
|
||||
const IOobject dictIO
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
dictPath == fileName::null
|
||||
? IOobject
|
||||
(
|
||||
dictName,
|
||||
runTime.time().system(),
|
||||
@ -372,9 +370,21 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("numberOfSubdomains")
|
||||
: IOobject
|
||||
(
|
||||
dictPath,
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
// Get requested numberOfSubdomains. Note: have no mesh yet so
|
||||
// cannot use decompositionModel::New
|
||||
const label nDomains =
|
||||
readLabel(IOdictionary(dictIO).lookup("numberOfSubdomains"));
|
||||
|
||||
if (decomposeFieldsOnly)
|
||||
{
|
||||
// Sanity check on previously decomposed case
|
||||
@ -465,7 +475,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
dictPath
|
||||
dictIO.objectPath()
|
||||
);
|
||||
|
||||
// Decompose the mesh
|
||||
@ -477,7 +487,7 @@ int main(int argc, char *argv[])
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize;
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
mesh.decomposeMesh(dictPath);
|
||||
mesh.decomposeMesh(dictIO.objectPath());
|
||||
|
||||
mesh.writeDecomposition(decomposeSets);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user