30char hoteos_tabul_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Eos/hoteos_tabul.C,v 1.2 2015/12/08 15:42:17 j_novak Exp $" ;
55#include "utilitaires.h"
60 void interpol_herm_2d(
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
61 const Tbl&,
double,
double,
double&,
double&,
double&) ;
71 Hot_eos(
"Tabulated hot EoS"), tablename(filename), authors(
"Unknown"),
72 hmin(0.), hmax(1.), sbmin(0.), sbmax(1.)
83 char tmp_string[160] ;
84 fread(tmp_string,
sizeof(
char), 160, fich) ;
115 if (
hhh != 0x0)
delete hhh ;
116 if (
s_B != 0x0)
delete s_B ;
117 if (
ppp != 0x0)
delete ppp ;
120 if (
d2p != 0x0)
delete d2p ;
131 char tmp_string[160] ;
133 fwrite(tmp_string,
sizeof(
char), 160, fich) ;
138 ost <<
"Hot EOS of class Hoteos_tabul (tabulated hot beta-equilibrium EoS) : "
140 ost <<
"Built from file " <<
tablename << endl ;
141 ost <<
"Authors : " <<
authors << endl ;
142 ost <<
"Number of points in file : " <<
hhh->
get_dim(0)
144 <<
" in entropy." << endl ;
160 cerr <<
"Hoteos_tabul::read_table(): " << endl ;
161 cerr <<
"Problem in opening the EOS file!" << endl ;
162 cerr <<
"While trying to open " <<
tablename << endl ;
163 cerr <<
"Aborting..." << endl ;
167 fich.ignore(1000,
'\n') ;
170 for (
int i=0; i<3; i++) {
171 fich.ignore(1000,
'\n') ;
175 fich >> nbp1 >> nbp2 ; fich.ignore(1000,
'\n') ;
176 if ( (nbp1<=0) || (nbp2<=0) ) {
177 cerr <<
"Hoteos_tabul::read_table(): " << endl ;
178 cerr <<
"Wrong value for the number of lines!" << endl ;
179 cerr <<
"nbp1 = " << nbp1 <<
", nbp2 = " << nbp2 << endl ;
180 cerr <<
"Aborting..." << endl ;
184 for (
int i=0; i<3; i++) {
185 fich.ignore(1000,
'\n') ;
188 ppp =
new Tbl(nbp2, nbp1) ;
189 hhh =
new Tbl(nbp2, nbp1) ;
190 s_B =
new Tbl(nbp2, nbp1) ;
193 d2p =
new Tbl(nbp2, nbp1) ;
202 double c2 = c_si * c_si ;
203 double dummy, nb_fm3, rho_cgs, p_cgs, mu_MeV, entr, temp, der2 ;
206 for (
int j=0; j<nbp2; j++) {
207 for (
int i=0; i<nbp1; i++) {
208 fich >> mu_MeV >> entr >> nb_fm3 >> temp >> p_cgs >> der2
209 >> dummy >> rho_cgs ;
210 fich.ignore(1000,
'\n') ;
211 if ( (nb_fm3<0) || (rho_cgs<0) || (p_cgs < 0) ){
212 cerr <<
"Eos_mag::read_table(): " << endl ;
213 cerr <<
"Negative value in table!" << endl ;
214 cerr <<
"nb = " << nb_fm3 <<
", rho = " << rho_cgs <<
215 ", p = " << p_cgs << endl ;
216 cerr <<
"Aborting..." << endl ;
220 double psc2 = 0.1*p_cgs/c2 ;
221 double rho_si = rho_cgs*1000. ;
223 double h_read =
log(mu_MeV) ;
224 if ( (i==0) && (j==0) ) ww = h_read ;
225 double h_new = h_read - ww ;
227 ppp->
set(j, i) = psc2/rhonuc_si ;
230 dpdh->
set(j, i) = (rho_si + psc2)/rhonuc_si ;
231 dpds->
set(j, i) = -temp*nb_fm3*mevpfm3 ;
232 d2p->
set(j, i) = 0.1*der2*mu_MeV/(c2*rhonuc_si) ;
236 hmin = (*hhh)(0, 0) ;
237 hmax = (*hhh)(0, nbp1-1) ;
239 sbmin = (*s_B)(0, 0) ;
240 sbmax = (*s_B)(nbp2-1, 0) ;
242 cout <<
"hmin: " <<
hmin <<
", hmax: " <<
hmax << endl ;
243 cout <<
"sbmin: " <<
sbmin <<
", sbmax: " <<
sbmax << endl ;
255 cerr <<
"Warning: Hoteos_tabul::new_cold_Eos " <<
256 "The corresponding cold EoS is likely not to function." << endl ;
274 cout <<
"The second EOS is not of type Hoteos_tabul !" << endl ;
296 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
303 cout <<
"Hoteos_tabul::nbar_Hs_p : ent > hmax !" << endl ;
308 cerr <<
"Hoteos_tabul::nbar_Hs_p : s_B not in the tabulated interval !"
310 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax
315 double p_int, dpds_int, dpdh_int ;
317 dpds_int, dpdh_int) ;
319 double nbar_int = dpdh_int *
exp(-ent) ;
332 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
339 cout <<
"Hoteos_tabul::ener_Hs_p : ent > hmax !" << endl ;
344 cerr <<
"Hoteos_tabul::ener_Hs_p : s_B not in the tabulated interval !"
346 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax
351 double p_int, dpds_int, dpdh_int ;
353 dpds_int, dpdh_int) ;
355 double nbar_int = dpdh_int *
exp(-ent) ;
357 double f_int = - p_int +
exp(ent) * nbar_int;
371 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
378 cout <<
"Hoteos_tabul::press_Hs_p : ent > hmax !" << endl ;
383 cerr <<
"Hoteos_tabul::press_Hs_p : s_B not in the tabulated interval !"
385 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax
390 double p_int, dpds_int, dpdh_int ;
392 dpds_int, dpdh_int) ;
405 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
412 cout <<
"Hoteos_tabul::temp_Hs_p : ent > hmax !" << endl ;
417 cerr <<
"Hoteos_tabul::temp_Hs_p : s_B not in the tabulated interval !"
419 cerr <<
"s_B = " << sb <<
", sbmin = " <<
sbmin <<
", sbmax = " <<
sbmax
424 double p_int, dpds_int, dpdh_int ;
426 dpds_int, dpdh_int) ;
428 double nbar_int = dpdh_int *
exp(-ent) ;
430 double temp_int = -dpds_int / nbar_int ;
Equation of state for the CompOSE database.
Equation of state base class.
Base class for temperature-dependent equations of state (abstract class).
virtual int identify() const =0
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
Eos * p_cold_eos
Corresponding cold Eos.
virtual void sauve(FILE *) const
Save in a file.
double hmin
Lower boundary of the enthalpy interval.
virtual void sauve(FILE *) const
Save in a file.
virtual ~Hoteos_tabul()
Destructor.
double sbmax
Upper boundary of the entropy interval.
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...
Hoteos_tabul(const string &filename)
Standard constructor from a filename.
virtual bool operator!=(const Hot_eos &) const
Comparison operator (difference)
void set_arrays_0x0()
Sets all the arrays to the null pointer.
virtual ostream & operator>>(ostream &) const
Operator >>
virtual bool operator==(const Hot_eos &) const
Comparison operator (egality)
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...
double hmax
Upper boundary of the enthalpy interval.
virtual const Eos & new_cold_Eos() const
Returns the corresponding cold Eos.
string tablename
Name of the file containing the tabulated data.
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...
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...
virtual int identify() const
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
string authors
Authors - reference for the table.
Tbl * s_B
Table of , entropy per baryon (in units of Boltzmann constant).
void read_table()
Reads the file containing the table and initializes in the arrays hhh , s_B, ppp, ....
Tbl * ppp
Table of pressure $P$.
double sbmin
Lower boundary of the entropy interval.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int i)
Read/write of a particular element (index i) (1D case)
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
Cmp exp(const Cmp &)
Exponential.
Cmp log(const Cmp &)
Neperian logarithm.
Standard units of space, time and mass.