87 #include "utilitaires.h" 92 void interpol_herm_2d(
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
const Tbl&,
double,
double,
double&,
double&,
double&) ;
102 const char* path) :
Eos(name_i), tablename(path) {
114 :
Eos(name_i), tablename(file_name) {
127 fread(tmp_name,
sizeof(
char), 160, fich) ;
191 cerr <<
"The second EOS is not of type Eos_mag !" << endl ;
213 "EOS of class Eos_mag : tabulated EOS depending on two variables: enthalpy and magnetic field." 215 ost <<
"Table read from " <<
tablename << endl ;
234 cerr <<
"Eos_mag::read_table(): " << endl ;
235 cerr <<
"Problem in opening the EOS file!" << endl ;
236 cerr <<
"Aborting..." << endl ;
240 for (
int i=0; i<5; i++) {
241 fich.ignore(1000,
'\n') ;
245 fich >> nbp1 >> nbp2 ; fich.ignore(1000,
'\n') ;
246 if ((nbp1<=0) || (nbp2<=0)) {
247 cerr <<
"Eos_mag::read_table(): " << endl ;
248 cerr <<
"Wrong value for the number of lines!" << endl ;
249 cerr <<
"nbp1 = " << nbp1 <<
", nbp2 = " << nbp2 << endl ;
250 cerr <<
"Aborting..." << endl ;
254 for (
int i=0; i<3; i++) {
255 fich.ignore(1000,
'\n') ;
272 double c2 = c_si * c_si ;
273 double B_unit = mag_unit / 1.e11 ;
274 double M_unit = B_unit*mu0/(4*M_PI) ;
277 double nb_fm3, rho_cgs, p_cgs, mu_MeV, magB_PG, magM_PG, chi_PGpMeV ;
281 for (
int j=0; j<nbp2; j++) {
283 for (
int i=0; i<nbp1; i++) {
284 fich >> no1 >> nb_fm3 >> rho_cgs >> p_cgs >> mu_MeV
285 >> magB_PG >> magM_PG >> chi_PGpMeV ;
286 fich.ignore(1000,
'\n') ;
287 if ( (nb_fm3<0) || (rho_cgs<0)) {
288 cerr <<
"Eos_mag::read_table(): " << endl ;
289 cerr <<
"Negative value in table!" << endl ;
290 cerr <<
"nb = " << nb_fm3 <<
", rho = " << rho_cgs <<
291 ", p = " << p_cgs << endl ;
292 cerr <<
"Aborting..." << endl ;
296 double psc2 = 0.1*p_cgs/c2 ;
297 double rho_si = rho_cgs*1000. ;
299 double h_read =
log(mu_MeV) ;
300 if ( (i==0) && (j==0) ) ww = h_read ;
301 double h_new = h_read - ww ;
303 logp->
set(j, i) = psc2/rhonuc_si ;
306 dlpsdlh->
set(j, i) = (rho_si + psc2)/rhonuc_si ;
308 d2lp->
set(j, i) = mu_MeV*chi_PGpMeV / (M_unit) ;
313 hmin = (*logh)(0, 0) ;
314 hmax = (*logh)(0, nbp1-1) ;
316 Bmax = (*Bfield)(nbp2-1, 0) ;
337 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
342 cerr <<
"Eos_tabul::nbar_ent_p : ent > hmax !" << endl ;
353 cerr <<
"Eos_tabul::nbar_ent_p : B > Bmax !" << endl ;
354 cerr <<
"B = " << magB0*mag_unit <<
", Bmax = " <<
Bmax*mag_unit << endl ;
358 double p_int, dpdb_int, dpdh_int ;
361 p_int, dpdb_int, dpdh_int) ;
363 double nbar_int = dpdh_int *
exp(-ent) ;
380 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
385 cerr <<
"Eos_tabul::ener_ent_p : ent > hmax !" << endl ;
397 cerr <<
"Eos_tabul::ener_ent_p : B > Bmax !" << endl ;
398 cerr <<
"B = " << magB0*mag_unit <<
", Bmax = " <<
Bmax*mag_unit << endl ;
403 double p_int, dpdb_int, dpdh_int ;
406 p_int, dpdb_int, dpdh_int) ;
408 double nbar_int = dpdh_int *
exp(-ent) ;
410 double f_int = - p_int +
exp(ent) * nbar_int;
426 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
431 cout <<
"Eos_mag::press_ent_p : ent > hmax !" << endl ;
443 cerr <<
"Eos_tabul::press_ent_p : B > Bmax !" << endl ;
444 cerr <<
"B = " << magB0*mag_unit <<
", Bmax = " <<
Bmax*mag_unit << endl ;
448 double p_int, dpdb_int, dpdh_int ;
451 p_int, dpdb_int, dpdh_int) ;
467 if ((ent >
hmin - 1.e-12) && (ent <
hmin))
472 cout <<
"Eos_mag::mag_ent_p : ent > hmax !" << endl ;
484 cerr <<
"Eos_tabul::mag_ent_p : B > Bmax !" << endl ;
485 cerr <<
"B = " << magB0*mag_unit <<
", Bmax = " <<
Bmax*mag_unit << endl ;
489 double p_int, dpdb_int, dpdh_int ;
492 p_int, dpdb_int, dpdh_int) ;
494 double magnetization = dpdb_int ;
499 return mu0*magnetization / magB0 ;
double Bmax
Upper boundary of the magnetic field interval.
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Cmp log(const Cmp &)
Neperian logarithm.
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
double & get_double_mod(int position=0) const
Returns the reference of a stored modifiable double .
Cmp exp(const Cmp &)
Exponential.
virtual double der_press_nbar_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual void sauve(FILE *) const
Save in a file.
string tablename
Name of the file containing the tabulated data.
Equation of state base class.
double & set(int i)
Read/write of a particular element (index i) (1D case)
virtual int identify() const =0
Returns a number to identify the sub-classe of Eos the object belongs to.
double hmax
Upper boundary of the log-enthalpy interval.
double hmin
Lower boundary of the log-enthalpy interval.
virtual void sauve(FILE *) const
Save in a file.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
virtual ostream & operator>>(ostream &) const
Operator >>
double mag_ent_p(double ent, const Param *par=0x0) const
Computes the magnetisation.
int get_n_double_mod() const
Returns the number of stored modifiable double 's addresses.
void read_table()
Reads the file containing the table and initializes in the arrays logh , logp and dlpsdlh ...
Eos_mag(const char *name_i, const char *table, const char *path)
Standard constructor.
virtual ~Eos_mag()
Destructor.
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
virtual bool operator==(const Eos &) const
Comparison operator (egality)
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Standard electro-magnetic units.