rel_boson.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_REL_BOSON_H
00024 #define O2SCL_REL_BOSON_H
00025 
00026 #include <string>
00027 #include <iostream>
00028 #include <fstream>
00029 #include <cmath>
00030 #include <o2scl/constants.h>
00031 #include <o2scl/mroot.h>
00032 #include <o2scl/inte.h>
00033 #include <o2scl/boson.h>
00034 #include <o2scl/gsl_mroot_hybrids.h>
00035 #include <o2scl/gsl_quad.h>
00036 
00037 #ifndef DOXYGENP
00038 namespace o2scl {
00039 #endif
00040 
00041   /** 
00042       \brief Equation of state for a relativistic boson
00043 
00044       \todo Testing not completely finished.
00045   */
00046   class rel_boson : public boson {
00047 
00048   public:
00049 
00050     /// Create a boson with mass \c m and degeneracy \c g
00051     rel_boson(double m=0.0, double g=0.0);
00052     virtual ~rel_boson();
00053 
00054     /// The error value from mroot
00055     int mroot_err;
00056 
00057     /// The error value from inte
00058     int inte_err;
00059   
00060     virtual int calc_mu(const double temper);
00061     virtual int calc_density(const double temper);
00062     
00063     virtual int pair_mu(const double temper);
00064 
00065     /// Calculate effective chemical potential from density
00066     virtual int nu_from_n(const double temper);
00067 
00068     /// Set inte object
00069     int set_inte(inte &l_nit, inte &l_dit);
00070 
00071     /** \brief Set the solver for use in calculating the chemical
00072         potential from the density */
00073     int set_density_root(root &rp) {
00074       density_root=&rp;
00075       return 0;
00076     }
00077 
00078     /// The default solver for calc_density().
00079     gsl_mroot_hybrids def_density_root;
00080 
00081     /// Default nondegenerate integrator
00082     gsl_inte_qagiu def_nit;
00083 
00084     /// Default degenerate integrator
00085     gsl_inte_qag def_dit;
00086 
00087     /// Set integrator memory
00088     int set_inte_mem(inte_mem &nim, inte_mem &dim) {
00089       nit_mem=&nim;
00090       dit_mem=&dim;
00091       return 0;
00092     }
00093 
00094     /// Set solver memory for calc_density()
00095     int set_density_root_mem(root_mem &rm) {
00096       density_root_mem=&rm;
00097       return 0;
00098     }
00099 
00100     /// Return string denoting type ("rel_boson")
00101     virtual const char *type() { return "rel_boson"; }
00102 
00103   protected:
00104 #ifndef DOXYGENP
00105 
00106     friend class io_tlate<rel_boson>;
00107 
00108     /// The non-degenerate integrator
00109     inte *nit;
00110     /// The degenerate integrator
00111     inte *dit;
00112     /// The solver for calc_density()
00113     root *density_root;
00114     
00115     /// Non-degenerate density integral
00116     double density_fun(double u, void *pa);
00117     /// Non-degenerate energy density integral
00118     double energy_fun(double u, void *pa);
00119     /// Non-degenerate entropy integral
00120     double entropy_fun(double u, void *pa);
00121     /// Degenerate density integral
00122     double deg_density_fun(double u, void *pa);
00123     /// Degenerate energy density integral
00124     double deg_energy_fun(double u, void *pa);
00125     /// Degenerate entropy integral
00126     double deg_entropy_fun(double u, void *pa);
00127     /// Solve for the density in calc_density()
00128     int solve_fun(double x, double &yy, void *pa);
00129 
00130 #endif
00131 
00132   };
00133 
00134   template<> int io_tlate<rel_boson>::input
00135     (cinput *co, in_file_format *ins, rel_boson *b);
00136   template<> int io_tlate<rel_boson>::output
00137     (coutput *co, out_file_format *outs, rel_boson *b);
00138   template<> const char *io_tlate<rel_boson>::type();
00139   
00140   typedef io_tlate<rel_boson> rel_boson_io_type;
00141 
00142 #ifndef DOXYGENP
00143 }
00144 #endif
00145 
00146 #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