bps_eos.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_BPS_EOS_H
00024 #define O2SCL_BPS_EOS_H
00025 
00026 #include <o2scl/part.h>
00027 #include <o2scl/mroot.h>
00028 #include <o2scl/collection.h>
00029 #include <o2scl/eos.h>
00030 #include <o2scl/gsl_mroot_hybrids.h>
00031 #include <o2scl/fermion.h>
00032 #include <o2scl/nuclear_mass.h>
00033 
00034 #ifndef DOXYGENP
00035 namespace o2scl {
00036 #endif
00037 
00038   /** 
00039       \brief Baym-Pethick-Sutherland equation of state
00040     
00041       This calculates the equation of state of electrons and nuclei
00042       using the approach of \ref Baym71 (based on the discussion in
00043       \ref Shapiro83) between about \f$8 \times 10^{6}
00044       ~\mathrm{g}/\mathrm{cm}^3\f$ and \f$4.3 \times 10^{11}
00045       ~\mathrm{g}/\mathrm{cm}^3\f$. Below these densities, more
00046       complex Coulomb corrections need to be considered, and above
00047       these densities, neutron drip is important.
00048 
00049       The default mass formula is semi-empirical
00050       \f{eqnarray*}
00051       M(A,Z)&=&(A-Z) m_n+Z (m_p+m_e)-
00052       15.76 A-17.81 A^{2/3} \\
00053       && -0.71 Z^2 /A^{1/3}-
00054       94.8/A \left(A/2-Z\right)^2+E_{\mathrm{pair}}
00055       \f}
00056       where 
00057       \f[
00058       E_{\mathrm{pair}} = \pm 39/A^{3/4}
00059       \f]
00060       if the nucleus is odd-odd (plus sign) or even-even (minus sign)
00061       and \f$E_{\mathrm{pair}}\f$ is zero for odd-even and even-odd
00062       nuclei. The nuclei are assumed not to contribute to the
00063       pressure. The electronic contribution to the pressure is assumed
00064       to be equal to the Fermi gas contribution plus a "lattice"
00065       contribution
00066       \f[
00067       \varepsilon_L = -1.444 Z^{2/3} e^2 n_e^{4/3}
00068       \f]
00069       This is Eq. 2.7.2 in \ref Shapiro83. The rest mass energy of
00070       the nucleons is included in the energy density. 
00071       
00072       The original results from \ref Baym71 are stored as a \ref table
00073       in bps.eos. The testing code for this class compares the
00074       calculations to the table and matches to within .2 percent for
00075       the energy density and 9 percent for the pressure (for a fixed
00076       baryon number density).
00077 
00078       \todo Can the pressure be made to match more closely?
00079 
00080       \future Convert to a \ref hadronic_eos object and offer an
00081       associated interface?
00082 
00083   */
00084   class bps_eos : public eos {
00085   public:
00086 
00087     bps_eos();
00088     
00089     virtual ~bps_eos() {};
00090     
00091     /** \brief Calculate the equation of state as a function of
00092         the baryon number density \c barn
00093         
00094         This calculates the equation of state as a function of the
00095         baryon number density in \f$\mathrm{fm}^{-3}\f$, returning the
00096         representative nucleus with proton number \c Z and atomic
00097         number \c A.  The pressure and energy density are returned 
00098         in \c th in \f$\mathrm{fm}^{-4}\f$.
00099     */
00100     virtual int calc_density(double barn, thermo &th, int &Z, int &A);
00101 
00102     /** \brief Calculate the equation of state as a function of
00103         the pressure
00104 
00105         This calculates the equation of state as a function of the
00106         pressure, returning the representative nucleus with proton
00107         number \c Z and atomic number \c A and the baryon number
00108         density \c barn in \f$\mathrm{fm}^{-3}\f$. The energy density
00109         is also returned in \f$\mathrm{fm}^{-4}\f$ in \c th.
00110     */
00111     virtual int calc_pressure(thermo &th, double &barn, int &Z, int &A);
00112 
00113     /** \brief The electron lattice energy */
00114     virtual double lattice_energy(int Z);
00115 
00116     /** \brief Get a pointer to the electron
00117      */
00118     virtual fermion *get_electron() { return &e; }
00119 
00120     /** 
00121         \brief The mass formula
00122 
00123         The nuclear mass without the contribution of the rest mass
00124         of the electrons. The electron rest mass energy is included
00125         in the electron thermodynamics elsewhere.
00126      */
00127     virtual double mass_formula(int Z, int A);
00128     
00129     /// Return string denoting type ("bps_eos")
00130     virtual const char *type() { return "bps_eos"; }
00131     
00132     /// Default mass formula
00133     semi_empirical_mass def_mass;
00134 
00135     /// Set the nuclear mass formula to be used
00136     int set_mass_formula(nuclear_mass &nm) {
00137       nmp=&nm;
00138       return 0;
00139     }
00140 
00141     /// Compute the ground state assuming a fixed atomic number
00142     int calc_density_fixedA(double barn, thermo &th, int &Z, int A);
00143     
00144   protected:
00145 
00146 #ifndef DOXYGEN_INTERNAL
00147 
00148     /// Solve Equation 2.7.4 for a given pressure
00149     virtual int eq274(size_t nv, const ovector_view &nx, ovector_view &ny, 
00150                       void *&pa);
00151 
00152     /// The Gibbs free energy
00153     double gibbs(int Z, int A);
00154 
00155     /// The energy density
00156     double energy(double barn, int Z, int A);
00157 
00158     /// A solver to solve Eq. 2.7.4
00159     gsl_mroot_hybrids<void *,mm_funct<void *> > gs;
00160 
00161     /// The electron thermodynamics
00162     fermion e;
00163 
00164     /// The nuclear mass formula
00165     nuclear_mass *nmp;
00166     
00167     friend class io_tlate<bps_eos>;
00168 
00169 #endif
00170 
00171   };
00172 
00173   template<> int io_tlate<bps_eos>::input
00174     (cinput *co, in_file_format *ins, bps_eos *be);
00175   template<> int io_tlate<bps_eos>::output
00176     (coutput *co, out_file_format *outs, bps_eos *be);
00177   template<> const char *io_tlate<bps_eos>::type();
00178   
00179   typedef io_tlate<bps_eos> bps_eos_io_type;
00180 
00181 #ifndef DOXYGENP
00182 }
00183 #endif
00184 
00185 #endif

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.