LORENE
eos_tabul.h
1/*
2 * Definition of Lorene classes Eos_tabul
3 * Eos_SLy4
4 * Eos_FPS
5 * Eos_BPAL12
6 * Eos_AkmalPR
7 * Eos_BBB2
8 * Eos_BalbN1H1
9 * Eos_GlendNH3
10 */
11
12/*
13 * Copyright (c) 2000-2001 Eric Gourgoulhon
14 * (c) 2014 Jerome Novak
15 *
16 * This file is part of LORENE.
17 *
18 * LORENE is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * LORENE is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with LORENE; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 *
32 */
33
34
35#ifndef __EOS_TABUL_H_
36#define __EOS_TABUL_H_
37
38/*
39 * $Id: eos_tabul.h,v 1.16 2015/08/04 14:41:28 j_novak Exp $
40 * $Log: eos_tabul.h,v $
41 * Revision 1.16 2015/08/04 14:41:28 j_novak
42 * Back to previous version for Eos_CompOSE. Enthalpy-consistent EoS can be accessed using Eos_consistent class (derived from Eos_CompOSE).
43 *
44 * Revision 1.15 2015/01/27 14:22:38 j_novak
45 * New methods in Eos_tabul to correct for EoS themro consistency (optional).
46 *
47 * Revision 1.14 2014/10/13 08:52:34 j_novak
48 * Lorene classes and functions now belong to the namespace Lorene.
49 *
50 * Revision 1.13 2014/07/01 09:26:20 j_novak
51 * Improvement of comments
52 *
53 * Revision 1.12 2014/06/30 16:13:18 j_novak
54 * New methods for reading directly from CompOSE files.
55 *
56 * Revision 1.11 2014/03/06 15:53:34 j_novak
57 * Eos_compstar is now Eos_compOSE. Eos_tabul uses strings and contains informations about authors.
58 *
59 * Revision 1.10 2010/02/02 14:26:10 j_novak
60 * *** empty log message ***
61 *
62 * Revision 1.9 2010/02/02 13:21:52 j_novak
63 * New class Eos_Compstar.
64 *
65 * Revision 1.8 2004/03/22 13:12:41 j_novak
66 * Modification of comments to use doxygen instead of doc++
67 *
68 * Revision 1.7 2003/12/08 15:48:43 m_bejger
69 * GlendNH3 EOS (Glendenning 1985, case 3) added
70 *
71 * Revision 1.6 2003/11/25 13:44:15 m_bejger
72 * Declared some vectors for Eos_tabul::read_table()
73 *
74 * Revision 1.5 2003/11/21 16:19:09 m_bejger
75 * Added new tables: lognb, dlpsdlnb
76 *
77 * Revision 1.4 2002/10/16 14:36:29 j_novak
78 * Reorganization of #include instructions of standard C++, in order to
79 * use experimental version 3 of gcc.
80 *
81 * Revision 1.3 2002/09/13 09:17:31 j_novak
82 * Modif. commentaires
83 *
84 * Revision 1.2 2002/04/09 14:32:15 e_gourgoulhon
85 * 1/ Added extra parameters in EOS computational functions (argument par)
86 * 2/ New class MEos for multi-domain EOS
87 *
88 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
89 * LORENE
90 *
91 * Revision 2.5 2001/09/11 16:15:46 eric
92 * Ajout des classes Eos_BBB2 et Eos_BalbN1H1
93 *
94 * Revision 2.4 2001/09/11 15:05:48 eric
95 * Ajout de la classe Eos_AkmalPR
96 *
97 * Revision 2.3 2001/03/23 13:40:23 eric
98 * Modifs commentaires.
99 *
100 * Revision 2.2 2001/02/07 09:45:28 eric
101 * Suppression de la fonction derent_ent_p.
102 * Ajout des fonctions donnant les derivees de l'EOS:
103 * der_nbar_ent_p
104 * der_ener_ent_p
105 * der_press_ent_p
106 *
107 * Revision 2.1 2000/11/23 22:33:48 eric
108 * Ajout de Eos_BPAL12.
109 *
110 * Revision 2.0 2000/11/22 19:29:18 eric
111 * *** empty log message ***
112 *
113 *
114 * $Header: /cvsroot/Lorene/C++/Include/eos_tabul.h,v 1.16 2015/08/04 14:41:28 j_novak Exp $
115 *
116 */
117
118// Standard C++
119#include <string>
120#include "headcpp.h"
121
122// Headers C
123#include <cstdio>
124
125// Lorene classes
126namespace Lorene {
127class Tbl ;
128
129
130 //------------------------------------//
131 // class Eos_tabul //
132 //------------------------------------//
133
134
149class Eos_tabul : public Eos {
150
151 // Data :
152 // -----
153
154 protected:
156 string tablename ;
157
158 string authors ;
159
161 double hmin ;
162
164 double hmax ;
165
168
171
174
177
180
181 double* press ;
182 double* nb ;
183 double* ro ;
184
185
186 // Constructors - Destructor
187 // -------------------------
188 protected:
189
196 Eos_tabul(const char* name_i, const char* table, const char* path) ;
197
204 Eos_tabul(const char* name_i, const char* file_name) ;
205
207
208 Eos_tabul(const char* name_i) ;
209
210 protected:
211
218 Eos_tabul(FILE* ) ;
219
230 Eos_tabul(ifstream& ist, const char* table) ;
231
242 Eos_tabul(ifstream& ist) ;
243
245 friend Eos* Eos::eos_from_file(FILE* ) ;
246 friend Eos* Eos::eos_from_file(ifstream& ) ;
247
248 public:
249 virtual ~Eos_tabul() ;
250
251
252 // Miscellaneous
253 // -------------
254
255 protected:
259 void read_table() ;
260
261
262 // Outputs
263 // -------
264
265 public:
266 virtual void sauve(FILE* ) const ;
267
268
269 // Computational functions
270 // -----------------------
271
272 public:
280 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
281 /* mb test version for linear interpolation
282
283 virtual double nbar_ent_p_mbtest(double ent, const Param* par=0x0) const ;
284 */
285
293 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
294
302 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
303 /* mb test version for linear interpolation
304 virtual double press_ent_p_mbtest(double ent, const Param* par=0x0) const ;
305 */
306
314 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
315
323 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
324
332 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
333
342 virtual double der_press_nbar_p(double ent, const Param* par=0x0) const ;
343
344};
345
346 //------------------------------------//
347 // class Eos_SLy4 //
348 //------------------------------------//
349
350
363class Eos_SLy4 : public Eos_tabul {
364
365
366 // Constructors - Destructor
367 // -------------------------
368 public:
369
374 Eos_SLy4(const char* path) ;
375
376
377 protected:
384 Eos_SLy4(FILE* ) ;
385
391 Eos_SLy4(ifstream& ) ;
392
393 private:
397 Eos_SLy4(const Eos_SLy4& ) ;
398
399
401 friend Eos* Eos::eos_from_file(FILE* ) ;
402 friend Eos* Eos::eos_from_file(ifstream& ) ;
403
404 public:
405 virtual ~Eos_SLy4() ;
406
407 // Miscellaneous
408 // -------------
409
410 public :
412 virtual bool operator==(const Eos& ) const ;
413
415 virtual bool operator!=(const Eos& ) const ;
416
420 virtual int identify() const ;
421
422 // Outputs
423 // -------
424
425 protected:
426 virtual ostream& operator>>(ostream &) const ;
427
428
429};
430
431 //------------------------------------//
432 // class Eos_FPS //
433 //------------------------------------//
434
435
442class Eos_FPS : public Eos_tabul {
443
444
445 // Constructors - Destructor
446 // -------------------------
447 public:
448
453 Eos_FPS(const char* path) ;
454
455
456 protected:
463 Eos_FPS(FILE* ) ;
464
470 Eos_FPS(ifstream& ) ;
471
472 private:
476 Eos_FPS(const Eos_FPS& ) ;
477
478
480 friend Eos* Eos::eos_from_file(FILE* ) ;
481 friend Eos* Eos::eos_from_file(ifstream& ) ;
482
483 public:
484 virtual ~Eos_FPS() ;
485
486 // Miscellaneous
487 // -------------
488
489 public :
491 virtual bool operator==(const Eos& ) const ;
492
494 virtual bool operator!=(const Eos& ) const ;
495
499 virtual int identify() const ;
500
501 // Outputs
502 // -------
503
504 protected:
505 virtual ostream& operator>>(ostream &) const ;
506
507
508};
509
510 //------------------------------------//
511 // class Eos_BPAL12 //
512 //------------------------------------//
513
514
520class Eos_BPAL12 : public Eos_tabul {
521
522
523 // Constructors - Destructor
524 // -------------------------
525 public:
526
531 Eos_BPAL12(const char* path) ;
532
533
534 protected:
541 Eos_BPAL12(FILE* ) ;
542
548 Eos_BPAL12(ifstream& ) ;
549
550 private:
555
556
558 friend Eos* Eos::eos_from_file(FILE* ) ;
559 friend Eos* Eos::eos_from_file(ifstream& ) ;
560
561 public:
562 virtual ~Eos_BPAL12() ;
563
564 // Miscellaneous
565 // -------------
566
567 public :
569 virtual bool operator==(const Eos& ) const ;
570
572 virtual bool operator!=(const Eos& ) const ;
573
577 virtual int identify() const ;
578
579 // Outputs
580 // -------
581
582 protected:
583 virtual ostream& operator>>(ostream &) const ;
584
585
586};
587
588
589 //------------------------------------//
590 // class Eos_AkmalPR //
591 //------------------------------------//
592
593
607class Eos_AkmalPR : public Eos_tabul {
608
609
610 // Constructors - Destructor
611 // -------------------------
612 public:
613
618 Eos_AkmalPR(const char* path) ;
619
620
621 protected:
628 Eos_AkmalPR(FILE* ) ;
629
635 Eos_AkmalPR(ifstream& ) ;
636
637 private:
642
643
645 friend Eos* Eos::eos_from_file(FILE* ) ;
646 friend Eos* Eos::eos_from_file(ifstream& ) ;
647
648 public:
649 virtual ~Eos_AkmalPR() ;
650
651 // Miscellaneous
652 // -------------
653
654 public :
656 virtual bool operator==(const Eos& ) const ;
657
659 virtual bool operator!=(const Eos& ) const ;
660
664 virtual int identify() const ;
665
666 // Outputs
667 // -------
668
669 protected:
670 virtual ostream& operator>>(ostream &) const ;
671
672
673};
674
675 //------------------------------------//
676 // class Eos_BBB2 //
677 //------------------------------------//
678
679
690class Eos_BBB2 : public Eos_tabul {
691
692
693 // Constructors - Destructor
694 // -------------------------
695 public:
696
701 Eos_BBB2(const char* path) ;
702
703
704 protected:
711 Eos_BBB2(FILE* ) ;
712
718 Eos_BBB2(ifstream& ) ;
719
720 private:
724 Eos_BBB2(const Eos_BBB2& ) ;
725
726
728 friend Eos* Eos::eos_from_file(FILE* ) ;
729 friend Eos* Eos::eos_from_file(ifstream& ) ;
730
731 public:
732 virtual ~Eos_BBB2() ;
733
734 // Miscellaneous
735 // -------------
736
737 public :
739 virtual bool operator==(const Eos& ) const ;
740
742 virtual bool operator!=(const Eos& ) const ;
743
747 virtual int identify() const ;
748
749 // Outputs
750 // -------
751
752 protected:
753 virtual ostream& operator>>(ostream &) const ;
754
755
756};
757
758
759 //------------------------------------//
760 // class Eos_BalbN1H1 //
761 //------------------------------------//
762
763
769class Eos_BalbN1H1 : public Eos_tabul {
770
771
772 // Constructors - Destructor
773 // -------------------------
774 public:
775
780 Eos_BalbN1H1(const char* path) ;
781
782
783 protected:
790 Eos_BalbN1H1(FILE* ) ;
791
797 Eos_BalbN1H1(ifstream& ) ;
798
799 private:
804
805
807 friend Eos* Eos::eos_from_file(FILE* ) ;
808 friend Eos* Eos::eos_from_file(ifstream& ) ;
809
810 public:
811 virtual ~Eos_BalbN1H1() ;
812
813 // Miscellaneous
814 // -------------
815
816 public :
818 virtual bool operator==(const Eos& ) const ;
819
821 virtual bool operator!=(const Eos& ) const ;
822
826 virtual int identify() const ;
827
828 // Outputs
829 // -------
830
831 protected:
832 virtual ostream& operator>>(ostream &) const ;
833
834
835};
836
837
838
839 //------------------------------------//
840 // class Eos_GlendNH3 //
841 //------------------------------------//
842
843
850class Eos_GlendNH3 : public Eos_tabul {
851
852
853 // Constructors - Destructor
854 // -------------------------
855 public:
856
861 Eos_GlendNH3(const char* path) ;
862
863
864 protected:
871 Eos_GlendNH3(FILE* ) ;
872
878 Eos_GlendNH3(ifstream& ) ;
879
880 private:
885
886
888 friend Eos* Eos::eos_from_file(FILE* ) ;
889 friend Eos* Eos::eos_from_file(ifstream& ) ;
890
891 public:
892 virtual ~Eos_GlendNH3() ;
893
894 // Miscellaneous
895 // -------------
896
897 public :
899 virtual bool operator==(const Eos& ) const ;
900
902 virtual bool operator!=(const Eos& ) const ;
903
907 virtual int identify() const ;
908
909 // Outputs
910 // -------
911
912 protected:
913 virtual ostream& operator>>(ostream &) const ;
914
915
916};
917
918}
919#endif
920
Equation of state AkmalPR (Akmal, Pandharipande & Ravenhall 1998).
Definition eos_tabul.h:607
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
virtual bool operator==(const Eos &) const
Comparison operator (egality)
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Eos_AkmalPR(const Eos_AkmalPR &)
Copy constructor (private to make Eos_AkmalPR a non-copiable class)
virtual ~Eos_AkmalPR()
Destructor.
Definition eos_akmalpr.C:89
virtual ostream & operator>>(ostream &) const
Operator >>
Equation of state BBB2 (Baldo, Bombaci & Burgio 1997).
Definition eos_tabul.h:690
virtual ostream & operator>>(ostream &) const
Operator >>
Definition eos_bbb2.C:124
virtual ~Eos_BBB2()
Destructor.
Definition eos_bbb2.C:88
Eos_BBB2(const Eos_BBB2 &)
Copy constructor (private to make Eos_BBB2 a non-copiable class)
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition eos_bbb2.C:113
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition eos_bbb2.C:100
Equation of state BPAL12 (Bombaci et al 1995).
Definition eos_tabul.h:520
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition eos_bpal12.C:112
virtual ~Eos_BPAL12()
Destructor.
Definition eos_bpal12.C:87
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual ostream & operator>>(ostream &) const
Operator >>
Definition eos_bpal12.C:123
Eos_BPAL12(const Eos_BPAL12 &)
Copy constructor (private to make Eos_BPAL12 a non-copiable class)
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition eos_bpal12.C:99
Equation of state BalbN1H1 (Balberg 2000).
Definition eos_tabul.h:769
virtual ~Eos_BalbN1H1()
Destructor.
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Eos_BalbN1H1(const Eos_BalbN1H1 &)
Copy constructor (private to make Eos_BalbN1H1 a non-copiable class)
virtual bool operator==(const Eos &) const
Comparison operator (egality)
virtual ostream & operator>>(ostream &) const
Operator >>
Equation of state FPS (Friedman-Pandharipande + Skyrme).
Definition eos_tabul.h:442
virtual ~Eos_FPS()
Destructor.
Definition eos_fps.C:86
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Eos_FPS(const Eos_FPS &)
Copy constructor (private to make Eos_FPS a non-copiable class)
virtual ostream & operator>>(ostream &) const
Operator >>
Definition eos_fps.C:122
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition eos_fps.C:111
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition eos_fps.C:98
Equation of state GlendNH3 (Glendenning 1985, case 3 ).
Definition eos_tabul.h:850
virtual ostream & operator>>(ostream &) const
Operator >>
Eos_GlendNH3(const Eos_GlendNH3 &)
Copy constructor (private to make Eos_GlendNH3 a non-copiable class)
virtual ~Eos_GlendNH3()
Destructor.
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
virtual bool operator==(const Eos &) const
Comparison operator (egality)
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Equation of state SLy4 (Douchin & Haensel 2001).
Definition eos_tabul.h:363
virtual ~Eos_SLy4()
Destructor.
Definition eos_sly4.C:86
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition eos_sly4.C:111
virtual ostream & operator>>(ostream &) const
Operator >>
Definition eos_sly4.C:122
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition eos_sly4.C:98
Eos_SLy4(const Eos_SLy4 &)
Copy constructor (private to make Eos_SLy4 a non-copiable class)
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Base class for tabulated equations of state.
Definition eos_tabul.h:149
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
Definition eos_tabul.C:462
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
Definition eos_tabul.C:434
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition eos_tabul.C:530
void read_table()
Reads the file containing the table and initializes in the arrays logh , logp and dlpsdlh .
Definition eos_tabul.C:226
virtual ~Eos_tabul()
Destructor.
Definition eos_tabul.C:201
Tbl * lognb
Table of .
Definition eos_tabul.h:176
Tbl * dlpsdlh
Table of .
Definition eos_tabul.h:173
Tbl * dlpsdlnb
Table of .
Definition eos_tabul.h:179
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
Definition eos_tabul.C:406
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition eos_tabul.C:487
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition eos_tabul.C:510
virtual void sauve(FILE *) const
Save in a file.
Definition eos_tabul.C:213
Tbl * logh
Table of .
Definition eos_tabul.h:167
string tablename
Name of the file containing the tabulated data.
Definition eos_tabul.h:156
Eos_tabul(const Eos_tabul &)
Copy constructor
double hmin
Lower boundary of the enthalpy interval.
Definition eos_tabul.h:161
Tbl * logp
Table of .
Definition eos_tabul.h:170
virtual double der_press_nbar_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition eos_tabul.C:560
string authors
Authors - reference for the table.
Definition eos_tabul.h:158
double hmax
Upper boundary of the enthalpy interval.
Definition eos_tabul.h:164
Equation of state base class.
Definition eos.h:190
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Parameter storage.
Definition param.h:125
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:64