abundances

class abundances.AbundanceModel(nuclear_net, weak_rates=WeakRates(RC_corr=True, thermal_corr=True, FM_corr=True, weak_mag_corr=True, T_nTOp_thermal_interval=f64[50](numpy), T_pTOn_thermal_interval=f64[50](numpy), L_nTOpCCRTh_res=f64[50](numpy), L_pTOnCCRTh_res=f64[50](numpy)), throw=True)[source]

Bases: Module

Abundance model and BBN abundance prediction.

nuclear_net

Nuclear network to be used for BBN prediction.

Type:

NuclearRates

weak_rates

Weak rates for neutron-proton interconversion.

Type:

WeakRates

species_dict

Dictionary of species considered in LINX.

Type:

dict

species_Z

Number of protons in each species.

Type:

list

species_N

Number of neutrons in each species.

Type:

list

species_A

Atomic mass number of each species.

Type:

list

species_excess_mass

Excess mass (mass - A*amu) of each species.

Type:

list

species_spin

Spin of each species.

Type:

list

species_binding_energy

Binding energy of each species.

Type:

list

throw

Whether to raise exceptions on solver failure.

Type:

bool

YNSE(Yn, Yp, T, eta, me=0.51099895)[source]

Nuclear statistical equilibrium yields for all species.

Parameters:
  • Yn (float) – The yield \(n_n / n_b\) of free neutrons.

  • Yp (float) – The yield \(n_p / n_b\) of free protons.

  • T (float) – The temperature of the baryons in MeV.

  • eta (float) – The baryon-to-photon ratio.

  • me (float, optional) – Electron mass in MeV. Defaults to const.me

Returns:

Yields for all species considered in LINX (13 of them).

Return type:

array

Y_prime(t, Y, args)[source]

Returns \(dY_i/dt\) for this abundance model.

Parameters:
  • t (float) – Time at which to evaluate \(dY_i/dt\).

  • Y (array) – Array of abundances for evaluating \(dY_i/dt\).

  • args (tuple of arrays) – Other relevant information for evaluating the derivative. These are respectively, 0) an array of scale factors; 1) an array of times; 2) an array of EM sector temperatures; 3) an array representing the abscissa of EM sector temperatures for evaluating weak rates; 4) an array of n -> p rates to interpolate over; 5) an array of p -> n rates to interpolate over; 6) the rescaling factor for baryon-to-photon ratio eta_fac; 7) the rescaling factor for neutron decay lifetime tau_n_fac and 8) the array rescaling nuclear rates, nuclear_rates_q.

Returns:

\(dY_i/dt\) at the given time and at the present abundance levels.

Return type:

array

__call__(rho_g_vec, rho_nu_vec, rho_NP_vec, P_NP_vec, a_vec=None, t_vec=None, eta_fac=Array(1., dtype=float64, weak_type=True), tau_n_fac=Array(1., dtype=float64, weak_type=True), nuclear_rates_q=None, me=0.51099895, Y_i=None, T_start=None, T_end=None, sampling_nTOp=150, rtol=1e-06, atol=1e-09, solver=Kvaerno3(   scan_kind=None, root_finder=VeryChord(     rtol=<tolerance taken from `diffeqsolve(..., stepsize_controller=...)` argument>, atol=<tolerance taken from `diffeqsolve(..., stepsize_controller=...)` argument>, norm=<tolerance taken from `diffeqsolve(..., stepsize_controller=...)` argument>, kappa=0.01, linear_solver=AutoLinearSolver(well_posed=None)   ), root_find_max_steps=10 ), max_steps=4096, save_history=False)[source]

Calculate BBN abundance.

Parameters:
  • rho_g_vec (array) – Energy density of photons in MeV^4.

  • rho_nu_vec (array) – Energy density of a single neutrino species in MeV^4 (all neutrinos assumed to have the same temperature).

  • rho_NP_vec (array) – Energy density of all new physics particles in MeV^4.

  • P_NP_vec (array) – Pressure of all new physics particles in MeV^4.

  • a_vec (array, optional) – Scale factor. If None, will be computed in function.

  • t_vec (array, optional) – Time in seconds. If None, will be computed in function.

  • eta_fac (float, optional) – Rescaling factor for baryon-to-photon ratio, 1 for fiducial value in const.eta0 (or const.Omegabh2).

  • tau_n_fac (float, optional) – Rescaling factor for neutron decay lifetime, 1 for fiducial value in const.tau_n.

  • nuclear_rates_q (array, optional) – q ~ N(0,1) specifies the nuclear rate in its log-normal distribution. If not specified, will be taken to be q = 0.

  • me (float, optional) – Electron mass in MeV. Defaults to const.me.

  • Y_i (tuple of float, optional) – Initial abundances \(n_i/n_b\) for species. Length must be equal to self.nuclear_net.max_i_species. Must specify T_start and T_end if not None.

  • T_start (float) – Temperature in MeV to start integration. Must specify Y_i and T_end if not None, otherwise const.T_start used.

  • T_end (float) – Temperature in MeV to end integration.

  • sampling_nTOp (int) – Number of points to subdivide (T_end, T_start) for neutron-proton interconversion rate interpolation table.

  • rtol (float, optional) – Relative tolerance of the abundance solver. Default is 1e-4.

  • atol (float, optional) – Absolute tolerance of the abundance solver. Default is 1e-9.

  • max_steps (int, optional) – Maximum number of steps taken by the solver. Default is 4096. Increasing this slows down the code, while decreasing this could mean that the solver cannot complete the solution.

  • solver (Diffrax ODE solver) – The Diffrax ODE solver to use. A stiff solver is recommended. Default is the 3rd order Kvaerno solver.

  • save_history (bool) – If True, full solution is returned with temperature and time abscissa.

Returns:

If save_history is set to True, a tuple containing an array of EM temperatures, an array of times, and a Diffrax Solution instance, which can be called as a function of time. Otherwise, returns yields of all species considered in self.nuclear_net.

Return type:

tuple of array or array

get_a(rho_g_vec, rho_nu_vec, rho_NP_vec, P_NP_vec)[source]

Scale factor.

Parameters:
  • rho_g_vec (array) – Energy density of photons.

  • rho_nu_vec (array) – Energy density of one species of neutrinos (assumed identical for all species).

  • rho_NP_vec (array) – Energy density of all new physics fluids.

  • P_NP_vec (array) – Pressure of all new physics fluids.

Returns:

Array of scale factors corresponding to physical parameters above.

Return type:

array

Notes

The final entry a[-1] is given by const.T0CMB / T_gamma[-1], where const.T0CMB is the CMB temperature measured today, and T_gamma[-1] is the temperature of photons in the last entry of rho_g_vec. In other words, we assume no subsequent entropy dump in the electromagnetic sector.

get_t(rho_g_vec, rho_nu_vec, rho_NP_vec, P_NP_vec)[source]

Time elapsed.

Parameters:
  • rho_g_vec (array) – Energy density of photons.

  • rho_nu_vec (array) – Energy density of one species of neutrinos (assumed identical for all species).

  • rho_NP_vec (array) – Energy density of all new physics fluids.

  • P_NP_vec (array) – Pressure of all new physics fluids.

Returns:

Array of times in seconds corresponding to physical parameters above. Initial time taken to be 1 / (2H).

Return type:

array