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
59 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
60 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
64 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
77 usage
"unknown option/argument: '$*'"
82 # get a sensible caseName
85 if [ -n "$useNativeReader" ]
89 caseFileExt
=".OpenFOAM"
92 caseFile
="$caseName$caseFileExt"
96 if [ -n "$regionName" ]
98 caseFile
="$caseName{$regionName}$caseFileExt"
99 fvControls
="$fvControls/$regionName"
102 if [ -n "$touchOnly" ]
105 echo "created '$caseFile'"
109 # parent directory for normal or parallel results
111 processor
*) parentDir
=".." ;;
115 # check existence of essential files
116 for check
in system
/controlDict
$fvControls/fvSchemes
$fvControls/fvSolution
118 [ -s "$parentDir/$check" ] || usage
"file does not exist: '$parentDir/$check'"
122 case "$ParaView_VERSION" in
124 trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
127 # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
128 sed -e s@
%CASE
%@
$PWD/$caseFile@g \
129 $WM_PROJECT_DIR/bin
/tools
/paraFoam.pvs
> paraFoam.pvs
131 paraview paraFoam.pvs
135 # only create/remove caseFile if it didn't already exist
136 [ -e $caseFile ] ||
{
137 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
139 echo "created temporary '$caseFile'"
142 paraview
--data="$caseFile"
146 #------------------------------------------------------------------------------