LORENE
eos_mag.h
1 /*
2  * Definition of Lorene classes Eos_mag
3  */
4 
5 /*
6  * Copyright (c) 2011 Jerome Novak
7  *
8  * This file is part of LORENE.
9  *
10  * LORENE is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
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 
27 #ifndef __EOS_MAG_H_
28 #define __EOS_MAG_H_
29 
30 /*
31  * $Id: eos_mag.h,v 1.5 2021/05/14 15:39:22 g_servignat Exp $
32  * $Log: eos_mag.h,v $
33  * Revision 1.5 2021/05/14 15:39:22 g_servignat
34  * Added sound speed computation from enthalpy to Eos class and tabulated+polytropic derived classes
35  *
36  * Revision 1.4 2014/10/13 08:52:33 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.3 2013/12/13 16:36:51 j_novak
40  * Addition and computation of magnetisation terms in the Einstein equations.
41  *
42  * Revision 1.2 2011/10/04 16:05:18 j_novak
43  * Update of Eos_mag class. Suppression of loge, re-definition of the derivatives
44  * and use of interpol_herm_2d.
45  *
46  * Revision 1.1 2011/06/16 10:49:18 j_novak
47  * New class Eos_mag for EOSs depending on density and magnetic field.
48  *
49  *
50  * $Header: /cvsroot/Lorene/C++/Include/eos_mag.h,v 1.5 2021/05/14 15:39:22 g_servignat Exp $
51  *
52  */
53 
54 // Standard C++
55 #include "headcpp.h"
56 #include <string>
57 
58 // Headers C
59 #include <cstdio>
60 
61 // Lorene classes
62 namespace Lorene {
63 class Tbl ;
64 class Cmp ;
65 
66 
67  //------------------------------------//
68  // class Eos_mag //
69  //------------------------------------//
70 
71 
81 class Eos_mag : public Eos {
82 
83  // Data :
84  // -----
85 
86  protected:
88  string tablename ;
89 
91  double hmin ;
92 
94  double hmax ;
95 
97  double Bmax ;
98 
101 
104 
107 
110 
113 
116 
117 
118  // Constructors - Destructor
119  // -------------------------
120  protected:
121 
128  Eos_mag(const char* name_i, const char* table, const char* path) ;
129 
136  Eos_mag(const char* name_i, const char* file_name) ;
137 
138  Eos_mag(const Eos_mag& ) ;
139 
140  protected:
141 
148  Eos_mag(FILE* ) ;
149 
160  Eos_mag(ifstream& ist, const char* table) ;
161 
171  Eos_mag(ifstream& ist) ;
172 
174  friend Eos* Eos::eos_from_file(FILE* ) ;
175  friend Eos* Eos::eos_from_file(ifstream& ) ;
176 
177  public:
178  virtual ~Eos_mag() ;
179 
180 
181  // Miscellaneous
182  // -------------
183 
184  protected:
188  void read_table() ;
189 
190  public :
192  virtual bool operator==(const Eos& ) const ;
193 
195  virtual bool operator!=(const Eos& ) const ;
196 
200  virtual int identify() const ;
201 
202  // Outputs
203  // -------
204  public:
205  virtual void sauve(FILE* ) const ;
206 
207 
208  protected:
209  virtual ostream& operator>>(ostream &) const ;
210 
211  // Computational functions
212  // -----------------------
213 
214  public:
217  double mag_ent_p(double ent, const Param* par=0x0) const ;
218 
226  virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
227 
228 
236  virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
237 
245  virtual double press_ent_p(double ent, const Param* par=0x0) const ;
246 
254  virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
255 
263  virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
264 
272  virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
273 
281  virtual double der_press_nbar_p(double ent, const Param* par=0x0) const ;
282 
293  virtual double csound_square_ent_p(double, const Param*) const {
294  c_est_pas_fait(__FILE__) ;
295  return 0;
296  } ;
297 };
298 
299 
300 }
301 #endif
302 
double Bmax
Upper boundary of the magnetic field interval.
Definition: eos_mag.h:97
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
Definition: eos_mag.C:333
virtual double der_press_nbar_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_mag.C:548
virtual void sauve(FILE *) const
Save in a file.
Definition: eos_mag.C:174
Tbl * dlpsdB
Table of .
Definition: eos_mag.h:112
Lorene prototypes.
Definition: app_hor.h:67
string tablename
Name of the file containing the tabulated data.
Definition: eos_mag.h:88
Equation of state base class.
Definition: eos.h:209
Tbl * d2lp
Table of .
Definition: eos_mag.h:115
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
Definition: eos_mag.h:293
double hmax
Upper boundary of the log-enthalpy interval.
Definition: eos_mag.h:94
double hmin
Lower boundary of the log-enthalpy interval.
Definition: eos_mag.h:91
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
Definition: eos_mag.C:422
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_mag.C:210
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
double mag_ent_p(double ent, const Param *par=0x0) const
Computes the magnetisation.
Definition: eos_mag.C:463
Parameter storage.
Definition: param.h:125
void read_table()
Reads the file containing the table and initializes in the arrays logh , logp and dlpsdlh ...
Definition: eos_mag.C:227
Tbl * Bfield
Table of .
Definition: eos_mag.h:106
Eos_mag(const char *name_i, const char *table, const char *path)
Standard constructor.
Definition: eos_mag.C:101
virtual ~Eos_mag()
Destructor.
Definition: eos_mag.C:161
Tbl * logp
Table of .
Definition: eos_mag.h:100
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_mag.C:536
Class for a magnetized (tabulated) equation of state.
Definition: eos_mag.h:81
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_mag.C:199
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_mag.C:186
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
Definition: eos_mag.C:376
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_mag.C:511
Basic array class.
Definition: tbl.h:164
Tbl * logh
Table of .
Definition: eos_mag.h:103
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_mag.C:523
Tbl * dlpsdlh
Table of .
Definition: eos_mag.h:109