hoteos.h
/*
* Definition of Lorene class Hot_eos.
*
*/
/*
* Copyright (c) 2015 Jerome Novak
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __HOTEOS_H_
#define __HOTEOS_H_
/*
* $Id: hoteos.h,v 1.3 2015/12/08 10:52:17 j_novak Exp $
* $Log: hoteos.h,v $
* Revision 1.3 2015/12/08 10:52:17 j_novak
* New class Hoteos_tabul for tabulated temperature-dependent EoSs.
*
* Revision 1.2 2015/09/10 13:28:00 j_novak
* New methods for the class Hot_Eos
*
* Revision 1.1 2015/03/17 14:19:59 j_novak
* New class Hot_eos to deal with temperature-dependent EOSs.
*
*
* $Header: /cvsroot/Lorene/C++/Include/hoteos.h,v 1.3 2015/12/08 10:52:17 j_novak Exp $
*
*/
//C++ headers
#include "headcpp.h"
//C headers
#include<cstdio>
#include "tbl.h"
namespace Lorene{
class Scalar ;
class Param ;
class Eos ;
//------------------------------------//
// class Hot_eos //
//------------------------------------//
class Hot_eos {
// Data :
// -----
protected:
string name ;
// Constructors - Destructor
// -------------------------
protected:
Hot_eos() ;
explicit Hot_eos(const string&) ;
explicit Hot_eos(const char*) ;
Hot_eos(const Hot_eos& ) ;
Hot_eos(FILE* ) ;
Hot_eos(ifstream& ) ;
public:
virtual ~Hot_eos() ;
// Derived data :
// ------------
protected:
mutable Eos* p_cold_eos ;
virtual void del_deriv() const ;
void set_der_0x0() const ;
// Name manipulation
// -----------------
public:
const string& get_name() const {return name; };
void set_name(const char* ) ;
// Miscellaneous
// -------------
public:
static Hot_eos* hoteos_from_file(FILE* ) ;
static Hot_eos* hoteos_from_file(ifstream& ) ;
virtual bool operator==(const Hot_eos& ) const = 0 ;
virtual bool operator!=(const Hot_eos& ) const = 0 ;
virtual int identify() const = 0 ;
// Outputs
// -------
public:
virtual void sauve(FILE* ) const ;
friend ostream& operator<<(ostream& , const Hot_eos& ) ;
protected:
virtual ostream& operator>>(ostream &) const = 0 ;
public:
virtual const Eos& new_cold_Eos() const = 0 ;
// Computational functions
// -----------------------
protected:
void calcule(const Scalar& thermo1, const Scalar& thermo2, int nzet, int l_min,
double (Hot_eos::*fait)(double, double) const, Scalar& resu) const ;
public:
virtual double nbar_Hs_p(double ent, double sb) const = 0 ;
Scalar nbar_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
virtual double ener_Hs_p(double ent, double sb) const = 0 ;
Scalar ener_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
virtual double press_Hs_p(double ent, double sb) const = 0 ;
Scalar press_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
virtual double temp_Hs_p(double ent, double sb) const = 0 ;
Scalar temp_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
};
ostream& operator<<(ostream& , const Hot_eos& ) ;
//------------------------------------//
// class Ideal_gas //
//------------------------------------//
class Ideal_gas : public Hot_eos {
// Data :
//-------
protected:
double gam ;
double kap ;
double m_0 ;
double gam1 ;
double unsgam1 ;
double gam1sgamkap ;
// Constructors - Destructor
// -------------------------
public:
Ideal_gas(double gamma, double kappa, double mass=1.) ;
Ideal_gas(const Ideal_gas& ) ;
protected:
Ideal_gas(FILE* ) ;
Ideal_gas(ifstream& ) ;
friend Hot_eos* Hot_eos::hoteos_from_file(FILE* ) ;
friend Hot_eos* Hot_eos::hoteos_from_file(ifstream& ) ;
public:
virtual ~Ideal_gas() ;
// Assignment
// ----------
void operator=(const Ideal_gas& ) ;
// Miscellaneous
// -------------
public :
virtual bool operator==(const Hot_eos& ) const ;
virtual bool operator!=(const Hot_eos& ) const ;
virtual int identify() const ;
double get_gam() const ;
double get_kap() const ;
double get_m_0() const ;
virtual const Eos& new_cold_Eos() const ;
protected:
void set_auxiliary() ;
// Outputs
// -------
public:
virtual void sauve(FILE* ) const ;
protected:
virtual ostream& operator>>(ostream &) const ;
// Computational functions
// -----------------------
public:
virtual double nbar_Hs_p(double ent, double sb) const ;
virtual double ener_Hs_p(double ent, double sb) const ;
virtual double press_Hs_p(double ent, double sb) const ;
virtual double temp_Hs_p(double ent, double sb) const ;
};
//------------------------------------//
// class Hoteos_tabul //
//------------------------------------//
class Hoteos_tabul : public Hot_eos {
// Data :
//-------
protected:
string tablename ;
string authors ;
double hmin ;
double hmax ;
double sbmin ;
double sbmax ;
Tbl* hhh ;
Tbl* s_B ;
Tbl* ppp ;
Tbl* dpdh ;
Tbl* dpds ;
Tbl* d2p ;
// Constructors - Destructor
// -------------------------
public:
Hoteos_tabul(const string& filename) ;
Hoteos_tabul(const Hoteos_tabul& ) ;
protected:
Hoteos_tabul(FILE* ) ;
Hoteos_tabul(ifstream& ) ;
friend Hot_eos* Hot_eos::hoteos_from_file(FILE* ) ;
friend Hot_eos* Hot_eos::hoteos_from_file(ifstream& ) ;
public:
virtual ~Hoteos_tabul() ;
void operator=(const Hoteos_tabul& ) ;
// Miscellaneous
// -------------
protected:
void read_table() ;
void set_arrays_0x0() ;
public :
virtual bool operator==(const Hot_eos& ) const ;
virtual bool operator!=(const Hot_eos& ) const ;
virtual int identify() const ;
virtual const Eos& new_cold_Eos() const ;
// Outputs
// -------
public:
virtual void sauve(FILE* ) const ;
protected:
virtual ostream& operator>>(ostream &) const ;
// Computational functions
// -----------------------
public:
virtual double nbar_Hs_p(double ent, double sb) const ;
virtual double ener_Hs_p(double ent, double sb) const ;
virtual double press_Hs_p(double ent, double sb) const ;
virtual double temp_Hs_p(double ent, double sb) const ;
};
}
#endif
Lorene::Eos
Equation of state base class.
Definition eos.h:190
Lorene::Hot_eos
Base class for temperature-dependent equations of state (abstract class).
Definition hoteos.h:67
Lorene::Hot_eos::get_name
const string & get_name() const
Returns the hot EOS name.
Definition hoteos.h:120
Lorene::Hot_eos::identify
virtual int identify() const =0
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
Lorene::Hot_eos::del_deriv
virtual void del_deriv() const
Deletes all the derived quantities.
Definition hoteos.C:109
Lorene::Hot_eos::nbar_Hs_p
virtual double nbar_Hs_p(double ent, double sb) const =0
Computes the baryon density from the log-enthalpy and entropy per baryon (virtual function implemente...
Lorene::Hot_eos::new_cold_Eos
virtual const Eos & new_cold_Eos() const =0
Returns the corresponding cold Eos.
Lorene::Hot_eos::calcule
void calcule(const Scalar &thermo1, const Scalar &thermo2, int nzet, int l_min, double(Hot_eos::*fait)(double, double) const, Scalar &resu) const
General computational method for Scalar 's.
Definition hoteos.C:153
Lorene::Hot_eos::ener_Hs_p
virtual double ener_Hs_p(double ent, double sb) const =0
Computes the total energy density from the log-enthalpy and entropy per baryon (virtual function impl...
Lorene::Hot_eos::p_cold_eos
Eos * p_cold_eos
Corresponding cold Eos.
Definition hoteos.h:108
Lorene::Hot_eos::temp_Hs_p
virtual double temp_Hs_p(double ent, double sb) const =0
Computes the temperature from the log-enthalpy and entropy per baryon (virtual function implemented i...
Lorene::Hot_eos::press_Hs
Scalar press_Hs(const Scalar &ent, const Scalar &sb, int nzet, int l_min=0) const
Computes the pressure from the log-enthalpy and entropy per baryon.
Definition hoteos.C:266
Lorene::Hot_eos::nbar_Hs
Scalar nbar_Hs(const Scalar &ent, const Scalar &sb, int nzet, int l_min=0) const
Computes the baryon density field from the log-enthalpy field and entropy per baryon.
Definition hoteos.C:236
Lorene::Hot_eos::Hot_eos
Hot_eos()
Standard constructor.
Definition hoteos.C:56
Lorene::Hot_eos::ener_Hs
Scalar ener_Hs(const Scalar &ent, const Scalar &sb, int nzet, int l_min=0) const
Computes the total energy density from the log-enthalpy and entropy per baryon.
Definition hoteos.C:252
Lorene::Hot_eos::hoteos_from_file
static Hot_eos * hoteos_from_file(FILE *)
Construction of an EOS from a binary file.
Definition hoteos_from_file.C:67
Lorene::Hot_eos::temp_Hs
Scalar temp_Hs(const Scalar &ent, const Scalar &sb, int nzet, int l_min=0) const
Computes the temperature field from the log-enthalpy field and entropy per baryon.
Definition hoteos.C:280
Lorene::Hot_eos::operator>>
virtual ostream & operator>>(ostream &) const =0
Operator >>.
Lorene::Hot_eos::set_der_0x0
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition hoteos.C:114
Lorene::Hot_eos::operator==
virtual bool operator==(const Hot_eos &) const =0
Comparison operator (egality).
Lorene::Hot_eos::press_Hs_p
virtual double press_Hs_p(double ent, double sb) const =0
Computes the pressure from the log-enthalpy and entropy per baryon (virtual function implemented in t...
Lorene::Hot_eos::~Hot_eos
virtual ~Hot_eos()
Destructor.
Definition hoteos.C:101
Lorene::Hot_eos::operator!=
virtual bool operator!=(const Hot_eos &) const =0
Comparison operator (difference).
Lorene::Hot_eos::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition hoteos.C:129
Lorene::Hot_eos::name
string name
EOS name.
Definition hoteos.h:72
Lorene::Hot_eos::operator<<
friend ostream & operator<<(ostream &, const Hot_eos &)
Display.
Definition hoteos.C:143
Lorene::Hot_eos::set_name
void set_name(const char *)
Sets the hot EOS name.
Definition hoteos.C:118
Lorene::Hoteos_tabul::hmin
double hmin
Lower boundary of the enthalpy interval.
Definition hoteos.h:561
Lorene::Hoteos_tabul::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition hoteos_tabul.C:127
Lorene::Hoteos_tabul::~Hoteos_tabul
virtual ~Hoteos_tabul()
Destructor.
Definition hoteos_tabul.C:114
Lorene::Hoteos_tabul::sbmax
double sbmax
Upper boundary of the entropy interval.
Definition hoteos.h:570
Lorene::Hoteos_tabul::nbar_Hs_p
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...
Definition hoteos_tabul.C:294
Lorene::Hoteos_tabul::Hoteos_tabul
Hoteos_tabul(const string &filename)
Standard constructor from a filename.
Definition hoteos_tabul.C:70
Lorene::Hoteos_tabul::operator!=
virtual bool operator!=(const Hot_eos &) const
Comparison operator (difference).
Definition hoteos_tabul.C:282
Lorene::Hoteos_tabul::hhh
Tbl * hhh
Table of .
Definition hoteos.h:573
Lorene::Hoteos_tabul::d2p
Tbl * d2p
Table of .
Definition hoteos.h:588
Lorene::Hoteos_tabul::set_arrays_0x0
void set_arrays_0x0()
Sets all the arrays to the null pointer.
Definition hoteos_tabul.C:101
Lorene::Hoteos_tabul::operator=
void operator=(const Hoteos_tabul &)
Assignment to another Hoteos_tabul.
Lorene::Hoteos_tabul::operator>>
virtual ostream & operator>>(ostream &) const
Operator >>.
Definition hoteos_tabul.C:136
Lorene::Hoteos_tabul::operator==
virtual bool operator==(const Hot_eos &) const
Comparison operator (egality).
Definition hoteos_tabul.C:269
Lorene::Hoteos_tabul::press_Hs_p
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...
Definition hoteos_tabul.C:369
Lorene::Hoteos_tabul::hmax
double hmax
Upper boundary of the enthalpy interval.
Definition hoteos.h:564
Lorene::Hoteos_tabul::new_cold_Eos
virtual const Eos & new_cold_Eos() const
Returns the corresponding cold Eos.
Definition hoteos_tabul.C:252
Lorene::Hoteos_tabul::tablename
string tablename
Name of the file containing the tabulated data.
Definition hoteos.h:556
Lorene::Hoteos_tabul::ener_Hs_p
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...
Definition hoteos_tabul.C:330
Lorene::Hoteos_tabul::dpdh
Tbl * dpdh
Table of .
Definition hoteos.h:582
Lorene::Hoteos_tabul::temp_Hs_p
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...
Definition hoteos_tabul.C:403
Lorene::Hoteos_tabul::Hoteos_tabul
Hoteos_tabul(const Hoteos_tabul &)
Copy constructor.
Lorene::Hoteos_tabul::identify
virtual int identify() const
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
Definition hoteos_from_file.C:60
Lorene::Hoteos_tabul::dpds
Tbl * dpds
Table of .
Definition hoteos.h:585
Lorene::Hoteos_tabul::authors
string authors
Authors - reference for the table.
Definition hoteos.h:558
Lorene::Hoteos_tabul::s_B
Tbl * s_B
Table of , entropy per baryon (in units of Boltzmann constant).
Definition hoteos.h:576
Lorene::Hoteos_tabul::read_table
void read_table()
Reads the file containing the table and initializes in the arrays hhh , s_B, ppp, ....
Definition hoteos_tabul.C:153
Lorene::Hoteos_tabul::ppp
Tbl * ppp
Table of pressure $P$.
Definition hoteos.h:579
Lorene::Hoteos_tabul::sbmin
double sbmin
Lower boundary of the entropy interval.
Definition hoteos.h:567
Lorene::Ideal_gas::set_auxiliary
void set_auxiliary()
Computes the auxiliary quantities gam1 , unsgam1 , gam1sgamkap from the values of gam and kap.
Definition ideal_gas.C:133
Lorene::Ideal_gas::get_m_0
double get_m_0() const
Return the individual particule mass (cf.
Definition ideal_gas.C:151
Lorene::Ideal_gas::nbar_Hs_p
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...
Definition ideal_gas.C:250
Lorene::Ideal_gas::Ideal_gas
Ideal_gas(double gamma, double kappa, double mass=1.)
Standard constructor.
Definition ideal_gas.C:64
Lorene::Ideal_gas::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition ideal_gas.C:221
Lorene::Ideal_gas::get_kap
double get_kap() const
Returns the pressure coefficient (cf. Eq. (1)).
Definition ideal_gas.C:147
Lorene::Ideal_gas::m_0
double m_0
Individual particule mass (cf.
Definition hoteos.h:381
Lorene::Ideal_gas::operator==
virtual bool operator==(const Hot_eos &) const
Comparison operator (egality).
Definition ideal_gas.C:175
Lorene::Ideal_gas::gam1sgamkap
double gam1sgamkap
Definition hoteos.h:385
Lorene::Ideal_gas::press_Hs_p
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...
Definition ideal_gas.C:279
Lorene::Ideal_gas::get_gam
double get_gam() const
Returns the adiabatic index (cf. Eq. (1)).
Definition ideal_gas.C:143
Lorene::Ideal_gas::operator>>
virtual ostream & operator>>(ostream &) const
Operator >>.
Definition ideal_gas.C:231
Lorene::Ideal_gas::operator!=
virtual bool operator!=(const Hot_eos &) const
Comparison operator (difference).
Definition ideal_gas.C:212
Lorene::Ideal_gas::~Ideal_gas
virtual ~Ideal_gas()
Destructor.
Definition ideal_gas.C:110
Lorene::Ideal_gas::ener_Hs_p
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...
Definition ideal_gas.C:263
Lorene::Ideal_gas::temp_Hs_p
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...
Definition ideal_gas.C:294
Lorene::Ideal_gas::new_cold_Eos
virtual const Eos & new_cold_Eos() const
Returns the corresponding cold Eos.
Definition ideal_gas.C:160
Lorene::Ideal_gas::identify
virtual int identify() const
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
Definition hoteos_from_file.C:58
Lorene::Ideal_gas::gam1
double gam1
Definition hoteos.h:383
Lorene::Ideal_gas::gam
double gam
Adiabatic index .
Definition hoteos.h:369
Lorene::Ideal_gas::operator=
void operator=(const Ideal_gas &)
Assignment to another Ideal_gas.
Definition ideal_gas.C:116
Lorene::Ideal_gas::unsgam1
double unsgam1
Definition hoteos.h:384
Lorene::Ideal_gas::kap
double kap
Pressure coefficient (cf.
Definition hoteos.h:376
Lorene::Param
Parameter storage.
Definition param.h:125
Lorene::Scalar
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
Lorene::Tbl
Basic array class.
Definition tbl.h:161
Lorene
Lorene prototypes.
Definition app_hor.h:64