3 forcesfilename
= 'forces/0/forces.dat'
7 print 'script assumes forces file ', forcesfilename
11 forceRegex
=r
"([0-9.Ee\-+]+)\s+\(+([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\)\s\(([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\s([0-9 .Ee\-+]+)\)+\s\(+([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\)\s\(([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\s([0-9.Ee\-+]+)\)+"
13 fpx
= []; fpy
= []; fpz
= []
14 fvx
= []; fvy
= []; fvz
= []
15 mpx
= []; mpy
= []; mpz
= []
16 mvx
= []; mvy
= []; mvz
= []
18 pipefile
=open(forcesfilename
,'r')
19 lines
= pipefile
.readlines()
22 match
=re
.search(forceRegex
,line
)
24 t
.append(float(match
.group(1)))
25 fpx
.append(float(match
.group(2)))
26 fpy
.append(float(match
.group(3)))
27 fpz
.append(float(match
.group(4)))
28 fvx
.append(float(match
.group(5)))
29 fvy
.append(float(match
.group(6)))
30 fvz
.append(float(match
.group(7)))
31 mpx
.append(float(match
.group(8)))
32 mpy
.append(float(match
.group(9)))
33 mpz
.append(float(match
.group(10)))
34 mvx
.append(float(match
.group(11)))
35 mvy
.append(float(match
.group(12)))
36 mvz
.append(float(match
.group(13)))
39 # combine pressure and viscous forces and moments
48 for i
in range(1,len(t
)):
58 pylab
.xlabel('iteration')
59 pylab
.ylabel('force (N)')
62 pylab
.plot(t
,fx
,'-',label
="fx")
63 pylab
.plot(t
,fy
,'-',label
="fy")
64 pylab
.plot(t
,fz
,'-',label
="fz")
66 #pylab.plot(t,mx,'-',label="mx")
67 #pylab.plot(t,my,'-',label="my")
68 #pylab.plot(t,mz,'-',label="mz")