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_SN_FERMION_H 00024 #define O2SCL_SN_FERMION_H 00025 00026 #include <string> 00027 #include <iostream> 00028 #include <fstream> 00029 #include <cmath> 00030 #include <o2scl/constants.h> 00031 #include <o2scl/cern_mroot_root.h> 00032 #include <o2scl/inte.h> 00033 #include <o2scl/deriv_part.h> 00034 #include <o2scl/gsl_inte_qag.h> 00035 #include <o2scl/gsl_inte_qagiu.h> 00036 00037 #ifndef DOXYGENP 00038 namespace o2scl { 00039 #endif 00040 00041 /** 00042 \brief Equation of state for a relativistic fermion 00043 00044 \note This class does not work with inc_rest_mass=true. 00045 00046 This implements an equation of state for a relativistic fermion 00047 using direct integration. After subtracting the rest mass from 00048 the chemical potentials, the distribution function is 00049 \f[ 00050 \left\{1+\exp[(\sqrt{k^2+m^{* 2}}-m-\nu)/T]\right\}^{-1} 00051 \f] 00052 where \f$ k \f$ is the momentum, \f$ \nu \f$ is the effective 00053 chemical potential, \f$ m \f$ is the rest mass, and \f$ m^{*} 00054 \f$ is the effective mass. For later use, we define \f$ E^{*} = 00055 \sqrt{k^2 + m^{*2}} \f$ . The degeneracy parameter is 00056 \f[ 00057 \psi=(\nu+(m-m^{*}))/T 00058 \f] 00059 For \f$ \psi \f$ greater than \ref deg_limit (degenerate 00060 regime), a finite interval integrator is used and for \f$ \psi 00061 \f$ less than \ref deg_limit (non-degenerate regime), an 00062 integrator over the interval from \f$ [0,\infty) \f$ is 00063 used. Typical choices are Gauss-Legendre integration for the 00064 degenerate regime and Gauss-Laguerre integration for the 00065 non-degenerate regime. The upper limit on the degenerate 00066 integration is given by the solution of 00067 \f[ 00068 (\sqrt{k^2+m^{*,2}}-m-\nu)/T=\mathrm{f{l}imit} 00069 \f] 00070 which is 00071 \f[ 00072 \sqrt{(m+{\cal L})^2-m^{*2}} 00073 \f] 00074 where \f$ {\cal L}\equiv\mathrm{f{l}imit}\times T+\nu \f$ . 00075 00076 In the non-degenerate regime, we make the substitution 00077 \f$ u=k/T \f$ to ensure that the variable of integration does not 00078 have units. 00079 00080 Uncertainties are given in \ref unc. 00081 00082 \todo This needs to be corrected to calculate \f$ \sqrt{k^2+m^{* 00083 2}}-m \f$ gracefully when \f$ m^{*}\approx m \f$ . 00084 \todo Call error handler if inc_rest_mass is true or update 00085 to properly treat the case when inc_rest_mass is true. 00086 00087 \b Evaluation \b of \b the \b derivatives 00088 00089 The relevant 00090 derivatives of the distribution function are 00091 \f[ 00092 \frac{\partial f}{\partial T}= 00093 f(1-f)\frac{E^{*}-m-\nu}{T^2} 00094 \f] 00095 \f[ 00096 \frac{\partial f}{\partial \nu}= 00097 f(1-f)\frac{1}{T} 00098 \f] 00099 \f[ 00100 \frac{\partial f}{\partial k}= 00101 -f(1-f)\frac{k}{E^{*} T} 00102 \f] 00103 \f[ 00104 \frac{\partial f}{\partial m^{*}}= 00105 -f(1-f)\frac{m^{*}}{E^{*} T} 00106 \f] 00107 00108 We also need the derivative of the entropy integrand w.r.t. the 00109 distribution function, which is 00110 \f[ 00111 {\cal S}\equiv f \ln f +(1-f) \ln (1-f) \qquad 00112 \frac{\partial {\cal S}}{\partial f} = \ln 00113 \left(\frac{f}{1-f}\right) = 00114 \left(\frac{\nu-E^{*}+m}{T}\right) 00115 \f] 00116 where the entropy density is 00117 \f[ 00118 s = - \frac{g}{2 \pi^2} \int_0^{\infty} {\cal S} k^2 d k 00119 \f] 00120 00121 The derivatives can be integrated directly (\ref method = \ref 00122 direct) or they may be converted to integrals over the 00123 distribution function through an integration by parts (\ref 00124 method = \ref byparts) 00125 \f[ 00126 \int_a^b f(k) \frac{d g(k)}{dk} dk = \left.f(k) g(k)\right|_{k=a}^{k=b} 00127 - \int_a^b g(k) \frac{d f(k)}{dk} dk 00128 \f] 00129 using the distribution function for \f$ f(k) \f$ and 0 and 00130 \f$ \infty \f$ as the limits, we have 00131 \f[ 00132 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{d g(k)}{dk} f dk = 00133 \frac{g}{2 \pi^2} \int_0^{\infty} g(k) f (1-f) \frac{k}{E^{*} T} dk 00134 \f] 00135 as long as \f$ g(k) \f$ vanishes at \f$ k=0 \f$ . 00136 Rewriting, 00137 \f[ 00138 \frac{g}{2 \pi^2} \int_0^{\infty} h(k) f (1-f) dk = 00139 \frac{g}{2 \pi^2} \int_0^{\infty} f \frac{T}{k} 00140 \left[ h^{\prime} E^{*}-\frac{h E^{*}}{k}+\frac{h k}{E^{*}} \right] dk 00141 \f] 00142 as long as \f$ h(k)/k \f$ vanishes at \f$ k=0 \f$ . 00143 00144 \b Explicit \b forms 00145 00146 1) The derivative of the density wrt the chemical potential 00147 \f[ 00148 \left(\frac{d n}{d \mu}\right)_T = 00149 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{k^2}{T} f (1-f) dk 00150 \f] 00151 Using \f$ h(k)=k^2/T \f$ we get 00152 \f[ 00153 \left(\frac{d n}{d \mu}\right)_T = 00154 \frac{g}{2 \pi^2} \int_0^{\infty} 00155 \left(\frac{k^2+E^{*2}}{E^{*}}\right) f dk 00156 \f] 00157 00158 2) The derivative of the density wrt the temperature 00159 \f[ 00160 \left(\frac{d n}{d T}\right)_{\mu} = 00161 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{k^2(E^{*}-m-\nu)}{T^2} 00162 f (1-f) dk 00163 \f] 00164 Using \f$ h(k)=k^2(E^{*}-\nu)/T^2 \f$ we get 00165 \f[ 00166 \left(\frac{d n}{d T}\right)_{\mu} = 00167 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{f}{T} 00168 \left[2 k^2+E^{*2}-E^{*}\left(\nu+m\right)- 00169 k^2 \left(\frac{\nu+m}{E^{*}}\right)\right] dk 00170 \f] 00171 00172 3) The derivative of the entropy wrt the chemical potential 00173 \f[ 00174 \left(\frac{d s}{d \mu}\right)_T = 00175 \frac{g}{2 \pi^2} \int_0^{\infty} k^2 f (1-f) 00176 \frac{(E^{*}-m-\nu)}{T^2} dk 00177 \f] 00178 This verifies the Maxwell relation 00179 \f[ 00180 \left(\frac{d s}{d \mu}\right)_T = 00181 \left(\frac{d n}{d T}\right)_{\mu} 00182 \f] 00183 00184 4) The derivative of the entropy wrt the temperature 00185 \f[ 00186 \left(\frac{d s}{d T}\right)_{\mu} = 00187 \frac{g}{2 \pi^2} \int_0^{\infty} k^2 f (1-f) 00188 \frac{(E^{*}-m-\nu)^2}{T^3} dk 00189 \f] 00190 Using \f$ h(k)=k^2 (E^{*}-\nu)^2/T^3 \f$ 00191 \f[ 00192 \left(\frac{d s}{d T}\right)_{\mu} = 00193 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{f(E^{*}-m-\nu)}{E^{*}T^2} 00194 \left[E^{* 3}+3 E^{*} k^2- (E^{* 2}+k^2)(\nu+m)\right] d k 00195 \f] 00196 00197 5) The derivative of the density wrt the effective mass 00198 \f[ 00199 \left(\frac{d n}{d m^{*}}\right)_{T,\mu} = 00200 -\frac{g}{2 \pi^2} \int_0^{\infty} 00201 \frac{k^2 m^{*}}{E^{*} T} f (1-f) dk 00202 \f] 00203 Using \f$ h(k)=-(k^2 m^{*})/(E^{*} T) \f$ we get 00204 \f[ 00205 \left(\frac{d n}{d m^{*}}\right)_{T,\mu} = 00206 -\frac{g}{2 \pi^2} \int_0^{\infty} 00207 m^{*} f dk 00208 \f] 00209 00210 \note The dsdT integration doesn't work well if the system is 00211 very degenerate. When method is byparts, the integral involves a 00212 large cancellation between the regions from \f$ k \in (0, 00213 \mathrm{ulimit/2}) \f$ and \f$ k \in (\mathrm{ulimit/2}, 00214 \mathrm{ulimit}) \f$. Switching to method=direct and setting the 00215 lower limit to \f$ \mathrm{llimit} \f$, may help, but recent 00216 testing on this gave negative values for dsdT. For very 00217 degenerate systems, an expansion is probably better than trying 00218 to perform the integration. 00219 00220 \future This class will have difficulty with extremely degenerate 00221 or extremely non-degnerate systems. Fix this. 00222 \future Create a more intelligent method for dealing with bad 00223 initial guesses for the chemical potential in calc_density(). 00224 */ 00225 class sn_fermion : public fermion_T, public deriv_part { 00226 00227 public: 00228 00229 /// Create a fermion with mass \c m and degeneracy \c g 00230 sn_fermion(double m=0.0, double g=0.0); 00231 virtual ~sn_fermion(); 00232 00233 /** \brief The critical degeneracy at which to switch integration 00234 techniques (default 2.0) 00235 */ 00236 double deg_limit; 00237 00238 /** 00239 \brief The limit for the Fermi functions (default 20.0) 00240 00241 sn_fermion will ignore corrections smaller than about 00242 \f$ \exp(-\mathrm{f{l}imit}) \f$ . 00243 */ 00244 double flimit; 00245 00246 /// Storage for the most recently calculated uncertainties 00247 fermion unc; 00248 /// Storage for the most recently calculated uncertainties 00249 deriv_part dunc; 00250 00251 /** \name Method of computing derivatives 00252 */ 00253 //@{ 00254 /// Method (default is \ref byparts) 00255 int method; 00256 /// In the form containing \f$ f(1-f) \f$ . 00257 static const int direct=1; 00258 /// Integrate by parts 00259 static const int byparts=2; 00260 //@} 00261 00262 /** 00263 \brief Calculate properties as function of chemical potential 00264 */ 00265 virtual int calc_mu(const double temper); 00266 00267 /** \brief Calculate properties as function of density 00268 */ 00269 virtual int calc_density(const double temper); 00270 00271 /** \brief Calculate properties with antiparticles as function of 00272 chemical potential 00273 */ 00274 virtual int pair_mu(const double temper); 00275 00276 /** \brief Calculate properties with antiparticles as function of 00277 density 00278 */ 00279 virtual int pair_density(const double temper); 00280 00281 /// Calculate effective chemical potential from density 00282 virtual int nu_from_n(const double temper); 00283 00284 /** 00285 \brief Set inte objects 00286 00287 The first integrator is used for non-degenerate integration 00288 and should integrate from 0 to \f$ \infty \f$ (like \ref 00289 gsl_inte_qagiu). The second integrator is for the degenerate 00290 case, and should integrate between two finite values. 00291 */ 00292 int set_inte(inte<const double,funct<const double> > &unit, 00293 inte<const double,funct<const double> > &udit); 00294 00295 // friend class sn_fermion_io_type; 00296 // friend class aio_tlate<sn_fermion>; 00297 00298 /** \brief Set the solver for use in calculating the chemical 00299 potential from the density */ 00300 int set_density_root(root<const double,funct<const double> > &rp) { 00301 density_root=&rp; 00302 return 0; 00303 } 00304 00305 /// The default integrator for the non-degenerate regime 00306 gsl_inte_qagiu<const double,funct<const double> > def_nit; 00307 00308 /// The default integrator for the degenerate regime 00309 gsl_inte_qag<const double,funct<const double> > def_dit; 00310 00311 /// The default solver for npen_density() and pair_density() 00312 cern_mroot_root<const double,funct<const double> > def_density_root; 00313 00314 /// Return string denoting type ("sn_fermion") 00315 virtual const char *type() { return "sn_fermion"; }; 00316 00317 protected: 00318 00319 #ifndef DOXYGENP 00320 00321 /// The integrator for non-degenerate fermions 00322 inte<const double,funct<const double> > *nit; 00323 00324 /// The integrator for degenerate fermions 00325 inte<const double,funct<const double> > *dit; 00326 00327 /// The solver for calc_density() and pair_density() 00328 root<const double,funct<const double> > *density_root; 00329 00330 /** \name The integrands, as a function of \f$ u=k/T \f$, for 00331 non-degenerate integrals 00332 */ 00333 //@{ 00334 double density_fun(double u, const double &temper); 00335 double energy_fun(double u, const double &temper); 00336 double entropy_fun(double u, const double &temper); 00337 double density_T_fun(double k, const double &temper); 00338 double density_mu_fun(double k, const double &temper); 00339 double entropy_T_fun(double k, const double &temper); 00340 double density_ms_fun(double k, const double &temper); 00341 //@} 00342 00343 /** \name The integrands, as a function of momentum, for the 00344 degenerate integrals 00345 */ 00346 //@{ 00347 double deg_density_fun(double u, const double &temper); 00348 double deg_energy_fun(double u, const double &temper); 00349 double deg_entropy_fun(double u, const double &temper); 00350 double deg_density_T_fun(double k, const double &temper); 00351 double deg_density_mu_fun(double k, const double &temper); 00352 double deg_entropy_T_fun(double k, const double &temper); 00353 double deg_density_ms_fun(double k, const double &temper); 00354 //@} 00355 00356 /** \name The function pointers for the non-degenerate integrals 00357 */ 00358 //@{ 00359 funct_mfptr_noerr<sn_fermion,const double> *density_fun_f; 00360 funct_mfptr_noerr<sn_fermion,const double> *energy_fun_f; 00361 funct_mfptr_noerr<sn_fermion,const double> *entropy_fun_f; 00362 funct_mfptr_noerr<sn_fermion,const double> *density_mu_fun_f; 00363 funct_mfptr_noerr<sn_fermion,const double> *density_T_fun_f; 00364 funct_mfptr_noerr<sn_fermion,const double> *entropy_T_fun_f; 00365 funct_mfptr_noerr<sn_fermion,const double> *density_ms_fun_f; 00366 //@} 00367 00368 /** \name The function pointers for the degenerate integrals 00369 */ 00370 //@{ 00371 funct_mfptr_noerr<sn_fermion,const double> *deg_density_fun_f; 00372 funct_mfptr_noerr<sn_fermion,const double> *deg_energy_fun_f; 00373 funct_mfptr_noerr<sn_fermion,const double> *deg_entropy_fun_f; 00374 funct_mfptr_noerr<sn_fermion,const double> *deg_density_mu_fun_f; 00375 funct_mfptr_noerr<sn_fermion,const double> *deg_density_T_fun_f; 00376 funct_mfptr_noerr<sn_fermion,const double> *deg_entropy_T_fun_f; 00377 funct_mfptr_noerr<sn_fermion,const double> *deg_density_ms_fun_f; 00378 //@} 00379 00380 /** \brief Solve for the chemical potential from the density 00381 for calc_density() 00382 */ 00383 int solve_fun(double x, double &yy, const double &temper); 00384 00385 /** \brief Solve for the chemical potential from the density 00386 for pair_density() 00387 */ 00388 int pair_fun(double x, double &yy, const double &temper); 00389 00390 #endif 00391 00392 }; 00393 00394 template<> int io_tlate<sn_fermion>::input 00395 (cinput *co, in_file_format *ins, sn_fermion *f); 00396 template<> int io_tlate<sn_fermion>::output 00397 (coutput *co, out_file_format *ins, sn_fermion *f); 00398 template<> const char *io_tlate<sn_fermion>::type(); 00399 00400 typedef io_tlate<sn_fermion> sn_fermion_io_type; 00401 00402 #ifndef DOXYGENP 00403 } 00404 #endif 00405 00406 #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