1 Introduction

Black Holes (BHs) are fundamental objects which are of utmost importance for the understanding of gravitation. With the detection of gravitational waves from mergers of binary BHs [1,2,3], direct observation of the Milky Way supermassive central BH [4], and the cosmological and gravitational questions related to primordial BHs (PBHs, see for example [5,6,7,8]), these compact objects are currently under intense scrutiny. It is therefore important to find methods to characterize their properties, and we present here a program for studying multi-messenger probes of BHs.

Other codes, such as BlackMax [9] and Charybdis [10], have already been released in order to compute the Hawking radiation (HR) of BHs, which however focus on higher-dimensional models of general relativity where the Planck mass is decreased and allow the users to make predictions for generation and evaporation of micro black holes at high-energy colliders.

We present here BlackHawk, which is the first public code for the computation of the time-dependent HR into stable or long-lived particles of \(4-\)dimensional Schwarzschild and Kerr BHs distributed in mass.

This document constitutes the manual of BlackHawk v1.0 and is organized as follows: Sect. 2 is a brief overview of BHs and HR physics, Sect. 3 presents the structure and file content of the code, and the compilation and run instructions, Sect. 4 describes the input parameters needed to run BlackHawk, Sect. 5 gives a detailed description of all the routines written in the code, Sect. 6 follows the normal execution of BlackHawk programs and gives examples of screen output, Sect. 7 presents the format of the data files generated by a run along with examples, Sect. 8 gives an estimation of the memory usage and Sect. 9 provides instructions for the users on how to modify the code.

2 Physics of Hawking radiation

In this section we give a short overview of the main physical aspects of HR. This concerns BHs of primordial origin (PBHs), as well as any other BHs.

In the following, all formulas are in natural units where \(\hbar = c = k_{\mathrm{B}} = G = 1\), unless stated otherwise.

2.1 Testing Black Holes distributions

BlackHawk has been designed to provide tests of compatibility between observations and BH distributions at different main steps of the history of the Universe. For this purpose, it computes the HR of a distribution of BHs, and its evolution in time. The obtained spectra can then be used to check whether the amount of produced particles has an effect on observable cosmological quantities.

The distribution of BHs as a function of their mass is completely model-dependent and recent studies have proven some previously set constraints to be irrelevant [11, 12]. BlackHawk can in principle work with any distribution of BHs. Several BH mass functions are already built-in and depend on the details of the BH formation mechanisms. For these built-in mass functions, all BHs are considered to have the same spin.

2.1.1 Peak theory distribution

The peak theory distribution is derived from the scale-invariant model, assuming that the power spectrum of the primordial density fluctuations is a power-law (see e.g. [13, 14])

$$\begin{aligned} P(k) = R_c \left( \frac{k}{k_0} \right) ^{n-1}\,, \end{aligned}$$
(1)

where \(n\approx 1.3\) and \(R_c\) is measured using the Cosmic Microwave Background (CMB) to be \(R_c = (24.0\pm 1.2)\times 10^{-10}\) at the scale \(k_0 = 0.002\,\) \(\hbox {Mpc}^{-1}\). The comoving number density of PBHs resulting from this power spec-trum is obtained in [13] through peak-theory

$$\begin{aligned} {\mathrm{d}}n \approx \frac{1}{4\pi ^2 M}\left( \frac{X(n-1)}{6M} \right) ^{3/2}\frac{(n-1)}{2}\nu ^4e^{-\nu ^2/2}{\mathrm{d}}M\,, \end{aligned}$$
(2)

where

$$\begin{aligned} \nu (M) \equiv \left( \frac{2(k_0^2 M/X)^{(n-1)/2}}{R_{\mathrm{c}}\varGamma ((n-1)/2)} \right) ^{1/2}\zeta _{\mathrm{th}}\,, \end{aligned}$$
(3)

and

$$\begin{aligned} X \equiv \frac{4\pi }{3}\left( \frac{8\pi G}{3} \right) ^{-1}\left( \frac{H_0^2\varOmega _{\mathrm{m}}}{1+z_{\mathrm{eq}}}\left( \frac{g_{*\mathrm eq}}{g_*} \right) ^{1/3} \right) ^{1/2}\,, \end{aligned}$$
(4)

in which:

  • \(H_0 = 67.8\,\)km \(\hbox {s}^{-1}\) \(\hbox {Mpc}^{-1}\) is the current Hubble parameter [15].

  • \(\varOmega _{\mathrm{m}} = 0.308\) is the matter mass fraction in the Universe [15].

  • \(z_{\mathrm{eq}} = 3200\) is the radiation-matter equality redshift [13].

  • \(g_{* \mathrm eq} = 3.36\) is the number of relativistic energy degrees of freedom (dof) at radiation-matter equality [13].

  • \(g_* = 106.75\) is the number of relativistic energy dof at the time of PBH formation (here the end of the inflation) [15].

  • \(\zeta _{\mathrm{th}} = 0.7\) parametrizes the direct collapse of a primordial density fluctuation into a PBH [13].

2.1.2 Log-normal distribution

The log-normal distribution [11] is considered to be the general mass function originating from a peak in the power spectrum of primordial fluctuations. It is parametrized through

$$\begin{aligned} {\mathrm{d}}n = \dfrac{ A}{\sqrt{2\pi }\sigma M^2}{\mathrm{exp}}\left( -\dfrac{\ln (M/M_c)^2}{2\sigma ^2} \right) {\mathrm{d}}M, \end{aligned}$$
(5)

where A is the amplitude, \(M_c\) is the position of the peak and \(\sigma \) is its width. Note that this is a log-normal distribution for the comoving density \(M\mathrm{d}n/\mathrm{d}M\) and not for the comoving number density \(\mathrm{d}n/\mathrm{d}M\) — the two differing only by a factor of M.

2.1.3 Power-law distribution

The power-law distribution [11] is a less refined version of Eq. (2). It also derives from scale-invariant primordial density fluctuations and is given by

$$\begin{aligned} {\mathrm{d}}n = AM^{\gamma -2}{\mathrm{d}}M\,, \end{aligned}$$
(6)

where \(\gamma \equiv -2w/(1+w)\) and w is defined through the equation of state of the dominating energy in the Universe at the epoch of PBH formation such as \(P=w\rho \).

2.1.4 Critical collapse distribution

The critical collapse distribution [11] derives from a Dirac power spectrum for primordial density fluctuations. It is defined as

$$\begin{aligned} {\mathrm{d}}n = AM^{1.85}\exp \left( -\left( \dfrac{M}{M_f}\right) ^{2.85} \right) {\mathrm{d}}M\,, \end{aligned}$$
(7)

where A is an amplitude factor and \(M_f\) an upper cut-off.

2.1.5 Dirac distribution

The Dirac distribution simulates a Dirac BH mass func-tion. It is useful to perform time-dependent monochromatic analyses and checks for a single BH. It is normalized to 1 BH per comoving \(\hbox {cm}^3\).

2.2 Hawking radiation

2.2.1 Schwarzschild Black Holes

Schwarzschild Black Holes are the simplest form of BHs. They are spherically symmetric and only described by their mass M. Hawking has shown [16] that BH horizons emit elementary particles as blackbodies with a temperature linked to their mass M throughFootnote 1

$$\begin{aligned} T = \dfrac{1}{8\pi M}\,. \end{aligned}$$
(8)

The number of particles emitted per units of time and energy is

$$\begin{aligned} \dfrac{{\mathrm{d}}^2 N}{{\mathrm{d}}t{\mathrm{d}}E} = \sum _{{\mathrm{dof}}} \dfrac{\varGamma _s(E,M)/2\pi }{e^{E/T}\pm 1}\,, \end{aligned}$$
(9)

where the sum is over the number of quantum dof (see Table 2 in Appendix C) and the ± are for fermions and bosons, respectively. The factor \(\varGamma _s\) is called the greybody factor and is detailed below.

The time-dependent comoving density of Hawking elementary particle i emitted by a distribution of BHs per units of time and energy is then computed through the integral

$$\begin{aligned} \dfrac{{\mathrm{d}}^2 n_i}{{\mathrm{d}}t{\mathrm{d}}E} = \displaystyle \int _{M_{\mathrm{min}}}^{M_{\mathrm{max}}} \dfrac{{\mathrm{d}}^2 N_i}{{\mathrm{d}}t{\mathrm{d}}E}\cdot \dfrac{{\mathrm{d}}n}{{\mathrm{d}}M}{\mathrm{d}}M\,. \end{aligned}$$
(10)

