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_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 When the integrators provide numerical uncertainties, these 00065 uncertainties are stored in \ref unc. In the case of 00066 calc_density() and pair_density(), the uncertainty from the 00067 numerical accuracy of the solver is not included. (There is also 00068 a relatively small inaccuracy due to the mathematical evaluation 00069 of the integrands which is not included in \ref unc.) 00070 00071 One way to improve the accuracy of the computation is just to 00072 decrease the tolerances on the default integration objects. This 00073 can be done, using, for example 00074 \code 00075 rel_fermion rf(1.0,2.0); 00076 rf.def_dit.tolx/=1.0e2; 00077 rf.def_dit.tolf/=1.0e2; 00078 rf.def_nit.tolx/=1.0e2; 00079 rf.def_nit.tolf/=1.0e2; 00080 \endcode 00081 which decreases the both the relative and absolute tolerances 00082 for both the degenerate and non-degenerate integrators. If one 00083 is using either the calc_density() or pair_density() functions, 00084 one may also have to improve the accuracy of the solver which 00085 determines the chemical potential from the density. For 00086 the default solver, this could be done with 00087 \code 00088 rf.def_density_root.tolx/=1.0e2; 00089 rf.def_density_root.tolf/=1.0e2; 00090 \endcode 00091 Of course if these tolerances are too small, the calculation 00092 may fail. 00093 00094 \note This does not work with inc_rest_mass=false (3/30/09: 00095 There is a significant amount of testing code to ensure that 00096 it does work with inc_rest_mass=false, so this may have 00097 been fixed already.) 00098 00099 \future Allow the user to change the upper limit on the 00100 degenerate integration and the hard-coded value of 200 in the 00101 integrands. 00102 \future It appears this doesn't compute the uncertainty in the 00103 chemical potential or density with calc_density(). This could 00104 be fixed. 00105 00106 */ 00107 class rel_fermion : public fermion_T { 00108 00109 public: 00110 00111 /// The critical degeneracy at which to switch integration techniques 00112 double deg_limit; 00113 00114 /// Storage for the uncertainty 00115 fermion unc; 00116 00117 /** \brief If true, use the present value of the chemical potential as 00118 a guess for the new chemical potential 00119 */ 00120 bool guess_from_nu; 00121 00122 /// Create a fermion with mass \c m and degeneracy \c g 00123 rel_fermion(double m=0.0, double g=0.0); 00124 virtual ~rel_fermion(); 00125 00126 /** 00127 \brief Calculate properties as function of chemical potential 00128 */ 00129 virtual int calc_mu(const double temper); 00130 00131 /** \brief Calculate properties as function of density 00132 */ 00133 virtual int calc_density(const double temper); 00134 00135 /** \brief Calculate properties with antiparticles as function of 00136 chemical potential 00137 */ 00138 virtual int pair_mu(const double temper); 00139 00140 /** \brief Calculate properties with antiparticles as function of 00141 density 00142 */ 00143 virtual int pair_density(const double temper); 00144 00145 /// Calculate effective chemical potential from density 00146 virtual int nu_from_n(const double temper); 00147 00148 /// Set integrators 00149 int set_inte(inte<double,funct<double> > &non_it, 00150 inte<double,funct<double> > °_it); 00151 00152 /** \brief Set the solver for use in calculating the chemical 00153 potential from the density */ 00154 int set_density_root(root<double,funct<double> > &rp) { 00155 density_root=&rp; 00156 return 0; 00157 } 00158 00159 /// The default solver for calc_density(). 00160 cern_mroot_root<double,funct<double> > def_density_root; 00161 00162 /// The default integrator for degenerate fermions 00163 gsl_inte_qag<double,funct<double> > def_dit; 00164 00165 /// The default integrator for non-degenerate fermions 00166 gsl_inte_qagiu<double,funct<double> > def_nit; 00167 00168 /// Return string denoting type ("rel_fermion") 00169 virtual const char *type() { return "rel_fermion"; } 00170 00171 protected: 00172 00173 #ifndef DOXYGEN_INTERNAL 00174 00175 friend class io_tlate<rel_fermion>; 00176 00177 /// The non-degenerate integrator 00178 inte<double,funct<double> > *nit; 00179 /// The degenerate integrator 00180 inte<double,funct<double> > *dit; 00181 /// The solver for calc_density() 00182 root<double,funct<double> > *density_root; 00183 00184 /// The integrand for the density for non-degenerate fermions 00185 double density_fun(double u, double &pa); 00186 00187 /// The integrand for the energy density for non-degenerate fermions 00188 double energy_fun(double u, double &pa); 00189 00190 /// The integrand for the entropy density for non-degenerate fermions 00191 double entropy_fun(double u, double &pa); 00192 00193 /// The integrand for the density for degenerate fermions 00194 double deg_density_fun(double u, double &pa); 00195 00196 /// The integrand for the energy density for degenerate fermions 00197 double deg_energy_fun(double u, double &pa); 00198 00199 /// The integrand for the entropy density for degenerate fermions 00200 double deg_entropy_fun(double u, double &pa); 00201 00202 /// Solve for the chemical potential given the density 00203 int solve_fun(double x, double &yy, double &pa); 00204 00205 /// Solve for the chemical potential given the density with antiparticles 00206 int pair_fun(double x, double &yy, double &pa); 00207 00208 #endif 00209 00210 }; 00211 00212 template<> int io_tlate<rel_fermion>::input 00213 (cinput *co, in_file_format *ins, rel_fermion *f); 00214 template<> int io_tlate<rel_fermion>::output 00215 (coutput *co, out_file_format *outs, rel_fermion *f); 00216 template<> const char *io_tlate<rel_fermion>::type(); 00217 template<> int io_tlate<rel_fermion>::stat_input 00218 (cinput *co, in_file_format *ins, rel_fermion *f); 00219 template<> int io_tlate<rel_fermion>::stat_output 00220 (coutput *co, out_file_format *outs, rel_fermion *f); 00221 00222 typedef io_tlate<rel_fermion> rel_fermion_io_type; 00223 00224 #ifndef DOXYGENP 00225 } 00226 #endif 00227 00228 #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