polytrope EOS solver
Functions to compute polytrope Equation of state from given parameters.
- EOSgenerators.Polytrope_EOS.compute_EOS(rhos, theta, rho_t_start=0.0012463097241917458, P_t_start=2.4572783742936653e-06)[source]
Calculate the pressure of a neutron star based on density using a piecewise polytropic equation of state (EOS).
This function computes the pressure (pres) as a function of density (rho) by applying different polytropic indices (gamma_1, gamma_2, …, gamma_n) within specified density thresholds (rho_t_start, rho_t_1, rho_t_2, …, rho_t_n-1). The EOS is defined in n distinct regions:
Low-density region: rho_t_start < rho <= rho_t_1
Intermediate-density region: rho_t_1 < rho <= rho_t_2, …, rho_t_k < rho <= rho_t_k+1, …, rho_t_n-2 < rho <= rho_t_n-1
High-density region: rho > rho_t_n-1
- Parameters:
rho (array-like) – An array of density values (in cgs units) at which to calculate the pressure.
theta (array-like, length 2 * n - 1) –
A list or tuple containing the EOS parameters in the following order:
gamma_1 (float): Polytropic index for the low-density region.
gamma_2 to gamma_2_n-1 (float): Polytropic index for the intermediate-density region.
gamma_n (float): Polytropic index for the high-density region.
rho_t_1 (float): Density threshold between the low and intermediate-density regions (in cgs units).
rho_t_2 to rho_t_n-2 (float): Density for the intermediate regions (in cgs units).
rho_t_n-1 (float): Density threshold between the intermediate and high-density regions (in cgs units).
rho_t_start (float) – Start point of the density for polytropic EOS
P_t_start (float) – Start point of the pressure for polytropic EOS
- Returns:
pres – An array of pressure values (in cgs units) corresponding to the input density values.
- Return type:
ndarray
- EOSgenerators.Polytrope_EOS.fun_gamma_max(rho2, rho1, p1)[source]
Outputs the maximum gamma for given densities and pressure at both ends of a section of polytropic function. :param rho2: density at the end point. :type rho2: float :param rho1: density at the start point. :type rho1: float :param p1: pressure at the start point. :type p1: float
- Returns:
the maximum gamma.
- Return type:
gamma_max (float)