To obtain instantaneous quantities for a single BH of mass \(M_0\), one just needs to take

$$\begin{aligned} \dfrac{{\mathrm{d}}n}{{\mathrm{d}}M} = \delta (M-M_0)\,. \end{aligned}$$
(11)

The greybody factors describe the probability that an elementary particle generated by thermal fluctuations of the vacuum at the BH horizon escapes its gravitational well. Starting from Dirac (spin \(s=1/2\)) and Proca (integer spin s) wave equations for a particle of rest mass \(\mu \)

$$\begin{aligned}&(i\not {\partial } - \mu )\psi = 0\,, \end{aligned}$$
(12)
$$\begin{aligned}&(\square + \mu ^2)\phi = 0\,, \end{aligned}$$
(13)

in the Schwarzschild metric

$$\begin{aligned} {\mathrm{d}}s^2 = h(r){\mathrm{d}}t^2 - h(r)^{-1}{\mathrm{d}}r^2 - r^2 (\mathrm{d}\theta ^2 + \sin (\theta )^2{\mathrm{d}}\phi ^2), \end{aligned}$$
(14)

where \(h(r) \equiv 1-r_{\mathrm{H}}/r\) and \(r_{\mathrm{H}} \equiv 2M\) is the Schwarzschild radius, Teukolsky & Press have shown [17, 18] that the wave equation can be separated into a radial equation and an angular equation if the wave is decomposed into spin weighted spherical harmonics \(S_{sl}(\theta )\) and a radial component \(R_{s}(r)\). The radial component of the master equation is for all spins s [19]

$$\begin{aligned}&\frac{1}{\varDelta ^s}\frac{{\mathrm{d}}}{{\mathrm{d}}r}\left( \varDelta ^{s+1}\frac{{\mathrm{d}}R_{s}}{{\mathrm{d}}r} \right) + \bigg ( \dfrac{K^2+is(2r-r_{\mathrm{H}})K}{\varDelta } -4isE r \nonumber \\&\quad - \lambda _{sl} -\mu ^2 r^2 \bigg )R_{s} = 0\,, \end{aligned}$$
(15)

where \(\varDelta (r) \equiv r^2 h(r)\), \(K(r) \equiv r^2E^2\) and E is the particle frequency (or equivalently its energy). In this equation, the separation constant \(\lambda _{ls} \equiv l(l+1) - s(s+1)\) is the eigenvalue of the angular equation, where l denotes the angular momentum of the spherical harmonics.

To obtain the greybody factors, one has to compute the transmission coefficients of the wave between the BH horizon and the spatial infinity. The cross-section \(\sigma (E)\) of the spherical wave on the BH is a sum on all spherical modes l obtained through the optical theorem. The greybody factor is finally given by [20]

$$\begin{aligned} \varGamma (E,M) = \dfrac{\sigma (E,M)E^2}{\pi }. \end{aligned}$$
(16)

The method used in BlackHawk to compute those greybody factors is described in Appendix B.1.

2.2.2 Kerr Black Holes

Kerr Black Holes are an extension of the Schwarzschild ones with an additional parameter: their spin \(a \equiv J/M \in [0,M]\) (in the following we will denote the reduced spin parameter by \(a^* \equiv a/M \in [0,1]\)) where J is the BH angular momentum. These rotating BHs could gain their spin through their formation mechanism [21], accretion [22] or merging process [23]. They are axially symmetric and require a specific treatment.

The temperature of a rotating BH is given by [24]

$$\begin{aligned} T \equiv \dfrac{1}{2\pi }\left( \dfrac{r_+ - M}{r_+^2 + a^2} \right) , \end{aligned}$$
(17)

where \(r_+ \equiv M + \sqrt{M^2 - a^2}\) is the Kerr external radius. The Teukolsky equation (15) has to be modified with \(\varDelta (r) \equiv r^2 - 2Mr + a^2\) and \(K(r) \equiv (r^2 + a^2)E^2 + am\), where m is the projection of the angular momentum l. The separation constant \(\lambda _{slm}\), now resulting from the angular solution for spheroidal harmonics, is more difficult to compute. We will use the 5th order expansion in terms of \(\gamma = a^*ME\), as given in [24].Footnote 2

The number of particles emitted per units of time and energy is now

$$\begin{aligned} \dfrac{{\mathrm{d}}^2 N}{{\mathrm{d}}t{\mathrm{d}}E} = \sum _{{\mathrm{dof.}}} \dfrac{\varGamma _s(E,M,a^*)/2\pi }{e^{E^\prime /T}\pm 1}, \end{aligned}$$
(18)

where \(E^\prime \equiv E - m\varOmega \) and \(\varOmega \equiv a^*/(2r_+)\) is the angular velocity at the horizon [24].

The method used to compute these greybody factors in BlackHawk is also described in Appendix B.1.

2.2.3 Exotic Black Holes

There are numerous other types of BHs, either in the classical standard cosmological model framework, such as the charged Reissner–Nordström BHs which possess a U(1) electric charge (e.g. [25, 26]), or in alternative models such as (A)dS BHs [27,28,29,30], scalar-tensor theories [31,32,33], higher-dimensional theories [34,35,36,37,38], massive gravity [39, 40], ... These BHs still exhibit a Hawking radiation process in most cases, the two main differences being Hawking temperature and greybody factors. Equations giving these quantities for specific cases can usually be found in the associated literature. Possible implementations of beyond-standard BHs in BlackHawk are described in Sect. 9.5.

2.3 Black Hole evolution

2.3.1 Schwarzschild Black Holes

Once the greybody factors are known, it is possible to integrate Eq. (9) to obtain a differential equation for the mass loss of a BH through HR [41]

$$\begin{aligned} \dfrac{{\mathrm{d}}M}{{\mathrm{d}}t} = - \dfrac{f(M)}{M^2}. \end{aligned}$$
(19)

The Page factor f(M) accounts for the number of quantum dof that a BH of mass M can emit. It is obtained through [41]

$$\begin{aligned} f(M) = -M^2 \dfrac{{\mathrm{d}}M}{{\mathrm{d}}t} = M^2\int _{0}^{+\infty } \dfrac{E}{2\pi }\sum _{{\mathrm{dof}}} \dfrac{\varGamma _s(E,M)}{e^{E/T}\pm 1}{\mathrm{d}}E.\nonumber \\ \end{aligned}$$
(20)

The computation of the f(M) factor in BlackHawk is described in Appendix B.2.

2.3.2 Kerr Black Holes

For Kerr BHs, a new phenomenon arises. The rotation of the BH enhances the emission of particles with high angular momentum, and with a projection m of that angular momentum aligned with the BH spin, thus effectively extracting angular momentum from the BH [42]. The equation for the Page factor \(f(M,a^*)\) becomes [24, 43, 44]

$$\begin{aligned} f(M,a^*)&\equiv -M^2 \dfrac{{\mathrm{d}}M}{{\mathrm{d}}t} \nonumber \\&= M^2\int _{0}^{+\infty } \dfrac{E}{2\pi }\sum _{{\mathrm{dof}}} \dfrac{\varGamma _s(E,M,a^*)}{e^{E^\prime /T}\pm 1}{\mathrm{d}}E, \end{aligned}$$
(21)

and the differential equation describing the angular momentum J is [24, 43, 44]Footnote 3

$$\begin{aligned} g(M,a^*)&\equiv -\dfrac{M}{a^*} \dfrac{{\mathrm{d}}J}{{\mathrm{d}}t} \nonumber \\&= -\dfrac{M}{a^*}\int _{0}^{+\infty } \sum _{{\mathrm{dof}}}\dfrac{m}{2\pi } \dfrac{\varGamma _s(E,M,a^*)}{e^{E^\prime /T}\pm 1}{\mathrm{d}}E. \end{aligned}$$
(22)

Once the \(f(M,a^*)\) and \(g(M,a^*)\) Page factors are obtained, the evolution of \(a^*\) is straightforwardly obtained through

