jesterTOV.utils.calculate_rest_mass_density

jesterTOV.utils.calculate_rest_mass_density#

calculate_rest_mass_density(e, p)[source]#

Compute rest-mass density from energy density and pressure.

This function solves the first law of thermodynamics to obtain the rest-mass density (baryon density) from the energy density and pressure. The relation is given by:

\[\frac{d\rho}{d\varepsilon} = \frac{\rho}{p + \varepsilon}\]

where \(\rho\) is the rest-mass density, \(\varepsilon\) is the energy density, and \(p\) is the pressure.

Parameters:
  • e (Float[Array, "n"]) – Energy density array [geometric units]

  • p (Float[Array, "n"]) – Pressure array [geometric units]

Returns:

Array – Rest-mass density array [geometric units]

Notes

This function uses diffrax for ODE integration and may have compatibility issues with some diffrax versions. The initial condition assumes \(\rho(\varepsilon_0) = \varepsilon_0\).