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