All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
tov_solve.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2014, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 /** \file tov_solve.h
24  \brief File defining \ref o2scl::tov_solve
25 */
26 #ifndef O2SCL_TOV_SOLVE_H
27 #define O2SCL_TOV_SOLVE_H
28 
29 #include <o2scl/eos_tov.h>
30 #include <o2scl/interp.h>
31 #include <o2scl/table_units.h>
32 #include <o2scl/shared_ptr.h>
33 #include <o2scl/ode_iv_solve.h>
34 #include <o2scl/mroot_hybrids.h>
35 #include <o2scl/min_brent_gsl.h>
36 
37 #ifndef DOXYGEN_NO_O2NS
38 namespace o2scl {
39 #endif
40 
41  /** \brief Class to solve the Tolman-Oppenheimer-Volkov equations
42 
43  See the \ref tovtoc section of the User's Guide for
44  the mathematical background.
45 
46  This class uses adaptive integration to compute the
47  gravitational mass, the radius, the baryonic mass (if the EOS
48  supplies the baryon density), and the gravitational potential
49  (if requested). The equation of state may be changed at any
50  time, by specifying the appropriate \ref eos_tov object
51 
52  <b>Basic Usage</b>
53 
54  After specifying the EOS through \ref tov_solve::set_eos(), one
55  calls either \ref tov_solve::mvsr(), \ref tov_solve::fixed(), or
56  \ref tov_solve::max() to compute the mass versus radius curve,
57  the profile of a star of a given fixed mass, or the profile of
58  the maximum mass star. These functions all generate results
59  in the form of a \ref table_units object, which can be
60  obtained from \ref tov_solve::get_results().
61 
62  Screen output:
63  - \c verbose=0 - Nothing
64  - \c verbose=1 - Basic information
65  - \c verbose=2 - For each profile computation, report solution
66  information at every kilometer.
67  - \c verbose=3 - Report profile information at every 20 grid
68  points and output the final interpolation to zero pressure. A
69  keypress is required after each profile.
70 
71  <b>Profiles of fixed mass</b>
72 
73  Profiles for a fixed gravitational mass are computed by solving
74  for the correct central pressure. In order to ensure that the
75  solver does not accidentally select a central pressure beyond
76  the maximum mass neutron star, the profile with the maximum mass
77  is computed beforehand automatically. The intial guess to the
78  solver is always the value of \ref fixed_pr_guess, which defaults to
79  \f$ 5.2 \times 10^{-5}~\mathrm{Msun}/\mathrm{km}^3 \f$ .
80  Alternatively, the user can specify the central pressure of
81  the maximum mass star so that it does not have to be computed.
82 
83  <b>Mass versus radius curve</b>
84 
85  The neutron star mass versus radius curve is constructed by
86  computing profiles of all neutron stars with a range of central
87  pressures. This range is from \ref prbegin to \ref prend, and
88  the ratio between successive central pressures is specified in
89  \ref princ (making a logarithmic central pressure grid).
90 
91  <b>Output tables</b>
92 
93  The functions \ref tov_solve::fixed() and \ref tov_solve::max()
94  produce output tables which represent the profile of the neutron
95  star of the requested mass. The columns are
96  - \c gm, the enclosed gravitational mass in \f$ \mathrm{M}_{\odot} \f$
97  - \c r, the radial coordinate in \f$ \mathrm{km} \f$
98  - \c gp, the gravitational potential (unitless) when
99  \ref calc_gpot is true
100  - \c bm, the baryonic mass in \f$ \mathrm{M}_{\odot} \f$ (when
101  \ref eos_tov::baryon_column is true).
102  - \c pr, the pressure in user-specified units
103  - \c ed, the energy density in user-specified units
104  - \c nb, the baryon density in user-specified units
105  (if \ref eos_tov::baryon_column is true)
106  - \c sg, the local surface gravity
107  (in \f$ \mathrm{g}/\mathrm{cm}^{2} \f$ )
108  - \c rs, the local redshift (unitless),
109  - \c dmdr, the derivative of the enclosed gravitational mass
110  in \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$
111  - \c dlogpdr, the derivative of the natural logarithm of the
112  pressure
113  - \c dgpdr, the derivative of the gravitational potential
114  in \f$ 1/\mathrm{km} \f$ (if \ref calc_gpot is true)
115  - \c dbmdr, the derivative of the enclosed baryonic mass
116  (if \ref eos_tov::baryon_column is true). \n
117 
118  The remaining columns are given by the user-defined columns from
119  the equation of state as determined by \ref eos_tov::get_names_units()
120  and \ref eos_tov::get_aux().
121 
122  The function \ref tov_solve::mvsr() produces a different kind of
123  output table corresponding to the mass versus radius curve. Some
124  points on the curve may correspond to unstable branches.
125  - \c gm, the total gravitational mass in \f$ \mathrm{M}_{\odot} \f$
126  - \c r, the radius in \f$ \mathrm{km} \f$
127  - \c gp, the gravitational potential in the center (unitless) when
128  \ref calc_gpot is true
129  - \c bm, total the baryonic mass in \f$ \mathrm{M}_{\odot} \f$ (when
130  \ref eos_tov::baryon_column is true).
131  - \c pr, the central pressure in user-specified units
132  - \c ed, the central energy density in user-specified units
133  - \c nb, the central baryon density in user-specified units
134  (if \ref eos_tov::baryon_column is true)
135  - \c sg, the surface gravity
136  (in \f$ \mathrm{g}/\mathrm{cm}^{2} \f$ )
137  - \c rs, the redshift at the surface,
138  - \c dmdr, the derivative of the gravitational mass
139  - \c dlogpdr, the derivative of the natural logarithm of the
140  pressure
141  - \c dgpdr, the derivative of the gravitational potential
142  in \f$ 1/\mathrm{km} \f$ (if \ref calc_gpot is true)
143  - \c dbmdr, the derivative of the enclosed baryonic mass
144  (if \ref eos_tov::baryon_column is true). \n
145 
146  The remaining columns are given by the user-defined columns from
147  the equation of state as determined by \ref eos_tov::get_names_units()
148  and \ref eos_tov::get_aux().
149 
150  If the user-specified \ref eos_tov object contains columns which
151  are the same as the native columns created by \ref tov_solve as
152  listed above, then the user-specified columns in the output
153  table are renamed by appending underscores to the original name.
154 
155  <b>Unit systems</b>
156 
157  By default, this class operates with energy density and
158  pressure in units of \f$ \mathrm{M}_{\odot}/\mathrm{km}^3 \f$
159  and baryon density in units of \f$ \mathrm{fm}^{-3} \f$.
160 
161  The function \ref set_units(std::string,std::string,std::string)
162  allows one to use different unit systems for energy density,
163  pressure, and baryon density. The following list of units of
164  energy density and pressure are hard-coded into the library and
165  always work:
166  - <tt>"g/cm^3"</tt>,
167  - <tt>"erg/cm^3"</tt>,
168  - <tt>"MeV/fm^3"</tt>,
169  - <tt>"1/fm^4"</tt>, and
170  - <tt>"Msun/km^3"</tt> (i.e. \f$ \mathrm{M}_{\odot}/\mathrm{km}^3 \f$ )
171 
172  The list of hard-coded units for baryon density are:
173  - <tt>"1/m^3"</tt>,
174  - <tt>"1/cm^3"</tt>, and
175  - <tt>"1/fm^3"</tt>.
176 
177  Other units choices will work if the conversion is either
178  already added to the global unit conversion object (from
179  <tt>o2scl_settings.get_convert_units()</tt> ) or the global unit
180  conversion object is able to compute them by a system call to
181  GNU <tt>units</tt> (see documentation in \ref convert_units).
182  Note that the choice of what units the tables are produced in
183  is independent of the unit system specified in the associated
184  \ref eos_tov object, i.e. the input EOS and output EOS units
185  need not be the same.
186 
187  Alternatively, using \ref set_units(double,double,double)
188  allows one to specify the conversion factors directly without
189  using the global unit conversion object.
190 
191  <b>Accuracy</b>
192 
193  The present code, as demonstrated in the tests, gives the
194  correct central pressure and energy density of the analytical
195  solution by Buchdahl to within less than 1 \part in \f$ 10^8 \f$.
196 
197  <b>Rotation</b>
198 
199  Rotation is considered if \ref tov_solve::ang_vel is set to
200  <tt>true</tt>. This adds two more differential equations to
201  solve for each central pressure.
202 
203  The differential equation for \f$ \bar{\omega} \f$ (see the
204  section in the User's Guide called \ref tovtoc ) is
205  independent of the relative scale for \f$ \bar{\omega} \f$ and
206  \f$ j \f$ . First, one rescales \f$ \bar{\omega} \f$ and
207  rewrites everything in terms of \f$ f\equiv \bar{\omega}/\Omega
208  \f$ and \f$ g \equiv r^4 j~df/dr \f$ . Then, pick a central
209  pressure, \f$ m(r=0)=g(r=0)=0 \f$, arbitrary values for \f$
210  \Phi(r=0) \f$ and \f$ f(r=0) \f$, and integrate
211  \f{eqnarray*}
212  \frac{d P}{d r} &=& - \frac{G \varepsilon m}{r^2}
213  \left( 1+\frac{P}{\varepsilon}\right)
214  \left( 1+\frac{4 \pi P r^3}{m} \right)
215  \left( 1-\frac{2 G m}{r}\right)^{-1}
216  \nonumber \\
217  \frac{d m}{d r} &=& 4 \pi r^2 \varepsilon
218  \nonumber \\
219  \frac{d \Phi}{d r} &=& - \frac{1}{\varepsilon}
220  \frac{ d P}{d r} \left(1+\frac{P}{\varepsilon}\right)^{-1}
221  \nonumber \\
222  \frac{d g}{dr} &=& -4 r^3 \frac{d j}{dr} f
223  \nonumber \\
224  \frac{d f}{dr} &=& \frac{g}{r^4 j}
225  \f}
226  Afterwards, shift \f$ \Phi \f$ by a constant to ensure
227  the correct value at \f$ r=R \f$, and multiply \f$ g \f$
228  by a constant to ensure that \f$ g=r^4 j (df/dr) \f$ holds
229  for the new potential \f$ \Phi \f$. Then, multiply
230  \f$ f \f$ by a constant to ensure that
231  \f[
232  f(r=R) + \frac{R}{3} \left(\frac{df}{dr}\right)_{r=R} = 1
233  \f]
234 
235  The functions \f$ f \f$ and \f$ g \f$ are stored in columns
236  called <tt>"omega_rat"</tt> and <tt>"rjw"</tt>, respectively.
237  One can compute the baryonic mass by integration or by adding
238  one additional differential equation, bringing the total to six.
239 
240  <b>Convergence details</b>
241 
242  By default, if the TOV solver fails to converge, the error
243  handler is called and an exception is thrown. If \ref
244  o2scl::tov_solve::err_nonconv is false, then \ref
245  o2scl::tov_solve::mvsr(), \ref o2scl::tov_solve::fixed(), and
246  \ref o2scl::tov_solve::max(), return an integer which gives some
247  information about why the solver failed to converge.
248 
249  <b>Other details</b>
250 
251  The ODE solution is stored in a buffer which can be directly
252  accessed using \ref o2scl::tov_solve::get_rkx(), \ref
253  o2scl::tov_solve::get_rky(), and \ref
254  o2scl::tov_solve::get_rkdydx(). In the case that the ODE steps
255  are small enough that there isn't enough space in the buffers,
256  the ODE solution data is thinned by a factor of two to allow for
257  the remaining ODE steps to be stored. The size of the buffers
258  can be controlled in \ref buffer_size .
259 
260  If \ref o2scl::tov_solve::reformat_results is true (the
261  default), then the results are placed in a shared pointer to the
262  \ref table_units object which can be accessed using \ref
263  o2scl::tov_solve::get_results(). The maximum size of the output
264  table can be controlled with \ref max_table_size. The output
265  table may be smaller than this, as it cannot be larger than the
266  number of steps stored in the buffer.
267 
268  \note The function \ref o2scl::tov_solve::integ_star() returns
269  <tt>gsl_efailed</tt> without calling the error handler in the
270  case that the solver can recover gracefully from, for example, a
271  negative pressure.
272  */
273  class tov_solve {
274 
275  public:
276 
279  typedef boost::numeric::ublas::matrix_column<ubmatrix> ubmatrix_column;
280  typedef boost::numeric::ublas::matrix_row<ubmatrix> ubmatrix_row;
281 
282 #ifndef DOXYGEN_INTERNAL
283 
284  protected:
285 
286  /// ODE function object
288 
289  /// Interpolation object for listed radii in \ref mvsr()
291 
292  /** \brief Set up column names and units
293 
294  When this function is used by \ref mvsr(), \c mvsr_mode is set
295  to true.
296  */
297  void column_setup(size_t &naux, std::vector<std::string> &ext_names,
298  bool mvsr_mode=false);
299 
300  /** \brief If true, \ref integ_star() computes all the profile info,
301  otherwise it only computes the gravitational mass
302  */
304 
305  /// The last row index in \ref rky
306  size_t ix_last;
307 
308  /// The schwarzchild radius in km
309  double schwarz_km;
310 
311  /** \brief Target mass for integ_star()
312 
313  Has a value of zero, unless set to a non-zero value by \ref fixed().
314  */
315  double tmass;
316 
317  /** \brief Ensure \c col does not match strings in \c cnames
318 
319  Underscores are added to \c col until it matches none of
320  the strings in \c cnames.
321  */
322  void make_unique_name(std::string &col,
323  std::vector<std::string> &cnames);
324 
325  /// \name User EOS
326  //@{
327  /// The EOS
329 
330  /// True if the EOS has been set
331  bool eos_set;
332  //@}
333 
334  /// \name Units for output table
335  //@{
336  /// Units for energy density
337  std::string eunits;
338  /// Units for pressure
339  std::string punits;
340  /// Units for baryon density
341  std::string nunits;
342  /// unit conversion factor for energy density (default 1.0)
343  double efactor;
344  /// unit conversion factor for pressure (default 1.0)
345  double pfactor;
346  /// unit conversion factor for baryon density (default 1.0)
347  double nfactor;
348  //@}
349 
350  /** \brief Smallest allowed pressure for integration (default: -100)
351 
352  This quantity can't be much smaller than -100 since we need to
353  compute numbers near \f$ e^{-\mathrm{min\_log\_pres}} \f$
354 
355  \future Replace this with the proper value from std::limits?
356  */
357  double min_log_pres;
358 
359  /// \name Integration storage
360  //@{
361  /// Radial coordinate (in kilometers)
363  /** \brief ODE functions
364 
365  If \c rky is viewed as a matrix, then the first column of each
366  row is the gravitational mass in solar masses, and the second
367  column is the natural logarithm of the pressure in \f$
368  \mathrm{M}_{\odot}/km^3 \f$ . When \ref calc_gpot is true, the
369  next column is the gravitational potential (which is
370  unitless), and when \ref eos_tov::baryon_column is true, the
371  next column is the baryonic mass in \f$ \mathrm{M}_{\odot}
372  \f$.
373  */
374  std::vector<ubvector> rky;
375  /// The derivatives of the ODE functions
376  std::vector<ubvector> rkdydx;
377  //@}
378 
379  /// The output table
381 
382  /// \name Numerical methods
383  //@{
384  /// The solver
386 
387  /// The minimizer
389 
390  /// The adaptive stepper
392  //@}
393 
394  /// The ODE step function
395  virtual int derivs(double x, size_t nv, const ubvector &y,
396  ubvector &dydx);
397 
398  /// The minimizer function to compute the maximum mass
399  virtual double max_fun(double maxx);
400 
401  /** \brief The solver function to compute the stellar profile
402  */
403  virtual int integ_star(size_t ndvar, const ubvector &ndx,
404  ubvector &ndy);
405 
406 #endif
407 
408  public:
409 
410  tov_solve();
411 
412  virtual ~tov_solve();
413 
414  /// Size of the ODE solution buffer (default \f$ 10^5 \f$)
415  size_t buffer_size;
416 
417  /// Maximum number of lines in the output table (default 400)
419 
420  /// \name Basic properties
421  //@{
422  /// Gravitational mass
423  double mass;
424  /// Radius
425  double rad;
426  /// Baryonic mass (when computed)
427  double bmass;
428  /// Gravitational potential (when computed)
429  double gpot;
430  /** \brief The value of \f$ d (\bar{\omega}/\Omega)/dr \f$
431  at the surface (when computed)
432  */
433  double domega_rat;
434  /** \brief Maximum value for central pressure in
435  \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$ (default \f$ 10^{20} \f$ )
436 
437  This variable is set by the <tt>mvsr()</tt> and <tt>max()</tt>
438  functions and used in \ref integ_star() .
439  */
440  double pcent_max;
441  //@}
442 
443  /** \name Solution parameters
444 
445  These parameters can be changed at any time.
446  */
447  //@{
448  /** \brief If true, then fixed() and max() reformat results into
449  a \ref o2scl::table_units object
450 
451  Note that \ref mvsr() always places its results in the
452  output table independent of the value of this variable.
453  */
455  /** \brief The mass of one baryon
456 
457  The mass of one baryon in kg for the total baryon mass
458  calculation (defaults to the proton mass).
459  */
460  double baryon_mass;
461  /// If true, solve for the angular velocity (default false)
462  bool ang_vel;
463  /// Apply general relativistic corrections (default true)
464  bool gen_rel;
465  /** \brief calculate the gravitational potential and the enclosed
466  baryon mass (default false)
467  */
468  bool calc_gpot;
469  /// smallest allowed radial stepsize in km (default 1.0e-4)
470  double step_min;
471  /// largest allowed radial stepsize in km (default 0.05)
472  double step_max;
473  /// initial radial stepsize in km (default 4.0e-3)
474  double step_start;
475  /// control for output (default 1)
476  int verbose;
477  /// Maximum number of integration steps (default 100000)
479  /** \brief If true, call the error handler if the solution does
480  not converge (default true)
481  */
483  //@}
484 
485  /** \brief Default value of maximum pressure for maximum mass star
486  in \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$
487  */
488  double pmax_default;
489 
490  /// \name Mass versus radius parameters
491  //@{
492  /** \brief Beginning pressure in
493  \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$ (default 7.0e-7)
494  */
495  double prbegin;
496  /** \brief Ending pressure in
497  \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$ (default 8.0e-3)
498  */
499  double prend;
500  /// Increment factor for pressure (default 1.1)
501  double princ;
502  /** \brief List of pressures at which more information should be
503  recorded
504 
505  If pressures (in the user-specified units) are added to this
506  vector, then in mvsr(), the radial location, enclosed
507  gravitational mass, and (if \ref o2scl::eos_tov::baryon_column
508  is true) enclosed baryon mass are stored in the table for each
509  central pressure. The associated columns are named
510  <tt>r0, gm0, bm0, r1, gm1, bm1,</tt> etc.
511  */
512  std::vector<double> pr_list;
513  //@}
514 
515  /// \name Fixed mass parameter
516  //@{
517  /** \brief Guess for central pressure in
518  \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$
519  (default \f$ 5.2 \times 10^{-5} \f$)
520 
521  This guess is used in the functions fixed().
522  */
524  //@}
525 
526  /// \name Maximum mass profile parameters
527  //@{
528  /// Beginning pressure for maximum mass guess (default 7.0e-5)
529  double max_begin;
530  /// Ending pressure for maximum mass guess (default 5.0e-3)
531  double max_end;
532  /// Increment for pressure for maximum mass guess (default 1.3)
533  double max_inc;
534  //@}
535 
536  /// \name Basic operation
537  //@{
538  /// Set the EOS to use
539  void set_eos(eos_tov &ter) {
540  te=&ter;
541  eos_set=true;
542  return;
543  }
544 
545  /** \brief Set output units for the table
546  */
547  void set_units(double s_efactor=1.0, double s_pfactor=1.0,
548  double s_nbfactor=1.0);
549 
550  /** \brief Set output units for the table
551  */
552  void set_units(std::string eunits="", std::string punits="",
553  std::string nunits="");
554 
555  /// Calculate the mass vs. radius curve
556  virtual int mvsr();
557 
558  /** \brief Calculate the profile of a star with fixed mass
559 
560  If the target mass is negative, it is interpreted as
561  subtracting from the maximum mass configuration. For a 2.15
562  solar mass neutron star, <tt>target_mass=-0.2</tt> corresponds
563  to 1.95 solar mass configuration.
564 
565  The variable \c pmax is the maximum allowable central pressure
566  in \f$ \mathrm{M}_{\odot}/\mathrm{km} \f$, i.e. the central
567  pressure of the maximum mass star. This ensures that the
568  function does not unintentionally select a configuration on an
569  unstable branch. If \c pmax is greater than or equal to the
570  default value (\ref pmax_default), then the maximum mass star
571  will be explicitly computed first.
572  */
573  virtual int fixed(double target_mass, double pmax=1.0e20);
574 
575  /** \brief Calculate the profile of the maximum mass star
576  */
577  virtual int max();
578 
579  /** \brief Construct a table from the results
580 
581  This function constructs a \ref table_units object from the
582  information in \ref rkx, \ref rky, and \ref rkdydx . Note that
583  the table is always constructed by default so this function
584  need not be called unless \ref tov_solve::reformat_results is
585  <tt>false</tt>.
586  */
587  virtual void make_table();
588 
589  /** \brief Return the results data table
590  */
592  return out_table;
593  }
594  //@}
595 
596  /// \name Convergence information flags
597  //@{
598  static const int fixed_solver_failed=128;
599  static const int fixed_integ_star_failed=256;
600  static const int fixed_wrong_mass=512;
601  static const int max_minimizer_failed=1024;
602  static const int max_integ_star_failed=2048;
603  static const int mvsr_integ_star_failed=4096;
604  static const int ang_vel_failed=8192;
605  static const int cent_press_large=16384;
606  static const int cent_press_neg=32768;
607  static const int over_max_steps=65536;
608  static const int last_step_large=131072;
609  //@}
610 
611  /// \name Get internally formatted results (in internal unit system)
612  //@{
613  /// Get the vector for the radial grid
614  const ubvector &get_rkx() const {
615  return rkx;
616  }
617  /// Get a list of vectors for the ODEs
618  const std::vector<ubvector> &get_rky() const {
619  return rky;
620  }
621  /// Get a list of vectors for the corresponding derivatives
622  const std::vector<ubvector> &get_rkdydx() const {
623  return rkdydx;
624  }
625  //@}
626 
627  /// \name Control numerical methods
628  //@{
629  /** \brief Set solver
630  */
632  mroot_ptr=&s_mrp;
633  return;
634  };
635 
636  /** \brief Set minimizer
637  */
638  void set_min(min_base<> &s_mp) {
639  min_ptr=&s_mp;
640  return;
641  };
642 
643  /** \brief Set the adaptive stepper
644  */
646  as_ptr=&sap;
647  return;
648  };
649  //@}
650 
651  /// \name Default numerical classes
652  //@{
653  /// The default minimizer
655 
656  /// The default solver
658 
659  /// The default adaptive stepper
661  //@}
662 
663  };
664 
665 #ifndef DOXYGEN_NO_O2NS
666 }
667 #endif
668 
669 #endif
670 
671 
void set_eos(eos_tov &ter)
Set the EOS to use.
Definition: tov_solve.h:539
virtual int mvsr()
Calculate the mass vs. radius curve.
double pcent_max
Maximum value for central pressure in (default )
Definition: tov_solve.h:440
std::string punits
Units for pressure.
Definition: tov_solve.h:339
double rad
Radius.
Definition: tov_solve.h:425
double schwarz_km
The schwarzchild radius in km.
Definition: tov_solve.h:309
mroot< mm_funct11, ubvector, jac_funct11 > * mroot_ptr
The solver.
Definition: tov_solve.h:385
bool calc_gpot
calculate the gravitational potential and the enclosed baryon mass (default false) ...
Definition: tov_solve.h:468
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)
Definition: tov_solve.h:482
double domega_rat
The value of at the surface (when computed)
Definition: tov_solve.h:433
std::string nunits
Units for baryon density.
Definition: tov_solve.h:341
double max_begin
Beginning pressure for maximum mass guess (default 7.0e-5)
Definition: tov_solve.h:529
double pmax_default
Default value of maximum pressure for maximum mass star in .
Definition: tov_solve.h:488
size_t max_integ_steps
Maximum number of integration steps (default 100000)
Definition: tov_solve.h:478
int verbose
control for output (default 1)
Definition: tov_solve.h:476
void set_mroot(mroot< mm_funct11, ubvector, jac_funct11 > &s_mrp)
Set solver.
Definition: tov_solve.h:631
size_t ix_last
The last row index in rky.
Definition: tov_solve.h:306
bool gen_rel
Apply general relativistic corrections (default true)
Definition: tov_solve.h:464
void set_stepper(astep_base< ubvector, ubvector, ubvector, ode_funct11 > &sap)
Set the adaptive stepper.
Definition: tov_solve.h:645
double max_end
Ending pressure for maximum mass guess (default 5.0e-3)
Definition: tov_solve.h:531
double prbegin
Beginning pressure in (default 7.0e-7)
Definition: tov_solve.h:495
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)
Definition: tov_solve.h:345
std::vector< ubvector > rky
ODE functions.
Definition: tov_solve.h:374
virtual int integ_star(size_t ndvar, const ubvector &ndx, ubvector &ndy)
The solver function to compute the stellar profile.
o2_shared_ptr< table_units<> >::type get_results()
Return the results data table.
Definition: tov_solve.h:591
double min_log_pres
Smallest allowed pressure for integration (default: -100)
Definition: tov_solve.h:357
double prend
Ending pressure in (default 8.0e-3)
Definition: tov_solve.h:499
bool integ_star_final
If true, integ_star() computes all the profile info, otherwise it only computes the gravitational mas...
Definition: tov_solve.h:303
double bmass
Baryonic mass (when computed)
Definition: tov_solve.h:427
bool ang_vel
If true, solve for the angular velocity (default false)
Definition: tov_solve.h:462
bool eos_set
True if the EOS has been set.
Definition: tov_solve.h:331
virtual void make_table()
Construct a table from the results.
void column_setup(size_t &naux, std::vector< std::string > &ext_names, bool mvsr_mode=false)
Set up column names and units.
min_brent_gsl def_min
The default minimizer.
Definition: tov_solve.h:654
virtual int derivs(double x, size_t nv, const ubvector &y, ubvector &dydx)
The ODE step function.
eos_tov * te
The EOS.
Definition: tov_solve.h:328
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 )
Definition: tov_solve.h:415
bool reformat_results
If true, then fixed() and max() reformat results into a o2scl::table_units object.
Definition: tov_solve.h:454
std::string eunits
Units for energy density.
Definition: tov_solve.h:337
A EOS base class for the TOV solver.
Definition: eos_tov.h:47
double mass
Gravitational mass.
Definition: tov_solve.h:423
mroot_hybrids< mm_funct11, ubvector, ubmatrix, jac_funct11 > def_solver
The default solver.
Definition: tov_solve.h:657
double baryon_mass
The mass of one baryon.
Definition: tov_solve.h:460
const std::vector< ubvector > & get_rkdydx() const
Get a list of vectors for the corresponding derivatives.
Definition: tov_solve.h:622
double step_max
largest allowed radial stepsize in km (default 0.05)
Definition: tov_solve.h:472
ubvector rkx
Radial coordinate (in kilometers)
Definition: tov_solve.h:362
std::vector< ubvector > rkdydx
The derivatives of the ODE functions.
Definition: tov_solve.h:376
Class to solve the Tolman-Oppenheimer-Volkov equations.
Definition: tov_solve.h:273
astep_base< ubvector, ubvector, ubvector, ode_funct11 > * as_ptr
The adaptive stepper.
Definition: tov_solve.h:391
interp< ubvector > iop
Interpolation object for listed radii in mvsr()
Definition: tov_solve.h:290
const ubvector & get_rkx() const
Get the vector for the radial grid.
Definition: tov_solve.h:614
ode_funct11 ofm
ODE function object.
Definition: tov_solve.h:287
double max_inc
Increment for pressure for maximum mass guess (default 1.3)
Definition: tov_solve.h:533
double nfactor
unit conversion factor for baryon density (default 1.0)
Definition: tov_solve.h:347
double fixed_pr_guess
Guess for central pressure in (default )
Definition: tov_solve.h:523
double princ
Increment factor for pressure (default 1.1)
Definition: tov_solve.h:501
double step_start
initial radial stepsize in km (default 4.0e-3)
Definition: tov_solve.h:474
astep_gsl< ubvector, ubvector, ubvector, ode_funct11 > def_stepper
The default adaptive stepper.
Definition: tov_solve.h:660
min_base * min_ptr
The minimizer.
Definition: tov_solve.h:388
double tmass
Target mass for integ_star()
Definition: tov_solve.h:315
o2_shared_ptr< table_units<> >::type out_table
The output table.
Definition: tov_solve.h:380
void make_unique_name(std::string &col, std::vector< std::string > &cnames)
Ensure col does not match strings in cnames.
const std::vector< ubvector > & get_rky() const
Get a list of vectors for the ODEs.
Definition: tov_solve.h:618
double step_min
smallest allowed radial stepsize in km (default 1.0e-4)
Definition: tov_solve.h:470
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.
Definition: tov_solve.h:512
size_t max_table_size
Maximum number of lines in the output table (default 400)
Definition: tov_solve.h:418
double gpot
Gravitational potential (when computed)
Definition: tov_solve.h:429
std::function< int(double, size_t, const boost::numeric::ublas::vector< double > &, boost::numeric::ublas::vector< double > &)> ode_funct11
void set_min(min_base<> &s_mp)
Set minimizer.
Definition: tov_solve.h:638
double efactor
unit conversion factor for energy density (default 1.0)
Definition: tov_solve.h:343

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..