LORENE
|
Class for tabulated equations of state for use in dynamical code.
More...
#include <dyneos.h>
Public Member Functions | |
Dyn_eos_tab (const string &name_i, const string &table_name, bool compose=true) | |
Standard constructor. More... | |
virtual | ~Dyn_eos_tab () |
Destructor. More... | |
virtual bool | operator== (const Dyn_eos &) const |
Comparison operator (egality) More... | |
virtual bool | operator!= (const Dyn_eos &) const |
Comparison operator (difference) More... | |
virtual int | identify () const |
Returns a number to identify the sub-classe of Dyn_eos the object belongs to. More... | |
virtual void | sauve (FILE *) const |
Save in a file. More... | |
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). More... | |
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). More... | |
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). More... | |
virtual double | csound_square_nbar_p (double nbar, const Param *par=0x0) const |
Computes the sound speed squared from the baryon density with extra parameters. More... | |
const string & | get_name () const |
Returns the EOS name. More... | |
void | set_name (const string &) |
Sets the EOS name. More... | |
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. More... | |
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. More... | |
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. More... | |
Scalar | csound_square_nbar (const Scalar &nbar, int nzet, int l_min=0, Param *par=0x0) const |
Computes the sound speed squared from the baryon density with extra parameters. More... | |
Static Public Member Functions | |
static Dyn_eos * | convert_from_Eos (const Eos &) |
Conversion operator from Eos to Dyn_eos . More... | |
static Dyn_eos * | eos_from_file (FILE *) |
Construction of an EOS from a binary file. More... | |
static Dyn_eos * | eos_from_file (ifstream &) |
Construction of an EOS from a formatted file. More... | |
Protected Member Functions | |
Dyn_eos_tab () | |
Default constructor to be called by derived classes. More... | |
Dyn_eos_tab (FILE *) | |
Constructor from a binary file (created by the function sauve(FILE*) ). More... | |
Dyn_eos_tab (ifstream &ist) | |
Constructor from a formatted file. More... | |
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 . More... | |
virtual void | read_table_lorene () |
Reads the file containing the table in LORENE format and initializes the arrays lognb , loge and dlesdlnb . More... | |
virtual ostream & | operator>> (ostream &) const |
Operator >> More... | |
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. More... | |
Protected Attributes | |
string | tablename |
Name of the file containing the tabulated data. More... | |
string | authors |
Authors - reference for the table. More... | |
bool | compose_format |
Are(is) the table(s) in CompOSE format? More... | |
double | nbmin |
Lower boundary of the baryon density interval. More... | |
double | nbmax |
Upper boundary of the baryon density interval. More... | |
Tbl * | lognb |
Table of . More... | |
Tbl * | loge |
Table of . More... | |
Tbl * | dlesdlnb |
Table of . More... | |
Tbl * | c_sound2 |
Table of . More... | |
string | name |
EOS name. More... | |
Private Member Functions | |
Dyn_eos_tab (const Dyn_eos_tab &) | |
Copy constructor (private to make Dyn_eos_tab a non-copiable class) More... | |
Friends | |
Dyn_eos * | Dyn_eos::eos_from_file (FILE *) |
The construction functions from a file. More... | |
Dyn_eos * | Dyn_eos::eos_from_file (ifstream &) |
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 , 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)].
Lorene::Dyn_eos_tab::Dyn_eos_tab | ( | const string & | name_i, |
const string & | table_name, | ||
bool | compose = true |
||
) |
Standard constructor.
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 74 of file dyneos_tab.C.
References compose_format, read_table_compose(), and read_table_lorene().
|
protected |
Default constructor to be called by derived classes.
Definition at line 87 of file dyneos_tab.C.
|
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 93 of file dyneos_tab.C.
References compose_format, Lorene::fread_be(), read_table_compose(), read_table_lorene(), and tablename.
|
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& ) .
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 120 of file dyneos_tab.C.
References compose_format, Lorene::Dyn_eos::name, read_table_compose(), read_table_lorene(), and tablename.
|
private |
Copy constructor (private to make Dyn_eos_tab
a non-copiable class)
|
virtual |
|
protectedinherited |
General computational method for Scalar
's.
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 196 of file dyneos.C.
References Lorene::Scalar::get_etat().
Conversion operator from Eos
to Dyn_eos
.
Works only for relativistic polytropes and tabulated EOSs.
Definition at line 120 of file dyneos.C.
References Lorene::Eos_poly::get_gam(), Lorene::Eos_poly::get_kap(), Lorene::Eos_poly::get_m_0(), Lorene::Eos_poly::get_mu_0(), Lorene::Eos::get_name(), and Lorene::Eos::identify().
|
inherited |
Computes the sound speed squared from the baryon density with extra parameters.
nbar | [input, unit: ] 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 |
Definition at line 300 of file dyneos.C.
References Lorene::Dyn_eos::calcule(), Lorene::Dyn_eos::csound_square_nbar_p(), and Lorene::Tensor::get_mp().
|
virtual |
Computes the sound speed squared from the baryon density with extra parameters.
nbar | [input, unit: ] baryon density |
par | possible extra parameters of the EOS |
Implements Lorene::Dyn_eos.
Definition at line 474 of file dyneos_tab.C.
References c_sound2, Lorene::Tbl::get_taille(), Lorene::log10(), lognb, nbmax, and nbmin.
|
inherited |
Computes the total energy density from the baryon density and extra parameters.
nbar | [input, unit: ] 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 |
Definition at line 276 of file dyneos.C.
References Lorene::Dyn_eos::calcule(), Lorene::Dyn_eos::ener_nbar_p(), and Lorene::Tensor::get_mp().
|
virtual |
Computes the total energy density from the baryon density and extra parameters (virtual function implemented in the derived classes).
nbar | [input, unit: ] baryon density |
par | possible extra parameters of the EOS |
Implements Lorene::Dyn_eos.
Definition at line 424 of file dyneos_tab.C.
References dlesdlnb, Lorene::Tbl::get_taille(), Lorene::log10(), loge, lognb, nbmax, nbmin, and Lorene::pow().
|
inherited |
Computes the log-enthalpy field from the baryon density field and extra parameters.
nbar | [input, unit: ] 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 |
Definition at line 263 of file dyneos.C.
References Lorene::Dyn_eos::calcule(), Lorene::Dyn_eos::ent_nbar_p(), and Lorene::Tensor::get_mp().
|
virtual |
Computes the log-enthalpy from the baryon density and extra parameters (virtual function implemented in the derived classes).
nbar | [input, unit: ] baryon density |
par | possible extra parameters of the EOS |
Implements Lorene::Dyn_eos.
Definition at line 399 of file dyneos_tab.C.
References dlesdlnb, Lorene::Tbl::get_taille(), Lorene::log(), Lorene::log10(), loge, lognb, nbmax, nbmin, and Lorene::pow().
|
staticinherited |
Construction of an EOS from a binary file.
The file must have been created by the function sauve(FILE*)
.
Definition at line 323 of file dyneos.C.
References Lorene::fread_be().
|
staticinherited |
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
):
Dyn_eos_poly
).Dyn_eos_poly_newt
).Dyn_eos_tab
).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.
|
inherited |
|
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.
|
virtual |
Comparison operator (difference)
Implements Lorene::Dyn_eos.
Reimplemented in Lorene::Dyn_eos_cons.
Definition at line 166 of file dyneos_tab.C.
References operator==().
|
virtual |
Comparison operator (egality)
Implements Lorene::Dyn_eos.
Reimplemented in Lorene::Dyn_eos_cons.
Definition at line 153 of file dyneos_tab.C.
References Lorene::Dyn_eos::identify(), and identify().
|
protectedvirtual |
Operator >>
Implements Lorene::Dyn_eos.
Reimplemented in Lorene::Dyn_eos_cons.
Definition at line 187 of file dyneos_tab.C.
References authors, compose_format, Lorene::Tbl::get_taille(), lognb, and tablename.
|
inherited |
Computes the pressure from the baryon density and extra parameters.
nbar | [input, unit: ] 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 |
Definition at line 288 of file dyneos.C.
References Lorene::Dyn_eos::calcule(), Lorene::Tensor::get_mp(), and Lorene::Dyn_eos::press_nbar_p().
|
virtual |
Computes the pressure from the baryon density and extra parameters (virtual function implemented in the derived classes).
nbar | [input, unit: ] baryon density |
par | possible extra parameters of the EOS |
Implements Lorene::Dyn_eos.
Definition at line 447 of file dyneos_tab.C.
References dlesdlnb, Lorene::Tbl::get_taille(), Lorene::log10(), loge, lognb, nbmax, nbmin, and Lorene::pow().
|
protectedvirtual |
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 294 of file dyneos_tab.C.
References c_sound2, Lorene::compute_derivative(), dlesdlnb, Lorene::log10(), loge, lognb, nbmax, nbmin, Lorene::pow(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and tablename.
|
protectedvirtual |
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 202 of file dyneos_tab.C.
References authors, c_sound2, Lorene::compute_derivative(), dlesdlnb, Lorene::log10(), loge, lognb, nbmax, nbmin, Lorene::pow(), Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and tablename.
|
virtual |
Save in a file.
Reimplemented from Lorene::Dyn_eos.
Definition at line 176 of file dyneos_tab.C.
References compose_format, Lorene::fwrite_be(), Lorene::Dyn_eos::sauve(), and tablename.
|
inherited |
|
friend |
The construction functions from a file.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |