From 920c72c05499c91024b6311a62836bd4cc9e0d84 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 16 Nov 2017 11:12:52 +0800 Subject: clusters/halo: improve advection calculation --- fg21sim/extragalactic/clusters/halo.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'fg21sim/extragalactic/clusters/halo.py') diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 160ab96..f69c1cc 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -761,17 +761,15 @@ class RadioHalo: Advection coefficients, describing the energy loss/gain rates. Unit: [Gyr^-1] """ - # Always use the properties at ``age_merger`` to derive the - # initial electron spectrum. if t < self.age_merger: - # NOTE: subtract ``time_step`` to make sure ``fp_diffusion()`` - # gives no acceleration. - t = self.age_merger - self.time_step - - gamma = np.asarray(gamma) - advection = (abs(self._loss_ion(gamma, t)) + - abs(self._loss_rad(gamma, t)) - - (self.fp_diffusion(gamma, t) * 2 / gamma)) + # To derive the initial electron spectrum + advection = (abs(self._loss_ion(gamma, self.age_merger)) + + abs(self._loss_rad(gamma, self.age_merger))) + else: + # Turbulence acceleration and beyond + advection = (abs(self._loss_ion(gamma, t)) + + abs(self._loss_rad(gamma, t)) - + (self.fp_diffusion(gamma, t) * 2 / gamma)) return advection def _mass(self, t): @@ -844,6 +842,7 @@ class RadioHalo: ---------- Ref.[sarazin1999],Eq.(9) """ + gamma = np.asarray(gamma) z = COSMO.redshift(t) mass = self._mass(t) n_th = helper.density_number_thermal(mass, z) # [cm^-3] @@ -859,6 +858,7 @@ class RadioHalo: ---------- Ref.[sarazin1999],Eq.(6,7) """ + gamma = np.asarray(gamma) B = self._magnetic_field(t) # [uG] z = COSMO.redshift(t) loss = -4.32e-4 * gamma**2 * ((B/3.25)**2 + (1+z)**4) -- cgit v1.2.2