修订版 | 74c66bd615992ab78b2f0d66fa170824b0d86a75 (tree) |
---|---|
时间 | 2007-03-10 00:14:57 |
作者 | iselllo |
Commiter | iselllo |
I added the code postprocess2.py, which is able to work out the average
axial velocity along the whole tube as a function of r (radial
coordinate) on a single snapshot of the velocity field.
@@ -0,0 +1,50 @@ | ||
1 | +#! /usr/bin/env python | |
2 | +from scipy import * | |
3 | +import pylab # used to read the .csv file | |
4 | + | |
5 | +q3arr=pylab.load("vpro001") # loading | |
6 | + | |
7 | +print 'the dimension of q3arr is', shape(q3arr) | |
8 | + | |
9 | +n1=65 # theta grid | |
10 | +n2=65 # r grid | |
11 | +n3=49 # z grid | |
12 | + | |
13 | +my_mean=zeros(n2) | |
14 | + | |
15 | +q3arr=reshape(q3arr,[n1,n2,n3]) | |
16 | +print 'the new dimension of q3arr is', shape(q3arr) | |
17 | + | |
18 | +print 'now a print of the array content', q3arr[14,:,12] | |
19 | + | |
20 | +z_pos=25 # I fix a certain position along z | |
21 | + | |
22 | + | |
23 | + | |
24 | +for i in range(1,n1): | |
25 | + for k in range(1,n3): | |
26 | + #my_mean[:]= q3arr[i,:,z_pos]+my_mean[:] | |
27 | + # what is above corresponds to the mean radial profile along z for a certain snapshot of the velocity field | |
28 | + my_mean[:]= q3arr[i,:,k]+my_mean[:] | |
29 | +# now this corresponds to the mean z velocity for a certain snapshot | |
30 | +#my_mean=my_mean/float(n1) | |
31 | +my_mean=my_mean/float(n1*n3) | |
32 | + | |
33 | +print "my_mean is", my_mean # this is the mean v_z(r) averaged on the cross section for a single velocity profile for a certain specific z coordinate and a single snapshot of the velocity. | |
34 | +print 'the dimension of my_mean is', shape(my_mean) | |
35 | + | |
36 | + | |
37 | +data = pylab.load("radstr.out") | |
38 | + | |
39 | + | |
40 | + | |
41 | +pylab.plot(data[:,0],my_mean) | |
42 | +pylab.xlabel('Radial Coordinate') | |
43 | +pylab.ylabel('Physical Coordinate') | |
44 | +pylab.title('Radial Grid') | |
45 | +pylab.grid(True) | |
46 | +pylab.savefig('Average_v_z(r)_on_snapshot') | |
47 | + | |
48 | + | |
49 | + | |
50 | +print 'So far so good' | |
\ No newline at end of file |