Blackholes¶
Synthesizer has a collection of routines for modelling the emission of black holes (i.e. AGN). When coupled with a Galaxy
object it also allows users to combine with the emission from other galaxy components (i.e. stellar emission).
Unlike stellar emission the division between a particle
and a parametric
BlackHoles
/BlackHole
object is not well defined; we explain below the differences in different use cases.
Parametric Blackholes¶
If you are only interested in exploring the parameter space of AGN emission without simulation data to forward model you can use a parametric.BlackHole
. There are some specific differences compared to particle.BlackHole
objects to keep in mind:
A
parametric.BlackHole
can only ever describe a singular black hole.A
parametric.BlackHole
’s “position” (i.e. if making an image) is described by aPointSource
morphology object rather than coordinates.A
parametric.BlackHole
exists in isolation, i.e. it does not interface directly with other parametric components.
[1]:
import numpy as np
from unyt import Msun, deg, yr, Mpc
from synthesizer import galaxy
from synthesizer.parametric import BlackHole
# Set a random number seed to ensure consistent results
np.random.seed(42)
First we need to initialise our BlackHole
object with the parameters that will be needed to compute spectra.
[2]:
blackhole = BlackHole(
mass=1e8 * Msun,
inclination=60 * deg,
accretion_rate=1 * Msun / yr,
metallicity=0.01,
)
Like other synthesizer objects we can get more information using the print
command.
[3]:
print(blackhole)
+-----------------------------------------------------------------------------------------------------+
| BLACK HOLES |
+--------------------------+--------------------------------------------------------------------------+
| Attribute | Value |
+--------------------------+--------------------------------------------------------------------------+
| component_type | 'BlackHoles' |
+--------------------------+--------------------------------------------------------------------------+
| epsilon | 0.10 |
+--------------------------+--------------------------------------------------------------------------+
| accretion_rate_eddington | 0.45 |
+--------------------------+--------------------------------------------------------------------------+
| metallicity | 0.01 |
+--------------------------+--------------------------------------------------------------------------+
| ionisation_parameter_blr | 0.10 |
+--------------------------+--------------------------------------------------------------------------+
| covering_fraction_blr | 0.10 |
+--------------------------+--------------------------------------------------------------------------+
| ionisation_parameter_nlr | 0.01 |
+--------------------------+--------------------------------------------------------------------------+
| covering_fraction_nlr | 0.10 |
+--------------------------+--------------------------------------------------------------------------+
| eddington_ratio | 0.45 |
+--------------------------+--------------------------------------------------------------------------+
| cosine_inclination | 0.50 |
+--------------------------+--------------------------------------------------------------------------+
| nbh | 1 |
+--------------------------+--------------------------------------------------------------------------+
| morphology | <synthesizer.parametric.morphology.PointSource object at 0x7f98137ddb70> |
+--------------------------+--------------------------------------------------------------------------+
| mass | 100000000.0 Msun |
+--------------------------+--------------------------------------------------------------------------+
| accretion_rate | 1.0 Msun/yr |
+--------------------------+--------------------------------------------------------------------------+
| bolometric_luminosity | 5.6629751681288276e+45 erg/s |
+--------------------------+--------------------------------------------------------------------------+
| hydrogen_density_blr | 1000000000.0 cm**(-3) |
+--------------------------+--------------------------------------------------------------------------+
| velocity_dispersion_blr | 2000 km/s |
+--------------------------+--------------------------------------------------------------------------+
| hydrogen_density_nlr | 10000.0 cm**(-3) |
+--------------------------+--------------------------------------------------------------------------+
| velocity_dispersion_nlr | 500 km/s |
+--------------------------+--------------------------------------------------------------------------+
| inclination | 60 degree |
+--------------------------+--------------------------------------------------------------------------+
| theta_torus | 10 degree |
+--------------------------+--------------------------------------------------------------------------+
| torus_fraction | 0.1111111111111111 |
+--------------------------+--------------------------------------------------------------------------+
| bb_temperature | 223999.99999999997 K |
+--------------------------+--------------------------------------------------------------------------+
| eddington_luminosity | 1.2570000000000002e+46 erg/s |
+--------------------------+--------------------------------------------------------------------------+
Particle blackholes¶
Creating Particle Blackholes¶
Before generating some simple observational quantities from physical properties we first need to create a BlackHoles
object. This object can be found in synthesizer/particle/blackholes.py
.
[4]:
from synthesizer.particle import BlackHoles, Gas
Lets create an instance of BlackHoles
containing 4 fake black holes. To do so we can provide a number of optional keyword arguments, but for now lets just provide their masses, metallicities, coordinates and accretion rates (the parameters required for spectra calculation). Note that masses
and accretion_rates
are positional arguments, and must therefore always be provided for particle.BlackHoles
, while parametric.BlackHole
s have more flexibility.
[5]:
# Make fake properties
n = 4
masses = 10 ** np.random.uniform(low=7, high=9, size=n) * Msun
coordinates = np.random.normal(0, 1.5, (n, 3)) * Mpc
accretion_rates = 10 ** np.random.uniform(
low=-2, high=1, size=n
) * Msun / yr
metallicities = np.full(n, 0.01)
# And get the black holes object
bh = BlackHoles(
masses=masses,
coordinates=coordinates,
accretion_rates=accretion_rates,
metallicities=metallicities,
)
For some emission models we require an inclination. This could, in principle, be calculated from the simulation and passed at instantiation, but for now we can use an in-built method to generate random inclinations.
[6]:
bh.calculate_random_inclination()
print(bh.inclination)
[41.04629858 70.66583653 17.97064039 46.28109946] degree
Blackhole properties¶
On initialisation a handful of properties will automatically be calculated if their prerequisites are met. For example, if masses
and accretion_rates
are provided, bolometric_luminosities
are automatically calculated using,
Note that the radiative efficency (epsilon
) defaults to 0.1, but can be passed as an array with a value for each particle.
[7]:
bh.bolometric_luminosities
[7]:
unyt_array([3.87796015e+45, 1.48431556e+44, 4.26067691e+44, 7.11426744e+44], 'erg/s')
Here are some more examples of calculated properties.
[8]:
print(bh.eddington_ratio)
print(bh.accretion_rate_eddington)
print(bh.eddington_luminosity)
[0.54977859 0.00148171 0.01164543 0.03593171]
[0.54977859 0.00148171 0.01164543 0.03593171]
[7.05367613e+45 1.00176047e+47 3.65866934e+46 1.97994099e+46] erg/s
As with most synthesizer objects a summary of the object can be printed using print
.
[9]:
print(bh)
+------------------------------------------------------------------------------------------------+
| PARTICLES |
+--------------------------------+---------------------------------------------------------------+
| Attribute | Value |
+--------------------------------+---------------------------------------------------------------+
| nparticles | 4 |
+--------------------------------+---------------------------------------------------------------+
| metallicity_floor | 1.00e-05 |
+--------------------------------+---------------------------------------------------------------+
| name | 'Black Holes' |
+--------------------------------+---------------------------------------------------------------+
| component_type | 'BlackHoles' |
+--------------------------------+---------------------------------------------------------------+
| ionisation_parameter_blr | 0.10 |
+--------------------------------+---------------------------------------------------------------+
| covering_fraction_blr | 0.10 |
+--------------------------------+---------------------------------------------------------------+
| ionisation_parameter_nlr | 0.01 |
+--------------------------------+---------------------------------------------------------------+
| covering_fraction_nlr | 0.10 |
+--------------------------------+---------------------------------------------------------------+
| nbh | 4 |
+--------------------------------+---------------------------------------------------------------+
| coordinates (4, 3) | -2.87e+00 Mpc -> 2.37e+00 Mpc (Mean: -3.67e-01 Mpc) |
+--------------------------------+---------------------------------------------------------------+
| masses (4,) | 5.61e+07 Msun -> 7.97e+08 Msun (Mean: 3.25e+08 Msun) |
+--------------------------------+---------------------------------------------------------------+
| mass (4,) | 5.61e+07 Msun -> 7.97e+08 Msun (Mean: 3.25e+08 Msun) |
+--------------------------------+---------------------------------------------------------------+
| accretion_rate (4,) | 2.62e-02 Msun/yr -> 6.85e-01 Msun/yr (Mean: 2.28e-01 Msun/yr) |
+--------------------------------+---------------------------------------------------------------+
| epsilon | [0.1] |
+--------------------------------+---------------------------------------------------------------+
| accretion_rate_eddington (4,) | 1.48e-03 -> 5.50e-01 (Mean: 1.50e-01) |
+--------------------------------+---------------------------------------------------------------+
| bolometric_luminosity (4,) | 1.48e+44 erg/s -> 3.88e+45 erg/s (Mean: 1.29e+45 erg/s) |
+--------------------------------+---------------------------------------------------------------+
| metallicity (4,) | 1.00e-02 -> 1.00e-02 (Mean: 1.00e-02) |
+--------------------------------+---------------------------------------------------------------+
| hydrogen_density_blr | 1000000000.0 cm**(-3) |
+--------------------------------+---------------------------------------------------------------+
| velocity_dispersion_blr | 2000 km/s |
+--------------------------------+---------------------------------------------------------------+
| hydrogen_density_nlr | 10000.0 cm**(-3) |
+--------------------------------+---------------------------------------------------------------+
| velocity_dispersion_nlr | 500 km/s |
+--------------------------------+---------------------------------------------------------------+
| inclination (4,) | 1.80e+01 degree -> 7.07e+01 degree (Mean: 4.40e+01 degree) |
+--------------------------------+---------------------------------------------------------------+
| theta_torus | 10 degree |
+--------------------------------+---------------------------------------------------------------+
| torus_fraction | 0.1111111111111111 |
+--------------------------------+---------------------------------------------------------------+
| bb_temperature (4,) | 3.19e+04 K -> 2.72e+05 K (Mean: 1.20e+05 K) |
+--------------------------------+---------------------------------------------------------------+
| eddington_luminosity (4,) | 7.05e+45 erg/s -> 1.00e+47 erg/s (Mean: 4.09e+46 erg/s) |
+--------------------------------+---------------------------------------------------------------+
| eddington_ratio (4,) | 1.48e-03 -> 5.50e-01 (Mean: 1.50e-01) |
+--------------------------------+---------------------------------------------------------------+
| cosine_inclination (4,) | 3.31e-01 -> 9.51e-01 (Mean: 6.82e-01) |
+--------------------------------+---------------------------------------------------------------+
| accretion_rates (4,) | 2.62e-02 Msun/yr -> 6.85e-01 Msun/yr (Mean: 2.28e-01 Msun/yr) |
+--------------------------------+---------------------------------------------------------------+
| metallicities (4,) | 1.00e-02 -> 1.00e-02 (Mean: 1.00e-02) |
+--------------------------------+---------------------------------------------------------------+
| inclinations | 0.0 degree |
+--------------------------------+---------------------------------------------------------------+
| epsilons | [0.1] |
+--------------------------------+---------------------------------------------------------------+
| bb_temperatures (4,) | 3.19e+04 K -> 2.72e+05 K (Mean: 1.20e+05 K) |
+--------------------------------+---------------------------------------------------------------+
| bolometric_luminosities (4,) | 1.48e+44 erg/s -> 3.88e+45 erg/s (Mean: 1.29e+45 erg/s) |
+--------------------------------+---------------------------------------------------------------+
| accretion_rates_eddington (4,) | 1.48e-03 -> 5.50e-01 (Mean: 1.50e-01) |
+--------------------------------+---------------------------------------------------------------+
| eddington_ratios (4,) | 1.48e-03 -> 5.50e-01 (Mean: 1.50e-01) |
+--------------------------------+---------------------------------------------------------------+
| log10metallicities (4,) | -2.00e+00 -> -2.00e+00 (Mean: -2.00e+00) |
+--------------------------------+---------------------------------------------------------------+
Calculating black hole metallicity¶
If we want to calculate emission from the black hole and its surroundings we need to know the metallicity of the gas surrounding the black hole. In the example above we could have passed an array of metallicities at instantiation, but most of the time we will not know ahead of time what these values should be. Instead, we can use the gas surrounding the black hole to calculate what this metallicity is. To do this we need to first create a Galaxy
with both a Gas
component and
BlackHoles
, again using fake data.
[10]:
# Make fake gas properties
ngas = 200
ms = np.full(ngas, 10**6.5) # Msun
pos = np.random.normal(0, 1.5, (ngas, 3)) # cMpc
hsml = np.full(ngas, 0.75) # cMpc
metals = np.full(ngas, 0.01)
# And make the gas object
gas = Gas(
masses=ms * Msun, metallicities=metals, coordinates=pos * Mpc, smoothing_lengths=hsml * Mpc
)
# And now create the galaxy
galaxy = galaxy(stars=None, gas=gas, black_holes=bh)
Now we have the galaxy we can use galaxy.calculate_black_hole_metallicity()
to calculate the black holes’ metallicity. This method will find all gas particles with smoothing lengths that intersect the black hole and calculate the mass–weighted average of their metallicity. If a black hole does not find any gas neighbours then a default metallicity is set instead. This defaults to solar metallicity (0.012) but can be overwritten by passing a new default_metallicity
as shown below.
[11]:
galaxy.calculate_black_hole_metallicity(default_metallicity=0.07)
print("Z_BH =", galaxy.black_holes.metallicities)
Z_BH = [0.01 0.01 0.01 0.07]