mirror of
https://github.com/glatterf42/sims_python_files.git
synced 2024-09-10 05:43:46 +02:00
Added small script to estimate relative PBH velocity from halo mass
This commit is contained in:
parent
a54dd9279d
commit
373ddd7151
2 changed files with 29 additions and 1 deletions
28
estimate_relative_pbh_velocity_from_halo_mass.py
Normal file
28
estimate_relative_pbh_velocity_from_halo_mass.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import numpy as np
|
||||
|
||||
G = 42.981 #everything here is in Gadget-units
|
||||
|
||||
def v_halo_from_mass(m_halo:int, L_box: float, N_res:int, m_particle:float):
|
||||
|
||||
m_box = N_res**3 * m_particle
|
||||
|
||||
rho_mean = m_box / (L_box ** 3)
|
||||
rho_halo = 200 * rho_mean
|
||||
|
||||
r_halo = (3 * m_halo / (4 * np.pi * rho_halo)) ** (1/3)
|
||||
|
||||
v_halo = np.sqrt(G * m_halo / r_halo)
|
||||
|
||||
return v_halo
|
||||
|
||||
v_result = v_halo_from_mass(m_halo=0.000067742, L_box=30.0, N_res=128, m_particle=0.1107263)
|
||||
|
||||
print(v_result)
|
||||
|
||||
|
||||
# #Results:
|
||||
# 11.75 for 0.067742 * 10^10 / h
|
||||
# 6.21 for 0.01 ...
|
||||
# 2.88 for 0.001 ...
|
||||
# 1.17 for 0.000067742 ... (i.e. 10^6 M_sun halos, i.e. three orders of magnitude smaller than the 10^9 we started with)
|
||||
|
|
@ -31,7 +31,7 @@ def downscale_IDs(particle_ID: int, Nres_max: int, Nres_min: int):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_particle = np.array([0, 0, 127])
|
||||
test_particle = np.array([1, 1, 0])
|
||||
# maximum_test = np.array([127, 127, 127]) #this works, Nres - 1 is the maximum for (i,j,k)
|
||||
|
||||
Nres_1 = 128
|
||||
|
|
Loading…
Reference in a new issue