Solve TOV Equation
Function to solve the TOV equation from EOS equation of state given by user.
- TOVsolver.solver_code.TOV_def(r, y, inveos, ad_index)[source]
Right-hand side of the TOV + tidal ODE system.
- Parameters:
r (float) – raius as integrate varible
y (psudo-varible) – containing pressure, mass, h and b as intergarte varibles
equation (to solve out the TOV)
inveos – the invert of the eos, pressure and energy density relation to integrate
interpolate. (and)
- Returns:
Derivatives [dP/dr, dm/dr, dh/dr, df/dr].
- Return type:
- TOVsolver.solver_code.m1_from_mc_m2(mc, m2)[source]
a function that feed back the companion star mass from GW event measurement.
- Parameters:
mc (float) – chrip mass of a GW event, unit in solar mass.
m2 (float or numpy array) – the determined mass for one of the star, this is computed from sampling of EoS.
- Returns:
the companion star mass in solar mass.
- Return type:
m1 (array)
- TOVsolver.solver_code.solveTOV(center_rho, Pmin, eos, inveos, max_radius=3e+19)[source]
Solve the Tolman-Oppenheimer-Volkoff (TOV) equation to determine the structure of a neutron star
This function numerically integrates the TOV equations from the center outward to find the mass and radius of a neutron star with a given central density and equation of state. The integration uses an adaptive step size method to ensure numerical stability, especially near the surface where pressure gradients become steep.
- Parameters:
center_rho (float) – The central energy density of the neutron star in unit.g_cm_3
Pmin (float) – Minimum pressure threshold that defines the star’s surface, in unit.G / unit.c**4
eos (function) – Function mapping energy density to pressure (ρ → P) Takes energy density in unit.G / unit.c**2, returns pressure in unit.G / unit.c**4
inveos (function) – Inverse equation of state, function mapping pressure to energy density (P → ρ)
max_radius (float, optional) – Safety parameter to prevent runaway integration in case the star’s surface is not properly detected. Defaults to 30e5*unit.cm
- Returns:
- (mass_Msun, radius_km)
Mass is in solar masses; radius is in kilometers.
- Return type:
tuple[float, float]
Notes
Integration begins at a small non-zero radius (r = 1e-18 * unit.cm) to avoid the coordinate singularity at r=0
Initial pressure is calculated using a Taylor expansion around r=0 since the TOV equation has an indeterminate form (0/0) at the origin
We use adaptive step sizing for numerical stability
Multiple stopping conditions ensure robustness against EoS-related numerical issues
- TOVsolver.solver_code.solveTOV_tidal(center_rho, energy_density, pressure, max_radius=3e+19)[source]
Solve TOV equation from given Equation of state in the neutron star core density range
- Parameters:
center_rho (array) – This is the energy density here is fixed in main that is np.logspace(14.3, 15.6, 50)
energy_density (array) – Desity array of the neutron star EoS, in MeV/fm^{-3}. Notice here for simiplicity, we omitted G/c**4 magnitude, so (value in MeV/fm^{-3})*G/c**4, could convert to the energy density we are using, please check the Test_EOS.csv to double check the order of magnitude.
pressure (array) – Pressure array of neutron star EoS, also in nautral unit with MeV/fm^{-3}, still please check the Test_EOS.csv, the conversion is (value in dyn/cm3)*G/c**4.
- Returns:
- (mass_Msun, radius_km, tidal_deformability)
Tidal deformability is dimensionless.
- Return type:
tuple[float, float, float]
- TOVsolver.solver_code.tidal_deformability(y2, Mns, Rns)[source]
Compute Tidal deformability from y2, neutron star mass and raius
- Parameters:
y2 (array) – midiate varrible that computing tidal
Mns (array) – neutron star mass in g/cm3
Rns (array) – neutron star radius in cm.
- Returns:
neutron star tidal deformability with unit-less.
- Return type:
tidal_def (array)