Debian Codegraph @

C++/Include/eos_bifluid.h

raw symbols SCIP
1 /*
2 * Definition of Lorene classes Eos_bifluid
3 * Eos_bf_poly
4 * Eos_bf_tabul
5 */
6
7 /*
8 * Copyright (c) 2001-2002 Jerome Novak
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 as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29 #ifndef __EOS_BIFLUID_H_
30 #define __EOS_BIFLUID_H_
31
32 /*
33 * $Id: eos_bifluid.h,v 1.22 2015/06/26 14:10:08 j_novak Exp $
34 * $Log: eos_bifluid.h,v $
35 * Revision 1.22 2015/06/26 14:10:08 j_novak
36 * Modified comments.
37 *
38 * Revision 1.21 2015/06/11 13:50:18 j_novak
39 * Minor corrections
40 *
41 * Revision 1.20 2015/06/10 14:39:17 a_sourie
42 * New class Eos_bf_tabul for tabulated 2-fluid EoSs and associated functions for the computation of rotating stars with such EoSs.
43 *
44 * Revision 1.19 2014/10/13 08:52:33 j_novak
45 * Lorene classes and functions now belong to the namespace Lorene.
46 *
47 * Revision 1.18 2014/04/25 10:43:50 j_novak
48 * The member 'name' is of type string now. Correction of a few const-related issues.
49 *
50 * Revision 1.17 2004/09/01 09:49:46 r_prix
51 * adapted to change in read_variable() for strings
52 *
53 * Revision 1.16 2004/03/22 13:12:41 j_novak
54 * Modification of comments to use doxygen instead of doc++
55 *
56 * Revision 1.15 2004/01/30 13:21:29 r_prix
57 * add documentation about 'special' 2-fluid typeos=5: == type0 + slow-rot style inversion
58 *
59 * Revision 1.14 2003/12/17 23:12:30 r_prix
60 * replaced use of C++ <string> by standard ANSI char* to be backwards compatible
61 * with broken compilers like MIPSpro Compiler 7.2 on SGI Origin200. ;-)
62 *
63 * Revision 1.13 2003/12/05 15:08:38 r_prix
64 * - use read_variable() to read eos_bifluid from file
65 * - changed 'contructor from file' to take filename as an argument instead of ifstream
66 * - changed 'name' member of Eos_bifluid to C++-type string (for convenience&safety)
67 *
68 * Revision 1.12 2003/12/04 14:13:32 r_prix
69 * added method get_typeos {return typeos}; and fixed some comments.
70 *
71 * Revision 1.11 2003/11/18 18:25:15 r_prix
72 * moved particle-masses m_1, m_2 of the two fluids into class eos_bifluid (from eos_bf_poly)
73 *
74 * Revision 1.10 2002/10/16 14:36:29 j_novak
75 * Reorganization of #include instructions of standard C++, in order to
76 * use experimental version 3 of gcc.
77 *
78 * Revision 1.9 2002/09/13 09:17:31 j_novak
79 * Modif. commentaires
80 *
81 * Revision 1.8 2002/06/17 14:05:16 j_novak
82 * friend functions are now also declared outside the class definition
83 *
84 * Revision 1.7 2002/06/03 13:23:16 j_novak
85 * The case when the mapping is not adapted is now treated
86 *
87 * Revision 1.6 2002/05/31 16:13:36 j_novak
88 * better inversion for eos_bifluid
89 *
90 * Revision 1.5 2002/05/02 15:16:22 j_novak
91 * Added functions for more general bi-fluid EOS
92 *
93 * Revision 1.4 2002/01/16 15:03:27 j_novak
94 * *** empty log message ***
95 *
96 * Revision 1.3 2002/01/11 14:09:34 j_novak
97 * Added newtonian version for 2-fluid stars
98 *
99 * Revision 1.2 2001/11/29 15:05:26 j_novak
100 * The entrainment term in 2-fluid eos is modified
101 *
102 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
103 * LORENE
104 *
105 * Revision 1.6 2001/08/31 15:47:35 novak
106 * The flag tronc has been added to nbar_ent.. functions
107 *
108 * Revision 1.5 2001/08/27 12:21:11 novak
109 * The delta2 Cmp argument put to const
110 *
111 * Revision 1.4 2001/08/27 09:50:15 novak
112 * New formula for "polytrope"
113 *
114 * Revision 1.3 2001/06/22 15:36:11 novak
115 * Modification de Eos_bifluid::trans2Eos
116 *
117 * Revision 1.2 2001/06/22 11:52:44 novak
118 * *** empty log message ***
119 *
120 * Revision 1.1 2001/06/21 15:21:22 novak
121 * Initial revision
122 *
123 *
124 * $Header: /cvsroot/Lorene/C++/Include/eos_bifluid.h,v 1.22 2015/06/26 14:10:08 j_novak Exp $
125 *
126 */
127
128 // Standard C++
129 #include "headcpp.h"
130 #include <string>
131
132 // Headers C
133 #include <cstdio>
134
135 // Lorene classes
136 #include "param.h"
137 namespace Lorene {
138 class Tbl ;
139 class Param ;
140 class Cmp ;
141 class Eos ;
142 class Eos_poly ;
143
144 //------------------------------------//
145 // base class Eos for two fluids //
146 //------------------------------------//
147 #define MAX_EOSNAME 100
148
149 /**
150 * 2-fluids equation of state base class.
151 *
152 * Fluid 1 is supposed to correspond to neutrons, whereas fluid 2
153 * corresponds to e.g. protons. Neutron 4-velocity is \f$u^\alpha_{\rm n}\f$
154 * and proton one is \f$u^\alpha_{\rm p}\f$
155 *
156 * Therefore, the EOS is defined by giving two log-enthalpies AND a
157 * relative velocity as inputs. The output are then: two baryonic
158 * densities, the total energy density and pressure
159 * The enthalpies \f$f_1\f$ and \f$f_2\f$ are obtained through the formula
160 * \f[
161 * {\rm d}{\cal E}=f^1{\rm d}n_1+f^2{\rm d}n_2+\alpha{\rm d}\Delta^2
162 * \label{eeosbfdefent}
163 * \f]
164 * see Comer, Novak \& Prix. Log-enthalpies are then defined as
165 * \f$H_1 = \ln\left( \frac{f^1}{m_1c^2} \right)\f$, where \f$m_1\f$ is the
166 * mass of a particle of the first fluid. (same for \f$H_2\f$)
167 * The relative velocity \f$\Delta^2\f$
168 * is defined as in Comer, Novak \& Prix. It can be seen as
169 * the neutron velocity seen in the frame of protons (or vice-versa):
170 * \f$\Gamma_\Delta = -g_{\alpha\beta} u^\alpha_{\rm n} u^\beta_{\rm p}\f$
171 * \ingroup (eos)
172 */
173 class Eos_bifluid {
174
175 // Data :
176 // -----
177
178 protected:
179 string name; ///< EOS name
180
181 /** Individual particle mass \f$m_1\f$
182 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
183 */
184 double m_1 ;
185
186 /** Individual particle mass \f$m_2\f$
187 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
188 */
189 double m_2 ;
190
191
192 // Constructors - Destructor
193 // -------------------------
194 protected:
195 Eos_bifluid() ; ///< Standard constructor
196
197 /// Standard constructor with name and the two masses per particle
198 explicit Eos_bifluid(const char* name_i, double mass1, double mass2) ;
199
200 Eos_bifluid(const Eos_bifluid& ) ; ///< Copy constructor
201
202 protected:
203 /** Constructor from a binary file (created by the function
204 * \c sauve(FILE*) ).
205 * This constructor is protected because any EOS construction
206 * from a binary file must be done via the function
207 * \c Eos_bifluid::eos_from_file(FILE*) .
208 */
209 Eos_bifluid(FILE* ) ;
210
211 /** Constructor from a formatted file.
212 * This constructor is protected because any EOS construction
213 * from a formatted file must be done via the function
214 * \c Eos_bifluid::eos_from_file(const char*).
215 *
216 * The following fields have to be present in the config-file:\\
217 * name: [string] name of the EOS
218 * m_1, m_2: [double] baryon masses of the 2-fluids
219 *
220 */
221 Eos_bifluid (const char *fname ) ;
222
223 /** Construction of an EOS from a formatted file.
224 *
225 * This constructor is protected because any EOS construction
226 * from a formatted file must be done via the function
227 * \c Eos_bifluid::eos_from_file(ifstream& ).
228 *
229 */
230 Eos_bifluid (ifstream& fich) ;
231
232
233 public:
234 virtual ~Eos_bifluid() ; ///< Destructor
235
236 // Assignment
237 // ----------
238 /// Assignment to another \c Eos_bifluid
239 void operator=(const Eos_bifluid& ) ;
240
241
242 // Name manipulation
243 // -----------------
244 public:
245 /// Returns the EOS name
246 string get_name() const {return name;} ;
247
248 // Miscellaneous
249 // -------------
250 public:
251
252 /** Return the individual particule mass \f$m_1\f$
253 *
254 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
255 */
256 double get_m1() const {return m_1 ;};
257
258 /** Return the individual particule mass \f$m_2\f$
259 *
260 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
261 */
262 double get_m2() const {return m_2 ;};
263
264 /** Construction of an EOS from a binary file.
265 * The file must have been created by the function
266 * \c sauve(FILE*) .
267 */
268 static Eos_bifluid* eos_from_file (FILE* ) ;
269
270 /** Construction of an EOS from a formatted file.
271 *
272 * The following field has to be present:\\
273 * ident: [int] identifying the type of 2-fluid EOS
274 * 1 = relativistic polytropic EOS (class \c Eos_bf_poly ). \\
275 * 2 = Newtonian polytropic EOS (class \c Eos_bf_poly_newt ).
276 */
277 static Eos_bifluid* eos_from_file ( const char *fname ) ;
278
279 /** Construction of an EOS from a formatted file.
280 *
281 * The fist line of the file must start by the EOS number, according
282 * to the following conventions:
283 * - 1 = 2-fluid relativistic polytropic EOS (class \c Eos_bf_poly ).
284 * - 2 = 2-fluid Newtonian polytropic EOS (class \c Eos_bf_poly_newt ).
285 * - 3 = 2-fluid tabulated EOS (class \c Eos_bf_tabul).
286 * The second line in the file should contain a name given by the user to the EOS.
287 * The following lines should contain the EOS parameters (one
288 * parameter per line), in the same order than in the class declaration.
289 */
290 static Eos_bifluid* eos_from_file(ifstream& ) ;
291
292
293 /// Comparison operator (egality)
294 virtual bool operator==(const Eos_bifluid& ) const = 0 ;
295
296 /// Comparison operator (difference)
297 virtual bool operator!=(const Eos_bifluid& ) const = 0 ;
298
299 /** Returns a number to identify the sub-classe of \c Eos_bifluid
300 * the object belongs to.
301 */
302 virtual int identify() const = 0 ;
303
304 // Outputs
305 // -------
306
307 public:
308 virtual void sauve(FILE* ) const ; ///< Save in a file
309
310 /// Display
311 friend ostream& operator<<(ostream& , const Eos_bifluid& ) ;
312
313 protected:
314 virtual ostream& operator>>(ostream &) const = 0 ; ///< Operator >>
315
316
317 // Computational functions
318 // -----------------------
319 public:
320 /** General computational method for \c Cmp 's, it computes
321 * both baryon densities, energy and pressure profiles.
322 *
323 * @param ent1 [input] the first log-enthalpy field \f$H_1\f$.
324 * @param ent2 [input] the second log-enthalpy field \f$H_2\f$.
325 * @param delta2 [input] the relative velocity field \f$\Delta^2 \f$
326 * @param nbar1 [output] baryonic density of the first fluid
327 * @param nbar2 [output] baryonic density of the second fluid
328 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
329 * @param ener [output] total energy density \f$\cal E\f$
330 * of both fluids together
331 * @param press [output] pressure \e p of both fluids together
332 * @param nzet [input] number of domains where \c resu is to be
333 * computed.
334 * @param l_min [input] index of the innermost domain is which
335 * \c resu is to be computed [default value: 0];
336 * \c resu is computed only in domains whose indices are
337 * in \c [l_min,l_min+nzet-1] . In the other
338 * domains, it is set to zero.
339 */
340 virtual void calcule_tout(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2,
341 Cmp& nbar1, Cmp& nbar2, Cmp& ener, Cmp& press,
342 int nzet, int l_min = 0) const ;
343
344 /** Computes both baryon densities from the log-enthalpies
345 * (virtual function implemented in the derived classes).
346 *
347 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
348 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
349 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
350 *
351 * @param nbar1 [output] baryonic density of the first fluid
352 * @param nbar2 [output] baryonic density of the second fluid
353 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
354 * @return true if the 2-fluids model is correct, false otherwise.
355 */
356 virtual bool nbar_ent_p(const double ent1, const double ent2,
357 const double delta2, double& nbar1,
358 double& nbar2) const = 0 ;
359
360 /** Computes baryon density out of the log-enthalpy asuming
361 * that only fluid 1 is present (virtual function implemented
362 * in the derived classes).
363 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
364 * @return nbar1 baryonic density of the first fluid
365 */
366 virtual double nbar_ent_p1(const double ent1) const = 0 ;
367
368 /** Computes baryon density out of the log-enthalpy assuming
369 * that only fluid 2 is present (virtual function implemented
370 * in the derived classes).
371 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
372 * @return nbar1 baryonic density of the first fluid
373 */
374 virtual double nbar_ent_p2(const double ent2) const = 0 ;
375
376 /** Computes both baryon density fields from the log-enthalpy fields
377 * and the relative velocity.
378 *
379 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
380 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
381 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
382 *
383 * @param nbar1 [output] baryonic density of the first fluid
384 * @param nbar2 [output] baryonic density of the second fluid
385 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
386 * @param nzet number of domains where the baryon density is to be
387 * computed.
388 * @param l_min index of the innermost domain is which the baryon
389 * density is
390 * to be computed [default value: 0]; the baryon density is
391 * computed only in domains whose indices are in
392 * \c [l_min,l_min+nzet-1] . In the other
393 * domains, it is set to zero.
394 *
395 */
396 void nbar_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2,
397 Cmp& nbar1, Cmp& nbar2, int nzet, int l_min = 0)
398 const ;
399
400 /** Computes the total energy density from the baryonic densities
401 * and the relative velocity.
402 * (virtual function implemented in the derived classes).
403 *
404 * @param nbar1 [input] baryonic density of the first fluid
405 * @param nbar2 [input] baryonic density of the second fluid
406 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
407 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
408 *
409 * @return energy density \f$\cal E\f$ [unit: \f$\rho_{\rm nuc} c^2\f$], where
410 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
411 */
412 virtual double ener_nbar_p(const double nbar1, const double nbar2,
413 const double delta2) const = 0 ;
414
415 /** Computes the total energy density from the log-enthalpy fields
416 * and the relative velocity.
417 *
418 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
419 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
420 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
421 * @param nzet number of domains where the energy density is to be
422 * computed.
423 * @param l_min index of the innermost domain is which the energy
424 * density is
425 * to be computed [default value: 0]; the energy density is
426 * computed only in domains whose indices are in
427 * \c [l_min,l_min+nzet-1] . In the other
428 * domains, it is set to zero.
429 *
430 * @return energy density field [unit: \f$\rho_{\rm nuc} c^2\f$],
431 * where
432 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
433 */
434 Cmp ener_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2,
435 int nzet, int l_min = 0) const ;
436
437 /** Computes the pressure from the baryonic densities
438 * and the relative velocity.
439 * (virtual function implemented in the derived classes).
440 *
441 * @param nbar1 [input] baryonic density of the first fluid
442 * @param nbar2 [input] baryonic density of the second fluid
443 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
444 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
445 *
446 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
447 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
448 */
449 virtual double press_nbar_p(const double nbar1, const double nbar2,
450 const double delta2) const = 0 ;
451
452 /** Computes the pressure from the log-enthalpy fields
453 * and the relative velocity.
454 *
455 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
456 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
457 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
458 * @param nzet number of domains where the pressure is to be
459 * computed.
460 * @param l_min index of the innermost domain is which the pressure
461 * is to be computed [default value: 0]; the pressure is computed
462 * only in domains whose indices are in
463 * \c [l_min,l_min+nzet-1] . In the other
464 * domains, it is set to zero.
465 *
466 * @return pressure field [unit: \f$\rho_{\rm nuc} c^2\f$], where
467 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
468 *
469 */
470 Cmp press_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2,
471 int nzet, int l_min = 0) const ;
472
473 /** Computes the derivative of the energy with respect to
474 * (baryonic density 1)\f$^2\f$.
475 * (virtual function implemented in the derived classes).
476 *
477 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
478 * baryonic density of fluid 1 at which the derivative
479 * is to be computed
480 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
481 * baryonic density of fluid 2 at which the derivative
482 * is to be computed
483 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
484 * relative Lorentz factor\f$\times\f$both densities at which
485 * the derivative is to be computed
486 *
487 * @return derivative \f$K^{11}=2\frac{\partial{\cal{E}}}{\partial{n_1^2}}\f$
488 */
489 virtual double get_K11(const double n1, const double n2, const
490 double x) const = 0 ;
491
492 /** Computes the derivative of the energy with respect to
493 * \f$x^2=n_1n_2\Gamma_\Delta\f$.
494 * (virtual function implemented in the derived classes).
495 *
496 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
497 * baryonic density of fluid 1 at which the derivative
498 * is to be computed
499 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
500 * baryonic density of fluid 2 at which the derivative
501 * is to be computed
502 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
503 * relative Lorentz factor\f$\times\f$both densities at which
504 * the derivative is to be computed
505 *
506 * @return derivative \f$K^{12}=\frac{\partial {\cal E}}{\partial (n_1n_2\Gamma_\Delta)}\f$
507 */
508 virtual double get_K12(const double n1, const double n2,const
509 double x) const = 0 ;
510
511 /** Computes the derivative of the energy/(baryonic density 2)\f$^2\f$.
512 * (virtual function implemented in the derived classes).
513 *
514 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
515 * baryonic density of fluid 1 at which the derivative
516 * is to be computed
517 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
518 * baryonic density of fluid 2 at which the derivative
519 * is to be computed
520 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
521 * relative Lorentz factor\f$\times\f$both densities at which
522 * the derivative is to be computed
523 *
524 * @return derivative \f$K^{22} = 2\frac{\partial {\cal E}}{\partial n_2^2}\f$
525 */
526 virtual double get_K22(const double n1, const double n2, const
527 double x) const = 0 ;
528
529 /** Computes the derivatives of the energy/(baryonic density 1)\f$^2\f$.
530 *
531 * @param nbar1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
532 * baryonic density field of fluid 1 at which
533 * the derivatives are to be computed
534 * @param nbar2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
535 * baryonic density field of fluid 2 at which
536 * the derivatives are to be computed
537 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
538 * relative velocity\f$\times\f$both densities at which
539 * the derivative is to be computed
540 * @param nzet number of domains where the derivatives are to be
541 * computed.
542 * @param l_min index of the innermost domain is which the
543 * derivatives are
544 * to be computed [default value: 0]; the derivatives are
545 * computed only in domains whose indices are in
546 * \c [l_min,l_min+nzet-1] . In the other
547 * domains, it is set to zero.
548 *
549 * @return derivative \f$K^{11}\f$ field (see \c get_K11 )
550 */
551 Cmp get_Knn(const Cmp& nbar1, const Cmp& nbar2, const Cmp& x2,
552 int nzet, int l_min = 0) const ;
553
554 /** Computes the derivatives of the energy/(baryonic density 2)\f$^2\f$.
555 *
556 * @param nbar1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
557 * baryonic density field of fluid 1 at which
558 * the derivatives are to be computed
559 * @param nbar2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
560 * baryonic density field of fluid 2 at which
561 * the derivatives are to be computed
562 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
563 * relative velocity\f$\times\f$both densities at which
564 * the derivative is to be computed
565 * @param nzet number of domains where the derivatives are to be
566 * computed.
567 * @param l_min index of the innermost domain is which the
568 * derivatives are
569 * to be computed [default value: 0]; the derivatives are
570 * computed only in domains whose indices are in
571 * \c [l_min,l_min+nzet-1] . In the other
572 * domains, it is set to zero.
573 *
574 * @return derivative \f$K^{22}\f$ field (see \c get_K12 )
575 */
576 Cmp get_Kpp(const Cmp& nbar1, const Cmp& nbar2, const Cmp&
577 x2, int nzet, int l_min = 0) const ;
578
579 /** Computes the derivatives of the energy with respect to
580 * \f$x^2=n_1n_2\Gamma_\Delta^2\f$.
581 *
582 * @param nbar1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
583 * baryonic density field of fluid 1 at which
584 * the derivatives are to be computed
585 * @param nbar2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
586 * baryonic density field of fluid 2 at which
587 * the derivatives are to be computed
588 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
589 * relative velocity\f$\times\f$both densities at which
590 * the derivative is to be computed
591 * @param nzet number of domains where the derivatives are to be
592 * computed.
593 * @param l_min index of the innermost domain is which the
594 * derivatives are
595 * to be computed [default value: 0]; the derivatives are
596 * computed only in domains whose indices are in
597 * \c [l_min,l_min+nzet-1] . In the other
598 * domains, it is set to zero.
599 *
600 * @return derivative \f$K^{12}\f$ field (see \c get_K12 )
601 */
602 Cmp get_Knp(const Cmp& nbar1, const Cmp& nbar2, const Cmp& x2,
603 int nzet, int l_min = 0) const ;
604
605
606 /** General computational method for \c Cmp 's (\f$K^{ij}\f$'s).
607 *
608 * @param nbar1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
609 * baryonic density field of fluid 1 at which
610 * the derivatives are to be computed.
611 * @param nbar2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
612 * baryonic density field of fluid 2 at which
613 * the derivatives are to be computed
614 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
615 * relative velocity\f$\times\f$both densities at which
616 * the derivative is to be computed
617 * @param nzet [input] number of domains where \c resu is to be
618 * computed.
619 * @param l_min [input] index of the innermost domain is which \c resu
620 * is to be computed [default value: 0]; \c resu is
621 * computed only in domains whose indices are in
622 * \c [l_min,l_min+nzet-1] . In the other
623 * domains, it is set to zero.
624 * @param fait [input] pointer on the member function of class
625 * \c Eos_bifluid which performs the pointwise calculation.
626 * @param resu [output] result of the computation.
627 */
628 void calcule(const Cmp& nbar1, const Cmp& nbar2, const Cmp&
629 x2, int nzet, int l_min, double
630 (Eos_bifluid::*fait)(double, double, double) const,
631 Cmp& resu)
632 const ;
633
634 /** Computes the derivatives of the energy/(baryonic density 1)\f$^2\f$.
635 *
636 * @param ent1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
637 * baryonic log enthalpy field of fluid 1 at which
638 * the derivatives are to be computed
639 * @param ent2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
640 * baryonic log enthalpy field of fluid 2 at which
641 * the derivatives are to be computed
642 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
643 * relative velocity\f$\times\f$both densities at which
644 * the derivative is to be computed
645 * @param nzet number of domains where the derivatives are to be
646 * computed.
647 * @param l_min index of the innermost domain is which the
648 * derivatives are
649 * to be computed [default value: 0]; the derivatives are
650 * computed only in domains whose indices are in
651 * \c [l_min,l_min+nzet-1] . In the other
652 * domains, it is set to zero.
653 *
654 * @return derivative \f$K^{11}\f$ field (see \c get_K11 )
655 */
656 Cmp get_Knn_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& x2,
657 int nzet, int l_min = 0) const ;
658
659 /** Computes the derivatives of the energy/(baryonic density 2)\f$^2\f$.
660 *
661 * @param ent1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
662 * baryonic log enthalpy field of fluid 1 at which
663 * the derivatives are to be computed
664 * @param ent2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
665 * baryonic log enthalpy field of fluid 2 at which
666 * the derivatives are to be computed
667 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
668 * relative velocity\f$\times\f$both densities at which
669 * the derivative is to be computed
670 * @param nzet number of domains where the derivatives are to be
671 * computed.
672 * @param l_min index of the innermost domain is which the
673 * derivatives are
674 * to be computed [default value: 0]; the derivatives are
675 * computed only in domains whose indices are in
676 * \c [l_min,l_min+nzet-1] . In the other
677 * domains, it is set to zero.
678 *
679 * @return derivative \f$K^{22}\f$ field (see \c get_K12 )
680 */
681 Cmp get_Kpp_ent(const Cmp& ent1, const Cmp& ent2, const Cmp&
682 x2, int nzet, int l_min = 0) const ;
683
684 /** Computes the derivatives of the energy with respect to
685 * \f$x^2=n_1n_2\Gamma_\Delta^2\f$.
686 *
687 * @param ent1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
688 * baryonic log enthalpy field of fluid 1 at which
689 * the derivatives are to be computed
690 * @param ent2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
691 * baryonic log enthalpy field of fluid 2 at which
692 * the derivatives are to be computed
693 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
694 * relative velocity\f$\times\f$both densities at which
695 * the derivative is to be computed
696 * @param nzet number of domains where the derivatives are to be
697 * computed.
698 * @param l_min index of the innermost domain is which the
699 * derivatives are
700 * to be computed [default value: 0]; the derivatives are
701 * computed only in domains whose indices are in
702 * \c [l_min,l_min+nzet-1] . In the other
703 * domains, it is set to zero.
704 *
705 * @return derivative \f$K^{12}\f$ field (see \c get_K12 )
706 */
707 Cmp get_Knp_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& x2,
708 int nzet, int l_min = 0) const ;
709
710 /** General computational method for \c Cmp 's (\f$K^{ij}\f$'s).
711 *
712 * @param ent1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
713 * baryonic log enthalpy field of fluid 1 at which
714 * the derivatives are to be computed.
715 * @param ent2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
716 * baryonic log enthalpy field of fluid 2 at which
717 * the derivatives are to be computed
718 * @param x2 [input, unit \f$n_{\rm nuc}^2c^2\f$]
719 * relative velocity\f$\times\f$both densities at which
720 * the derivative is to be computed
721 * @param nzet [input] number of domains where \c resu is to be
722 * computed.
723 * @param l_min [input] index of the innermost domain is which \c resu
724 * is to be computed [default value: 0]; \c resu is
725 * computed only in domains whose indices are in
726 * \c [l_min,l_min+nzet-1] . In the other
727 * domains, it is set to zero.
728 * @param fait [input] pointer on the member function of class
729 * \c Eos_bifluid which performs the pointwise calculation.
730 * @param resu [output] result of the computation.
731 */
732 void calcule_ent(const Cmp& ent1, const Cmp& ent2, const Cmp&
733 x2, int nzet, int l_min, double
734 (Eos_bifluid::*fait)(double, double, double) const,
735 Cmp& resu)
736 const ;
737
738 // Conversion functions
739 // ---------------------
740
741 /** Makes a translation from \c Eos_bifluid to \c Eos .
742 * (virtual function implemented in the derived classes).
743 *
744 * This is only useful for the construction of a
745 * \c Et_rot_bifluid
746 * star and ought not to be used in other situations.
747 * @param relat [input] Relativistic EOS or not.
748 */
749 virtual Eos* trans2Eos() const = 0 ;
750
751 };
752 ostream& operator<<(ostream& , const Eos_bifluid& ) ;
753
754
755 //------------------------------------//
756 // class Eos_bf_poly //
757 //------------------------------------//
758
759 /**
760 * Analytic equation of state for two fluids (relativistic case).
761 *
762 * This equation of state (EOS) corresponds to two types of relativistic
763 * particles of rest mass is \f$m_1\f$ and \f$m_2\f$, whose total energy density
764 * \f$\cal{E}\f$ is related to their numerical densities \f$n_1\f$, \f$n_2\f$ and
765 * relative velocity
766 * \f[
767 * \Gamma_\Delta = -g_{\alpha\beta} u^\alpha_{\rm n} u^\beta_{\rm p}
768 * \label{e:defgamamdelta}
769 * \f]
770 * (\f$u^\alpha_{\rm n}\f$ and \f$u^\alpha_{\rm p}\f$ being the 4-velocities of
771 * both fluids), by
772 * \f[ \label{eeosbfpolye}
773 * {\cal{E}} = \frac{1}{2}\kappa_1 n_1^{\gamma_1} + m_1 c^2 \, n_1
774 * \ + \frac{1}{2}\kappa_2 n_2^{\gamma_2} + m_2 c^2 \, n_2
775 * \ + \kappa_3 n_1^{\gamma_3} n_2^{\gamma_4}
776 * \ + \Delta^2 \beta n_1^{\gamma_5} n_2^{\gamma_6}\ .
777 * \f]
778 * The relativistic (i.e. including rest mass energy) chemical potentials
779 * are then
780 * \f[
781 * \mu_1 := {{\rm d}{\cal{E}} \over {\rm d}n_1} = \frac{1}{2}\gamma_1\kappa_1
782 * n_1^{\gamma_1-1} + m_1 c^2 + \gamma_3 \kappa_3
783 * n_1^{\gamma_3-1} n_2^{\gamma_4} + \Delta^2 \gamma_5 \beta
784 * n_1^{\gamma_5-1} n_2^{\gamma_6}\ ,
785 * \f]
786 * \f[
787 * \mu_2 := {{\rm d}{\cal{E}} \over {\rm d}n_2} = \frac{1}{2}\gamma_2\kappa_2
788 * n_2^{\gamma_2-1} + m_2 c^2 + \gamma_4 \kappa_3
789 * n_1^{\gamma_3} n_2^{\gamma_4-1} + \Delta^2 \gamma_6 \beta
790 * n_1^{\gamma_5} n_2^{\gamma_6-1} \ .
791 * \f]
792 * The pressure is given by the (zero-temperature) First Law of Thermodynamics:
793 * \f$p = \mu_1 n_1 + \mu_2 n_2 - {\cal E}\f$, so that
794 * \f[
795 * p = \frac{1}{2} (\gamma_1 -1)\kappa_1 n_1^{\gamma_1} +
796 * \frac{1}{2}(\gamma_2-1)\kappa_2 n_2^{\gamma_2} + (\gamma_3 +\gamma_4
797 * -1)\kappa_3 n_1^{\gamma_3}n_2^{\gamma_4} + \Delta^2 \beta \left(
798 * (\gamma_5 + \gamma_6 - 1) n_1^{\gamma_5} n_2^{\gamma_6} \right) \ .
799 * \f]
800 * The log-enthalpies are defined as the logarithm of the ratio of the enthalpy
801 * per particle (see Eq.~\ref{eeosbfdefent}) by the particle rest mass energy :
802 * \f[\label{eeosbfentanal}
803 * H_i := c^2 \ln \left( \frac{f_i}{m_ic^2} \right) \ .
804 * \f]
805 * From this system, the particle densities are obtained in term of
806 * the log-enthalpies. (The system (\ref{eeosbfentanal}) is a linear one
807 * if \f$\gamma_1 = \gamma_2 = 2\f$ and \f$\gamma_3 = \gamma_4 = \gamma_5 =
808 * \gamma_6 = 1\f$).
809 *
810 * The energy density \f$\cal E\f$and pressure \e p can then be obtained
811 * as functions of baryonic densities. \ingroup (eos)
812 *
813 */
814 class Eos_bf_poly : public Eos_bifluid {
815
816 // Data :
817 // -----
818
819 protected:
820 /// Adiabatic indexes \f$\gamma_1\f$, see Eq.~\ref{eeosbfpolye}
821 double gam1 ;
822
823 /// Adiabatic indexes \f$\gamma_2\f$, see Eq.~\ref{eeosbfpolye}
824 double gam2 ;
825
826 /// Adiabatic indexes \f$\gamma_3\f$, see Eq.~\ref{eeosbfpolye}
827 double gam3 ;
828
829 /// Adiabatic indexes \f$\gamma_4\f$, see Eq.~\ref{eeosbfpolye}
830 double gam4 ;
831
832 /// Adiabatic indexes \f$\gamma_5\f$, see Eq.~\ref{eeosbfpolye}
833 double gam5 ;
834
835 /// Adiabatic indexes \f$\gamma_6\f$, see Eq.~\ref{eeosbfpolye}
836 double gam6 ;
837
838 /** Pressure coefficient \f$\kappa_1\f$ , see Eq.~\ref{eeosbfpolye}
839 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
840 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
841 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
842 */
843 double kap1 ;
844
845 /** Pressure coefficient \f$\kappa_2\f$ , see Eq.~\ref{eeosbfpolye}
846 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
847 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
848 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
849 */
850 double kap2 ;
851
852 /** Pressure coefficient \f$\kappa_3\f$ , see Eq.~\ref{eeosbfpolye}
853 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
854 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
855 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
856 */
857 double kap3 ;
858
859 /** Coefficient \f$\beta\f$ , see Eq.~\ref{eeosbfpolye}
860 * [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
861 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
862 * \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
863 */
864 double beta ;
865
866 double gam1m1 ; ///< \f$\gamma_1-1\f$
867 double gam2m1 ; ///< \f$\gamma_2-1\f$
868 double gam34m1 ; ///< \f$\gamma_3+\gamma_4-1\f$
869 double gam56m1 ; ///< \f$\gamma_5+\gamma_6-1\f$
870
871 protected:
872 /** The bi-fluid analytical EOS type:
873 *
874 * 0 - \f$\gamma_1 = \gamma_2 = 2\f$ and
875 * \f$\gamma_3 = \gamma_4 = \gamma_5 = \gamma_6 = 1\f$. In this case,
876 * the EOS can be inverted analytically.
877 *
878 * 1 - \f$\gamma_3 = \gamma_4 = \gamma_5 = \gamma_6 = 1\f$, but
879 * \f$\gamma_1 \not= 2\f$ or \f$\gamma_2 \not= 2\f$.
880 *
881 * 2 - \f$\gamma_3 = \gamma_5 = 1\f$, but none of the previous cases.
882 *
883 * 3 - \f$\gamma_4 = \gamma_6 = 1\f$, but none of the previous cases.
884 *
885 * 4 - None of the previous cases (the most general)
886 *
887 * 5 - special case of comparison to slow-rotation approximation:
888 * this is identical to typeos=0, but using a modified
889 * EOS-inversion method, namely we don't switch to a 1-fluid
890 * EOS in 1-fluid regions.
891 *
892 **/
893 int typeos ;
894
895 /** Parameters needed for some inversions of the EOS.
896 * In particular, it is used for type 4 EOS:
897 * contains the relaxation parameter needed in the iteration
898 */
899 double relax ;
900
901 double precis ; ///< contains the precision required in zerosec_b
902
903 ///contains the precision required in the relaxation nbar_ent_p
904 double ecart ;
905
906
907 // Constructors - Destructor
908 // -------------------------
909 public:
910
911 /** Standard constructor.
912 *
913 * The adiabatic indexes \f$\gamma_1\f$ and \f$\gamma_2\f$ are set to 2.
914 * All other adiabatic indexes \f$\gamma_i\f$, \f$i\in 3\dots 6\f$ are
915 * set to 1.
916 * The individual particle masses \f$m_1\f$ and \f$m_2\f$ are set to the
917 * mean baryon mass \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$.
918 * The inversion parameters are set to their default values
919 * (see hereafter the consrtuctor with all parameters).
920 *
921 * @param kappa1 pressure coefficient \f$\kappa_1\f$
922 * @param kappa2 pressure coefficient \f$\kappa_2\f$
923 * @param kappa3 pressure coefficient \f$\kappa_3\f$
924 * @param beta coefficient in the entrainment term \f$\beta\f$
925 * (cf. Eq.~(\ref{eeosbfpolye}))
926 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
927 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
928 */
929 Eos_bf_poly(double kappa1, double kappa2, double kappa3, double beta) ;
930
931 /** Standard constructor with all parameters.
932 *
933 * @param gamma1 adiabatic index \f$\gamma_1\f$
934 * @param gamma2 adiabatic index \f$\gamma_2\f$
935 * @param gamma3 adiabatic index \f$\gamma_3\f$
936 * @param gamma4 adiabatic index \f$\gamma_4\f$
937 * @param gamma5 adiabatic index \f$\gamma_5\f$
938 * @param gamma6 adiabatic index \f$\gamma_6\f$
939 * (cf. Eq.~(\ref{eeosbfpolye}))
940 * @param kappa1 pressure coefficient \f$\kappa_1\f$
941 * @param kappa2 pressure coefficient \f$\kappa_2\f$
942 * @param kappa3 pressure coefficient \f$\kappa_3\f$
943 * @param beta coefficient in the entrainment term \f$\beta\f$
944 * (cf. Eq.~(\ref{eeosbfpolye}))
945 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
946 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
947 * @param mass1 individual particule mass \f$m_1\f$ (neutrons)
948 * @param mass2 individual particule mass \f$m_2\f$ (protons)
949 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$]
950 * @param relax relaxation parameter (see \c par_inv)
951 * @param precis precision parameter for zerosec_b
952 * (see \c par_inv)
953 * @param relax precision parameter for relaxation
954 * procedure (see \c par_inv)
955 *
956 */
957 Eos_bf_poly(double gamma1, double gamma2, double gamma3,
958 double gamma4, double gamma5, double gamma6,
959 double kappa1, double kappa2, double kappa3,
960 double beta, double mass1=1, double mass2=1,
961 double relax=0.5, double precis = 1.e-9,
962 double ecart = 1.e-8) ;
963
964 Eos_bf_poly(const Eos_bf_poly& ) ; ///< Copy constructor
965
966 protected:
967 /** Constructor from a binary file (created by the function
968 * \c sauve(FILE*) ).
969 * This constructor is protected because any EOS construction
970 * from a binary file must be done via the function
971 * \c Eos_bifluid::eos_from_file(FILE*) .
972 */
973 Eos_bf_poly(FILE* ) ;
974
975 /** Constructor from a formatted file.
976 * This constructor is protected because any EOS construction
977 * from a formatted file must be done via the function
978 * \c Eos_bifluid::eos_from_file(const char*) .
979 *
980 */
981 Eos_bf_poly (const char *fname) ;
982
983 /// The construction functions from a file
984 friend Eos_bifluid* Eos_bifluid::eos_from_file(FILE* ) ;
985 friend Eos_bifluid* Eos_bifluid::eos_from_file(const char *fname ) ;
986
987 public:
988 virtual ~Eos_bf_poly() ; ///< Destructor
989
990 // Assignment
991 // ----------
992 /// Assignment to another \c Eos_bf_poly
993 void operator=(const Eos_bf_poly& ) ;
994
995
996 // Miscellaneous
997 // -------------
998 public :
999 /// Comparison operator (egality)
1000 virtual bool operator==(const Eos_bifluid& ) const ;
1001
1002 /// Comparison operator (difference)
1003 virtual bool operator!=(const Eos_bifluid& ) const ;
1004
1005 /** Returns a number to identify the sub-classe of \c Eos_bifluid
1006 * the object belongs to.
1007 */
1008 virtual int identify() const ;
1009
1010 /// Returns the adiabatic index \f$\gamma_1\f$
1011 double get_gam1() const {return gam1 ;};
1012
1013 /// Returns the adiabatic index \f$\gamma_2\f$
1014 double get_gam2() const {return gam2 ;};
1015
1016 /// Returns the adiabatic index \f$\gamma_3\f$
1017 double get_gam3() const {return gam3 ;};
1018
1019 /// Returns the adiabatic index \f$\gamma_4\f$
1020 double get_gam4() const {return gam4 ;};
1021
1022 /// Returns the adiabatic index \f$\gamma_5\f$
1023 double get_gam5() const {return gam5 ;};
1024
1025 /// Returns the adiabatic index \f$\gamma_6\f$
1026 double get_gam6() const {return gam6 ;};
1027
1028 /** Returns the pressure coefficient \f$\kappa_1\f$
1029 * [unit: \f$\rho_{\rm nuc} c^2 \f$], where
1030 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$.
1031 */
1032 double get_kap1() const {return kap1 ;};
1033
1034 /** Returns the pressure coefficient \f$\kappa_2\f$
1035 * [unit: \f$\rho_{\rm nuc} c^2 \f$], where
1036 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$.
1037 */
1038 double get_kap2() const {return kap2 ;};
1039
1040 /** Returns the pressure coefficient \f$\kappa_3\f$
1041 * [unit: \f$\rho_{\rm nuc} c^2 \f$], where
1042 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$.
1043 */
1044 double get_kap3() const {return kap3 ;};
1045
1046 /** Returns the coefficient \f$\beta\f$
1047 * [unit: \f$\rho_{\rm nuc} c^2 \f$], where
1048 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$.
1049 */
1050 double get_beta() const {return beta ;};
1051
1052 // Returns (sub)type of bifluid-eos (member \c typeos})
1053 int get_typeos() const {return typeos;};
1054
1055 protected:
1056 /** Computes the auxiliary quantities \c gam1m1 , \c gam2m1
1057 * and \c gam3m1
1058 */
1059 void set_auxiliary() ;
1060
1061 /// Determines the type of the analytical EOS (see \c typeos )
1062 void determine_type() ;
1063
1064 // Outputs
1065 // -------
1066
1067 public:
1068 virtual void sauve(FILE* ) const ; ///< Save in a file
1069
1070 protected:
1071 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1072
1073
1074 // Computational functions
1075 // -----------------------
1076
1077 public:
1078
1079 /** Computes both baryon densities from the log-enthalpies
1080 *
1081 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1082 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
1083 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1084 *
1085 * @param nbar1 [output] baryonic density of the first fluid
1086 * @param nbar2 [output] baryonic density of the second fluid
1087 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1088 *
1089 */
1090 virtual bool nbar_ent_p(const double ent1, const double ent2,
1091 const double delta2, double& nbar1,
1092 double& nbar2) const ;
1093
1094 /** Computes baryon density out of the log-enthalpy asuming
1095 * that only fluid 1 is present.
1096 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1097 * @return nbar1 baryonic density of the first fluid
1098 */
1099 virtual double nbar_ent_p1(const double ent1) const ;
1100
1101 /** Computes baryon density out of the log-enthalpy assuming
1102 * that only fluid 2 is present.
1103 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1104 * @return nbar1 baryonic density of the first fluid
1105 */
1106 virtual double nbar_ent_p2(const double ent2) const ;
1107
1108 /** Computes the total energy density from the baryonic densities
1109 * and the relative velocity.
1110 *
1111 * @param nbar1 [input] baryonic density of the first fluid
1112 * @param nbar2 [input] baryonic density of the second fluid
1113 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1114 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1115 *
1116 * @return energy density \f$\cal E\f$ [unit: \f$\rho_{\rm nuc} c^2\f$], where
1117 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1118 */
1119 virtual double ener_nbar_p(const double nbar1, const double nbar2,
1120 const double delta2) const ;
1121
1122 /** Computes the pressure from the baryonic densities
1123 * and the relative velocity.
1124 *
1125 * @param nbar1 [input] baryonic density of the first fluid
1126 * @param nbar2 [input] baryonic density of the second fluid
1127 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1128 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1129 *
1130 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1131 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1132 */
1133 virtual double press_nbar_p(const double nbar1, const double nbar2,
1134 const double delta2) const ;
1135 // Conversion functions
1136 // ---------------------
1137
1138 /** Makes a translation from \c Eos_bifluid to \c Eos .
1139 *
1140 * This is only useful for the construction of a
1141 * \c Et_rot_bifluid
1142 * star and ought not to be used in other situations.
1143 */
1144 virtual Eos* trans2Eos() const ;
1145
1146 /** Computes the derivative of the energy with respect to
1147 * (baryonic density 1)\f$^2\f$.
1148 *
1149 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1150 * baryonic density of fluid 1 at which the derivative
1151 * is to be computed
1152 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1153 * baryonic density of fluid 2 at which the derivative
1154 * is to be computed
1155 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
1156 * relative Lorentz factor\f$\times\f$both densities at which
1157 * the derivative is to be computed
1158 *
1159 * @return derivative \f$K^{11}=2\frac{\partial{\cal{E}}}{\partial{n_1^2}}\f$
1160 */
1161 virtual double get_K11(const double n1, const double n2, const
1162 double delta2) const ;
1163
1164 /** Computes the derivative of the energy with respect to
1165 * \f$x^2=n_1n_2\Gamma_\Delta\f$.
1166 *
1167 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1168 * baryonic density of fluid 1 at which the derivative
1169 * is to be computed
1170 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1171 * baryonic density of fluid 2 at which the derivative
1172 * is to be computed
1173 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
1174 * relative Lorentz factor\f$\times\f$both densities at which
1175 * the derivative is to be computed
1176 *
1177 * @return derivative \f$K^{12}=\frac{\partial {\cal E}}{\partial (n_1n_2\Gamma_\Delta)}\f$
1178 */
1179 virtual double get_K12(const double n1, const double n2,const
1180 double delta2) const ;
1181
1182 /** Computes the derivative of the energy/(baryonic density 2)\f$^2\f$.
1183 *
1184 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1185 * baryonic density of fluid 1 at which the derivative
1186 * is to be computed
1187 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1188 * baryonic density of fluid 2 at which the derivative
1189 * is to be computed
1190 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
1191 * relative Lorentz factor\f$\times\f$both densities at which
1192 * the derivative is to be computed
1193 *
1194 * @return derivative \f$K^{22} = 2\frac{\partial {\cal E}}{\partial n_2^2}\f$
1195 */
1196 virtual double get_K22(const double n1, const double n2, const
1197 double delta2) const ;
1198
1199 };
1200
1201 //------------------------------------//
1202 // class Eos_bf_poly_newt //
1203 //------------------------------------//
1204
1205 /**
1206 * Analytic equation of state for two fluids (Newtonian case).
1207 *
1208 * This equation of state (EOS) corresponds to two types of non-relativistic
1209 * particles of rest mass is \f$m_1\f$ and \f$m_2\f$, whose total energy density
1210 * \f$\cal{E}\f$ is related to their numerical densities \f$n_1\f$, \f$n_2\f$ and
1211 * relative velocity \f$\Delta^2\f$
1212 * \f[
1213 * \Delta = \left( \vec{v}_n - \vec{v}_p \right)^2
1214 * \label{e:defdeltan}
1215 * \f]
1216 * by
1217 * \f[ \label{eeosbfnewte}
1218 * {\cal{E}} = \frac{1}{2}\kappa_1 n_1^{\gamma_1}
1219 * \ + \frac{1}{2}\kappa_2 n_2^{\gamma_2}
1220 * \ + \kappa_3 n_1^{\gamma_3} n_2^{\gamma_4}
1221 * \ + \Delta^2 \beta n_1^{\gamma_5} n_2^{\gamma_6}\ .
1222 * \f]
1223 * The non-relativistic chemical potentials are then
1224 * \f[
1225 * \mu_1 := {{\rm d}{\cal{E}} \over {\rm d}n_1} = \frac{1}{2}\gamma_1\kappa_1
1226 * n_1^{\gamma_1-1} + \gamma_3 \kappa_3
1227 * n_1^{\gamma_3-1} n_2^{\gamma_4} + \Delta^2 \gamma_5 \beta
1228 * n_1^{\gamma_5-1} n_2^{\gamma_6}\ ,
1229 * \f]
1230 * \f[
1231 * \mu_2 := {{\rm d}{\cal{E}} \over {\rm d}n_2} = \frac{1}{2}\gamma_2\kappa_2
1232 * n_2^{\gamma_2-1} + \gamma_4 \kappa_3
1233 * n_1^{\gamma_3} n_2^{\gamma_4-1} + \Delta^2 \gamma_6 \beta
1234 * n_1^{\gamma_5} n_2^{\gamma_6-1} \ .
1235 * \f]
1236 * The pressure is given by the (zero-temperature) First Law of Thermodynamics:
1237 * \f$p = \mu_1 n_1 + \mu_2 n_2 - {\cal E}\f$, so that
1238 * \f[
1239 * p = \frac{1}{2} (\gamma_1 -1)\kappa_1 n_1^{\gamma_1} +
1240 * \frac{1}{2}(\gamma_2-1)\kappa_2 n_2^{\gamma_2} + (\gamma_3 +\gamma_4
1241 * -1)\kappa_3 n_1^{\gamma_3}n_2^{\gamma_4} + \Delta^2 \beta \left(
1242 * (\gamma_5 + \gamma_6 - 1) n_1^{\gamma_5} n_2^{\gamma_6} \right) \ .
1243 * \f]
1244 * The
1245 * specific enthalpies are related to the chemical potentials by
1246 * \f[
1247 * h_i = \frac{\mu_i}{m_i}
1248 * \f]
1249 *
1250 * From this system, the particle densities are obtained in term of
1251 * the enthalpies. (The system is a linear one
1252 * if \f$\gamma_1 = \gamma_2 = 2\f$ and \f$\gamma_3 = \gamma_4 = \gamma_5 =
1253 * \gamma_6 = 1\f$). \ingroup (eos)
1254 *
1255 * The energy density \f$\cal E\f$and pressure \e p can then be obtained.
1256 *
1257 */
1258 class Eos_bf_poly_newt : public Eos_bf_poly {
1259
1260 // Data :
1261 // -----
1262
1263 // no new data with respect to Eos_bf_poly
1264
1265 // Constructors - Destructor
1266 // -------------------------
1267 public:
1268
1269 /** Standard constructor.
1270 *
1271 * The adiabatic indexes \f$\gamma_1\f$ and \f$\gamma_2\f$ are set to 2.
1272 * All other adiabatic indexes \f$\gamma_i\f$, \f$i\in 3\dots 6\f$ are
1273 * set to 1.
1274 * The individual particle masses \f$m_1\f$ and \f$m_2\f$ are set to the
1275 * mean baryon mass \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$.
1276 * The inversion parameters are set to their default values
1277 * (see hereafter the consrtuctor with all parameters).
1278 *
1279 * @param kappa1 pressure coefficient \f$\kappa_1\f$
1280 * @param kappa2 pressure coefficient \f$\kappa_2\f$
1281 * @param kappa3 pressure coefficient \f$\kappa_3\f$
1282 * @param beta coefficient in the entrainment term \f$\beta\f$
1283 * (cf. Eq.~(\ref{eeosbfpolye}))
1284 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
1285 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1286 */
1287 Eos_bf_poly_newt(double kappa1, double kappa2, double kappa3,
1288 double beta) ;
1289
1290 /** Standard constructor with all parameters.
1291 *
1292 * @param gamma1 adiabatic index \f$\gamma_1\f$
1293 * @param gamma2 adiabatic index \f$\gamma_2\f$
1294 * @param gamma3 adiabatic index \f$\gamma_3\f$
1295 * @param gamma4 adiabatic index \f$\gamma_4\f$
1296 * @param gamma5 adiabatic index \f$\gamma_5\f$
1297 * @param gamma6 adiabatic index \f$\gamma_6\f$
1298 * (cf. Eq.~(\ref{eeosbfpolye}))
1299 * @param kappa1 pressure coefficient \f$\kappa_1\f$
1300 * @param kappa2 pressure coefficient \f$\kappa_2\f$
1301 * @param kappa3 pressure coefficient \f$\kappa_3\f$
1302 * @param beta coefficient in the entrainment term \f$\beta\f$
1303 * (cf. Eq.~(\ref{eeosbfpolye}))
1304 * [unit: \f$\rho_{\rm nuc} c^2\f$], where
1305 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1306 * @param mass1 individual particule mass \f$m_1\f$ (neutrons)
1307 * @param mass2 individual particule mass \f$m_2\f$ (protons)
1308 * @param relax relaxation parameter (see \c par_inv)
1309 * @param precis precision parameter for zerosec_b
1310 * (see \c par_inv)
1311 * @param relax precision parameter for relaxation
1312 * procedure (see \c par_inv)
1313 *
1314 * [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$]
1315 */
1316 Eos_bf_poly_newt(double gamma1, double gamma2, double gamma3,
1317 double gamma4, double gamma5, double gamma6,
1318 double kappa1, double kappa2, double kappa3,
1319 double beta, double mass1, double mass2,
1320 double relax=0.5, double precis = 1.e-9,
1321 double ecart = 1.e-8) ;
1322
1323
1324 Eos_bf_poly_newt(const Eos_bf_poly_newt& ) ; ///< Copy constructor
1325
1326 protected:
1327 /** Constructor from a binary file (created by the function
1328 * \c sauve(FILE*) ).
1329 * This constructor is protected because any EOS construction
1330 * from a binary file must be done via the function
1331 * \c Eos_bifluid::eos_from_file(FILE*) .
1332 */
1333 Eos_bf_poly_newt(FILE* ) ;
1334
1335 /** Constructor from a formatted file.
1336 * This constructor is protected because any EOS construction
1337 * from a formatted file must be done via the function
1338 * \c Eos_bifluid::eos_from_file(const char* ) .
1339 */
1340 Eos_bf_poly_newt(const char *fname ) ;
1341
1342 /// The construction functions from a file
1343 friend Eos_bifluid* Eos_bifluid::eos_from_file(FILE* ) ;
1344 friend Eos_bifluid* Eos_bifluid::eos_from_file(const char *fname) ;
1345
1346 public:
1347 virtual ~Eos_bf_poly_newt() ; ///< Destructor
1348
1349 // Assignment
1350 // ----------
1351 /// Assignment to another \c Eos_bf_poly_newt
1352 void operator=(const Eos_bf_poly_newt& ) ;
1353
1354
1355 // Miscellaneous
1356 // -------------
1357
1358 public :
1359 /// Comparison operator (egality)
1360 virtual bool operator==(const Eos_bifluid& ) const ;
1361
1362 /// Comparison operator (difference)
1363 virtual bool operator!=(const Eos_bifluid& ) const ;
1364
1365 /** Returns a number to identify the sub-classe of \c Eos_bifluid
1366 * the object belongs to.
1367 */
1368 virtual int identify() const ;
1369
1370 // Outputs
1371 // -------
1372
1373 public:
1374 virtual void sauve(FILE* ) const ; ///< Save in a file
1375
1376 protected:
1377 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1378
1379
1380 // Computational functions
1381 // -----------------------
1382
1383 public:
1384
1385 /** Computes both baryon densities from the log-enthalpies
1386 *
1387 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1388 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
1389 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1390 *
1391 * @param nbar1 [output] baryonic density of the first fluid
1392 * @param nbar2 [output] baryonic density of the second fluid
1393 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1394 *
1395 */
1396 virtual bool nbar_ent_p(const double ent1, const double ent2,
1397 const double delta2, double& nbar1,
1398 double& nbar2) const ;
1399
1400 /** Computes baryon density out of the log-enthalpy asuming
1401 * that only fluid 1 is present (virtual function implemented
1402 * in the derived classes).
1403 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1404 * @return nbar1 baryonic density of the first fluid
1405 */
1406 virtual double nbar_ent_p1(const double ent1) const ;
1407
1408 /** Computes baryon density out of the log-enthalpy assuming
1409 * that only fluid 2 is present.
1410 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1411 * @return nbar1 baryonic density of the first fluid
1412 */
1413 virtual double nbar_ent_p2(const double ent2) const ;
1414
1415 /** Computes the total energy density from the baryonic densities
1416 * and the relative velocity.
1417 *
1418 * @param nbar1 [input] baryonic density of the first fluid
1419 * @param nbar2 [input] baryonic density of the second fluid
1420 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1421 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1422 *
1423 * @return energy density \f$\cal E\f$ [unit: \f$\rho_{\rm nuc} c^2\f$], where
1424 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1425 */
1426 virtual double ener_nbar_p(const double nbar1, const double nbar2,
1427 const double delta2) const ;
1428
1429 /** Computes the pressure from the baryonic densities
1430 * and the relative velocity.
1431 *
1432 * @param nbar1 [input] baryonic density of the first fluid
1433 * @param nbar2 [input] baryonic density of the second fluid
1434 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1435 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1436 *
1437 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1438 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1439 */
1440 virtual double press_nbar_p(const double nbar1, const double nbar2,
1441 const double delta2) const ;
1442 // Conversion functions
1443 // ---------------------
1444
1445 /** Makes a translation from \c Eos_bifluid to \c Eos .
1446 *
1447 * This is only useful for the construction of a
1448 * \c Et_rot_bifluid
1449 * star and ought not to be used in other situations.
1450 */
1451 virtual Eos* trans2Eos() const ;
1452
1453 /** Computes the derivative of the energy with respect to
1454 * (baryonic density 1)\f$^2\f$.
1455 *
1456 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1457 * baryonic density of fluid 1 at which the derivative
1458 * is to be computed
1459 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1460 * baryonic density of fluid 2 at which the derivative
1461 * is to be computed
1462 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
1463 * relative Lorentz factor\f$\times\f$both densities at which
1464 * the derivative is to be computed
1465 *
1466 * @return derivative \f$K^{11}=2\frac{\partial{\cal{E}}}{\partial{n_1^2}}\f$
1467 */
1468 virtual double get_K11(const double n1, const double n2, const
1469 double delta2) const ;
1470
1471 /** Computes the derivative of the energy with respect to
1472 * \f$x^2=n_1n_2\Gamma_\Delta\f$.
1473 *
1474 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1475 * baryonic density of fluid 1 at which the derivative
1476 * is to be computed
1477 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1478 * baryonic density of fluid 2 at which the derivative
1479 * is to be computed
1480 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
1481 * relative Lorentz factor\f$\times\f$both densities at which
1482 * the derivative is to be computed
1483 *
1484 * @return derivative \f$K^{12}=\frac{\partial {\cal E}}{\partial (n_1n_2\Gamma_\Delta)}\f$
1485 */
1486 virtual double get_K12(const double n1, const double n2,const
1487 double delta2) const ;
1488
1489 /** Computes the derivative of the energy/(baryonic density 2)\f$^2\f$.
1490 *
1491 * @param n1 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1492 * baryonic density of fluid 1 at which the derivative
1493 * is to be computed
1494 * @param n2 [input, unit \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1495 * baryonic density of fluid 2 at which the derivative
1496 * is to be computed
1497 * @param x [input, unit \f$n_{\rm nuc}^2c^2\f$]
1498 * relative Lorentz factor\f$\times\f$both densities at which
1499 * the derivative is to be computed
1500 *
1501 * @return derivative \f$K^{22} = 2\frac{\partial {\cal E}}{\partial n_2^2}\f$
1502 */
1503 virtual double get_K22(const double n1, const double n2, const
1504 double delta2) const ;
1505
1506 };
1507
1508
1509 /* Declaration of the new class Eos_bf_tabul derived from Eos_bifluid */
1510
1511 //------------------------------------//
1512 // class Eos_bf_tabul //
1513 //------------------------------------//
1514
1515 /**
1516 * Class for a two-fluid (tabulated) equation of state.
1517 *
1518 * This EOS depends on three variables \f$(\Delta^2, \mu_n, \mu_p )\f$: relative velocity
1519 * between the two fluids and the two enthalpies (for neutrons and protons).
1520 *
1521 * The interpolation through the tables is
1522 * a cubic Hermite interpolation in \f$\mu_n\f$ and \f$\mu_p\f$ which is
1523 * thermodynamically consistent, i.e. preserves the
1524 * Gibbs-Duhem relation. It is defined in
1525 * [Nozawa, Stergioulas, Gourgoulhon \& Eriguchi,
1526 * \a Astron. \a Astrophys. Suppl. Ser. \b 132 , 431 (1998)],
1527 * and derives from a general technique presented in
1528 * [Swesty, \a J. \a Comp. \a Phys. \b 127 , 118 (1996)].
1529 * The value of \f$\Delta^{2}\f$ being calculated with a first order precision,
1530 * we use a linear interpolation in \f$\Delta^{2}\f$.
1531 *
1532 */
1533
1534 class Eos_bf_tabul : public Eos_bifluid {
1535
1536 // Data :
1537 // -----
1538
1539 protected:
1540 /// Name of the file containing the tabulated data (be careful, Eos_bifluid uses char*)
1541 string tablename ;
1542
1543 /// Authors
1544 string authors ;
1545
1546 /// Lower boundary of the relative velocity interval --> 0 ?
1547 double delta_car_min ;
1548
1549 /// Upper boundary of the relative velocity interval --> 1 ?
1550 /// or a maximal value until which the linear approximation in \Delta^{2} is fine ?
1551 double delta_car_max ;
1552
1553
1554 /// Lower boundary of the log-enthalpy interval (fluid 1 = n)
1555 double ent1_min ;
1556
1557 /// Upper boundary of the log-enthalpy interval (fluid 1 = n)
1558 double ent1_max ;
1559
1560 /// Lower boundary of the log-enthalpy interval (fluid 2 = p)
1561 double ent2_min ;
1562
1563 /// Upper boundary of the log-enthalpy interval (fluid 2 = p)
1564 double ent2_max ;
1565
1566 /**
1567 * Table of \f$ \log H_n \f$ where
1568 * \f$ H_n = \ln \left( \frac{\mu_n}{m_n} \right) \f$.
1569 */
1570 Tbl* logent1 ;
1571
1572 /**
1573 * Table of \f$ \log H_p \f$ where
1574 * \f$ H_p = \ln \left( \frac{\mu_p}{m_p} \right) \f$.
1575 */
1576 Tbl* logent2 ;
1577
1578 /// Table of \f$ \Delta^{2} \f$
1579 Tbl* delta_car ;
1580
1581 /// Table of \f$ \log \Psi \f$
1582 Tbl* logp ;
1583
1584 /// Table of \f$ \frac {\partial \log \Psi } {\partial \log H_n}\f$
1585 Tbl* dlpsdlent1 ;
1586
1587 /// Table of \f$ \frac {\partial \log \Psi } {\partial \log H_p}\f$
1588 Tbl* dlpsdlent2 ;
1589
1590 /// Table of \f$ \frac {\partial^2 \log \Psi} {\partial \log H_n \partial \log H_p} \f$
1591 Tbl* d2lpsdlent1dlent2 ;
1592
1593 /// Table of \f$ \frac {\partial^2 \log \Psi} {\partial \log H_n \partial \log H_n} \f$
1594 Tbl* d2lpsdlent1dlent1 ;
1595 /// Table of \f$ \frac {\partial^2 \log \Psi} {\partial \log H_p \partial \log H_p} \f$
1596 Tbl* d2lpsdlent2dlent2 ;
1597
1598
1599 /// Table of \f$ \frac {\partial \log \Psi}{\partial \Delta^{2}} \f$
1600 Tbl* dlpsddelta_car ;
1601
1602 /// Table of \f$ \frac {\partial^2 \log \Psi} {\partial \log H_n \partial \Delta^{2}} \f$
1603 Tbl* d2lpsdlent1ddelta_car ;
1604
1605 /// Table of \f$ \frac {\partial^2 \log \Psi} {\partial \log H_p \partial \Delta^{2}} \f$
1606 Tbl* d2lpsdlent2ddelta_car ;
1607
1608 /// if necessary for the interpolation to find alpha (derivee seconde croisee)
1609 /// ie, if it's possible to calculate it (when the eos is calculated)
1610 /// Table of \f$ \frac {\partial^3 \log \Psi} {\partial \log H_p \partial \log H_n \partial \Delta^{2}} \f$
1611 Tbl* d3lpsdlent1dlent2ddelta_car ;
1612
1613
1614 // to save the limit curve of nn = 0
1615 Tbl* delta_car_n0 ;
1616 Tbl* mu1_n0 ;
1617 Tbl* mu2_n0 ;
1618 // to save the limit curve of np = 0
1619 Tbl* delta_car_p0 ;
1620 Tbl* mu1_p0 ;
1621 Tbl* mu2_p0 ;
1622
1623 // to save the 1 fluid table //
1624 Tbl* mu1_N ;
1625 Tbl* n_n_N ;
1626 Tbl* press_N ;
1627 Tbl* mu2_P ;
1628 Tbl* n_p_P ;
1629 Tbl* press_P ;
1630
1631
1632 // Constructors - Destructor
1633 // -------------------------
1634 protected:
1635
1636 /** Standard constructor.
1637 *
1638 * @param name_i Name of the equation of state
1639 * @param table Name of the file containing the EOS table
1640 * @param path Path to the directory containing the EOS file
1641 * @param mass1 Mass of particles in fluid 1 (neutrons)
1642 * @param mass2 Mass of particles in fluid 2 (protons)
1643 */
1644 Eos_bf_tabul(const char* name_i, const char* table, const char* path, double mass1, double mass2) ;
1645
1646 /** Standard constructor from the full filename.
1647 *
1648 * @param name_i Name of the equation of state
1649 * @param file_name Full name of the file containing the EOS table
1650 * (including the absolute path).
1651 * @param mass1 Mass of particles in fluid 1 (neutrons)
1652 * @param mass2 Mass of particles in fluid 2 (protons)
1653 */
1654 Eos_bf_tabul(const char* name_i, const char* file_name, double mass1, double mass2) ;
1655
1656 private:
1657 Eos_bf_tabul(const Eos_bf_tabul& ) ; ///< Copy constructor
1658
1659 protected:
1660
1661 /** Constructor from a binary file (created by the function
1662 * \c sauve(FILE*) ).
1663 * This constructor is protected because any EOS construction
1664 * from a binary file must be done via the function
1665 * \c Eos_bifluid::eos_from_file(FILE*) .
1666 */
1667 Eos_bf_tabul(FILE* ) ;
1668
1669 /** Constructor from a formatted file.
1670 * This constructor is protected because any EOS construction
1671 * from a formatted file must be done via the function
1672 * \c Eos_bifluid::eos_from_file(ifstream\& ) .
1673 *
1674 * @param ist input file stream containing a name as first line
1675 * and the path to the directory containing the EOS file
1676 * as second line
1677 * @param table Name of the file containing the EOS table
1678 */
1679 Eos_bf_tabul(ifstream& ist, const char* table) ;
1680
1681 /** Constructor from a formatted file.
1682 * This constructor is protected because any EOS construction
1683 * from a formatted file must be done via the function
1684 * \c Eos::eos_from_file(ifstream\& ) .
1685 *
1686 * @param ist input file stream containing a name as first line
1687 * and the full filename (including the path) containing
1688 * the EOS file as second line
1689 */
1690 Eos_bf_tabul(ifstream& ist) ;
1691
1692 /// The construction functions from a file
1693 friend Eos_bifluid* Eos_bifluid::eos_from_file(FILE* ) ;
1694 friend Eos_bifluid* Eos_bifluid::eos_from_file(ifstream& ) ;
1695
1696 public:
1697 virtual ~Eos_bf_tabul() ; ///< Destructor
1698
1699 // Assignment
1700 // ----------
1701 private :
1702 /// Assignment to another \c Eos_bf_tabul
1703 void operator=(const Eos_bf_tabul& ) ;
1704
1705
1706 // Miscellaneous
1707 // -------------
1708
1709 protected:
1710 /** Reads the file containing the table and initializes
1711 * the arrays logent1, \c logent2, \c delta_car, \c logp, \c dlpsdlent1, \c dlpsdlent2,
1712 * \c d2lpsdlent1dlent2, \c dlpsddelta_car, \c d2lpsdlent1ddelta_car,
1713 * \c d2lpsdlent2ddelta_car, \c d3lpsdlent1dlent2ddelta_car
1714 **/
1715 void read_table() ;
1716
1717 public :
1718 /// Comparison operator (egality)
1719 virtual bool operator==(const Eos_bifluid& ) const ;
1720
1721 /// Comparison operator (difference)
1722 virtual bool operator!=(const Eos_bifluid& ) const ;
1723
1724 /** Returns a number to identify the sub-classe of \c Eos the
1725 * object belongs to.
1726 */
1727 virtual int identify() const ;
1728
1729
1730 // Outputs
1731 // -------
1732
1733 public:
1734 virtual void sauve(FILE* ) const ; ///< Save in a file
1735
1736
1737 protected:
1738 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
1739
1740
1741 // Computational functions
1742 // -----------------------
1743
1744 public:
1745 /** General computational method for \c Cmp 's, it computes
1746 * both baryon densities, energy and pressure profiles.
1747 *
1748 * @param ent1 [input] the first log-enthalpy field \f$H_1\f$.
1749 * @param ent2 [input] the second log-enthalpy field \f$H_2\f$.
1750 * @param delta2 [input] the relative velocity field \f$\Delta^2 \f$
1751 * @param nbar1 [output] baryonic density of the first fluid
1752 * @param nbar2 [output] baryonic density of the second fluid
1753 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1754 * @param ener [output] total energy density \f$\cal E\f$
1755 * of both fluids together
1756 * @param press [output] pressure \e p of both fluids together
1757 * @param K_nn [output] coefficient \f$ K_{nn} \f$
1758 * @param K_np [output] coefficient \f$ K_{np} \f$
1759 * @param K_pp [output] coefficient \f$ K_{pp} \f$
1760 * @param nzet [input] number of domains where \c resu is to be
1761 * computed.
1762 * @param l_min [input] index of the innermost domain is which
1763 * \c resu is to be computed [default value: 0];
1764 * \c resu is computed only in domains whose indices are
1765 * in \c [l_min,l_min+nzet-1] . In the other
1766 * domains, it is set to zero.
1767 */
1768 void calcule_interpol(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2,
1769 Cmp& nbar1, Cmp& nbar2, Cmp& ener, Cmp& press,
1770 Cmp& K_nn, Cmp& K_np, Cmp& K_pp,
1771 int nzet, int l_min = 0) const ;
1772
1773 /** Computes both baryon densities from the log-enthalpies
1774 *
1775 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1776 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$
1777 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$
1778 *
1779 * @param nbar1 [output] baryonic density of the first fluid
1780 * @param nbar2 [output] baryonic density of the second fluid
1781 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1782 *
1783 */
1784 virtual bool nbar_ent_p(const double ent1, const double ent2,
1785 const double delta2, double& nbar1,
1786 double& nbar2) const ;
1787
1788 /** Computes baryon density out of the log-enthalpy asuming
1789 * that only fluid 1 is present.
1790 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1791 * @return nbar1 baryonic density of the first fluid
1792 */
1793 virtual double nbar_ent_p1(const double ent1) const ;
1794
1795 /** Computes baryon density out of the log-enthalpy assuming
1796 * that only fluid 2 is present.
1797 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1798 * @return nbar1 baryonic density of the first fluid
1799 */
1800 virtual double nbar_ent_p2(const double ent2) const ;
1801
1802 /** Computes the total energy density from the baryonic densities
1803 * and the relative velocity.
1804 *
1805 * @param nbar1 [input] baryonic density of the first fluid
1806 * @param nbar2 [input] baryonic density of the second fluid
1807 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1808 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1809 *
1810 * @return energy density \f$\cal E\f$ [unit: \f$\rho_{\rm nuc} c^2\f$], where
1811 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1812 */
1813 virtual double ener_nbar_p(const double nbar1, const double nbar2,
1814 const double delta2) const ;
1815
1816 /** Computes the pressure from the baryonic densities
1817 * and the relative velocity.
1818 *
1819 * @param nbar1 [input] baryonic density of the first fluid
1820 * @param nbar2 [input] baryonic density of the second fluid
1821 * [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
1822 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$\Delta^2\f$
1823 *
1824 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1825 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1826 */
1827 virtual double press_nbar_p(const double nbar1, const double nbar2,
1828 const double delta2) const ;
1829
1830 /** Computes the derivative of the energy with respect to
1831 * (baryonic density 1)\f$^2\f$.
1832 *
1833 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$ of fluid 1 at
1834 * which the derivative is to be computed
1835 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$ of fluid 2 at
1836 * which the derivative is to be computed
1837 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$ at
1838 * which the derivative is to be computed
1839 *
1840 * @return derivative \f$K^{11}=2\frac{\partial{\cal{E}}}{\partial{n_1^2}}\f$
1841 */
1842 virtual double get_K11(const double delta2, const double ent1,
1843 const double ent2) const ;
1844
1845 /** Computes the derivative of the energy with respect to
1846 * \f$x^2=n_1n_2\Gamma_\Delta\f$.
1847 *
1848 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$ of fluid 1 at
1849 * which the derivative is to be computed
1850 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$ of fluid 2 at
1851 * which the derivative is to be computed
1852 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$ at
1853 * which the derivative is to be computed
1854 *
1855 * @return derivative \f$K^{12}=\frac{\partial {\cal E}}{\partial (n_1n_2\Gamma_\Delta)}\f$
1856 */
1857 virtual double get_K12(const double delta2, const double ent1 ,
1858 const double ent2) const ;
1859
1860 /** Computes the derivative of the energy/(baryonic density 2)\f$^2\f$.
1861 *
1862 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$ of fluid 1 at
1863 * which the derivative is to be computed
1864 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$ of fluid 2 at
1865 * which the derivative is to be computed
1866 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$ at
1867 * which the derivative is to be computed
1868 *
1869 * @return derivative \f$K^{22} = 2\frac{\partial {\cal E}}{\partial n_2^2}\f$
1870 */
1871 virtual double get_K22(const double delta2, const double ent1,
1872 const double ent2) const ;
1873
1874 /** Computes the total energy density from the baryonic log-enthalpies
1875 * and the relative velocity.
1876 *
1877 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$ of fluid 1
1878 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$ of fluid 2
1879 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$
1880 *
1881 * @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
1882 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1883 */
1884 virtual double ener_ent_p(const double ent1, const double ent2,
1885 const double delta_car) const ;
1886
1887 /** Computes the pressure from the baryonic log-enthalpies
1888 * and the relative velocity. Computes the pressure from the log-enthalpy.
1889 *
1890 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$ of fluid 1
1891 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$ of fluid 2
1892 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$
1893 *
1894 * @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
1895 * \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
1896 */
1897 virtual double press_ent_p(const double ent1, const double ent2,
1898 const double delta_car) const ;
1899
1900
1901
1902 /** Computes the pressure from the baryonic log-enthalpies asuming
1903 * that only fluid 1 is present.
1904 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1905 * @return nbar1 baryonic density of the first fluid
1906 */
1907 virtual double press_ent_p1(const double ent1) const ;
1908
1909 /** Computes the pressure from the baryonic log-enthalpies assuming
1910 * that only fluid 2 is present.
1911 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$
1912 * @return nbar1 baryonic density of the first fluid
1913 */
1914 virtual double press_ent_p2(const double ent2) const ;
1915
1916
1917
1918 /** Computes alpha, the derivative of the total energy density
1919 * with respect to \f$ \Delta^2\f$ from the baryonic log-enthalpies
1920 * and the relative velocity.
1921 *
1922 * @param ent1 [input, unit: \f$c^2\f$] log-enthalpy \f$H_1\f$ of fluid 1
1923 * @param ent2 [input, unit: \f$c^2\f$] log-enthalpy \f$H_2\f$ of fluid 2
1924 * @param delta2 [input, unit: \f$c^2\f$] relative velocity \f$ \Delta^2\f$
1925 *
1926 * @return \alpha
1927 */
1928 virtual double alpha_ent_p(const double ent1, const double ent2,
1929 const double delta_car) const ;
1930
1931
1932 // Conversion function
1933 // ---------------------
1934
1935 /** Makes a translation from \c Eos_bifluid to \c Eos .
1936 *
1937 * This is only useful for the construction of a
1938 * \c Et_rot_bifluid star and ought not to be used in other situations.
1939 */
1940 virtual Eos* trans2Eos() const ;
1941
1942 };
1943
1944
1945 }
1946 #endif