• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisãoa06fe694ca95feda2bd31c7a8f52e353897fbe28 (tree)
Hora2009-04-23 01:45:58
Autoriselllo
Commiteriselllo

Mensagem de Log

I added a code to investigate numerically the condensation equation. The space-dependent part is
treated using a finite-difference scheme (central derivative) and the equation is translated into
a system of coupled ODE's.

Mudança Sumário

Diff

diff -r 3d61cd0fb648 -r a06fe694ca95 Python-codes/growth-semi-difference.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Python-codes/growth-semi-difference.py Wed Apr 22 16:45:58 2009 +0000
@@ -0,0 +1,83 @@
1+#! /usr/bin/env python
2+
3+import scipy as s
4+import numpy as n
5+import pylab as p
6+import scipy.integrate as si
7+
8+
9+def simple_coupling(y,t):
10+ coupling=s.zeros(len(y))
11+
12+ y_new=y/x_grid
13+
14+ coupling[1:-1]=y_new[2:]-y_new[:-2]
15+ coupling=-coupling*A/(2.*dx)
16+ return coupling
17+
18+A=0.00016358757687
19+
20+#fix grid in x (careful to avoid zero!)
21+
22+NN=2000
23+
24+x_grid=s.linspace(0.01,3.,NN)
25+print "x_grid is, ", x_grid
26+
27+dx=x_grid[2]-x_grid[1]
28+
29+print "dx is, ", dx
30+
31+#now create a constant initial state
32+
33+my_sel=s.where((x_grid>=0.4) & (x_grid<=0.5))
34+
35+# print "x_grid[my_sel] is, ", x_grid[my_sel]
36+
37+# y0=s.zeros(NN)
38+# y0[my_sel]=1000.
39+
40+y0=s.exp(-(x_grid-0.5)**2./0.02)
41+
42+print "y0 is, ", y0
43+
44+t=s.linspace(0.,3500., 60)
45+
46+print "t is, ", t
47+
48+# y = integrate.odeint(coupling_optim, y0, \
49+# t,printmessg=1,rtol=1e-10,atol=1e-10)
50+
51+
52+y = si.odeint(simple_coupling, y0, \
53+ t,printmessg=1, mxstep=600)
54+
55+#p.save("evolution_of_the_population.dat",y)
56+
57+print "y[20,:] is, ", y[20,:]
58+
59+fig = p.figure()
60+axes = fig.gca()
61+
62+# p.semilogx(dp,my_initial_state,"ro")
63+# p.semilogx(dp[selection],grown_state[selection],"kx")
64+p.plot(x_grid,y0,"ro")
65+p.plot(x_grid,y[(len(t)-1),:],"b")
66+
67+p.legend(("Initial state", "10 minutes"))
68+
69+
70+p.subplots_adjust(bottom=0.2)
71+
72+
73+
74+
75+p.xlabel(r'$d_p [\mu m]$', fontsize=20)
76+p.ylabel(r'$n(d_p,t)$', fontsize=20)
77+p.savefig("evolution_semi_difference.pdf")
78+
79+p.clf()
80+
81+
82+
83+print "So far so good"