LORENE
eos_multi_poly.h
1 /*
2  * Definition of Lorene class Eos_multi_poly
3  *
4  */
5 
6 /*
7  * Copyright (c) 2009 Keisuke Taniguchi
8  * Copyright (c) 2004 Keisuke Taniguchi
9  *
10  * This file is part of LORENE.
11  *
12  * LORENE is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2
14  * as published by the Free Software Foundation.
15  *
16  * LORENE is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with LORENE; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  *
25  */
26 
27 #ifndef __EOS_MULTI_POLY_H_
28 #define __EOS_MULTI_POLY_H_
29 
30 /*
31  * $Id: eos_multi_poly.h,v 1.6 2014/10/13 08:52:33 j_novak Exp $
32  * $Log: eos_multi_poly.h,v $
33  * Revision 1.6 2014/10/13 08:52:33 j_novak
34  * Lorene classes and functions now belong to the namespace Lorene.
35  *
36  * Revision 1.5 2014/10/06 15:09:39 j_novak
37  * Modified #include directives to use c++ syntax.
38  *
39  * Revision 1.4 2009/06/23 14:33:31 k_taniguchi
40  * Completely revised.
41  *
42  * Revision 1.3 2004/05/14 11:35:17 k_taniguchi
43  * Minor changes in some comments.
44  *
45  * Revision 1.2 2004/05/07 13:04:01 j_novak
46  * Forgotten #include<assert.h>
47  *
48  * Revision 1.1 2004/05/07 08:09:56 k_taniguchi
49  * Initial revision
50  *
51  *
52  *
53  * $Header: /cvsroot/Lorene/C++/Include/eos_multi_poly.h,v 1.6 2014/10/13 08:52:33 j_novak Exp $
54  *
55  */
56 
57 // Standard C++
58 #include "headcpp.h"
59 
60 // Headers C
61 #include <cstdio>
62 #include <cassert>
63 
64 // Lorene classes
65 #include "eos.h"
66 #include "param.h"
67 namespace Lorene {
68 class Tbl ;
69 class Cmp ;
70 class Param ;
71 class Eos ;
72 
73  //-------------------------------------------//
74  // base class Eos for multiple polytrope //
75  //-------------------------------------------//
76 
84 class Eos_multi_poly : public Eos {
85 
86  // Data :
87  // -----
88 
89  protected:
91  int npeos ;
92 
94  double* gamma ;
95 
99  double kappa0 ;
100 
102  double logP1 ;
103 
105  double* logRho ;
106 
113  double* kappa ;
114 
118  double* nbCrit ;
119 
123  double* entCrit ;
124 
129  double* decInc ;
130 
134  double m0 ;
135 
142  double* mu0 ;
143 
144 
145  // Constructors - Destructor
146  // -------------------------
147  public:
160  Eos_multi_poly(int npoly, double* gamma_i, double kappa0_i,
161  double logP1_i, double* logRho_i, double* decInc_i) ;
162 
163  Eos_multi_poly(const Eos_multi_poly& ) ;
164 
165  protected:
172  Eos_multi_poly(FILE* ) ;
173 
179  Eos_multi_poly(ifstream& ) ;
180 
182  friend Eos* Eos::eos_from_file(FILE* ) ;
183  friend Eos* Eos::eos_from_file(ifstream& ) ;
184 
185  public:
186  virtual ~Eos_multi_poly() ;
187 
188 
189  // Assignment
190  // ----------
191  public:
193  void operator=(const Eos_multi_poly&) ;
194 
196  // double& set_kappa(int n) ;
197 
198 
199  // Miscellaneous
200  // -------------
201  public:
203  virtual bool operator==(const Eos& ) const ;
204 
206  virtual bool operator!=(const Eos& ) const ;
207 
211  virtual int identify() const ;
212 
214  const int& get_npeos() const { return npeos ; } ;
215 
217  const double& get_gamma(int n) const {
218  assert(n>=0 && n<npeos) ;
219  return gamma[n] ;
220  } ;
221 
223  const double& get_kappa0() const { return kappa0 ; } ;
224 
226  const double& get_logP1() const { return logP1 ; } ;
227 
229  const double& get_logRho(int n) const {
230  assert(n>=0 && n<npeos-1) ;
231  return logRho[n] ;
232  } ;
233 
240  const double& get_kappa(int n) const {
241  assert(n>=0 && n<npeos) ;
242  return kappa[n] ;
243  } ;
244 
246  const double& get_nbCrit(int n) const {
247  assert(n>=0 && n<npeos-1) ;
248  return nbCrit[n] ;
249  } ;
250 
252  const double& get_entCrit(int n) const {
253  assert(n>=0 && n<npeos-1) ;
254  return entCrit[n] ;
255  } ;
256 
257  protected:
259  void set_auxiliary() ;
260 
261 
262  // Outputs
263  // -------
264  public:
265  virtual void sauve(FILE *) const ;
266 
267  protected:
268  virtual ostream& operator>>(ostream &) const ;
269 
270 
271  // Computational functions
272  // -----------------------
273  public:
283  virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
284 
293  virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
294 
303  virtual double press_ent_p(double ent, const Param* par=0x0) const ;
304 
313  virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
314 
323  virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
324 
333  virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
334 
343  virtual double der_press_nbar_p(double ent, const Param* par=0x0) const ;
344 };
345 
346 }
347 #endif
virtual ~Eos_multi_poly()
Destructor.
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Lorene prototypes.
Definition: app_hor.h:64
virtual bool operator==(const Eos &) const
Read/write kappa.
double * kappa
Array (size: npeos) of pressure coefficient [unit: ], where and .
Equation of state base class.
Definition: eos.h:190
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
const int & get_npeos() const
Returns the number of polytropes npeos.
virtual double der_press_nbar_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
void operator=(const Eos_multi_poly &)
Assignment to another Eos_multi_poly.
Eos_multi_poly(int npoly, double *gamma_i, double kappa0_i, double logP1_i, double *logRho_i, double *decInc_i)
Standard constructor (sets m0 to 1).
const double & get_logRho(int n) const
Returns the exponent of fiducial densities.
double kappa0
Pressure coefficient for the crust [unit: ].
const double & get_kappa0() const
Returns the pressure coefficient for the crust.
double * gamma
Array (size: npeos) of adiabatic index .
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
double * entCrit
Array (size npeos - 1) of the critical enthalpy at which the polytropic EOS changes its index and con...
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
Parameter storage.
Definition: param.h:125
double logP1
Exponent of the pressure at the fiducial density .
double * nbCrit
Array (size npeos - 1) of the number density at which the polytropic EOS changes its index and consta...
const double & get_logP1() const
Returns the exponent of the pressure at the fiducial density.
const double & get_kappa(int n) const
Returns the pressure coefficient [unit: ], where and .
const double & get_nbCrit(int n) const
Returns the critical number density.
double * mu0
Array (size: npeos) of the relativistic chemical potential at zero pressure [unit: ...
Base class for a multiple polytropic equation of state.
virtual ostream & operator>>(ostream &) const
Operator >>
double * decInc
Array (size npeos - 1) of the percentage which detemines the terminating enthalpy for lower density a...
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
int npeos
Number of polytropic equations of state.
void set_auxiliary()
Computes the auxiliary quantities.
double m0
Individual particule mass [unit: ].
virtual void sauve(FILE *) const
Save in a file.
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
double * logRho
Array (size: npeos - 1) of the exponent of fiducial densities.
const double & get_gamma(int n) const
Returns the adiabatic index .
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
const double & get_entCrit(int n) const
Returns the critical enthalpy.
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.