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