26 #ifndef O2SCL_TABULATED_EOS_H 27 #define O2SCL_TABULATED_EOS_H 30 #include <o2scl/constants.h> 31 #include <o2scl/eos_had_base.h> 32 #include <o2scl/fermion.h> 33 #include <o2scl/eos_had_apr.h> 35 #ifndef DOXYGEN_NO_O2NS 78 std::string srho_nuc, srho_neut, snuc, sneut;
85 if (!one_table)
delete tneut;
101 if (!one_table)
delete tneut;
109 if (table_alloc==
false) {
110 O2SCL_ERR(
"No EOS specified in eos_had_tabulated::calc_e().",
115 double delta=(1.0-2.0*xp);
121 double edsym=(tneut->
interp(srho_neut,barn,sneut)-
122 tnuc->
interp(srho_nuc,barn,snuc))/
125 th.
ed=ednuc+delta*delta*edsym;
128 double dednucdn=tnuc->
deriv(srho_nuc,barn,snuc)/
130 double dedsymdn=barn*(tneut->
deriv(srho_neut,barn,sneut)-
131 tnuc->
deriv(srho_nuc,barn,snuc))/
135 ne.
mu=(dednucdn+delta*delta*dedsymdn)+4.0*delta*edsym*xp/barn;
136 pr.
mu=(dednucdn+delta*delta*dedsymdn)+4.0*delta*edsym*(xp-1.0)/barn;
147 template <
class vec_t>
148 int set_eos(
size_t n, vec_t &rho, vec_t &Enuc, vec_t &Eneut) {
158 for(
size_t i=0;i<n;i++) {
159 double line[3]={rho[i],Enuc[i],Eneut[i]};
172 template<
class vec_t>
173 int set_eos(
size_t n_nuc, vec_t &rho_nuc, vec_t &E_nuc,
174 size_t n_neut, vec_t &rho_neut, vec_t &E_neut) {
186 for(
size_t i=0;i<n_nuc;i++) {
187 double line[2]={rho_nuc[i],E_nuc[i]};
190 for(
size_t i=0;i<n_neut;i++) {
191 double line[2]={rho_neut[i],E_neut[i]};
210 #ifndef DOXYGEN_NO_O2NS
void deriv(std::string x, std::string y, std::string yp)
bool table_alloc
True if the table has been allocated.
void free_table()
Free the table memory.
int set_eos(size_t n, vec_t &rho, vec_t &Enuc, vec_t &Eneut)
Set the EOS through vectors specifying the densities and energies.
Zero-temperature EOS from a table.
int set_eos(size_t n_nuc, vec_t &rho_nuc, vec_t &E_nuc, size_t n_neut, vec_t &rho_neut, vec_t &E_neut)
Set the EOS through vectors specifying the densities and energies.
double interp(std::string sx, double x0, std::string sy)
void line_of_names(std::string newheads)
A hadronic EOS based on a function of the densities [abstract base].
virtual int calc_e(fermion &ne, fermion &pr, thermo &th)
Equation of state as a function of density.
table & get_neut_table()
Return the internal table.
void line_of_data(size_t nv, const vec2_t &v)
bool one_table
If true, then tnuc and tneut point to the same table.
table & get_nuc_table()
Return the internal table.