BUG: snappyHexMesh with -decomposeParDict option (issue #265)

- only occurs in combination with distributedTriSurfaceMesh in snappy.

- workaround similar to that previously used for surfaceRedistributePar
  (issue #60).

Minor adjustment of incompressible motorBike tutorial to detect use of
distributedTriSurfaceMesh.
This commit is contained in:
Mark Olesen 2016-11-24 12:02:11 +01:00
parent 55ed6ec776
commit 58fad3ab79
5 changed files with 59 additions and 34 deletions

View File

@ -901,33 +901,42 @@ int main(int argc, char *argv[])
// Read decomposePar dictionary
dictionary decomposeDict;
if (Pstream::parRun())
{
if (Pstream::parRun())
{
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
decomposeDict = IOdictionary
// A demand-driven decompositionMethod can have issues finding
// an alternative decomposeParDict location.
IOdictionary* dictPtr = new IOdictionary
(
decompositionModel::selectIO
(
decompositionModel::selectIO
IOobject
(
IOobject
(
"decomposeParDict",
runTime.system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
decompDictFile
)
);
}
else
{
decomposeDict.add("method", "none");
decomposeDict.add("numberOfSubdomains", 1);
}
"decomposeParDict",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
decompDictFile
)
);
// Store it on the object registry, but to be found it must also
// have the expected "decomposeParDict" name.
dictPtr->rename("decomposeParDict");
runTime.store(dictPtr);
decomposeDict = *dictPtr;
}
else
{
decomposeDict.add("method", "none");
decomposeDict.add("numberOfSubdomains", 1);
}

View File

@ -161,7 +161,10 @@ int main(int argc, char *argv[])
fileName decompDictFile;
args.optionReadIfPresent("decomposeParDict", decompDictFile);
IOdictionary* dict = new IOdictionary
// A demand-driven decompositionMethod can have issues finding
// an alternative decomposeParDict location.
IOdictionary* dictPtr = new IOdictionary
(
decompositionModel::selectIO
(
@ -177,11 +180,11 @@ int main(int argc, char *argv[])
)
);
// The object must have the expected "decomposeParDict" name.
// This also implies that it cannot be changed during the run.
dict->rename("decomposeParDict");
// Store it on the object registry, but to be found it must also
// have the expected "decomposeParDict" name.
runTime.store(dict);
dictPtr->rename("decomposeParDict");
runTime.store(dictPtr);
}
// Determine mesh bounding boxes:

View File

@ -56,15 +56,17 @@ isTest()
#
getNumberOfProcessors()
{
local dict="${1:-system/decomposeParDict}"
# Re-use positional parameters for automatic whitespace elimination
set -- $(foamDictionary -entry numberOfSubdomains -value "${1:-system/decomposeParDict}")
set -- $(foamDictionary -entry numberOfSubdomains -value "$dict" 2>/dev/null)
if [ "$#" -eq 1 ]
then
echo "$1"
else
echo "Error retrieving 'numberOfSubdomains' from decomposeParDict" 1>&2
echo 1
echo "Warning no 'numberOfSubdomains' in '$dict'" 1>&2
echo 1 # serial as fallback
return 1
fi
}

View File

@ -4,7 +4,10 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Alternative decomposeParDict name:
decompDict="-decomposeParDict system/decomposeParDict.6"
## Standard decomposeParDict name:
# unset decompDict
# copy motorbike surface from resources directory
\cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
@ -13,6 +16,14 @@ runApplication surfaceFeatureExtract
runApplication blockMesh
runApplication decomposePar $decompDict
# Using distributedTriSurfaceMesh?
if foamDictionary -entry geometry -value system/snappyHexMeshDict | \
grep -q distributedTriSurfaceMesh
then
runParallel $decompDict surfaceRedistributePar motorBike.obj independent
fi
runParallel $decompDict snappyHexMesh -overwrite
#- For non-parallel running: - set the initial fields

View File

@ -15,20 +15,20 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
numberOfSubdomains 6;
method hierarchical;
// method ptscotch;
simpleCoeffs
{
n (4 1 1);
n (6 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (2 2 1);
n (3 2 1);
delta 0.001;
order xyz;
}