-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwind-parameters.py
97 lines (82 loc) · 2.4 KB
/
wind-parameters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 15:23:56 2022
@author: alankar
"""
import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
## useful constants
yr = 365*24*60**2
Myr = 1e6*yr
pi = np.pi
pc = 3.0856775807e18
kpc = 1e3*pc
Mpc = 1e3*kpc
s = 1
cm = 1
K = 1
km = 1e5*cm
mp = 1.67262192369e-24
kB = 1.3806505e-16
G = 6.6726e-8
H0 = 67.4
H0cgs = H0*((km/s)/Mpc)
dcrit0 = 3*H0cgs**2/(8.*pi*G)
MSun = 2.e33
X_solar = 0.7154
Y_solar = 0.2703
Z_solar = 0.0143
fracZ = 1.0
Xp = X_solar*(1-fracZ*Z_solar)/(X_solar+Y_solar)
Yp = Y_solar*(1-fracZ*Z_solar)/(X_solar+Y_solar)
Zp = fracZ*Z_solar
mu = 1./(2*Xp+0.75*Yp+0.5625*Zp)
mup = 1./(2*Xp+0.75*Yp+(9./16.)*Zp)
muHp = 1./Xp
mue = 2./(1+Xp)
mui = 1./(1/mu-1/mue)
# Program starts here
gamma = 5/3
alpha = 1.0
wind = np.loadtxt('./cc85/CC85_steady-prof_gamma_1.667.txt', skiprows=1)
mach = wind[:,3]/np.sqrt(gamma*wind[:,2]/wind[:,1])
rnorm = wind[:,0]
relpos = interp1d(mach, rnorm) #inverting the Mach relation
rhonorm = interp1d(rnorm, wind[:,1])
prsnorm = interp1d(rnorm, wind[:,2])
velnorm = interp1d(rnorm, wind[:,3])
LAMBDA = np.loadtxt('./cc85/cooltable.dat')
LAMBDA = interp1d(LAMBDA[:,0], LAMBDA[:,1], fill_value='extrapolate')
# Parameters
chi = 100
Mw = 1.5
tcoolmBytcc = 0.08
Tcl = 4e4 # K
RinibyRcl = 200
PinibykB = 1.0e+06 # Kcm^-3, degenerate
Tw = chi*Tcl
Pw = PinibykB*kB
rhow = (PinibykB/Tw)*(mu*mp)
vw = Mw*np.sqrt(gamma*kB*Tw/(mu*mp))
RinibyRinj = relpos(Mw)
rhoTini = rhonorm(RinibyRinj)
prsTini = prsnorm(RinibyRinj)
velTini = velnorm(RinibyRinj)
Rgo = 2 * (Tcl/1e4)**(5/2)*Mw/((PinibykB/1e3)*(LAMBDA(np.sqrt(chi)*Tcl)/10**-21.4) ) *(chi/100) * (alpha**-1) # pc
Rcl = (tcoolmBytcc**-1) * Rgo # pc
Rini = RinibyRcl*Rcl # pc
Rinj = Rini/RinibyRinj # pc
Mdot = ((Pw/prsTini)* (vw/velTini)**(-1) *(Rinj*pc)**2) / (MSun/yr)
Edot = ((Pw/prsTini) * (vw/velTini) *(Rinj*pc)**2) #erg s^-1
# Equivalent alternate expression
# Mdot = ((rhow/rhoTini)* (vw/velTini) *(Rinj*pc)**2) / (MSun/yr)
# Edot = ((rhow/rhoTini) * (vw/velTini)**3 *(Rinj*pc)**2) #erg s^-1
sanity = (rhow/rhoTini)/((Pw/prsTini)*(vw/velTini)**-2)
print('Mdot = %.2e MSun/yr'%Mdot)
print('Edot = %.2e erg/s'%Edot)
print('R_inj = %.2e pc'%(Rinj*pc/pc))
print('R_ini = %.2e pc'%(Rini*pc/pc))
print('R_cl = %.2e pc'%(Rcl*pc/pc))
print('R_go = %.2e pc'%Rgo)
print('T_cl = %.2e K'%Tcl)