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_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 00049 approximate, but very fast. For a more accurate (but slower) 00050 method, use 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 - We can use the density to solve for \f$ f \f$ 00077 - We can 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 might 00081 be less time consuming. The density is solved for the effective 00082 chemical potential instead. The initial guess is just taken from 00083 the present value of part::nu. 00084 00085 The constructor uses the coefficients from the file \c fermilat3 00086 by default. 00087 00088 It is important that if the \ref inte and \ref root objects are 00089 not thread safe, different instances should not use the same 00090 instance of a \ref inte or \ref root object simultaneously. 00091 00092 \future Use bracketing to speed up one-dimensional root finding. 00093 */ 00094 class eff_fermion : virtual public fermion { 00095 00096 public: 00097 00098 /// Create a fermion with mass \c mass and degeneracy \c dof 00099 eff_fermion(double mass=0.0, double dof=0.0); 00100 00101 virtual ~eff_fermion(); 00102 00103 /** \name Load coefficients for finite-temperature approximation 00104 00105 \c ctype Should be one of the constants below: 00106 cf_fermilat3, cf_fermijel2, cf_fermijel3, or 00107 cf_fermijel3cons. 00108 00109 \todo Document these coefficients better 00110 */ 00111 //@{ 00112 static int load_coefficients(int ix); 00113 static const int cf_fermilat3=1; 00114 static const int cf_fermijel2=2; 00115 static const int cf_fermijel3=3; 00116 static const int cf_fermijel3cons=4; 00117 //@} 00118 00119 /** 00120 \brief Calculate thermodynamic 00121 properties as function of chemical potential 00122 00123 If the quantity \f$ (\mu-m)/T \f$ (or \f$ (\nu-m^{*})/T \f$ in 00124 the case of interacting particles) is less than -200, then 00125 this quietly sets the density, the scalar density, the energy 00126 density, the pressure and the entropy to zero and exits. 00127 00128 \todo Should see if the function actually works if 00129 \f$ (\mu-m)/T = -199 \f$ . 00130 */ 00131 virtual int calc_mu(const double temper); 00132 00133 /** 00134 \brief Calculate thermodynamic 00135 properties as function of density 00136 00137 \warning This function needs a guess for the chemical potential, 00138 and will fail if that guess is not sufficiently accurate. 00139 */ 00140 virtual int calc_density(const double temper); 00141 00142 /** \brief Calculate thermodynamic properties with antiparticles 00143 as function of chemical potential 00144 */ 00145 virtual int pair_mu(const double temper); 00146 00147 /** \brief Calculate thermodynamic properties with antiparticles 00148 as function of density 00149 */ 00150 virtual int pair_density(const double temper); 00151 00152 /** \brief Set the solver for use in calculating \f$ \psi \f$ 00153 */ 00154 int set_psi_root(root<void *, funct<void *> > &rp) { 00155 psi_root=&rp; 00156 return 0; 00157 } 00158 00159 /** \brief Set the solver for use in calculating the chemical 00160 potential from the density with meth2=true 00161 */ 00162 int set_density_root(root<void *, funct<void *> > &rp) { 00163 density_root=&rp; 00164 return 0; 00165 } 00166 00167 /** \brief If the temperature is less than \c tlimit then the 00168 zero-temperature functions are used (default 0). 00169 */ 00170 double tlimit; 00171 00172 /** \brief The default solver for \f$ \psi \f$ 00173 */ 00174 cern_mroot_root<void *, funct<void *> > def_psi_root; 00175 00176 /** \brief The default solver for calc_density() and pair_density() 00177 */ 00178 cern_mroot_root<void *, funct<void *> > def_density_root; 00179 00180 /// Return string denoting type ("eff_fermion") 00181 virtual const char *type() { return "eff_fermion"; } 00182 00183 /// The minimum value of \f$ \psi \f$ (default -200) 00184 double min_psi; 00185 00186 #ifndef DOXYGEN_INTERNAL 00187 00188 protected: 00189 00190 friend class io_tlate<eff_fermion>; 00191 00192 /// The matrix of coefficients 00193 static double **Pmnf; 00194 /// The parameter \f$ a \f$ 00195 static double parma; 00196 /// The array row size 00197 static int sizem; 00198 /// The array column size 00199 static int sizen; 00200 00201 /// The solver for \f$ \psi \f$ 00202 root<void *,funct<void *> > *psi_root; 00203 /// The other solver for calc_density() 00204 root<void *,funct<void *> > *density_root; 00205 00206 /// The function which solves for \f$ f \f$ from \f$ \psi \f$. 00207 int solve_fun(double x, double &y, void *&pa); 00208 00209 /// Fix density for calc_density() 00210 int density_fun(double x, double &y, void *&pa); 00211 00212 /// Fix density for pair_density() 00213 int pair_density_fun(double x, double &y, void *&pa); 00214 00215 #endif 00216 00217 }; 00218 00219 template<> int io_tlate<eff_fermion>::input 00220 (cinput *co, in_file_format *ins, eff_fermion *f); 00221 template<> int io_tlate<eff_fermion>::output 00222 (coutput *co, out_file_format *outs, eff_fermion *f); 00223 /* 00224 template<> int io_tlate<eff_fermion>::stat_input 00225 (cinput *co, in_file_format *ins, eff_fermion *f); 00226 template<> int io_tlate<eff_fermion>::stat_output 00227 (coutput *co, out_file_format *outs, eff_fermion *f); 00228 template<> bool io_tlate<eff_fermion>::has_static_data(); 00229 */ 00230 template<> const char *io_tlate<eff_fermion>::type(); 00231 00232 typedef io_tlate<eff_fermion> eff_fermion_io_type; 00233 00234 #ifndef DOXYGENP 00235 } 00236 #endif 00237 00238 #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