$$\begin{aligned} \dfrac{{\mathrm{d}}a^*}{{\mathrm{d}}t}&= \dfrac{{\mathrm{d}}(J/M^2)}{{\mathrm{d}}t}\nonumber \\&= \dfrac{1}{M^2} \dfrac{{\mathrm{d}}J}{{\mathrm{d}}t} - 2\dfrac{J}{M^3}\dfrac{{\mathrm{d}}M}{{\mathrm{d}}t} \nonumber \\&= a^*\dfrac{2f(M,a^*) - g(M,a^*)}{M^3}. \end{aligned}$$
(23)

The computation of the \(f(M,a^*)\) and \(g(M,a^*)\) Page factors in BlackHawk is described in Appendix B.2.

2.3.3 Exotic Black Holes

Exotic BHs listed in Sect. 2.2.3 can have a modified evolution as compared to the Schwarzschild and Kerr cases, for two main reasons. First, since their greybody factors and temperature are different, the f and g parameters are expected to be different as well and the master Eq. (18) will give a different emission rate. Second, these BHs can possess other scalar degrees of freedom, such as a U(1) charge (e.g. the electric charge in Reissner–Nordström BHs [25]), which experience a specific evolution. Evolution equations for these additional charges have to be derived, and would be similar to Eqs. (21) and (22). The implementation of beyond-standard BHs in BlackHawk is described in Sect. 9.5.

2.4 Hadronization

The elementary particles emitted by BHs are not the final products of the HR. Some of them are unstable, others only exist in hadrons. A particle physics code has to be used in order to evolve the elementary particles into final products. We used HERWIG [45] and PYTHIA [46] for this purpose.

The final particles, hereby denoted as “secondary Hawking particles” (the elementary being the “primary Hawking particles”), depend on the cosmological context in which they are emitted. For Big-Bang Nucleosynthesis (BBN) studies, an estimation of the reaction rates imposes to keep the particles with a lifetime longer than \(\sim 10^{-8}\,\)s [47]. These particles are listed in the Table 2 of Appendix C.

The time-dependent comoving density of Hawking secondary particle j emitted by a distribution of BHs per units of time and energy is computed with the integral

$$\begin{aligned} \dfrac{{\mathrm{d}}^2 n_j}{{\mathrm{d}}t{\mathrm{d}}E} = \int \sum _{i} \dfrac{\mathrm{d}^2 n_i}{{\mathrm{d}}t{\mathrm{d}}E^\prime } \cdot \dfrac{{\mathrm{d}}N^i_j}{\mathrm{d}E}\, {\mathrm{d}}E^\prime \,, \end{aligned}$$
(24)

where the sum is taken over Hawking primary particles i, and Sect. Appendix B.3 describes how hadronization tables \(\mathrm{d}N_j^i(E^\prime ,E)\) have been computed to transform the primary spectra into secondary spectra in BlackHawk.

3 Content and compilation

This section describes the structure and file content of the code and explains its usage. BlackHawk is written in C and has been tested under Linux, Mac and Windows (using Cygwin64). It can be obtained from

blackhawk.hepforge.org

3.1 Main directory

The main directory contains:

  • the source codes BlackHawk_*.c containing the main routines,

  • a pre-built parameter file parameters.txt,

  • a compilation file Makefile,

  • a README.txt file containing general information about the code,

  • four folders src/, results/, manual/ and scripts/ that are described in the following.

3.2 src/ sub-folder

This folder contains:

  • a header file include.h containing the declaration of all routines along with the parameter structure struct param (see Sect. 4.1) and the numerical values of general quantities (units conversion factors, constants, particle masses...),

  • ten source files containing the definition of all the BlackHawk routines:

    • evolution.c,

    • general.c,

    • hadro_herwig.c,

    • hadro_pythia.c,

    • hadro_pythianew.c,

    • primary.c,

    • secondary.c,

    • spectrum.c,

    • technical.c

  • two compilation files Makefile and FlagsForMake,

  • a subfolder tables/ containing all the numerical tables which will be described in the following.

3.3 results/ sub-folder

This folder is designed to receive sub-folders of data generated by running the BlackHawk code (see Sect. 7).

3.4 manual/ sub-folder

This folder contains an up-to-date version of the present manual.

3.5 scripts/ sub-folder

This folder contains all the scripts used to compute the numerical tables mentioned in the following, as well as visualization scripts and a main program for SuperIso Relic [48,49,50]. These scripts can be used to generate the needed tables. They are accompanied by README.txt files explaining how to use them.

3.6 Compilation

The compilation of BlackHawk has been tested on Linux, Mac and Windows (using Cygwin64) distributions. The code is written in C99 standard. To compile the code, simply cd into the main directory and typeFootnote 4:

make BlackHawk_*

where * denotes tot or inst. This will create a library file libblackhawk.a and an executable BlackHawk_*.x. The compiler and compilation flags can be modified in Makefile if needed.

To run the code, cd to the main directory and typeFootnote 5:

./BlackHawk_*.x parameter_file

where parameter_file is the name of a parameter file. To compile only the library, just cd into the main directory and type:

make

4 Input parameters

In this section we describe how input parameters are handled in BlackHawk and their meaning.

4.1 Parameter structure

The input parameters used by BlackHawk are listed in the parameters.txt file. This file can be modified by the user and is saved for each new run of the code in the destination directory. A C structure has been defined in include.h to embed all the parameters:

figure a

Most routines described in Sect. 5 will use this structure as an argument in order to have an easy access to the run parameters. Depending on the choices of the parameters, some parameters can be irrelevant for a given run and will therefore not be taken into account, and no error message will be displayed for the irrelevant/unused parameters.

4.2 General parameters

The first set of parameters defines the general variables:

  • destination_folder is the name of the output folder that will be created in results/ to save run data.

  • full_output determines whether the shell output will be expanded (1) or not (0). It can be useful tp debug the code or to see the progress in time-consuming routines.

  • interpolation_method determines whether the interpolations in the tables are made linearly (interpolation between the tabulated values) or logarithmically (linear interpolation between the decimal logarithm of the tabulated values).

4.3 Black Hole spectrum parameters

The second set of parameters defines the quantities used to compute the BH density distribution (see Sect. 5.2):

  • BHnumber is the number of BH masses that will be simulated. If the parameter spectrum_choice is not set to 5, it has to be an integer greater than or equal to 1. If it is equal to 1, the only BH mass will be Mmin (see below). If the parameter spectrum_choice is set to 5, it has to be the number of tabulated values in the user-defined BH distribution (see below and Sect. 9.2). It will be automatically set to 1 if spectrum_choice is set to 0.

  • Mmin and Mmax are respectively the lowest and highest BH masses that will be simulated. They have to be given in grams and satisfy the condition \(M_{\mathrm{p}} \approx 2\times 10^{-5}\,\)g < Mmin, Mmax, where \(M_{\mathrm{p}}\) is the Planck mass. For a mass distribution, one must have Mmin < Mmax. If they are not compatible with boundaries of the mass distribution, the computation will stop (see below).

  • spectrum_choice selects the form of the BH mass distribution (see Sect. 2.1). It has to be an integer among 0 (Dirac, mimicking a single BHFootnote 6), 1 (log-normal), 2 (power-law), 3 (critical collapse), 4 (peak theory) and 5 (user-defined distribution, see below and Sect. 9.2).

  • amplitude is the amplitude A present in Eqs. (5)–(7). It is the normalization of the corresponding BH distribution and thus strictly positive.

  • variance is the variance \(\sigma \) in the log-normal distribution of Eq. (5). It has to be strictly positive.

  • crit_mass is the characteristic mass \(M_c\) in Eq. (5) and \(M_f\) in Eq. (7). It has to be strictly positive.

  • eq_state defines the equation of state w (see Sect. 2.1.3).

  • table is the name of a user-defined BH distribution table. It has to be a string with any file extension.

4.4 Black Holes evolution parameters

The next set of parameters defines the quantities used to compute the BHs evolution (see Sect. 5.3):

  • tmin is the initial integration time of the evolution of BH, in seconds. It can have any positive value, but we recommand that it is lower than the lifetime of the lightest BH under consideration.

  • nb_fin_times is the number of final integration times that will be used in the computations. It will be set automatically by the integration procedure.

  • limit is the iteration limit when computing the time evolution of a single BH (see Sect. 5.3). It is fixed to limit = 5000 even if the effective iteration numbers hardly reach 1000. It should be increased if the integration does not reach the complete evaporation of BHs.

  • Mmin_fM and Mmax_fM are the BH mass boundaries used to compute the \(f(M,a^*)\) and \(g(M,a^*)\) tables. They should not be modified unless the user recomputes the corresponding tables (see Sect. 9).

  • amin_fM and amax_fM are the BH spin boundaries used to compute the \(f(M,a^*)\) and \(g(M,a^*)\) tables. They should not be modified unless the user recomputes the corresponding tables (see Sect. 9).

  • nb_fM_masses and nb_fM_a are respectively the number of BH masses and spins tabulated in the \(f(M,a^*)\) and \(g(M,a^*)\) tables. They should not be modified unless the corresponding tables are recomputed (see Sect. 9).

