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