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_SN_NR_FERMION_H 00024 #define O2SCL_SN_NR_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/deriv_part.h> 00033 00034 #ifndef DOXYGENP 00035 namespace o2scl { 00036 #endif 00037 00038 /** 00039 \brief Equation of state for a nonrelativistic fermion 00040 00041 This does not include the rest mass energy in the chemical 00042 potential or the rest mass energy density in the energy density 00043 to alleviate numerical precision problems at low densities 00044 00045 This implements an equation of state for a nonrelativistic fermion 00046 using direct integration. After subtracting the rest mass from 00047 the chemical potentials, the distribution function is 00048 \f[ 00049 \left\{1+\exp\left[\left(\frac{k^2} 00050 {2 m^{*}}-\nu\right)/T\right]\right\}^{-1} 00051 \f] 00052 where \f$ \nu \f$ is the effective chemical potential, \f$ m \f$ is 00053 the rest mass, and \f$ m^{*} \f$ is the effective mass. 00054 For later use, we define \f$ E^{*} = k^2/2/m^{*} \f$ . 00055 00056 Uncertainties are given in \ref unc. 00057 00058 \b Evaluation \b of \b the \b derivatives 00059 00060 The relevant derivatives of the distribution function are 00061 \f[ 00062 \frac{\partial f}{\partial T}= 00063 f(1-f)\frac{E^{*}-\nu}{T^2} 00064 \f] 00065 \f[ 00066 \frac{\partial f}{\partial \nu}= 00067 f(1-f)\frac{1}{T} 00068 \f] 00069 \f[ 00070 \frac{\partial f}{\partial k}= 00071 -f(1-f)\frac{k}{m^{*} T} 00072 \f] 00073 \f[ 00074 \frac{\partial f}{\partial m^{*}}= 00075 f(1-f)\frac{k^2}{2 m^{*2} T} 00076 \f] 00077 00078 We also need the derivative of the entropy integrand w.r.t. the 00079 distribution function, which is quite simple 00080 \f[ 00081 {\cal S}\equiv f \ln f +(1-f) \ln (1-f) \qquad 00082 \frac{\partial {\cal S}}{\partial f} = \ln 00083 \left(\frac{f}{1-f}\right) = 00084 \left(\frac{\nu-E^{*}}{T}\right) 00085 \f] 00086 where the entropy density is 00087 \f[ 00088 s = - \frac{g}{2 \pi^2} \int_0^{\infty} {\cal S} k^2 d k 00089 \f] 00090 00091 The derivatives can be integrated directly 00092 or they may be converted to integrals 00093 over the distribution function through an integration by parts 00094 \f[ 00095 \int_a^b f(k) \frac{d g(k)}{dk} dk = \left.f(k) g(k)\right|_{k=a}^{k=b} 00096 - \int_a^b g(k) \frac{d f(k)}{dk} dk 00097 \f] 00098 using the distribution function for \f$ f(k) \f$ and 0 and \f$ 00099 \infty \f$ as the limits, we have 00100 \f[ 00101 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{d g(k)}{dk} f dk = 00102 \frac{g}{2 \pi^2} \int_0^{\infty} g(k) f (1-f) \frac{k}{E^{*} T} dk 00103 \f] 00104 as long as \f$ g(k) \f$ vanishes at \f$ k=0 \f$ . 00105 Rewriting, 00106 \f[ 00107 \frac{g}{2 \pi^2} \int_0^{\infty} h(k) f (1-f) dk = 00108 \frac{g}{2 \pi^2} \int_0^{\infty} f \frac{T m^{*}}{k} 00109 \left[ h^{\prime} - \frac{h}{k}\right] d k 00110 \f] 00111 as long as \f$ h(k)/k \f$ vanishes at \f$ k=0 \f$ . 00112 00113 \b Explicit \b forms 00114 00115 1) The derivative of the density wrt the chemical potential 00116 \f[ 00117 \left(\frac{d n}{d \mu}\right)_T = 00118 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{k^2}{T} f (1-f) dk 00119 \f] 00120 Using \f$ h(k)=k^2/T \f$ we get 00121 \f[ 00122 \left(\frac{d n}{d \mu}\right)_T = 00123 \frac{g}{2 \pi^2} \int_0^{\infty} 00124 m^{*} f dk 00125 \f] 00126 00127 2) The derivative of the density wrt the temperature 00128 \f[ 00129 \left(\frac{d n}{d T}\right)_{\mu} = 00130 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{k^2(E^{*}-\nu)}{T^2} 00131 f (1-f) dk 00132 \f] 00133 Using \f$ h(k)=k^2(E^{*}-\nu)/T^2 \f$ we get 00134 \f[ 00135 \left(\frac{d n}{d T}\right)_{\mu} = 00136 \frac{g}{2 \pi^2} \int_0^{\infty} \frac{f}{T} 00137 \left[m^{*} \left(E^{*}-\nu\right) -k^2\right] d k 00138 \f] 00139 00140 3) The derivative of the entropy wrt the chemical potential 00141 \f[ 00142 \left(\frac{d s}{d \mu}\right)_T = 00143 \frac{g}{2 \pi^2} \int_0^{\infty} k^2 f (1-f) 00144 \frac{(E^{*}-\nu)}{T^2} dk 00145 \f] 00146 This verifies the Maxwell relation 00147 \f[ 00148 \left(\frac{d s}{d \mu}\right)_T = 00149 \left(\frac{d n}{d T}\right)_{\mu} 00150 \f] 00151 00152 4) The derivative of the entropy wrt the temperature 00153 \f[ 00154 \left(\frac{d s}{d T}\right)_{\mu} = 00155 \frac{g}{2 \pi^2} \int_0^{\infty} k^2 f (1-f) 00156 \frac{(E^{*}-\nu)^2}{T^3} dk 00157 \f] 00158 Using \f$ h(k)=k^2 (E^{*}-\nu)^2/T^3 \f$ 00159 \f[ 00160 \left(\frac{d s}{d T}\right)_{\mu} = 00161 \frac{g}{2 \pi^2} \int_0^{\infty} 00162 f \frac{m^{*}}{T^2} \left[\left( E^{*}-\nu \right)^2 00163 +\frac{2 k^2}{m^{*}} \left(E^{*}-\nu\right)\right] d k 00164 \f] 00165 00166 5) The derivative of the density wrt the effective mass 00167 \f[ 00168 \left(\frac{d n}{d m^{*}}\right)_{T,\mu} = 00169 \frac{g}{2 \pi^2} \int_0^{\infty} 00170 \frac{k^2}{2 m^{* 2} T} f (1-f) k^2 dk 00171 \f] 00172 Using \f$ h(k)=k^4/(2 m^{* 2} T) \f$ we get 00173 \f[ 00174 \left(\frac{d n}{d m^{*}}\right)_{T,\mu} = 00175 \frac{g}{2 \pi^2} \int_0^{\infty} f 00176 \frac{3 k^2}{2 m^{*}} d k 00177 \f] 00178 00179 <b> New section</b> 00180 00181 \f$ u = k^2/2/m^{*}/T \f$ and \f$ y=\mu/T \f$, so 00182 \f[ 00183 k d k = m^{*} T d u 00184 \f] 00185 or 00186 \f[ 00187 d k = \frac{m^{*} T}{\sqrt{2 m^{*} T u}} d u = 00188 \sqrt{\frac{m^{*} T}{2 u}} d u 00189 \f] 00190 00191 1) The derivative of the density wrt the chemical potential 00192 \f[ 00193 \left(\frac{d n}{d \mu}\right)_T = 00194 \frac{g m^{* 3/2} \sqrt{T}}{2^{3/2} \pi^2} \int_0^{\infty} 00195 u^{-1/2} f d u 00196 \f] 00197 00198 2) The derivative of the density wrt the temperature 00199 \f[ 00200 \left(\frac{d n}{d T}\right)_{\mu} = 00201 \frac{g m^{* 3/2} \sqrt{T}} 00202 {2^{3/2} \pi^2} \int_0^{\infty} f d u 00203 \left[ 3 u^{1/2} - y u^{-1/2}\right] 00204 \f] 00205 00206 4) The derivative of the entropy wrt the temperature 00207 \f[ 00208 \left(\frac{d s}{d T}\right)_{\mu} = 00209 \frac{g m^{* 3/2} T^{1/2}}{2^{3/2} \pi^2} \int_0^{\infty} 00210 f \left[ 5 u^{3/2} - 6 y u^{1/2} + y^2 u^{-1/2}\right] d u 00211 \f] 00212 00213 5) The derivative of the density wrt the effective mass 00214 \f[ 00215 \left(\frac{d n}{d m^{*}}\right)_{T,\mu} = 00216 \frac{3 g m{* 1/2} T^{3/2}}{2^{3/2} \pi^2} 00217 \int_0^{\infty} u^{1/2} f d u 00218 \f] 00219 00220 */ 00221 class sn_nr_fermion : public deriv_fermion { 00222 00223 public: 00224 00225 /// Create a fermion with mass \c m and degeneracy \c g 00226 sn_nr_fermion(double m=0.0, double g=0.0); 00227 virtual ~sn_nr_fermion(); 00228 00229 /** 00230 \brief The limit for the Fermi functions (default 20.0) 00231 00232 sn_nr_fermion will ignore corrections smaller than about 00233 \f$ \exp(-\mathrm{f{l}imit}) \f$ . 00234 */ 00235 double flimit; 00236 00237 /// Storage for the most recently calculated uncertainties 00238 deriv_fermion unc; 00239 00240 /** \brief If true, use the present value of the chemical potential as 00241 a guess for the new chemical potential 00242 */ 00243 bool guess_from_nu; 00244 00245 /** 00246 \brief Calculate properties as function of chemical potential 00247 */ 00248 virtual int calc_mu(const double temper); 00249 00250 /** \brief Calculate properties as function of density 00251 */ 00252 virtual int calc_density(const double temper); 00253 00254 /** \brief Calculate properties with antiparticles as function of 00255 chemical potential 00256 */ 00257 virtual int pair_mu(const double temper); 00258 00259 /** \brief Calculate properties with antiparticles as function of 00260 density 00261 */ 00262 virtual int pair_density(const double temper); 00263 00264 /// Calculate effective chemical potential from density 00265 virtual int nu_from_n(const double temper); 00266 00267 // friend class sn_nr_fermion_io_type; 00268 // friend class aio_tlate<sn_nr_fermion>; 00269 00270 /** \brief Set the solver for use in calculating the chemical 00271 potential from the density */ 00272 int set_density_root(root<void *,funct<void *> > &rp) { 00273 density_root=&rp; 00274 return 0; 00275 } 00276 00277 /// The default solver for npen_density() and pair_density() 00278 cern_mroot_root<void *,funct<void*> > def_density_root; 00279 00280 /// Return string denoting type ("sn_nr_fermion") 00281 virtual const char *type() { return "sn_nr_fermion"; }; 00282 00283 protected: 00284 00285 #ifndef DOXYGEN_INTERNAL 00286 00287 /// Solver to compute chemical potential from density 00288 root<void *,funct<void *> > *density_root; 00289 00290 /// Function to compute chemical potential from density 00291 int solve_fun(double x, double &yy, void *&pa); 00292 00293 /** \brief Function to compute chemical potential from density 00294 when antiparticles are included 00295 */ 00296 int pair_fun(double x, double &yy, void *&pa); 00297 00298 #endif 00299 00300 }; 00301 00302 template<> int io_tlate<sn_nr_fermion>::input 00303 (cinput *co, in_file_format *ins, sn_nr_fermion *f); 00304 template<> int io_tlate<sn_nr_fermion>::output 00305 (coutput *co, out_file_format *ins, sn_nr_fermion *f); 00306 template<> const char *io_tlate<sn_nr_fermion>::type(); 00307 00308 typedef io_tlate<sn_nr_fermion> sn_nr_fermion_io_type; 00309 00310 #ifndef DOXYGENP 00311 } 00312 #endif 00313 00314 #endif