cold_nstar.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, 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_COLD_NSTAR_H
00024 #define O2SCL_COLD_NSTAR_H
00025 
00026 #include <o2scl/hadronic_eos.h>
00027 #include <o2scl/tov_solve.h>
00028 #include <o2scl/table.h>
00029 #include <o2scl/fermion.h>
00030 #include <o2scl/cern_mroot_root.h>
00031 #include <o2scl/cern_mroot.h>
00032 #include <o2scl/gsl_mroot_hybrids.h>
00033 #include <o2scl/tov_eos.h>
00034 
00035 #ifndef DOXYGENP
00036 namespace o2scl {
00037 #endif
00038 
00039   /** 
00040       \brief Naive static cold neutron star
00041       \nosubgrouping
00042 
00043       This uses hadronic_eos::calc_e() to compute the equation of 
00044       state of zero-temperature beta-equilibrated neutron star
00045       matter and tov_solve::mvsr() to compute the mass versus
00046       radius curve.
00047 
00048       The electron and muon are given masses 
00049       o2scl_fm_const::mass_electron and o2scl_fm_const::mass_muon,
00050       respectively.
00051 
00052       The energy density and pressure are both calculated
00053       in units  \f$ \mathrm{fm}^{-4} \f$  and the baryon
00054       density in  \f$ \mathrm{fm}^{-3} \f$ 
00055       
00056       The condition for Urca is the area of the triangle
00057       formed by the neutron, proton, and electron Fermi momenta.
00058       
00059       Using the definition of the semi-perimeter, 
00060       \f[
00061       s \equiv \left( k_{F,n}+k_{F,p}+k_{F,e} \right)/2
00062       \f]
00063       Heron's formula gives the triangle area as
00064       \f[
00065       a=\sqrt{s(s-k_{F,n})(s-k_{F,p})(s-k_{F,e})}
00066       \f]
00067       
00068       The column in the eos \ref table labeled \c urca
00069       is  \f$ a^2 \f$ . If this quantity is positive, then
00070       direct Urca is allowed.
00071       
00072       The squared speed of sound (in units of  \f$ c \f$ )
00073       is calculated by 
00074       \f[
00075       c_s^2 = \frac{ d P }{d \varepsilon}
00076       \f]
00077       and this is placed in the column labeled \c cs2.
00078 
00079       The adabatic index is calculated by
00080       \f[
00081       \Gamma = \frac{ d \ln P} { d \ln \varepsilon}
00082       \f]
00083       Note that  \f$ \Gamma \f$  must be greater than  \f$ 4/3 \f$ 
00084       at the center of the neutron star for stability. (This
00085       is a necessary, but not sufficient condition.)
00086 
00087       Note that if the speed of sound is non-monotonic, then
00088       calc_eos() will only record the lowest density for which
00089       the EOS becomes acausal.
00090       
00091       \todo Ensure that the adiabatic index of the central density 
00092       is greater than 4/3?
00093       \todo Implement more stability criteria
00094       \todo Warn if the EOS becomes pure neutron matter?
00095   */
00096 
00097   class cold_nstar {
00098   public:
00099 
00100     cold_nstar();
00101 
00102     /// \name Basic operation
00103     //@{
00104     /** 
00105         \brief Set the equation of state
00106         
00107         This should be set before calling calc_eos().
00108     */
00109     int set_eos(hadronic_eos &he) {
00110       hep=&he;
00111       eos_set=true;
00112       return 0;
00113     }
00114     
00115     /** 
00116         \brief Calculate the given equation of state
00117      */
00118     int calc_eos(double np_0=0.0);
00119 
00120     /** 
00121         \brief Compute the density at which the direct Urca process is allowed
00122 
00123         This is faster than using calc_eos() since it does nothing
00124         other than computes the critical density. It does not store
00125         the equation of state.
00126      */
00127     double calc_urca(double np_0=0.0);
00128 
00129     /** \brief Calculate the M vs. R curve
00130      */
00131     int calc_nstar();
00132     //@}
00133 
00134     /** \brief The starting baryon density (default 0.05)
00135      */
00136     double nb_start;
00137 
00138     /** \brief The final baryon density (default 2.0)
00139      */
00140     double nb_end;
00141 
00142     /** \brief The baryon density stepsize (default 0.01)
00143      */
00144     double dnb;
00145 
00146     /** \brief If true, include muons (default false)
00147      */
00148     bool include_muons;
00149 
00150     /// \name Output 
00151     //@{
00152     /** 
00153         \brief The smallest baryon density where the pressure decreases
00154 
00155         If this is zero after calling calc_eos(), then 
00156         the pressure does not decrease in the specified range
00157         of baryon density
00158      */
00159     double min_bad;
00160 
00161     /** 
00162         \brief The smallest density where Urca becomes allowed
00163 
00164         If this is zero after calling calc_eos(), then direct
00165         Urca is never allowed.
00166      */
00167     double allow_urca;
00168 
00169     /** 
00170         \brief The smallest density where Urca becomes disallowed
00171         
00172         If this is zero after calling calc_eos(), then direct
00173         Urca is not disallowed at a higher density than 
00174         it becomes allowed.
00175      */
00176     double deny_urca;
00177 
00178     /** 
00179         \brief The density at which the EOS becomes acausal
00180 
00181         If this is zero, then the EOS is causal at all baryon densities
00182         in the specified range
00183      */
00184     double acausal;
00185 
00186     /** 
00187         \brief The pressure at which the EOS becomes acausal
00188 
00189         If this is zero, then the EOS is causal at all baryon densities
00190         in the specified range
00191      */
00192     double acausal_pr;
00193 
00194     /** 
00195         \brief The energy density at which the EOS becomes acausal
00196 
00197         If this is zero, then the EOS is causal at all baryon densities
00198         in the specified range
00199      */
00200     double acausal_ed;
00201 
00202     /** 
00203         \brief Solver tolerance (default \f$ 10^{-4} \f$)
00204     */
00205     double solver_tol;
00206 
00207     /** 
00208         \brief Get the eos table (after having called calc_eos())
00209     */
00210     table &get_eos_results() {
00211       return eost;
00212     }
00213     
00214     /** 
00215         \brief Get the results from the TOV (after having called calc_nstar())
00216     */
00217     table &get_tov_results() {
00218       return tp->get_results();
00219     }
00220 
00221     //@}
00222 
00223     /** 
00224         \brief Set the neutron and proton 
00225         
00226         The default objects are of type \ref fermion, with mass
00227         o2scl_fm_const::mass_neutron and o2scl_fm_const::mass_proton.
00228         These defaults will give incorrect results for
00229         non-relativistic equations of state.
00230      */
00231     int set_n_and_p(fermion &n, fermion &p) {
00232       np=&n;
00233       pp=&p;
00234       return 0;
00235     }
00236 
00237     /// The default neutron
00238     fermion def_n;
00239 
00240     /// The default proton
00241     fermion def_p;
00242 
00243     /** 
00244         \brief Specify the object for solving the TOV equations
00245         
00246         The default uses the low-density equation of state with
00247         tov::verbose=0. In calc_nstar(), the units are set by calling
00248         tov_solve::set_units().
00249     */
00250     int set_tov(tov_solve &ts) {
00251       tp=&ts;
00252       return 0;
00253     }
00254     
00255     /** \brief The default TOV equation solver
00256      */
00257     tov_solve def_tov;
00258 
00259     /** \brief Set the equation solver for the EOS
00260      */
00261     int set_root(root<void *,funct<void *> > &rf) {
00262       rp=&rf;
00263       return 0;
00264     }
00265 
00266     /** 
00267         \brief The default equation solver for the EOS
00268     */
00269     cern_mroot_root<void *,funct<void *> > def_root;
00270 
00271     /// Default EOS object for the TOV solver
00272     tov_interp_eos def_tov_eos;
00273 
00274 #ifndef DOXYGEN_INTERNAL
00275 
00276   protected:
00277 
00278     /// \name The thermodynamic information
00279     //@{
00280     thermo hb, h, l;
00281     //@}
00282 
00283     /// Solve to ensure zero charge in \f$ \beta \f$-equilibrium
00284     int solve_fun(double x, double &y, void *&vp);
00285 
00286     /// True if equation of state has been set
00287     bool eos_set;
00288 
00289     /// The electron
00290     fermion e;
00291 
00292     /// The muon
00293     fermion mu;
00294 
00295     /// A pointer to the equation of state
00296     hadronic_eos *hep;
00297 
00298     /// A pointer to the neutron
00299     fermion *np;
00300 
00301     /// A pointer to the proton
00302     fermion *pp;
00303 
00304     /// A pointer to the TOV object
00305     tov_solve *tp;
00306     
00307     /// A pointer to the solver
00308     root<void *,funct<void *> > *rp;
00309 
00310     /// Storage for the EOS table
00311     table eost;
00312 
00313     /// The baryon density
00314     double barn;
00315 
00316 #endif
00317 
00318   };
00319 
00320 
00321 #ifndef DOXYGENP
00322 }
00323 #endif
00324 
00325 #endif

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