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
251526e024
commit
19dcf83b6a
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(vtkPV3blockMesh, 0);
|
||||
defineTypeNameAndDebug(vtkPV3blockMesh, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -335,13 +335,28 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
|
||||
<< 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
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"blockMeshDict",
|
||||
dbPtr_().constant(),
|
||||
meshDir_,
|
||||
dictPath,
|
||||
dbPtr_(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(vtkPV4blockMesh, 0);
|
||||
defineTypeNameAndDebug(vtkPV4blockMesh, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -335,13 +335,28 @@ void Foam::vtkPV4blockMesh::updateFoamMesh()
|
||||
<< 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
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"blockMeshDict",
|
||||
dbPtr_().constant(),
|
||||
meshDir_,
|
||||
dictPath,
|
||||
dbPtr_(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
|
33
bin/paraFoam
33
bin/paraFoam
@ -67,12 +67,12 @@ unset regionName optTouch
|
||||
# already 2010-07)
|
||||
export LC_ALL=C
|
||||
|
||||
# reader extension
|
||||
# Reader extension
|
||||
extension=OpenFOAM
|
||||
|
||||
requirePV=1
|
||||
|
||||
# parse options
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
@ -110,10 +110,10 @@ do
|
||||
;;
|
||||
--)
|
||||
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: '$*'"
|
||||
@ -124,7 +124,7 @@ done
|
||||
# Get the ParaView major version to select the appropriate readers
|
||||
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 ]
|
||||
then
|
||||
cat<< BUILDREADER
|
||||
@ -140,7 +140,7 @@ BUILDREADER
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check for --data=... argument
|
||||
# Check for --data=... argument
|
||||
hasDataArg()
|
||||
{
|
||||
hasData=false
|
||||
@ -159,7 +159,7 @@ hasDataArg()
|
||||
hasDataArg $@
|
||||
|
||||
|
||||
# get a sensible caseName from the directory name
|
||||
# Get a sensible caseName from the directory name
|
||||
caseName=${PWD##*/}
|
||||
caseFile="$caseName.$extension"
|
||||
fvControls="system"
|
||||
@ -179,14 +179,14 @@ fi
|
||||
case "${optTouch:-false}" in
|
||||
all)
|
||||
extension=OpenFOAM
|
||||
if [ -f constant/polyMesh/blockMeshDict ]
|
||||
if [ -f system/blockMeshDict -o -f constant/polyMesh/blockMeshDict ]
|
||||
then
|
||||
touch "$caseName.blockMesh"
|
||||
echo "Created '$caseName.blockMesh'"
|
||||
fi
|
||||
touch "$caseName.$extension"
|
||||
echo "Created '$caseName.$extension'"
|
||||
# discover probable regions
|
||||
# Discover probable regions
|
||||
for region in constant/*
|
||||
do
|
||||
if [ -d $region -a -d $region/polyMesh ]
|
||||
@ -206,7 +206,7 @@ true)
|
||||
esac
|
||||
|
||||
|
||||
# parent directory for normal or parallel results
|
||||
# Parent directory for normal or parallel results
|
||||
case "$caseName" in
|
||||
processor*) parentDir=".." ;;
|
||||
*) parentDir="." ;;
|
||||
@ -216,18 +216,23 @@ esac
|
||||
if [ "${hasData:-false}" = true ]
|
||||
then
|
||||
|
||||
# has --data=.., send directly to paraview
|
||||
# Has --data=.., send directly to paraview
|
||||
exec paraview "$@"
|
||||
|
||||
else
|
||||
|
||||
# check existence of essential files
|
||||
# Check existence of essential files
|
||||
warn="WARN file does not exist:"
|
||||
case $extension in
|
||||
blockMesh)
|
||||
blockMeshDictDir=system/blockMeshDict
|
||||
if [ -f constant/polyMesh/blockMeshDict ]
|
||||
then
|
||||
blockMeshDictDir=constant/polyMesh/blockMeshDict
|
||||
fi
|
||||
for check in \
|
||||
system/controlDict \
|
||||
constant/polyMesh/blockMeshDict \
|
||||
$blockMeshDictDir \
|
||||
;
|
||||
do
|
||||
[ -s "$parentDir/$check" ] || {
|
||||
@ -262,7 +267,7 @@ else
|
||||
exit
|
||||
}
|
||||
|
||||
# only create/remove caseFile if it didn't already exist
|
||||
# Only create/remove caseFile if it didn't already exist
|
||||
[ -e $caseFile ] || {
|
||||
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
|
||||
touch "$caseFile"
|
||||
|
Loading…
Reference in New Issue
Block a user