00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, 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_NSE_EOS_H 00024 #define O2SCL_NSE_EOS_H 00025 00026 #include <o2scl/classical.h> 00027 #include <o2scl/constants.h> 00028 #include <o2scl/nuclear_dist.h> 00029 #include <o2scl/mm_funct.h> 00030 #include <o2scl/gsl_mroot_hybrids.h> 00031 00032 #ifndef DOXYGENP 00033 namespace o2scl { 00034 #endif 00035 00036 /** \brief Equation of state for nuclei in statistical equilibrium 00037 00038 This class computes the composition of matter in nuclear statistical 00039 equilibrium. The chemical potential of a nucleus X with proton number 00040 \f$ Z_X \f$ and neutron number \f$ N_X \f$ is given by 00041 \f[ 00042 \mu_X = N \mu_n + Z \mu_p - E_{\mathrm{bind},X} 00043 \f] 00044 where \f$ \mu_n \f$ and \f$ \mu_p \f$ are the neutron and proton 00045 chemical potentials and \f$ E_{\mathrm{bind},X} \f$ is the binding 00046 energy of the nucleus. 00047 00048 The baryon number density and electron fraction are then given 00049 by 00050 \f[ 00051 n_B = n_{X} (N_X + Z_X) \qquad Y_e n_B = n_X Z_X 00052 \f] 00053 where \f$ n_X \f$ is the number density which is determined from 00054 the chemical potential above. 00055 00056 This implicitly assumes that the nuclei are non-interacting. 00057 00058 \future Right now calc_density() needs a very good guess. This 00059 could be fixed, probably by solving for the log(mu/T) instead 00060 of mu. 00061 */ 00062 class nse_eos { 00063 00064 #ifndef DOXYGENP 00065 00066 protected: 00067 00068 /// Parameter structure 00069 typedef struct { 00070 double nb, Ye, T; 00071 nuclear_dist *ndp; 00072 } solve_parms; 00073 00074 /// Function to solve for baryon and charge conservation 00075 int solve_fun(size_t nv, const ovector_base &x, ovector_base &y, 00076 solve_parms &pa); 00077 00078 /// Solver 00079 mroot<solve_parms,mm_funct<solve_parms> > *root; 00080 00081 #endif 00082 00083 public: 00084 00085 nse_eos(); 00086 00087 /** \brief Calculate the equation of state as a function of the 00088 chemical potentials 00089 00090 Given \c mun, \c mup and \c T, this computes the composition 00091 (the individual densities are stored in the distribution \c 00092 nd) the baryon number density \c nb, and the electron fraction 00093 \c Ye. 00094 00095 This function does not use the solver. 00096 */ 00097 int calc_mu(double mun, double mup, double T, 00098 double &nb, double &Ye, thermo &th, nuclear_dist &nd); 00099 00100 /** \brief Calculate the equation of state as a function of the densities 00101 00102 Given the baryon number density \c nb, and the electron 00103 fraction \c Ye and the temperature \c T, this computes the 00104 composition (the individual densities are stored in the 00105 distribution \c nd) and the chemical potentials are given in 00106 \c mun and \c mup . 00107 00108 This function uses the solver to self-consistently compute 00109 the chemical potentials. 00110 */ 00111 int calc_density(double nb, double Ye, double T, 00112 double &mun, double &mup, thermo &th, nuclear_dist &nd); 00113 00114 /// Default solver 00115 gsl_mroot_hybrids<solve_parms,mm_funct<solve_parms> > def_root; 00116 00117 /** \brief Set the solver for use in computing the chemical potentials 00118 */ 00119 int set_mroot(mroot<solve_parms,mm_funct<solve_parms> > &rp) { 00120 root=&rp; 00121 return 0; 00122 } 00123 00124 }; 00125 00126 #ifndef DOXYGENP 00127 } 00128 #endif 00129 00130 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page