Particles and Nuclei Sub-Library: Version 0.910
eff_boson.h
00001 /*
00002   -------------------------------------------------------------------
00003 
00004   Copyright (C) 2006-2012, 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_BOSON_H
00024 #define O2SCL_EFF_BOSON_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/cern_mroot_root.h>
00037 #include <o2scl/gsl_mroot_hybrids.h>
00038 
00039 #include <o2scl/boson.h>
00040 
00041 #ifndef DOXYGENP
00042 namespace o2scl {
00043 #endif
00044 
00045   /** \brief Boson class from fitting method
00046      
00047      \todo Better documentation (see eff_fermion)
00048      \todo Remove the 'meth2' stuff
00049      \todo Remove static variables fix_density and stat_temper
00050      \todo Remove exit() calls
00051   */
00052   class eff_boson {
00053 
00054   public:
00055     
00056     /// Create a boson with mass \c m and degeneracy \c g 
00057     eff_boson();
00058     
00059     virtual ~eff_boson();
00060   
00061     /** \brief Load coefficients for finite-temperature approximation
00062         
00063         Presently acceptable values of \c fn are: \c boselat3 from
00064         Lattimer's notes \c bosejel21, \c bosejel22, \c bosejel34, and
00065         \c bosejel34cons from \ref Johns96.
00066     */
00067     int load_coefficients(int ctype);
00068     /// A set of coefficients from Jim Lattimer 
00069     static const int cf_boselat3=1;
00070     /// A set of coefficients from \ref Johns96
00071     static const int cf_bosejel21=2;
00072     /// A set of coefficients from \ref Johns96
00073     static const int cf_bosejel22=3;
00074     /// A set of coefficients from \ref Johns96
00075     static const int cf_bosejel34=4;
00076     /** \brief The set of coefficients from \ref Johns96 which retains 
00077         better thermodynamic consistency
00078      */
00079     static const int cf_bosejel34cons=5;
00080   
00081     /** \brief Calculate thermodynamic 
00082         properties as function of chemical potential
00083     */
00084     virtual void calc_mu(boson &b, double temper);
00085 
00086     /** \brief Calculate thermodynamic 
00087         properties as function of density
00088     */
00089     virtual void calc_density(boson &b, double temper);
00090 
00091     /** \brief Calculate thermodynamic properties with antiparticles
00092         as function of chemical potential
00093     */
00094     virtual void pair_mu(boson &b, double temper);
00095 
00096     /** \brief Calculate thermodynamic properties with antiparticles
00097         as function of density
00098     */
00099     virtual void pair_density(boson &b, double temper);
00100 
00101     /** \brief Set the solver for use in calculating \f$ \psi \f$ 
00102      */
00103     void set_psi_root(root<funct> &rp) {
00104       psi_root=&rp;
00105       return;
00106     }
00107 
00108     /** \brief Set the solver for use in calculating the chemical
00109         potential from the density 
00110     */
00111     void set_density_mroot(mroot<mm_funct<> > &rp) {
00112       density_mroot=&rp;
00113       return;
00114     }
00115 
00116     /** \brief Set the solver for use in calculating the chemical
00117         potential from the density (meth2=true) 
00118     */
00119     void set_meth2_root(root<funct> &rp) {
00120       meth2_root=&rp;
00121       return;
00122     }
00123 
00124     /** \brief The default solver for calc_density() and pair_density()
00125      */
00126     gsl_mroot_hybrids<mm_funct<> > def_density_mroot;
00127 
00128     /** \brief The default solver for \f$ \psi \f$
00129      */
00130     cern_mroot_root<funct> def_psi_root;
00131 
00132     /** \brief The default solver for calc_density() and pair_density()
00133      */
00134     cern_mroot_root<funct> def_meth2_root;
00135 
00136     virtual const char *type() { return "eff_boson"; }
00137 
00138 #ifndef DOXYGEN_INTERNAL
00139 
00140   protected:
00141   
00142     /// The coefficients
00143     umatrix Pmnb;
00144     /// The number of coefficient rows
00145     int sizem;
00146     /// The number of coefficient columns
00147     int sizen;
00148     /// The parameter, \f$ a \f$
00149     double parma;
00150     /// Temporary storage
00151     double fix_density;
00152 
00153     /// Desc
00154     boson *bp;
00155 
00156     /// Desc
00157     double T;
00158     
00159     /// The solver for calc_density()
00160     mroot<mm_funct<> > *density_mroot;
00161 
00162     /// The solver to compute \f$ h \f$ from \f$ \psi \f$.
00163     root<funct> *psi_root;
00164 
00165     /// The solver for calc_density()
00166     root<funct> *meth2_root;
00167 
00168     /// The function which solves for \f$ h \f$ from \f$ \psi \f$.
00169     double solve_fun(double x, double &psi);
00170 
00171     /// Fix density for calc_density()
00172     int density_fun(size_t nv, const ovector_base &x, ovector_base &y);
00173 
00174     /// Fix density for pair_density()
00175     int pair_density_fun(size_t nv, const ovector_base &x, ovector_base &y);
00176 
00177 #endif
00178   };
00179 
00180 #ifndef DOXYGENP
00181 }
00182 #endif
00183 
00184 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Friends

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.