/usr/include/lorene/C++/Include/hoteos.h is in liblorene-dev 0.0.0~cvs20161116+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | /*
* Definition of Lorene class Hot_eos.
*
*/
/*
* Copyright (c) 2015 Jerome Novak
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __HOTEOS_H_
#define __HOTEOS_H_
/*
* $Id: hoteos.h,v 1.3 2015/12/08 10:52:17 j_novak Exp $
* $Log: hoteos.h,v $
* Revision 1.3 2015/12/08 10:52:17 j_novak
* New class Hoteos_tabul for tabulated temperature-dependent EoSs.
*
* Revision 1.2 2015/09/10 13:28:00 j_novak
* New methods for the class Hot_Eos
*
* Revision 1.1 2015/03/17 14:19:59 j_novak
* New class Hot_eos to deal with temperature-dependent EOSs.
*
*
* $Header: /cvsroot/Lorene/C++/Include/hoteos.h,v 1.3 2015/12/08 10:52:17 j_novak Exp $
*
*/
//C++ headers
#include "headcpp.h"
//C headers
#include<cstdio>
#include "tbl.h"
namespace Lorene{
class Scalar ;
class Param ;
class Eos ;
//------------------------------------//
// class Hot_eos //
//------------------------------------//
/**
* Base class for temperature-dependent equations of state (abstract class).
* \ingroup(eos)
*
*/
class Hot_eos {
// Data :
// -----
protected:
string name ; ///< EOS name
// Constructors - Destructor
// -------------------------
protected:
Hot_eos() ; ///< Standard constructor
/// Standard constructor from a name (string)
explicit Hot_eos(const string&) ;
/// Standard constructor from a name (char*)
explicit Hot_eos(const char*) ;
Hot_eos(const Hot_eos& ) ; ///< Copy constructor
/** Constructor from a binary file (created by the function
* \c sauve(FILE*) ).
* This constructor is protected because any hot EOS construction
* from a binary file must be done via the function
* \c Hot_eos::hoteos_from_file(FILE*) .
*/
Hot_eos(FILE* ) ;
/** Constructor from a formatted file.
* This constructor is protected because any hot EOS construction
* from a formatted file must be done via the function
* \c Hot_eos::hoteos_from_file(ifstream&) .
*/
Hot_eos(ifstream& ) ;
public:
virtual ~Hot_eos() ; ///< Destructor
// Derived data :
// ------------
protected:
mutable Eos* p_cold_eos ; ///< Corresponding cold Eos.
/// Deletes all the derived quantities
virtual void del_deriv() const ;
/// Sets to \c 0x0 all the pointers on derived quantities
void set_der_0x0() const ;
// Name manipulation
// -----------------
public:
/// Returns the hot EOS name
const string& get_name() const {return name; };
/// Sets the hot EOS name
void set_name(const char* ) ;
// Miscellaneous
// -------------
public:
/** Construction of an EOS from a binary file.
* The file must have been created by the function \c sauve(FILE*) .
*/
static Hot_eos* hoteos_from_file(FILE* ) ;
/** Construction of a hot EOS from a formatted file.
*
* The fist line of the file must start by the EOS number, according
* to the following conventions:
* - 1 = relativistic ideal gas (class \c Ideal_gas ).
* - 2 = non-relativistic ideal gas (class \c Ideal_gas_norel ).
*
* The second line in the file should contain a name given by the user to the EOS.
* The following lines should contain the EOS parameters (one
* parameter per line), in the same order than in the class declaration.
*/
static Hot_eos* hoteos_from_file(ifstream& ) ;
/// Comparison operator (egality)
virtual bool operator==(const Hot_eos& ) const = 0 ;
/// Comparison operator (difference)
virtual bool operator!=(const Hot_eos& ) const = 0 ;
/** Returns a number to identify the sub-classe of \c Hot_eos the
* object belongs to.
*/
virtual int identify() const = 0 ;
// Outputs
// -------
public:
virtual void sauve(FILE* ) const ; ///< Save in a file
/// Display
friend ostream& operator<<(ostream& , const Hot_eos& ) ;
protected:
virtual ostream& operator>>(ostream &) const = 0 ; ///< Operator >>
public:
/// Returns the corresponding cold \c Eos.
virtual const Eos& new_cold_Eos() const = 0 ;
// Computational functions
// -----------------------
protected:
/** General computational method for \c Scalar 's
*
* @param thermo1 [input] first thermodynamical quantity (for instance the
* enthalpy field) from which the thermodynamical quantity \c resu
* is to be computed.
* @param thermo2 [input] second thermodynamical quantity (for instance the
* entropy field) from which the thermodynamical quantity \c resu
* is to be computed.
* @param nzet [input] number of domains where \c resu is to be
* computed.
* @param l_min [input] index of the innermost domain is which \c resu
* is to be computed [default value: 0]; \c resu is computed only in
* domains whose indices are in \c [l_min,l_min+nzet-1] . In the other
* domains, it is set to zero.
* @param fait [input] pointer on the member function of class
* \c Hot_eos which performs the pointwise calculation.
* @param resu [output] result of the computation.
*/
void calcule(const Scalar& thermo1, const Scalar& thermo2, int nzet, int l_min,
double (Hot_eos::*fait)(double, double) const, Scalar& resu) const ;
public:
/** Computes the baryon density from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} (to be modified) \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
*
*/
virtual double nbar_Hs_p(double ent, double sb) const = 0 ;
/** Computes the baryon density field from the log-enthalpy field and
* entropy per baryon.
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
* @param nzet number of domains where the baryon density is to be
* computed.
* @param l_min index of the innermost domain is which the baryon
* density is
* to be computed [default value: 0]; the baryon density is
* computed only in domains whose indices are in
* \c [l_min,l_min+nzet-1] . In the other
* domains, it is set to zero.
*
* @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
*
*/
Scalar nbar_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
/** Computes the total energy density from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
virtual double ener_Hs_p(double ent, double sb) const = 0 ;
/** Computes the total energy density from the log-enthalpy and entropy per baryon.
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
* @param nzet number of domains where the energy density is to be
* computed.
* @param l_min index of the innermost domain is which the energy
* density is
* to be computed [default value: 0]; the energy density is
* computed only in domains whose indices are in
* \c [l_min,l_min+nzet-1] . In the other
* domains, it is set to zero.
*
* @return energy density [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
Scalar ener_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
/** Computes the pressure from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
virtual double press_Hs_p(double ent, double sb) const = 0 ;
/** Computes the pressure from the log-enthalpy and entropy per baryon.
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
* @param nzet number of domains where the pressure is to be
* computed.
* @param l_min index of the innermost domain is which the pressure is
* to be computed [default value: 0]; the pressure is computed
* only in domains whose indices are in \c [l_min,l_min+nzet-1] .
* In the other domains, it is set to zero.
*
* @return pressure [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*
*/
Scalar press_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
/** Computes the temperature from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} (to be modified) \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return temperature [unit: MeV]
*
*/
virtual double temp_Hs_p(double ent, double sb) const = 0 ;
/** Computes the temperature field from the log-enthalpy field and
* entropy per baryon.
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
* @param nzet number of domains where the baryon density is to be
* computed.
* @param l_min index of the innermost domain is which the baryon
* density is
* to be computed [default value: 0]; the baryon density is
* computed only in domains whose indices are in
* \c [l_min,l_min+nzet-1] . In the other
* domains, it is set to zero.
*
* @return temperature [unit: MeV]
*
*/
Scalar temp_Hs(const Scalar& ent, const Scalar& sb, int nzet, int l_min = 0) const ;
};
ostream& operator<<(ostream& , const Hot_eos& ) ;
//------------------------------------//
// class Ideal_gas //
//------------------------------------//
/**
* Ideal-gas (temperature-dependent) equation of state, with mass-term
* in the energy density.
*
* \f[
* p(n, s_b) = \kappa n^\gamma e^{(\gamma-1)s_b}\ .\qquad (1)
* \f]
* and \f[
* e(n, s_b) = \frac{\kappa}{\gamma - 1} n^\gamma e^{(\gamma-1)s_b} + m_0\, n\ .
* \qquad (2) \f]
* ### (to be written...)
*
*\ingroup (eos)
*
*/
class Ideal_gas : public Hot_eos {
// Data :
//-------
protected:
/// Adiabatic index \f$\gamma\f$
double gam ;
/** Pressure coefficient \f$\kappa\f$ (cf. Eq. (1))
* [unit: \f$\rho_{\rm nuc} c^2 / n_{\rm nuc}^\gamma\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$ and
* \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$.
*/
double kap ;
/** Individual particule mass \f$m_0\f$ (cf. Eq. (2))
* [unit: \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$].
*/
double m_0 ;
double gam1 ; ///< \f$\gamma-1\f$
double unsgam1 ; ///< \f$1/(\gamma-1)\f$
double gam1sgamkap ; ///< \f$(\gamma-1) / (\gamma \kappa) m_0\f$
// Constructors - Destructor
// -------------------------
public:
/** Standard constructor.
*
* Unless specified, the individual particle mass \f$m_0\f$ is set
* to the mean baryon mass \f$m_B = 1.66\ 10^{-27} \ {\rm kg}\f$.
*
* @param gamma adiabatic index \f$\gamma\f$
* @param kappa pressure coefficient \f$\kappa\f$
* @param mass individual particule mass \f$m_0\f$
*/
Ideal_gas(double gamma, double kappa, double mass=1.) ;
Ideal_gas(const Ideal_gas& ) ; ///< Copy constructor
protected:
/** Constructor from a binary file (created by the function
* \c sauve(FILE*) ).
* This constructor is protected because any hot EOS construction
* from a binary file must be done via the function
* \c Hot_eos::eos_from_file(FILE*) .
*/
Ideal_gas(FILE* ) ;
/** Constructor from a formatted file.
* This constructor is protected because any EOS construction
* from a formatted file must be done via the function
* \c Hot_eos::hoteos_from_file(ifstream&) .
*/
Ideal_gas(ifstream& ) ;
/// The construction functions from a file
friend Hot_eos* Hot_eos::hoteos_from_file(FILE* ) ;
friend Hot_eos* Hot_eos::hoteos_from_file(ifstream& ) ;
public:
virtual ~Ideal_gas() ; ///< Destructor
// Assignment
// ----------
/// Assignment to another \c Ideal_gas
void operator=(const Ideal_gas& ) ;
// Miscellaneous
// -------------
public :
/// Comparison operator (egality)
virtual bool operator==(const Hot_eos& ) const ;
/// Comparison operator (difference)
virtual bool operator!=(const Hot_eos& ) const ;
/** Returns a number to identify the sub-classe of \c Hot_eos the
* object belongs to.
*/
virtual int identify() const ;
/// Returns the adiabatic index \f$\gamma\f$ (cf. Eq. (1)).
double get_gam() const ;
/// Returns the pressure coefficient \f$\kappa\f$ (cf. Eq. (1)).
double get_kap() const ;
/** Return the individual particule mass \f$m_0\f$
* (cf. Eq. (1))
*/
double get_m_0() const ;
virtual const Eos& new_cold_Eos() const ;
protected:
/** Computes the auxiliary quantities \c gam1 , \c unsgam1 ,
* \c gam1sgamkap from the values of \c gam and \c kap
*/
void set_auxiliary() ;
// Outputs
// -------
public:
virtual void sauve(FILE* ) const ; ///< Save in a file
protected:
virtual ostream& operator>>(ostream &) const ; ///< Operator >>
// Computational functions
// -----------------------
public:
/** Computes the baryon density from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} (to be modified) \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
*
*/
virtual double nbar_Hs_p(double ent, double sb) const ;
/** Computes the total energy density from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
virtual double ener_Hs_p(double ent, double sb) const ;
/** Computes the pressure from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
virtual double press_Hs_p(double ent, double sb) const ;
/** Computes the temperature from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} (to be modified) \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return temperature [unit: MeV]
*
*/
virtual double temp_Hs_p(double ent, double sb) const ;
};
//------------------------------------//
// class Hoteos_tabul //
//------------------------------------//
/**
* Hot (temperature-dependent) tabulated equation of state, read from a file.
*
*
*\ingroup (eos)
*
*/
class Hoteos_tabul : public Hot_eos {
// Data :
//-------
protected:
/// Name of the file containing the tabulated data
string tablename ;
string authors ; ///<Authors - reference for the table
/// Lower boundary of the enthalpy interval
double hmin ;
/// Upper boundary of the enthalpy interval
double hmax ;
/// Lower boundary of the entropy interval
double sbmin ;
/// Upper boundary of the entropy interval
double sbmax ;
/// Table of \f$H = \log ( e + P ) / n_B\f$
Tbl* hhh ;
/// Table of \f$s_B\f$, entropy per baryon (in units of Boltzmann constant).
Tbl* s_B ;
/// Table of pressure $P$
Tbl* ppp ;
/// Table of \f$\partial P/\partial H\f$
Tbl* dpdh ;
/// Table of \f$\partial P/\partial s_B\f$
Tbl* dpds ;
/// Table of \f$\partial^2 P/\partial s_B \partial H\f$
Tbl* d2p ;
// Constructors - Destructor
// -------------------------
public:
/** Standard constructor from a filename.
*/
Hoteos_tabul(const string& filename) ;
Hoteos_tabul(const Hoteos_tabul& ) ; ///< Copy constructor
protected:
/** Constructor from a binary file (created by the function
* \c sauve(FILE*) ).
* This constructor is protected because any hot EOS construction
* from a binary file must be done via the function
* \c Hot_eos::eos_from_file(FILE*) .
*/
Hoteos_tabul(FILE* ) ;
/** Constructor from a formatted file.
* This constructor is protected because any EOS construction
* from a formatted file must be done via the function
* \c Hot_eos::hoteos_from_file(ifstream&) .
*/
Hoteos_tabul(ifstream& ) ;
/// The construction functions from a file
friend Hot_eos* Hot_eos::hoteos_from_file(FILE* ) ;
friend Hot_eos* Hot_eos::hoteos_from_file(ifstream& ) ;
public:
virtual ~Hoteos_tabul() ; ///< Destructor
/// Assignment to another \c Hoteos_tabul
void operator=(const Hoteos_tabul& ) ;
// Miscellaneous
// -------------
protected:
/** Reads the file containing the table and initializes
* in the arrays \c hhh , \c s_B, \c ppp, ...
*/
void read_table() ;
/// Sets all the arrays to the null pointer.
void set_arrays_0x0() ;
public :
/// Comparison operator (egality)
virtual bool operator==(const Hot_eos& ) const ;
/// Comparison operator (difference)
virtual bool operator!=(const Hot_eos& ) const ;
/** Returns a number to identify the sub-classe of \c Hot_eos the
* object belongs to.
*/
virtual int identify() const ;
virtual const Eos& new_cold_Eos() const ;
// Outputs
// -------
public:
virtual void sauve(FILE* ) const ; ///< Save in a file
protected:
virtual ostream& operator>>(ostream &) const ; ///< Operator >>
// Computational functions
// -----------------------
public:
/** Computes the baryon density from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} (to be modified) \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return baryon density [unit: \f$n_{\rm nuc} := 0.1 \ {\rm fm}^{-3}\f$]
*
*/
virtual double nbar_Hs_p(double ent, double sb) const ;
/** Computes the total energy density from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return energy density \e e [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
virtual double ener_Hs_p(double ent, double sb) const ;
/** Computes the pressure from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return pressure \e p [unit: \f$\rho_{\rm nuc} c^2\f$], where
* \f$\rho_{\rm nuc} := 1.66\ 10^{17} \ {\rm kg/m}^3\f$
*/
virtual double press_Hs_p(double ent, double sb) const ;
/** Computes the temperature from the log-enthalpy and entropy per baryon
* (virtual function implemented in the derived classes).
*
* @param ent [input, unit: \f$c^2\f$] log-enthalpy \e H defined by
* \f$H = c^2 \ln\left( {e+p \over m_B c^2 n} (to be modified) \right) \f$,
* where \e e is the (total) energy density, \e p the pressure,
* \e n the baryon density, and \f$m_B\f$ the baryon mass
* @param sb [input, unit: \f$k_B\f$] entropy per baryon \f$s_b\f$
*
* @return temperature [unit: MeV]
*
*/
virtual double temp_Hs_p(double ent, double sb) const ;
};
}
#endif
|