70 #include "utilitaires.h" 75 void interpol_herm_2d(
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
76 const Tbl&,
double,
double,
double&,
double&,
double&) ;
86 Hot_eos(
"Tabulated hot EoS"), tablename(filename), authors(
"Unknown"),
87 hmin(0.), hmax(1.), sbmin(0.), sbmax(1.)
100 size_t ret = fread(tmp_string,
sizeof(
char), nc, fich) ;
104 cerr <<
"Hoteos_tabul: constructor from a binary file:" << endl ;
105 cerr <<
"Problems in reading the table name." << endl ;
106 cerr <<
"Aborting..." << endl ;
138 if (
hhh != 0x0)
delete hhh ;
139 if (
s_B != 0x0)
delete s_B ;
140 if (
ppp != 0x0)
delete ppp ;
143 if (
d2p != 0x0)
delete d2p ;
154 char tmp_string[160] ;
156 fwrite(tmp_string,
sizeof(
char), 160, fich) ;
161 ost <<
"Hot EOS of class Hoteos_tabul (tabulated hot beta-equilibrium EoS) : " 163 ost <<
"Built from file " <<
tablename << endl ;
164 ost <<
"Authors : " <<
authors << endl ;
165 ost <<
"Number of points in file : " <<
hhh->
get_dim(0)
167 <<
" in entropy." << endl ;
183 cerr <<
"Hoteos_tabul::read_table(): " << endl ;
184 cerr <<
"Problem in opening the EOS file!" << endl ;
185 cerr <<
"While trying to open " <<
tablename << endl ;
186 cerr <<
"Aborting..." << endl ;
190 fich.ignore(1000,
'\n') ;
193 for (
int i=0; i<3; i++) {
194 fich.ignore(1000,
'\n') ;
198 fich >> nbp1 >> nbp2 ; fich.ignore(1000,
'\n') ;
199 if ( (nbp1<=0) || (nbp2<=0) ) {
200 cerr <<
"Hoteos_tabul::read_table(): " << endl ;
201 cerr <<
"Wrong value for the number of lines!" << endl ;
202 cerr <<
"nbp1 = " << nbp1 <<
", nbp2 = " << nbp2 << endl ;
203 cerr <<
"Aborting..." << endl ;
207 for (
int i=0; i<3; i++) {
208 fich.ignore(1000,
'\n') ;
211 ppp =
new Tbl(nbp2, nbp1) ;
212 hhh =
new Tbl(nbp2, nbp1) ;
213 s_B =
new Tbl(nbp2, nbp1) ;
216 d2p =
new Tbl(nbp2, nbp1) ;
225 double c2 = c_si * c_si ;
226 double dummy, nb_fm3, rho_cgs, p_cgs, mu_MeV, entr, temp, der2 ;
230 for (
int j=0; j<nbp2; j++) {
231 for (
int i=0; i<nbp1; i++) {
232 fich >> no >> nb_fm3>> rho_cgs >> p_cgs>> mu_MeV >> entr >> temp >> der2
234 fich.ignore(1000,
'\n') ;
235 if ( (nb_fm3<0) || (rho_cgs<0) || (p_cgs < 0) ){
236 cerr <<
"Eos_mag::read_table(): " << endl ;
237 cerr <<
"Negative value in table!" << endl ;
238 cerr <<
"nb = " << nb_fm3 <<
", rho = " << rho_cgs <<
239 ", p = " << p_cgs << endl ;
240 cerr <<
"Aborting..." << endl ;
244 double psc2 = 0.1*p_cgs/c2 ;
245 double rho_si = rho_cgs*1000. ;
247 double h_read =
log(mu_MeV) ;
248 if ( (i==0) && (j==0) ) ww = h_read ;
249 double h_new = h_read - ww ;
251 ppp->
set(j, i) = psc2/rhonuc_si ;
254 dpdh->
set(j, i) = (rho_si + psc2)/rhonuc_si ;
255 dpds->
set(j, i) = -temp*nb_fm3*mevpfm3 ;
256 d2p->
set(j, i) = 0.1*der2*mu_MeV/(c2*rhonuc_si) ;
260 hmin = (*hhh)(0, 0) ;
261 hmax = (*hhh)(0, nbp1-1) ;
263 sbmin = (*s_B)(0, 0) ;
264 sbmax = (*s_B)(nbp2-1, 0) ;
266 cout <<
"hmin: " <<
hmin <<
", hmax: " <<
hmax << endl ;
267 cout <<
"sbmin: " <<
sbmin <<
", sbmax: " <<
sbmax << endl ;
279 cerr <<
"Warning: Hoteos_tabul::new_cold_Eos " <<
280 "The corresponding cold EoS is likely not to work" << endl ;
281 cout <<
"read from file: "<<
tablename.c_str() << endl;
300 cout <<
"The second EOS is not of type Hoteos_tabul !" << endl ;
322 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
329 cout <<
"Hoteos_tabul::nbar_Hs_p : ent > hmax !" << endl ;
334 cerr <<
"Hoteos_tabul::nbar_Hs_p : s_B not in the tabulated interval !" 336 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax 341 double p_int, dpds_int, dpdh_int ;
343 dpds_int, dpdh_int) ;
345 double nbar_int = dpdh_int *
exp(-ent) ;
358 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
365 cout <<
"Hoteos_tabul::ener_Hs_p : ent > hmax !" << endl ;
370 cerr <<
"Hoteos_tabul::ener_Hs_p : s_B not in the tabulated interval !" 372 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax 377 double p_int, dpds_int, dpdh_int ;
379 dpds_int, dpdh_int) ;
381 double nbar_int = dpdh_int *
exp(-ent) ;
383 double f_int = - p_int +
exp(ent) * nbar_int;
397 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
404 cout <<
"Hoteos_tabul::press_Hs_p : ent > hmax !" << endl ;
409 cerr <<
"Hoteos_tabul::press_Hs_p : s_B not in the tabulated interval !" 411 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax 416 double p_int, dpds_int, dpdh_int ;
418 dpds_int, dpdh_int) ;
431 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
438 cout <<
"Hoteos_tabul::temp_Hs_p : ent > hmax !" << endl ;
443 cerr <<
"Hoteos_tabul::temp_Hs_p : s_B not in the tabulated interval !" 445 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax 450 double p_int, dpds_int, dpdh_int ;
452 dpds_int, dpdh_int) ;
454 double nbar_int = dpdh_int *
exp(-ent) ;
456 double temp_int = -dpds_int / nbar_int ;
466 cerr <<
"Hoteos_tabul::csound_square_Hs_p : function not implemented (yet !) ..." << endl;
467 cerr <<
"Aborting ..." << endl;
474 cerr <<
"Hoteos_tabul::chi2_Hs_p : function not implemented (yet !) ..." << endl;
475 cerr <<
"Aborting ..." << endl;
482 cerr <<
"Hoteos_tabul::mul_Hs_p : function not implemented (yet !) ..." << endl;
483 cerr <<
"Aborting ..." << endl;
490 cerr <<
"Hoteos_tabul::sigma_Hs_p : function not implemented (yet !) ..." << endl;
491 cerr <<
"Aborting ..." << endl;
Cmp log(const Cmp &)
Neperian logarithm.
Cmp exp(const Cmp &)
Exponential.
Eos * p_cold_eos
Corresponding cold Eos.
virtual double chi2_Hs_p(double ent, const double ye) const
Computes the chi^2 coefficient from the enthapy with electronic fraction (virtual function implemente...
virtual double sigma_Hs_p(double ent, const double ye) const
Computes the source terms for electronic fraction advection equation from the enthapy with electronic...
Standard units of space, time and mass.
Equation of state base class.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Hoteos_tabul(const string &filename)
Standard constructor from a filename.
virtual double press_Hs_p(double ent, double sb) const
Computes the pressure from the log-enthalpy and entropy per baryon (virtual function implemented in t...
virtual int identify() const
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
virtual bool operator==(const Hot_eos &) const
Comparison operator (egality)
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Tbl * s_B
Table of , entropy per baryon (in units of Boltzmann constant).
double hmax
Upper boundary of the enthalpy interval.
string authors
Authors - reference for the table.
double hmin
Lower boundary of the enthalpy interval.
string tablename
Name of the file containing the tabulated data.
void set_arrays_0x0()
Sets all the arrays to the null pointer.
void read_table()
Reads the file containing the table and initializes in the arrays hhh , s_B, ppp, ...
virtual double csound_square_Hs_p(double ent, const double ye) const
Computes the sound speed squared from the enthapy with electronic fraction (virtual function impleme...
virtual int identify() const =0
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
virtual const Eos & new_cold_Eos() const
Returns the corresponding cold Eos.
virtual void sauve(FILE *) const
Save in a file.
Base class for 2-parameters equations of state (abstract class).
virtual ~Hoteos_tabul()
Destructor.
virtual void sauve(FILE *) const
Save in a file.
virtual double temp_Hs_p(double ent, double sb) const
Computes the temperature from the log-enthalpy and entropy per baryon (virtual function implemented i...
Tbl * ppp
Table of pressure $P$.
virtual ostream & operator>>(ostream &) const
Operator >>
double sbmax
Upper boundary of the entropy interval.
Equation of state for the CompOSE database.
virtual bool operator!=(const Hot_eos &) const
Comparison operator (difference)
virtual double mul_Hs_p(double ent, const double ye) const
Computes the electronic chemical potential from the enthapy with electronic fraction (virtual functio...
virtual double nbar_Hs_p(double ent, double sb) const
Computes the baryon density from the log-enthalpy and entropy per baryon (virtual function implemente...
double sbmin
Lower boundary of the entropy interval.
virtual double ener_Hs_p(double ent, double sb) const
Computes the total energy density from the log-enthalpy and entropy per baryon (virtual function impl...