eos_sn.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, 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 eos_sn.h
24  \brief File defining \ref o2scl::eos_sn_base
25 */
26 #ifndef GEN_SN_EOS_H
27 #define GEN_SN_EOS_H
28 
29 #include <cmath>
30 #include <iostream>
31 #include <fstream>
32 #include <o2scl/constants.h>
33 #include <o2scl/tensor_grid.h>
34 #include <o2scl/table.h>
35 #include <o2scl/boson_eff.h>
36 #include <o2scl/fermion_rel.h>
37 #include <o2scl/fermion_eff.h>
38 #include <o2scl/test_mgr.h>
39 #include <o2scl/convert_units.h>
40 #include <o2scl/interp2_direct.h>
41 
42 #ifndef DOXYGEN_NO_O2NS
43 namespace o2scl {
44 #endif
45 
46  /** \brief A base class for the supernova EOSs [abstract]
47 
48  This class is experimental.
49 
50  See also the general description in the \ref sneos_section
51  section of the User's guide.
52 
53  \comment
54  \todo Allow logarithmic grids for any of nb, Ye, or T.
55  12/10/13: The member variables are in the parent class, but no
56  code is written to use them yet. What really are these for?
57  1/3/14: In fact, the linear vs. logarithmic distinction isn't
58  necessarily useful, because some of the grids (e.g. T for sht)
59  aren't either purely linear or purely logarithmic.
60  \endcomment
61 
62  \future Add option to rescale energies and chemical
63  potentials to different masses.
64  \future Create a \ref o2scl::table object, possibly using
65  tensor_grid::vector_slice.
66  \future Show how matrix_slice and vector_slice can be used
67  with this object.
68  \future Add option to load and store a separate lepton/photon
69  EOS
70  \future Add pions?
71  \future Create a standard output format? Output to
72  stellarcollapse.org HDF5 format?
73 
74  \comment
75  \future Could this be a child of eos_had_temp_base and
76  then directly used in nstar_cold()? Actually no, this doesn't
77  work because of the nuclei.
78  \endcomment
79 
80  */
81  class eos_sn_base {
82 
83  public:
84 
87 
88  eos_sn_base();
89 
90  virtual ~eos_sn_base();
91 
92  /// \name Grid and data sizes
93  //@{
94  /// Size of baryon density grid
95  size_t n_nB;
96  /// Size of electron fraction grid
97  size_t n_Ye;
98  /// Size of temperature grid
99  size_t n_T;
100  /// Baryon density grid (in \f$ \mathrm{fm}^{-3} \f$)
101  std::vector<double> nB_grid;
102  /// Electron fraction grid
103  std::vector<double> Ye_grid;
104  /// Temperature grid (in \f$ \mathrm{MeV} \f$)
105  std::vector<double> T_grid;
106  /// Number of additional data sets
107  size_t n_oth;
108  /// Number of base data sets
109  static const size_t n_base=16;
110  //@}
111 
112  /// \name Data
113  //@{
114  /** \brief Total free energy per baryon in MeV (without
115  baryon rest masses but including electron rest mass)
116 
117  By default, this energy is relative to
118  \f[
119  m_n (1-Y_e) + m_p Y_e
120  \f]
121  where \f$ m_n \f$ is stored in \ref m_neut and \f$ m_p \f$
122  is stored in \ref m_prot .
123  */
125  /** \brief Free energy per baryon without lepton and photon
126  contributions in MeV
127 
128  By default, this energy is relative to
129  \f[
130  m_n (1-Y_e) + m_p Y_e
131  \f]
132  where \f$ m_n \f$ is stored in \ref m_neut and \f$ m_p \f$
133  is stored in \ref m_prot .
134  */
136  /** \brief Total internal energy per baryon in MeV (without
137  baryon rest masses but including electron rest mass)
138 
139  By default, this energy is relative to
140  \f[
141  m_n (1-Y_e) + m_p Y_e
142  \f]
143  where \f$ m_n \f$ is stored in \ref m_neut and \f$ m_p \f$
144  is stored in \ref m_prot .
145  */
147  /** \brief Internal energy per baryon without lepton and photon
148  contributions in MeV
149 
150  By default, this energy is relative to
151  \f[
152  m_n (1-Y_e) + m_p Y_e
153  \f]
154  where \f$ m_n \f$ is stored in \ref m_neut and \f$ m_p \f$
155  is stored in \ref m_prot .
156  */
158  /// Total pressure in \f$ \mathrm{MeV}/\mathrm{fm}^3 \f$
160  /** \brief Pressure without lepton and photon contributions
161  in \f$ \mathrm{MeV}/\mathrm{fm}^3 \f$
162  */
164  /// Total entropy per baryon
166  /// Entry per baryon without lepton and photon contributions
168  /** \brief Neutron chemical potential in MeV
169 
170  By default this is relative to the neutron mass in
171  \ref m_neut .
172  */
174  /** \brief Proton chemical potential in MeV
175 
176  By default this is relative to the proton mass in
177  \ref m_prot .
178  */
180  /// Proton number
182  /// Mass number
184  /// Neutron baryon fraction
186  /// Proton baryon fraction
188  /// Alpha particle baryon fraction
190  /// Heavy nuclei baryon fraction
192  /// Other data sets
194  /// List of pointers to data
196  //@}
197 
198  /** \brief Check the table composition entries
199  */
200  void check_composition(double &max1, double &max2);
201 
202  /// \name Interpolation
203  //@{
204  /** \brief Set the interpolation type of all the
205  \ref o2scl::tensor_grid3 objects to type \c interp_type .
206 
207  \note This is used by the constructor to set all tensors
208  to linear interpolation.
209  */
210  void set_interp_type(size_t interp_type);
211  //@}
212 
213  /// \name Nucleon masses
214  //@{
215  /** \brief Neutron mass in \f$ \mathrm{MeV} \f$
216  (defaults to o2scl_mks::mass_neutron times o2scl_const::hc_mev_fm)
217  */
218  double m_neut;
219 
220  /** \brief Proton mass in \f$ \mathrm{MeV} \f$
221  (defaults to o2scl_mks::mass_proton times o2scl_const::hc_mev_fm)
222  */
223  double m_prot;
224  //@}
225 
226  /// \name Electron and photon contribution
227  //@{
228  /// Photon
230  /// Electron
231  fermion electron;
232  /// Muon
233  fermion muon;
234  /// If true, include muons
236  /// Relativistic fermion thermodynamics
238  /** \brief Compute the electron and photon contribution for the full
239  grid
240 
241  If \ref baryons_only_loaded is true, this function computes
242  the data for <tt>E, P, S,</tt> and <tt>F</tt> by adding
243  electrons and photons to the baryon contributions stored in
244  <tt>Eint, Pint, Sint,</tt> and <tt>Fint</tt>. Otherwise,
245  this function computes <tt>Eint, Pint, Sint,</tt> and
246  <tt>Fint</tt> by subtracting electron and photon
247  contributions from <tt>E, P, S,</tt> and <tt>F</tt>.
248 
249  The electron contribution to the internal energy and free
250  energy computed by this function includes the electron rest
251  mass.
252  */
253  virtual void compute_eg();
254 
255  /** \brief Compute lepton contribution at one point
256  */
257  virtual void compute_eg_point(double nB, double Ye, double T,
258  thermo &th);
259 
260  /** \brief Check electrons and photons
261 
262  This checks that the electron and photon thermodynamics
263  generated by \o2 is consistent with the data in
264  \c E, \c Eint, \c F, \c Fint, \c P, \c Pint, \c S,
265  and \c Sint.
266  */
267  virtual double check_eg();
268  //@}
269 
270  /** \brief Test the free energy and store results in \c tm
271 
272  This checks that the data in \c Fint is consistent with that
273  in \c Eint and \c Sint (if \ref baryons_only_loaded is true)
274  and that \c F is consistent with that in \c E and \c S (if
275  \ref with_leptons_loaded is true).
276  */
277  void check_free_energy(double &avg);
278 
279  /** \brief Verbosity parameter (default 1)
280  */
281  int verbose;
282 
283  /** \brief Compute properties of matter in beta equilibrium
284  at fixed entropy per baryon
285 
286  This function just does a simple hard-coded linear
287  interpolation.
288 
289  The temperature is returned in units of MeV.
290  */
291  virtual void beta_eq_sfixed
292  (double nB, double entr, double &Ye, double &T);
293 
294  /** \brief Compute the electron fraction for beta-equilibrium
295  at fixed density and temperature
296 
297  This function just uses linear interpolation to
298  interpolate in baryon density and temperature and
299  the uses a quadratic to determine the minimum of the
300  free energy.
301 
302  If \ref data_with_leptons() is <tt>false</tt>, then
303  \ref compute_eg() is used to compute the leptons.
304  */
305  virtual void beta_eq_Tfixed(double nB, double T, double &Ye);
306 
307  /// Return true if data has been loaded
308  bool is_loaded() {
309  return loaded;
310  }
311 
312  /// Free allocated memory
313  void free();
314 
315  /// Return true if data with lepton information has been loaded
317  return with_leptons_loaded;
318  }
319 
320  /// Return true if data with only baryon information has been loaded
322  return baryons_only_loaded;
323  }
324 
325  /* \brief Load EOS from file named \c file_name
326 
327  \comment
328  The native EOS type overriddes this generic function,
329  but this function is for loading other EOSs in the
330  base class format
331  \endcomment
332  */
333  virtual void load(std::string fname);
334 
335  /* \brief Output EOS to file named \c file_name
336 
337  \comment
338  The native EOS type overriddes this generic function,
339  but this function is for writing other EOSs in the
340  base class format
341  \endcomment
342  */
343  virtual void output(std::string fname);
344 
345  /// Labels for the extra data sets included in current EOS
346  std::vector<std::string> oth_names;
347 
348  /// Units for the extra data sets included in current EOS
349  std::vector<std::string> oth_units;
350 
351  /** \brief A slice of data from \ref eos_sn_base for one index fixed
352 
353  This class allows one to easily construct a \ref
354  o2scl::interp2_direct object automatically by fixing one index
355  from one of the \ref o2scl::tensor_grid3 objects in a child of
356  \ref o2scl::eos_sn_base .
357  */
358  class slice {
359 
360  public:
361 
362  /// Typedef for the matrix type
363  typedef std::function<double &(size_t,size_t)> data_t;
364 
365  /// Data object in the form of a matrix
367 
368  /// \name Grid vectors
369  //@{
370  ubvector grid_x, grid_y;
371  //@}
372 
373  /** \brief The interpolation object
374  */
377 
378  /** \brief Set the slice to correspond to a matrix
379  in the form \f$ (n_B,T) \f$
380  */
381  void set_nB_T(tensor_grid3<> &tg3, size_t iYe) {
382  /*
383  data=std::bind(std::mem_fn<double &(size_t,size_t,size_t)>
384  (&tensor_grid3<>::get),tg3,std::placeholders::_1,iYe,
385  std::placeholders::_2);
386  size_t nx=tg3.get_size(0);
387  grid_x.resize(nx);
388  for(size_t i=0;i<nx;i++) grid_x[i]=tg3.get_grid(0,i);
389  size_t ny=tg3.get_size(2);
390  grid_y.resize(ny);
391  for(size_t i=0;i<ny;i++) grid_y[i]=tg3.get_grid(2,i);
392  it.set_data(nx,ny,grid_x,grid_y,data);
393  */
394  return;
395  }
396 
397  /** \brief Set the slice to correspond to a matrix
398  in the form \f$ (n_B,Y_e) \f$
399  */
400  void set_nB_Ye(tensor_grid3<> &tg3, size_t iT) {
401  /*
402  data=std::bind(std::mem_fn<double &(size_t,size_t,size_t)>
403  (&tensor_grid3<>::get),tg3,std::placeholders::_1,
404  std::placeholders::_2,iT);
405  size_t nx=tg3.get_size(0);
406  grid_x.resize(nx);
407  for(size_t i=0;i<nx;i++) grid_x[i]=tg3.get_grid(0,i);
408  size_t ny=tg3.get_size(1);
409  grid_y.resize(ny);
410  for(size_t i=0;i<ny;i++) grid_y[i]=tg3.get_grid(1,i);
411  it.set_data(nx,ny,grid_x,grid_y,data);
412  */
413  return;
414  }
415 
416  /** \brief Set the slice to correspond to a matrix
417  in the form \f$ (T,Y_e) \f$
418  */
419  void set_T_Ye(tensor_grid3<> &tg3, size_t inB) {
420  /*
421  data=std::bind(std::mem_fn<double &(size_t,size_t,size_t)>
422  (&tensor_grid3<>::get),tg3,inB,std::placeholders::_2,
423  std::placeholders::_1);
424  size_t nx=tg3.get_size(2);
425  grid_x.resize(nx);
426  for(size_t i=0;i<nx;i++) grid_x[i]=tg3.get_grid(2,i);
427  size_t ny=tg3.get_size(1);
428  grid_y.resize(ny);
429  for(size_t i=0;i<ny;i++) grid_y[i]=tg3.get_grid(1,i);
430  it.set_data(nx,ny,grid_x,grid_y,data);
431  */
432  return;
433  }
434 
435  };
436 
437  protected:
438 
439  /** \brief Unit conversion object (set automatically in constructor)
440  */
442  /// If true, a EOS table was successfully loaded (default false)
443  bool loaded;
444  /// True if thermodynamics with leptons has been loaded
446  /// True if baryon-only thermodynamics has been loaded
448 
449  /// \name Memory allocation
450  //@{
451  /// Allocate memory
452  void alloc();
453  //@}
454 
455  };
456 
457  /** \brief The Lattimer-Swesty supernova EOS
458 
459  This class is experimental.
460 
461  \note \o2 Does not contain the Lattimer-Swesty EOS, only
462  provides some code to manipulate it. This class is designed
463  to be used with the files <tt>ls.dat, sk1.dat, ska.dat</tt>
464  and <tt>skm.dat</tt> as provided on Jim Lattimer's website,
465  http://www.astro.sunysb.edu/lattimer/EOS/main.html .
466 
467  Note that the tables on this website are different
468  than what is generated from the LS Fortran code. See
469  \ref eos_sn_oo to read O'Connor and Ott's tables
470  generated from the LS Fortran code.
471 
472  The four models are
473  - LS (K=370, Sv=31)
474  - SKI' (K=371, Sv=30.4)
475  - SKa (K=263, Sv=34.5)
476  - SKM* (K=217, Sv=31.4)
477 
478  \note In the original table, the full internal energy per baryon
479  (data section 4 of 26) is apparently based on a rest mass of
480  \f$ Y_e m_p + (1-Y_e) m_n \f$, while the baryon part of the
481  internal energy per baryon (data section 13 of 26) is based
482  on a rest mass of \f$ m_n \f$. This means that
483  \f[
484  E - E_{\mathrm{int}} = E_{\mathrm{eg}} - Y_e (m_n - m_p)
485  \f]
486  where \f$ E_{\mathrm{eg}} \f$ is the energy per baryon of
487  electrons and photons. In order to keep things consistent with
488  the other EOS tables, when the EOS table is loaded, \ref
489  eos_sn_base::Eint is rescaled to a rest mass of \f$ Y_e m_p +
490  (1-Y_e) m_n \f$ .
491 
492  See also the documentation at \ref eos_sn_base and the
493  \ref sneos_section section of the User's guide.
494 
495  See \ref Lattimer91 and \ref Lattimer85.
496 
497  \todo There are still a few points for which the electron/photon
498  EOS seems to be off, but this may be the result of small
499  inaccuracies from finite-differencing the LS table.
500  */
501  class eos_sn_ls : public eos_sn_base {
502 
503  public:
504 
505  /// \name Additional data included in this EOS
506  //@{
507  /// Filling factor for nuclei
509  /// Baryon number density inside nuclei in \f$ \mathrm{fm}^{-3} \f$
511  /// Derivative of pressure with respect to baryon density
513  /// Derivative of pressure with respect to temperature
515  /// Derivative of pressure with respect to electron fraction
517  /// Derivative of entropy with respect to temperature
519  /// Derivative of entropy with respect to electron fraction
521  /// Number of neutrons in skin
523  /// Baryon density outside nuclei in \f$ \mathrm{fm}^{-3} \f$
525  /// Proton fraction outside nuclei
527  /** \brief Out of whackness parameter,
528  \f$ \mu_n-\mu_p-\mu_e+1.293~\mathrm{MeV} \f$, in MeV
529  */
531  //@}
532 
533  eos_sn_ls() :
534  fill(other[0]),
535  nb_in(other[1]),
536  dPdn(other[2]),
537  dPdT(other[3]),
538  dPdY(other[4]),
539  dsdT(other[5]),
540  dsdY(other[6]),
541  Nskin(other[7]),
542  nb_out(other[8]),
543  x_out(other[9]),
544  mu(other[10]) {
545  }
546 
547  /// Load table from filename \c fname
548  virtual void load(std::string fname);
549 
550  /** \brief Check electrons and photons
551 
552  This checks that the electron and photon thermodynamics
553  generated by \o2 is consistent with the data in
554  \c E, \c Eint, \c F, \c Fint, \c P, \c Pint, \c S,
555  and \c Sint.
556  */
557  virtual double check_eg();
558  };
559 
560  /** \brief The EOS tables from O'Connor and Ott
561 
562  This class reads the HDF5 EOS tables generated by E. O'Connor
563  and C. Ott in \ref OConnor10. The tables are available from
564 
565  http://stellarcollapse.org/equationofstate
566 
567  and are available under a creative commons
568  attribution-noncommercial-share alike license. This \o2 code to
569  read those tables is licensed (along with all \o2 code) under
570  the GPLv3 license (with permission from Evan O'Connor).
571 
572  The original README file from O'Connor and Ott's EOSdriver
573  code is available in the \o2
574  distribution in <tt>doc/o2scl/eos/extras/scollapse_README</tt>
575  and is reproduced below
576 
577  \verbinclude scollapse_README
578 
579  See also the documentation at \ref eos_sn_base and the
580  \ref sneos_section section of the User's guide.
581 
582  \future Loading an EOS currently requires loading the HDF5 file
583  and then copying it. This wouldn't be necessary if the \o2
584  tensor had the same ordering as the indices in the original
585  HDF5 file.
586  */
587  class eos_sn_oo : public eos_sn_base {
588 
589  public:
590 
591  eos_sn_oo() :
592  cs2(other[0]),
593  dedt(other[1]),
594  dpderho(other[2]),
595  dpdrhoe(other[3]),
596  gamma(other[4]),
597  mu_e(other[5]),
598  muhat(other[6]),
599  munu(other[7]),
600  XHe3(other[8]),
601  XLi4(other[9]),
602  Xt(other[10]),
603  Xd(other[11]) {
604  }
605 
606  /// \name Additional data included in this EOS
607  //@{
608  /// Speed of sound in cm^2/s^2
610  /// C_V in erg/g/K
612  /// dpderho in dyn*g/cm^2/erg
614  /// dpdrhoe in dyn cm^3/cm^2/g
616  /// Gamma
618  /// Electron chemical potential per baryon including rest mass
620  /// mun - mup
622  /// mue - mun + mup
624  /// Helion fraction
626  /// Lithium-4 fraction
628  /// Triton fraction
630  /// Deuteron fraction
632  /// The original mass density grid from the table in g/cm^3
633  std::vector<double> rho;
634  /// Energy shift for table storage in erg/g
635  double energy_shift;
636  //@}
637 
638  /// \name Table modes
639  //@{
640  /// Use the J. Lattimer et al. method for handling the chemical potentials
641  static const size_t ls_mode=0;
642  /// Use the H. Shen et al. method for handling the chemical potentials
643  static const size_t stos_mode=1;
644  /// Set for a Hempel et al. table with light nuclei
645  static const size_t hfsl_mode=2;
646  /// Set for a G. Shen et al. table
647  static const size_t sht_mode=3;
648  //@}
649 
650  /// Load table from filename \c fname with mode \c mode
651  virtual void load(std::string fname, size_t mode);
652 
653  };
654 
655  /** \brief The H. Shen et al. supernova EOS
656 
657  This class is experimental.
658 
659  \note \o2 Does not contain the EOS, only provides some code to
660  manipulate it. This class is designed to be used with the file
661  which was originally called <tt>eos.tab</tt> and now referred to
662  as <tt>eos1.tab</tt> and stored e.g. at
663  http://user.numazu-ct.ac.jp/~sumi/eos/.
664 
665  In order to force the EOS to a uniform grid, linear
666  interpolation is used to recast the variation in baryon density,
667  choosing the grid in baryon density to be the same as the
668  section in the table with T=0.1 MeV and \f$ Y_p = 0.1 \f$ for
669  all temperature and proton fraction points.
670 
671  The data for \ref eos_sn_base::E, \ref eos_sn_base::F, \ref
672  eos_sn_base::S, and \ref eos_sn_base::P is not stored in the table
673  but can be computed with \ref eos_sn_base::compute_eg().
674 
675  See also the documentation at \ref eos_sn_base and the
676  \ref sneos_section section of the User's guide.
677 
678  See \ref Shen98 and \ref Shen98b .
679 
680  \note Thanks to Matthias Hempel for providing the correct
681  temperature grid.
682 
683  \todo Add the T=0 and Ye=0 data to this class. Separate
684  tables for these cases have been released, but I don't think
685  this class can read them yet.
686  */
687  class eos_sn_stos : public eos_sn_base {
688 
689  public:
690 
691  /// \name Additional data included in this EOS
692  //@{
693  /** \brief Logarithm of baryon number density in
694  \f$ \mathrm{g}/\mathrm{cm}^3 \f$
695  */
697  /// Baryon number density in \f$ \mathrm{fm}^{-3} \f$
699  /// Logarithm of proton fraction
701  /// Proton fraction
703  /// Nucleon effective mass in MeV
705  /// Fraction of quark matter
707  //@}
708 
709  eos_sn_stos() :
710  log_rho(other[0]),
711  nB(other[1]),
712  log_Y(other[2]),
713  Yp(other[3]),
714  M_star(other[4]),
715  quark_frac(other[5]) {
716  check_grid=true;
717  m_neut=938.0;
718  m_prot=938.0;
719  }
720 
721  static const size_t orig_mode=0;
722  static const size_t quark_mode=1;
723 
724  /// If true, check the grid after load() (default true)
726 
727  /// Load table from filename \c fname with mode \c mode
728  virtual void load(std::string fname, size_t mode);
729 
730  };
731 
732  /** \brief A class to manipulate the G. Shen et al. EOS
733 
734  This class is experimental.
735 
736  \note \o2 Does not contain the EOS, only provides some code to
737  manipulate it. This class was designed to be used with the FSU
738  models given at
739  http://cecelia.physics.indiana.edu/gang_shen_eos/FSU/fsu.html .
740  The full list of files and the associated modes for the
741  \ref load() function are:
742  - <tt>"FSU1.7eos1.01.dat"</tt> (\ref mode_17)
743  - <tt>"FSU2.1eos1.01.dat"</tt> (\ref mode_21)
744  - <tt>"FSU1.7eosb1.01.dat"</tt> (\ref mode_17b)
745  - <tt>"FSU2.1eosb1.01.dat"</tt> (\ref mode_21b)
746  - <tt>"NL3eos1.03.dat"</tt> (\ref mode_NL3)
747  - <tt>"NL3eosb1.03.dat"</tt> (\ref mode_NL3b)
748 
749  See also the documentation at \ref eos_sn_base and the
750  \ref sneos_section section of the User's guide.
751 
752  The free energy per baryon neutron and proton chemical
753  potentials are relative to a nucleon mass of 939 MeV. The values
754  of \ref o2scl::eos_sn_base::m_neut and \ref
755  o2scl::eos_sn_base::m_prot are set to 939 MeV accordingly. The
756  electron chemical potential still includes its rest mass. All
757  quantites are stored as in the original table, except that
758  the values in \ref o2scl::eos_sn_base::E or \ref
759  o2scl::eos_sn_base::Eint are computed directly from the
760  thermodynamic identity.
761 
762  See \ref Shen11.
763 
764  \warning The NL3 model is probably ruled out by nuclear mass
765  data, neutron matter calculations, and neutron star mass and
766  radius observations.
767  */
768  class eos_sn_sht : public eos_sn_base {
769 
770  public:
771 
772  /// \name Table modes
773  //@{
774  /// 1.7 solar masses with leptons and photons
775  static const size_t mode_17=0;
776  /// 2.1 solar masses with leptons and photons
777  static const size_t mode_21=1;
778  /// 1.7 solar masses without leptons and photons
779  static const size_t mode_17b=2;
780  /// 2.1 solar masses without leptons and photons
781  static const size_t mode_21b=3;
782  /// NL3 model with leptons and photons
783  static const size_t mode_NL3=4;
784  /// NL3 model with leptons and photons
785  static const size_t mode_NL3b=5;
786  //@}
787 
788  /// \name Additional data included in this EOS
789  //@{
790  /// Temperature in MeV
792  /// Proton fraction
794  /// Baryon number density in \f$ 1/\mathrm{fm}^3 \f$
796  /// Electron chemical potential in MeV
798  /// Nucleon effective mass (Dirac) in MeV
800  //@}
801 
802  eos_sn_sht() :
803  T(other[0]),
804  Yp(other[1]),
805  nB(other[2]),
806  mue(other[3]),
807  M_star(other[4]) {
808  check_grid=true;
809  m_neut=939.0;
810  m_prot=939.0;
811  }
812 
813  /// If true, check the grid after load() (default true)
815 
816  /// Load table from filename \c fname with mode \c mode
817  virtual void load(std::string fname, size_t mode);
818 
819  };
820 
821  /** \brief The Hempel et al. supernova EOSs
822 
823  This class is experimental.
824 
825  \note \o2 Does not contain the EOS, only provides some code to
826  manipulate it. This class was designed to be used with the files
827  <tt>dd2_frdm_eos_shen98format_v1.02.tab</tt>,
828  <tt>fsg_roca_eos_shen98format_v1.0.tab</tt>, and
829  <tt>nl3_lala_eos_shen98format_v1.0.tab</tt> as obtained from
830  http://phys-merger.physik.unibas.ch/~hempel/eos.html.
831 
832  The free energy is stored with respect to the proton mass
833  of 938 MeV, so \ref eos_sn_base::Fint is shifted by
834  \f[
835  938~\mathrm{MeV}-Y_e m_p-(1-Y_e) m_n
836  \f]
837  and the internal energy is stored with respect to an
838  atomic mass unit so \ref eos_sn_base::Eint is shifted
839  by
840  \f[
841  931~\mathrm{MeV}-Y_e m_p-(1-Y_e) m_n
842  \f]
843  the rest of the file data is copied over directly from
844  the file.
845 
846  See also the documentation at \ref eos_sn_base and the
847  \ref sneos_section section of the User's guide.
848 
849  See \ref Hempel10 and \ref Hempel12.
850  */
851  class eos_sn_hfsl : public eos_sn_base {
852 
853  public:
854 
855  /// The atomic mass unit
856  double m_amu;
857 
858  /// \name Additional data included in this EOS
859  //@{
860  /** \brief Logarithm of baryon number density in
861  \f$ \mathrm{g}/\mathrm{cm}^3 \f$
862  */
864  /// Baryon number density in \f$ 1/\mathrm{fm}^3 \f$
866  /// Logarithm of proton fraction
868  /// Proton fraction
870  /// Nucleon effective mass in MeV
872  /// Mass number of light fragments
874  /// Proton number of light fragments
876  //@}
877 
878  /// If true, check the grid after load() (default true)
880 
881  eos_sn_hfsl() :
882  log_rho(other[0]),
883  nB(other[1]),
884  log_Y(other[2]),
885  Yp(other[3]),
886  M_star(other[4]),
887  A_light(other[5]),
888  Z_light(other[6]) {
889  check_grid=true;
890  m_neut=939.565346;
891  m_prot=938.272013;
892  m_amu=931.49432;
893  }
894 
895  /// Load table from filename \c fname
896  virtual void load(std::string fname);
897 
898  };
899 
900 #ifndef DOXYGEN_NO_O2NS
901 }
902 #endif
903 
904 #endif
o2scl::eos_sn_oo::mu_e
tensor_grid3 & mu_e
Electron chemical potential per baryon including rest mass.
Definition: eos_sn.h:619
o2scl::eos_sn_base::check_free_energy
void check_free_energy(double &avg)
Test the free energy and store results in tm.
o2scl::eos_sn_base::compute_eg_point
virtual void compute_eg_point(double nB, double Ye, double T, thermo &th)
Compute lepton contribution at one point.
boost::numeric::ublas::matrix< double >
o2scl::eos_sn_hfsl::A_light
tensor_grid3 & A_light
Mass number of light fragments.
Definition: eos_sn.h:873
o2scl::eos_sn_base::m_neut
double m_neut
Neutron mass in (defaults to o2scl_mks::mass_neutron times o2scl_const::hc_mev_fm)
Definition: eos_sn.h:218
o2scl::eos_sn_hfsl::m_amu
double m_amu
The atomic mass unit.
Definition: eos_sn.h:856
o2scl::eos_sn_base::with_leptons_loaded
bool with_leptons_loaded
True if thermodynamics with leptons has been loaded.
Definition: eos_sn.h:445
o2scl::eos_sn_oo::stos_mode
static const size_t stos_mode
Use the H. Shen et al. method for handling the chemical potentials.
Definition: eos_sn.h:643
o2scl::eos_sn_ls::dPdY
tensor_grid3 & dPdY
Derivative of pressure with respect to electron fraction.
Definition: eos_sn.h:516
o2scl::eos_sn_base::oth_names
std::vector< std::string > oth_names
Labels for the extra data sets included in current EOS.
Definition: eos_sn.h:346
o2scl::eos_sn_hfsl::M_star
tensor_grid3 & M_star
Nucleon effective mass in MeV.
Definition: eos_sn.h:871
o2scl::eos_sn_stos::nB
tensor_grid3 & nB
Baryon number density in .
Definition: eos_sn.h:698
o2scl::eos_sn_base::relf
fermion_rel relf
Relativistic fermion thermodynamics.
Definition: eos_sn.h:237
o2scl::eos_sn_base::arr
tensor_grid3 * arr[n_base+30]
List of pointers to data.
Definition: eos_sn.h:195
boost::numeric::ublas::vector< double >
o2scl::eos_sn_oo::Xd
tensor_grid3 & Xd
Deuteron fraction.
Definition: eos_sn.h:631
o2scl::eos_sn_base::Xnuclei
tensor_grid3 Xnuclei
Heavy nuclei baryon fraction.
Definition: eos_sn.h:191
o2scl::eos_sn_ls::dsdT
tensor_grid3 & dsdT
Derivative of entropy with respect to temperature.
Definition: eos_sn.h:518
o2scl::eos_sn_sht::T
tensor_grid3 & T
Temperature in MeV.
Definition: eos_sn.h:791
o2scl::eos_sn_ls::Nskin
tensor_grid3 & Nskin
Number of neutrons in skin.
Definition: eos_sn.h:522
o2scl::eos_sn_oo::XHe3
tensor_grid3 & XHe3
Helion fraction.
Definition: eos_sn.h:625
o2scl::eos_sn_sht::load
virtual void load(std::string fname, size_t mode)
Load table from filename fname with mode mode.
o2scl::eos_sn_sht::mode_21
static const size_t mode_21
2.1 solar masses with leptons and photons
Definition: eos_sn.h:777
o2scl::eos_sn_base::mup
tensor_grid3 mup
Proton chemical potential in MeV.
Definition: eos_sn.h:179
o2scl::eos_sn_base::beta_eq_sfixed
virtual void beta_eq_sfixed(double nB, double entr, double &Ye, double &T)
Compute properties of matter in beta equilibrium at fixed entropy per baryon.
o2scl::eos_sn_sht::Yp
tensor_grid3 & Yp
Proton fraction.
Definition: eos_sn.h:793
o2scl::tensor_grid3
o2scl::eos_sn_base::check_eg
virtual double check_eg()
Check electrons and photons.
o2scl::eos_sn_base::slice::it
interp2_direct< ubvector, data_t, matrix_row_gen< data_t >, matrix_column_gen< data_t > > it
The interpolation object.
Definition: eos_sn.h:376
o2scl::eos_sn_base::verbose
int verbose
Verbosity parameter (default 1)
Definition: eos_sn.h:281
o2scl::eos_sn_ls::check_eg
virtual double check_eg()
Check electrons and photons.
o2scl::eos_sn_base::nB_grid
std::vector< double > nB_grid
Baryon density grid (in )
Definition: eos_sn.h:101
o2scl::eos_sn_base::mun
tensor_grid3 mun
Neutron chemical potential in MeV.
Definition: eos_sn.h:173
o2scl::eos_sn_base::n_T
size_t n_T
Size of temperature grid.
Definition: eos_sn.h:99
o2scl::eos_sn_base::slice
A slice of data from eos_sn_base for one index fixed.
Definition: eos_sn.h:358
o2scl::eos_sn_sht::mode_NL3
static const size_t mode_NL3
NL3 model with leptons and photons.
Definition: eos_sn.h:783
o2scl::eos_sn_sht::mode_NL3b
static const size_t mode_NL3b
NL3 model with leptons and photons.
Definition: eos_sn.h:785
o2scl::eos_sn_oo::munu
tensor_grid3 & munu
mue - mun + mup
Definition: eos_sn.h:623
o2scl::eos_sn_hfsl
The Hempel et al. supernova EOSs.
Definition: eos_sn.h:851
o2scl::eos_sn_base::Eint
tensor_grid3 Eint
Internal energy per baryon without lepton and photon contributions in MeV.
Definition: eos_sn.h:157
o2scl::eos_sn_base::slice::set_nB_Ye
void set_nB_Ye(tensor_grid3<> &tg3, size_t iT)
Set the slice to correspond to a matrix in the form .
Definition: eos_sn.h:400
o2scl::eos_sn_base::Sint
tensor_grid3 Sint
Entry per baryon without lepton and photon contributions.
Definition: eos_sn.h:167
o2scl::eos_sn_base::check_composition
void check_composition(double &max1, double &max2)
Check the table composition entries.
o2scl::eos_sn_base::slice::set_T_Ye
void set_T_Ye(tensor_grid3<> &tg3, size_t inB)
Set the slice to correspond to a matrix in the form .
Definition: eos_sn.h:419
o2scl::boson
o2scl::eos_sn_base::P
tensor_grid3 P
Total pressure in .
Definition: eos_sn.h:159
o2scl::eos_sn_oo::muhat
tensor_grid3 & muhat
mun - mup
Definition: eos_sn.h:621
o2scl::eos_sn_oo::energy_shift
double energy_shift
Energy shift for table storage in erg/g.
Definition: eos_sn.h:635
thermo_tl< double >
o2scl::eos_sn_base::n_Ye
size_t n_Ye
Size of electron fraction grid.
Definition: eos_sn.h:97
o2scl::eos_sn_ls::dsdY
tensor_grid3 & dsdY
Derivative of entropy with respect to electron fraction.
Definition: eos_sn.h:520
o2scl::eos_sn_base::slice::data
data_t data
Data object in the form of a matrix.
Definition: eos_sn.h:366
o2scl::eos_sn_base::compute_eg
virtual void compute_eg()
Compute the electron and photon contribution for the full grid.
o2scl::eos_sn_stos::log_Y
tensor_grid3 & log_Y
Logarithm of proton fraction.
Definition: eos_sn.h:700
o2scl::eos_sn_base::n_oth
size_t n_oth
Number of additional data sets.
Definition: eos_sn.h:107
o2scl::eos_sn_oo::cs2
tensor_grid3 & cs2
Speed of sound in cm^2/s^2.
Definition: eos_sn.h:609
o2scl::eos_sn_base::S
tensor_grid3 S
Total entropy per baryon.
Definition: eos_sn.h:165
o2scl::eos_sn_base::F
tensor_grid3 F
Total free energy per baryon in MeV (without baryon rest masses but including electron rest mass)
Definition: eos_sn.h:124
o2scl::eos_sn_oo::dpdrhoe
tensor_grid3 & dpdrhoe
dpdrhoe in dyn cm^3/cm^2/g
Definition: eos_sn.h:615
o2scl::eos_sn_ls::nb_in
tensor_grid3 & nb_in
Baryon number density inside nuclei in .
Definition: eos_sn.h:510
o2scl::eos_sn_base::T_grid
std::vector< double > T_grid
Temperature grid (in )
Definition: eos_sn.h:105
o2scl::eos_sn_ls
The Lattimer-Swesty supernova EOS.
Definition: eos_sn.h:501
o2scl::eos_sn_base::Xalpha
tensor_grid3 Xalpha
Alpha particle baryon fraction.
Definition: eos_sn.h:189
o2scl::eos_sn_stos::load
virtual void load(std::string fname, size_t mode)
Load table from filename fname with mode mode.
o2scl::eos_sn_base::other
tensor_grid3 other[30]
Other data sets.
Definition: eos_sn.h:193
o2scl::eos_sn_oo::dpderho
tensor_grid3 & dpderho
dpderho in dyn*g/cm^2/erg
Definition: eos_sn.h:613
o2scl::eos_sn_base::slice::data_t
std::function< double &(size_t, size_t)> data_t
Typedef for the matrix type.
Definition: eos_sn.h:363
o2scl::eos_sn_oo::gamma
tensor_grid3 & gamma
Gamma.
Definition: eos_sn.h:617
o2scl::eos_sn_base::photon
boson photon
Photon.
Definition: eos_sn.h:229
o2scl::eos_sn_base::baryons_only_loaded
bool baryons_only_loaded
True if baryon-only thermodynamics has been loaded.
Definition: eos_sn.h:447
fermion_rel_tl< double >
o2scl::eos_sn_base::data_baryons_only
bool data_baryons_only()
Return true if data with only baryon information has been loaded.
Definition: eos_sn.h:321
o2scl::eos_sn_sht
A class to manipulate the G. Shen et al. EOS.
Definition: eos_sn.h:768
o2scl::eos_sn_stos::check_grid
bool check_grid
If true, check the grid after load() (default true)
Definition: eos_sn.h:725
o2scl::eos_sn_base::Pint
tensor_grid3 Pint
Pressure without lepton and photon contributions in .
Definition: eos_sn.h:163
o2scl::eos_sn_base::free
void free()
Free allocated memory.
o2scl::eos_sn_base::A
tensor_grid3 A
Mass number.
Definition: eos_sn.h:183
o2scl::eos_sn_sht::nB
tensor_grid3 & nB
Baryon number density in .
Definition: eos_sn.h:795
o2scl::eos_sn_stos
The H. Shen et al. supernova EOS.
Definition: eos_sn.h:687
o2scl::eos_sn_base::m_prot
double m_prot
Proton mass in (defaults to o2scl_mks::mass_proton times o2scl_const::hc_mev_fm)
Definition: eos_sn.h:223
o2scl::eos_sn_stos::Yp
tensor_grid3 & Yp
Proton fraction.
Definition: eos_sn.h:702
o2scl::eos_sn_hfsl::check_grid
bool check_grid
If true, check the grid after load() (default true)
Definition: eos_sn.h:879
o2scl::eos_sn_ls::dPdn
tensor_grid3 & dPdn
Derivative of pressure with respect to baryon density.
Definition: eos_sn.h:512
o2scl::eos_sn_base::Xn
tensor_grid3 Xn
Neutron baryon fraction.
Definition: eos_sn.h:185
o2scl::eos_sn_base::slice::set_nB_T
void set_nB_T(tensor_grid3<> &tg3, size_t iYe)
Set the slice to correspond to a matrix in the form .
Definition: eos_sn.h:381
o2scl::eos_sn_stos::quark_frac
tensor_grid3 & quark_frac
Fraction of quark matter.
Definition: eos_sn.h:706
o2scl::eos_sn_base::electron
fermion electron
Electron.
Definition: eos_sn.h:231
o2scl::eos_sn_oo::hfsl_mode
static const size_t hfsl_mode
Set for a Hempel et al. table with light nuclei.
Definition: eos_sn.h:645
o2scl::eos_sn_base::Ye_grid
std::vector< double > Ye_grid
Electron fraction grid.
Definition: eos_sn.h:103
o2scl::eos_sn_hfsl::Yp
tensor_grid3 & Yp
Proton fraction.
Definition: eos_sn.h:869
o2scl::eos_sn_oo
The EOS tables from O'Connor and Ott.
Definition: eos_sn.h:587
o2scl::eos_sn_base::Xp
tensor_grid3 Xp
Proton baryon fraction.
Definition: eos_sn.h:187
o2scl::eos_sn_hfsl::Z_light
tensor_grid3 & Z_light
Proton number of light fragments.
Definition: eos_sn.h:875
o2scl::eos_sn_ls::nb_out
tensor_grid3 & nb_out
Baryon density outside nuclei in .
Definition: eos_sn.h:524
o2scl::eos_sn_base::beta_eq_Tfixed
virtual void beta_eq_Tfixed(double nB, double T, double &Ye)
Compute the electron fraction for beta-equilibrium at fixed density and temperature.
o2scl::eos_sn_hfsl::load
virtual void load(std::string fname)
Load table from filename fname.
o2scl::eos_sn_hfsl::log_rho
tensor_grid3 & log_rho
Logarithm of baryon number density in .
Definition: eos_sn.h:863
o2scl::eos_sn_base::Fint
tensor_grid3 Fint
Free energy per baryon without lepton and photon contributions in MeV.
Definition: eos_sn.h:135
o2scl::eos_sn_sht::mue
tensor_grid3 & mue
Electron chemical potential in MeV.
Definition: eos_sn.h:797
o2scl::eos_sn_oo::Xt
tensor_grid3 & Xt
Triton fraction.
Definition: eos_sn.h:629
o2scl::eos_sn_hfsl::nB
tensor_grid3 & nB
Baryon number density in .
Definition: eos_sn.h:865
o2scl::eos_sn_base::data_with_leptons
bool data_with_leptons()
Return true if data with lepton information has been loaded.
Definition: eos_sn.h:316
o2scl::eos_sn_base::n_base
static const size_t n_base
Number of base data sets.
Definition: eos_sn.h:109
o2scl::eos_sn_sht::mode_17b
static const size_t mode_17b
1.7 solar masses without leptons and photons
Definition: eos_sn.h:779
o2scl::eos_sn_ls::fill
tensor_grid3 & fill
Filling factor for nuclei.
Definition: eos_sn.h:508
o2scl::eos_sn_base::is_loaded
bool is_loaded()
Return true if data has been loaded.
Definition: eos_sn.h:308
o2scl::eos_sn_base
A base class for the supernova EOSs [abstract].
Definition: eos_sn.h:81
o2scl::eos_sn_oo::dedt
tensor_grid3 & dedt
C_V in erg/g/K.
Definition: eos_sn.h:611
o2scl::eos_sn_base::E
tensor_grid3 E
Total internal energy per baryon in MeV (without baryon rest masses but including electron rest mass)
Definition: eos_sn.h:146
o2scl::eos_sn_base::muon
fermion muon
Muon.
Definition: eos_sn.h:233
o2scl::convert_units< double >
o2scl::matrix_column_gen
o2scl::eos_sn_ls::x_out
tensor_grid3 & x_out
Proton fraction outside nuclei.
Definition: eos_sn.h:526
o2scl::eos_sn_stos::M_star
tensor_grid3 & M_star
Nucleon effective mass in MeV.
Definition: eos_sn.h:704
o2scl::eos_sn_sht::M_star
tensor_grid3 & M_star
Nucleon effective mass (Dirac) in MeV.
Definition: eos_sn.h:799
o2scl::eos_sn_ls::dPdT
tensor_grid3 & dPdT
Derivative of pressure with respect to temperature.
Definition: eos_sn.h:514
o2scl::eos_sn_base::cu
convert_units< double > & cu
Unit conversion object (set automatically in constructor)
Definition: eos_sn.h:441
o2scl::eos_sn_base::n_nB
size_t n_nB
Size of baryon density grid.
Definition: eos_sn.h:95
o2scl::eos_sn_base::alloc
void alloc()
Allocate memory.
o2scl::eos_sn_sht::mode_21b
static const size_t mode_21b
2.1 solar masses without leptons and photons
Definition: eos_sn.h:781
o2scl::eos_sn_base::oth_units
std::vector< std::string > oth_units
Units for the extra data sets included in current EOS.
Definition: eos_sn.h:349
o2scl::eos_sn_oo::XLi4
tensor_grid3 & XLi4
Lithium-4 fraction.
Definition: eos_sn.h:627
o2scl::eos_sn_oo::rho
std::vector< double > rho
The original mass density grid from the table in g/cm^3.
Definition: eos_sn.h:633
o2scl::eos_sn_oo::sht_mode
static const size_t sht_mode
Set for a G. Shen et al. table.
Definition: eos_sn.h:647
o2scl::eos_sn_oo::ls_mode
static const size_t ls_mode
Use the J. Lattimer et al. method for handling the chemical potentials.
Definition: eos_sn.h:641
o2scl::eos_sn_base::loaded
bool loaded
If true, a EOS table was successfully loaded (default false)
Definition: eos_sn.h:443
o2scl::eos_sn_base::Z
tensor_grid3 Z
Proton number.
Definition: eos_sn.h:181
o2scl::eos_sn_sht::check_grid
bool check_grid
If true, check the grid after load() (default true)
Definition: eos_sn.h:814
o2scl::eos_sn_stos::log_rho
tensor_grid3 & log_rho
Logarithm of baryon number density in .
Definition: eos_sn.h:696
o2scl::eos_sn_oo::load
virtual void load(std::string fname, size_t mode)
Load table from filename fname with mode mode.
o2scl::eos_sn_ls::mu
tensor_grid3 & mu
Out of whackness parameter, , in MeV.
Definition: eos_sn.h:530
o2scl::eos_sn_base::set_interp_type
void set_interp_type(size_t interp_type)
Set the interpolation type of all the o2scl::tensor_grid3 objects to type interp_type .
o2scl::eos_sn_hfsl::log_Y
tensor_grid3 & log_Y
Logarithm of proton fraction.
Definition: eos_sn.h:867
o2scl::eos_sn_ls::load
virtual void load(std::string fname)
Load table from filename fname.
o2scl::eos_sn_base::include_muons
bool include_muons
If true, include muons.
Definition: eos_sn.h:235
o2scl::eos_sn_sht::mode_17
static const size_t mode_17
1.7 solar masses with leptons and photons
Definition: eos_sn.h:775
o2scl::interp2_direct

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