From 02d9e049e4202e40468f9a341bc34fbc08a9632f Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 21 Feb 2019 22:19:50 +0800 Subject: clusters/halo: Extend tau_acceleration() against base turbulence Add new parameter 'is_end' to this method. If it is True, then calculate the acceleration timescale using velocity_turb_base(), i.e., the situation without active merger-induced turbulence. --- fg21sim/extragalactic/clusters/halo.py | 42 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'fg21sim/extragalactic/clusters') diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 3c4ecd6..64d2321 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -382,7 +382,7 @@ class RadioHalo1M: return np.sqrt(v2_turb) @lru_cache() - def tau_acceleration(self, t_merger): + def tau_acceleration(self, t, is_end=False): """ Calculate the electron acceleration timescale due to turbulent waves, which describes the turbulent acceleration efficiency. @@ -419,22 +419,44 @@ class RadioHalo1M: ---------- * Ref.[pinzke2017],Eq.(37) * Ref.[miniati2015],Eq.(29) + + Parameters + ---------- + t : float + The beginning time or ending time (if ``is_end=True``) of the merger. + Unit: [Gyr] + is_end : bool, optional + Whether the given time ``t`` is the ending time of the merger. + Default: False + + Returns + ------- + tau : float + The acceleration timescale of the merger. + Unit: [Gyr] """ - self._validate_time(t_merger) + self._validate_time(t, include_end=is_end) + + if is_end: + v_t = self.velocity_turb_base(t) # [km/s] + else: + v_t = self.velocity_turb(t) # [km/s] - k_L = 2 * np.pi / self.radius_turb(t_merger) # [kpc^-1] - cs = helper.speed_sound(self.kT(t_merger)) # [km/s] - v_t = self.velocity_turb(t_merger) # [km/s] - tau = self.x_cr * cs**3 / (8*k_L * v_t**4) + if np.isclose(v_t, 0): + return np.inf + + k_L = 2 * np.pi / self.radius_turb(t) # [kpc^-1] + c_s = helper.speed_sound(self.kT(t)) # [km/s] + tau = self.x_cr * c_s**3 / (8*k_L * v_t**4) tau *= AUC.s2Gyr * AUC.kpc2km # [s kpc/km] -> [Gyr] - # Mass scaling - M_main = self.mass_main(t_merger) + # Scale by cluster mass + M_main = self.mass_main(t) f_mass = (M_main / 1e15) ** (-self.mass_index) tau *= f_mass - tau /= self.f_acc # tune factor (folded with "zeta_ins") + tau /= self.f_acc # tune factor (folded with ΞΆ "zeta_ins") - return tau # [Gyr] + return tau @property @lru_cache() -- cgit v1.2.2