2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright held by original author
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 the
14 # Free Software Foundation; either version 3 of the License, or (at your
15 # 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, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 # Proccess a scalar, vetorial or tensorial field of OpenFOAM
31 # probe file (for monitoring points). The original file will not be changed
32 # and the fields of each monitoring point will be stored in a new
33 # directory named probe<Name> (where <Name> is the field name) in the
34 # directory where are the original probes files.
35 # The fourth optional parameter can be used to create xmgrace sequentially
37 # for monitoring points or automatically create eps figures (case is 1).
41 # Jovani L. Favero, J. F. Mitre (2009)
43 #------------------------------------------------------------------------------
46 echo "Usage: foamProbe [<probes files directory> <numbers of monitoring points> <field name> <optional value: 0 - open in xmgrace, 1 - save to eps file>]"
55 # Number of points, P.
70 if [ ! -d "$DNAME" ]; then
71 echo "Directory $DNAME does not exist."
76 echo "Can not be less than 1 single monitoring point."
82 if [ ! -f "$CNAME" ]; then
83 echo "Field $CNAME does not exist."
89 echo "Wait: Processing $P point(s) in $CNAME file ...."
91 # Base directory to place processed files
93 if [ ! -d "$DIR" ]; then
96 sed -e "s/ *(/\t/g" -e 's/)//g' "$CNAME" >"$DIR/$NAME"
99 while [ "$column" -le "$P" ]; do
101 column=`expr $column + 1`
102 cut
-f 1,$column "$NAME" |
sed -e "s/\t/ /g" -e '/^#/d' >$NAME.base
103 echo -e "# Time \t Point_$point" >$NAME\_
$point
104 cat $NAME.base
>>$NAME\_
$point
109 if [ "$xmgrace" = 1 ]; then
113 while [ "$field" -le "$P" ]; do
115 field
=`expr $field + 1`
116 echo " Opening file $CNAME$underscore$point"
117 if [ "$save" = 0 ]; then
118 echo " Opened $CNAME$underscore$point"
119 xmgrace
-nxy $CNAME\_
$point -noask
122 if [ "$save" -ne 0 ]; then
123 xmgrace
-nxy $CNAME\_
$point -hardcopy -printfile $CNAME\_
$point.eps
-hdevice EPS
124 echo " Saving file $CNAME$underscore$point.eps"
126 echo " Closing file $CNAME$underscore$point"