Lorene::Dyn_eos_tab Class Reference
[Equations of state]

Class for tabulated equations of state for use in dynamical code. More...

#include <dyneos.h>

Inheritance diagram for Lorene::Dyn_eos_tab:
Lorene::Dyn_eos Lorene::Dyn_eos_cons

List of all members.

Public Member Functions

 Dyn_eos_tab (const string &name_i, const string &table_name, bool compose=true)
 Standard constructor.
virtual ~Dyn_eos_tab ()
 Destructor.
virtual bool operator== (const Dyn_eos &) const
 Comparison operator (egality).
virtual bool operator!= (const Dyn_eos &) const
 Comparison operator (difference).
virtual int identify () const
 Returns a number to identify the sub-classe of Dyn_eos the object belongs to.
virtual void sauve (FILE *) const
 Save in a file.
virtual double ent_nbar_p (double nbar, const Param *par=0x0) const
 Computes the log-enthalpy from the baryon density and extra parameters (virtual function implemented in the derived classes).
virtual double ener_nbar_p (double nbar, const Param *par=0x0) const
 Computes the total energy density from the baryon density and extra parameters (virtual function implemented in the derived classes).
virtual double press_nbar_p (double nbar, const Param *par=0x0) const
 Computes the pressure from the baryon density and extra parameters (virtual function implemented in the derived classes).
virtual double csound_nbar_p (double nbar, const Param *par=0x0) const
 Computes the sound speed $ c_s = c \sqrt{d p / d e}$ from the baryon density with extra parameters (virtual function implemented in the derived classes).
const string & get_name () const
 Returns the EOS name.
void set_name (const string &)
 Sets the EOS name.
virtual bool operator== (const Dyn_eos &) const =0
 Comparison operator (egality).
virtual bool operator!= (const Dyn_eos &) const =0
 Comparison operator (difference).
