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.4 2014/10/13 08:52:33 j_novak Exp $
32  * $Log: eos_mag.h,v $
33  * Revision 1.4 2014/10/13 08:52:33 j_novak
34  * Lorene classes and functions now belong to the namespace Lorene.
35  *
36  * Revision 1.3 2013/12/13 16:36:51 j_novak
37  * Addition and computation of magnetisation terms in the Einstein equations.
38  *
39  * Revision 1.2 2011/10/04 16:05:18 j_novak
40  * Update of Eos_mag class. Suppression of loge, re-definition of the derivatives
41  * and use of interpol_herm_2d.
42  *
43  * Revision 1.1 2011/06/16 10:49:18 j_novak
44  * New class Eos_mag for EOSs depending on density and magnetic field.
45  *
46  *
47  * $Header: /cvsroot/Lorene/C++/Include/eos_mag.h,v 1.4 2014/10/13 08:52:33 j_novak Exp $
48  *
49  */
50 
51 // Standard C++
52 #include "headcpp.h"
53 #include <string>
54 
55 // Headers C
56 #include <cstdio>
57 
58 // Lorene classes
59 namespace Lorene {
60 class Tbl ;
61 class Cmp ;
62 
63 
64  //------------------------------------//
65  // class Eos_mag //
66  //------------------------------------//
67 
68 
78 class Eos_mag : public Eos {
79 
80  // Data :
81  // -----
82 
83  protected:
85  string tablename ;
86 
88  double hmin ;
89 
91  double hmax ;
92 
94  double Bmax ;
95 
97  Tbl* logp ;
98 
101 
104 
107 
110 
113 
114 
115  // Constructors - Destructor
116  // -------------------------
117  protected:
118 
125  Eos_mag(const char* name_i, const char* table, const char* path) ;
126 
133  Eos_mag(const char* name_i, const char* file_name) ;
134 
135  Eos_mag(const Eos_mag& ) ;
136 
137  protected:
138 
145  Eos_mag(FILE* ) ;
146 
157  Eos_mag(ifstream& ist, const char* table) ;
158 
168  Eos_mag(ifstream& ist) ;
169 
171  friend Eos* Eos::eos_from_file(FILE* ) ;
172  friend Eos* Eos::eos_from_file(ifstream& ) ;
173 
174  public:
175  virtual ~Eos_mag() ;
176 
177 
178  // Miscellaneous
179  // -------------
180 
181  protected:
185  void read_table() ;
186 
187  public :
189  virtual bool operator==(const Eos& ) const ;
190 
192  virtual bool operator!=(const Eos& ) const ;
193 
197  virtual int identify() const ;
198 
199  // Outputs
200  // -------
201  public:
202  virtual void sauve(FILE* ) const ;
203 
204 
205  protected:
206  virtual ostream& operator>>(ostream &) const ;
207 
208  // Computational functions
209  // -----------------------
210 
211  public:
214  double mag_ent_p(double ent, const Param* par=0x0) const ;
215 
223  virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
224 
225 
233  virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
234 
242  virtual double press_ent_p(double ent, const Param* par=0x0) const ;
243 
251  virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
252 
260  virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
261 
269  virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
270 
278  virtual double der_press_nbar_p(double ent, const Param* par=0x0) const ;
279 
280 };
281 
282 
283 }
284 #endif
285 
double Bmax
Upper boundary of the magnetic field interval.
Definition: eos_mag.h:94
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:330
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:545
virtual void sauve(FILE *) const
Save in a file.
Definition: eos_mag.C:171
Tbl * dlpsdB
Table of .
Definition: eos_mag.h:109
Lorene prototypes.
Definition: app_hor.h:64
string tablename
Name of the file containing the tabulated data.
Definition: eos_mag.h:85
Equation of state base class.
Definition: eos.h:190
Tbl * d2lp
Table of .
Definition: eos_mag.h:112
double hmax
Upper boundary of the log-enthalpy interval.
Definition: eos_mag.h:91
double hmin
Lower boundary of the log-enthalpy interval.
Definition: eos_mag.h:88
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
Definition: eos_mag.C:419
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_mag.C:207
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:460
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:224
Tbl * Bfield
Table of .
Definition: eos_mag.h:103
Eos_mag(const char *name_i, const char *table, const char *path)
Standard constructor.
Definition: eos_mag.C:98
virtual ~Eos_mag()
Destructor.
Definition: eos_mag.C:158
Tbl * logp
Table of .
Definition: eos_mag.h:97
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:533
Class for a magnetized (tabulated) equation of state.
Definition: eos_mag.h:78
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_mag.C:196
virtual bool operator==(const Eos &) const
Comparison operator (egality)
Definition: eos_mag.C:183
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:373
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:508
Basic array class.
Definition: tbl.h:161
Tbl * logh
Table of .
Definition: eos_mag.h:100
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:520
Tbl * dlpsdlh
Table of .
Definition: eos_mag.h:106