Merge commit 'b5be6201e00421a59e574a07b3d28cde5defff84'
[foam-extend-4.0.git] / bin / foamGraphResUVWP
blobee170c6d13c43a4d668a3f070c24e030f7b0b9ab
1 #!/bin/csh -f
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | foam-extend: Open Source CFD
5 # \\ / O peration | Version: 4.0
6 # \\ / A nd | Web: http://www.foam-extend.org
7 # \\/ M anipulation | For copyright notice see file Copyright
8 #------------------------------------------------------------------------------
9 # License
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/>.
25 # Script
26 # foamGraphResUVWP
28 # Description
30 #------------------------------------------------------------------------------
32 set tmpU = newU$$.dat
33 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
35 set tmpV = newV$$.dat
36 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
38 set tmpW = newW$$.dat
39 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
41 set tmpP = newP$$.dat
42 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
44 set linesU = `cat $tmpU | wc -l`
45 set linesV = `cat $tmpV | wc -l`
46 set linesW = `cat $tmpW | wc -l`
47 set linesP = `cat $tmpP | wc -l`
49 set ngraphs = 0
51 if ($linesU > 1) then
52 @ ngraphs = $ngraphs + 1
53 endif
55 if ($linesV > 1) then
56 @ ngraphs = $ngraphs + 1
57 endif
59 if ($linesW > 1) then
60 @ ngraphs = $ngraphs + 1
61 endif
63 if ($linesP > 1) then
64 @ ngraphs = $ngraphs + 1
65 endif
67 cat << EOF > residualUVWP.dat
68 EOF
69 #Solver Performance
70 #number of iterations
71 #residual
72 #0 0
73 #0 0
74 #$ngraphs
75 #EOF
77 if ($linesU > 1) then
78 cat << EOF >> residualUVWP.dat
80 EOF
83 #$linesU
84 #EOF
85 cat $tmpU >> residualUVWP.dat
86 endif
88 if ($linesV > 1) then
89 cat << EOF >> residualUVWP.dat
91 EOF
94 #$linesV
95 #EOF
96 cat $tmpV >> residualUVWP.dat
97 endif
99 if ($linesW > 1) then
100 cat << EOF >> residualUVWP.dat
105 #$linesW
106 #EOF
107 cat $tmpW >> residualUVWP.dat
108 endif
110 if ($linesP > 1) then
111 cat << EOF >> residualUVWP.dat
116 #$linesP
117 #EOF
118 cat $tmpP >> residualUVWP.dat
119 endif
121 rm $tmpU
122 rm $tmpV
123 rm $tmpW
124 rm $tmpP
126 #------------------------------------------------------------------------------