Advertisement
Geometrian

M87* Calculations

Apr 10th, 2019
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. import math
  2. import matplotlib.pyplot as plt
  3. from mpmath import mp
  4.  
  5. mp.dps = 50
  6.  
  7.  
  8. #https://astronomy.stackexchange.com/questions/8413/what-is-the-temperature-of-an-accretion-disc-surrounding-a-supermassive-black-ho
  9.  
  10. G = 6.67408e-11 #m³ / kg s²
  11. c = 299792458.0 #m / s
  12. σ = 5.670367e-8 #W / m² K⁴
  13. π = math.pi
  14. k_B = 1.38064852e-23 #J / K
  15. h = 6.62607015e-34 #J s
  16.  
  17. def r_s(M):
  18.     return 2.0*G*M/(c*c)
  19.  
  20. def T(r,M,Mdot):
  21.     term1 = ( 3.0 * G * M * Mdot ) / ( 8.0 * π * σ * r*r*r )
  22.     term2 = 1.0 - math.sqrt( r_s(M) / r )
  23.     return (term1*term2)**0.25
  24.  
  25. def B(λ,T):
  26.     return 2.0*h*c*c / ( λ*λ*λ*λ*λ * ( mp.exp((h*c)/(λ*k_B*T)) - 1.0 ) )
  27.  
  28.  
  29.  
  30. #M87*
  31.  
  32. M = 7.22e9 * 1.98847e30 #7.22 billion solar masses
  33.  
  34. Mdot = 1.98847e30 / (10.0*86400.0*365.2524) #1 solar mass every ten years
  35.  
  36.  
  37.  
  38. def plot_T():
  39.     rf0 = 1.0
  40.     rf1 = 4.0
  41.  
  42.     rfs = []
  43.     dr = (rf1-rf0)*0.0001
  44.     rf = rf0
  45.     while rf <= rf1:
  46.         rfs.append(rf)
  47.         rf += dr
  48.  
  49.     Ts = [T(rf*r_s(M),M,Mdot) for rf in rfs]
  50.  
  51.     plt.plot(rfs,Ts)
  52.  
  53.     plt.xlabel("Schwarzschild Radii")
  54.     plt.ylabel("Temperature (K)")
  55.  
  56.     plt.title("Accretion Disk Temperature for M87*")
  57.  
  58.     plt.show()
  59.  
  60. def plot_bb():
  61.     T = 3.0e9
  62.  
  63.     λs = [ λfm for λfm in range(1,5000,1) ]
  64.     Bs = [ B(λfm*1.0e-15,T) for λfm in λs ]
  65.    
  66.     plt.plot(λs,Bs)
  67.  
  68.     plt.xlabel("λ (fm)")
  69.     plt.ylabel("Spectral Radiance")
  70.  
  71.     plt.title("Blackbody Radiation")
  72.  
  73.     plt.show()
  74.  
  75. plot_T()
  76. #plot_bb()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement