pisces.models.galaxy_clusters.spherical.SphericalGalaxyClusterModel.from_density_and_total_density#
- classmethod SphericalGalaxyClusterModel.from_density_and_total_density(density_profile: BaseSphericalDensityProfile, total_density_profile: BaseSphericalDensityProfile, filename: str | Path, min_radius: unyt_quantity | str = unyt_quantity(1, 'kpc'), max_radius: unyt_quantity | str = unyt_quantity(1, 'Mpc'), num_points: int = 1000, overwrite: bool = False, stellar_density_profile: BaseSphericalDensityProfile = None, **kwargs)[source]#
Generate a spherical cluster model from analytic density profiles.
- Parameters:
density_profile (
BaseSphericalDensityProfile
) – Profile object representing the radial gas density.total_density_profile (
BaseSphericalDensityProfile
) – Profile object representing the total density.filename (
str
orPath
) –The file at which to save the model. If the file already exists, then it will raise an error unless
overwrite=True
.This should be an HDF5 file with a
.h5
or.hdf5
extension.min_radius (
unyt_quantity
orstr
, optional) – Minimum radius for sampling (default: 1 kpc).max_radius (
unyt_quantity
orstr
, optional) – Maximum radius for sampling (default: 1 Mpc).num_points (
int
, optional) – Number of radial samples (default: 1000).overwrite (
bool
, optional) – Whether to overwrite existing file (default: False).stellar_density_profile (
BaseSphericalDensityProfile
, optional) – Optional stellar density profile. If provided, the stellar density will be included in the model. Otherwise, the stellar density is assumed to be zero and no stellar component is included.**kwargs – Additional keyword arguments passed to the density profile constructors.
Notes
Given gas density \(\rho_{\mathrm{gas}}(r)\), total density \(\rho_{\mathrm{tot}}(r)\), and an optional stellar density \(\rho_{\star}(r)\), we perform the following steps:
Compute Dark Matter Density:
Requiring that the total density is the sum of gas, stellar, and dark matter densities:
\[\rho_{\mathrm{DM}}(r) = \rho_{\mathrm{tot}}(r) - \rho_{\mathrm{gas}}(r) - \rho_{\star}(r)\]
Compute mass profiles via:
\[M_i(<r) = 4\pi \int_0^r \rho_i(r') \, r'^2 \, dr'\]
for each component \(i \in \{\mathrm{gas}, \mathrm{tot}, {\rm dm}, \mathrm{stellar}\}\).
Compute the gravitational field:
\[\nabla \Phi(r) = \frac{G M_{\mathrm{tot}}(<r)}{r^2}\]Use hydrostatic equilibrium to integrate for pressure:
\[\nabla P = - \rho_{\mathrm{gas}}(r) \nabla \Phi(r)\]Solve for temperature using the ideal gas law:
\[T(r) = \frac{P(r)}{n(r)} = \frac{P(r)}{\rho_{\mathrm{gas}}(r)} \cdot \mu m_p\]