From 6c494f0b0c207c45afb90a192f665f683f9bb067 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 25 Jan 2019 16:22:00 +0800 Subject: clusters/halo: Fold _rho_gas_f() into _velocity_turb() --- fg21sim/extragalactic/clusters/halo.py | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 56c8622..4cf6306 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -655,21 +655,6 @@ class RadioHalo1M: return helper.magnetic_field(mass=mass, z=z, eta_b=eta_b, kT_out=kT_out) - @lru_cache() - def _rho_gas_f(self, t): - """ - The gas density profile of the main cluster. - - Returns - ------- - f(r) : function - A function that calculates the gas density of unit [Msun/kpc^3]. - """ - z = COSMO.redshift(t) - mass = self.mass_main(t) - return helper.calc_gas_density_profile(mass, z, f_rc=self.f_rc, - beta=self.beta) - @lru_cache() def _velocity_turb(self, t): """ @@ -703,13 +688,16 @@ class RadioHalo1M: Unit: [km/s] """ z = COSMO.redshift(t) - rho_gas_f = self._rho_gas_f(t) - R_turb = self.radius_turbulence(t) # [kpc] - M_turb = 4*np.pi * integrate.quad(lambda r: rho_gas_f(r) * r**2, - a=0, b=R_turb)[0] # [Msun] - M_main = self.mass_main(t) M_sub = self.mass_sub(t) + R_turb = self.radius_turbulence(t) # [kpc] + + rho_gas_f = helper.calc_gas_density_profile( + M_main, z, f_rc=self.f_rc, beta=self.beta) + M_turb = 4*np.pi * integrate.quad( + lambda r: rho_gas_f(r) * r**2, + a=0, b=R_turb)[0] # [Msun] + v_i = helper.velocity_impact(M_main, M_sub, z) # [km/s] rho_main = helper.density_number_thermal(M_main, z) # [cm^-3] rho_main *= AC.mu*AC.u * AUC.g2Msun * AUC.kpc2cm**3 # [Msun/kpc^3] -- cgit v1.2.2