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

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..