Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / bin / foamGraphResUVWP
blob5a2b895d7f0990ffdf028f69f849392c31f7c1e9
1 #!/bin/csh -f
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 2004-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 # foamGraphResUVWP
28 # Description
30 #------------------------------------------------------------------------------
31 if (! -f "$1" ) then
32 echo "No file: '$1'"
33 exit 1
34 endif
36 set tmpU = newU$$.dat
37 cat $1 | grep "Solving for Ux" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpU
39 set tmpV = newV$$.dat
40 cat $1 | grep "Solving for Uy" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpV
42 set tmpW = newW$$.dat
43 cat $1 | grep "Solving for Uz" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpW
45 set tmpP = newP$$.dat
46 cat $1 | grep "Solving for p" | grep -v "solution singularity" | sed s/,//g | awk 'BEGIN { NENTRIES = 0 }{NENTRIES++; printf("%d %e\n", NENTRIES, $8)}' - > $tmpP
48 set linesU = `cat $tmpU | wc -l`
49 set linesV = `cat $tmpV | wc -l`
50 set linesW = `cat $tmpW | wc -l`
51 set linesP = `cat $tmpP | wc -l`
53 set ngraphs = 0
55 if ($linesU > 1) then
56 @ ngraphs = $ngraphs + 1
57 endif
59 if ($linesV > 1) then
60 @ ngraphs = $ngraphs + 1
61 endif
63 if ($linesW > 1) then
64 @ ngraphs = $ngraphs + 1
65 endif
67 if ($linesP > 1) then
68 @ ngraphs = $ngraphs + 1
69 endif
71 cat << EOF > residualUVWP.dat
72 EOF
73 #Solver Performance
74 #number of iterations
75 #residual
76 #0 0
77 #0 0
78 #$ngraphs
79 #EOF
81 if ($linesU > 1) then
82 cat << EOF >> residualUVWP.dat
84 EOF
87 #$linesU
88 #EOF
89 cat $tmpU >> residualUVWP.dat
90 endif
92 if ($linesV > 1) then
93 cat << EOF >> residualUVWP.dat
95 EOF
98 #$linesV
99 #EOF
100 cat $tmpV >> residualUVWP.dat
101 endif
103 if ($linesW > 1) then
104 cat << EOF >> residualUVWP.dat
109 #$linesW
110 #EOF
111 cat $tmpW >> residualUVWP.dat
112 endif
114 if ($linesP > 1) then
115 cat << EOF >> residualUVWP.dat
120 #$linesP
121 #EOF
122 cat $tmpP >> residualUVWP.dat
123 endif
125 rm $tmpU
126 rm $tmpV
127 rm $tmpW
128 rm $tmpP
130 #------------------------------------------------------------------------------