Commit 58fad3ab authored by Mark Olesen's avatar Mark Olesen
Browse files

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.
parent 55ed6ec7
......@@ -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);
// A demand-driven decompositionMethod can have issues finding
// an alternative decomposeParDict location.
decomposeDict = IOdictionary
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);
}
......
......@@ -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:
......
......@@ -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
}
......
......@@ -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
......
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment