![]() |
Particles and Nuclei Sub-Library: Version 0.910
|
00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006-2012, 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/cern_mroot_root.h> 00034 #include <o2scl/gsl_inte_qagiu.h> 00035 #include <o2scl/gsl_inte_qag.h> 00036 #include <o2scl/eff_fermion.h> 00037 00038 #ifndef DOXYGENP 00039 namespace o2scl { 00040 #endif 00041 00042 /** \brief Equation of state for a relativistic fermion 00043 00044 This class computes the thermodynamics of a relativistic fermion 00045 either as a function of the density or the chemical potential. 00046 It employs direct integration, using two different integrators 00047 for the degenerate and non-degenerate regimes. The default 00048 integrators are gsl_inte_qag (for degenerate fermions) and 00049 gsl_inte_qagiu (for non-degenerate fermions). For the functions 00050 calc_mu() and calc_density(), if the temperature argument is 00051 less than or equal to zero, the functions \ref 00052 fermion_zerot::calc_mu_zerot() and \ref 00053 fermion_zerot::calc_density_zerot() will be used to compute the 00054 result. 00055 00056 \hline 00057 <b>Degeneracy parameter:</b> 00058 00059 Define the degeneracy parameter 00060 \f[ 00061 \psi=(\nu-m^{*})/T 00062 \f] 00063 where \f$ \nu \f$ is the effective chemical potential and \f$ 00064 m^{*} \f$ is the effective mass. For \f$ \psi \f$ greater than 00065 \ref deg_limit (degenerate regime), a finite interval integrator 00066 is used and for \f$ \psi \f$ less than \ref deg_limit 00067 (non-degenerate regime), an integrator over the interval from 00068 \f$ [0,\infty) \f$ is used. In the case where \ref 00069 part::inc_rest_mass is false, the degeneracy parameter is 00070 \f[ 00071 \psi=(\nu+m-m^{*})/T 00072 \f] 00073 00074 <b>Integration limits:</b> 00075 00076 The upper limit on the degenerate integration is given by 00077 \f[ 00078 \mathrm{upper~limit} = \sqrt{{\cal L}^2-m^{*,2}} 00079 \f] 00080 where \f$ {\cal L}\equiv u T+\nu \f$ and \f$ u \f$ is \ref 00081 rel_fermion::upper_limit_fac . In the case where \ref 00082 part::inc_rest_mass is false, the result is 00083 \f[ 00084 \mathrm{upper~limit} = \sqrt{(m+{\cal L})^2-m^{*2}} 00085 \f] 00086 00087 The entropy is only significant at the Fermi surface, thus 00088 in the degenerate case, the lower limit of the entropy 00089 integral can be given be determined by the value of \f$ k \f$ 00090 which solves 00091 \f[ 00092 - u = \frac{\sqrt{k^2+m^{* 2}}-\nu}{T} 00093 \f] 00094 The solution is 00095 \f[ 00096 \mathrm{lower~limit} = \sqrt{(-u T+{\nu})^2-m^{*,2}} 00097 \f] 00098 but this solution is only valid if \f$ (m^{*}-\nu)/T < -u \f$. 00099 In the case where part::inc_rest_mass is false, the result is 00100 \f[ 00101 \mathrm{lower~limit} = \sqrt{(-u T + m +\nu)^2-m^{*,2}} 00102 \f] 00103 which is valid if \f$ (m^{*}-\nu - m)/T < -u \f$. 00104 00105 <b>Entropy integrand:</b> 00106 00107 In the degenerate regime, the entropy integrand 00108 \f[ 00109 - k^2 \left[ f \log f + \left(1-f\right) \log 00110 \left(1-f \right) \right] 00111 \f] 00112 where \f$ f \f$ is the fermionic distribution function can lose 00113 precision when \f$ (E^{*} - \nu)/T \f$ is negative and 00114 sufficiently large in absolute magnitude. Thus when \f$ (E^{*} - 00115 \nu)/T < S \f$ where \f$ S \f$ is stored in \ref deg_entropy_fac 00116 (default is -30), the integrand is written as 00117 \f[ 00118 -k^2 \left( E/T-\nu/T \right) e^{E/T-\nu/T} \, . 00119 \f] 00120 If \f$ (E - \nu)/T < S \f$ is less than -1 times \ref exp_limit 00121 (e.g. less than -200), then the entropy integrand is assumed 00122 to be zero. 00123 00124 <b>Non-degenerate integrands:</b> 00125 00126 \comment 00127 It's not at all clear that this dimensionless form is more 00128 accurate than other potential alternatives. On the other hand, 00129 it seems that the uncertainties in the integrations are larger 00130 than the errors made by the integrand at present. 00131 \endcomment 00132 The integrands in the non-degenerate regime are written 00133 in a dimensionless form, by defining 00134 \f$ p = \sqrt{\left(T u + m^{*}\right)^2-m^{* 2}} \f$, 00135 \f$ \nu \equiv y T \f$, and 00136 \f$ m^{*} \equiv \mathrm{mx}~T \f$. 00137 The density integrand is 00138 \f[ 00139 \left(\mathrm{mx}+u\right) \sqrt{u^2+2 (\mathrm{mx}) u} 00140 \left(\frac{e^{y}}{e^{\mathrm{mx}+u}+e^{y}}\right) \, , 00141 \f] 00142 the energy integrand is 00143 \f[ 00144 \left(\mathrm{mx}+u\right)^2 \sqrt{u^2+2 (\mathrm{mx}) u} 00145 \left(\frac{e^{y}}{e^{\mathrm{mx}+u}+e^{y}}\right) \, , 00146 \f] 00147 and the entropy integrand is 00148 \f[ 00149 \left(\mathrm{mx}+u\right) \sqrt{u^2+2 (\mathrm{mx}) u} 00150 \left(t_1+t_2\right) \, , 00151 \f] 00152 where 00153 \f{eqnarray*} 00154 t_1 &=& \log \left(1+e^{y-\mathrm{mx}-u}\right)/ 00155 \left(1+e^{y-\mathrm{mx}-u}\right) \nonumber \\ 00156 t_2 &=& \log \left(1+e^{\mathrm{mx}+u-y}\right)/ 00157 \left(1+e^{\mathrm{mx}+u-y}\right) \, . 00158 \f} 00159 00160 \hline 00161 <b>Accuracy:</b> 00162 00163 The default settings for for this class give an accuracy of at 00164 least 1 part in \f$ 10^6 \f$ (and frequently better than this). 00165 00166 When the integrators provide numerical uncertainties, these 00167 uncertainties are stored in \ref unc. In the case of 00168 calc_density() and pair_density(), the uncertainty from the 00169 numerical accuracy of the solver is not included. (There is also 00170 a relatively small inaccuracy due to the mathematical evaluation 00171 of the integrands which is not included in \ref unc.) 00172 00173 One way to improve the accuracy of the computation is just to 00174 decrease the tolerances on the default integration objects. This 00175 can be done, using, for example 00176 \code 00177 rel_fermion rf(1.0,2.0); 00178 rf.def_dit.tolx/=1.0e2; 00179 rf.def_dit.tolf/=1.0e2; 00180 rf.def_nit.tolx/=1.0e2; 00181 rf.def_nit.tolf/=1.0e2; 00182 \endcode 00183 which decreases the both the relative and absolute tolerances 00184 for both the degenerate and non-degenerate integrators. If one 00185 is using either the calc_density() or pair_density() functions, 00186 one may also have to improve the accuracy of the solver which 00187 determines the chemical potential from the density. For 00188 the default solver, this could be done with 00189 \code 00190 rf.def_density_root.tolx/=1.0e2; 00191 rf.def_density_root.tolf/=1.0e2; 00192 \endcode 00193 Of course if these tolerances are too small, the calculation 00194 may fail. 00195 00196 \hline 00197 <b>Todos:</b> 00198 00199 \future The expressions which appear in in the integrand 00200 functions density_fun(), etc. could likely be improved, 00201 especially in the case where inc_rest_mass=false. There should 00202 not be a need to check if <tt>ret</tt> is finite. 00203 00204 \future It appears this doesn't compute the uncertainty in the 00205 chemical potential or density with calc_density(). This could 00206 be fixed. 00207 00208 \future I'd like to change the lower limit on the entropy 00209 integration, but the value in the code at the moment (stored 00210 in <tt>ll</tt>) makes bm_part2.cpp worse. 00211 00212 \future pair_mu() should set the antiparticle integrators 00213 as done in sn_fermion. 00214 */ 00215 class rel_fermion : public fermion_eval_thermo { 00216 00217 public: 00218 00219 /// \name Numerical parameters 00220 //@{ 00221 /** \brief The critical degeneracy at which to switch integration 00222 techniques (default 2) 00223 */ 00224 double deg_limit; 00225 00226 /** \brief The limit for exponentials to ensure integrals are finite 00227 (default 200) 00228 */ 00229 double exp_limit; 00230 00231 /// The factor for the degenerate upper limits (default 20) 00232 double upper_limit_fac; 00233 00234 /// A factor for the degenerate entropy integration (default 30) 00235 double deg_entropy_fac; 00236 //@} 00237 00238 /// Storage for the uncertainty 00239 fermion unc; 00240 00241 /// Create a fermion with mass \c m and degeneracy \c g 00242 rel_fermion(); 00243 00244 virtual ~rel_fermion(); 00245 00246 /** \brief Calculate properties as function of chemical potential 00247 */ 00248 virtual void calc_mu(fermion &f, double temper); 00249 00250 /** \brief Calculate properties as function of density 00251 00252 This function uses the current value of \c nu (or \c mu if the 00253 particle is non interacting) for an initial guess to solve for 00254 the chemical potential. If this guess is too small, then this 00255 function may fail. 00256 */ 00257 virtual void calc_density(fermion &f, double temper); 00258 00259 /** \brief Calculate properties with antiparticles as function of 00260 chemical potential 00261 */ 00262 virtual void pair_mu(fermion &f, double temper); 00263 00264 /** \brief Calculate properties with antiparticles as function of 00265 density 00266 */ 00267 virtual void pair_density(fermion &f, double temper); 00268 00269 /// Calculate effective chemical potential from density 00270 virtual void nu_from_n(fermion &f, double temper); 00271 00272 /// Set integrators 00273 int set_inte(inte<funct> &non_it, inte<funct> °_it); 00274 00275 /** \brief Set the solver for use in calculating the chemical 00276 potential from the density */ 00277 int set_density_root(root<funct> &rp) { 00278 density_root=&rp; 00279 return 0; 00280 } 00281 00282 /// The default solver for calc_density(). 00283 cern_mroot_root<funct> def_density_root; 00284 00285 /// The default integrator for degenerate fermions 00286 gsl_inte_qag<funct> def_dit; 00287 00288 /// The default integrator for non-degenerate fermions 00289 gsl_inte_qagiu<funct> def_nit; 00290 00291 /// Return string denoting type ("rel_fermion") 00292 virtual const char *type() { return "rel_fermion"; } 00293 00294 protected: 00295 00296 #ifndef DOXYGEN_INTERNAL 00297 00298 /// The non-degenerate integrator 00299 inte<funct> *nit; 00300 /// The degenerate integrator 00301 inte<funct> *dit; 00302 /// The solver for calc_density() 00303 root<funct> *density_root; 00304 /// Temperature 00305 double T; 00306 /// Current fermion pointer 00307 fermion *fp; 00308 00309 /// The integrand for the density for non-degenerate fermions 00310 double density_fun(double u); 00311 00312 /// The integrand for the energy density for non-degenerate fermions 00313 double energy_fun(double u); 00314 00315 /// The integrand for the entropy density for non-degenerate fermions 00316 double entropy_fun(double u); 00317 00318 /// The integrand for the density for degenerate fermions 00319 double deg_density_fun(double u); 00320 00321 /// The integrand for the energy density for degenerate fermions 00322 double deg_energy_fun(double u); 00323 00324 /// The integrand for the entropy density for degenerate fermions 00325 double deg_entropy_fun(double u); 00326 00327 /// Solve for the chemical potential given the density 00328 double solve_fun(double x); 00329 00330 /// Solve for the chemical potential given the density with antiparticles 00331 double pair_fun(double x); 00332 00333 #endif 00334 00335 }; 00336 00337 #ifndef DOXYGENP 00338 } 00339 #endif 00340 00341 #endif
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).