5 print 'script requires name of log file'
8 logfilename
= sys
.argv
[1]
9 print 'Reading file', logfilename
12 UpRegex
=r
"([A-Z,a-z]*):*.*Solving for Up, Initial residual = \(([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\), Final residual = \(([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\), No Iterations ([0-9]*)"
13 komegaRegex
=r
"([A-Z,a-z]*):*.*Solving for kOmega, Initial residual = \(([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\), Final residual = \(([0-9.Ee\-+]*)\s([0-9.Ee\-+]*)\), No Iterations ([0-9]*)"
27 #HJ take name of log file as script argument
28 pipefile
=open(logfilename
,'r')
29 lines
= pipefile
.readlines()
32 matchUp
=re
.search(UpRegex
,line
)
36 Ux
.append(float(matchUp
.group(2)))
37 Uy
.append(float(matchUp
.group(3)))
38 Uz
.append(float(matchUp
.group(4)))
39 p
.append(float(matchUp
.group(5)))
40 matchkomega
=re
.search(komegaRegex
,line
)
43 tkomega
.append(ikomega
)
44 k
.append(float(matchkomega
.group(2)))
45 omega
.append(float(matchkomega
.group(3)))
47 outfile
=open('residual.dat','w')
49 print 'hits = ', ikomega
51 #HJ need better way of combining lists
53 for index
in range(0,ikomega
):
54 outfile
.write(str(tUp
[index
])+' '+str(Ux
[index
])+' '+str(Uy
[index
])+' '+str(Uz
[index
])+' '+str(p
[index
])+' '+str(k
[index
])+' '+str(omega
[index
])+'\n')
56 for index
in range(0,iUp
):
57 outfile
.write(str(tUp
[index
])+' '+str(Ux
[index
])+' '+str(Uy
[index
])+' '+str(Uz
[index
])+' '+str(p
[index
])+'\n')
63 pylab
.xlabel('iteration')
64 pylab
.ylabel('residual')
69 pylab
.semilogy(tUp
,Ux
,'-',label
="Ux")
70 pylab
.semilogy(tUp
,Uy
,'-',label
="Uy")
71 pylab
.semilogy(tUp
,Uz
,'-',label
="Uz")
72 pylab
.semilogy(tUp
,p
,'-',label
="p")
75 pylab
.semilogy(tkomega
,k
,'-',label
="k")
76 pylab
.semilogy(tkomega
,omega
,'-',label
="omega")