Debian Codegraph @

C++/Include/eos.h

raw symbols SCIP
1 /*
2 * Definition of Lorene classes Eos
3 * Eos_poly
4 * Eos_poly_newt
5 * Eos_incomp
6 * Eos_incomp_newt
7 * Eos_strange
8 * Eos_strange_c
9 *
10 */
11
12 /*
13 * Copyright (c) 2000-2001 Eric Gourgoulhon
14 *
15 * This file is part of LORENE.
16 *
17 * LORENE is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * LORENE is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with LORENE; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 *
31 */
32
33
34 #ifndef __EOS_H_
35 #define __EOS_H_
36
37 /*
38 * $Id: eos.h,v 1.22 2015/08/04 14:41:28 j_novak Exp $
39 * $Log: eos.h,v $
40 * Revision 1.22 2015/08/04 14:41:28 j_novak
41 * Back to previous version for Eos_CompOSE. Enthalpy-consistent EoS can be accessed using Eos_consistent class (derived from Eos_CompOSE).
42 *
43 * Revision 1.21 2015/03/17 14:19:59 j_novak
44 * New class Hot_eos to deal with temperature-dependent EOSs.
45 *
46 * Revision 1.20 2014/10/13 08:52:33 j_novak
47 * Lorene classes and functions now belong to the namespace Lorene.
48 *
49 * Revision 1.19 2014/10/06 15:09:39 j_novak
50 * Modified #include directives to use c++ syntax.
51 *
52 * Revision 1.18 2012/10/26 14:09:13 e_gourgoulhon
53 * Added new class Eos_Fermi
54 *
55 * Revision 1.17 2011/06/16 10:49:18 j_novak
56 * New class Eos_mag for EOSs depending on density and magnetic field.
57 *
58 * Revision 1.16 2010/02/02 13:21:52 j_novak
59 * New class Eos_Compstar.
60 *
61 * Revision 1.15 2010/01/23 16:27:11 e_gourgoulhon
62 * Improved documentation.
63 *
64 * Revision 1.14 2005/05/22 20:49:12 k_taniguchi
65 * Introduction of a new class Eos_fit_AkmalPR.
66 *
67 * Revision 1.13 2004/09/26 18:51:47 k_taniguchi
68 * Introduction of new classes Eos_fitting, Eos_fit_SLy4, and Eos_fit_FPS
69 *
70 * Revision 1.12 2004/05/07 08:08:29 k_taniguchi
71 * Add the case of Eos_multi_poly.C
72 *
73 * Revision 1.11 2004/03/22 16:10:20 j_novak
74 * Excluding some files
75 *
76 * Revision 1.10 2004/03/22 13:12:40 j_novak
77 * Modification of comments to use doxygen instead of doc++
78 *
79 * Revision 1.9 2004/01/14 15:52:26 f_limousin
80 * Added methods calcule, nbar_ent, der_nbar_ent and der_ener_ent for Scalar.
81 *
82 * Revision 1.8 2003/12/08 15:48:12 m_bejger
83 * GlendNH3 (Glendenning 1985, case 3) added
84 *
85 * Revision 1.7 2002/10/16 14:36:28 j_novak
86 * Reorganization of #include instructions of standard C++, in order to
87 * use experimental version 3 of gcc.
88 *
89 * Revision 1.6 2002/09/13 09:17:31 j_novak
90 * Modif. commentaires
91 *
92 * Revision 1.5 2002/06/17 14:05:16 j_novak
93 * friend functions are now also declared outside the class definition
94 *
95 * Revision 1.4 2002/04/11 13:27:48 e_gourgoulhon
96 * *** empty log message ***
97 *
98 * Revision 1.3 2002/04/09 15:19:03 e_gourgoulhon
99 * Add EOS number 100 in the comments of eos_from_file
100 *
101 * Revision 1.2 2002/04/09 14:32:14 e_gourgoulhon
102 * 1/ Added extra parameters in EOS computational functions (argument par)
103 * 2/ New class MEos for multi-domain EOS
104 *
105 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
106 * LORENE
107 *
108 * Revision 2.15 2001/09/12 15:54:17 eric
109 * Modif documentation eos_from_file.
110 *
111 * Revision 2.14 2001/06/13 14:12:18 eric
112 * Modif commentaires (mise en conformite Doc++ 3.4.7)
113 *
114 * Revision 2.13 2001/02/07 09:33:42 eric
115 * Suppression des fonctions derent_ent et derent_ent_p.
116 * Ajout des fonctions donnant les derivees de l'EOS:
117 * der_nbar_ent
118 * der_ener_ent
119 * der_press_ent
120 *
121 * Revision 2.12 2000/11/23 14:45:33 eric
122 * Ajout de l'EOS Eos_strange_cr.
123 *
124 * Revision 2.11 2000/11/22 19:28:45 eric
125 * Ajout de #include "eos_tabul.h" a la fin.
126 *
127 * Revision 2.10 2000/10/25 10:55:08 eric
128 * Eos_strange: modif commentaires.
129 *
130 * Revision 2.9 2000/10/24 15:28:43 eric
131 * Ajout de l'EOS matiere etrange (Eos_strange).
132 *
133 * Revision 2.8 2000/06/20 08:34:20 eric
134 * Ajout des membres get_gam(), ... a Eos_ploy
135 *
136 * Revision 2.7 2000/02/14 14:43:22 eric
137 * Modif commentaires.
138 *
139 * Revision 2.6 2000/02/14 14:32:46 eric
140 * Ajout des constructeurs par lecture de fichier formate.
141 *
142 * Revision 2.5 2000/01/21 16:21:12 eric
143 * Modif commentaires.
144 *
145 * Revision 2.4 2000/01/21 15:16:10 eric
146 * Ajout de la fonction identify()
147 * Ajout de la fonction de construction a partir d'un fichier
148 * static Eos* Eos::eos_from_file(FILE* ).
149 * Ajout des operateurs de comparaison == et !=
150 *
151 * Revision 2.3 2000/01/18 16:10:57 eric
152 * Ajout des EOS Eos_incomp et Eos_incomp_newt.
153 *
154 * Revision 2.2 2000/01/18 15:13:28 eric
155 * Ajout de l'equation d'etat Eos_poly_newt.
156 *
157 * Revision 2.1 2000/01/18 13:46:50 eric
158 * Premiere version operationnelle
159 *
160 * Revision 2.0 2000/01/18 10:46:08 eric
161 * *** empty log message ***
162 *
163 *
164 * $Header: /cvsroot/Lorene/C++/Include/eos.h,v 1.22 2015/08/04 14:41:28 j_novak Exp $
165 *
166 */
167
168 // Standard C++
169 #include "headcpp.h"
170
171 // Headers C
172 #include <cstdio>
173
174 // Lorene classes
175 namespace Lorene {
176 class Tbl ;
177 class Cmp ;
178 class Scalar ;
179 class Param ;
180
181 //------------------------------------//
182 // base class Eos //
183 //------------------------------------//
184
185 /**
186 * Equation of state base class. \ingroup(eos)
187 *
188 *
189 */
190 class Eos {
191
192 // Data :
193 // -----
194
195 protected:
196 char name[100] ; ///< EOS name
197
198
199 // Constructors - Destructor
200 // -------------------------
201 protected:
202 Eos() ; ///< Standard constructor
203
204 /// Standard constructor with name
205 explicit Eos(const char* name_i) ;
206
207 Eos(const Eos& ) ; ///< Copy constructor
208
209 protected:
210 /** Constructor from a binary file (created by the function
211 * \c sauve(FILE*) ).
212 * This constructor is protected because any EOS construction
213 * from a binary file must be done via the function
214 * \c Eos::eos_from_file(FILE*) .
215 */
216 Eos(FILE* ) ;
217
218 /** Constructor from a formatted file.
219 * This constructor is protected because any EOS construction
220 * from a formatted file must be done via the function
221 * \c Eos::eos_from_file(ifstream&) .
222 */
223 Eos(ifstream& ) ;
224
225
226 public:
227 virtual ~Eos() ; ///< Destructor
228
229
230 // Name manipulation
231 // -----------------
232 public:
233 const char* get_name() const ; ///< Returns the EOS name
234
235 /// Sets the EOS name
236 void set_name(const char* name_i) ;
237
238 // Miscellaneous
239 // -------------
240 public:
241 /** Construction of an EOS from a binary file.
242 * The file must have been created by the function \c sauve(FILE*) .
243 */
244 static Eos* eos_from_file(FILE* ) ;
245
246 /** Construction of an EOS from a formatted file.
247 *
248 * The fist line of the file must start by the EOS number, according
249 * to the following conventions:
250 * - 1 = relativistic polytropic EOS (class \c Eos_poly ).
251 * - 2 = Newtonian polytropic EOS (class \c Eos_poly_newt ).
252 * - 3 = Relativistic incompressible EOS (class \c Eos_incomp ).
253 * - 4 = Newtonian incompressible EOS (class \c Eos_incomp_newt ).
254 * - 5 = Strange matter (MIT Bag model)
255 * - 6 = Strange matter (MIT Bag model) with crust
256 * - 10 = SLy4 (Douchin \& Haensel 2001)
257 * - 11 = FPS (Friedman-Pandharipande + Skyrme)
258 * - 12 = BPAL12 (Bombaci et al. 1995)
259 * - 13 = AkmalPR (Akmal, Pandharipande \& Ravenhall 1998)
260 * - 14 = BBB2 (Baldo, Bombaci \& Burgio 1997)
261 * - 15 = BalbN1H1 (Balberg 2000)
262 * - 16 = GlendNH3 (Glendenning 1985, case 3)
263 * - 17 = Compstar (Tabulated EOS for 2010 CompStar school)
264 * - 18 = magnetized (tabulated) equation of state
265 * - 19 = relativistic ideal Fermi gas at zero temperature (class \c Eos_Fermi)
266 * - 100 = Multi-domain EOS (class \c MEos )
267 * - 110 = Multi-polytropic EOS (class \c Eos_multi_poly )
268 * - 120 = Fitted SLy4 (Shibata 2004)
269 * - 121 = Fitted FPS (Shibata 2004)
270 * - 122 = Fitted AkmalPR (Taniguchi 2005)
271 *
272 * The second line in the file should contain a name given by the user to the EOS.
273 * The following lines should contain the EOS parameters (one
274 * parameter per line), in the same order than in the class declaration.
275 */
276 static Eos* eos_from_file(ifstream& ) ;
277
278 /// Comparison operator (egality)
279 virtual bool operator==(const Eos& ) const = 0 ;
280
281 /// Comparison operator (difference)
282 virtual bool operator!=(const Eos& ) const = 0 ;
283
284 /** Returns a number to identify the sub-classe of \c Eos the
285 * object belongs to.
286 */
287 virtual int identify() const = 0 ;
288
289 // Outputs
290 // -------
291
292 public:
293 virtual void sauve(FILE* ) const ; ///< Save in a file
294
295 /// Display
296 friend ostream& operator<<(ostream& , const Eos& ) ;
297
298 protected:
299 virtual ostream& operator>>(ostream &) const = 0 ; ///< Operator >>
300
301
302 // Computational functions
303 // -----------------------
304 protected:
305 /** General computational method for \c Cmp 's
306 *
307 * @param thermo [input] thermodynamical quantity (for instance the
308 * enthalpy field)from which the
309 * thermodynamical quantity \c resu is to be computed.
310 * @param nzet [input] number of domains where \c resu is to be
311 * computed.
312 * @param l_min [input] index of the innermost domain is which \c resu
313 * is to be computed [default value: 0]; \c resu is
314 * computed only in domains whose indices are in
315 * \c [l_min,l_min+nzet-1] . In the other
316 * domains, it is set to zero.
317 * @param fait [input] pointer on the member function of class
318 * \c Eos which performs the pointwise calculation.
319 * @param par possible extra parameters of the EOS
320 * @param resu [output] result of the computation.
321 */
322 void calcule(const Cmp& thermo, int nzet, int l_min,
323 double (Eos::*fait)(double, const Param*) const, const Param* par, Cmp& resu) const ;
324
325 /** General computational method for \c Scalar 's
326 *
327 * @param thermo [input] thermodynamical quantity (for instance the
328 * enthalpy field)from which the
329 * thermodynamical quantity \c resu is to be computed.
330 * @param nzet [input] number of domains where \c resu is to be
331 * computed.
332 * @param l_min [input] index of the innermost domain is which \c resu
333 * is to be computed [default value: 0]; \c resu is
334 * computed only in domains whose indices are in
335 * \c [l_min,l_min+nzet-1] . In the other
336 * domains, it is set to zero.
337 * @param fait [input] pointer on the member function of class
338 * \c Eos which performs the pointwise calculation.
339 * @param par possible extra parameters of the EOS
340 * @param resu [output] result of the computation.
341 */
342
343
344 void calcule(const Scalar& thermo, int nzet, int l_min,
345 double (Eos::*fait)(double, const Param*) const, const Param* par, Scalar& resu) const ;
346
347 public:
348 /** Computes the baryon density from the log-enthalpy and extra parameters
349 * (virtual function implemented in the derived classes).
350 *
351 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
352 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
353 * where \e e is the (total) energy density, \e p the pressure,
354 * \e n the baryon density, and \f$m_B\f$ the baryon mass
355 * @param par possible extra parameters of the EOS
356 *
357 * @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
358 *
359 */
360 virtual double nbar_ent_p(double ent, const Param* par=0x0) const = 0 ;
361
362 /** Computes the baryon density field from the log-enthalpy field and
363 * extra parameters
364 *
365 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
366 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
367 * where \e e is the (total) energy density, \e p the pressure,
368 * \e n the baryon density, and \f$m_B\f$ the baryon mass
369 * @param nzet number of domains where the baryon density is to be
370 * computed.
371 * @param l_min index of the innermost domain is which the baryon
372 * density is
373 * to be computed [default value: 0]; the baryon density is
374 * computed only in domains whose indices are in
375 * \c [l_min,l_min+nzet-1] . In the other
376 * domains, it is set to zero.
377 * @param par possible extra parameters of the EOS
378 *
379 * @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
380 *
381 */
382 Cmp nbar_ent(const Cmp& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
383
384 /** Computes the baryon density field from the log-enthalpy field and
385 * extra parameters
386 *
387 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
388 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
389 * where \e e is the (total) energy density, \e p the pressure,
390 * \e n the baryon density, and \f$m_B\f$ the baryon mass
391 * @param nzet number of domains where the baryon density is to be
392 * computed.
393 * @param l_min index of the innermost domain is which the baryon
394 * density is
395 * to be computed [default value: 0]; the baryon density is
396 * computed only in domains whose indices are in
397 * \c [l_min,l_min+nzet-1] . In the other
398 * domains, it is set to zero.
399 * @param par possible extra parameters of the EOS
400 *
401 * @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
402 *
403 */
404
405 Scalar nbar_ent(const Scalar& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
406
407 /** Computes the total energy density from the log-enthalpy and extra parameters
408 * (virtual function implemented in the derived classes).
409 *
410 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
411 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
412 * where \e e is the (total) energy density, \e p the pressure,
413 * \e n the baryon density, and \f$m_B\f$ the baryon mass
414 * @param par possible extra parameters of the EOS
415 *
416 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
417 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
418 */
419 virtual double ener_ent_p(double ent, const Param* par=0x0) const = 0 ;
420
421 /** Computes the total energy density from the log-enthalpy and extra parameters.
422 *
423 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
424 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
425 * where \e e is the (total) energy density, \e p the pressure,
426 * \e n the baryon density, and \f$m_B\f$ the baryon mass
427 * @param nzet number of domains where the energy density is to be
428 * computed.
429 * @param l_min index of the innermost domain is which the energy
430 * density is
431 * to be computed [default value: 0]; the energy density is
432 * computed only in domains whose indices are in
433 * \c [l_min,l_min+nzet-1] . In the other
434 * domains, it is set to zero.
435 * @param par possible extra parameters of the EOS
436 *
437 * @return energy density [unit: \f$\rho_{\rm nuc} c^2\f$], where
438 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
439 */
440 Cmp ener_ent(const Cmp& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
441
442 /** Computes the total energy density from the log-enthalpy and extra parameters.
443 *
444 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
445 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
446 * where \e e is the (total) energy density, \e p the pressure,
447 * \e n the baryon density, and \f$m_B\f$ the baryon mass
448 * @param nzet number of domains where the energy density is to be
449 * computed.
450 * @param l_min index of the innermost domain is which the energy
451 * density is
452 * to be computed [default value: 0]; the energy density is
453 * computed only in domains whose indices are in
454 * \c [l_min,l_min+nzet-1] . In the other
455 * domains, it is set to zero.
456 * @param par possible extra parameters of the EOS
457 *
458 * @return energy density [unit: \f$\rho_{\rm nuc} c^2\f$], where
459 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
460 */
461
462 Scalar ener_ent(const Scalar& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
463
464 /** Computes the pressure from the log-enthalpy and extra parameters
465 * (virtual function implemented in the derived classes).
466 *
467 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
468 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
469 * where \e e is the (total) energy density, \e p the pressure,
470 * \e n the baryon density, and \f$m_B\f$ the baryon mass
471 * @param par possible extra parameters of the EOS
472 *
473 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
474 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
475 */
476 virtual double press_ent_p(double ent, const Param* par=0x0) const = 0 ;
477
478
479 /** Computes the pressure from the log-enthalpy and extra parameters
480 *
481 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
482 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
483 * where \e e is the (total) energy density, \e p the pressure,
484 * \e n the baryon density, and \f$m_B\f$ the baryon mass
485 * @param nzet number of domains where the pressure is to be
486 * computed.
487 * @param l_min index of the innermost domain is which the pressure is
488 * to be computed [default value: 0]; the pressure is computed
489 * only in domains whose indices are in
490 * \c [l_min,l_min+nzet-1] . In the other
491 * domains, it is set to zero.
492 * @param par possible extra parameters of the EOS
493 *
494 * @return pressure [unit: \f$\rho_{\rm nuc} c^2\f$], where
495 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
496 *
497 */
498 Cmp press_ent(const Cmp& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
499
500 /** Computes the pressure from the log-enthalpy and extra parameters
501 *
502 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
503 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
504 * where \e e is the (total) energy density, \e p the pressure,
505 * \e n the baryon density, and \f$m_B\f$ the baryon mass
506 * @param nzet number of domains where the pressure is to be
507 * computed.
508 * @param l_min index of the innermost domain is which the pressure is
509 * to be computed [default value: 0]; the pressure is computed
510 * only in domains whose indices are in
511 * \c [l_min,l_min+nzet-1] . In the other
512 * domains, it is set to zero.
513 * @param par possible extra parameters of the EOS
514 *
515 * @return pressure [unit: \f$\rho_{\rm nuc} c^2\f$], where
516 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
517 *
518 */
519
520 Scalar press_ent(const Scalar& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
521
522 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
523 * from the log-enthalpy and extra parameters
524 * (virtual function implemented in the derived classes).
525 *
526 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
527 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
528 * where \e e is the (total) energy density, \e p the pressure,
529 * \e n the baryon density, and \f$m_B\f$ the baryon mass
530 * @param par possible extra parameters of the EOS
531 *
532 * @return dln(n)/dln(H)
533 */
534 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const = 0 ;
535
536 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
537 * from the log-enthalpy and extra parameters
538 *
539 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
540 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
541 * where \e e is the (total) energy density, \e p the pressure,
542 * \e n the baryon density, and \f$m_B\f$ the baryon mass
543 * @param nzet number of domains where the derivative
544 * dln(n)/dln(H) is to be computed.
545 * @param l_min index of the innermost domain is which the
546 * coefficient dln(n)/dln(H) is
547 * to be computed [default value: 0]; the derivative
548 * dln(n)/dln(H) is
549 * computed only in domains whose indices are in
550 * \c [l_min,l_min+nzet-1] . In the other
551 * domains, it is set to zero.
552 * @param par possible extra parameters of the EOS
553 *
554 * @return dln(n)/dln(H)
555 *
556 */
557 Cmp der_nbar_ent(const Cmp& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
558
559 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
560 * from the log-enthalpy and extra parameters
561 *
562 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
563 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
564 * where \e e is the (total) energy density, \e p the pressure,
565 * \e n the baryon density, and \f$m_B\f$ the baryon mass
566 * @param nzet number of domains where the derivative
567 * dln(n)/dln(H) is to be computed.
568 * @param l_min index of the innermost domain is which the
569 * coefficient dln(n)/dln(H) is
570 * to be computed [default value: 0]; the derivative
571 * dln(n)/dln(H) is
572 * computed only in domains whose indices are in
573 * \c [l_min,l_min+nzet-1] . In the other
574 * domains, it is set to zero.
575 * @param par possible extra parameters of the EOS
576 *
577 * @return dln(n)/dln(H)
578 *
579 */
580
581 Scalar der_nbar_ent(const Scalar& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
582
583 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
584 * from the log-enthalpy with extra parameters
585 * (virtual function implemented in the derived classes).
586 *
587 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
588 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
589 * where \e e is the (total) energy density, \e p the pressure,
590 * \e n the baryon density, and \f$m_B\f$ the baryon mass
591 * @param par possible extra parameters of the EOS
592 *
593 * @return dln(e)/dln(H)
594 */
595 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const = 0 ;
596
597 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
598 * from the log-enthalpy and extra parameters
599 *
600 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
601 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
602 * where \e e is the (total) energy density, \e p the pressure,
603 * \e n the baryon density, and \f$m_B\f$ the baryon mass
604 * @param nzet number of domains where the derivative
605 * dln(e)/dln(H) is to be computed.
606 * @param l_min index of the innermost domain is which the
607 * coefficient dln(n)/dln(H) is
608 * to be computed [default value: 0]; the derivative
609 * dln(e)/dln(H) is
610 * computed only in domains whose indices are in
611 * \c [l_min,l_min+nzet-1] . In the other
612 * domains, it is set to zero.
613 * @param par possible extra parameters of the EOS
614 *
615 * @return dln(e)/dln(H)
616 *
617 */
618 Cmp der_ener_ent(const Cmp& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
619
620 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
621 * from the log-enthalpy and extra parameters
622 *
623 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
624 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
625 * where \e e is the (total) energy density, \e p the pressure,
626 * \e n the baryon density, and \f$m_B\f$ the baryon mass
627 * @param nzet number of domains where the derivative
628 * dln(e)/dln(H) is to be computed.
629 * @param l_min index of the innermost domain is which the
630 * coefficient dln(n)/dln(H) is
631 * to be computed [default value: 0]; the derivative
632 * dln(e)/dln(H) is
633 * computed only in domains whose indices are in
634 * \c [l_min,l_min+nzet-1] . In the other
635 * domains, it is set to zero.
636 * @param par possible extra parameters of the EOS
637 *
638 * @return dln(e)/dln(H)
639 *
640 */
641
642 Scalar der_ener_ent(const Scalar& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
643
644 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
645 * from the log-enthalpy and extra parameters
646 * (virtual function implemented in the derived classes).
647 *
648 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
649 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
650 * where \e e is the (total) energy density, \e p the pressure,
651 * \e n the baryon density, and \f$m_B\f$ the baryon mass
652 * @param par possible extra parameters of the EOS
653 *
654 * @return dln(p)/dln(H)
655 */
656 virtual double der_press_ent_p(double ent, const Param* par=0x0) const = 0 ;
657
658 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
659 * from the log-enthalpy and extra parameters
660 *
661 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
662 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
663 * where \e e is the (total) energy density, \e p the pressure,
664 * \e n the baryon density, and \f$m_B\f$ the baryon mass
665 * @param nzet number of domains where the derivative
666 * dln(p)/dln(H) is to be computed.
667 * @param par possible extra parameters of the EOS
668 * @param l_min index of the innermost domain is which the
669 * coefficient dln(n)/dln(H) is
670 * to be computed [default value: 0]; the derivative
671 * dln(p)/dln(H) is
672 * computed only in domains whose indices are in
673 * \c [l_min,l_min+nzet-1] . In the other
674 * domains, it is set to zero.
675 *
676 * @return dln(p)/dln(H)
677 *
678 */
679 Cmp der_press_ent(const Cmp& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
680
681 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
682 * from the log-enthalpy and extra parameters
683 *
684 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
685 * \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
686 * where \e e is the (total) energy density, \e p the pressure,
687 * \e n the baryon density, and \f$m_B\f$ the baryon mass
688 * @param nzet number of domains where the derivative
689 * dln(p)/dln(H) is to be computed.
690 * @param par possible extra parameters of the EOS
691 * @param l_min index of the innermost domain is which the
692 * coefficient dln(n)/dln(H) is
693 * to be computed [default value: 0]; the derivative
694 * dln(p)/dln(H) is
695 * computed only in domains whose indices are in
696 * \c [l_min,l_min+nzet-1] . In the other
697 * domains, it is set to zero.
698 *
699 * @return dln(p)/dln(H)
700 *
701 */
702
703 Scalar der_press_ent(const Scalar& ent, int nzet, int l_min = 0, const Param* par=0x0) const ;
704
705 };
706 ostream& operator<<(ostream& , const Eos& ) ;
707
708
709 //------------------------------------//
710 // class Eos_poly //
711 //------------------------------------//
712
713
714 /**
715 * Polytropic equation of state (relativistic case).
716 *
717 * This equation of state (EOS) corresponds to identical relativistic
718 * particles of rest mass is \f$m_0\f$, whose total energy density \e e is
719 * related to their numerical density \e n by
720 * \f[
721 * e(n) = {\kappa \over \gamma-1} n^\gamma + \mu_0 \, n \ , \qquad \qquad (1)
722 * \f]
723 * where \f$\mu_0\f$ is the chemical potential at zero pressure.
724 * The relativistic (i.e. including rest mass energy) chemical potential is
725 * then
726 * \f[
727 * \mu(n) := {de\over dn} = {\kappa \gamma \over \gamma-1} n^{\gamma-1}
728 * + \mu_0 \ .\qquad \qquad (2)
729 * \f]
730 * The pressure is given by the (zero-temperature) First Law of Thermodynamics:
731 * \f$p = \mu n - e\f$, so that
732 * \f[
733 * p(n) = \kappa n^\gamma \ . \qquad \qquad (3)
734 * \f]
735 * The log-enthalpy is defined as the logarithm of the ratio of the enthalpy
736 * par particle by the partical rest mass energy :
737 * \f[
738 * H(n) := c^2 \ln \left( {e+p \over m_0 c^2\, n} \right) \ . \qquad \qquad (4)
739 * \f]
740 * According to the (zero-temperature) First Law of Thermodynamics, the
741 * log-enthalpy is related to the chemical potential by
742 * \f[
743 * H = c^2 \ln \left( {\mu \over m_0 c^2} \right) \ . \qquad \qquad (5)
744 * \f]
745 * From this expression and relation (2), the expression
746 * of the particle density in term of the log-enthalpy is
747 * \f[
748 * n(H) = \left[ {\gamma-1\over \gamma} {m_0 c^2 \over \kappa}
749 \left( \exp(H) - {\mu_0\over m_0 c^2} \right)
750 * \right] ^{1/(\gamma-1)} \ . \qquad \qquad (6)
751 * \f]
752 * The energy density and pressure as functions of \e H can then be obtained
753 * by inserting this relation into Eqs. (1) and (3).
754 *
755 *\ingroup (eos)
756 */
757 class Eos_poly : public Eos {
758
759 // Data :
760 // -----
761
762 protected:
763 /// Adiabatic index \f$\gamma\f$ (cf. Eq. (3))
764 double gam ;
765
766 /** Pressure coefficient \f$\kappa\f$ (cf. Eq. (3))
767 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
768 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
769 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
770 */
771 double kap ;
772
773 /** Individual particule mass \f$m_0\f$ (cf. Eq. (1))
774 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
775 */
776 double m_0 ;
777
778 /** Relativistic chemical potential at zero pressure
779 * [unit: \f$m_B c^2\f$, with \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
780 * (standard value: 1)
781 */
782 double mu_0 ;
783
784
785
786 double gam1 ; ///< \f$\gamma-1\f$
787 double unsgam1 ; ///< \f$1/(\gamma-1)\f$
788 double gam1sgamkap ; ///< \f$(\gamma-1) / (\gamma \kappa) m_0\f$
789 double rel_mu_0 ; ///< \f$\mu_0/m_0\f$
790 double ent_0 ; ///< Enthalpy at zero pressure (\f$\ln (\mu_0/m_0)\f$)
791
792 // Constructors - Destructor
793 // -------------------------
794 public:
795
796 /** Standard constructor (sets both \c m_0 and \c mu_0 to 1).
797 *
798 * The individual particle mass \f$m_0\f$ is set to the mean baryon
799 * mass \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$.
800 *
801 * @param gamma adiabatic index \f$\gamma\f$
802 * (cf. Eq. (3))
803 * @param kappa pressure coefficient \f$\kappa\f$
804 * (cf. Eq. (3))
805 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
806 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
807 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$
808 */
809 Eos_poly(double gamma, double kappa) ;
810
811 /** Standard constructor with individual particle mass
812 * (sets \c mu_0 to 1).
813 * @param gamma adiabatic index \f$\gamma\f$ (cf. Eq. (3))
814 * @param kappa pressure coefficient \f$\kappa\f$
815 * (cf. Eq. (3))
816 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
817 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
818 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$
819 * @param mass individual particule mass \f$m_0\f$
820 * (cf. Eq. (1)
821 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$]
822 */
823 Eos_poly(double gamma, double kappa, double mass) ;
824
825 /** Standard constructor with individual particle mass and zero-pressure
826 * chemical potential
827 *
828 * @param gamma adiabatic index \f$\gamma\f$ (cf. Eq. (3))
829 * @param kappa pressure coefficient \f$\kappa\f$
830 * (cf. Eq. (3))
831 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
832 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
833 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$
834 * @param mass individual particule mass \f$m_0\f$
835 * (cf. Eq. (1))
836 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$]
837 * @param mu_zero Relativistic chemical potential at zero pressure
838 * [unit: \f$m_B c^2\f$, with \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
839 * (standard value: 1)
840 */
841 Eos_poly(double gamma, double kappa, double mass, double mu_zero) ;
842
843 Eos_poly(const Eos_poly& ) ; ///< Copy constructor
844
845 protected:
846 /** Constructor from a binary file (created by the function
847 * \c sauve(FILE*) ).
848 * This constructor is protected because any EOS construction
849 * from a binary file must be done via the function
850 * \c Eos::eos_from_file(FILE*) .
851 */
852 Eos_poly(FILE* ) ;
853
854 /** Constructor from a formatted file.
855 * This constructor is protected because any EOS construction
856 * from a formatted file must be done via the function
857 * \c Eos::eos_from_file(ifstream&) .
858 */
859 Eos_poly(ifstream& ) ;
860
861 /// The construction functions from a file
862 friend Eos* Eos::eos_from_file(FILE* ) ;
863 friend Eos* Eos::eos_from_file(ifstream& ) ;
864
865 public:
866 virtual ~Eos_poly() ; ///< Destructor
867
868 // Assignment
869 // ----------
870 /// Assignment to another \c Eos_poly
871 void operator=(const Eos_poly& ) ;
872
873
874 // Miscellaneous
875 // -------------
876
877 public :
878 /// Comparison operator (egality)
879 virtual bool operator==(const Eos& ) const ;
880
881 /// Comparison operator (difference)
882 virtual bool operator!=(const Eos& ) const ;
883
884 /** Returns a number to identify the sub-classe of \c Eos the
885 * object belongs to.
886 */
887 virtual int identify() const ;
888
889 /// Returns the adiabatic index \f$\gamma\f$ (cf. Eq. (3))
890 double get_gam() const ;
891
892 /** Returns the pressure coefficient \f$\kappa\f$ (cf. Eq. (3))
893 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
894 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
895 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
896 */
897 double get_kap() const ;
898
899 /** Return the individual particule mass \f$m_0\f$
900 * (cf. Eq. (1))
901 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
902 */
903 double get_m_0() const ;
904
905 /** Return the relativistic chemical potential at zero pressure
906 * [unit: \f$m_B c^2\f$, with \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
907 */
908 double get_mu_0() const ;
909
910 protected:
911 /** Computes the auxiliary quantities \c gam1 , \c unsgam1 ,
912 * \c gam1sgamkap from the values of \c gam and \c kap
913 */
914 void set_auxiliary() ;
915
916
917 // Outputs
918 // -------
919
920 public:
921 virtual void sauve(FILE* ) const ; ///< Save in a file
922
923 protected:
924 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
925
926
927 // Computational functions
928 // -----------------------
929
930 public:
931 /** Computes the baryon density from the log-enthalpy.
932 *
933 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
934 * Eq. (4)
935 *
936 * @param par possible extra parameters of the EOS
937 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
938 *
939 */
940 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
941
942 /** Computes the total energy density from the log-enthalpy.
943 *
944 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
945 * Eq. (4)
946 *
947 * @param par possible extra parameters of the EOS
948 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
949 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
950 */
951 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
952
953 /** Computes the pressure from the log-enthalpy.
954 *
955 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
956 * Eq. (4)
957 *
958 * @param par possible extra parameters of the EOS
959 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
960 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
961 */
962 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
963
964 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
965 * from the log-enthalpy.
966 *
967 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
968 * Eq. (4)
969 *
970 * @param par possible extra parameters of the EOS
971 * @return dln(n)/dln(H)
972 */
973 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
974
975 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
976 * from the log-enthalpy.
977 *
978 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
979 * Eq. (4)
980 *
981 * @param par possible extra parameters of the EOS
982 * @return dln(e)/dln(H)
983 */
984 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
985
986 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
987 * from the log-enthalpy.
988 *
989 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
990 * Eq. (4)
991 *
992 * @param par possible extra parameters of the EOS
993 * @return dln(p)/dln(H)
994 */
995 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
996
997 };
998
999 //------------------------------------//
1000 // class Eos_poly_newt //
1001 //------------------------------------//
1002
1003
1004
1005 /**
1006 * Polytropic equation of state (Newtonian case). \ingroup (eos)
1007 *
1008 * This equation of state (EOS) corresponds to identical non relativistic
1009 * particles of rest mass is \f$m_0\f$, whose internal energy density \f$\epsilon\f$ is
1010 * related to their numerical density \e n by
1011 * \f[
1012 * \epsilon(n) = {\kappa \over \gamma-1} n^\gamma \ . \qquad\qquad (1)
1013 * \f]
1014 * The (non-relativistic) chemical potential is
1015 * then
1016 * \f[
1017 * \mu(n) := {d\epsilon\over dn} = {\kappa \gamma \over \gamma-1} n^{\gamma-1}
1018 * \ . \qquad\qquad (2)
1019 * \f]
1020 * The pressure is given by the (zero-temperature) First Law of Thermodynamics:
1021 * \f$p = \mu n - \epsilon\f$, so that
1022 * \f[
1023 * p(n) = \kappa n^\gamma \ . \qquad\qquad (3)
1024 * \f]
1025 * The (non-relativistic) specific enthalpy is :
1026 * \f[
1027 * h(n) := {\epsilon + p \over m_0 n} \ . \qquad\qquad (4)
1028 * \f]
1029 * According to the (zero-temperature) First Law of Thermodynamics, the
1030 * specific enthalpy is related to the chemical potential by
1031 * \f[
1032 * h = {\mu \over m_0} \ . \qquad\qquad (5)
1033 * \f]
1034 * From this expression and relation (2), the expression
1035 * of the particle density in term of the specific enthalpy is
1036 * \f[
1037 * n(h) = \left[ {\gamma-1\over \gamma} {m_0 \over \kappa} h
1038 * \right] ^{1/(\gamma-1)} \ . \qquad\qquad (6)
1039 * \f]
1040 * The energy density and pressure as functions of \e H can then be obtained
1041 * by inserting this relation into Eq. (1) and (3).
1042 *
1043 */
1044 class Eos_poly_newt : public Eos_poly {
1045
1046 // Data :
1047 // -----
1048
1049 // no new data with respect to Eos_poly
1050
1051 // Constructors - Destructor
1052 // -------------------------
1053 public:
1054
1055 /** Standard constructor.
1056 *
1057 * The individual particle mass \f$m_0\f$ is set to the mean baryon
1058 * mass \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$.
1059 *
1060 * @param gamma adiabatic index \f$\gamma\f$
1061 * (cf. Eq. (3))
1062 * @param kappa pressure coefficient \f$\kappa\f$
1063 * (cf. Eq. (3))
1064 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
1065 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
1066 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$
1067 */
1068 Eos_poly_newt(double gamma, double kappa) ;
1069
1070 Eos_poly_newt(const Eos_poly_newt& ) ; ///< Copy constructor
1071
1072 protected:
1073 /** Constructor from a binary file (created by the function
1074 * \c sauve(FILE*) ).
1075 * This constructor is protected because any EOS construction
1076 * from a binary file must be done via the function
1077 * \c Eos::eos_from_file(FILE*) .
1078 */
1079 Eos_poly_newt(FILE* ) ;
1080
1081 /** Constructor from a formatted file.
1082 * This constructor is protected because any EOS construction
1083 * from a formatted file must be done via the function
1084 * \c Eos::eos_from_file(ifstream&) .
1085 */
1086 Eos_poly_newt(ifstream& ) ;
1087
1088 /// The construction functions from a file
1089 friend Eos* Eos::eos_from_file(FILE* ) ;
1090 friend Eos* Eos::eos_from_file(ifstream& ) ;
1091
1092
1093 public:
1094 virtual ~Eos_poly_newt() ; ///< Destructor
1095
1096 // Assignment
1097 // ----------
1098 /// Assignment to another \c Eos_poly_newt
1099 void operator=(const Eos_poly_newt& ) ;
1100
1101 // Miscellaneous
1102 // -------------
1103
1104 public :
1105 /// Comparison operator (egality)
1106 virtual bool operator==(const Eos& ) const ;
1107
1108 /// Comparison operator (difference)
1109 virtual bool operator!=(const Eos& ) const ;
1110
1111 /** Returns a number to identify the sub-classe of \c Eos the
1112 * object belongs to.
1113 */
1114 virtual int identify() const ;
1115
1116 // Outputs
1117 // -------
1118
1119 public:
1120 virtual void sauve(FILE* ) const ; ///< Save in a file
1121
1122 protected:
1123 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1124
1125
1126 // Computational functions
1127 // -----------------------
1128
1129 public:
1130 /** Computes the baryon density from the specific enthalpy.
1131 *
1132 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H defined by
1133 * Eq. (4)
1134 *
1135 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1136 *
1137 */
1138 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
1139
1140 /** Computes the total energy density from the specific enthalpy.
1141 *
1142 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H defined by
1143 * Eq. (4)
1144 *
1145 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
1146 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1147 */
1148 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
1149
1150 /** Computes the pressure from the specific enthalpy.
1151 *
1152 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H defined by
1153 * Eq. (4)
1154 *
1155 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1156 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1157 */
1158 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
1159
1160 /** Computes the logarithmic derivative \f$d\ln n/d\ln h\f$
1161 * from the specific enthalpy.
1162 *
1163 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H defined by
1164 * Eq. (4)
1165 *
1166 * @return dln(n)/dln(h)
1167 */
1168 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
1169
1170 /** Computes the logarithmic derivative \f$d\ln e/d\ln h\f$
1171 * from the specific enthalpy.
1172 *
1173 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H defined by
1174 * Eq. (4)
1175 *
1176 * @return dln(e)/dln(h)
1177 */
1178 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
1179
1180 /** Computes the logarithmic derivative \f$d\ln p/d\ln h\f$
1181 * from the specific enthalpy.
1182 *
1183 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H defined by
1184 * Eq. (4)
1185 *
1186 * @return dln(p)/dln(h)
1187 */
1188 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
1189
1190 };
1191
1192
1193 //------------------------------------//
1194 // class Eos_incomp //
1195 //------------------------------------//
1196
1197
1198 /**
1199 * Equation of state of incompressible matter (relativistic case).
1200 *
1201 * This equation of state (EOS) corresponds to a constant density
1202 * matter \f$e = \rho_0 \, c^2\f$.
1203 * \ingroup (eos)
1204 *
1205 */
1206 class Eos_incomp : public Eos {
1207
1208 // Data :
1209 // -----
1210
1211 protected:
1212 /// Constant density \f$\rho_0\f$
1213 double rho0 ;
1214
1215 /** Log-enthalpy threshold for setting the energy density to
1216 * a non zero value (should be negative).
1217 */
1218 double ent0 ;
1219
1220 // Constructors - Destructor
1221 // -------------------------
1222 public:
1223
1224 /** Standard constructor.
1225 *
1226 * The log-enthalpy threshold for non-zero density is set
1227 * -1.e-6.
1228 *
1229 * @param rho_c constant density \f$\rho_0\f$
1230 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
1231 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1232 */
1233 Eos_incomp(double rho_c) ;
1234
1235 /** Standard constructor with log-enthalpy threshold.
1236 *
1237 * @param rho_c constant density \f$\rho_0\f$
1238 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
1239 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1240 * @param ent_c log-enthalpy threshold for non-zero density
1241 * [unit: \f$c^2\f$] :
1242 * the energy density is set to \c rho_c} for
1243 * \f$H > {\tt ent_c}\f$.
1244 */
1245 Eos_incomp(double rho_c, double ent_c) ;
1246
1247 Eos_incomp(const Eos_incomp& ) ; ///< Copy constructor
1248
1249 protected:
1250 /** Constructor from a binary file (created by the function
1251 * \c sauve(FILE*) ).
1252 * This constructor is protected because any EOS construction
1253 * from a binary file must be done via the function
1254 * \c Eos::eos_from_file(FILE*) .
1255 */
1256 Eos_incomp(FILE* ) ;
1257
1258 /** Constructor from a formatted file.
1259 * This constructor is protected because any EOS construction
1260 * from a formatted file must be done via the function
1261 * \c Eos::eos_from_file(ifstream&) .
1262 */
1263 Eos_incomp(ifstream& ) ;
1264
1265 /// The construction functions from a file
1266 friend Eos* Eos::eos_from_file(FILE* ) ;
1267 friend Eos* Eos::eos_from_file(ifstream& ) ;
1268
1269 public:
1270 virtual ~Eos_incomp() ; ///< Destructor
1271
1272 // Assignment
1273 // ----------
1274 /// Assignment to another \c Eos_incomp
1275 void operator=(const Eos_incomp& ) ;
1276
1277
1278 // Miscellaneous
1279 // -------------
1280
1281 public :
1282 /// Comparison operator (egality)
1283 virtual bool operator==(const Eos& ) const ;
1284
1285 /// Comparison operator (difference)
1286 virtual bool operator!=(const Eos& ) const ;
1287
1288 /** Returns a number to identify the sub-classe of \c Eos the
1289 * object belongs to.
1290 */
1291 virtual int identify() const ;
1292
1293 // Outputs
1294 // -------
1295
1296 public:
1297 virtual void sauve(FILE* ) const ; ///< Save in a file
1298
1299 protected:
1300 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1301
1302
1303 // Computational functions
1304 // -----------------------
1305
1306 public:
1307 /** Computes the baryon density from the log-enthalpy.
1308 *
1309 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1310 *
1311 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1312 *
1313 */
1314 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
1315
1316 /** Computes the total energy density from the log-enthalpy.
1317 *
1318 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1319 *
1320 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
1321 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1322 */
1323 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
1324
1325 /** Computes the pressure from the log-enthalpy.
1326 *
1327 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1328 *
1329 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1330 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1331 */
1332 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
1333
1334 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
1335 * from the log-enthalpy.
1336 *
1337 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1338 *
1339 * @return dln(n)/dln(H)
1340 */
1341 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
1342
1343 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
1344 * from the log-enthalpy.
1345 *
1346 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1347 *
1348 * @return dln(e)/dln(H)
1349 */
1350 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
1351
1352 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
1353 * from the log-enthalpy.
1354 *
1355 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1356 *
1357 * @return dln(p)/dln(H)
1358 */
1359 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
1360
1361 };
1362
1363 //------------------------------------//
1364 // class Eos_incomp_newt //
1365 //------------------------------------//
1366
1367
1368 /**
1369 * Equation of state of incompressible matter (Newtonian case).
1370 *
1371 * This equation of state (EOS) corresponds to a constant density
1372 * matter \f$\rho = \rho_0\f$.
1373 * \ingroup (eos)
1374 *
1375 */
1376 class Eos_incomp_newt : public Eos_incomp {
1377
1378 // Data :
1379 // -----
1380
1381 // no new data with respect to Eos_incomp
1382
1383 // Constructors - Destructor
1384 // -------------------------
1385 public:
1386
1387 /** Standard constructor.
1388 *
1389 * The log-enthalpy threshold for non-zero density is set
1390 * -1.e-6.
1391 *
1392 * @param rho_c constant density \f$\rho_0\f$
1393 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
1394 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1395 */
1396 Eos_incomp_newt(double rho_c) ;
1397
1398 /** Standard constructor with specific enthalpy threshold.
1399 *
1400 * @param rho_c constant density \f$\rho_0\f$
1401 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
1402 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1403 * @param ent_c specific enthalpy threshold for non-zero density
1404 * [unit: \f$c^2\f$] :
1405 * the energy density is set to \c rho_c for
1406 * \f$h > {\tt ent_c}\f$.
1407 */
1408 Eos_incomp_newt(double rho_c, double ent_c) ;
1409
1410 Eos_incomp_newt(const Eos_incomp_newt& ) ; ///< Copy constructor
1411
1412 protected:
1413 /** Constructor from a binary file (created by the function
1414 * \c sauve(FILE*) ).
1415 * This constructor is protected because any EOS construction
1416 * from a binary file must be done via the function
1417 * \c Eos::eos_from_file(FILE*) .
1418 */
1419 Eos_incomp_newt(FILE* ) ;
1420
1421 /** Constructor from a formatted file.
1422 * This constructor is protected because any EOS construction
1423 * from a formatted file must be done via the function
1424 * \c Eos::eos_from_file(ifstream&) .
1425 */
1426 Eos_incomp_newt(ifstream& ) ;
1427
1428 /// The construction functions from a file
1429 friend Eos* Eos::eos_from_file(FILE* ) ;
1430 friend Eos* Eos::eos_from_file(ifstream& ) ;
1431
1432 public:
1433 virtual ~Eos_incomp_newt() ; ///< Destructor
1434
1435 // Assignment
1436 // ----------
1437 /// Assignment to another \c Eos_incomp_newt
1438 void operator=(const Eos_incomp_newt& ) ;
1439
1440
1441 // Miscellaneous
1442 // -------------
1443
1444 public :
1445 /// Comparison operator (egality)
1446 virtual bool operator==(const Eos& ) const ;
1447
1448 /// Comparison operator (difference)
1449 virtual bool operator!=(const Eos& ) const ;
1450
1451 /** Returns a number to identify the sub-classe of \c Eos the
1452 * object belongs to.
1453 */
1454 virtual int identify() const ;
1455
1456 // Outputs
1457 // -------
1458
1459 public:
1460 virtual void sauve(FILE* ) const ; ///< Save in a file
1461
1462 protected:
1463 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1464
1465
1466 // Computational functions
1467 // -----------------------
1468
1469 public:
1470 /** Computes the baryon density from the specific enthalpy.
1471 *
1472 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H
1473 *
1474 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1475 *
1476 */
1477 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
1478
1479 /** Computes the total energy density from the specific enthalpy.
1480 *
1481 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H
1482 *
1483 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
1484 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1485 */
1486 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
1487
1488 /** Computes the pressure from the specific enthalpy.
1489 *
1490 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H
1491 *
1492 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1493 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1494 */
1495 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
1496
1497 /** Computes the logarithmic derivative \f$d\ln n/d\ln h\f$
1498 * from the specific enthalpy.
1499 *
1500 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H
1501 *
1502 * @return dln(n)/dln(h)
1503 */
1504 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
1505
1506 /** Computes the logarithmic derivative \f$d\ln e/d\ln h\f$
1507 * from the specific enthalpy.
1508 *
1509 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H
1510 *
1511 * @return dln(e)/dln(h)
1512 */
1513 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
1514
1515 /** Computes the logarithmic derivative \f$d\ln p/d\ln h\f$
1516 * from the specific enthalpy.
1517 *
1518 * @param ent [input, unit: \f$c^2\f$] specific enthalpy \e H
1519 *
1520 * @return dln(p)/dln(h)
1521 */
1522 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
1523
1524 };
1525
1526
1527 //------------------------------------//
1528 // class Eos_strange //
1529 //------------------------------------//
1530
1531
1532 /**
1533 * Strange matter EOS (MIT Bag model).
1534 *
1535 * This equation of state (EOS) corresponds to u,d,s degenerate symetric
1536 * matter in the MIT bag model, according to approximate formula
1537 * given in Zdunik, Astron. Astrophys. \b 359 , 311 (2000).
1538 *\ingroup (eos)
1539 */
1540 class Eos_strange : public Eos {
1541
1542 // Data :
1543 // -----
1544
1545 protected:
1546 /** Baryon density at zero pressure divided by \f$B_{60}^{3/4}\f$.
1547 * [unit: \f${\rm fm}^{-3}\f$]
1548 */
1549 double n0_b60 ;
1550
1551 /// Bag constant [unit: \f$60\ {\rm MeV\, fm}^{-3}\f$]
1552 double b60 ;
1553
1554 /** Log-enthalpy threshold for setting the energy density to
1555 * a non zero value (should be negative).
1556 */
1557 double ent0 ;
1558
1559 /** Fitting parameter \f$\epsilon_{\rm fit}\f$ related to the
1560 * square of sound velocity by \f$c_s^2 = 1/3(1+\epsilon_{\rm fit})\f$.
1561 * [cf. Zdunik, Astron. Astrophys. \b 359 , 311 (2000)]
1562 */
1563 double eps_fit ;
1564
1565 /** Energy density at zero pressure divided by \f$B_{60}\f$.
1566 * [unit: \f${\rm MeV\, fm^{-3}}\f$]
1567 */
1568 double rho0_b60 ;
1569
1570 /** Baryon density at zero pressure.
1571 * [unit: \f$0.1{\rm \ fm}^{-3}\f$ (Lorene's unit)]
1572 */
1573 double n0 ;
1574
1575 /** Energy density at zero pressure.
1576 * [unit: \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1577 * (Lorene's unit)]
1578 */
1579 double rho0 ;
1580
1581 /** \f$B_{60}^{3/4}\f$
1582 *
1583 */
1584 double b34 ;
1585
1586 /** Factor \f$(4+\epsilon_{\rm fit})/(1+\epsilon_{\rm fit})\f$
1587 *
1588 */
1589 double fach ;
1590
1591 // Constructors - Destructor
1592 // -------------------------
1593 public:
1594
1595 /** Standard constructor.
1596 *
1597 * @param n0_b60_i Baryon density at zero pressure divided
1598 * by \f$B_{60}^{3/4}\f$ [unit: \f${\rm fm}^{-3}\f$]
1599 * @param b60_i Bag constant [unit: \f$60\ {\rm MeV\, fm}^{-3}\f$]
1600 * @param ent0_i Log-enthalpy threshold for setting the energy
1601 * density to a non zero value (should be negative)
1602 * @param eps_fit_i Fitting parameter \f$\epsilon_{\rm fit}\f$ related
1603 * to the square of sound velocity by
1604 * \f$c_s^2 = 1/3(1+\epsilon_{\rm fit})\f$
1605 * [cf. Zdunik, Astron. Astrophys. \b 359 , 311 (2000)]
1606 * @param rho0_b60_i Energy density at zero pressure divided by
1607 * \f$B_{60}\f$ [unit: \f${\rm MeV\, fm^{-3}}\f$]
1608 *
1609 */
1610 Eos_strange(double n0_b60_i, double b60_i, double ent0_i,
1611 double eps_fit_i, double rho0_b60_i) ;
1612
1613
1614 Eos_strange(const Eos_strange& ) ; ///< Copy constructor
1615
1616 protected:
1617 /** Constructor from a binary file (created by the function
1618 * \c sauve(FILE*) ).
1619 * This constructor is protected because any EOS construction
1620 * from a binary file must be done via the function
1621 * \c Eos::eos_from_file(FILE*) .
1622 */
1623 Eos_strange(FILE* ) ;
1624
1625 /** Constructor from a formatted file.
1626 * This constructor is protected because any EOS construction
1627 * from a formatted file must be done via the function
1628 * \c Eos::eos_from_file(ifstream&) .
1629 */
1630 Eos_strange(ifstream& ) ;
1631
1632 /// The construction functions from a file
1633 friend Eos* Eos::eos_from_file(FILE* ) ;
1634 friend Eos* Eos::eos_from_file(ifstream& ) ;
1635
1636 public:
1637 virtual ~Eos_strange() ; ///< Destructor
1638
1639 // Assignment
1640 // ----------
1641 /// Assignment to another \c Eos_strange
1642 void operator=(const Eos_strange& ) ;
1643
1644
1645 // Miscellaneous
1646 // -------------
1647
1648 public :
1649 /// Comparison operator (egality)
1650 virtual bool operator==(const Eos& ) const ;
1651
1652 /// Comparison operator (difference)
1653 virtual bool operator!=(const Eos& ) const ;
1654
1655 /** Returns a number to identify the sub-classe of \c Eos the
1656 * object belongs to.
1657 */
1658 virtual int identify() const ;
1659
1660 /** Returns the baryon density at zero pressure divided by \f$B_{60}^{3/4}\f$
1661 * [unit: \f${\rm fm}^{-3}\f$]
1662 */
1663 double get_n0_b60() const {return n0_b60;} ;
1664
1665 /// Returns the bag constant [unit: \f$60\ {\rm MeV\, fm}^{-3}\f$]
1666 double get_b60() const {return b60;} ;
1667
1668 /** Returns the log-enthalpy threshold for setting the energy density to
1669 * a non zero value (should be negative).
1670 */
1671 double get_ent0() const {return ent0;} ;
1672
1673 /** Returns the fitting parameter \f$\epsilon_{\rm fit}\f$ related to the
1674 * square of sound velocity by \f$c_s^2 = 1/3(1+\epsilon_{\rm fit})\f$.
1675 * [cf. Zdunik, Astron. Astrophys. \b 359 , 311 (2000)]
1676 */
1677 double get_eps_fit() const {return eps_fit;} ;
1678
1679 /** Returns the energy density at zero pressure divided by \f$B_{60}\f$.
1680 * [unit: \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$]
1681 */
1682 double get_rho0_b60() const {return rho0_b60;} ;
1683
1684 protected:
1685 /** Computes the auxiliary quantities \c n0 , \c rh0 ,
1686 * \c b34 and \c fach from the values of the other
1687 * parameters
1688 */
1689 void set_auxiliary() ;
1690
1691
1692 // Outputs
1693 // -------
1694
1695 public:
1696 virtual void sauve(FILE* ) const ; ///< Save in a file
1697
1698 protected:
1699 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1700
1701
1702 // Computational functions
1703 // -----------------------
1704
1705 public:
1706 /** Computes the baryon density from the log-enthalpy.
1707 *
1708 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1709 *
1710 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1711 *
1712 */
1713 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
1714
1715 /** Computes the total energy density from the log-enthalpy.
1716 *
1717 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1718 *
1719 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
1720 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1721 */
1722 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
1723
1724 /** Computes the pressure from the log-enthalpy.
1725 *
1726 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1727 *
1728 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1729 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1730 */
1731 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
1732
1733 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
1734 * from the log-enthalpy.
1735 *
1736 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1737 *
1738 * @return dln(n)/dln(H)
1739 */
1740 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
1741
1742 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
1743 * from the log-enthalpy.
1744 *
1745 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1746 *
1747 * @return dln(e)/dln(H)
1748 */
1749 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
1750
1751 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
1752 * from the log-enthalpy.
1753 *
1754 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
1755 *
1756 * @return dln(p)/dln(H)
1757 */
1758 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
1759
1760 };
1761
1762
1763 //------------------------------------//
1764 // class Eos_strange_cr //
1765 //------------------------------------//
1766
1767
1768 /**
1769 * Strange matter EOS (MIT Bag model) with crust.
1770 *
1771 * For liquid core, this equation of state (EOS) corresponds to u,d,s
1772 * degenerate symetric
1773 * matter in the MIT bag model, according to approximate formula
1774 * given in Zdunik, Astron. Astrophys. \b 359 , 311 (2000).
1775 * The EOS for crust is a polytropic approximation of the BPS
1776 * model up to neutron drip point.
1777 *\ingroup (eos)
1778 */
1779 class Eos_strange_cr : public Eos {
1780
1781 // Data :
1782 // -----
1783
1784 protected:
1785 /** Baryon density at zero pressure divided by \f$B_{60}^{3/4}\f$.
1786 * [unit: \f${\rm fm}^{-3}\f$]
1787 */
1788 double n0_b60 ;
1789
1790 /// Bag constant [unit: \f$60\ {\rm MeV\, fm}^{-3}\f$]
1791 double b60 ;
1792
1793 /** Log-enthalpy threshold for setting the energy density to
1794 * a non zero value (should be negative).
1795 */
1796 double ent0 ;
1797
1798 /** Fitting parameter \f$\epsilon_{\rm fit}\f$ related to the
1799 * square of sound velocity by \f$c_s^2 = 1/3(1+\epsilon_{\rm fit})\f$.
1800 * [cf. Zdunik, Astron. Astrophys. \b 359 , 311 (2000)]
1801 */
1802 double eps_fit ;
1803
1804 /** Energy density at zero pressure divided by \f$B_{60}\f$.
1805 * [unit: \f${\rm MeV\, fm^{-3}}\f$]
1806 */
1807 double rho0_b60 ;
1808
1809 /** Log-enthalpy at neutron drip point, defining the
1810 * boundary between crust and core.
1811 *
1812 */
1813 double ent_nd ;
1814
1815 /** Energy density at neutron drip point, defining the
1816 * boundary between crust and core
1817 * [unit: \f${\rm MeV\, fm^{-3}}\f$]
1818 *
1819 */
1820 double rho_nd ;
1821
1822 /** Adiabatic index for the crust model
1823 *
1824 */
1825 double gam ;
1826
1827 // Derived data:
1828 // -------------
1829
1830 /** Baryon density at zero pressure.
1831 * [unit: \f$0.1{\rm \ fm}^{-3}\f$ (Lorene's unit)]
1832 */
1833 double n0 ;
1834
1835 /** Energy density at zero pressure.
1836 * [unit: \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1837 * (Lorene's unit)]
1838 */
1839 double rho0 ;
1840
1841 /** \f$B_{60}^{3/4}\f$
1842 *
1843 */
1844 double b34 ;
1845
1846 /** Factor \f$(4+\epsilon_{\rm fit})/(1+\epsilon_{\rm fit})\f$
1847 *
1848 */
1849 double fach ;
1850
1851 /** Energy density at neutron drip point, defining the
1852 * boundary between crust and core
1853 * [unit: \c rho_unit ]
1854 *
1855 */
1856 double rho_nd_nucl ;
1857
1858 /** Ratio of pressure to energy density at neutron drip
1859 * point
1860 */
1861 double x_nd ;
1862
1863 /// Rescaled number density at neutron drip point
1864 double ncr_nd ;
1865
1866 /// Enthalpy shift in quark phase
1867 double delent ;
1868
1869 /// \f$1/(\gamma-1)\f$
1870 double unsgam1 ;
1871
1872 /// \f$ (\gamma - 1 -x_{\rm nd}) / \gamma / x_{\rm nd}\f$
1873 double gam1sx ;
1874
1875
1876 // Constructors - Destructor
1877 // -------------------------
1878 public:
1879
1880 /** Standard constructor.
1881 *
1882 * @param n0_b60_i Baryon density at zero pressure divided
1883 * by \f$B_{60}^{3/4}\f$ [unit: \f${\rm fm}^{-3}\f$]
1884 * @param b60_i Bag constant [unit: \f$60\ {\rm MeV\, fm}^{-3}\f$]
1885 * @param ent0_i Log-enthalpy threshold for setting the energy
1886 * density to a non zero value (should be negative)
1887 * @param eps_fit_i Fitting parameter \f$\epsilon_{\rm fit}\f$ related
1888 * to the square of sound velocity by
1889 * \f$c_s^2 = 1/3(1+\epsilon_{\rm fit})\f$
1890 * [cf. Zdunik, Astron. Astrophys. \b 359 , 311 (2000)]
1891 * @param rho0_b60_i Energy density at zero pressure divided by
1892 * \f$B_{60}\f$ [unit: \f${\rm MeV\, fm^{-3}}\f$]
1893 * @param ent_nd_i Log-enthalpy at neutron drip point,
1894 * defining the boundary between crust and core
1895 * @param rho_nd_i Energy density at neutron drip point,
1896 * defining the boundary between crust and core
1897 * [unit: \f${\rm MeV\, fm^{-3}}\f$]
1898 * @param gam_i Adiabatic index for the crust model
1899 *
1900 */
1901 Eos_strange_cr(double n0_b60_i, double b60_i, double ent0_i,
1902 double eps_fit_i, double rho0_b60_i,
1903 double ent_nd_i, double rho_nd_i,
1904 double gam_i) ;
1905
1906
1907 Eos_strange_cr(const Eos_strange_cr& ) ; ///< Copy constructor
1908
1909 protected:
1910 /** Constructor from a binary file (created by the function
1911 * \c sauve(FILE*) ).
1912 * This constructor is protected because any EOS construction
1913 * from a binary file must be done via the function
1914 * \c Eos::eos_from_file(FILE*) .
1915 */
1916 Eos_strange_cr(FILE* ) ;
1917
1918 /** Constructor from a formatted file.
1919 * This constructor is protected because any EOS construction
1920 * from a formatted file must be done via the function
1921 * \c Eos::eos_from_file(ifstream&) .
1922 */
1923 Eos_strange_cr(ifstream& ) ;
1924
1925 /// The construction functions from a file
1926 friend Eos* Eos::eos_from_file(FILE* ) ;
1927 friend Eos* Eos::eos_from_file(ifstream& ) ;
1928
1929 public:
1930 virtual ~Eos_strange_cr() ; ///< Destructor
1931
1932 // Assignment
1933 // ----------
1934 /// Assignment to another \c Eos_strange
1935 void operator=(const Eos_strange_cr& ) ;
1936
1937
1938 // Miscellaneous
1939 // -------------
1940
1941 public :
1942 /// Comparison operator (egality)
1943 virtual bool operator==(const Eos& ) const ;
1944
1945 /// Comparison operator (difference)
1946 virtual bool operator!=(const Eos& ) const ;
1947
1948 /** Returns a number to identify the sub-classe of \c Eos the
1949 * object belongs to.
1950 */
1951 virtual int identify() const ;
1952
1953 /** Returns the baryon density at zero pressure divided by \f$B_{60}^{3/4}\f$
1954 * [unit: \f${\rm fm}^{-3}\f$]
1955 */
1956 double get_n0_b60() const {return n0_b60;} ;
1957
1958 /// Returns the bag constant [unit: \f$60\ {\rm MeV\, fm}^{-3}\f$]
1959 double get_b60() const {return b60;} ;
1960
1961 /** Returns the log-enthalpy threshold for setting the energy density to
1962 * a non zero value (should be negative).
1963 */
1964 double get_ent0() const {return ent0;} ;
1965
1966 /** Returns the fitting parameter \f$\epsilon_{\rm fit}\f$ related to the
1967 * square of sound velocity by \f$c_s^2 = 1/3(1+\epsilon_{\rm fit})\f$.
1968 * [cf. Zdunik, Astron. Astrophys. \b 359 , 311 (2000)]
1969 */
1970 double get_eps_fit() const {return eps_fit;} ;
1971
1972 /** Returns the energy density at zero pressure divided by \f$B_{60}\f$.
1973 * [unit: \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$]
1974 */
1975 double get_rho0_b60() const {return rho0_b60;} ;
1976
1977 /** Returns the log-enthalpy at neutron drip point,
1978 * defining the boundary between crust and core.
1979 */
1980 double get_ent_nd() const {return ent_nd;} ;
1981
1982 /** Returns the energy density at neutron drip point,
1983 * defining the boundary between crust and core
1984 * [unit: \f${\rm MeV\, fm^{-3}}\f$].
1985 *
1986 */
1987 double get_rho_nd() const {return rho_nd;} ;
1988
1989 /** Returns the adiabatic index for the crust model
1990 */
1991 double get_gam() const {return gam;} ;
1992
1993
1994
1995 protected:
1996 /** Computes the auxiliary quantities \c n0 , \c rh0 ,
1997 * \c b34 and \c fach from the values of the other
1998 * parameters
1999 */
2000 void set_auxiliary() ;
2001
2002
2003 // Outputs
2004 // -------
2005
2006 public:
2007 virtual void sauve(FILE* ) const ; ///< Save in a file
2008
2009 protected:
2010 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
2011
2012
2013 // Computational functions
2014 // -----------------------
2015
2016 public:
2017 /** Computes the baryon density from the log-enthalpy.
2018 *
2019 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2020 *
2021 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
2022 *
2023 */
2024 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
2025
2026 /** Computes the total energy density from the log-enthalpy.
2027 *
2028 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2029 *
2030 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
2031 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
2032 */
2033 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
2034
2035 /** Computes the pressure from the log-enthalpy.
2036 *
2037 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2038 *
2039 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
2040 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
2041 */
2042 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
2043
2044 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
2045 * from the log-enthalpy.
2046 *
2047 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2048 *
2049 * @return dln(n)/dln(H)
2050 */
2051 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
2052
2053 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
2054 * from the log-enthalpy.
2055 *
2056 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2057 *
2058 * @return dln(e)/dln(H)
2059 */
2060 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
2061
2062 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
2063 * from the log-enthalpy.
2064 *
2065 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2066 *
2067 * @return dln(p)/dln(H)
2068 */
2069 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
2070
2071 };
2072
2073
2074 //----------------------------//
2075 // class Eos_Fermi //
2076 //----------------------------//
2077
2078
2079 /**
2080 * Degenerate ideal Fermi gas
2081 *
2082 * This equation of state describes an ideal gas of relativistic fermions at zero temperature.
2083 * It has two parameters : the fermion mass \f$m\f$ and the degeneracy \f$g_s\f$ of each momentum state
2084 * (for electrons or neutrons : \f$g_s = 2\f$).
2085 *
2086 * *** NB: This class is _under construction_ and not fully tested yet ! ***
2087 *
2088 *\ingroup (eos)
2089 */
2090 class Eos_Fermi : public Eos {
2091
2092 // Data :
2093 // -----
2094
2095 protected:
2096 /** Individual particule mass \f$m_0\f$
2097 * [unit: eV/c2].
2098 */
2099 double m_0 ;
2100
2101 /** Degeneracy parameter
2102 */
2103 int g_s ;
2104
2105
2106 /// Number density scale [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
2107 double n_0 ;
2108
2109 /** Energy density scale [unit: \f$\rho_{\rm nuc} c^2\f$], where
2110 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$]
2111 */
2112 double ener_0 ;
2113
2114
2115 /** Pressure scale [unit: \f$\rho_{\rm nuc} c^2\f$], where
2116 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$]
2117 */
2118 double p_0 ;
2119
2120 // Constructors - Destructor
2121 // -------------------------
2122 public:
2123
2124 /** Standard constructor (sets \c g_s to 2).
2125 *
2126 * @param mass mass of each fermion in eV/c2
2127 *
2128 */
2129 Eos_Fermi(double mass) ;
2130
2131 /** Standard constructor.
2132 *
2133 * @param mass mass of each fermion in eV/c2
2134 * @param g_degen degeneracy factor (value for electrons or neutrons: 2)
2135 *
2136 */
2137 Eos_Fermi(double mass, int g_degen) ;
2138
2139 Eos_Fermi(const Eos_Fermi& ) ; ///< Copy constructor
2140
2141 protected:
2142 /** Constructor from a binary file (created by the function
2143 * \c sauve(FILE*) ).
2144 * This constructor is protected because any EOS construction
2145 * from a binary file must be done via the function
2146 * \c Eos::eos_from_file(FILE*) .
2147 */
2148 Eos_Fermi(FILE* ) ;
2149
2150 /** Constructor from a formatted file.
2151 * This constructor is protected because any EOS construction
2152 * from a formatted file must be done via the function
2153 * \c Eos::eos_from_file(ifstream&) .
2154 */
2155 Eos_Fermi(ifstream& ) ;
2156
2157 /// The construction functions from a file
2158 friend Eos* Eos::eos_from_file(FILE* ) ;
2159 friend Eos* Eos::eos_from_file(ifstream& ) ;
2160
2161 public:
2162 virtual ~Eos_Fermi() ; ///< Destructor
2163
2164 // Assignment
2165 // ----------
2166 /// Assignment to another \c Eos_Fermi
2167 void operator=(const Eos_Fermi& ) ;
2168
2169
2170 // Miscellaneous
2171 // -------------
2172
2173 public :
2174 /// Comparison operator (egality)
2175 virtual bool operator==(const Eos& ) const ;
2176
2177 /// Comparison operator (difference)
2178 virtual bool operator!=(const Eos& ) const ;
2179
2180 /** Returns a number to identify the sub-classe of \c Eos the
2181 * object belongs to.
2182 */
2183 virtual int identify() const ;
2184
2185 /// Returns the fermion mass in eV/c2
2186 double get_m() const ;
2187
2188 /// Returns the degeneracy factor
2189 int get_g_degen() const ;
2190
2191 protected:
2192 /** Computes the auxiliary quantities \c n_0 , \c ener_0
2193 */
2194 void set_auxiliary() ;
2195
2196
2197 // Outputs
2198 // -------
2199
2200 public:
2201 virtual void sauve(FILE* ) const ; ///< Save in a file
2202
2203 protected:
2204 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
2205
2206
2207 // Computational functions
2208 // -----------------------
2209
2210 public:
2211 /** Computes the baryon density from the log-enthalpy.
2212 *
2213 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2214 * @param par possible extra parameters of the EOS (not used here)
2215 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
2216 *
2217 */
2218 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
2219
2220 /** Computes the total energy density from the log-enthalpy.
2221 *
2222 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2223 * @param par possible extra parameters of the EOS (not used here)
2224 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
2225 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
2226 */
2227 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
2228
2229 /** Computes the pressure from the log-enthalpy.
2230 *
2231 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2232 * @param par possible extra parameters of the EOS (not used here)
2233 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
2234 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
2235 */
2236 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
2237
2238 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
2239 * from the log-enthalpy.
2240 *
2241 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2242 * @param par possible extra parameters of the EOS (not used here)
2243 * @return dln(n)/dln(H)
2244 */
2245 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
2246
2247 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
2248 * from the log-enthalpy.
2249 *
2250 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2251 * @param par possible extra parameters of the EOS (not used here)
2252 * @return dln(e)/dln(H)
2253 */
2254 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
2255
2256 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
2257 * from the log-enthalpy.
2258 *
2259 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H
2260 * @param par possible extra parameters of the EOS
2261 * @return dln(p)/dln(H)
2262 */
2263 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
2264
2265 };
2266
2267
2268
2269
2270 //------------------------------//
2271 // EOS with domain dependency //
2272 //------------------------------//
2273
2274 /**
2275 * EOS with domain dependency.
2276 *
2277 *
2278 */
2279 class MEos : public Eos {
2280
2281 // Data :
2282 // -----
2283
2284 protected:
2285 /// Array (upon the domains) containing the various EOS
2286 const Eos** mono_eos ;
2287
2288 /// Number of domains
2289 int ndom ;
2290
2291 /// Indicates wether the EOS has been constructed from a file
2292 bool constructed_from_file ;
2293
2294 // Constructors - Destructor
2295 // -------------------------
2296 public:
2297
2298 /** Standard constructor.
2299 * @param ndom_i number of domains
2300 * @param mono_eos_i array (size \c ndom_i ) of pointers on the various EOS
2301 */
2302 MEos(int ndom_i, const Eos** mono_eos_i) ;
2303
2304 /// Constructor for 2 domains
2305 MEos(const Eos& eos1, const Eos& eos2) ;
2306
2307 /// Constructor for 3 domains
2308 MEos(const Eos& eos1, const Eos& eos2, const Eos& eos3) ;
2309
2310 /// Constructor for 4 domains
2311 MEos(const Eos& eos1, const Eos& eos2, const Eos& eos3, const Eos& eos4) ;
2312
2313 MEos(const MEos& ) ; ///< Copy constructor
2314
2315 protected:
2316 /** Constructor from a binary file (created by the function
2317 * \c sauve(FILE*) ).
2318 * This constructor is protected because any EOS construction
2319 * from a binary file must be done via the function
2320 * \c Eos::eos_from_file(FILE*) .
2321 */
2322 MEos(FILE* ) ;
2323
2324 /** Constructor from a formatted file.
2325 * This constructor is protected because any EOS construction
2326 * from a formatted file must be done via the function
2327 * \c Eos::eos_from_file(ifstream&) .
2328 */
2329 MEos(ifstream& ) ;
2330
2331 ///< The construction functions from a file
2332 friend Eos* Eos::eos_from_file(FILE* ) ;
2333 friend Eos* Eos::eos_from_file(ifstream& ) ;
2334
2335 public:
2336 virtual ~MEos() ; ///< Destructor
2337
2338 // Assignment
2339 // ----------
2340 /// Assignment to another \c MEos
2341 void operator=(const MEos& ) ;
2342
2343
2344 // Miscellaneous
2345 // -------------
2346
2347 public :
2348 /// Comparison operator (egality)
2349 virtual bool operator==(const Eos& ) const ;
2350
2351 /// Comparison operator (difference)
2352 virtual bool operator!=(const Eos& ) const ;
2353
2354 /** Returns a number to identify the sub-classe of \c Eos the
2355 * object belongs to.
2356 */
2357 virtual int identify() const ;
2358
2359 // Outputs
2360 // -------
2361
2362 public:
2363 virtual void sauve(FILE* ) const ; ///< Save in a file
2364
2365 protected:
2366 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
2367
2368
2369 // Computational functions
2370 // -----------------------
2371
2372 public:
2373 /** Computes the baryon density from the log-enthalpy.
2374 *
2375 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
2376 * Eq. (4)
2377 *
2378 * @param par possible extra parameters of the EOS
2379 * @return baryon density \e n [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
2380 *
2381 */
2382 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
2383
2384 /** Computes the total energy density from the log-enthalpy.
2385 *
2386 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
2387 * Eq. (4)
2388 *
2389 * @param par possible extra parameters of the EOS
2390 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
2391 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
2392 */
2393 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
2394
2395 /** Computes the pressure from the log-enthalpy.
2396 *
2397 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
2398 * Eq. (4)
2399 *
2400 * @param par possible extra parameters of the EOS
2401 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
2402 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
2403 */
2404 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
2405
2406 /** Computes the logarithmic derivative \f$d\ln n/d\ln H\f$
2407 * from the log-enthalpy.
2408 *
2409 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
2410 * Eq. (4)
2411 *
2412 * @param par possible extra parameters of the EOS
2413 * @return dln(n)/dln(H)
2414 */
2415 virtual double der_nbar_ent_p(double ent, const Param* par=0x0) const ;
2416
2417 /** Computes the logarithmic derivative \f$d\ln e/d\ln H\f$
2418 * from the log-enthalpy.
2419 *
2420 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
2421 * Eq. (4)
2422 *
2423 * @param par possible extra parameters of the EOS
2424 * @return dln(e)/dln(H)
2425 */
2426 virtual double der_ener_ent_p(double ent, const Param* par=0x0) const ;
2427
2428 /** Computes the logarithmic derivative \f$d\ln p/d\ln H\f$
2429 * from the log-enthalpy.
2430 *
2431 * @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
2432 * Eq. (4)
2433 *
2434 * @param par possible extra parameters of the EOS
2435 * @return dln(p)/dln(H)
2436 */
2437 virtual double der_press_ent_p(double ent, const Param* par=0x0) const ;
2438
2439 };
2440
2441 }
2442 //------------------//
2443 // Remaining EOS //
2444 //------------------//
2445
2446 #include "eos_tabul.h"
2447 #include "eos_compose.h"
2448 #include "eos_mag.h"
2449
2450 #endif