Automatic Calculation of Cold Neutron Star Structure

The class o2scl::nstar_cold computes the structure of non-rotating zero-temperature spherically-symmetric neutron stars, given a core hadronic equation of state (of type o2scl::eos_had_base) It automatically tabulates the core EOS, adds a crust EOS (if necessary) and then uses o2scl::tov_solve to compute the mass-radius curve. It also computes the adiabatic index, the speed of sound, and determines the possibility of the direct Urca process as a function of density or radius.

Cold neutron star example

/* Example: ex_nstar_cold.cpp
-------------------------------------------------------------------
This example solves the TOV equations using class nstar_cold using a
relativistic mean-field EOS from class eos_had_rmf.
*/
#include <o2scl/nstar_cold.h>
#include <o2scl/eos_had_rmf.h>
#include <o2scl/hdf_file.h>
#include <o2scl/hdf_io.h>
#include <o2scl/test_mgr.h>
using namespace std;
using namespace o2scl;
using namespace o2scl_hdf;
// For hc_mev_fm
using namespace o2scl_const;
// A simple function to load the NL3 model
int load_nl3(eos_had_rmf &rmf);
int main(void) {
cout.setf(ios::scientific);
// Initialize EOS
load_nl3(rmf);
rmf.def_neutron.mu=5.0;
rmf.def_proton.mu=5.0;
rmf.set_fields(0.2,0.1,-0.05);
rmf.err_nonconv=false;
int sret=rmf.saturation();
if (sret!=0) {
rmf.set_fields(0.1,0.07,0.0);
rmf.def_neutron.mu=5.0;
rmf.def_proton.mu=5.0;
rmf.err_nonconv=true;
rmf.saturation();
} else {
rmf.err_nonconv=true;
}
cout << "Saturation density: " << rmf.n0 << endl;
cout << "Binding energy: " << rmf.eoa*hc_mev_fm << endl;
cout << "Effective mass: " << rmf.msom << endl;
cout << "Symmetry energy: " << rmf.esym*hc_mev_fm << endl;
cout << "Compressibility: " << rmf.comp*hc_mev_fm << endl;
// Compute EOS, include muons
nst.include_muons=true;
nst.set_eos(rmf);
nst.calc_eos();
std::shared_ptr<table_units<> > te=nst.get_eos_results();
// Compute mass vs. radius
nst.calc_nstar();
std::shared_ptr<table_units<> > tr=nst.get_tov_results();
cout << "Maximum mass: " << tr->max("gm") << endl;
cout << "Radius of maximum mass star: "
<< tr->get("r",tr->lookup("gm",tr->max("gm"))) << endl;
cout << "Central baryon density of maximum mass star: ";
cout << tr->get("nb",tr->lookup("gm",tr->max("gm"))) << endl;
// Output EOS and TOV results to files
hf.open_or_create("ex_nstar_cold_eos.o2");
hdf_output(hf,*te,"eos");
hf.close();
hf.open_or_create("ex_nstar_cold_tov.o2");
hdf_output(hf,*tr,"tov");
hf.close();
t.report();
return 0;
}
// End of example

Typical output:

