26 #ifndef O2SCL_TOV_SOLVE_H 27 #define O2SCL_TOV_SOLVE_H 29 #include <o2scl/eos_tov.h> 30 #include <o2scl/interp.h> 31 #include <o2scl/table_units.h> 32 #include <o2scl/ode_iv_solve.h> 33 #include <o2scl/mroot_hybrids.h> 34 #include <o2scl/min_brent_gsl.h> 36 #ifndef DOXYGEN_NO_O2NS 356 typedef boost::numeric::ublas::matrix_column<ubmatrix> ubmatrix_column;
357 typedef boost::numeric::ublas::matrix_row<ubmatrix> ubmatrix_row;
359 #ifndef DOXYGEN_INTERNAL 400 std::vector<std::string> &cnames);
451 std::vector<ubvector>
rky;
472 virtual int derivs(
double x,
size_t nv,
const ubvector &y,
476 virtual double max_fun(
double maxx);
480 virtual int integ_star(
size_t ndvar,
const ubvector &ndx,
636 void set_units(
double s_efactor=1.0,
double s_pfactor=1.0,
637 double s_nbfactor=1.0);
641 void set_units(std::string eunits=
"", std::string punits=
"",
642 std::string nunits=
"");
646 void get_units(std::string &eunits, std::string &punits,
647 std::string &nunits);
674 virtual int fixed(
double target_mass,
double pmax=1.0e20);
690 virtual int fixed_pr(
double pcent,
double pmax=1.0e20);
728 out_table->add_constant(
"schwarz",schwarz_km);
738 static const int fixed_solver_failed=128;
739 static const int fixed_integ_star_failed=256;
740 static const int fixed_wrong_mass=512;
741 static const int max_minimizer_failed=1024;
742 static const int max_integ_star_failed=2048;
743 static const int mvsr_integ_star_failed=4096;
744 static const int ang_vel_failed=8192;
745 static const int cent_press_large=16384;
746 static const int cent_press_neg=32768;
747 static const int over_max_steps=65536;
748 static const int last_step_large=131072;
758 const std::vector<ubvector> &
get_rky()
const {
805 #ifndef DOXYGEN_NO_O2NS void set_eos(eos_tov &ter)
Set the EOS to use.
virtual int mvsr()
Calculate the mass vs. radius curve.
const std::vector< ubvector > & get_rky() const
Get a list of vectors for the ODEs.
double pcent_max
Maximum value for central pressure in (default )
std::string punits
Units for pressure.
double schwarz_km
The schwarzchild radius in km.
mroot_hybrids< mm_funct, ubvector, ubmatrix, jac_funct > def_solver
The default solver.
bool calc_gpot
calculate the gravitational potential (default false)
virtual int fixed(double target_mass, double pmax=1.0e20)
Calculate the profile of a star with fixed mass.
bool err_nonconv
If true, call the error handler if the solution does not converge (default true)
void set_mroot(mroot< mm_funct, ubvector, jac_funct > &s_mrp)
Set solver.
std::shared_ptr< table_units<> > get_results()
Return the results data table.
double domega_rat
The value of at the surface (when ang_vel is true)
std::string nunits
Units for baryon density.
double max_begin
Beginning pressure for maximum mass guess in (default 7.0e-5)
double pmax_default
Default value of maximum pressure for maximum mass star in (default )
size_t max_integ_steps
Maximum number of integration steps (default 100000)
int verbose
control for output (default 1)
size_t ix_last
The last row index in rky.
bool gen_rel
Apply general relativistic corrections (default true)
double max_end
Ending pressure for maximum mass guess in (default 5.0e-3)
double prbegin
Beginning pressure in (default 7.0e-7)
void set_units(double s_efactor=1.0, double s_pfactor=1.0, double s_nbfactor=1.0)
Set output units for the table.
double pfactor
unit conversion factor for pressure (default 1.0)
std::vector< ubvector > rky
ODE functions.
virtual int integ_star(size_t ndvar, const ubvector &ndx, ubvector &ndy)
The solver function to compute the stellar profile.
double min_log_pres
Smallest allowed pressure for integration (default: -100)
void get_units(std::string &eunits, std::string &punits, std::string &nunits)
Get output units for the table.
double prend
Ending pressure in (default 8.0e-3)
bool integ_star_final
If true, integ_star() computes all the profile info, otherwise it only computes the gravitational mas...
const std::vector< ubvector > & get_rkdydx() const
Get a list of vectors for the corresponding derivatives.
double bmass
Baryonic mass (when computed; in )
bool ang_vel
If true, solve for the angular velocity (default false)
bool eos_set
True if the EOS has been set.
virtual void make_table()
Construct a table from the results.
min_brent_gsl def_min
The default minimizer.
astep_gsl< ubvector, ubvector, ubvector, ode_funct > def_stepper
The default adaptive stepper.
virtual int derivs(double x, size_t nv, const ubvector &y, ubvector &dydx)
The ODE step function.
virtual double max_fun(double maxx)
The minimizer function to compute the maximum mass.
size_t buffer_size
Size of the ODE solution buffer (default )
bool reformat_results
If true, then fixed() and max() reformat results into a o2scl::table_units object.
std::string eunits
Units for energy density.
std::function< int(double, size_t, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &)> ode_funct
std::shared_ptr< table_units<> > out_table
The output table.
void set_stepper(astep_base< ubvector, ubvector, ubvector, ode_funct > &sap)
Set the adaptive stepper.
A EOS base class for the TOV solver.
double mass
Gravitational mass (in )
const ubvector & get_rkx() const
Get the vector for the radial grid.
double baryon_mass
The mass of one baryon.
virtual int fixed_pr(double pcent, double pmax=1.0e20)
Calculate the profile of a star with a specified central pressure.
double step_max
largest allowed radial stepsize in km (default 0.05)
ubvector rkx
Radial coordinate (in kilometers)
void column_setup(bool mvsr_mode=false)
Set up column names and units.
double last_rjw
The value of at the surface.
std::vector< ubvector > rkdydx
The derivatives of the ODE functions.
Class to solve the Tolman-Oppenheimer-Volkov equations.
interp< ubvector > iop
Interpolation object for listed radii in mvsr()
ode_funct ofm
ODE function object.
double max_inc
Increment for pressure for maximum mass guess (unitless; default 1.3)
double nfactor
unit conversion factor for baryon density (default 1.0)
double fixed_pr_guess
Guess for central pressure in (default )
double princ
Increment factor for pressure (default 1.1)
void set_table(std::shared_ptr< table_units<> > t)
Return the results data table.
double step_start
initial radial stepsize in km (default 4.0e-3)
mroot< mm_funct, ubvector, jac_funct > * mroot_ptr
The solver for fixed gravitational masses.
min_base * min_ptr
The minimizer for maximum masses.
double tmass
Target mass for integ_star()
void make_unique_name(std::string &col, std::vector< std::string > &cnames)
Ensure col does not match strings in cnames.
double step_min
smallest allowed radial stepsize in km (default 1.0e-4)
virtual int max()
Calculate the profile of the maximum mass star.
std::vector< double > pr_list
List of pressures at which more information should be recorded.
size_t max_table_size
Maximum number of lines in the output table (default 400)
double last_f
The value of at the surface.
double gpot
Gravitational potential (when computed; unitless)
astep_base< ubvector, ubvector, ubvector, ode_funct > * as_ptr
The adaptive stepper.
void set_min(min_base<> &s_mp)
Set minimizer.
double efactor
unit conversion factor for energy density (default 1.0)