aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r--fg21sim/extragalactic/clusters/helper.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/fg21sim/extragalactic/clusters/helper.py b/fg21sim/extragalactic/clusters/helper.py
index 29134f7..88c566a 100644
--- a/fg21sim/extragalactic/clusters/helper.py
+++ b/fg21sim/extragalactic/clusters/helper.py
@@ -231,6 +231,28 @@ def density_energy_thermal(mass, z=0.0, configs=CONFIGS):
return e_th
+def density_energy_electron(spectrum, gamma):
+ """
+ Calculate the energy density of relativistic electrons.
+
+ Parameters
+ ----------
+ spectrum : 1D float `~numpy.ndarray`
+ The number density of the electrons w.r.t. Lorentz factors
+ Unit: [cm^-3]
+ gamma : 1D float `~numpy.ndarray`
+ The Lorentz factors of electrons
+
+ Returns
+ -------
+ e_re : float
+ The energy density of the relativistic electrons.
+ Unit: [erg cm^-3]
+ """
+ e_re = integrate.trapz(spectrum*gamma*AU.mec2, gamma)
+ return e_re
+
+
def magnetic_field(mass, z=0.0, configs=CONFIGS):
"""
Calculate the mean magnetic field strength within the ICM, which is
@@ -255,28 +277,6 @@ def magnetic_field(mass, z=0.0, configs=CONFIGS):
return B
-def density_energy_electron(spectrum, gamma):
- """
- Calculate the energy density of relativistic electrons.
-
- Parameters
- ----------
- spectrum : 1D float `~numpy.ndarray`
- The number density of the electrons w.r.t. Lorentz factors
- Unit: [cm^-3]
- gamma : 1D float `~numpy.ndarray`
- The Lorentz factors of electrons
-
- Returns
- -------
- e_re : float
- The energy density of the relativistic electrons.
- Unit: [erg cm^-3]
- """
- e_re = integrate.trapz(spectrum*gamma*AU.mec2, gamma)
- return e_re
-
-
def speed_sound(kT):
"""
The adiabatic sound speed in cluster ICM.