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 kRegex
=r
"([A-Z,a-z]*):*.*Solving for k, Initial residual = ([0-9.Ee\-+]*), Final residual = ([0-9.Ee\-+]*), No Iterations ([0-9]*)"
14 omegaRegex
=r
"([A-Z,a-z]*):*.*Solving for omega, Initial residual = ([0-9.Ee\-+]*), Final residual = ([0-9.Ee\-+]*), No Iterations ([0-9]*)"
15 epsilonRegex
=r
"([A-Z,a-z]*):*.*Solving for epsilon, Initial residual = ([0-9.Ee\-+]*), Final residual = ([0-9.Ee\-+]*), No Iterations ([0-9]*)"
36 #HJ take name of log file as script argument
37 pipefile
=open(logfilename
,'r')
38 lines
= pipefile
.readlines()
41 matchUp
=re
.search(UpRegex
,line
)
45 Ux
.append(float(matchUp
.group(2)))
46 Uy
.append(float(matchUp
.group(3)))
47 Uz
.append(float(matchUp
.group(4)))
48 p
.append(float(matchUp
.group(5)))
49 matchk
=re
.search(kRegex
,line
)
53 k
.append(float(matchk
.group(2)))
54 matchomega
=re
.search(omegaRegex
,line
)
58 omega
.append(float(matchomega
.group(2)))
59 matchepsilon
=re
.search(epsilonRegex
,line
)
61 iepsilon
= iepsilon
+ 1
62 tepsilon
.append(iepsilon
)
63 epsilon
.append(float(matchepsilon
.group(2)))
65 outfile
=open('residual.dat','w')
67 #HJ need better way of combining lists
69 for index
in range(0,iomega
):
70 outfile
.write(str(tUp
[index
])+' '+str(Ux
[index
])+' '+str(Uy
[index
])+' '+str(Uz
[index
])+' '+str(p
[index
])+' '+str(k
[index
])+' '+str(omega
[index
])+'\n')
72 for index
in range(0,iepsilon
):
73 outfile
.write(str(tUp
[index
])+' '+str(Ux
[index
])+' '+str(Uy
[index
])+' '+str(Uz
[index
])+' '+str(p
[index
])+' '+str(k
[index
])+' '+str(epsilon
[index
])+'\n')
75 for index
in range(0,iUp
):
76 outfile
.write(str(tUp
[index
])+' '+str(Ux
[index
])+' '+str(Uy
[index
])+' '+str(Uz
[index
])+' '+str(p
[index
])+'\n')
82 pylab
.xlabel('iteration')
83 pylab
.ylabel('residual')
88 pylab
.semilogy(tUp
,Ux
,'-',label
="Ux")
89 pylab
.semilogy(tUp
,Uy
,'-',label
="Uy")
90 pylab
.semilogy(tUp
,Uz
,'-',label
="Uz")
91 pylab
.semilogy(tUp
,p
,'-',label
="p")
94 pylab
.semilogy(tk
,k
,'-',label
="k")
97 pylab
.semilogy(tomega
,omega
,'-',label
="omega")
100 pylab
.semilogy(tepsilon
,epsilon
,'-',label
="epsilon")