fermion.h

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_FERMION_H
00024 #define O2SCL_FERMION_H
00025 
00026 #include <string>
00027 #include <iostream>
00028 #include <fstream>
00029 #include <cmath>
00030 #include <gsl/gsl_specfunc.h>
00031 #include <o2scl/constants.h>
00032 #include <o2scl/funct.h>
00033 #include <o2scl/root.h>
00034 #include <o2scl/mroot.h>
00035 #include <o2scl/inte.h>
00036 #include <o2scl/part.h>
00037 #include <o2scl/cern_mroot_root.h>
00038 
00039 #ifndef DOXYGENP
00040 namespace o2scl {
00041 #endif
00042 
00043   /** 
00044       \brief Fermion class
00045 
00046       This is a base class for the computation of fermionic
00047       thermodynamics. This class includes the computations of
00048       zero-temperature (possibly massive) and massless fermions at
00049       zero or finite temperature. The more general case of fermions
00050       with both finite mass and a finite temperature are taken care of
00051       by the functions calc_mu(), calc_density(), pair_mu(), and
00052       pair_density(). These are not implemented in this class
00053       (see eff_fermion, rel_fermion, nonrel_fermion, sn_fermion, 
00054       and sn_nr_fermion).
00055 
00056       The function massless_calc_density() uses a \ref root object to
00057       solve for the chemical potential as a function of the
00058       density. The default is an object of type cern_mroot_root.
00059       massless_pair_density() doesn't need to use the \ref root object
00060       because of the simplification afforded by the inclusion of
00061       antiparticles.
00062 
00063       \todo Consider putting a parent version of calc_e and calc_p, or
00064       in part or fermion which automatically solves like
00065       eff_fermion::calc_density()?
00066 
00067       \htmlonly
00068       The Mathematica notebook contains the derivations of the
00069       series expansions and some algebra for the massless_pair()
00070       functions.
00071       <a href="fermion.nb">
00072       fermion.nb</a>, and
00073       <a href="fermion.ps">
00074       fermion.ps</a>.
00075       \endhtmlonly
00076       \latexonly
00077       The Mathematica notebook contains the derivations of the
00078       series expansions and some algebra for the massless\_pair()
00079       functions.
00080       \begin{verbatim}
00081       doc/o2scl/extras/fermion.nb
00082       doc/o2scl/extras/fermion.ps
00083       \end{verbatim}
00084       \endlatexonly
00085   */
00086   class fermion : virtual public part {
00087   public:
00088 
00089     /// Fermi momentum
00090     double kf;
00091     /// Gap
00092     double del;
00093 
00094     /// Create a fermion with mass \c mass  and degeneracy \c dof.
00095     fermion(double mass=0, double dof=0);
00096 
00097     virtual ~fermion() {
00098     }
00099 
00100     /// \name Zero-temperature fermions 
00101     //@{
00102     /** 
00103         \brief Calculate the Fermi momentum from the density
00104         
00105         Uses the relation \f$ k_F = ( 6 \pi^2 n /g )^{1/3} \f$
00106     */
00107     int kffromden(); 
00108 
00109     /** 
00110         \brief Scalar number density at T=0 from \ref kf and \ref ms
00111 
00112         Calculates the integral 
00113         \f[
00114         n_s=\frac{g}{2 \pi^2} \int_0^{k_F} k^2 
00115         \frac{m^{*}}{\sqrt{k^2+m^{* 2}}} d k
00116         \f]
00117     */
00118     int sden(); 
00119     
00120     /** 
00121         \brief Energy density at T=0 from \ref kf and \ref ms
00122 
00123         Calculates the integral 
00124         \f[
00125         \varepsilon = \frac{g}{2 \pi^2} \int_0^{k_F} k^2 \
00126         sqrt{k^2+m^{* 2}} d k
00127         \f]
00128     */
00129     int eden(); 
00130 
00131     /** 
00132         \brief Pressure at T=0 from \ref kf and \ref ms
00133 
00134         Calculates the integral 
00135         \f[
00136         P=\frac{g}{6 \pi^2} \int_0^{k_F} \frac{k^4}{\sqrt{k^2+m^{* 2}}} d k
00137         \f]
00138     */
00139     int pres(); 
00140 
00141     /** 
00142         \brief Zero temperature fermions from nu and ms
00143 
00144         This function always returns \c gsl_success.
00145      */
00146     virtual int calc_mu_zerot();
00147 
00148     /** 
00149         \brief Zero temperature fermions from n and ms
00150 
00151         This function always returns \c gsl_success.
00152     */
00153     virtual int calc_density_zerot();
00154     //@}
00155 
00156     /** 
00157         \brief Calculate properties as function of chemical potential
00158      */
00159     virtual int calc_mu(const double temper);
00160 
00161     /** \brief Calculate properties as function of density
00162      */
00163     virtual int calc_density(const double temper);
00164 
00165     /** \brief Calculate properties with antiparticles as function of
00166         chemical potential
00167     */
00168     virtual int pair_mu(const double temper);
00169 
00170     /** \brief Calculate properties with antiparticles as function of
00171         density
00172     */
00173     virtual int pair_density(const double temper);
00174   
00175     /// \name Massless fermions
00176     //@{
00177     /// Finite temperature massless fermions
00178     virtual int massless_calc_mu(const double temper);
00179 
00180     /// Finite temperature massless fermions
00181     virtual int massless_calc_density(const double temper);
00182 
00183     /** 
00184         \brief Finite temperature massless fermions and antifermions 
00185     */
00186     int massless_pair_mu(const double temper);
00187 
00188     /** 
00189         \brief Finite temperature massless fermions and antifermions 
00190 
00191         In the cases \f$ n^3 >> T \f$ and \f$ T >> n^3 \f$ ,
00192         expansions are used instead of the exact formulas to avoid
00193         loss of precision.
00194 
00195         \todo Comment here about the precision of the expansions and
00196         allow the user to control how they are used if necessary.
00197     */
00198     int massless_pair_density(const double temper);
00199     //@}
00200 
00201     /** \brief Set the solver for use in massless_root_density() */ 
00202     int set_massless_root(root<void *,funct<void *> > &rp) {
00203       massless_root=&rp;
00204       return 0;
00205     }
00206 
00207     /** 
00208         \brief Degenerate expansion for specific heat
00209         
00210         This is a temporary location and is also unchecked.
00211     */
00212     double deg_specific_heat(double T) {
00213       double ret;
00214       if (non_interacting) {
00215         nu=mu;
00216         ms=m;
00217       }
00218       double sqd=nu*nu-ms*ms;
00219       ret=o2scl_const::pi2*T*nu/sqd*
00220         (1.0-o2scl_const::pi2*T*T*
00221          (5.0*pow(ms,4.0)+4.0*ms*ms*nu*nu+14.0*pow(nu,4.0))/
00222          15.0/nu/nu/sqd/sqd);
00223       return ret;
00224     }
00225       
00226     /** 
00227         \brief The default solver for massless_calc_mu()
00228         
00229         We default to cern_mroot_root here since we don't have
00230         a bracket or a derivative.
00231     */
00232     cern_mroot_root<void *,funct<void *> > def_massless_root;
00233 
00234     /// Return string denoting type ("fermion")
00235     virtual const char *type() { return "fermion"; }
00236 
00237 #ifndef DOXYGENP
00238 
00239     friend class io_tlate<fermion>;
00240 
00241   protected:
00242     
00243     /// A pointer to the solver for massless fermions
00244     root<void *,funct<void *> > *massless_root;
00245     
00246     /// The function to solve for massless fermions
00247     int massless_fun(double x, double &y, void *&pa);
00248 
00249   private:
00250 
00251     fermion(const fermion &);
00252     fermion& operator=(const fermion&);
00253 
00254 #endif
00255 
00256   };
00257 
00258   template<> int io_tlate<fermion>::input
00259     (cinput *co, in_file_format *ins, fermion *f);
00260   template<> int io_tlate<fermion>::output
00261     (coutput *co, out_file_format *outs, fermion *f);
00262   template<> const char *io_tlate<fermion>::type();
00263   
00264   typedef io_tlate<fermion> fermion_io_type;
00265 
00266 #ifndef DOXYGENP
00267 }
00268 #endif
00269 
00270 #endif

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page