LORENE
Lorene::Dyn_eos_cons Class Reference

Equation of state for the CompOSE database with a consistent computation of the baryon density. More...

#include <dyneos.h>

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

Public Member Functions

 Dyn_eos_cons (const string &name_i, const string &table_name, bool compose=true)
 Standard constructor. More...
 
virtual ~Dyn_eos_cons ()
 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 $ c_s^2 = c^2 \frac{dp}{de}$ 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 $ c_s^2 = c^2 \frac{dp}{de}$ from the baryon density with extra parameters. More...
 

Static Public Member Functions

static Dyn_eosconvert_from_Eos (const Eos &)
 Conversion operator from Eos to Dyn_eos. More...
 
static Dyn_eoseos_from_file (FILE *)
 Construction of an EOS from a binary file. More...
 
static Dyn_eoseos_from_file (ifstream &)
 Construction of an EOS from a formatted file. More...
 

Protected Member Functions

 Dyn_eos_cons (FILE *)
 Constructor from a binary file (created by the function sauve(FILE*) ). More...
 
 Dyn_eos_cons (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...
 
Tbllognb
 Table of $\log n_b$. More...
 
Tblloge
 Table of $\log e$. More...
 
Tbldlesdlnb
 Table of $d\log e/d\log n_b$. More...
 
Tblc_sound2
 Table of $c_s^2 = c^2 \frac{d p}{d e}$. More...
 
string name
 EOS name. More...
 

Private Member Functions

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

Friends

Dyn_eosDyn_eos::eos_from_file (FILE *)
 The construction functions from a file. More...
 
Dyn_eosDyn_eos::eos_from_file (ifstream &)
 

Detailed Description

Equation of state for the CompOSE database with a consistent computation of the baryon density.

(derived from Dyn_eos_tab ).

General tabulated EOS, reading a table passed as an argument to the constructor. The baryon density $n_B$ is computed to ensure the relation $ de/dn = h $, thus eventually modifying the table. See documentation of the class Dyn_eos_tab for details of the table format.

Definition at line 839 of file dyneos.h.

Constructor & Destructor Documentation

◆ Dyn_eos_cons() [1/4]

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

Standard constructor.

Parameters
name_iName of the EoS
table_nameName 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)
composeAre the file(s) in CompOSE format?

Definition at line 65 of file dyneos_cons.C.

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

◆ Dyn_eos_cons() [2/4]

Lorene::Dyn_eos_cons::Dyn_eos_cons ( 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 79 of file dyneos_cons.C.

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

◆ Dyn_eos_cons() [3/4]

Lorene::Dyn_eos_cons::Dyn_eos_cons ( 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
istinput 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 104 of file dyneos_cons.C.

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

◆ Dyn_eos_cons() [4/4]

Lorene::Dyn_eos_cons::Dyn_eos_cons ( const Dyn_eos_cons )
private

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

◆ ~Dyn_eos_cons()

Lorene::Dyn_eos_cons::~Dyn_eos_cons ( )
virtual

Destructor.

Definition at line 123 of file dyneos_cons.C.

Member Function Documentation

◆ calcule()

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
protectedinherited

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.
parpossible extra parameters of the EOS
resu[output] result of the computation.

Definition at line 196 of file dyneos.C.

References Lorene::Scalar::get_etat().

◆ convert_from_Eos()

Dyn_eos * Lorene::Dyn_eos::convert_from_Eos ( const Eos eos_in)
staticinherited

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().

◆ csound_square_nbar()

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

Computes the sound speed squared $ c_s^2 = c^2 \frac{dp}{de}$ from the baryon density with extra parameters.

Parameters
nbar[input, unit: $n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}$] baryon density
nzetnumber of domains where the derivative dln(e)/dln(H) is to be computed.
l_minindex 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.
parpossible extra parameters of the EOS
Returns
$c_s^2 $ [unit: c^2]

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().

◆ csound_square_nbar_p()

double Lorene::Dyn_eos_tab::csound_square_nbar_p ( double  nbar,
const Param par = 0x0 
) const
virtualinherited

Computes the sound speed squared $ c_s^2 = c^2 \frac{dp}{de}$ from the baryon density with extra parameters.

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

Implements Lorene::Dyn_eos.

Definition at line 474 of file dyneos_tab.C.

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

◆ ener_nbar()

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
nzetnumber of domains where the energy density is to be computed.
l_minindex 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.
parpossible 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 276 of file dyneos.C.

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

◆ ener_nbar_p()

double Lorene::Dyn_eos_tab::ener_nbar_p ( double  nbar,
const Param par = 0x0 
) const
virtualinherited

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
parpossible 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 424 of file dyneos_tab.C.

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

◆ ent_nbar()

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
nzetnumber of domains where the baryon density is to be computed.
l_minindex 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.
parpossible 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 263 of file dyneos.C.

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

◆ ent_nbar_p()

double Lorene::Dyn_eos_tab::ent_nbar_p ( double  nbar,
const Param par = 0x0 
) const
virtualinherited

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
parpossible 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 399 of file dyneos_tab.C.

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

◆ eos_from_file() [1/2]

Dyn_eos * Lorene::Dyn_eos::eos_from_file ( FILE *  fich)
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().

◆ eos_from_file() [2/2]

Dyn_eos * Lorene::Dyn_eos::eos_from_file ( ifstream &  fich)
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 ):

  • 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 362 of file dyneos.C.