4.5 Primary spectrum parameters

This set of parameters defines the quantities related to the primary Hawking spectra (see Sect. 5.4):

  • Emin and Emax are the minimum and maximum primary particle energies, respectively. They must be compatible with the table boundaries (see below) and satisfy \(0< \texttt {Emin} < \texttt {Emax}\).

  • Enumber is the number of primary particles energies that will be simulated. It has to be an integer greater than or equal to 2.

  • particle_number is the number of primary particle types. It is fixed to 15 (photon, gluon, \(\hbox {W}^\pm \) boson, \(\hbox {Z}^0\) boson, Higgs boson, neutrino, 3 leptons (electron, muon, tau) and 6 quarks (up, down, charm, strange, top, bottom)) and should not be modified unless the user recomputes the primary particle table (see Sect. 9).

  • grav determines whether the emission of gravitons by BH will be taken into account (grav = 1) or not (grav = 0).

  • nb_gamma_a and nb_gamma_x are respectively the number of spins \(a^*\) and values of \(x \equiv 2 \times E\times M\) tabulated in the greybody factor tables. They should not be modified unless the corresponding tables are recomputed (see Sect. 9).

4.6 Hadronization parameters

This last set of parameters defines the quantities used during the hadronization (see Sect. 5.5):

  • primary_only determines whether the secondary spectra will be computed or not. It has to be an integer between 0 (primary spectra only) and 1 (primary and secondary spectra). In the case where the parameters Emin and Emax are not compatible with the hadronization table boundaries (see below), a warning will be displayed and extrapolation used.

  • hadronization_choice determines which hadronization tables will be used to compute the secondary spectra (see Sect. Appendix B.3). It has to be an integer between 0 (PYTHIA tables – Early Universe/BBN epoch), 1 (HERWIG tables – Early Universe/BBN epoch) and 2 (new PYTHIA tables – present epoch).

  • Emin_hadro and Emax_hadro are the energy boundaries of the hadronization tables. They should not be changed unless the user recomputes the corresponding tables (see Sect. 9).

  • nb_init_en and nb_fin_en are the number of initial and final particle energy entries in the selected hadronization tables, respectively. They should not be modified unless the corresponding tables are recomputed (see Sect. 9).

  • nb_init_part and nb_fin_part are the number of primary and secondary particle types in the selected hadronization tables, respectively. They should not be modified unless the corresponding tables are recomputed (see Sect. 9).

5 Routines

Below are listed the main routines defined in BlackHawk. To simplify the analytic formulas, all intermediate quantities are in GeV (see Appendix A for conversion rules).

5.1 General routines

There are 4 general routines in the BlackHawk code. The principal ones are the main routines, described in Sect. 6. The other two are:

  • int read_params(struct param *parameters, char name[], int session): this routine reads the file name. The parameters are converted from CGS units to GeV. The user should respect the original syntax when modifying the parameters (concerning spaces, underscores, ...), except for comments which are preceded by a # symbol. It takes a pointer to a struct param object (see Sect. 4.1) as an argument and fills it using the file name. The argument session shows which of the main program has been launched (0 for BlackHawk_tot, 1 for BlackHawk_inst). If one parameter is not of the type described in Sect. 4 this function will display an error message. Any of these errors will end the BlackHawk run. If one parameter is in small contradiction with the others but the computation can still be partly done (e.g. only the primary spectra can be computed with the given parameters) a warning message will be displayed. In such case, the problematic parameters will be set automatically (e.g. primary_only = 1) and the computation will proceed.

  • int memory_estimation(struct param *parameters, int session): this routine gives a rough estimate of the usage of both RAM and disk space (see Sect. 8). If the user decides to cancel the run the value 0 is returned, otherwise it is 1. The output is given in MB.

5.2 Black Hole spectrum routines

There are 4 routines contributing to the BH initial spectrum computation (see Sect. 2.1):

  • void read_users_table(double *init_ masses, double *init_spins, double *spec_table, struct param *parameters): this routine reads auser-defined BH distribution table in the file given by the parameter table. It fills the arrays init_masses[], init_spins[] and spec_table[] with results converted from CGS units to GeV.

  • double nu(double M): this routine takes a BH mass as an argument and computes the dimensionless quantity \(\nu (M)\) defined in Eq. (3).

  • double n_cov(double M, double *table_ masses, double *table_codensities, int index, struct param *parameters): this routine takes a BH mass as an argument and computes the comoving density \(\dfrac{{\mathrm{d}}n}{{\mathrm{d}}M}\) defined in Eq. (2) (using the nu routine) or (5) or (6) or (7) (in \(\hbox {GeV}^{2}\) \(\rightarrow \) \(\hbox {cm}^{-3}\cdot \) \(\hbox {g}^{-1}\)), depending on the parameter spectrum_choice (see Sect. 4.3). If this parameter is set to 0, a flat distribution is used with only one BH mass, mimicking a Dirac distribution normalized to one BH per comoving \(\hbox {cm}^3\).

  • void spectrum(double *init_masses, double *init_spins, double *spec_table, double *table_masses, double *table_ codensities, struct param *parameters): this routine fills the array init_masses[] with BHnumber BH masses logarithmically distributed between Mmin and Mmax. If the parameter BHnumber is set to 1, the only BH initial mass will be Mmin. For each BH mass, it then fills the array init_spins[] with a spin a (the same for each mass) and the array spec_tables[] computing the corresponding comoving densities \({\mathrm{d}}n\) (in \(\hbox {GeV}^3\) \(\rightarrow \) \(\hbox {cm}^{-3}\)) using the n_cov routine where \({\mathrm{d}}M\) is taken around the considered mass. The result is rescaled by a factor \(10^{100}\) due to the very small numbers involved in the dimensionless computation.

  • void write_spectrum(double *init_ masses, double *init_spins, double *spec_table, struct param *parameters): this routine writes the BH initial masses, spins and comoving densities in a file BH_spectrum.txt, saved in destination_folder/ (see Sect. 7.1). The results are converted from GeV to CGS units.

5.3 Black Holes evolution routines

There are 6 routines contributing to the BH time evolution computation (see Sect. 2.3):

  • double rplus_BH(double M, double a): this routine gives the external Kerr radius of a rotating BH for a given mass M and spin \(a^*\) (see Sect. 2.2.2) (in \(\hbox {GeV}^{-1}\) \(\rightarrow \) cm);

  • double temp_BH(double M, double a): this routine gives the Hawking temperature of a Kerr BH for a given mass M and spin \(a^*\) using Eq. (17) (in GeV \(\rightarrow \) K).

  • void read_fM_table(double **fM_table, double *fM_masses, double *fM_a, struct param *parameters): this routine reads the \(f(M,a^*)\) factor (see Eq. (21)) in the table contained in the folder fM_tables/ (see Sect. Appendix B.2). It fills the arrays fM_masses[] (in GeV \(\rightarrow \) g), fM_a[] and fM_table[][] (in \(\hbox {GeV}^{4}\) \(\rightarrow \) \(\hbox {g}^3\cdot \) \(\hbox {s}^{-1}\)).

  • void read_gM_table(double **gM_table, double *fM_masses, double *fM_a, struct param *parameters): this routine reads the \(g(M,a^*)\) factor (see Eq. (22)) in the table contained in the folder fM_tables/ (see Sect. Appendix B.2). It fills the arrays fM_masses[] (in GeV \(\rightarrow \) g), fM_a[] and gM_table[][] (in \(\hbox {GeV}^{4}\) \(\rightarrow \) \(\hbox {g}^2\cdot \)GeV\(\cdot \) \(\hbox {s}^{-1}\)).

  • double loss_rate_M(double M, double a, double **fM_table, double *fM_masses, double *fM_a, int counter_M, int counter_a, struct param *parameters): this routine computes the quantity \(\dfrac{{\mathrm{d}}M}{{\mathrm{d}}t}\) defined in Eq. (21) (in \(\hbox {GeV}^2\) \(\rightarrow \) g\(\cdot \) \(\hbox {s}^{-1}\)).

  • double loss_rate_a(double M, double a, double **fM_table, double **gM_table, double *fM_masses, double *fM_a, int counter_M, int counter_a, struct param *parameters): this routine computes the quantity \(\dfrac{\mathrm{d}a^*}{{\mathrm{d}}t}\) defined in Eq. (23) (in GeV \(\rightarrow \) \(\hbox {s}^{-1}\)).

  • void life_evolution(double **life_ masses, double **life_spins, double *life_times, double *dts, int *evolu tion_length, double *init_masses, double *init_spins, double **fM_table, double **gM_table, double *fM_masses, double *fM_a, struct param *parameters): this routine computes the evolution of each of the initial BH masses in init_masses[] and BH spins in init_spins[]. The initial time life_times[0] is set to tmin, the initial masses life_masses[i][0] are set to init_masses[i] and the initial spins life_spins[i][0] are set to init_spins[i]. Iteratively, the next masses and spins are estimated using the Euler method

    $$\begin{aligned}&M(t+{\mathrm{d}}t) = M(t) + \dfrac{{\mathrm{d}}M}{{\mathrm{d}}t}{\mathrm{d}}t, \end{aligned}$$
    (25)
    $$\begin{aligned}&a^*(t + {\mathrm{d}}t) = a^*(t) + \dfrac{{\mathrm{d}}a^*}{{\mathrm{d}}t}{\mathrm{d}}t, \end{aligned}$$
    (26)

    where the derivatives are computed using the loss_ rate_* routines. If one of the relative variations is too large (\(|{\mathrm{d}}X/X| > 0.1\)) then the time interval is divided by 2. If all the variations are very small (\(|{\mathrm{d}}X/X| < 0.001\)), and if the current timestep is reasonable compared to the current timescale (\({\mathrm{d}}t/t\lesssim 1\)) then the time interval is multiplied by 2. Once the dimensionless spin reaches \(10^{-3}\), we stop computing its variation and simply set it to 0, and it does not enter anymore in the adaptive timesteps conditions. This goes on until each mass reaches the Planck mass or the recursion limit limit \(\times \) BHnumber is attained, in which case the following error is displayed

    figure b

    This may be a sign that the parameter limit should be increased. The intermediate time intervals \({\mathrm{d}}t\), times t, masses M and spins \(a^*\) are stored in the arrays dts[], life_times[] (both in \(\hbox {GeV}^{-1}\) \(\rightarrow \) s), life_masses [][] (in GeV \(\rightarrow \) g) and life_spins[][], respectively. The number of intermediate iterations for each initial mass is stored in the array evolution_length[].

  • void write_life_evolutions(double **life_masses, double **life_spins, double **life_times, int *evolution_ length, struct param *parameters): this routine writes the BH time-dependent masses and spins until full evaporation in the file life_evolutions. txt, saved in destination_folder/ (see Sect. 7.1). The results are converted from GeV to CGS units.

5.4 Primary spectra routines

There are 5 routines contributing to the computation of the primary Hawking spectra (see Sect. 2.2):

  • void read_gamma_tables(double ***gammas, double *gamma_a, double *gamma_x, struct param *parameters): this routine reads the quantities \(\varGamma /(e^{E^\prime /T}\pm 1)\), defined in Eq. (18), in the tables spin_*.txt in the folder gamma_tables/. It fills the arrays gamma_a[] and gamma_x[] with the tabulated spins \(a^*\) (dimensionless) and \(x\equiv Er_{\mathrm{BH}}\) (dimensionless \(\rightarrow \) GeV\(\cdot \)cm), respectively. It fills the array gammas[][][] with the corresponding dimensionless greybody factors in format [type][spin][x] (see Appendix B.1).

  • void read_asymp_fits(double ***fits, struct param *parameters): this routine reads the asymptotic fit parameters for the greybody factors, contained in the tables spin_*_fits.txt in the folder gamma_tables/. It fills the array fits[][][] in format [type][spin][parameters] (see Appendix B.1).

  • double dNdtdE(double E, double M, double a, int particle_index, double ***gammas, double *gamma_a, double *gamma_x, double ***fits, double *dof, double *spins, double *masses_primary, int counter_a, int counter_x, struct param *parameters): this routine computes the emission rate \(\mathrm{d}^2N/{\mathrm{d}}t{\mathrm{d}}E\) of the primary particle particle_index (see Eq. (18)), for a given particle energy E, the BH mass M, the BH spin a and the particle informations contained in dof[], spins[] and masses_primary[]. If \(x \equiv Er_{\mathrm{H}}\) is in the greybody factor boundaries, the values are interpolated in those tables at position counter_a and counter_x. Otherwise, we use the asymptotic fits tables (see Appendix B.1). The result is dimensionless (\(\rightarrow \) \(\hbox {GeV}^{-1}\cdot \) \(\hbox {s}^{-1}\)).

  • void instantaneous_primary_spectrum (double **instantaneous_primary_ spectra, double *BH_masses, double BH_spins, double *spec_table, double *energies, double ***gammas, double *gamma_a, double *gamma_x, double ***fits, double *dof, double *spins, double *masses_primary, struct param *parameters): this routine computes the instantaneous primary Hawking spectra for a distribution of BHs given by the routine spectrum, namely the quantity \(\dfrac{\mathrm{d}^2n}{{\mathrm{d}}t{\mathrm{d}}E}\) in Eq. (10) for each primary particle and each energy in energies[], computed with the routine dNdtdE. The results are stored in the array instantaneous_primary_spectra[][] in format [particle][energy].

  • void write_instantaneous_primary_ spectra(double **instantaneous_ primary_spectra, double *energies, struct param *parameters): this routine writes the instantaneous primary Hawking spectra in a file instantaneous_primary_spectra.txt, saved in destination_folder/ (see Sect. 7.2). The results are converted from GeV to CGS units.

5.5 Secondary spectra routines

There are 9 routines contributing to the computation of the secondary Hawking spectra (see Sect. 2.4):

  • void convert_hadronization_tables (double ****tables, double *initial_ energies, double *final_energies, struct param *parameters): this routine is auxiliary. It writes hardcoded versions of the hadronization tables (see Appendix B.3) in files hadronization_ tables_*.h in the tables/ subfolder in order to accelerate the code execution, while slowing its compilation.

  • void read_hadronization_tables(double ****tables, double *initial_energies, double *final_energies, struct param *parameters): this routine reads the hadronization table (see  Appendix B.3) determined by hadronization_choice. If HARDTABLES is defined, it uses the table included at compilation using the routines read_hadronization_*, otherwise it reads the corresponding table in the tables sub-folder. It fills the arrays initial_energies[] and final_energies[] with the tabulated primary particles and secondary particles energies (in GeV), respectively, and fills the array tables[][][][] with the corresponding branching ratios \(\dfrac{{\mathrm{d}}N_j^i}{{\mathrm{d}}E^\prime }\) in Eq. (24) (in \(\hbox {GeV}^{-1}\)) in format [secondary particle][initial energy][final energy][primary particle].

  • void total_spectra(double ***partial_ hadronized_spectra, double **partial_ primary_spectra, double **partial_ integrated_hadronized_spectra, double ****tables, double *initial_energies, double *final_energies, double ***primary_spectra, double *times, double *energies, double *masses_ secondary, struct param *parameters): this routine is a container that uses the “instantaneous” routines to compute the Hawking primary and secondary spectra at each timestep in times and writes it directly in the output in order to save RAM memory. To do so, it creates the output files *_primary_spectrum.txt and *_secondary_spectrum.txt (if primary_only is set to 0). Then, it fills the partial arrays partial_* with the instantaneous primary spectra, hadronized spectra and integrated spectra. Finally, it calls the routine write_lines to write the partial result in the output before moving to the next timestep.

  • void write_lines(char **file_names, double **partial_integrated_hadronized _spectra, double time, struct param *parameters): given a time and instantaneous primary and secondary spectra (if primary_only is set to 0), this routine writes a new line in the *_spectrum.txt files. The arrays write_*[] determine whether the values of each particles are written or not, thus potentially saving disc memory. Results are converted from GeV to CGS units (see Sect. 7.1).

  • double contribution_instantaneous (int j, int counter, int k, double **instantaneous_primary_spectra, double ****tables, double *initial_ energies, double *final_energies, int particle_type, int hadronization_ choice): this routine computes the instantaneous integrand of Eq. (24) (in \(\hbox {GeV}^{-1}\) \(\rightarrow \) \(\hbox {GeV}^{-2}\cdot \) \(\hbox {s}^{-1}\)) for the secondary particle particle_type, initial energy \(E^\prime =\) energies[j], corresponding tabulated initial energy initial_energies[counter] and final energy \(E =\) final_energies[k]. The sum over channels of production of the secondary particles may depend on the structure of the hadronization tables.

  • void hadronize_instantaneous(double ***instantaneous_hadronized_spectra, double ****tables, double *initial_ energies, double *final_energies, double **instantaneous_primary_ spectra, double *energies, struct param *parameters): this routine computes the instantaneous secondary Hawking spectra for all secondary particles, all initial energies in energies[] and all final energies in final_energies[]. It fills the array instantaneous_hadronized_spectra [][][] using the routine contribution_ instantaneous, in format [secondary particle][initial energy][final energy]. If the initial energy is not in the hadronization tables, the contribution is extrapolated.

  • void integrate_initial_energies_ instantaneous(double ***hadronized_ emission_spectra, double **integrated_ hadronized_spectra, double *energies, double *final_energies, struct param *parameters): this routine computes the integral Eq. (24) (dimensionless \(\rightarrow \) \(\hbox {GeV}^{-1}\cdot \) \(\hbox {s}^{-1}\)) using the trapeze routine. The results are stored in the array instantaneous_integrated_hadronized_ spectra [][] in format [secondary particle][final energy].

  • void add_*_instantaneous(double **instantaneous_primary_spectra, double **instantaneous_integrated_hadronized_spectra, double *energies, double *final_energies, struct param *parameters): these two routines add the contribution of the primary photons/neutrinos to the secondary produced ones. The value in term of final energies is interpolated in the primary spectrum and added to the hadronized spectrum instantaneous_integrated_hadronized_spectra[][].

  • void write_instantaneous_hadronized_spectra(double **instantaneous_integrated_hadronized_spectra, double *hadronized_energies, struct param *parameters): this routine writes the instantaneous secondary Hawking spectra in the file instantaneous_secondary_spectra.txt, saved in destination_folder/ (see Sect. 7.2). The results are converted from GeV to CGS units.

5.6 Auxiliary routines

8 auxiliary routines are used throughout the code:

  • double trapeze(double x1, double x2, double y1, double y2): this routine performs the trapeze integration of a function f that takes values y1 in x1 and y2 in x2 using

    (27)
  • void free*(*): these routines perform a proper memory freeing of \(n-\)dimensional arrays of various types, by recursively applying the native free routine.

  • int ind_max(double *table, int llength): this routine returns the index of the maximum of the array table[] of length llength.

6 Programs

The BlackHawk code is split into two programs, which are presented in this section:

  • BlackHawk_tot: full time-dependent Hawking spectra;

  • BlackHawk_inst: instantaneous Hawking spectra.

Once a set of parameters is chosen, the two programs can be launched in the same destination_folder/ because the output files will not enter in conflict (see Sect. 7). We will now describe the structure of the main routines together with screen output examples.

6.1 Common features

When running the BlackHawk code, some routines will be called regardless of the program choice. First, some general quantities are fixed (which are converted into GeV when applicable, see Appendix A):

  • machine_precision \(= 10^{-10}\) defines the precision up to which two double numbers are considered as equal.

  • G \(= 6.67408\times 10^{-11}\,\) \(\hbox {m}^3\cdot \) \(\hbox {kg}^{-1}\cdot \) \(\hbox {s}^{-2}\) is the Newton constant in SI units.

  • Mp \(\equiv G^{-1/2}\) is the Planck mass in the natural system of units.

  • m_* are the masses of the Standard Model particles (see Table 2 in Appendix C).

  • *_conversion are the quantities used to convert units from CGS/SI to GeV (see Appendix A).

The code runs in several steps, which are separated on the output screen. A new step starts with:

[main] : ***** ...

and ends with:

DONE

If the full_output parameter is set to 1, then more information will be displayed about the progress of the steps. In the case where information appears with the name of another routine inside brackets, it means that an error occurred.

The first common step is the definition and filling of the parameters structure using read_params. Then an estimation of the memory that will be used is displayed by memory_estimation. The user can choose to go on or to cancel the run (see Sect. 5.1). If no error was found in the input parameters, the output directory destination_folder/ is created. If it already exists, the user has the choice to overwrite the existing data or to stop the execution in order to choose another output folder. For a subsequent data interpretation, the parameters file is copied in the output folder. The expected output at this stage is of the formFootnote 7:

figure c

The subsequent execution steps depend on the program. Output examples are given in the mode full_output \(=0\).

6.2 BlackHawk_tot: Time-dependent Hawking spectra

In this program, BlackHawk computes the time-depen-dent Hawking spectra of a chosen initial distribution of BHs.

BlackHawk will compute the initial distribution of BHs (at tmin) using the routine spectrum or will read the user-defined BH distribution file table with the routine read_users_table (depending on the spectrum_choice), filling the arrays init_masses[], init_spins[] and spec_table[]. It writes the results in the output with write_spectrum (see Sect. 5.2).

It then reads the \(f(M,a^*)\) and \(g(M,a^*)\) tables using the read_fM_table and read_gM_table routines, resp-ectively, filling the arrays fM_table[][], gM_table[][], fM_masses[] and fM_a[], in order to evolve in time each initial BH spin and mass until the Planck mass limit using the routine life_evolution. This fills the arrays life_times[], life_masses[][], life_spins[][], dts[] and evolution_length[]. The evolutions in time are written in the output using the routine write_life_evolutions (see Sect. 5.3).

Then BlackHawk reads the greybody factor tables using the read_gamma_tables routine, filling the arrays gammas[][][], gamma_a[] and gamma_x[], and the fits tables using read_asymp_fits, filling the array fits[][][]. The common time range times[] is filled with the times in life_times[] until the evaporation of the last BH. This time range thus embeds all interesting intermediate evolution timesteps.

If the parameter primary_only has been set to 0, BlackHawk reads the suitable hadronization tables (depending on the hadronization_choice) with the routine read_hadronization_tables, filling the arrays tables[][][][], initial_energies[] and final_energies[]. It uses all these tables to compute the primary and secondary (if primary_only \(= 0\)) Hawking spectra using the routine total_spectra. Due to the large number of intermediate timesteps when a full distribution is considered, we do not perform the full computation in one step in the RAM memory, but rather do it timestep by timestep using the intermediate arrays partial_primary_spectra[][], partial_hadronized_spectra[][][] and partial_integrated_hadronized_spectra[][], and the instantaneous routines hadronize_instantaneous, integrate_initial_energies_instantaneous and add_*_instantaneous. The intermediate results are written in the output thanks to write_lines (see Sect. 5.5).

This is the end of the execution of BlackHawk_tot. The expected output is of the form:

figure d

6.3 BlackHawk_inst: Instantaneous Hawking spectra

In this program, BlackHawk computes the instantaneous Hawking spectra of a distribution of BHs.

First BlackHawk will compute the initial distribution of BHs (at tmin) using the routine spectrum or it will read the user-defined BH distribution file table with the routine read_users_table (depending on the spectrum_choice), filling the arrays init_masses[], init_spins[] and spec_table[]. It then writes the results in the output with write_spectrum (see Sect. 5.2).

Then BlackHawk reads the greybody factor tables using the routine read_gamma_tables, filling the arrays gammas[][][], gamma_masses[] and gamma_energies[] and the fit table with the routine read_asymp_fits, filling the array fits[][][], to compute the primary Hawking spectra using the routine instantaneous_primary_spectrum, filling the arrays instantaneous_primary_spectra[][]. The results are written in the output by the routine write_instantaneous_primary_spectra (see Sect. 5.4).

If the parameter primary_only has been set to 0, BlackHawk reads the hadronization tables (depending on the hadronization_choice) using the routine read_hadronization_tables, filling the arrays tables[][][][], initial_energies[] and final_energies[], and uses them to compute the secondary Hawking spectra using the routine hadronize_instantaneous, filling the array instantaneous_hadronized_spectra[][][].

