InterfaceΒΆ

There are two classes to represent spherical neutron stars. The most important is spherical_star_properties, which collects scalar measures and the EOS. A derived class, spherical_star, additionally provides the radial profiles describing metric and matter distribution.

There are different TOV solver functions for different use cases. One can either just extract global scalar measures, or also obtain the radial profiles found during the solution process. If profiles are not needed, one should use the first variant, which saves memory and computational costs since no interpolation tables have to be set up.

The function returning only global properties is called get_tov_properties() and the one returning everything is called get_tov_star().

To control the accuracy, there is a class star_accuracy_spec which allows to express the desired accuracies for mass, radius, moment of inertia, and tidal deformability individually, and whether the tidal deformability and/or bulk radius is needed at all. The specification of tolerances is completely independent from the solution method. The available TOV solver translates the specification into suitable internal parameters, using heuristic formulas that have been calibrated using the measured error for a large set of tabulated nuclear physics EOS, polytropic EOS spanning a wide range of compactness, and piecewise polytropic EOS.

There are two functions to create an error specification: star_acc_simple() and star_acc_detailed(). The former distinguishes only the accuracy for deformability from anything else, while the latter allows finer grained control. The default values are appropriate for most applications. If very high precision is needed one should narrow the tolerances, and if speed is an issue one should widen the tolerance as much as possible. In particular, tidal deformability and bulk radius computation can be disabled if not needed in order to increase speed.

All solvers take EOS and central baryonic mass density as first arguments. The third argument is the accuracy spec created by one of the above functions.

The following example creates an EOS on the fly and computes a single TOV model

#include "reprimand/unitconv.h"
#include "reprimand/eos_barotr_poly.h"
#include "reprimand/spherical_stars.h"

using namespace EOS_Toolkit;

int main() {
    // Choose geometric units to work in
    auto u = units::geom_solar();

    // Create polytropic EOS 
    const double n_poly      = 1;
    const double rho_poly    = 6.176e+18 / u.density();
    const double rhomax_poly = 1E40 / u.density();
    auto eos = make_eos_barotr_poly(n_poly, rho_poly,
                                    rhomax_poly);

    // Choose NS central density
    const double tov_cnt_rho_SI = 7.9056e+17;
    const double tov_cnt_rho = tov_cnt_rho_SI / u.density();

    // Specification for desired accuracy
    const auto accs = star_acc_simple(true,  // want tidal deform Lambda
                                      false, // don't need bulk radius
                                      1e-6,  // accuracy for M,R,I
                                      1e-4   // accuracy for Lambda
                                      );

    // Compute NS properties
    auto tov = get_tov_properties(eos, tov_cnt_rho, accs);

    double gravitational_mass = tov.grav_mass();
    double circumferential_radius = tov.circ_radius();    
    double dimless_tidal_deform = tov.deformability().lambda;
    
    // Convert back units    
    double gravitational_mass_SI = gravitational_mass * u.mass();
    double circumferential_radius_SI = circumferential_radius * u.length();
    
}

The library also provides a method to find the maximum mass model along a TOV sequence, find_rhoc_tov_max_mass(). Another function, find_rhoc_tov_of_mass(), finds a TOV model with given gravitational mass. Note this is not efficient for finding many models for a given EOS since it finds a TOV solution for each step of the root finding. For such applications, e.g. in GW data parameter estimation, it is much more efficient to use the star sequence functionality provided by the library which is based on interpolation tables.

Tip

NSs represented by spherical_star_properties or spherical_star can be copied cheaply, and one does not need to worry about memory management. Internally, the EOS data and the NS profile are managed by reference counted shared pointers.