Saturation density: 1.480066e-01
Binding energy: -1.621698e+01
Effective mass: 5.958939e-01
Symmetry energy: 3.734713e+01
Compressibility: 2.710301e+02
Mass versus radius mode.
Central P: 7.0000e-07 (Msun/km^3), M: 1.3090e-01 (Msun), R: 3.4138e+01 (km)
Central P: 7.7000e-07 (Msun/km^3), M: 1.4088e-01 (Msun), R: 2.9779e+01 (km)
Central P: 8.4700e-07 (Msun/km^3), M: 1.5177e-01 (Msun), R: 2.6686e+01 (km)
Central P: 9.3170e-07 (Msun/km^3), M: 1.6350e-01 (Msun), R: 2.4409e+01 (km)
Central P: 1.0249e-06 (Msun/km^3), M: 1.7603e-01 (Msun), R: 2.2685e+01 (km)
Central P: 1.1274e-06 (Msun/km^3), M: 1.8948e-01 (Msun), R: 2.1334e+01 (km)
Central P: 1.2401e-06 (Msun/km^3), M: 2.0390e-01 (Msun), R: 2.0255e+01 (km)
Central P: 1.3641e-06 (Msun/km^3), M: 2.1924e-01 (Msun), R: 1.9385e+01 (km)
Central P: 1.5005e-06 (Msun/km^3), M: 2.3557e-01 (Msun), R: 1.8671e+01 (km)
Central P: 1.6506e-06 (Msun/km^3), M: 2.5301e-01 (Msun), R: 1.8079e+01 (km)
Central P: 1.8156e-06 (Msun/km^3), M: 2.7148e-01 (Msun), R: 1.7586e+01 (km)
Central P: 1.9972e-06 (Msun/km^3), M: 2.9105e-01 (Msun), R: 1.7172e+01 (km)
Central P: 2.1969e-06 (Msun/km^3), M: 3.1173e-01 (Msun), R: 1.6824e+01 (km)
Central P: 2.4166e-06 (Msun/km^3), M: 3.3347e-01 (Msun), R: 1.6529e+01 (km)
Central P: 2.6582e-06 (Msun/km^3), M: 3.5639e-01 (Msun), R: 1.6277e+01 (km)
Central P: 2.9241e-06 (Msun/km^3), M: 3.8041e-01 (Msun), R: 1.6063e+01 (km)
Central P: 3.2165e-06 (Msun/km^3), M: 4.0568e-01 (Msun), R: 1.5879e+01 (km)
Central P: 3.5381e-06 (Msun/km^3), M: 4.3215e-01 (Msun), R: 1.5720e+01 (km)
Central P: 3.8919e-06 (Msun/km^3), M: 4.5994e-01 (Msun), R: 1.5584e+01 (km)
Central P: 4.2811e-06 (Msun/km^3), M: 4.8905e-01 (Msun), R: 1.5466e+01 (km)
Central P: 4.7092e-06 (Msun/km^3), M: 5.1959e-01 (Msun), R: 1.5363e+01 (km)
Central P: 5.1802e-06 (Msun/km^3), M: 5.5156e-01 (Msun), R: 1.5274e+01 (km)
Central P: 5.6982e-06 (Msun/km^3), M: 5.8511e-01 (Msun), R: 1.5198e+01 (km)
Central P: 6.2680e-06 (Msun/km^3), M: 6.2021e-01 (Msun), R: 1.5131e+01 (km)
Central P: 6.8948e-06 (Msun/km^3), M: 6.5703e-01 (Msun), R: 1.5074e+01 (km)
Central P: 7.5843e-06 (Msun/km^3), M: 6.9559e-01 (Msun), R: 1.5025e+01 (km)
Central P: 8.3427e-06 (Msun/km^3), M: 7.3597e-01 (Msun), R: 1.4983e+01 (km)
Central P: 9.1770e-06 (Msun/km^3), M: 7.7832e-01 (Msun), R: 1.4947e+01 (km)
Central P: 1.0095e-05 (Msun/km^3), M: 8.2262e-01 (Msun), R: 1.4917e+01 (km)
Central P: 1.1104e-05 (Msun/km^3), M: 8.6902e-01 (Msun), R: 1.4892e+01 (km)
Central P: 1.2215e-05 (Msun/km^3), M: 9.1757e-01 (Msun), R: 1.4872e+01 (km)
Central P: 1.3436e-05 (Msun/km^3), M: 9.6828e-01 (Msun), R: 1.4856e+01 (km)
Central P: 1.4780e-05 (Msun/km^3), M: 1.0213e+00 (Msun), R: 1.4843e+01 (km)
Central P: 1.6258e-05 (Msun/km^3), M: 1.0765e+00 (Msun), R: 1.4834e+01 (km)
Central P: 1.7883e-05 (Msun/km^3), M: 1.1340e+00 (Msun), R: 1.4828e+01 (km)
Central P: 1.9672e-05 (Msun/km^3), M: 1.1938e+00 (Msun), R: 1.4824e+01 (km)
Central P: 2.1639e-05 (Msun/km^3), M: 1.2557e+00 (Msun), R: 1.4822e+01 (km)
Central P: 2.3803e-05 (Msun/km^3), M: 1.3196e+00 (Msun), R: 1.4822e+01 (km)
Central P: 2.6183e-05 (Msun/km^3), M: 1.3855e+00 (Msun), R: 1.4822e+01 (km)
Central P: 2.8801e-05 (Msun/km^3), M: 1.4532e+00 (Msun), R: 1.4823e+01 (km)
Central P: 3.1681e-05 (Msun/km^3), M: 1.5224e+00 (Msun), R: 1.4823e+01 (km)
Central P: 3.4850e-05 (Msun/km^3), M: 1.5928e+00 (Msun), R: 1.4823e+01 (km)
Central P: 3.8335e-05 (Msun/km^3), M: 1.6643e+00 (Msun), R: 1.4821e+01 (km)
Central P: 4.2168e-05 (Msun/km^3), M: 1.7364e+00 (Msun), R: 1.4818e+01 (km)
Central P: 4.6385e-05 (Msun/km^3), M: 1.8088e+00 (Msun), R: 1.4812e+01 (km)
Central P: 5.1023e-05 (Msun/km^3), M: 1.8811e+00 (Msun), R: 1.4802e+01 (km)
Central P: 5.6126e-05 (Msun/km^3), M: 1.9528e+00 (Msun), R: 1.4789e+01 (km)
Central P: 6.1738e-05 (Msun/km^3), M: 2.0236e+00 (Msun), R: 1.4772e+01 (km)
Central P: 6.7912e-05 (Msun/km^3), M: 2.0931e+00 (Msun), R: 1.4750e+01 (km)
Central P: 7.4703e-05 (Msun/km^3), M: 2.1608e+00 (Msun), R: 1.4723e+01 (km)
Central P: 8.2174e-05 (Msun/km^3), M: 2.2262e+00 (Msun), R: 1.4691e+01 (km)
Central P: 9.0391e-05 (Msun/km^3), M: 2.2891e+00 (Msun), R: 1.4653e+01 (km)
Central P: 9.9430e-05 (Msun/km^3), M: 2.3491e+00 (Msun), R: 1.4609e+01 (km)
Central P: 1.0937e-04 (Msun/km^3), M: 2.4058e+00 (Msun), R: 1.4558e+01 (km)
Central P: 1.2031e-04 (Msun/km^3), M: 2.4589e+00 (Msun), R: 1.4502e+01 (km)
Central P: 1.3234e-04 (Msun/km^3), M: 2.5082e+00 (Msun), R: 1.4440e+01 (km)
Central P: 1.4558e-04 (Msun/km^3), M: 2.5534e+00 (Msun), R: 1.4371e+01 (km)
Central P: 1.6013e-04 (Msun/km^3), M: 2.5946e+00 (Msun), R: 1.4296e+01 (km)
Central P: 1.7615e-04 (Msun/km^3), M: 2.6314e+00 (Msun), R: 1.4215e+01 (km)
Central P: 1.9376e-04 (Msun/km^3), M: 2.6639e+00 (Msun), R: 1.4129e+01 (km)
Central P: 2.1314e-04 (Msun/km^3), M: 2.6920e+00 (Msun), R: 1.4037e+01 (km)
Central P: 2.3445e-04 (Msun/km^3), M: 2.7157e+00 (Msun), R: 1.3940e+01 (km)
Central P: 2.5790e-04 (Msun/km^3), M: 2.7352e+00 (Msun), R: 1.3838e+01 (km)
Central P: 2.8369e-04 (Msun/km^3), M: 2.7505e+00 (Msun), R: 1.3732e+01 (km)
Central P: 3.1205e-04 (Msun/km^3), M: 2.7618e+00 (Msun), R: 1.3623e+01 (km)
Central P: 3.4326e-04 (Msun/km^3), M: 2.7691e+00 (Msun), R: 1.3509e+01 (km)
Central P: 3.7759e-04 (Msun/km^3), M: 2.7728e+00 (Msun), R: 1.3393e+01 (km)
Central P: 4.1534e-04 (Msun/km^3), M: 2.7728e+00 (Msun), R: 1.3273e+01 (km)
Central P: 4.5688e-04 (Msun/km^3), M: 2.7696e+00 (Msun), R: 1.3152e+01 (km)
Central P: 5.0257e-04 (Msun/km^3), M: 2.7632e+00 (Msun), R: 1.3029e+01 (km)
Central P: 5.5282e-04 (Msun/km^3), M: 2.7539e+00 (Msun), R: 1.2905e+01 (km)
Central P: 6.0811e-04 (Msun/km^3), M: 2.7420e+00 (Msun), R: 1.2781e+01 (km)
Central P: 6.6892e-04 (Msun/km^3), M: 2.7276e+00 (Msun), R: 1.2655e+01 (km)
Central P: 7.3581e-04 (Msun/km^3), M: 2.7111e+00 (Msun), R: 1.2531e+01 (km)
Central P: 8.0939e-04 (Msun/km^3), M: 2.6925e+00 (Msun), R: 1.2406e+01 (km)
Central P: 8.9033e-04 (Msun/km^3), M: 2.6722e+00 (Msun), R: 1.2283e+01 (km)
Central P: 9.7936e-04 (Msun/km^3), M: 2.6504e+00 (Msun), R: 1.2161e+01 (km)
Central P: 1.0773e-03 (Msun/km^3), M: 2.6272e+00 (Msun), R: 1.2041e+01 (km)
Central P: 1.1850e-03 (Msun/km^3), M: 2.6029e+00 (Msun), R: 1.1924e+01 (km)
Central P: 1.3035e-03 (Msun/km^3), M: 2.5777e+00 (Msun), R: 1.1808e+01 (km)
Central P: 1.4339e-03 (Msun/km^3), M: 2.5517e+00 (Msun), R: 1.1696e+01 (km)
Central P: 1.5773e-03 (Msun/km^3), M: 2.5251e+00 (Msun), R: 1.1587e+01 (km)
Central P: 1.7350e-03 (Msun/km^3), M: 2.4981e+00 (Msun), R: 1.1481e+01 (km)
Central P: 1.9085e-03 (Msun/km^3), M: 2.4709e+00 (Msun), R: 1.1379e+01 (km)
Central P: 2.0993e-03 (Msun/km^3), M: 2.4435e+00 (Msun), R: 1.1281e+01 (km)
Central P: 2.3093e-03 (Msun/km^3), M: 2.4162e+00 (Msun), R: 1.1188e+01 (km)
Central P: 2.5402e-03 (Msun/km^3), M: 2.3890e+00 (Msun), R: 1.1098e+01 (km)
Central P: 2.7942e-03 (Msun/km^3), M: 2.3621e+00 (Msun), R: 1.1014e+01 (km)
Central P: 3.0736e-03 (Msun/km^3), M: 2.3356e+00 (Msun), R: 1.0934e+01 (km)
Central P: 3.3810e-03 (Msun/km^3), M: 2.3096e+00 (Msun), R: 1.0859e+01 (km)
Central P: 3.7191e-03 (Msun/km^3), M: 2.2842e+00 (Msun), R: 1.0789e+01 (km)
Central P: 4.0910e-03 (Msun/km^3), M: 2.2595e+00 (Msun), R: 1.0725e+01 (km)
Central P: 4.5001e-03 (Msun/km^3), M: 2.2355e+00 (Msun), R: 1.0665e+01 (km)
Central P: 4.9501e-03 (Msun/km^3), M: 2.2124e+00 (Msun), R: 1.0611e+01 (km)
Central P: 5.4452e-03 (Msun/km^3), M: 2.1903e+00 (Msun), R: 1.0563e+01 (km)
Central P: 5.9897e-03 (Msun/km^3), M: 2.1691e+00 (Msun), R: 1.0519e+01 (km)
Central P: 6.5886e-03 (Msun/km^3), M: 2.1490e+00 (Msun), R: 1.0482e+01 (km)
Central P: 7.2475e-03 (Msun/km^3), M: 2.1301e+00 (Msun), R: 1.0449e+01 (km)
Central P: 7.9723e-03 (Msun/km^3), M: 2.1122e+00 (Msun), R: 1.0422e+01 (km)
Maximum mass: 2.772829e+00
Radius of maximum mass star: 1.327348e+01
Central baryon density of maximum mass star: 6.818579e-01
0 tests performed.
All tests passed.
o2scl_const
hdf_output
void hdf_output(hdf_file &hf, o2scl::uniform_grid< double > &h, std::string name)
o2scl::nstar_cold
Naive static cold neutron star.
Definition: nstar_cold.h:185
o2scl::nstar_cold::get_eos_results
std::shared_ptr< table_units<> > get_eos_results()
Get the eos table (after having called calc_eos())
Definition: nstar_cold.h:296
o2scl::eos_had_base::def_mroot
mroot_hybrids def_mroot
The default solver.
Definition: eos_had_base.h:787
o2scl::nstar_cold::set_eos
void set_eos(eos_had_base &he)
Set the equation of state.
Definition: nstar_cold.h:197
o2scl::eos_had_rmf
Relativistic mean field theory EOS.
Definition: eos_had_rmf.h:298
o2scl::eos_had_base::msom
double msom
Effective mass (neutron)
Definition: eos_had_base.h:349
o2scl::test_mgr::report
bool report() const
o2scl::eos_had_rmf::set_fields
virtual int set_fields(double sig, double ome, double lrho)
Set a guess for the fields for the next call to calc_e(), calc_p(), or saturation()
Definition: eos_had_rmf.h:563
o2scl::nstar_cold::calc_eos
int calc_eos(double np_0=0.0)
Calculate the given equation of state.
o2scl::eos_had_base::n0
double n0
Saturation density in .
Definition: eos_had_base.h:346
o2scl::eos_had_rmf::def_sat_mroot
mroot_hybrids def_sat_mroot
The default solver for calculating the saturation density.
Definition: eos_had_rmf.h:603
o2scl_hdf::hdf_file::close
void close()
o2scl::nstar_cold::include_muons
bool include_muons
If true, include muons (default false)
Definition: nstar_cold.h:324
o2scl::eos_had_base::esym
double esym
Symmetry energy in .
Definition: eos_had_base.h:343
hc_mev_fm
const double hc_mev_fm
o2scl::nstar_cold::calc_nstar
int calc_nstar()
Calculate the M vs. R curve.
o2scl::eos_had_rmf::saturation
virtual int saturation()
Calculate properties of nuclear matter at the saturation density.
o2scl::test_mgr
o2scl_hdf
Additional functions to read and write EOS data to HDF5 files.
o2scl::eos_had_base::eoa
double eoa
Binding energy (without the rest mass) in .
Definition: eos_had_base.h:332
o2scl::eos_had_rmf::err_nonconv
bool err_nonconv
If true, throw exceptions when the function calc_e() does not converge (default true)
Definition: eos_had_rmf.h:337
o2scl::mroot::err_nonconv
bool err_nonconv
o2scl::nstar_cold::get_tov_results
std::shared_ptr< table_units<> > get_tov_results()
Get the results from the TOV (after having called calc_nstar())
Definition: nstar_cold.h:302
o2scl::test_mgr::set_output_level
void set_output_level(int l)
o2scl_hdf::hdf_file
o2scl_hdf::hdf_file::open_or_create
void open_or_create(std::string fname)
o2scl::eos_had_base::def_neutron
fermion def_neutron
The defaut neutron.
Definition: eos_had_base.h:756
o2scl::eos_had_base::comp
double comp
Compression modulus in .
Definition: eos_had_base.h:340
o2scl::eos_had_base::def_proton
fermion def_proton
The defaut proton.
Definition: eos_had_base.h:764
jacobian< mm_funct, boost::numeric::ublas::vector< double >, boost::numeric::ublas::matrix< double > >::err_nonconv
bool err_nonconv
o2scl::mroot_hybrids::def_jac
jacobian_gsl< func_t, vec_t, mat_t > def_jac

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).