![]() |
Equation of State Sub-Library: Version 0.910
|
/* Example: ex_cold_nstar.cpp ------------------------------------------------------------------- This example solves the TOV equations using class cold_nstar using a relativistic mean-field EOS from class rmf_eos. */ #include <o2scl/cold_nstar.h> #include <o2scl/rmf_eos.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(rmf_eos &rmf); int main(void) { cout.setf(ios::scientific); test_mgr t; t.set_output_level(1); cold_nstar nst; // Initialize EOS rmf_eos rmf; load_nl3(rmf); rmf.saturation(); 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(); o2_shared_ptr<table_units>::type te=nst.get_eos_results(); // Compute mass vs. radius nst.calc_nstar(); o2_shared_ptr<table_units>::type 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 hdf_file hf; hf.open("ex_cold_nstar_eos.o2"); hdf_output(hf,*te,"eos"); hf.close(); hf.open("ex_cold_nstar_tov.o2"); hdf_output(hf,*tr,"tov"); hf.close(); t.report(); return 0; } // End of example
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).