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_HAD_GIBBS_NSEOS_H 00024 #define O2SCL_HAD_GIBBS_NSEOS_H 00025 00026 #include <cmath> 00027 #include <o2scl/constants.h> 00028 #include <o2scl/hadronic_eos.h> 00029 00030 #ifndef DOXYGENP 00031 namespace o2scl { 00032 #endif 00033 00034 /** \brief Create a Gibbs phase transition between two hadronic EOSs 00035 to create neutron star matter 00036 00037 This computes neutron star matter assuming a Gibbs phase 00038 transition between two \ref hadronic_eos 's. When possible it 00039 generally uses hadronic_eos::calc_e() over 00040 hadronic_eos::calc_p(). 00041 00042 This class is not very sophisticated and the functions calc_e() 00043 and fixed_chi() will fail if the initial guess is not good 00044 enough. 00045 */ 00046 class had_gibbs_nseos { 00047 00048 public: 00049 00050 had_gibbs_nseos(); 00051 00052 virtual ~had_gibbs_nseos(); 00053 00054 /** \brief Compute the properties of neutron star matter at 00055 00056 fixed density 00057 */ 00058 virtual int calc_e(double nb, fermion &n1, fermion &p1, thermo &th1, 00059 fermion &n2, fermion &p2, thermo &th2, double &chi, 00060 int type); 00061 00062 /** \brief Compute the properties of neutron star matter in the 00063 00064 mixed phase for fixed chi 00065 */ 00066 virtual int fixed_chi(double chi, fermion &n1, fermion &p1, thermo &th1, 00067 fermion &n2, fermion &p2, thermo &th2, double &nb, 00068 int type); 00069 00070 /// Set the Phase 1 hadronic equation of state 00071 int set_hadronic_eos1(hadronic_eos &he) { 00072 hep1=&he; 00073 return 0; 00074 } 00075 00076 /// Set the Phase 2 hadronic equation of state 00077 int set_hadronic_eos2(hadronic_eos &he) { 00078 hep2=&he; 00079 return 0; 00080 } 00081 00082 /// The default solver 00083 gsl_mroot_hybrids<void *,mm_funct<void *> > def_solver; 00084 00085 /** 00086 \brief Change the solver 00087 00088 In order to work properly, the solver needs to gracefully 00089 recover from a function which returns a non-zero value. If a 00090 \ref gsl_mroot_hybrids object is used, then \ref 00091 gsl_mroot_hybrids::shrink_step should be set to \c true. This 00092 is done automatically for the default solver. 00093 */ 00094 int set_solver(mroot<void *,mm_funct<void *> > &mr) { 00095 solverp=&mr; 00096 return 0; 00097 } 00098 00099 /** \brief The guess for the phase of the next call to calc_e() 00100 (default: \c phase1) 00101 */ 00102 int phase_guess; 00103 00104 /** \name Possible values for phase_guess 00105 */ 00106 //@{ 00107 static const int phase1=1; 00108 static const int phase2=2; 00109 static const int mixed_phase=3; 00110 //@} 00111 00112 /** \name Possible values for type 00113 */ 00114 //@{ 00115 static const int nuclear_matter=1; 00116 static const int neutron_matter=2; 00117 static const int nstar_matter=3; 00118 //@} 00119 00120 #ifndef DOXYGEN_INTERNAL 00121 00122 protected: 00123 00124 /** \brief Useful structure for parameters to phase1_eqs(), phase2_eqs(), 00125 and gibbs_eqs() [protected] 00126 */ 00127 typedef struct solvepar_s { 00128 fermion *n1; 00129 fermion *p1; 00130 fermion *n2; 00131 fermion *p2; 00132 thermo *th1; 00133 thermo *th2; 00134 double nb; 00135 } solvepar; 00136 00137 /** \brief Useful structure for parameters to 00138 had_gibbs_nseos::fixed_chi_eqs() [protected] 00139 */ 00140 typedef struct chipar_s { 00141 fermion *n1; 00142 fermion *p1; 00143 fermion *n2; 00144 fermion *p2; 00145 thermo *th1; 00146 thermo *th2; 00147 double chi; 00148 } chipar; 00149 00150 /// Solve for Phase 1 matter 00151 int phase1_nstar(size_t nv, const ovector_view &x, ovector_view &y, 00152 void *&pa); 00153 00154 /// Solve for Phase 2 matter 00155 int phase2_nstar(size_t nv, const ovector_view &x, ovector_view &y, 00156 void *&pa); 00157 00158 /// Solve for mixed phase matter 00159 int gibbs_nstar(size_t nv, const ovector_view &x, ovector_view &y, 00160 void *&pa); 00161 00162 /// Solve for mixed phase matter at fixed chi 00163 int fixed_chi_nstar(size_t nv, const ovector_view &x, ovector_view &y, 00164 void *&pa); 00165 00166 /// Solve for mixed phase matter 00167 int gibbs_nuc(size_t nv, const ovector_view &x, ovector_view &y, 00168 void *&pa); 00169 00170 /// Solve for mixed phase matter at fixed chi 00171 int fixed_chi_nuc(size_t nv, const ovector_view &x, ovector_view &y, 00172 void *&pa); 00173 00174 /// Solve for mixed phase matter 00175 int gibbs_neut(size_t nv, const ovector_view &x, ovector_view &y, 00176 void *&pa); 00177 00178 /// Solve for mixed phase matter at fixed chi 00179 int fixed_chi_neut(size_t nv, const ovector_view &x, ovector_view &y, 00180 void *&pa); 00181 00182 /// The hadronic EOS for Phase 1 00183 hadronic_eos *hep1; 00184 00185 /// The hadronic EOS for Phase 2 00186 hadronic_eos *hep2; 00187 00188 /// The electron 00189 fermion elec; 00190 00191 /// The muon 00192 fermion mu; 00193 00194 /// The solver 00195 mroot<void *,mm_funct<void *> > *solverp; 00196 00197 /// \name Storage for the solution vectors 00198 //@{ 00199 ovector gx; 00200 ovector px; 00201 //@} 00202 #endif 00203 00204 }; 00205 00206 #ifndef DOXYGENP 00207 } 00208 #endif 00209 00210 #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