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.7 2021/05/14 15:39:22 g_servignat Exp $
32 * $Log: eos_multi_poly.h,v $
33 * Revision 1.7 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.6 2014/10/13 08:52:33 j_novak
37 * Lorene classes and functions now belong to the namespace Lorene.
38 *
39 * Revision 1.5 2014/10/06 15:09:39 j_novak
40 * Modified #include directives to use c++ syntax.
41 *
42 * Revision 1.4 2009/06/23 14:33:31 k_taniguchi
43 * Completely revised.
44 *
45 * Revision 1.3 2004/05/14 11:35:17 k_taniguchi
46 * Minor changes in some comments.
47 *
48 * Revision 1.2 2004/05/07 13:04:01 j_novak
49 * Forgotten #include<assert.h>
50 *
51 * Revision 1.1 2004/05/07 08:09:56 k_taniguchi
52 * Initial revision
53 *
54 *
55 *
56 * $Header: /cvsroot/Lorene/C++/Include/eos_multi_poly.h,v 1.7 2021/05/14 15:39:22 g_servignat Exp $
57 *
58 */
59
60// Standard C++
61#include "headcpp.h"
62
63// Headers C
64#include <cstdio>
65#include <cassert>
66
67// Lorene classes
68#include "eos.h"
69#include "param.h"
70namespace Lorene {
71class Tbl ;
72class Cmp ;
73class Param ;
74class Eos ;
75
76 //-------------------------------------------//
77 // base class Eos for multiple polytrope //
78 //-------------------------------------------//
79
87class Eos_multi_poly : public Eos {
88
89 // Data :
90 // -----
91
92 protected:
94 int npeos ;
95
97 double* gamma ;
98
102 double kappa0 ;
103
105 double logP1 ;
106
108 double* logRho ;
109
116 double* kappa ;
117
121 double* nbCrit ;
122
126 double* entCrit ;
127
132 double* decInc ;
133
137 double m0 ;
138
145 double* mu0 ;
146
147
148 // Constructors - Destructor
149 // -------------------------
150 public:
163 Eos_multi_poly(int npoly, double* gamma_i, double kappa0_i,
164 double logP1_i, double* logRho_i, double* decInc_i) ;
165
167
168 protected:
175 Eos_multi_poly(FILE* ) ;
176
182 Eos_multi_poly(ifstream& ) ;
183
185 friend Eos* Eos::eos_from_file(FILE* ) ;
186 friend Eos* Eos::eos_from_file(ifstream& ) ;
187
188 public:
189 virtual ~Eos_multi_poly() ;
190
191
192 // Assignment
193 // ----------
194 public:
196 void operator=(const Eos_multi_poly&) ;
197
199 // double& set_kappa(int n) ;
200
201
202 // Miscellaneous
203 // -------------
204 public:
206 virtual bool operator==(const Eos& ) const ;
207
209 virtual bool operator!=(const Eos& ) const ;
210
214 virtual int identify() const ;
215
217 const int& get_npeos() const { return npeos ; } ;
218
220 const double& get_gamma(int n) const {
221 assert(n>=0 && n<npeos) ;
222 return gamma[n] ;
223 } ;
224
226 const double& get_kappa0() const { return kappa0 ; } ;
227
229 const double& get_logP1() const { return logP1 ; } ;
230
232 const double& get_logRho(int n) const {
233 assert(n>=0 && n<npeos-1) ;
234 return logRho[n] ;
235 } ;
236
243 const double& get_kappa(int n) const {
244 assert(n>=0 && n<npeos) ;
245 return kappa[n] ;
246 } ;
247
249 const double& get_nbCrit(int n) const {
250 assert(n>=0 && n<npeos-1) ;
251 return nbCrit[n] ;
252 } ;
253
255 const double& get_entCrit(int n) const {
256 assert(n>=0 && n<npeos-1) ;
257 return entCrit[n] ;
258 } ;
259
260 protected:
262 void set_auxiliary() ;
263
264
265 // Outputs
266 // -------
267 public:
268 virtual void sauve(FILE *) const ;
269
270 protected:
271 virtual ostream& operator>>(ostream &) const ;
272
273
274 // Computational functions
275 // -----------------------
276 public:
286 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
287
296 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
297
306 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
307
316 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
317
326 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
327
336 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
337
346 virtual double der_press_nbar_p(double ent, const Param* par=0x0) const ;
347
358 virtual double csound_square_ent_p(double, const Param*) const {
359 c_est_pas_fait(__FILE__) ;
360 return 0;
361 } ;
362};
363
364}
365#endif
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
virtual void sauve(FILE *) const
Save in a file.
const double & get_gamma(int n) const
Returns the adiabatic index .
int npeos
Number of polytropic equations of state.
double * decInc
Array (size npeos - 1) of the percentage which detemines the terminating enthalpy for lower density a...
double m0
Individual particule mass [unit: ].
void operator=(const Eos_multi_poly &)
Assignment to another Eos_multi_poly.
const double & get_logRho(int n) const
Returns the exponent of fiducial densities.
double * nbCrit
Array (size npeos - 1) of the number density at which the polytropic EOS changes its index and consta...
const double & get_kappa(int n) const
Returns the pressure coefficient [unit: ], where and .
virtual double der_press_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
const double & get_entCrit(int n) const
Returns the critical enthalpy.
double * mu0
Array (size: npeos) of the relativistic chemical potential at zero pressure [unit: ,...
const double & get_nbCrit(int n) const
Returns the critical number density.
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
double * gamma
Array (size: npeos) of adiabatic index .
const int & get_npeos() const
Returns the number of polytropes npeos.
double * logRho
Array (size: npeos - 1) of the exponent of fiducial densities.
virtual double der_ener_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
const double & get_kappa0() const
Returns the pressure coefficient for the crust.
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
double logP1
Exponent of the pressure at the fiducial density .
virtual bool operator!=(const Eos &) const
Comparison operator (difference).
void set_auxiliary()
Computes the auxiliary quantities.
virtual double der_press_nbar_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual ostream & operator>>(ostream &) const
Operator >>.
double * kappa
Array (size: npeos) of pressure coefficient [unit: ], where and .
double kappa0
Pressure coefficient for the crust [unit: ].
virtual ~Eos_multi_poly()
Destructor.
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
double * entCrit
Array (size npeos - 1) of the critical enthalpy at which the polytropic EOS changes its index and con...
virtual double der_nbar_ent_p(double ent, const Param *par=0x0) const
Computes the logarithmic derivative from the log-enthalpy.
virtual bool operator==(const Eos &) const
Read/write kappa.
const double & get_logP1() const
Returns the exponent of the pressure at the fiducial density.
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).
Equation of state base class.
Definition eos.h:206
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Eos()
Standard constructor.
Definition eos.C:118
Parameter storage.
Definition param.h:125
Basic array class.
Definition tbl.h:161
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
Lorene prototypes.
Definition app_hor.h:67