Rev. | 1d1ed12bad090edd5f47c0228b16921329292842 |
---|---|
Größe | 863 Bytes |
Zeit | 2007-05-29 21:39:58 |
Autor | iselllo |
Log Message | I added the file Python-codes/self_similarity.py. This simple code
|
#! /usr/bin/env python
from scipy import *
import pylab # used to read the .csv file
#from scipy.special import * # to be able to use the error function
def self_similar(y, t):
return -myconst*y**2.
t = arange(0,4.0, 0.01)
y0 = 1.55e14 # initial total number concentration
a=0.9046
b=1.248
mu=2e-5
k_B=1.38e-23
T=400.
rho_p=1300.
myconst=2.*k_B*T/(3.*mu)*(1.+a*b)
print 'myconst is',myconst
y = integrate.odeint(self_similar, y0, t,printmessg=1)
print 'solution is', y
pylab.plot(t,y[:,0])
pylab.xlabel('Time')
pylab.ylabel('Total Number Concentration')
pylab.title('Self-Similar Evolution Number Concentration')
pylab.grid(True)
pylab.savefig('self_similar_number_concentration_cont_kernel')
pylab.hold(False)
results=zeros((len(t),2))
results[:,0]=t
results[:,1]=y[:,0]
pylab.save("self_similar_pop.txt",results)
print 'So far so good'