From 308442d1ca1a0f56889dd60f78d2b776ace2d81b Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 21 Feb 2019 20:17:47 +0800 Subject: clusters/halo: Reorder the '_energy_loss()' method --- fg21sim/extragalactic/clusters/halo.py | 54 +++++++++++++--------------------- 1 file changed, 21 insertions(+), 33 deletions(-) (limited to 'fg21sim') diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 55c7ca0..e24a0c3 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -645,6 +645,27 @@ class RadioHalo1M: (self.fp_diffusion(gamma, t) * 2 / gamma)) return advection + def _energy_loss(self, gamma, t): + """ + Energy loss mechanisms: + * inverse Compton scattering off the CMB photons + * synchrotron radiation + * Coulomb collisions + + Reference: Ref.[sarazin1999],Eqs.(6,7,9) + + Unit: [Gyr^-1] + """ + gamma = np.asarray(gamma) + z = COSMO.redshift(t) + B = self.magnetic_field(t) # [uG] + mass = self.mass_main(t) + n_th = helper.density_number_thermal(mass, z) # [cm^-3] + loss_ic = -4.32e-4 * gamma**2 * (1+z)**4 + loss_syn = -4.10e-5 * gamma**2 * B**2 + loss_coul = -3.79e4 * n_th * (1 + np.log(gamma/n_th) / 75) + return loss_ic + loss_syn + loss_coul + def _merger_time(self, t=None): """ The (cosmic) time when the merger begins. @@ -723,39 +744,6 @@ class RadioHalo1M: tau_turb = self.duration_turb(t_merger) return (t >= t_merger) and (t <= t_merger + tau_turb) - def _energy_loss(self, gamma, t): - """ - Energy loss mechanisms: - * inverse Compton scattering off the CMB photons - * synchrotron radiation - * Coulomb collisions - - Reference: Ref.[sarazin1999],Eqs.(6,7,9) - - Parameters - ---------- - gamma : float, or float 1D `~numpy.ndarray` - The Lorentz factors of electrons - t : float - The cosmic time/age - Unit: [Gyr] - - Returns - ------- - loss : float, or float 1D `~numpy.ndarray` - The energy loss rates - Unit: [Gyr^-1] - """ - gamma = np.asarray(gamma) - z = COSMO.redshift(t) - B = self.magnetic_field(t) # [uG] - mass = self.mass_main(t) - n_th = helper.density_number_thermal(mass, z) # [cm^-3] - loss_ic = -4.32e-4 * gamma**2 * (1+z)**4 - loss_syn = -4.10e-5 * gamma**2 * B**2 - loss_coul = -3.79e4 * n_th * (1 + np.log(gamma/n_th) / 75) - return loss_ic + loss_syn + loss_coul - class RadioHaloAM(RadioHalo1M): """ -- cgit v1.2.2