• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision08a73f562b8ef9ea912481f8cc3ed6658967ca6a (tree)
Zeit2007-03-07 19:57:33
Autoriselllo
Commiteriselllo

Log Message

I modified the code Python-codes/postprocess.py by adding some extra
functionalities to read & postprocess the output of the DNS simulations.

Ändern Zusammenfassung

Diff

diff -r 896c4a6f209d -r 08a73f562b8e Python-codes/postprocess.py
--- a/Python-codes/postprocess.py Mon Mar 05 17:55:03 2007 +0000
+++ b/Python-codes/postprocess.py Wed Mar 07 10:57:33 2007 +0000
@@ -2,13 +2,13 @@
22 from scipy import *
33 import pylab # used to read the .csv file
44
5-from pylab import *
5+#from pylab import *
66
77 # now I want to try reading some .csv file
88 data = pylab.load("radjet.out")
99 #print "data now is", data
1010
11-hold(False) # so that the plots are NOT superimposed
11+pylab.hold(False) # so that the plots are NOT superimposed
1212
1313 skip_this=0
1414 if (skip_this !=1):
@@ -25,15 +25,14 @@
2525
2626
2727 x=linspace(0.,1.,len(data[:,0]))
28-print 'the length of data[:,0] is', len(data[:,0])
29-print 'the length of x is', len(x)
28+
3029
3130
3231 rext=5.
3332 strr=3.5 # stretching parameter
3433 istr_0=tanh(x*strr)/tanh(strr)*rext
3534
36-print 'istr_0 is', istr_0
35+#print 'istr_0 is', istr_0
3736
3837 print 'the length of istr_0 is', len(istr_0)
3938
@@ -47,13 +46,7 @@
4746 pylab.savefig('radial_physical_grid_istrr=0')
4847 #pylab.show() # uncomment them to plot a distribution
4948
50-#s = file( './field0160.dat','rb' ).read( )
5149
52-#newarr = fromstring(s ,Float)
53-
54-#print 'newarr is', newarr
55-
56-#print 'the dimensions of newarr are', shape(newarr)
5750
5851 data2 = pylab.load("rg2.out")
5952
@@ -65,7 +58,7 @@
6558
6659 pylab.plot(seq2,data2[:,0],seq2,data2[:,1],seq2,data2[:,2],seq2,data2[:,3],linewidth=2.0)
6760 #hold(True) # now I want to overlap the plots
68-legend(('rc','rm','g2rc','g2rm'))
61+pylab.legend(('rc','rm','g2rc','g2rm'))
6962 pylab.xlabel('grid point number')
7063 pylab.ylabel('physical coordinate')
7164 #pylab.title('Radial Grid ISTR=0')
@@ -89,7 +82,7 @@
8982
9083 pylab.plot(seq2,data2[:,0],seq2,data2[:,1],seq2,data2[:,2],linewidth=2.0)
9184 #hold(True) # now I want to overlap the plots
92-legend(('x2','yd','rc'))
85+pylab.legend(('x2','yd','rc'))
9386 pylab.xlabel('grid point number')
9487 pylab.ylabel('physical coordinate')
9588 #pylab.title('Radial Grid ISTR=0')
@@ -98,3 +91,103 @@
9891 #pylab.plot(seq2,data2[:,2])
9992 #pylab.plot(seq2,data2[:,3])
10093 pylab.savefig('radstrout_plot')
94+
95+
96+# now I try reading the binary file
97+
98+#s = file( './field0160.dat','rb' ).read( )
99+
100+#newarr = fromstring(s ,Float)
101+
102+#print 'newarr is', newarr
103+
104+#print 'the dimensions of newarr are', shape(newarr)
105+
106+#lenarr=len(newarr)
107+#print max(newarr)
108+
109+pylab.hold(False)
110+
111+v_prof = pylab.load("v_prof")
112+
113+pylab.plot(data2[:,2],v_prof)
114+pylab.xlabel('radial distance from axis')
115+pylab.ylabel('Velocity profile')
116+pylab.grid(True)
117+pylab.savefig('velocity_profile')
118+
119+
120+
121+my_mean=zeros(len(data2[:,0]))
122+
123+
124+pylab.hold(True) # s e t t h e ho ld s t a t e t o be on
125+for i in range (1,20 ) : # s t a r t a t 1 , end a t 100
126+ fname = 'vpro%03d'%i # %03d pads t h e i n t e g e r s wi th z e r o s
127+ new_v_prof = pylab.load(fname)
128+ pylab.plot(data2[:,2],new_v_prof,linewidth=1.5)
129+ pylab.xlabel('radial distance from axis')
130+ pylab.ylabel('Velocity profile')
131+ pylab.grid(True)
132+new_v_prof = pylab.load('vpro001')
133+pylab.plot(data2[:,2],new_v_prof,linewidth=1.5)
134+pylab.savefig('velocity_profile_different_times')
135+#pylab.show()
136+
137+pylab.hold(False)
138+
139+ini_read=15
140+end_read=20
141+
142+#hold(True) # s e t t h e ho ld s t a t e t o be on
143+for i in range (ini_read,(end_read+1) ) : # s t a r t a t 1 , end a t 100
144+ #print 'i is', i
145+ fname = 'vpro%03d'%i # %03d pads t h e i n t e g e r s wi th z e r o s
146+ new_v_prof = pylab.load(fname)
147+ my_mean=my_mean+new_v_prof
148+ pylab.plot(data2[:,2],new_v_prof,linewidth=1.5)
149+ pylab.hold(True)
150+ pylab.xlabel('radial distance from axis')
151+ pylab.ylabel('Velocity profile')
152+ pylab.grid(True)
153+
154+my_mean=my_mean/(end_read-ini_read+1)
155+#print 'mymat[] is', mymat[:,1]
156+
157+ini_v_prof = pylab.load('vpro001')
158+pylab.plot(data2[:,2],ini_v_prof,linewidth=1.5)
159+
160+
161+
162+
163+
164+
165+pylab.legend(('t=150','t=160','t=170','t=180','t=190','t=200','initial profile'))
166+pylab.savefig('velocity_profile_late_times')
167+#pylab.show()
168+
169+pylab.hold(False)
170+
171+
172+pylab.plot(data2[:,2],my_mean,data2[:,2],ini_v_prof,linewidth=1.5,)
173+pylab.legend(('average profile at late t','initial profile'))
174+pylab.savefig('late-average-vs-initial')
175+
176+# now I also try plotting the initial profile I would get using an empirical correlation
177+
178+def v_appr(r):
179+ return U*(1-r/R)**(1./6.)
180+
181+U=my_mean[0]
182+R=1.
183+v_emp=map(v_appr,data2[:,2])
184+pylab.hold(False)
185+
186+pylab.plot(data2[:,2],my_mean,data2[:,2],v_emp,linewidth=1.5,)
187+pylab.legend(('average profile at late t','empirical_profile'))
188+pylab.grid(True)
189+pylab.xlabel('radial distance from axis')
190+pylab.ylabel('Velocity profile')
191+pylab.savefig('late-average-vs-empirical')
192+
193+print 'So far so good'
\ No newline at end of file