Scalar ent_nbar (const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
 Computes the log-enthalpy field from the baryon density field and extra parameters.
Scalar ener_nbar (const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
 Computes the total energy density from the baryon density and extra parameters.
Scalar press_nbar (const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
 Computes the pressure from the baryon density and extra parameters.
Scalar csound_nbar (const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const
 Computes the sound speed $ c_s = c \sqrt{d p / d e}$ from the baryon density with extra parameters.

Static Public Member Functions

static Dyn_eoseos_from_file (FILE *)
 Construction of an EOS from a binary file.
static Dyn_eoseos_from_file (ifstream &)
 Construction of an EOS from a formatted file.

Protected Member Functions

 Dyn_eos_tab ()
 Default constructor to be called by derived classes.
 Dyn_eos_tab (FILE *)
 Constructor from a binary file (created by the function sauve(FILE*) ).
 Dyn_eos_tab (ifstream &ist)
 Constructor from a formatted file.
virtual void read_table_compose ()
 Reads the files .nb and .thermo containing the table in CompOSE format and initializes the arrays lognb , loge and dlesdlnb .
virtual void read_table_lorene ()
 Reads the file containing the table in LORENE format and initializes the arrays lognb , loge and dlesdlnb .
virtual ostream & operator>> (ostream &) const
 Operator >>.
void calcule (const Scalar &thermo, int nzet, int l_min, double(Dyn_eos::*fait)(double, const Param *) const, Param *par, Scalar &resu) const
 General computational method for Scalar 's.

Protected Attributes

string tablename
 Name of the file containing the tabulated data.
string authors
 Authors - reference for the table.
bool compose_format
 Are(is) the table(s) in CompOSE format?
double nbmin
 Lower boundary of the baryon density interval.
double nbmax
 Upper boundary of the baryon density interval.
Tbllognb
 Table of $\log n_b$.
Tblloge
 Table of $\log e$.
Tbldlesdlnb
 Table of $d\log e/d\log n_b$.
Tblc_sound
 Table of $c_s = c \sqrt{d p / d e}$.
string name
 EOS name.

Private Member Functions

 Dyn_eos_tab (const Dyn_eos_tab &)
 Copy constructor (private to make Dyn_eos_tab a non-copiable class).

Friends

Dyn_eosDyn_eos::eos_from_file (FILE *)
 The construction functions from a file.
Dyn_eosDyn_eos::eos_from_file (ifstream &)
ostream & operator<< (ostream &, const Dyn_eos &)
 Display.

Detailed Description

Class for tabulated equations of state for use in dynamical code.

()

Data are to be stored in a formatted file either in the standard LORENE format, or taken from the CompOSE database. Standard format : the first five lines are comments, preceded by hashes. Then is given the number of data lines. After, three other lines of comments, data are given in four columns. The first one is just a number, not used by LORENE. Second is the baryon number density in ${\rm fm}^{-3}$, then is the total energy density (including rest mass) and pressure, both in cgs units. Here is an example from the file eos_fps.d:

#  Date: Tue, 21 Nov 2000 17:24:31 +0100
#  From: xxx
#  FPS e.o.s.:   BPS below n.drip, then FPS. Supplied by N.Stergioulas
#  (June 1998) crust bottom at n=0.0957 , rho=1.60E14 1.E50,1.60E14
#
129  <-- Number of lines
#
#            n_B [fm^{-3}]       rho [g/cm^3]        p [dyn/cm^2]
#  
   6     0.2722041559E-13    0.4518590000E+02    0.1701030000E+15
   7     0.1279071657E-12    0.2123260000E+03    0.5817150000E+16  

CompOSE data: use the files XXX.nb and XXX.thermo taken from the database. When built with Dyn_eos::eos_from_file(), the file must be composed of the following lines:

17	Type of the EOS 
1	0: standard format	1: CompOSE format 
Tabulated EoS
/full/path/to/the/eos/table/name_of_the_table 

On the second line '0' means that the table has the standard LORENE format for tabulated EoSs. Note that tables must be ordered from lowest densities up and that units used in the table file are not those of LORENE. The interpolation through the tables is a cubic Hermite interpolation, which is thermodynamically consistent, i.e. preserves the Gibbs-Duhem relation. It is defined in [Nozawa, Stergioulas, Gourgoulhon & Eriguchi, Astron. Astrophys. Suppl. Ser. 132 , 431 (1998)], and derives from a general technique presented in [Swesty, J. Comp. Phys. 127 , 118 (1996)].

Definition at line 637 of file dyneos.h.


Constructor & Destructor Documentation

Lorene::Dyn_eos_tab::Dyn_eos_tab ( const string &  name_i,
const string &  table_name,
bool  compose = true 
)

Standard constructor.

Parameters:
name_i Name of the EoS
table_name Name of the file containing the table (case compose = false), or the prefix i.e. without the .nb or .thermo of the two files (case compose = true)
compose Are the file(s) in CompOSE format?

Definition at line 66 of file dyneos_tab.C.

References compose_format, read_table_compose(), and read_table_lorene().

Lorene::Dyn_eos_tab::Dyn_eos_tab (  )  [protected]

Default constructor to be called by derived classes.

Definition at line 79 of file dyneos_tab.C.

Lorene::Dyn_eos_tab::Dyn_eos_tab ( FILE *  fich  )  [protected]

Constructor from a binary file (created by the function sauve(FILE*) ).

This constructor is protected because any EOS construction from a binary file must be done via the function Dyn_eos::eos_from_file(FILE*) .

Definition at line 85 of file dyneos_tab.C.

References compose_format, Lorene::fread_be(), read_table_compose(), read_table_lorene(), and tablename.

Lorene::Dyn_eos_tab::Dyn_eos_tab ( ifstream &  ist  )  [protected]

Constructor from a formatted file.

This constructor is protected because any EOS construction from a formatted file must be done via the function Dyn_eos::eos_from_file(ifstream& ) .

Parameters:
ist input file stream containing a name as first line and the full filename (including the path) containing the EOS file as second line

Definition at line 106 of file dyneos_tab.C.

References compose_format, Lorene::Dyn_eos::name, read_table_compose(), read_table_lorene(), and tablename.

Lorene::Dyn_eos_tab::Dyn_eos_tab ( const Dyn_eos_tab  )  [private]

Copy constructor (private to make Dyn_eos_tab a non-copiable class).

Lorene::Dyn_eos_tab::~Dyn_eos_tab (  )  [virtual]

Destructor.

Definition at line 126 of file dyneos_tab.C.

References c_sound, dlesdlnb, loge, and lognb.


Member Function Documentation

void Lorene::Dyn_eos::calcule ( const Scalar thermo,
int  nzet,
int  l_min,
double(Dyn_eos::*)(double, const Param *) const   fait,
Param par,
Scalar resu 
) const [protected, inherited]

General computational method for Scalar 's.

Parameters:
thermo [input] thermodynamical quantity (for instance the density field) from which the thermodynamical quantity resu is to be computed.
nzet [input] number of domains where resu is to be computed.
l_min [input] index of the innermost domain is which resu is to be computed [default value: 0]; resu is computed only in domains whose indices are in [l_min,l_min+nzet-1] . In the other domains, it is set to zero.
fait [input] pointer on the member function of class Dyn_eos which performs the pointwise calculation.
par possible extra parameters of the EOS
resu [output] result of the computation.

Definition at line 129 of file dyneos.C.

References Lorene::Scalar::annule(), Lorene::Valeur::c, Lorene::Valeur::coef_i(), Lorene::Tbl::get_etat(), Lorene::Scalar::get_etat(), Lorene::Tensor::get_mp(), Lorene::Mg3d::get_nzone(), Lorene::Scalar::get_spectral_va(), Lorene::Tbl::get_taille(), Lorene::Valeur::set_etat_c_qcq(), Lorene::Tbl::set_etat_qcq(), Lorene::Mtbl::set_etat_qcq(), Lorene::Scalar::set_etat_qcq(), Lorene::Tbl::set_etat_zero(), Lorene::Scalar::set_etat_zero(), Lorene::Scalar::set_spectral_va(), Lorene::Tbl::t, and Lorene::Mtbl::t.

Scalar Lorene::Dyn_eos::csound_nbar ( const Scalar nbar,
int  nzet,
int  l_min = 0,
Param par = 0x0 
) const [inherited]

Computes the sound speed $ c_s = c \sqrt{d p / d e}$ from the baryon density with extra parameters.

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
nzet number of domains where the derivative dln(e)/dln(H) is to be computed.
l_min index of the innermost domain is which the coefficient dln(n)/dln(H) is to be computed [default value: 0]; the derivative dln(e)/dln(H) is computed only in domains whose indices are in [l_min,l_min+nzet-1] . In the other domains, it is set to zero.
par possible extra parameters of the EOS
Returns:
$c_s $ [unit: c]

Definition at line 233 of file dyneos.C.

References Lorene::Dyn_eos::calcule(), Lorene::Dyn_eos::csound_nbar_p(), and Lorene::Tensor::get_mp().

double Lorene::Dyn_eos_tab::csound_nbar_p ( double  nbar,
const Param par = 0x0 
) const [virtual]

Computes the sound speed $ c_s = c \sqrt{d p / d e}$ from the baryon density with extra parameters (virtual function implemented in the derived classes).

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
par possible extra parameters of the EOS
Returns:
$c_s $ [unit: c]

Implements Lorene::Dyn_eos.

Definition at line 460 of file dyneos_tab.C.

References c_sound, Lorene::Tbl::get_taille(), Lorene::log10(), lognb, nbmax, and nbmin.

Scalar Lorene::Dyn_eos::ener_nbar ( const Scalar nbar,
int  nzet,
int  l_min = 0,
Param par = 0x0 
) const [inherited]

Computes the total energy density from the baryon density and extra parameters.

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
nzet number of domains where the energy density is to be computed.
l_min index of the innermost domain is which the energy density is to be computed [default value: 0]; the energy density is computed only in domains whose indices are in [l_min,l_min+nzet-1] . In the other domains, it is set to zero.
par possible extra parameters of the EOS
Returns:
energy density [unit: $\rho_{\rm nuc} c^2$], where $\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3$

Definition at line 209 of file dyneos.C.

References Lorene::Dyn_eos::calcule(), Lorene::Dyn_eos::ener_nbar_p(), and Lorene::Tensor::get_mp().

double Lorene::Dyn_eos_tab::ener_nbar_p ( double  nbar,
const Param par = 0x0 
) const [virtual]

Computes the total energy density from the baryon density and extra parameters (virtual function implemented in the derived classes).

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
par possible extra parameters of the EOS
Returns:
energy density e [unit: $\rho_{\rm nuc} c^2$], where $\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3$

Implements Lorene::Dyn_eos.

Definition at line 410 of file dyneos_tab.C.

References dlesdlnb, Lorene::Tbl::get_taille(), Lorene::log10(), loge, lognb, nbmax, nbmin, and Lorene::pow().

Scalar Lorene::Dyn_eos::ent_nbar ( const Scalar nbar,
int  nzet,
int  l_min = 0,
Param par = 0x0 
) const [inherited]

Computes the log-enthalpy field from the baryon density field and extra parameters.

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
nzet number of domains where the baryon density is to be computed.
l_min index of the innermost domain is which the baryon density is to be computed [default value: 0]; the baryon density is computed only in domains whose indices are in [l_min,l_min+nzet-1] . In the other domains, it is set to zero.
par possible extra parameters of the EOS
Returns:
ent log-enthalpy H defined by $H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) $, where e is the (total) energy density, p the pressure, n the baryon density, and $m_B$ the baryon mass.

Definition at line 196 of file dyneos.C.

References Lorene::Dyn_eos::calcule(), Lorene::Dyn_eos::ent_nbar_p(), and Lorene::Tensor::get_mp().

double Lorene::Dyn_eos_tab::ent_nbar_p ( double  nbar,
const Param par = 0x0 
) const [virtual]

Computes the log-enthalpy from the baryon density and extra parameters (virtual function implemented in the derived classes).

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
par possible extra parameters of the EOS
Returns:
ent log-enthalpy H defined by $H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) $, where e is the (total) energy density, p the pressure, n the baryon density, and $m_B$ the baryon mass.

Implements Lorene::Dyn_eos.

Definition at line 385 of file dyneos_tab.C.

References dlesdlnb, Lorene::Tbl::get_taille(), Lorene::log(), Lorene::log10(), loge, lognb, nbmax, nbmin, and Lorene::pow().

Dyn_eos * Lorene::Dyn_eos::eos_from_file ( ifstream &  fich  )  [static, inherited]

Construction of an EOS from a formatted file.

The fist line of the file must start by the EOS number, according to the following conventions (same as fo the classes Eos ):

  • 1 = relativistic polytropic EOS (class Dyn_eos_poly ).
  • 2 = Newtonian polytropic EOS (class Dyn_eos_poly_newt ).
  • 17 = Tabulated EOS (class Dyn_eos_tab ).
  • 20 = Consistent EOS from table (class Dyn_eos_cons ).

The second line in the file should contain a name given by the user to the EOS. The following lines should contain the EOS parameters (one parameter per line), in the same order than in the class declaration.

Definition at line 295 of file dyneos.C.

Dyn_eos * Lorene::Dyn_eos::eos_from_file ( FILE *  fich  )  [static, inherited]

Construction of an EOS from a binary file.

The file must have been created by the function sauve(FILE*) .

Definition at line 256 of file dyneos.C.

References Lorene::fread_be().

const string & Lorene::Dyn_eos::get_name (  )  const [inherited]

Returns the EOS name.

Definition at line 103 of file dyneos.C.

References Lorene::Dyn_eos::name.

int Lorene::Dyn_eos_tab::identify (  )  const [virtual]

Returns a number to identify the sub-classe of Dyn_eos the object belongs to.

Implements Lorene::Dyn_eos.

Reimplemented in Lorene::Dyn_eos_cons.

Definition at line 248 of file dyneos.C.

virtual bool Lorene::Dyn_eos::operator!= ( const Dyn_eos  )  const [pure virtual, inherited]

Comparison operator (difference).

bool Lorene::Dyn_eos_tab::operator!= ( const Dyn_eos eos_i  )  const [virtual]

Comparison operator (difference).

Reimplemented in Lorene::Dyn_eos_cons.

Definition at line 152 of file dyneos_tab.C.

References operator==().

virtual bool Lorene::Dyn_eos::operator== ( const Dyn_eos  )  const [pure virtual, inherited]

Comparison operator (egality).

bool Lorene::Dyn_eos_tab::operator== ( const Dyn_eos eos_i  )  const [virtual]

Comparison operator (egality).

Reimplemented in Lorene::Dyn_eos_cons.

Definition at line 139 of file dyneos_tab.C.

References identify(), and Lorene::Dyn_eos::identify().

ostream & Lorene::Dyn_eos_tab::operator>> ( ostream &  ost  )  const [protected, virtual]

Operator >>.

Implements Lorene::Dyn_eos.

Reimplemented in Lorene::Dyn_eos_cons.

Definition at line 173 of file dyneos_tab.C.

References authors, compose_format, Lorene::Tbl::get_taille(), lognb, and tablename.

Scalar Lorene::Dyn_eos::press_nbar ( const Scalar nbar,
int  nzet,
int  l_min = 0,
Param par = 0x0 
) const [inherited]

Computes the pressure from the baryon density and extra parameters.

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
nzet number of domains where the pressure is to be computed.
l_min index of the innermost domain is which the pressure is to be computed [default value: 0]; the pressure is computed only in domains whose indices are in [l_min,l_min+nzet-1] . In the other domains, it is set to zero.
par possible extra parameters of the EOS
Returns:
pressure [unit: $\rho_{\rm nuc} c^2$], where $\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3$

Definition at line 221 of file dyneos.C.

References Lorene::Dyn_eos::calcule(), Lorene::Tensor::get_mp(), and Lorene::Dyn_eos::press_nbar_p().

double Lorene::Dyn_eos_tab::press_nbar_p ( double  nbar,
const Param par = 0x0 
) const [virtual]

Computes the pressure from the baryon density and extra parameters (virtual function implemented in the derived classes).

Parameters:
nbar [input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
par possible extra parameters of the EOS
Returns:
pressure p [unit: $\rho_{\rm nuc} c^2$], where $\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3$

Implements Lorene::Dyn_eos.

Definition at line 433 of file dyneos_tab.C.

References dlesdlnb, Lorene::Tbl::get_taille(), Lorene::log10(), loge, lognb, nbmax, nbmin, and Lorene::pow().

void Lorene::Dyn_eos_tab::read_table_compose (  )  [protected, virtual]

Reads the files .nb and .thermo containing the table in CompOSE format and initializes the arrays lognb , loge and dlesdlnb .

Reimplemented in Lorene::Dyn_eos_cons.

Definition at line 280 of file dyneos_tab.C.

References c_sound, dlesdlnb, Lorene::log10(), loge, lognb, nbmax, nbmin, Lorene::pow(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), Lorene::sqrt(), and tablename.

void Lorene::Dyn_eos_tab::read_table_lorene (  )  [protected, virtual]

Reads the file containing the table in LORENE format and initializes the arrays lognb , loge and dlesdlnb .

Reimplemented in Lorene::Dyn_eos_cons.

Definition at line 188 of file dyneos_tab.C.

References authors, c_sound, dlesdlnb, Lorene::log10(), loge, lognb, nbmax, nbmin, Lorene::pow(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), Lorene::sqrt(), and tablename.

void Lorene::Dyn_eos_tab::sauve ( FILE *  fich  )  const [virtual]

Save in a file.

Reimplemented from Lorene::Dyn_eos.

Definition at line 162 of file dyneos_tab.C.

References compose_format, Lorene::fwrite_be(), and tablename.

void Lorene::Dyn_eos::set_name ( const string &  name_i  )  [inherited]

Sets the EOS name.

Definition at line 98 of file dyneos.C.

References Lorene::Dyn_eos::name.


Friends And Related Function Documentation

Dyn_eos* Dyn_eos::eos_from_file ( FILE *   )  [friend]

The construction functions from a file.

Reimplemented in Lorene::Dyn_eos_cons.

ostream& operator<< ( ostream &  ,
const Dyn_eos  
) [friend, inherited]

Display.


Member Data Documentation

string Lorene::Dyn_eos_tab::authors [protected]

Authors - reference for the table.

Definition at line 646 of file dyneos.h.

Table of $c_s = c \sqrt{d p / d e}$.

Definition at line 666 of file dyneos.h.

Are(is) the table(s) in CompOSE format?

Definition at line 648 of file dyneos.h.

Table of $d\log e/d\log n_b$.

Definition at line 663 of file dyneos.h.

Table of $\log e$.

Definition at line 660 of file dyneos.h.

Table of $\log n_b$.

Definition at line 657 of file dyneos.h.

string Lorene::Dyn_eos::name [protected, inherited]

EOS name.

Definition at line 74 of file dyneos.h.

double Lorene::Dyn_eos_tab::nbmax [protected]

Upper boundary of the baryon density interval.

Definition at line 654 of file dyneos.h.

double Lorene::Dyn_eos_tab::nbmin [protected]

Lower boundary of the baryon density interval.

Definition at line 651 of file dyneos.h.

string Lorene::Dyn_eos_tab::tablename [protected]

Name of the file containing the tabulated data.

Definition at line 644 of file dyneos.h.


The documentation for this class was generated from the following files:

Generated on 7 Dec 2019 for LORENE by  doxygen 1.6.1