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
Lorene::Eos_multi_poly::kappa0
double kappa0
Pressure coefficient for the crust [unit: ].
Definition: eos_multi_poly.h:99
Lorene::Eos_multi_poly::der_press_nbar_p
virtual double der_press_nbar_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_multi_poly.C:1088
Lorene::Eos_multi_poly::nbCrit
double * nbCrit
Array (size npeos - 1) of the number density at which the polytropic EOS changes its index and consta...
Definition: eos_multi_poly.h:118
Lorene::Eos_multi_poly::get_logRho
const double & get_logRho(int n) const
Returns the exponent of fiducial densities.
Definition: eos_multi_poly.h:229
Lorene::Eos_multi_poly::der_nbar_ent_p
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_multi_poly.C:798
Lorene::Eos_multi_poly::identify
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
Definition: eos_from_file.C:165
Lorene::Eos_multi_poly::press_ent_p
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
Definition: eos_multi_poly.C:700
Lorene::Eos_multi_poly::get_npeos
const int & get_npeos() const
Returns the number of polytropes npeos.
Definition: eos_multi_poly.h:214
Lorene::Eos_multi_poly
Base class for a multiple polytropic equation of state.
Definition: eos_multi_poly.h:84
Lorene::Eos_multi_poly::set_auxiliary
void set_auxiliary()
Computes the auxiliary quantities.
Definition: eos_multi_poly.C:270
Lorene::Eos_multi_poly::get_entCrit
const double & get_entCrit(int n) const
Returns the critical enthalpy.
Definition: eos_multi_poly.h:252
Lorene
Lorene prototypes.
Definition: app_hor.h:64
Lorene::Eos::eos_from_file
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Definition: eos_from_file.C:177
Lorene::Eos_multi_poly::~Eos_multi_poly
virtual ~Eos_multi_poly()
Destructor.
Definition: eos_multi_poly.C:242
Lorene::Eos_multi_poly::der_ener_ent_p
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_multi_poly.C:857
Lorene::Eos_multi_poly::logP1
double logP1
Exponent of the pressure at the fiducial density .
Definition: eos_multi_poly.h:102
Lorene::Eos_multi_poly::gamma
double * gamma
Array (size: npeos) of adiabatic index .
Definition: eos_multi_poly.h:94
Lorene::Eos_multi_poly::get_kappa
const double & get_kappa(int n) const
Returns the pressure coefficient [unit: ], where and .
Definition: eos_multi_poly.h:240
Lorene::Eos
Equation of state base class.
Definition: eos.h:190
Lorene::Eos_multi_poly::m0
double m0
Individual particule mass [unit: ].
Definition: eos_multi_poly.h:134
Lorene::Eos_multi_poly::nbar_ent_p
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
Definition: eos_multi_poly.C:493
Lorene::Eos_multi_poly::get_logP1
const double & get_logP1() const
Returns the exponent of the pressure at the fiducial density.
Definition: eos_multi_poly.h:226
Lorene::Eos_multi_poly::operator!=
virtual bool operator!=(const Eos &) const
Comparison operator (difference)
Definition: eos_multi_poly.C:385
Lorene::Eos_multi_poly::logRho
double * logRho
Array (size: npeos - 1) of the exponent of fiducial densities.
Definition: eos_multi_poly.h:105
Lorene::Eos_multi_poly::operator>>
virtual ostream & operator>>(ostream &) const
Operator >>
Definition: eos_multi_poly.C:419
Lorene::Eos_multi_poly::operator==
virtual bool operator==(const Eos &) const
Read/write kappa.
Definition: eos_multi_poly.C:341
Lorene::Eos_multi_poly::get_gamma
const double & get_gamma(int n) const
Returns the adiabatic index .
Definition: eos_multi_poly.h:217
Lorene::Eos_multi_poly::entCrit
double * entCrit
Array (size npeos - 1) of the critical enthalpy at which the polytropic EOS changes its index and con...
Definition: eos_multi_poly.h:123
Lorene::Eos_multi_poly::get_kappa0
const double & get_kappa0() const
Returns the pressure coefficient for the crust.
Definition: eos_multi_poly.h:223
Lorene::Eos_multi_poly::der_press_ent_p
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
Definition: eos_multi_poly.C:990
Lorene::Eos_multi_poly::get_nbCrit
const double & get_nbCrit(int n) const
Returns the critical number density.
Definition: eos_multi_poly.h:246
Lorene::Eos_multi_poly::ener_ent_p
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
Definition: eos_multi_poly.C:591
Lorene::Eos_multi_poly::operator=
void operator=(const Eos_multi_poly &)
Assignment to another Eos_multi_poly.
Definition: eos_multi_poly.C:258
Lorene::Param
Parameter storage.
Definition: param.h:125
Lorene::Eos_multi_poly::kappa
double * kappa
Array (size: npeos) of pressure coefficient [unit: ], where and .
Definition: eos_multi_poly.h:113
Lorene::Eos_multi_poly::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).
Definition: eos_multi_poly.C:94
Lorene::Eos_multi_poly::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition: eos_multi_poly.C:395
Lorene::Eos_multi_poly::mu0
double * mu0
Array (size: npeos) of the relativistic chemical potential at zero pressure [unit: ,...
Definition: eos_multi_poly.h:142
Lorene::Eos_multi_poly::npeos
int npeos
Number of polytropic equations of state.
Definition: eos_multi_poly.h:91
Lorene::Eos_multi_poly::decInc
double * decInc
Array (size npeos - 1) of the percentage which detemines the terminating enthalpy for lower density a...
Definition: eos_multi_poly.h:129