◆ get_name()

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

Returns the EOS name.

Definition at line 110 of file dyneos.C.

References Lorene::Dyn_eos::name.

◆ identify()

int Lorene::Dyn_eos_cons::identify ( ) const
virtual

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

Reimplemented from Lorene::Dyn_eos_tab.

Definition at line 317 of file dyneos.C.

◆ operator!=()

bool Lorene::Dyn_eos_cons::operator!= ( const Dyn_eos eos_i) const
virtual

Comparison operator (difference)

Reimplemented from Lorene::Dyn_eos_tab.

Definition at line 145 of file dyneos_cons.C.

References operator==().

◆ operator==()

bool Lorene::Dyn_eos_cons::operator== ( const Dyn_eos eos_i) const
virtual

Comparison operator (egality)

Reimplemented from Lorene::Dyn_eos_tab.

Definition at line 132 of file dyneos_cons.C.

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

◆ operator>>()

ostream & Lorene::Dyn_eos_cons::operator>> ( ostream &  ost) const
protectedvirtual

◆ press_nbar()

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
nzetnumber of domains where the pressure is to be computed.
l_minindex 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.
parpossible 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 288 of file dyneos.C.

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

◆ press_nbar_p()

double Lorene::Dyn_eos_tab::press_nbar_p ( double  nbar,
const Param par = 0x0 
) const
virtualinherited

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
parpossible 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 447 of file dyneos_tab.C.

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

◆ read_table_compose()

void Lorene::Dyn_eos_cons::read_table_compose ( )
protectedvirtual

◆ read_table_lorene()

◆ sauve()

void Lorene::Dyn_eos_tab::sauve ( FILE *  fich) const
virtualinherited

◆ set_name()

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

Sets the EOS name.

Definition at line 105 of file dyneos.C.

References Lorene::Dyn_eos::name.

Friends And Related Function Documentation

◆ Dyn_eos::eos_from_file

Dyn_eos* Dyn_eos::eos_from_file ( FILE *  )
friend

The construction functions from a file.

Member Data Documentation

◆ authors

string Lorene::Dyn_eos_tab::authors
protectedinherited

Authors - reference for the table.

Definition at line 657 of file dyneos.h.

◆ c_sound2

Tbl* Lorene::Dyn_eos_tab::c_sound2
protectedinherited

Table of $c_s^2 = c^2 \frac{d p}{d e}$.

Definition at line 677 of file dyneos.h.

◆ compose_format

bool Lorene::Dyn_eos_tab::compose_format
protectedinherited

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

Definition at line 659 of file dyneos.h.

◆ dlesdlnb

Tbl* Lorene::Dyn_eos_tab::dlesdlnb
protectedinherited

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

Definition at line 674 of file dyneos.h.

◆ loge

Tbl* Lorene::Dyn_eos_tab::loge
protectedinherited

Table of $\log e$.

Definition at line 671 of file dyneos.h.

◆ lognb

Tbl* Lorene::Dyn_eos_tab::lognb
protectedinherited

Table of $\log n_b$.

Definition at line 668 of file dyneos.h.

◆ name

string Lorene::Dyn_eos::name
protectedinherited

EOS name.

Definition at line 81 of file dyneos.h.

◆ nbmax

double Lorene::Dyn_eos_tab::nbmax
protectedinherited

Upper boundary of the baryon density interval.

Definition at line 665 of file dyneos.h.

◆ nbmin

double Lorene::Dyn_eos_tab::nbmin
protectedinherited

Lower boundary of the baryon density interval.

Definition at line 662 of file dyneos.h.

◆ tablename

string Lorene::Dyn_eos_tab::tablename
protectedinherited

Name of the file containing the tabulated data.

Definition at line 655 of file dyneos.h.


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