BUG: resolve some decomposeParDict problems (issues #60, #265).

- Cleanup/centralize handling of -decomposeParDict by relocating
  common code into argList. Ensures that all processes receive
  identical information about the -decomposeParDict opton.

- Only use alternative decomposeParDict for simpleFoam/motorBike
  tutorial so that this will be included in the test loop for snappy.

- Added Mattijs' fix for surfaceRedistributePar.
This commit is contained in:
Mark Olesen
2016-10-25 18:19:19 +02:00
parent 196a4ea4e5
commit 52d0289ee1
16 changed files with 106 additions and 107 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,6 +46,7 @@ Note
#include "distributedTriSurfaceMesh.H"
#include "mapDistribute.H"
#include "localIOdictionary.H"
#include "decompositionModel.H"
using namespace Foam;
@ -103,7 +104,8 @@ int main(int argc, char *argv[])
{
argList::addNote
(
"redistribute a triSurface"
"Redistribute a triSurface. "
"The specified surface must be located in the constant/triSurface directory"
);
argList::validArgs.append("triSurfaceMesh");
@ -127,7 +129,7 @@ int main(int argc, char *argv[])
<< "Using distribution method "
<< distTypeName << nl << endl;
const bool keepNonMapped = args.options().found("keepNonMapped");
const bool keepNonMapped = args.optionFound("keepNonMapped");
if (keepNonMapped)
{
@ -151,6 +153,37 @@ int main(int argc, char *argv[])
Random rndGen(653213);
// For independent decomposition, ensure that distributedTriSurfaceMesh
// can find the alternative decomposeParDict specified via the
// -decomposeParDict option.
if (distType == distributedTriSurfaceMesh::INDEPENDENT)
{
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
IOdictionary* dict = new IOdictionary
(
decompositionModel::selectIO
(
IOobject
(
"decomposeParDict",
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
),
decompDictFile
)
);
// The object must have the expected "decomposeParDict" name.
// This also implies that it cannot be changed during the run.
dict->rename("decomposeParDict");
runTime.store(dict);
}
// Determine mesh bounding boxes:
List<List<treeBoundBox>> meshBb(Pstream::nProcs());
if (distType == distributedTriSurfaceMesh::FOLLOW)