diff options
author | Aaron LI <aly@aaronly.me> | 2017-12-30 20:23:02 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-12-30 20:23:02 +0800 |
commit | 07d2312bcea7971ff30229fa04d27c87dc1b297c (patch) | |
tree | 8c33610f915225f83348c52c27b141fc0cfc2525 /fg21sim | |
parent | b831796a7482e6545c303d8a8fbb60719fd4b807 (diff) | |
download | fg21sim-07d2312bcea7971ff30229fa04d27c87dc1b297c.tar.bz2 |
clusters/halo: Add virial_speed() helper function
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/extragalactic/clusters/helper.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fg21sim/extragalactic/clusters/helper.py b/fg21sim/extragalactic/clusters/helper.py index 10c4f12..e751bbe 100644 --- a/fg21sim/extragalactic/clusters/helper.py +++ b/fg21sim/extragalactic/clusters/helper.py @@ -297,6 +297,18 @@ def speed_sound(kT): return cs * AUC.cm2km # [km/s] +def velocity_virial(mass, z=0.0): + """ + Calculate the virial velocity, i.e., free-fall velocity. + + Unit: [km/s] + """ + R_vir = radius_virial(mass, z) * AUC.kpc2cm # [cm] + vv = np.sqrt(AC.G * mass*AUC.Msun2g / R_vir) # [cm/s] + vv /= AUC.km2cm # [km/s] + return vv + + def velocity_impact(M_main, M_sub, z=0.0): """ Estimate the relative impact velocity between the two merging @@ -354,8 +366,7 @@ def time_crossing(M_main, M_sub, z=0.0): """ R_vir = radius_virial(M_main, z) # [kpc] vi = velocity_impact(M_main, M_sub, z) # [km/s] - # Unit conversion coefficient: [s kpc/km] => [Gyr] - uconv = AUC.kpc2km * AUC.s2Gyr + uconv = AUC.kpc2km * AUC.s2Gyr # [s kpc/km] => [Gyr] time = uconv * R_vir / vi # [Gyr] return time |