The initial energy dependence of the spectra is integrated out with the routine integrate_initial_energies_instantaneous, which fills the array instantaneous_integrated_hadronized_spectra[][]. The contributions from primary photons and neutrinos are added to the secondary spectra by the routines add_*_instantaneous. The results are written in the output by the routine write_instantaneous_hadronized_spectra (see Sect. 5.5).

This is the end of the execution of BlackHawk_inst. The expected output is of the form:

figure e

7 Output files

As explained in the previous sections, all the output files generated by a run of BlackHawk will be stored in a destination_folder/. In this section we describe the format of these files created by each program. Examples of results can be found in Appendix D. In all the cases, the parameter file parameters.txt used for the run is copied in the output folder in order to allow for subsequent data interpretation.

Python vizualisation scripts have been incorporated in the sub-folder scripts/ in order to plot the data produced by both programs. They come with a file README.txt that explains how to configure them. You can of course modify these scripts to your own purpose or use any other plotting program.

7.1 BlackHawk_tot

Running BlackHawk_tot produces 4 (or 3) types of output files:

  • BH_spectrum.txt: this file is written by the routine write_spectrum. It contains the initial density spectrum of BHs and has 3 columns: the first one is a list of the BHs initial masses (in g), the second one the corresponding list of initial spins (dimensionless) and the third one is the comoving number densities (in \(\hbox {cm}^{-3}\)).

  • life_evolutions.txt: this file is written by the routine write_life_evolutions. It contains all the integrated timesteps for each initial BH mass. It includes a list of the number of integration timesteps for each initial BH mass. Also it contains a table in which the first column is the time (in s), and each other column is the evolution of the mass of a BH (in g) as a function of time. Finally it includes a table with the same format giving the evolution of the spins (dimensionless).

  • *_primary_spectrum.txt: these files are written by the routine write_lines. They contain the emission rates of each primary particle at each final time and for each simulated initial energy. The first line gives the list of energies (in GeV), the first column gives the list of times (in s), and each further column is the emission rate of the particle per unit energy, time and covolume (in \(\hbox {GeV}^{-1}\) \(\hbox {s}^{-1}\) \(\hbox {cm}^{-3}\)).

  • *_secondary_spectrum.txt: these files are also written by write_lines. They contain the emission rates of each secondary particles at each final times and for each simulated final energies. The first line gives the list of energies (in GeV), the first column gives the list of times (in s), and each other column is the emission rate of the particle per units of energy, time and covolume (in \(\hbox {GeV}^{-1}\) \(\hbox {s}^{-1}\) \(\hbox {cm}^{-3}\)). These files will not be generated if the parameter primary_only has been set to 1.

7.2 BlackHawk_inst

Running BlackHawk_inst produces 3 (or 2) output files:

  • BH_spectrum.txt: this file is written by the routine write_spectrum. It contains the initial density spectrum of BHs, and has 3 columns: the first one is a list of BHs initial masses (in g), the second one the corresponding list of initial spins (dimensionless) and the third one is the comoving number densities (in \(\hbox {cm}^{-3}\)).

  • instantaneous_primary_spectra.txt: this file is written by write_instantaneous_primary_spectra. It contains the emission rates of the primary particles for each simulated initial energy. The first line is the list of primary particles, the first column is the list of energies (in GeV), and each other column is the emission rate per unit energy and time (in \(\hbox {GeV}^{-1}\) \(\hbox {s}^{-1}\) \(\hbox {cm}^{-3}\)).

  • instantaneous_secondary_spectra.txt: this file is written by write_instantaneous_hadronized_spectra. It contains the emission rates of the secondary particles for each simulated final energy. The first line is the list of secondary particles, the first column is that of energies, and each other column is the emission rate per unit energy and time (in \(\hbox {GeV}^{-1}\) \(\hbox {s}^{-1}\) \(\hbox {cm}^{-3}\)). It will not be generated if the parameter primary_only has been set to 1.

8 Memory use

The code BlackHawk has been designed to minimize the memory used (both RAM and disk) and the computation time while avoiding excessive approximations. In this Section we give estimates of the memory used by each program.

8.1 RAM used

To every array defined in BlackHawk, a memory space is allocated with a malloc call. This memory is freed at the moment the array stops being necessary for the following part of the run. Then, the RAM used by BlackHawk at a given step of a session (corresponding to a paragraph in Sect. 6) can be estimated as a sum over all active arrays at that time. double are coded in 8 bytes and int in 4 bytes. Memory spaces M are given in bytes. For BlackHawk_tot we have:

  • step 1 (BH spectrum):

    • init_masses[] \(=\) 8 \(\times \) BHnumber

    • init_spins[] \(=\) 8 \(\times \) BHnumber

    • spec_table[] \(=\) 8 \(\times \) BHnumber

  • step 2 (BH evolution):

    • init_masses[] \(=\) 8 \(\times \) BHnumber

    • init_spins[] \(=\) 8 \(\times \) BHnumber

    • spec_table[] \(=\) 8 \(\times \)BHnumber

    • fM_table[][] \(=\) 8 \(\times \) nb_fM_a \(\times \) nb_fM_masses

    • gM_table[][] \(=\) 8 \(\times \) nb_fM_a \(\times \) nb_fM_masses

    • fM_masses[] \(=\) 8 \(\times \) nb_fM_masses

    • fM_a[] \(=\) 8 \(\times \) nb_fM_a

    • life_masses[][] \(=\) 8 \(\times \) BHnumber\(^2\) \(\times \) limit

    • life_spins[][] \(=\) 8 \(\times \) BHnumber\(^2\) \(\times \) limit

    • life_times[] \(=\) 8 \(\times \) BHnumber \(\times \) limit

    • dts[] \(=\) 8 \(\times \) BHnumber \(\times \) limit

    • evolution_length[] \(=\) 4 \(\times \) BHnumber

  • step 3 (primary and secondary spectra):

    • spec_table[] \(=\) 8 \(\times \) BHnumber

    • life_masses[][] \(=\) 8 \(\times \) BHnumber\(^2\) \(\times \) limit

    • life_spins[][] \(=\) 8 \(\times \) BHnumber\(^2\) \(\times \) limit

    • life_times[] \(=\) 8 \(\times \) BHnumber \(\times \) limit

    • dts[] \(=\) 8 \(\times \) BHnumber \(\times \) limit

    • evolution_length[] \(=\) 4 \(\times \) BHnumber

    • gammas[][][] = 8 \(\times \) 4 \(\times \) nb_gamma_a \(\times \) nb_gamma_x

    • gamma_a[] \(=\) 8 \(\times \) nb_gamma_a

    • gamma_x[] \(=\) 8 \(\times \) nb_gamma_x

    • fits[][][] \(=\) 8 \(\times \) 4 \(\times \) nb_gamma_a \(\times \) 7

    • dof[] \(=\) 8 \(\times \) (particle_number \(+\) grav)

    • spins[] \(=\) 8 \(\times \) (particle_number \(+\) grav)

    • masses_primary[] \(=\) 8 \(\times \) (particle_number \(+\) grav)

    • times[] \(\approx \) 8 \(\times \) limit \(\times \) BHnumber

    • energies[] \(=\) 8 \(\times \) Enumber

    • tables[][][][] \(=\) 8 \(\times \) nb_fin_part \(\times \) nb_init_en \(\times \) nb_fin_en \(\times \) nb_fin_part

    • initial_energies[] \(=\) 8 \(\times \) nb_init_en

    • final_energies[] \(=\) 8 \(\times \) nb_fin_en

    • partial_hadronized_spectra[][][] \(=\) 8 \(\times \) nb_fin_part \(\times \) Enumber \(\times \) nb_fin_en

    • partial_primary_spectra[][] \(=\) 8 \(\times \) (particle_number \(+\) grav) \(\times \) Enumber

    • partial_integrated_hadronized_spectra[][] \(=\) 8 \(\times \) nb_fin_part \(\times \) nb_fin_en

    • masses_secondary[] \(=\) 8 \(\times \) nb_fin_part

