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 # Proccess a scalar, vetorial or tensorial field of OpenFOAM
30 # probe file (for monitoring points). The original file will not be changed
31 # and the fields of each monitoring point will be stored in a new
32 # directory named probe<Name> (where <Name> is the field name) in the
33 # directory where are the original probes files.
34 # The fourth optional parameter can be used to create xmgrace sequentially
36 # for monitoring points or automatically create eps figures (case is 1).
40 # Jovani L. Favero, J. F. Mitre (2009)
42 #------------------------------------------------------------------------------
45 echo "Usage: foamProbe [<probes files directory> <numbers of monitoring points> <field name> <optional value: 0 - open in xmgrace, 1 - save to eps file>]"
54 # Number of points, P.
69 if [ ! -d "$DNAME" ]; then
70 echo "Directory $DNAME does not exist."
75 echo "Can not be less than 1 single monitoring point."
81 if [ ! -f "$CNAME" ]; then
82 echo "Field $CNAME does not exist."
88 echo "Wait: Processing $P point(s) in $CNAME file ...."
90 # Base directory to place processed files
92 if [ ! -d "$DIR" ]; then
95 sed -e "s/ *(/\t/g" -e 's/)//g' "$CNAME" >"$DIR/$NAME"
98 while [ "$column" -le "$P" ]; do
100 column=`expr $column + 1`
101 cut
-f 1,$column "$NAME" |
sed -e "s/\t/ /g" -e '/^#/d' >$NAME.base
102 echo -e "# Time \t Point_$point" >$NAME\_
$point
103 cat $NAME.base
>>$NAME\_
$point
108 if [ "$xmgrace" = 1 ]; then
112 while [ "$field" -le "$P" ]; do
114 field
=`expr $field + 1`
115 echo " Opening file $CNAME$underscore$point"
116 if [ "$save" = 0 ]; then
117 echo " Opened $CNAME$underscore$point"
118 xmgrace
-nxy $CNAME\_
$point -noask
121 if [ "$save" -ne 0 ]; then
122 xmgrace
-nxy $CNAME\_
$point -hardcopy -printfile $CNAME\_
$point.eps
-hdevice EPS
123 echo " Saving file $CNAME$underscore$point.eps"
125 echo " Closing file $CNAME$underscore$point"