mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -901,33 +901,42 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Read decomposePar dictionary
|
// Read decomposePar dictionary
|
||||||
dictionary decomposeDict;
|
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(),
|
||||||
"decomposeParDict",
|
runTime,
|
||||||
runTime.system(),
|
IOobject::MUST_READ,
|
||||||
mesh,
|
IOobject::NO_WRITE
|
||||||
IOobject::MUST_READ,
|
),
|
||||||
IOobject::NO_WRITE
|
decompDictFile
|
||||||
),
|
)
|
||||||
decompDictFile
|
);
|
||||||
)
|
|
||||||
);
|
// Store it on the object registry, but to be found it must also
|
||||||
}
|
// have the expected "decomposeParDict" name.
|
||||||
else
|
|
||||||
{
|
dictPtr->rename("decomposeParDict");
|
||||||
decomposeDict.add("method", "none");
|
runTime.store(dictPtr);
|
||||||
decomposeDict.add("numberOfSubdomains", 1);
|
|
||||||
}
|
decomposeDict = *dictPtr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
decomposeDict.add("method", "none");
|
||||||
|
decomposeDict.add("numberOfSubdomains", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,10 @@ int main(int argc, char *argv[])
|
|||||||
fileName decompDictFile;
|
fileName decompDictFile;
|
||||||
args.optionReadIfPresent("decomposeParDict", 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
|
decompositionModel::selectIO
|
||||||
(
|
(
|
||||||
@ -177,11 +180,11 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// The object must have the expected "decomposeParDict" name.
|
// Store it on the object registry, but to be found it must also
|
||||||
// This also implies that it cannot be changed during the run.
|
// have the expected "decomposeParDict" name.
|
||||||
dict->rename("decomposeParDict");
|
|
||||||
|
|
||||||
runTime.store(dict);
|
dictPtr->rename("decomposeParDict");
|
||||||
|
runTime.store(dictPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine mesh bounding boxes:
|
// Determine mesh bounding boxes:
|
||||||
|
|||||||
@ -56,15 +56,17 @@ isTest()
|
|||||||
#
|
#
|
||||||
getNumberOfProcessors()
|
getNumberOfProcessors()
|
||||||
{
|
{
|
||||||
|
local dict="${1:-system/decomposeParDict}"
|
||||||
|
|
||||||
# Re-use positional parameters for automatic whitespace elimination
|
# 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 ]
|
if [ "$#" -eq 1 ]
|
||||||
then
|
then
|
||||||
echo "$1"
|
echo "$1"
|
||||||
else
|
else
|
||||||
echo "Error retrieving 'numberOfSubdomains' from decomposeParDict" 1>&2
|
echo "Warning no 'numberOfSubdomains' in '$dict'" 1>&2
|
||||||
echo 1
|
echo 1 # serial as fallback
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,10 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Source tutorial run functions
|
# Source tutorial run functions
|
||||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
|
# Alternative decomposeParDict name:
|
||||||
decompDict="-decomposeParDict system/decomposeParDict.6"
|
decompDict="-decomposeParDict system/decomposeParDict.6"
|
||||||
|
## Standard decomposeParDict name:
|
||||||
|
# unset decompDict
|
||||||
|
|
||||||
# copy motorbike surface from resources directory
|
# copy motorbike surface from resources directory
|
||||||
\cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
|
\cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
|
||||||
@ -13,6 +16,14 @@ runApplication surfaceFeatureExtract
|
|||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
|
|
||||||
runApplication decomposePar $decompDict
|
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
|
runParallel $decompDict snappyHexMesh -overwrite
|
||||||
|
|
||||||
#- For non-parallel running: - set the initial fields
|
#- For non-parallel running: - set the initial fields
|
||||||
|
|||||||
@ -15,20 +15,20 @@ FoamFile
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
numberOfSubdomains 4;
|
numberOfSubdomains 6;
|
||||||
|
|
||||||
method hierarchical;
|
method hierarchical;
|
||||||
// method ptscotch;
|
// method ptscotch;
|
||||||
|
|
||||||
simpleCoeffs
|
simpleCoeffs
|
||||||
{
|
{
|
||||||
n (4 1 1);
|
n (6 1 1);
|
||||||
delta 0.001;
|
delta 0.001;
|
||||||
}
|
}
|
||||||
|
|
||||||
hierarchicalCoeffs
|
hierarchicalCoeffs
|
||||||
{
|
{
|
||||||
n (2 2 1);
|
n (3 2 1);
|
||||||
delta 0.001;
|
delta 0.001;
|
||||||
order xyz;
|
order xyz;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user