LORENE
hoteos.h
1/*
2 * Definition of Lorene class Hot_eos.
3 *
4 */
5
6/*
7 * Copyright (c) 2015 Jerome Novak
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __HOTEOS_H_
27#define __HOTEOS_H_
28
29/*
30 * $Id: hoteos.h,v 1.3 2015/12/08 10:52:17 j_novak Exp $
31 * $Log: hoteos.h,v $
32 * Revision 1.3 2015/12/08 10:52:17 j_novak
33 * New class Hoteos_tabul for tabulated temperature-dependent EoSs.
34 *
35 * Revision 1.2 2015/09/10 13:28:00 j_novak
36 * New methods for the class Hot_Eos
37 *
38 * Revision 1.1 2015/03/17 14:19:59 j_novak
39 * New class Hot_eos to deal with temperature-dependent EOSs.
40 *
41 *
42 * $Header: /cvsroot/Lorene/C++/Include/hoteos.h,v 1.3 2015/12/08 10:52:17 j_novak Exp $
43 *
44 */
45
46//C++ headers
47#include "headcpp.h"
48
49//C headers
50#include<cstdio>
51#include "tbl.h"
52
53namespace Lorene{
54
55class Scalar ;
56class Param ;
57class Eos ;
58 //------------------------------------//
59 // class Hot_eos //
60 //------------------------------------//
61
67 class Hot_eos {
68
69 // Data :
70 // -----
71 protected:
72 string name ;
73
74 // Constructors - Destructor
75 // -------------------------
76 protected:
77 Hot_eos() ;
78
80 explicit Hot_eos(const string&) ;
81
83 explicit Hot_eos(const char*) ;
84
85 Hot_eos(const Hot_eos& ) ;
86
93 Hot_eos(FILE* ) ;
94
100 Hot_eos(ifstream& ) ;
101
102 public:
103 virtual ~Hot_eos() ;
104
105 // Derived data :
106 // ------------
107 protected:
108 mutable Eos* p_cold_eos ;
109
111 virtual void del_deriv() const ;
112
114 void set_der_0x0() const ;
115
116 // Name manipulation
117 // -----------------
118 public:
120 const string& get_name() const {return name; };
121
123 void set_name(const char* ) ;
124
125 // Miscellaneous
126 // -------------
127 public:
131 static Hot_eos* hoteos_from_file(FILE* ) ;
132
144 static Hot_eos* hoteos_from_file(ifstream& ) ;
145
147 virtual bool operator==(const Hot_eos& ) const = 0 ;
148
150 virtual bool operator!=(const Hot_eos& ) const = 0 ;
151
155 virtual int identify() const = 0 ;
156
157 // Outputs
158 // -------
159
160 public:
161 virtual void sauve(FILE* ) const ;
162
164 friend ostream& operator<<(ostream& , const Hot_eos& ) ;
165
166 protected:
167 virtual ostream& operator>>(ostream &) const = 0 ;
168
169 public:
171 virtual const Eos& new_cold_Eos() const = 0 ;
172
173
174 // Computational functions
175 // -----------------------
176 protected:
195 void calcule(const Scalar& thermo1, const Scalar& thermo2, int nzet, int l_min,
196 double (Hot_eos::*fait)(double, double) const, Scalar& resu) const ;
197
198 public:
211 virtual double nbar_Hs_p(double ent, double sb) const = 0 ;
212
233 Scalar nbar_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
234
247 virtual double ener_Hs_p(double ent, double sb) const = 0 ;
248
268 Scalar ener_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
269
282 virtual double press_Hs_p(double ent, double sb) const = 0 ;
283
302 Scalar press_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
303
316 virtual double temp_Hs_p(double ent, double sb) const = 0 ;
317
338 Scalar temp_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
339
340 };
341 ostream& operator<<(ostream& , const Hot_eos& ) ;
342
343 //------------------------------------//
344 // class Ideal_gas //
345 //------------------------------------//
346
362 class Ideal_gas : public Hot_eos {
363
364 // Data :
365 //-------
366
367 protected:
369 double gam ;
370
376 double kap ;
377
381 double m_0 ;
382
383 double gam1 ;
384 double unsgam1 ;
385 double gam1sgamkap ;
386
387 // Constructors - Destructor
388 // -------------------------
389 public:
390
400 Ideal_gas(double gamma, double kappa, double mass=1.) ;
401
402 Ideal_gas(const Ideal_gas& ) ;
403
404 protected:
411 Ideal_gas(FILE* ) ;
412
418 Ideal_gas(ifstream& ) ;
419
422 friend Hot_eos* Hot_eos::hoteos_from_file(ifstream& ) ;
423
424 public:
425 virtual ~Ideal_gas() ;
426
427 // Assignment
428 // ----------
430 void operator=(const Ideal_gas& ) ;
431
432 // Miscellaneous
433 // -------------
434
435 public :
437 virtual bool operator==(const Hot_eos& ) const ;
438
440 virtual bool operator!=(const Hot_eos& ) const ;
441
445 virtual int identify() const ;
446
448 double get_gam() const ;
449
451 double get_kap() const ;
452
456 double get_m_0() const ;
457
458 virtual const Eos& new_cold_Eos() const ;
459
460 protected:
464 void set_auxiliary() ;
465
466 // Outputs
467 // -------
468
469 public:
470 virtual void sauve(FILE* ) const ;
471
472 protected:
473 virtual ostream& operator>>(ostream &) const ;
474
475
476 // Computational functions
477 // -----------------------
478
479 public:
492 virtual double nbar_Hs_p(double ent, double sb) const ;
493
506 virtual double ener_Hs_p(double ent, double sb) const ;
507
520 virtual double press_Hs_p(double ent, double sb) const ;
521
534 virtual double temp_Hs_p(double ent, double sb) const ;
535
536};
537
538 //------------------------------------//
539 // class Hoteos_tabul //
540 //------------------------------------//
541
549 class Hoteos_tabul : public Hot_eos {
550
551 // Data :
552 //-------
553
554 protected:
556 string tablename ;
557
558 string authors ;
559
561 double hmin ;
562
564 double hmax ;
565
567 double sbmin ;
568
570 double sbmax ;
571
574
577
580
583
586
589
590 // Constructors - Destructor
591 // -------------------------
592 public:
593
596 Hoteos_tabul(const string& filename) ;
597
599
600 protected:
607 Hoteos_tabul(FILE* ) ;
608
614 Hoteos_tabul(ifstream& ) ;
615
618 friend Hot_eos* Hot_eos::hoteos_from_file(ifstream& ) ;
619
620 public:
621 virtual ~Hoteos_tabul() ;
622
624 void operator=(const Hoteos_tabul& ) ;
625
626 // Miscellaneous
627 // -------------
628
629 protected:
633 void read_table() ;
634
636 void set_arrays_0x0() ;
637
638 public :
640 virtual bool operator==(const Hot_eos& ) const ;
641
643 virtual bool operator!=(const Hot_eos& ) const ;
644
648 virtual int identify() const ;
649
650 virtual const Eos& new_cold_Eos() const ;
651
652 // Outputs
653 // -------
654
655 public:
656 virtual void sauve(FILE* ) const ;
657
658 protected:
659 virtual ostream& operator>>(ostream &) const ;
660
661
662 // Computational functions
663 // -----------------------
664
665 public:
678 virtual double nbar_Hs_p(double ent, double sb) const ;
679
692 virtual double ener_Hs_p(double ent, double sb) const ;
693
706 virtual double press_Hs_p(double ent, double sb) const ;
707
720 virtual double temp_Hs_p(double ent, double sb) const ;
721
722};
723
724}
725#endif
Equation of state base class.
Definition eos.h:190
Base class for temperature-dependent equations of state (abstract class).
Definition hoteos.h:67
const string & get_name() const
Returns the hot EOS name.
Definition hoteos.h:120
virtual int identify() const =0
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
virtual void del_deriv() const
Deletes all the derived quantities.
Definition hoteos.C:109
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...
virtual const Eos & new_cold_Eos() const =0
Returns the corresponding cold Eos.
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
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...
Eos * p_cold_eos
Corresponding cold Eos.
Definition hoteos.h:108
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...
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
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
Hot_eos()
Standard constructor.
Definition hoteos.C:56
friend ostream & operator<<(ostream &, const Hot_eos &)
Display.
Definition hoteos.C:143
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
static Hot_eos * hoteos_from_file(FILE *)
Construction of an EOS from a binary file.
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
virtual ostream & operator>>(ostream &) const =0
Operator >>
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition hoteos.C:114
virtual bool operator==(const Hot_eos &) const =0
Comparison operator (egality)
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...
virtual ~Hot_eos()
Destructor.
Definition hoteos.C:101
virtual bool operator!=(const Hot_eos &) const =0
Comparison operator (difference)
virtual void sauve(FILE *) const
Save in a file.
Definition hoteos.C:129
string name
EOS name.
Definition hoteos.h:72
void set_name(const char *)
Sets the hot EOS name.
Definition hoteos.C:118
Hot (temperature-dependent) tabulated equation of state, read from a file.
Definition hoteos.h:549
double hmin
Lower boundary of the enthalpy interval.
Definition hoteos.h:561
virtual void sauve(FILE *) const
Save in a file.
virtual ~Hoteos_tabul()
Destructor.
double sbmax
Upper boundary of the entropy interval.
Definition hoteos.h:570
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...
virtual bool operator!=(const Hot_eos &) const
Comparison operator (difference)
Tbl * hhh
Table of .
Definition hoteos.h:573
Tbl * d2p
Table of .
Definition hoteos.h:588
void set_arrays_0x0()
Sets all the arrays to the null pointer.
void operator=(const Hoteos_tabul &)
Assignment to another Hoteos_tabul.
virtual ostream & operator>>(ostream &) const
Operator >>
virtual bool operator==(const Hot_eos &) const
Comparison operator (egality)
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...
double hmax
Upper boundary of the enthalpy interval.
Definition hoteos.h:564
virtual const Eos & new_cold_Eos() const
Returns the corresponding cold Eos.
string tablename
Name of the file containing the tabulated data.
Definition hoteos.h:556
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...
Tbl * dpdh
Table of .
Definition hoteos.h:582
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...
Hoteos_tabul(const Hoteos_tabul &)
Copy constructor.
virtual int identify() const
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
Tbl * dpds
Table of .
Definition hoteos.h:585
string authors
Authors - reference for the table.
Definition hoteos.h:558
Tbl * s_B
Table of , entropy per baryon (in units of Boltzmann constant).
Definition hoteos.h:576
void read_table()
Reads the file containing the table and initializes in the arrays hhh , s_B, ppp, ....
Tbl * ppp
Table of pressure $P$.
Definition hoteos.h:579
double sbmin
Lower boundary of the entropy interval.
Definition hoteos.h:567
Ideal-gas (temperature-dependent) equation of state, with mass-term in the energy density.
Definition hoteos.h:362
void set_auxiliary()
Computes the auxiliary quantities gam1 , unsgam1 , gam1sgamkap from the values of gam and kap.
Definition ideal_gas.C:133
double get_m_0() const
Return the individual particule mass (cf.
Definition ideal_gas.C:151
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
virtual void sauve(FILE *) const
Save in a file.
Definition ideal_gas.C:221
double get_kap() const
Returns the pressure coefficient (cf. Eq. (1)).
Definition ideal_gas.C:147
double m_0
Individual particule mass (cf.
Definition hoteos.h:381
virtual bool operator==(const Hot_eos &) const
Comparison operator (egality)
Definition ideal_gas.C:175
double gam1sgamkap
Definition hoteos.h:385
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
double get_gam() const
Returns the adiabatic index (cf. Eq. (1)).
Definition ideal_gas.C:143
virtual ostream & operator>>(ostream &) const
Operator >>
Definition ideal_gas.C:231
virtual bool operator!=(const Hot_eos &) const
Comparison operator (difference)
Definition ideal_gas.C:212
virtual ~Ideal_gas()
Destructor.
Definition ideal_gas.C:110
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
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
virtual const Eos & new_cold_Eos() const
Returns the corresponding cold Eos.
Definition ideal_gas.C:160
virtual int identify() const
Returns a number to identify the sub-classe of Hot_eos the object belongs to.
double gam
Adiabatic index .
Definition hoteos.h:369
void operator=(const Ideal_gas &)
Assignment to another Ideal_gas.
Definition ideal_gas.C:116
double kap
Pressure coefficient (cf.
Definition hoteos.h:376
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:64