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_EFF_FERMION_H 00024 #define O2SCL_EFF_FERMION_H 00025 00026 #include <string> 00027 #include <iostream> 00028 #include <fstream> 00029 #include <cmath> 00030 #include <o2scl/constants.h> 00031 #include <o2scl/funct.h> 00032 #include <o2scl/mm_funct.h> 00033 #include <o2scl/root.h> 00034 #include <o2scl/mroot.h> 00035 #include <o2scl/inte.h> 00036 #include <o2scl/fermion.h> 00037 #include <o2scl/cern_mroot_root.h> 00038 #include <o2scl/misc.h> 00039 00040 #ifndef DOXYGENP 00041 namespace o2scl { 00042 #endif 00043 00044 /** 00045 \brief Fermion class from fitting method 00046 00047 Based on the fitting method of \ref Johns96 which is an update 00048 of the method from \ref Eggleton73 . This method is approximate, 00049 but very fast. For a more accurate (but slower) method, use 00050 rel_fermion. 00051 00052 Given the chemical potential and the temperature the functions 00053 calc_mu() and pair_mu() work by solving the equation 00054 \f[ 00055 \psi= 2 \sqrt{1+f/a}+\log\left(\frac{\sqrt{1+f/a}-1} 00056 {\sqrt{1+f/a}+1}\right) 00057 \f] 00058 for \f$ f \f$ given \f$ \psi=(\mu-m)/T \f$. 00059 If \f$ f/a<10^{-10} \f$, then the alternative expression 00060 \f[ 00061 \psi= 2 \left(1+f/(2 a)\right)+\log\left[\frac{f/(2 a)} 00062 {\left(1+f/(2 a)\right)}\right] 00063 \f] 00064 is used. The pressure, energy density, and entropy, are 00065 determined as polynomials in \f$ f \f$ with a 00066 set of precomputed coefficients as done in \ref Johns96 . 00067 00068 If \f$ \psi \f$ is too small (less than about -200), the 00069 above procedure fails. To handle this, this class 00070 uses the \classical result if \f$ \psi \f$ < \ref min_psi, 00071 where \ref min_psi defaults to -200. 00072 00073 When the density and temperature is given instead 00074 (calc_density() and pair_density()), then there are two ways to 00075 proceed. 00076 - Use the density to solve for \f$ f \f$ . 00077 - Use the density to solve for the chemical potential. 00078 00079 Because the density is a complicated polynomial in \f$ f \f$, 00080 the former procedure does not work very well even though it 00081 might be less time consuming. In this class, the density is 00082 solved for the effective chemical potential instead. The initial 00083 guess is just taken from the present value of part::nu . 00084 00085 \note It is important to note that the coefficients are 00086 static and apply to all objects of type \ref eff_fermion. 00087 00088 \todo There's still def_err_hnd.set_mode(0) in the testing code, 00089 probably because the solver has a hard time for extreme values. 00090 00091 \future Use bracketing to speed up one-dimensional root finding. 00092 */ 00093 class eff_fermion : virtual public fermion_T { 00094 00095 public: 00096 00097 /// Create a fermion with mass \c mass and degeneracy \c dof 00098 eff_fermion(double mass=0.0, double dof=0.0); 00099 00100 virtual ~eff_fermion(); 00101 00102 /** \name Coefficients for finite-temperature approximation 00103 */ 00104 //@{ 00105 /** \brief Load coefficients 00106 00107 The argument \c ctype Should be one of the constants below. 00108 */ 00109 static int load_coefficients(int ctype); 00110 /// A set of coefficients from Jim Lattimer 00111 static const int cf_fermilat3=1; 00112 /// The smaller set of coefficients from \ref Johns96 00113 static const int cf_fermijel2=2; 00114 /// The larger set of coefficients from \ref Johns96 00115 static const int cf_fermijel3=3; 00116 /** \brief The set of coefficients from \ref Johns96 which retains 00117 better thermodynamic consistency 00118 */ 00119 static const int cf_fermijel3cons=4; 00120 //@} 00121 00122 /** 00123 \brief Calculate thermodynamic 00124 properties as function of chemical potential 00125 00126 If the quantity \f$ (\mu-m)/T \f$ (or \f$ (\nu-m^{*})/T \f$ in 00127 the case of interacting particles) is less than -200, then 00128 this quietly sets the density, the scalar density, the energy 00129 density, the pressure and the entropy to zero and exits. 00130 00131 \todo Should see if the function actually works if 00132 \f$ (\mu-m)/T = -199 \f$ . 00133 */ 00134 virtual int calc_mu(const double temper); 00135 00136 /** 00137 \brief Calculate thermodynamic properties as function of 00138 density 00139 00140 \warning This function needs a guess for the chemical 00141 potential, and will fail if that guess is not sufficiently 00142 accurate. 00143 */ 00144 virtual int calc_density(const double temper); 00145 00146 /** \brief Calculate thermodynamic properties with antiparticles 00147 as function of chemical potential 00148 00149 \warning This function needs a guess for the chemical 00150 potential, and will fail if that guess is not sufficiently 00151 accurate. 00152 */ 00153 virtual int pair_mu(const double temper); 00154 00155 /** \brief Calculate thermodynamic properties with antiparticles 00156 as function of density 00157 */ 00158 virtual int pair_density(const double temper); 00159 00160 /** \brief Set the solver for use in calculating \f$ \psi \f$ 00161 */ 00162 int set_psi_root(root<double , funct<double > > &rp) { 00163 psi_root=&rp; 00164 return 0; 00165 } 00166 00167 /** \brief Set the solver for use in calculating the chemical 00168 potential from the density 00169 */ 00170 int set_density_root(root<double , funct<double > > &rp) { 00171 density_root=&rp; 00172 return 0; 00173 } 00174 00175 /** \brief If the temperature is less than \c tlimit then the 00176 zero-temperature functions are used (default 0). 00177 */ 00178 double tlimit; 00179 00180 /** \brief The default solver for \f$ \psi \f$ 00181 */ 00182 cern_mroot_root<double, funct<double> > def_psi_root; 00183 00184 /** \brief The default solver for calc_density() and pair_density() 00185 */ 00186 cern_mroot_root<double, funct<double> > def_density_root; 00187 00188 /// Return string denoting type ("eff_fermion") 00189 virtual const char *type() { return "eff_fermion"; } 00190 00191 /// The minimum value of \f$ \psi \f$ (default -200) 00192 double min_psi; 00193 00194 #ifndef DOXYGEN_INTERNAL 00195 00196 protected: 00197 00198 friend class io_tlate<eff_fermion>; 00199 00200 /// The matrix of coefficients 00201 static double **Pmnf; 00202 /// The parameter \f$ a \f$ 00203 static double parma; 00204 /// The array row size 00205 static int sizem; 00206 /// The array column size 00207 static int sizen; 00208 00209 /// The solver for \f$ \psi \f$ 00210 root<double,funct<double> > *psi_root; 00211 /// The other solver for calc_density() 00212 root<double,funct<double> > *density_root; 00213 00214 /// The function which solves for \f$ f \f$ from \f$ \psi \f$. 00215 int solve_fun(double x, double &y, double &psi); 00216 00217 /// Fix density for calc_density() 00218 int density_fun(double x, double &y, double &temper); 00219 00220 /// Fix density for pair_density() 00221 int pair_density_fun(double x, double &y, double &temper); 00222 00223 #endif 00224 00225 }; 00226 00227 template<> int io_tlate<eff_fermion>::input 00228 (cinput *co, in_file_format *ins, eff_fermion *f); 00229 template<> int io_tlate<eff_fermion>::output 00230 (coutput *co, out_file_format *outs, eff_fermion *f); 00231 /* 00232 template<> int io_tlate<eff_fermion>::stat_input 00233 (cinput *co, in_file_format *ins, eff_fermion *f); 00234 template<> int io_tlate<eff_fermion>::stat_output 00235 (coutput *co, out_file_format *outs, eff_fermion *f); 00236 template<> bool io_tlate<eff_fermion>::has_static_data(); 00237 */ 00238 template<> const char *io_tlate<eff_fermion>::type(); 00239 00240 typedef io_tlate<eff_fermion> eff_fermion_io_type; 00241 00242 #ifndef DOXYGENP 00243 } 00244 #endif 00245 00246 #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