Using the parameters of  Appendix D.1, the arrays occupy at most \(\sim 150\,\)MB. For BlackHawk_inst we have:

  • step 1 (BH spectrum):

    • BH_masses[] \(=\) 8 \(\times \) BHnumber

    • BH_spins[] \(=\) 8 \(\times \) BHnumber

    • spec_table[] \(=\) 8 \(\times \) BHnumber

  • step 2 (primary spectra):

    • BH_masses[] = 8 \(\times \) BHnumber

    • BH_spins[] = 8 \(\times \) BHnumber

    • spec_table[] = 8 \(\times \) BHnumber

    • gammas[][][] = 8 \(\times \) 4 \(\times \) nb_gamma_a \(\times \) nb_gamma_x

    • gamma_a[] = 8 \(\times \) nb_gamma_a

    • gamma_x[] = 8 \(\times \) nb_gamma_x

    • fits[][][] = 8 \(\times \) 4 \(\times \) nb_gamma_a \(\times \) 7

    • dof[] = 8 \(\times \) (particle_number + grav)

    • spins[] = 8 \(\times \) (particle_number + grav)

    • masses_primary[] = 8 \(\times \) (particle_number + grav)

    • instantaneous_primary_spectra[][] = 8 \(\times \) (particle_number + grav) \(\times \) Enumber

    • energies[] = 8 \(\times \)Enumber

  • step 3 (during hadronization):

    • instantaneous_primary_spectra[][] = 8 \(\times \) (particle_number + grav) \(\times \) Enumber

    • energies[] = 8 \(\times \) Enumber

    • tables[][][][] = 8 \(\times \) nb_fin_part \(\times \) nb_init_en \(\times \) nb_fin_en \(\times \) nb_fin_part

    • initial_energies[] = 8 \(\times \) nb_init_en

    • final_energies[] = 8 \(\times \) nb_fin_en

    • masses_secondary[] = 8 \(\times \) nb_fin_part

    • instantaneous_hadronized_spectra[][][] = 8 \(\times \) nb_fin_part \(\times \) Enumber \(\times \) nb_fin_en

  • step 3 bis (during integration):

    • instantaneous_primary_spectra[][] = 8 \(\times \) (particle_number + grav) \(\times \) Enumber

    • energies[] = 8 \(\times \) Enumber

    • initial_energies[] = 8 \(\times \) nb_init_en

    • final_energies[] = 8 \(\times \) nb_fin_en

    • instantaneous_hadronized_spectra[][][] = 8 \(\times \) nb_fin_times \(\times \) Enumber \(\times \) nb_fin_en

    • instantaneous_integrated_hadronized_spectra[][] = 8 \(\times \) nb_fin_part \(\times \) nb_fin_en

Using the parameters of Appendix D.1, the arrays occupy at most \(\sim 10\,\)MB.

8.2 Static disk memory used

The output generated is written in .txt files using a precision of 5 significant digits. Adding the exponent and the coma, we get to 12 characters per written number, which is 12 bytes. For BlackHawk_tot we have:

  • file BH_spectrum.txt: M = 12 \(\times \) 3 \(\times \) BHnumber.

  • file life_evolutions.txt: M \(\approx \) 4 \(\times \) 3 \(\times \) BHnumber + 12 \(\times \) 2 \(\times \) BHnumber\(^2\) \(\times \) 1000 where an average number of 1000 iterations for the mass integration of BHs has been assumed.

  • files *_primary_spectrum.txt: M = 12 \(\times \) (particle_number + grav) \(\times \) Enumber \(\times \) 1000 \(\times \) BHnumber where an average number of 1000 iterations for the mass integration of BHs has been assumed.

  • files *_secondary_spectrum.txt: M = 12 \(\times \) nb_fin_part \(\times \) nb_fin_en \(\times \) 1000 \(\times \) BHnumber where an average number of 1000 iterations for the mass integration of BHs has been assumed.

Using the parameters of Appendix D.1, the total written disk space is \(\sim 230\,\)MB. For BlackHawk_inst we have:

  • file BH_spectrum.txt: M = 12 \(\times \) 3 \(\times \) BHnumber.

  • file instantaneous_primary_spectra.txt: M = 12 \(\times \) Enumber \(\times \) (particle_number + grav).

  • file instantaneous_secondary_spectra.txt: M = 12 \(\times \) nb_fin_en \(\times \) nb_fin_part.

Using the parameters of Appendix D.1, the total written disk space is \(\sim 35\,\)kB.

9 Other applications

In this Section we present some hints on how to modify BlackHawk. Most of these modifications will require add-ons in the file parameters.txt and thus a modification of the routine read_params and of the structure struct param.

9.1 Computing new numerical tables

The user may be interested in recomputing the tables described in Appendix B, either to have more entries or to compute them with different methods for comparison. The easiest way to add tables in BlackHawk would be:

  • authorize the corresponding “choice” parameters to have other integer values;

  • put the new tables in a new directory in the tables/ sub-folder;

  • add a switch into the tables reading routines;

  • make sure that the way tables are used in the routines will be compatible with the format of the new ones.

All the scripts used to compute the current tables are included in BlackHawk in the sub-folder scripts/ together with README.txt files.

9.2 Using another Black Hole mass function

The user may be interested in testing its own BH distribution. Here are the main steps to add a pre-built distribution:

  • add a “choice” parameter to the struct param choosing the distribution,

  • add the corresponding analytical formula to the routine n_cov or tabulated values in the sub-folder tables/,

  • modify the parameter tmin if the distribution is valid at a different initial time.

Providing a tabulated initial distribution to BlackHawk is done by switching the parameter spectrum_choice to 5, putting the table file in the sub-folder users_spectra/ and giving its full file name (including the extension) to the parameter table. The format has to be:

  • three same-length columns, the first one for BHs masses M, the second one for BHs spins \(a^*\) and the third one for the comoving number densities \({\mathrm{d}}n(M)\) (with \({\mathrm{d}}M\) taken around M),

  • masses and densities in CGS units (g and \(\hbox {cm}^{-3}\) respectively), spins in dimensionless form,

  • numbers in standard scientific notation,

  • no additional text.

9.3 Adding primary particles

If the user wants to add hypothetical primary Hawking particles, the following steps have to be undertaken:

  • enhance the parameter particle_number or add the new particle(s) with a switch similar to the one of the graviton,

  • recompute the \(f(M,a^*)\) and \(g(M,a^*)\) tables to account for this(ese) new emission(s),

  • if the spin(s) of the new particle(s) is(are) not among the greybody factor tables, compute the new ones,

  • add the new particle(s) to all the fixed length arrays of particle types (e.g. the file names or columns in the writing routines),

  • eventually add its(their) contribution(s) to the secondary spectra.

9.4 Adding secondary particles

In order to add secondary Hawking particles to the code, one has to:

  • recompute the hadronization tables to take new branching ratios into account,

  • add the new particle(s) to all the fixed length arrays of particle types (e.g. the file names or columns in the writing routines),

  • add the corresponding contribution(s) to the routine contribution_instantaneous.

9.5 Other types of Black Holes

If the user wants to compute the Hawking emission of BHs different from the Schwarzschild or Kerr ones, several ingredients are needed:

  • add a switch to the parameter file to select amongst the new types of BHs,

  • modify/add the Hawking temperature function temp_BH for these BHs,

  • modify/add evolution routines loss_rate_* and life_evolution (e.g. for charged BHs a routine loss_rate_Q for the evolution of the charge parameter Q),

  • compute the corresponding f, g and eventually new evolution parameters tables and add the corresponding reading routines (e.g. for charged BHs a routine read_hM_table to read the \(q(M,a^*,Q)\) table where q would describe the evolution of the electric charge Q),

  • compute the new greybody factors tables and update the corresponding reading and interpolating routines read_gamma_tables, read_gamma_fits and dNdtdE.

Depending on the complexity of the BH model, the user may need to implement some or all of the above modifications.

10 Conclusion

BlackHawk is the first public code generating both primary and secondary Hawking radiation spectra for any mass distribution of Schwarzschild and Kerr Black Holes, and their evolution in time. The primary spectra are obtained using greybody factors, and the secondary ones result from the decay and hadronization of the primary particles. The Black Hole and spectrum evolutions are obtained by considering the energy loss via Hawking radiation and the subsequent modification of the temperature of the Black Hole. BlackHawk is designed in a user-friendly way and modifications can be easily implemented. The prime application is to study the effects of particles generated by Hawking radiation on observable quantities and thus to disqualify or set constraints on cosmological models involving the formation of Black Holes, as well as to test the Hawking radiation assumptions and study Black Hole general properties.