00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 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 This implements an equation of state for a relativistic fermion 00046 using direct integration. Define the degeneracy parameter 00047 \f[ 00048 \psi=(\nu-m^{*})/T 00049 \f] 00050 where \f$ \nu \f$ is the effective chemical potential and \f$ 00051 m^{*} \f$ is the effective mass. For \f$ \psi \f$ greater than 00052 \ref deg_limit (degenerate regime), a finite interval integrator 00053 is used and for \f$ \psi \f$ less than \ref deg_limit 00054 (non-degenerate regime), an integrator over the interval from 00055 \f$ [0,\infty) \f$ is used. The upper limit on the degenerate 00056 integration is given by 00057 \f[ 00058 \sqrt{(20 T+{\nu})^2-m^{*,2}} 00059 \f] 00060 00061 The default integrators are gsl_inte_qag (for degenerate particles) 00062 and gsl_inte_qagiu (for non-degenerate particles) 00063 00064 One way to improve the accuracy of the computation is just to 00065 decrease the tolerances on the default integration objects. This 00066 can be done, using, for example 00067 \code 00068 rel_fermion rf(1.0,2.0); 00069 rf.def_dit.tolx/=1.0e2; 00070 rf.def_dit.tolf/=1.0e2; 00071 rf.def_nit.tolx/=1.0e2; 00072 rf.def_nit.tolf/=1.0e2; 00073 \endcode 00074 which decreases the both the relative and absolute tolerances 00075 for both the degenerate and non-degenerate integrators. If one 00076 is using either the calc_density() or pair_density() functions, 00077 one may also have to improve the accuracy of the solver which 00078 determines the chemical potential from the density. For 00079 the default solver, this could be done with 00080 \code 00081 rf.def_density_root.tolx/=1.0e2; 00082 rf.def_density_root.tolf/=1.0e2; 00083 \endcode 00084 Of course if these tolerances are too small, the calculation 00085 may fail, in which case the reported uncertainties are 00086 not necessarily correct. 00087 00088 \note This does not work with inc_rest_mass=false 00089 00090 \future Allow the user to change the upper limit on the 00091 degenerate integration and the hard-coded value of 200 in the 00092 integrands. 00093 \future It appears this doesn't compute the uncertainty in the 00094 chemical potential or density with calc_density(). This could 00095 be fixed. 00096 00097 */ 00098 class rel_fermion : public fermion { 00099 00100 public: 00101 00102 /// The critical degeneracy at which to switch integration techniques 00103 double deg_limit; 00104 00105 /// Storage for the uncertainty 00106 fermion unc; 00107 00108 /** \brief If true, use the present value of the chemical potential as 00109 a guess for the new chemical potential 00110 */ 00111 bool guess_from_nu; 00112 00113 /// Create a fermion with mass \c m and degeneracy \c g 00114 rel_fermion(double m=0.0, double g=0.0); 00115 virtual ~rel_fermion(); 00116 00117 /** 00118 \brief Calculate properties as function of chemical potential 00119 */ 00120 virtual int calc_mu(const double temper); 00121 00122 /** \brief Calculate properties as function of density 00123 */ 00124 virtual int calc_density(const double temper); 00125 00126 /** \brief Calculate properties with antiparticles as function of 00127 chemical potential 00128 */ 00129 virtual int pair_mu(const double temper); 00130 00131 /** \brief Calculate properties with antiparticles as function of 00132 density 00133 */ 00134 virtual int pair_density(const double temper); 00135 00136 /// Calculate effective chemical potential from density 00137 virtual int nu_from_n(const double temper); 00138 00139 /// Set integrators 00140 int set_inte(inte<void *,funct<void *> > &non_it, 00141 inte<void *,funct<void *> > °_it); 00142 00143 /** \brief Set the solver for use in calculating the chemical 00144 potential from the density */ 00145 int set_density_root(root<void *,funct<void *> > &rp) { 00146 density_root=&rp; 00147 return 0; 00148 } 00149 00150 /// The default solver for calc_density(). 00151 cern_mroot_root<void *,funct<void *> > def_density_root; 00152 00153 /// The default integrator for degenerate fermions 00154 gsl_inte_qag<void *,funct<void *> > def_dit; 00155 00156 /// The default integrator for non-degenerate fermions 00157 gsl_inte_qagiu<void *,funct<void *> > def_nit; 00158 00159 /// Return string denoting type ("rel_fermion") 00160 virtual const char *type() { return "rel_fermion"; } 00161 00162 protected: 00163 00164 #ifndef DOXYGEN_INTERNAL 00165 00166 friend class io_tlate<rel_fermion>; 00167 00168 /// The non-degenerate integrator 00169 inte<void *,funct<void *> > *nit; 00170 /// The degenerate integrator 00171 inte<void *,funct<void *> > *dit; 00172 /// The solver for calc_density() 00173 root<void *,funct<void *> > *density_root; 00174 00175 /// The integrand for the density for non-degenerate fermions 00176 double density_fun(double u, void *&pa); 00177 00178 /// The integrand for the energy density for non-degenerate fermions 00179 double energy_fun(double u, void *&pa); 00180 00181 /// The integrand for the entropy density for non-degenerate fermions 00182 double entropy_fun(double u, void *&pa); 00183 00184 /// The integrand for the density for degenerate fermions 00185 double deg_density_fun(double u, void *&pa); 00186 00187 /// The integrand for the energy density for degenerate fermions 00188 double deg_energy_fun(double u, void *&pa); 00189 00190 /// The integrand for the entropy density for degenerate fermions 00191 double deg_entropy_fun(double u, void *&pa); 00192 00193 /// Solve for the chemical potential given the density 00194 int solve_fun(double x, double &yy, void *&pa); 00195 00196 /// Solve for the chemical potential given the density wiht antiparticles 00197 int pair_fun(double x, double &yy, void *&pa); 00198 00199 #endif 00200 00201 }; 00202 00203 template<> int io_tlate<rel_fermion>::input 00204 (cinput *co, in_file_format *ins, rel_fermion *f); 00205 template<> int io_tlate<rel_fermion>::output 00206 (coutput *co, out_file_format *outs, rel_fermion *f); 00207 template<> const char *io_tlate<rel_fermion>::type(); 00208 template<> int io_tlate<rel_fermion>::stat_input 00209 (cinput *co, in_file_format *ins, rel_fermion *f); 00210 template<> int io_tlate<rel_fermion>::stat_output 00211 (coutput *co, out_file_format *outs, rel_fermion *f); 00212 00213 typedef io_tlate<rel_fermion> rel_fermion_io_type; 00214 00215 #ifndef DOXYGENP 00216 } 00217 #endif 00218 00219 #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