Help on class TOV in module slmemulator.TOV_class:
class TOV(builtins.object)
| TOV(
| eos_filepath=None,
| tidal=False,
| solver='RK4',
| solve_ivp_kwargs=None,
| sol_pts=4000
| )
|
| Methods defined here:
|
| RK2(self, f, x0, t0, te, N)
| A simple RK2 solver using the Heun's method.
| This is a low-fidelity solver.
|
| Example:
| tov.RK2(f=func, x0=1., t0=1., te=10., N=100)
|
| Parameters:
| f (func): A Python function for the ODE(s) to be solved.
| Able to solve N coupled ODEs.
|
| x0 (float): Guess for the function(s) to be solved.
|
| t0 (float): Initial point of the grid.
|
| te (float): End point of the grid.
|
| N (int): The number of steps to take in the range (te-t0).
|
| Returns:
| times (array): The grid of solution steps.
|
| solution (array): The solutions of each function
| at each point in the grid.
|
| RK4(self, f, x0, t0, te, N)
| A simple RK4 solver to avoid overhead of
| calculating with solve_ivp or any other
| adaptive step-size function.
|
| Example:
| tov.RK4(f=func, x0=1., t0=1., te=10., N=100)
|
| Parameters:
| f (func): A Python function for the ODE(s) to be solved.
| Able to solve N coupled ODEs.
|
| x0 (float): Guess for the function(s) to be solved.
|
| t0 (float): Initial point of the grid.
|
| te (float): End point of the grid.
|
| N (int): The number of steps to take in the range (te-t0).
|
| Returns:
| times (array): The grid of solution steps.
|
| solution (array): The solutions of each function
| at each point in the grid.
|
| __init__(
| self,
| eos_filepath=None,
| tidal=False,
| solver='RK4',
| solve_ivp_kwargs=None,
| sol_pts=4000
| )
| Class to calculate the Tolman-Oppenheimer-Volkoff equations,
| including options for the tidal deformability and moment of
| inertia using RK4. Also includes uncertainty quantification
| techniques through the highest posterior density interval (HPD
| or HDI) calculation. Able to accept one EOS from a single curve
| or draws from an EOS, such as from a Gaussian Process.
|
| Example:
| tov = TOVSolver(eos_filepath='path/to/eos', tidal=True, moment=True)
|
| Parameters:
| eos_filepath (str): The path to the EOS data table to be used.
|
| tidal (bool): Whether to calculate tidal deformability or not.
| Default is False.
|
| moment (bool): Whether to calculate moment of inertia or not.
| Default is False.
|
| Returns:
| None.
|
| canonical_NS_radius(self)
| Calculation of the radius of a 1.4 M_sol neutron star.
|
| Example:
| tov.canonical_NS_radius()
|
| Parameters:
| None.
|
| Returns:
| rad_14 (array): The array of values of the radius
| for each EOS used.
|
| central_dens(self, pres_arr=None)
| Calculation to determine the central density of the star
| at the maximum mass and radius determined from the tov_routine().
|
| Example:
| tov.central_dens()
|
| Parameters:
| pres_arr (array): An optional pressure array to use for
| calculating central densities at places other
| than the absolute TOV maximum mass of each curve.
| Default is None, and code will use absolute TOV
| maximum mass central pressure class array.
|
| Returns:
| c_dens (array): The array of central densities for
| each EOS used.
|
| euler(self, f, x0, t0, te, N)
| A simple forward euler solver to avoid overhead of
| calculating with solve_ivp or any other
| adaptive step-size function.
| This is a low fidelity solver!
|
| Example:
| tov.euler(f=func, x0=1., t0=1., te=10., N=100)
|
| Parameters:
| f (func): A Python function for the ODE(s) to be solved.
| Able to solve N coupled ODEs.
|
| x0 (float): Guess for the function(s) to be solved.
|
| t0 (float): Initial point of the grid.
|
| te (float): End point of the grid.
|
| N (int): The number of steps to take in the range (te-t0).
|
| Returns:
| times (array): The grid of solution steps.
|
| solution (array): The solutions of each function
| at each point in the grid.
|
| f_x(self, x, mass, pres, eps)
| A function in the tidal deformability calculation.
|
| Example:
| tov.f_x(x=0.2, mass=1.06, pres=2.34, eps=6.0)
|
| Parameters:
| x (float): The current gridpoint in scaled radius.
|
| mass (float): The current mass.
|
| pres (float): The current pressure from the EOS.
|
| eps (float): The current energy density from the EOS.
|
| Returns:
| The value of F(x) at the current radius.
|
| max_arrays(self)
| Returns the max arrays needed for the interval calculation.
|
| Parameters:
| None.
|
| Returns:
| self.max_radius_arr (array): Maximum radius array.
| self.max_pres_arr (array): Maximum central pressure array.
| self.max_mass_arr (array): Maximum mass array.
|
| q_x(self, x, mass, pres, eps, cs2)
| A function in the calculation of the tidal deformability.
|
| Example:
| tov.q_x(x=0.1, mass=2.0, pres=1.0, eps=3.0, cs2=0.33)
|
| Parameters:
| x (float): The current gridpoint in scaled radius.
|
| mass (float): The current mass.
|
| pres (float): The current pressure from the EOS.
|
| eps (float): The current energy density from the EOS.
|
| cs2 (float): The current speed of sound from the EOS.
|
| Returns:
| The value of Q(x) at the current radius.
|
| tidal_def(self, yR, mass, radius)
| The calculation of the tidal deformability, Lambda, and
| the tidal Love number, k2. This function is calculated after
| the RK4 routine has been completed.
|
| Example:
| tov.tidal_def(yR=np.array, mass=np.array, radius=np.array)
|
| Parameters:
| yR (float): The array of y at the maximum radii points.
|
| mass (float): The array of mass at the maximum radii.
|
| radius (float): The maximum radii array.
|
| Returns:
| tidal_deform (array): The tidal deformability solved at
| each point in the maximum radius.
|
| k2 (array): The value of the Love number calculated at the
| compactness M/R and the value of y at maximum radius.
|
| tov_equations_scaled(self, x, y0)
| The Tolman-Oppenheimer-Volkoff equations in scaled format, to be
| solved with the RK4 routine. If selected, the tidal deformability
| and moment of inertia will be included and solved
| simultaneously.
|
| Example:
| tov.tov_equations_scaled(x=0.2,
| y0=[m_init, p_init])
|
| Parameters:
| x (float): A point in the scaled radius grid.
|
| y0 (list): The list of initial guesses for each function
| solved.
|
| Returns:
| The solutions, in array format, of each function to be
| solved.
|
| tov_routine(self, verbose=False, write_to_file=False)
| The TOV routine to solve each set of coupled ODEs and to output
| the quantities needed to display the M-R curve, as well as the
| tidal deformability and moment of inertia if desired.
|
| Example:
| tov.tov_routine(verbose=True, write_to_file=True)
|
| Parameters:
| verbose (bool): Whether to plot quantities and display
| the full maximum mass array. Default is False.
|
| write_to_file (bool): Choice to write the TOV results to
| a file located in a folder of the user's choice.
| Default is False.
|
| Returns:
| self.total_radius (array): The array of total maximum
| radius values.
|
| self.total_pres_central (array): The array of total
| central pressure values.
|
| self.total_max_mass (array): The array of total
| maximum mass values.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object