.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/a_models/plot_spherical_galaxy_cluster_model.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_a_models_plot_spherical_galaxy_cluster_model.py: ========================================= Build a Spherical Galaxy Cluster ========================================= This example constructs a simple spherical galaxy cluster model using Pisces and visualizes its thermodynamic profiles, including temperature, entropy, and pressure. Unlike magnetized models, this cluster assumes pure thermal pressure support. The model uses NFW profiles for both total and gas densities and solves for the hydrostatic temperature profile under spherical symmetry. .. GENERATED FROM PYTHON SOURCE LINES 15-21 Setup ----- We begin by importing the required profiles and model class. This example uses: - :class:`~pisces.models.galaxy_clusters.spherical.SphericalGalaxyClusterModel` - :class:`~profiles.density.NFWDensityProfile` .. GENERATED FROM PYTHON SOURCE LINES 21-31 .. code-block:: Python import tempfile import matplotlib.pyplot as plt import numpy as np import unyt from pisces.models.galaxy_clusters import SphericalGalaxyClusterModel from pisces.profiles import NFWDensityProfile .. GENERATED FROM PYTHON SOURCE LINES 32-35 Density Profiles ---------------- We'll define NFW profiles for both the total matter and gas components. .. GENERATED FROM PYTHON SOURCE LINES 35-48 .. code-block:: Python # Define the central density and scale radius for total mass. rho_tot = unyt.unyt_quantity(5e6, "Msun/kpc**3") r_s_tot = unyt.unyt_quantity(200, "kpc") # Define the central density and scale radius for gas. rho_gas = unyt.unyt_quantity(5e5, "Msun/kpc**3") r_s_gas = unyt.unyt_quantity(220, "kpc") # Create the profiles total_density = NFWDensityProfile(rho_0=rho_tot, r_s=r_s_tot) gas_density = NFWDensityProfile(rho_0=rho_gas, r_s=r_s_gas) .. GENERATED FROM PYTHON SOURCE LINES 49-52 Model Construction ------------------ We'll construct the spherical galaxy cluster model over a logarithmic radial grid. .. GENERATED FROM PYTHON SOURCE LINES 52-72 .. code-block:: Python # Create a temporary output file tmpdir = tempfile.TemporaryDirectory() filename = f"{tmpdir.name}/basic_cluster_model.h5" # Define the radial range rmin = unyt.unyt_quantity(1.0, "kpc") rmax = unyt.unyt_quantity(3.0, "Mpc") # Build the model model = SphericalGalaxyClusterModel.from_density_and_total_density( gas_density, total_density, filename, min_radius=rmin, max_radius=rmax, num_points=500, overwrite=True, ) .. rst-class:: sphx-glr-script-out .. code-block:: none Preparing metadata...: 0%| | 0/7 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_spherical_galaxy_cluster_model.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_spherical_galaxy_cluster_model.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_