pisces.models.galaxy_clusters.spherical.MagnetizedSphericalGalaxyClusterModel.from_density_and_total_density#

classmethod MagnetizedSphericalGalaxyClusterModel.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, beta_profile: BaseProfile | Callable | float = 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 or Path) –

    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 or str, optional) – Minimum radius for sampling (default: 1 kpc).

  • max_radius (unyt_quantity or str, 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.

  • beta_profile (BaseSphericalDensityProfile or float or callable, optional) – The magnetic pressure fraction \(\beta\). This is the ratio between the thermal pressure and the magnetic pressure. By default, it is set to \(\infty\), corresponding to an unmagnetized cluster. For larger values of \(\beta\), the cluster will become less magnetized.

  • **kwargs – Additional keyword arguments passed to the radial grid construction.

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:

  1. 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)\]
  1. 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}\}\).

  1. Compute the gravitational field:

    \[\nabla \Phi(r) = \frac{G M_{\mathrm{tot}}(<r)}{r^2}\]
  2. Use hydrostatic equilibrium to integrate for pressure:

    \[\nabla P = - \rho_{\mathrm{gas}}(r) \nabla \Phi(r)\]
  3. 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\]