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_REL_FERMION_H 00024 #define O2SCL_REL_FERMION_H 00025 00026 #include <string> 00027 #include <iostream> 00028 #include <fstream> 00029 #include <cmath> 00030 #include <o2scl/constants.h> 00031 #include <o2scl/mroot.h> 00032 #include <o2scl/inte.h> 00033 #include <o2scl/fermion.h> 00034 #include <o2scl/cern_mroot_root.h> 00035 #include <o2scl/gsl_inte_qagiu.h> 00036 #include <o2scl/gsl_inte_qag.h> 00037 00038 #ifndef DOXYGENP 00039 namespace o2scl { 00040 #endif 00041 00042 /** 00043 \brief Equation of state for a relativistic fermion 00044 00045 \hline 00046 <b>Method:</b> 00047 00048 This implements an equation of state for a relativistic fermion 00049 using direct integration. Define the degeneracy parameter 00050 \f[ 00051 \psi=(\nu-m^{*})/T 00052 \f] 00053 where \f$ \nu \f$ is the effective chemical potential and \f$ 00054 m^{*} \f$ is the effective mass. For \f$ \psi \f$ greater than 00055 \ref deg_limit (degenerate regime), a finite interval integrator 00056 is used and for \f$ \psi \f$ less than \ref deg_limit 00057 (non-degenerate regime), an integrator over the interval from 00058 \f$ [0,\infty) \f$ is used. The upper limit on the degenerate 00059 integration is given by 00060 \f[ 00061 \sqrt{(u T+{\nu})^2-m^{*,2}} 00062 \f] 00063 where \f$ u \f$ is \ref rel_fermion::upper_limit_fac . 00064 00065 In the degenerate regime, the entropy integrand 00066 \f[ 00067 - k^2 \left[ n \log n + \left(1-n\right) \log 00068 \left(1-n \right) \right] 00069 \f] 00070 can lose precision when \f$ (E - \nu)/T \f$ is negative 00071 and sufficiently large in absolute magnitude. Thus when 00072 \f$ (E - \nu)/T < S \f$ where \f$ S \f$ is stored in 00073 \ref deg_entropy_fac (default is -30), the integrand 00074 is written as 00075 \f[ 00076 -k^2 \left( E/T-\nu/T \right) e^{E/T-\nu/T} \, . 00077 \f] 00078 If \f$ (E - \nu)/T < S \f$ is less than -1 times \ref exp_limit 00079 (e.g. less than -200), then the entropy integrand is assumed 00080 to be zero. 00081 00082 The integrands in the non-degenerate regime are written 00083 in a dimensionless form, by defining 00084 \f$ u \equiv p/T, y \equiv \nu/T, \f$ and 00085 \f$ \mathrm{mx} \equiv m^{*}/T \f$. 00086 The density integrand is 00087 \f[ 00088 \left(\mathrm{mx}+u\right) \sqrt{u^2+2 \mathrm{mx} u} 00089 \left(\frac{e^{y}}{e^{\mathrm{mx}+u}+e^{y}}\right) \, , 00090 \f] 00091 the energy integrand is 00092 \f[ 00093 \left(\mathrm{mx}+u\right)^2 \sqrt{u^2+2 \mathrm{mx} u} 00094 \left(\frac{e^{y}}{e^{\mathrm{mx}+u}+e^{y}}\right) \, , 00095 \f] 00096 and the entropy integrand is 00097 \f[ 00098 \left(\mathrm{mx}+u\right) \sqrt{u^2+2 \mathrm{mx} u} 00099 \left(t_1+t_2\right) \, , 00100 \f] 00101 where 00102 \f{eqnarray*} 00103 t_1 &=& \log \left(1+e^{y-\mathrm{mx}-u}\right)/ 00104 \left(1+e^{y-\mathrm{mx}-u}\right) \nonumber \\ 00105 t_2 &=& \log \left(1+e^{\mathrm{mx}+u-y}\right)/ 00106 \left(1+e^{\mathrm{mx}+u-y}\right) \, . 00107 \f} 00108 00109 The default integrators are gsl_inte_qag (for degenerate particles) 00110 and gsl_inte_qagiu (for non-degenerate particles). 00111 00112 \hline 00113 <b>Accuracy:</b> 00114 00115 The default settings for for this class give an accuracy of at 00116 least 1 part in \f$ 10^6 \f$ (and frequently better than this). 00117 00118 When the integrators provide numerical uncertainties, these 00119 uncertainties are stored in \ref unc. In the case of 00120 calc_density() and pair_density(), the uncertainty from the 00121 numerical accuracy of the solver is not included. (There is also 00122 a relatively small inaccuracy due to the mathematical evaluation 00123 of the integrands which is not included in \ref unc.) 00124 00125 One way to improve the accuracy of the computation is just to 00126 decrease the tolerances on the default integration objects. This 00127 can be done, using, for example 00128 \code 00129 rel_fermion rf(1.0,2.0); 00130 rf.def_dit.tolx/=1.0e2; 00131 rf.def_dit.tolf/=1.0e2; 00132 rf.def_nit.tolx/=1.0e2; 00133 rf.def_nit.tolf/=1.0e2; 00134 \endcode 00135 which decreases the both the relative and absolute tolerances 00136 for both the degenerate and non-degenerate integrators. If one 00137 is using either the calc_density() or pair_density() functions, 00138 one may also have to improve the accuracy of the solver which 00139 determines the chemical potential from the density. For 00140 the default solver, this could be done with 00141 \code 00142 rf.def_density_root.tolx/=1.0e2; 00143 rf.def_density_root.tolf/=1.0e2; 00144 \endcode 00145 Of course if these tolerances are too small, the calculation 00146 may fail. 00147 00148 \hline 00149 <b>Todos:</b> 00150 00151 \note This does not work with inc_rest_mass=false (3/30/09: 00152 There is a significant amount of testing code to ensure that 00153 it does work with inc_rest_mass=false, so this may have 00154 been fixed already.) 00155 00156 \future Improve the asymptotics of the non-degenerate 00157 integrands. 00158 00159 \future It appears this doesn't compute the uncertainty in the 00160 chemical potential or density with calc_density(). This could 00161 be fixed. 00162 00163 */ 00164 class rel_fermion : public fermion_T { 00165 00166 public: 00167 00168 /// \name Numerical parameters 00169 //@{ 00170 /** \brief The critical degeneracy at which to switch integration 00171 techniques (default 2) 00172 */ 00173 double deg_limit; 00174 00175 /** \brief The limit for exponentials to ensure integrals are finite 00176 (default 200) 00177 */ 00178 double exp_limit; 00179 00180 /// The factor for the degenerate upper limits (default 20) 00181 double upper_limit_fac; 00182 00183 /// A factor for the degenerate entropy integration (default 30) 00184 double deg_entropy_fac; 00185 //@} 00186 00187 /// Storage for the uncertainty 00188 fermion unc; 00189 00190 /** \brief If true, use the present value of the chemical potential as 00191 a guess for the new chemical potential 00192 */ 00193 bool guess_from_nu; 00194 00195 /// Create a fermion with mass \c m and degeneracy \c g 00196 rel_fermion(double m=0.0, double g=0.0); 00197 virtual ~rel_fermion(); 00198 00199 /** 00200 \brief Calculate properties as function of chemical potential 00201 */ 00202 virtual int calc_mu(double temper); 00203 00204 /** \brief Calculate properties as function of density 00205 */ 00206 virtual int calc_density(double temper); 00207 00208 /** \brief Calculate properties with antiparticles as function of 00209 chemical potential 00210 */ 00211 virtual int pair_mu(double temper); 00212 00213 /** \brief Calculate properties with antiparticles as function of 00214 density 00215 */ 00216 virtual int pair_density(double temper); 00217 00218 /// Calculate effective chemical potential from density 00219 virtual int nu_from_n(double temper); 00220 00221 /// Set integrators 00222 int set_inte(inte<double,funct<double> > &non_it, 00223 inte<double,funct<double> > °_it); 00224 00225 /** \brief Set the solver for use in calculating the chemical 00226 potential from the density */ 00227 int set_density_root(root<double,funct<double> > &rp) { 00228 density_root=&rp; 00229 return 0; 00230 } 00231 00232 /// The default solver for calc_density(). 00233 cern_mroot_root<double,funct<double> > def_density_root; 00234 00235 /// The default integrator for degenerate fermions 00236 gsl_inte_qag<double,funct<double> > def_dit; 00237 00238 /// The default integrator for non-degenerate fermions 00239 gsl_inte_qagiu<double,funct<double> > def_nit; 00240 00241 /// Return string denoting type ("rel_fermion") 00242 virtual const char *type() { return "rel_fermion"; } 00243 00244 protected: 00245 00246 #ifndef DOXYGEN_INTERNAL 00247 00248 /// The non-degenerate integrator 00249 inte<double,funct<double> > *nit; 00250 /// The degenerate integrator 00251 inte<double,funct<double> > *dit; 00252 /// The solver for calc_density() 00253 root<double,funct<double> > *density_root; 00254 00255 /// The integrand for the density for non-degenerate fermions 00256 double density_fun(double u, double &pa); 00257 00258 /// The integrand for the energy density for non-degenerate fermions 00259 double energy_fun(double u, double &pa); 00260 00261 /// The integrand for the entropy density for non-degenerate fermions 00262 double entropy_fun(double u, double &pa); 00263 00264 /// The integrand for the density for degenerate fermions 00265 double deg_density_fun(double u, double &pa); 00266 00267 /// The integrand for the energy density for degenerate fermions 00268 double deg_energy_fun(double u, double &pa); 00269 00270 /// The integrand for the entropy density for degenerate fermions 00271 double deg_entropy_fun(double u, double &pa); 00272 00273 /// Solve for the chemical potential given the density 00274 int solve_fun(double x, double &yy, double &pa); 00275 00276 /// Solve for the chemical potential given the density with antiparticles 00277 int pair_fun(double x, double &yy, double &pa); 00278 00279 #endif 00280 00281 }; 00282 00283 #ifndef DOXYGENP 00284 } 00285 #endif 00286 00287 #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