2 #------------------------------------------------------------------------------
4 # \\ / F ield | foam-extend: Open Source CFD
6 # \\ / A nd | For copyright notice see file Copyright
8 #------------------------------------------------------------------------------
10 # This file is part of foam-extend.
12 # foam-extend is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation, either version 3 of the License, or (at your
15 # option) any later version.
17 # foam-extend is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
29 # start paraview with the OpenFOAM libraries
31 #------------------------------------------------------------------------------
33 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
36 usage: ${0##*/} [OPTION]
38 -case dir specify alternative case directory
39 -region name specify mesh region name
40 -touch only create the .OpenFOAM or .foam file
41 -nativeReader use the paraview native reader for OpenFOAM
43 * start paraview $ParaView_VERSION with the OpenFOAM libraries
49 unset regionName touchOnly useNativeReader
51 # This is needed for systems that are using comma as the decimal separator
62 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
63 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
67 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
80 usage
"unknown option/argument: '$*'"
85 # get a sensible caseName
88 if [ -n "$useNativeReader" ]
92 caseFileExt
=".OpenFOAM"
95 caseFile
="$caseName$caseFileExt"
99 if [ -n "$regionName" ]
101 caseFile
="$caseName{$regionName}$caseFileExt"
102 fvControls
="$fvControls/$regionName"
105 if [ -n "$touchOnly" ]
108 echo "created '$caseFile'"
112 # parent directory for normal or parallel results
114 processor
*) parentDir
=".." ;;
118 # check existence of essential files
119 for check
in system
/controlDict
$fvControls/fvSchemes
$fvControls/fvSolution
121 [ -s "$parentDir/$check" ] || usage
"file does not exist: '$parentDir/$check'"
125 case "$ParaView_VERSION" in
127 trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
130 # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
131 sed -e s@
%CASE
%@
$PWD/$caseFile@g \
132 $WM_PROJECT_DIR/bin
/tools
/paraFoam.pvs
> paraFoam.pvs
134 paraview paraFoam.pvs
138 # only create/remove caseFile if it didn't already exist
139 [ -e $caseFile ] ||
{
140 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
142 echo "created temporary '$caseFile'"
145 paraview
--data="$caseFile"
149 #------------------------------------------------------------------------------