twoPhaseEulerFoam:frictionalStressModel/Schaeffer: Correct mut on processor boundaries
[OpenFOAM-1.7.x.git] / bin / paraFoam
blobb9ac61f80c28858be336c5047bf38997926dd03e
1 #!/bin/sh
2 #---------------------------------*- sh -*-------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #------------------------------------------------------------------------------
9 # License
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
20 # for more details.
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/>.
25 # Script
26 # paraFoam
28 # Description
29 # start paraview with the OpenFOAM libraries
31 #------------------------------------------------------------------------------
32 usage() {
33 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
34 cat<<USAGE
36 usage: ${0##*/} [OPTION]
37 options:
38 -case dir specify alternative case directory
39 -region name specify mesh region name
40 -touch only create the .OpenFOAM file
42 * start paraview $ParaView_VERSION with the OpenFOAM libraries
44 USAGE
45 exit 1
48 unset regionName touchOnly
50 # We want to do nice exit when running paraview to give paraview opportunity
51 # to clean up
52 unset FOAM_ABORT
55 # Hack: change all locale to 'C' i.e. using '.' for decimal point. This is
56 # only needed temporarily until paraview is locale aware. (git version is
57 # already 2010-07)
58 export LC_ALL=C
61 # parse options
62 while [ "$#" -gt 0 ]
64 case "$1" in
65 -h | -help)
66 usage
68 -case)
69 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
70 cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
71 shift 2
73 -region)
74 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
75 regionName=$2
76 shift 2
78 -touch)
79 touchOnly=true
80 shift
83 usage "unknown option/argument: '$*'"
85 esac
86 done
88 # get a sensible caseName
89 caseName=${PWD##*/}
90 caseFile="$caseName.OpenFOAM"
91 fvControls="system"
93 if [ -n "$regionName" ]
94 then
95 caseFile="$caseName{$regionName}.OpenFOAM"
96 fvControls="$fvControls/$regionName"
99 if [ -n "$touchOnly" ]
100 then
101 touch "$caseFile"
102 echo "created '$caseFile'"
103 exit 0
106 # parent directory for normal or parallel results
107 case "$caseName" in
108 processor*) parentDir=".." ;;
109 *) parentDir="." ;;
110 esac
112 # check existence of essential files
113 for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
115 [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
116 done
119 case "$ParaView_VERSION" in
121 trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
122 touch "$caseFile"
124 # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
125 sed -e s@%CASE%@$PWD/$caseFile@g \
126 $WM_PROJECT_DIR/bin/tools/paraFoam.pvs > paraFoam.pvs
128 paraview paraFoam.pvs
132 # only create/remove caseFile if it didn't already exist
133 [ -e $caseFile ] || {
134 trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
135 touch "$caseFile"
136 echo "created temporary '$caseFile'"
139 paraview --data="$caseFile"
142 esac
143 #------------------------------------------------------------------------------