Revision | cd60708cc67ba974922993fe1e74d3c4dd5dd051 (tree) |
---|---|
Zeit | 2007-12-04 21:34:22 |
Autor | iselllo |
Commiter | iselllo |
I added test-section2.py, basically the same as test-section.py but it
also shows how to read files from the output of the DNS code.
@@ -0,0 +1,54 @@ | ||
1 | +#! /usr/bin/env python | |
2 | +from scipy import * | |
3 | +import pylab | |
4 | + | |
5 | +nt=129 | |
6 | +nr=88 | |
7 | +nz=129 | |
8 | +read3d=0 | |
9 | + | |
10 | +if (read3d!=0): | |
11 | + vel3d=pylab.load("vsection") | |
12 | + print 'the shape of vel3d is', shape(vel3d) | |
13 | + vel3d=vel3d.reshape(nt,nr,nz) | |
14 | + vel_section=vel3d[:,:,65] | |
15 | + pylab.save("vel_cross_section",vel_section) | |
16 | + | |
17 | +elif (read3d==0): | |
18 | + vel_section=pylab.load("vel_cross_section") | |
19 | + | |
20 | +rg2=pylab.load("rg2.out") | |
21 | +r=rg2[:,0] | |
22 | + | |
23 | + | |
24 | +theta=linspace(0.,2.*pi,nt) | |
25 | +#print "theta is ", theta | |
26 | +sin_t=sin(theta) | |
27 | +cos_t=cos(theta) | |
28 | +rsin_t=r[newaxis,:]*sin_t[:,newaxis] | |
29 | +rcos_t=r[newaxis,:]*cos_t[:,newaxis] | |
30 | +rsin_t=ravel(rsin_t) | |
31 | +rcos_t=ravel(rcos_t) | |
32 | + | |
33 | +rsin_t.shape=(nt,nr) | |
34 | +rcos_t.shape=(nt,nr) | |
35 | + | |
36 | + | |
37 | +#pylab.colorbar() | |
38 | +#pylab.clf() | |
39 | +pylab.figure() | |
40 | +X = rsin_t.transpose() | |
41 | +Y = rcos_t.transpose() | |
42 | +Z = vel_section.transpose() | |
43 | +velmin = vel_section.min() | |
44 | +velmax = vel_section.max() | |
45 | +print velmin, velmax | |
46 | +levels = arange(velmin, velmax+0.01, 0.01) | |
47 | +pylab.contourf(X, Y, Z, levels, cmap=pylab.cm.jet) | |
48 | +pylab.colorbar() | |
49 | + | |
50 | +#pylab.show() | |
51 | + | |
52 | +pylab.savefig("velocity_on_section_DNS.png") | |
53 | +#pylab.hold(False) | |
54 | + |