Advertisement
gronke

Lazzati 4

Jun 7th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pylab
  2. import math
  3.  
  4. #mass of hydrogen and carbon
  5. mH = 1.67e-24
  6. mC = 12*mH
  7.  
  8. #constants
  9. r0 = int(1e16)
  10. p0 = 1.7e-14
  11. T0 = 1e8
  12. k =  1.38e-16
  13. r = 10**pylab.arange(15,20,0.01)
  14. P = (p0*(r/r0)**(-3))
  15. nH = P/(mH*(1 + (10**(-3.4))*mC))
  16. nC = 10**(-3.4)*nH
  17.  
  18. #define temperature
  19. T = pylab.zeros(r.size);
  20. T[0] = T0
  21. for i in range(1,r.size):
  22.     T[i] = T[i-1]*(1 + (2./3)*((P[i]-P[i-1])/(P[i-1])))
  23.  
  24. #define equilbrium density
  25. Ns = pylab.zeros(r.size);
  26. for i in range(1,r.size):
  27.         Ns[i] = ((6.9e13)*math.exp(-844282/T[i]))/(k*T[i])
  28.  
  29. #define saturation
  30. S = nC/Ns
  31.  
  32. #plotting
  33. pylab.figure(1)
  34. pylab.title('Saturation versus Radius', fontsize=12)
  35. pylab.xlabel('Radius (cm)')
  36. pylab.ylabel('Saturation (cm^-3)')
  37. pylab.loglog(r,S)
  38. pylab.xlim((1e16,1e17))
  39. pylab.ylim((0,10))
  40. pylab.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement