paraFoam: add support for system/blockMeshDict with the -block option
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1803
This commit is contained in:
parent
00b6400860
commit
75e6691e95
3 changed files with 85 additions and 50 deletions
|
|
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|
@ -43,7 +43,7 @@ License
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(vtkPV3blockMesh, 0);
|
defineTypeNameAndDebug(vtkPV3blockMesh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -335,13 +335,28 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set path for the blockMeshDict
|
||||||
|
const word dictName("blockMeshDict");
|
||||||
|
fileName dictPath(dbPtr_().system()/dictName);
|
||||||
|
|
||||||
|
// Check if dictionary is present in the constant directory
|
||||||
|
if
|
||||||
|
(
|
||||||
|
exists
|
||||||
|
(
|
||||||
|
dbPtr_().path()/dbPtr_().constant()
|
||||||
|
/polyMesh::meshSubDir/dictName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictPath = dbPtr_().constant()/polyMesh::meshSubDir/dictName;
|
||||||
|
}
|
||||||
|
|
||||||
IOdictionary meshDict
|
IOdictionary meshDict
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"blockMeshDict",
|
dictPath,
|
||||||
dbPtr_().constant(),
|
|
||||||
meshDir_,
|
|
||||||
dbPtr_(),
|
dbPtr_(),
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
|
|
|
||||||
|
|
@ -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-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|
@ -43,7 +43,7 @@ License
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(vtkPV4blockMesh, 0);
|
defineTypeNameAndDebug(vtkPV4blockMesh, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -335,13 +335,28 @@ void Foam::vtkPV4blockMesh::updateFoamMesh()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set path for the blockMeshDict
|
||||||
|
const word dictName("blockMeshDict");
|
||||||
|
fileName dictPath(dbPtr_().system()/dictName);
|
||||||
|
|
||||||
|
// Check if dictionary is present in the constant directory
|
||||||
|
if
|
||||||
|
(
|
||||||
|
exists
|
||||||
|
(
|
||||||
|
dbPtr_().path()/dbPtr_().constant()
|
||||||
|
/polyMesh::meshSubDir/dictName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictPath = dbPtr_().constant()/polyMesh::meshSubDir/dictName;
|
||||||
|
}
|
||||||
|
|
||||||
IOdictionary meshDict
|
IOdictionary meshDict
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"blockMeshDict",
|
dictPath,
|
||||||
dbPtr_().constant(),
|
|
||||||
meshDir_,
|
|
||||||
dbPtr_(),
|
dbPtr_(),
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
|
|
|
||||||
85
bin/paraFoam
85
bin/paraFoam
|
|
@ -67,12 +67,12 @@ unset regionName optTouch
|
||||||
# already 2010-07)
|
# already 2010-07)
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
# reader extension
|
# Reader extension
|
||||||
extension=OpenFOAM
|
extension=OpenFOAM
|
||||||
|
|
||||||
requirePV=1
|
requirePV=1
|
||||||
|
|
||||||
# parse options
|
# Parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
@ -110,10 +110,10 @@ do
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break # stop here, treat balance as paraview options
|
break # Stop here, treat balance as paraview options
|
||||||
;;
|
;;
|
||||||
--*)
|
--*)
|
||||||
break # stop here, treat this and balance as paraview options
|
break # Stop here, treat this and balance as paraview options
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unknown option/argument: '$*'"
|
usage "unknown option/argument: '$*'"
|
||||||
|
|
@ -124,7 +124,7 @@ done
|
||||||
# Get the ParaView major version to select the appropriate readers
|
# Get the ParaView major version to select the appropriate readers
|
||||||
version=`echo $ParaView_VERSION | sed -e 's/^\([0-9][0-9]*\).*$/\1/'`
|
version=`echo $ParaView_VERSION | sed -e 's/^\([0-9][0-9]*\).*$/\1/'`
|
||||||
|
|
||||||
# check that reader module has been built
|
# Check that reader module has been built
|
||||||
if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPV${version}FoamReader_SM.so ]
|
if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPV${version}FoamReader_SM.so ]
|
||||||
then
|
then
|
||||||
cat<< BUILDREADER
|
cat<< BUILDREADER
|
||||||
|
|
@ -140,7 +140,7 @@ BUILDREADER
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for --data=... argument
|
# Check for --data=... argument
|
||||||
hasDataArg()
|
hasDataArg()
|
||||||
{
|
{
|
||||||
hasData=false
|
hasData=false
|
||||||
|
|
@ -159,7 +159,7 @@ hasDataArg()
|
||||||
hasDataArg $@
|
hasDataArg $@
|
||||||
|
|
||||||
|
|
||||||
# get a sensible caseName from the directory name
|
# Get a sensible caseName from the directory name
|
||||||
caseName=${PWD##*/}
|
caseName=${PWD##*/}
|
||||||
caseFile="$caseName.$extension"
|
caseFile="$caseName.$extension"
|
||||||
fvControls="system"
|
fvControls="system"
|
||||||
|
|
@ -179,14 +179,14 @@ fi
|
||||||
case "${optTouch:-false}" in
|
case "${optTouch:-false}" in
|
||||||
all)
|
all)
|
||||||
extension=OpenFOAM
|
extension=OpenFOAM
|
||||||
if [ -f constant/polyMesh/blockMeshDict ]
|
if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
|
||||||
then
|
then
|
||||||
touch "$caseName.blockMesh"
|
touch "$caseName.blockMesh"
|
||||||
echo "Created '$caseName.blockMesh'"
|
echo "Created '$caseName.blockMesh'"
|
||||||
fi
|
fi
|
||||||
touch "$caseName.$extension"
|
touch "$caseName.$extension"
|
||||||
echo "Created '$caseName.$extension'"
|
echo "Created '$caseName.$extension'"
|
||||||
# discover probable regions
|
# Discover probable regions
|
||||||
for region in constant/*
|
for region in constant/*
|
||||||
do
|
do
|
||||||
if [ -d $region -a -d $region/polyMesh ]
|
if [ -d $region -a -d $region/polyMesh ]
|
||||||
|
|
@ -206,7 +206,7 @@ true)
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# parent directory for normal or parallel results
|
# Parent directory for normal or parallel results
|
||||||
case "$caseName" in
|
case "$caseName" in
|
||||||
processor*) parentDir=".." ;;
|
processor*) parentDir=".." ;;
|
||||||
*) parentDir="." ;;
|
*) parentDir="." ;;
|
||||||
|
|
@ -216,42 +216,47 @@ esac
|
||||||
if [ "${hasData:-false}" = true ]
|
if [ "${hasData:-false}" = true ]
|
||||||
then
|
then
|
||||||
|
|
||||||
# has --data=.., send directly to paraview
|
# Has --data=.., send directly to paraview
|
||||||
exec paraview "$@"
|
exec paraview "$@"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
# check existence of essential files
|
# Check existence of essential files
|
||||||
warn="WARN file does not exist:"
|
warn="WARN file does not exist:"
|
||||||
case $extension in
|
case $extension in
|
||||||
blockMesh)
|
blockMesh)
|
||||||
for check in \
|
blockMeshDictDir=system/blockMeshDict
|
||||||
system/controlDict \
|
if [ -f constant/polyMesh/blockMeshDict ]
|
||||||
constant/polyMesh/blockMeshDict \
|
then
|
||||||
;
|
blockMeshDictDir=constant/polyMesh/blockMeshDict
|
||||||
do
|
fi
|
||||||
[ -s "$parentDir/$check" ] || {
|
for check in \
|
||||||
[ -n "$warn" ] && echo "$warn" 1>&2
|
system/controlDict \
|
||||||
echo " $parentDir/$check" 1>&2
|
$blockMeshDictDir \
|
||||||
unset warn
|
;
|
||||||
}
|
do
|
||||||
done
|
[ -s "$parentDir/$check" ] || {
|
||||||
;;
|
[ -n "$warn" ] && echo "$warn" 1>&2
|
||||||
|
echo " $parentDir/$check" 1>&2
|
||||||
|
unset warn
|
||||||
|
}
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
builtin | OpenFOAM)
|
builtin | OpenFOAM)
|
||||||
for check in \
|
for check in \
|
||||||
system/controlDict \
|
system/controlDict \
|
||||||
$fvControls/fvSchemes \
|
$fvControls/fvSchemes \
|
||||||
$fvControls/fvSolution \
|
$fvControls/fvSolution \
|
||||||
;
|
;
|
||||||
do
|
do
|
||||||
[ -s "$parentDir/$check" ] || {
|
[ -s "$parentDir/$check" ] || {
|
||||||
[ -n "$warn" ] && echo "$warn" 1>&2
|
[ -n "$warn" ] && echo "$warn" 1>&2
|
||||||
echo " $parentDir/$check" 1>&2
|
echo " $parentDir/$check" 1>&2
|
||||||
unset warn
|
unset warn
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$warn" ] || {
|
[ -n "$warn" ] || {
|
||||||
|
|
@ -262,7 +267,7 @@ else
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
# only create/remove caseFile if it didn't already exist
|
# Only create/remove caseFile if it didn't already exist
|
||||||
[ -e $caseFile ] || {
|
[ -e $caseFile ] || {
|
||||||
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
||||||
touch "$caseFile"
|
touch "$caseFile"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue