2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
8 #-------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
29 # start paraview with the OpenFOAM libraries
32 # combining -block or -builtin options with the -region option yields
34 #------------------------------------------------------------------------------
37 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
40 Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION]
42 -block use blockMesh reader (uses .blockMesh extension)
43 -builtin use VTK builtin OpenFOAM reader (uses .foam extension)
44 -case <dir> specify alternative case directory, default is the cwd
45 -region <name> specify alternative mesh region
46 -touch only create the file (eg, .blockMesh, .OpenFOAM, etc)
47 -touchAll create .blockMesh, .OpenFOAM files (and for all regions)
51 paraview options start with a double dashes
53 * start paraview $ParaView_VERSION with the OpenFOAM libraries
59 # We want to do nice exit when running paraview to give paraview opportunity
63 unset regionName optTouch
84 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
85 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
89 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
103 break # stop here, treat balance as paraview options
106 break # stop here, treat this and balance as paraview options
109 usage
"unknown option/argument: '$*'"
116 # check for --data=... argument
136 # get a sensible caseName from the directory name
138 caseFile
="$caseName.$extension"
141 if [ -n "$regionName" ]
143 caseFile
="$caseName{$regionName}.$extension"
144 fvControls
="$fvControls/$regionName"
147 case "${optTouch:-false}" in
150 if [ -f constant
/polyMesh
/blockMeshDict
]
152 touch "$caseName.blockMesh"
153 echo "created '$caseName.blockMesh'"
155 touch "$caseName.$extension"
156 echo "created '$caseName.$extension'"
157 # discover probable regions
158 for region
in constant
/*
160 if [ -d $region -a -d $region/polyMesh
]
162 regionName
=${region##*/}
163 touch "$caseName{$regionName}.$extension"
164 echo "created '$caseName{$regionName}.$extension'"
171 echo "created '$caseFile'"
177 # parent directory for normal or parallel results
179 processor
*) parentDir
=".." ;;
184 if [ "${hasData:-false}" = true
]
187 # has --data=.., send directly to paraview
192 # check existence of essential files
193 warn
="WARN file does not exist:"
198 constant
/polyMesh
/blockMeshDict \
201 [ -s "$parentDir/$check" ] ||
{
202 [ -n "$warn" ] && echo "$warn" 1>&2
203 echo " $parentDir/$check" 1>&2
212 $fvControls/fvSchemes \
213 $fvControls/fvSolution \
216 [ -s "$parentDir/$check" ] ||
{
217 [ -n "$warn" ] && echo "$warn" 1>&2
218 echo " $parentDir/$check" 1>&2
225 # only create/remove caseFile if it didn't already exist
226 [ -e $caseFile ] ||
{
227 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
229 echo "created temporary '$caseFile'"
232 # For now filter out any ld.so errors. Caused by non-system compiler?
233 paraview
--data="$caseFile" "$@" 2>&1 | fgrep
-v 'Inconsistency detected by ld.so'
237 #------------------------------------------------------------------------------