135#include "utilitaires.h"
179 if (p_eos_poly_newt != 0x0) {
181 "Etoile::Etoile : the EOS Eos_poly_newt must not be employed"
182 <<
" for a relativistic star ! " << endl ;
183 cout <<
"(Use Eos_poly instead)" << endl ;
186 if (p_eos_incomp_newt != 0x0) {
188 "Etoile::Etoile : the EOS Eos_incomp_newt must not be employed"
189 <<
" for a relativistic star ! " << endl ;
190 cout <<
"(Use Eos_incomp instead)" << endl ;
197 if ( (p_eos_poly != 0x0) && (p_eos_poly_newt == 0x0) ) {
199 "Etoile::Etoile : the EOS Eos_poly must not be employed"
200 <<
" for a Newtonian star ! " << endl ;
201 cout <<
"(Use Eos_poly_newt instead)" << endl ;
204 if ( (p_eos_incomp != 0x0) && (p_eos_incomp_newt == 0x0) ) {
206 "Etoile::Etoile : the EOS Eos_incomp must not be employed"
207 <<
" for a relativistic star ! " << endl ;
208 cout <<
"(Use Eos_incomp_newt instead)" << endl ;
242 a_car.set_std_base() ;
303 fread_be(&xx,
sizeof(
int), 1, fich) ;
320 if (
eos != *p_eos_file) {
322 "Etoile::Etoile(const Map&, const Eos&, FILE*) : the EOS given in "
324 " argument and that read in the file are different !" << endl ;
352 Tenseur d_logn_auto_div_file(
mp,
mp.get_bvect_spher(), fich) ;
435 assert( &(et.
mp) == &
mp ) ;
436 assert( &(et.
eos) == &
eos ) ;
520 ost <<
"Relativistic star" << endl ;
521 ost <<
"-----------------" << endl ;
524 ost <<
"Newtonian star" << endl ;
525 ost <<
"--------------" << endl ;
528 ost <<
"Number of domains occupied by the star : " <<
nzet << endl ;
530 ost <<
"Equation of state : " << endl ;
533 ost << endl <<
"Central enthalpy : " <<
ent()(0,0,0,0) <<
" c^2" << endl ;
534 ost <<
"Central proper baryon density : " <<
nbar()(0,0,0,0)
535 <<
" x 0.1 fm^-3" << endl ;
536 ost <<
"Central proper energy density : " <<
ener()(0,0,0,0)
537 <<
" rho_nuc c^2" << endl ;
538 ost <<
"Central pressure : " <<
press()(0,0,0,0)
539 <<
" rho_nuc c^2" << endl ;
542 <<
"Regularization index of the gravitational potential : k_div = "
544 ost <<
"Central lapse N : " <<
nnn()(0,0,0,0) << endl ;
545 ost <<
"Central value of A^2 : " <<
a_car()(0,0,0,0) << endl ;
548 <<
"Coordinate equatorial radius (phi=0) a1 = "
549 <<
ray_eq()/km <<
" km" << endl ;
550 ost <<
"Coordinate equatorial radius (phi=pi/2) a2 = "
552 ost <<
"Coordinate equatorial radius (phi=pi): "
554 ost <<
"Coordinate polar radius a3 = "
559 ost << endl <<
"Baryon mass : " <<
mass_b() / msol <<
" M_sol" << endl ;
560 ost <<
"Gravitational mass : " <<
mass_g() / msol <<
" M_sol" << endl ;
578 double epsilon = 1.e-12 ;
580 const Mg3d* mg =
mp.get_mg() ;
585 for (
int l=0; l<nz; l++) {
587 for (
int k=0; k<mg->
get_np(l); k++) {
588 for (
int j=0; j<mg->
get_nt(l); j++) {
589 for (
int i=0; i<mg->
get_nr(l); i++) {
601 fact_ent.
set(0) = 1 + epsilon * xi(0) * xi(0) ;
602 fact_ent.
set(1) = 1 - 0.25 * epsilon * (xi(1) - 1) * (xi(1) - 1) ;
604 for (
int l=
nzet; l<nz; l++) {
605 fact_ent.
set(l) = 1 ;
611 fact_ent.
set(1) = 1 - 0.5 * epsilon * (xi(1) - 0.5) * (xi(1) - 0.5) ;
612 fact_ent.
set(2) = 1 - 0.25 * epsilon * (xi(2) - 1) * (xi(2) - 1) ;
617 cout <<
"Etoile::equation_of_state: not ready yet for nzet > 3 !"
621 ent_eos = fact_ent * ent_eos ;
634 nbar.set_etat_qcq() ;
636 for (
int l=0; l<
nzet; l++) {
641 tempo =
eos.nbar_ent(ent_eos, 1, l, &par) ;
647 ener.set_etat_qcq() ;
649 for (
int l=0; l<
nzet; l++) {
654 tempo =
eos.ener_ent(ent_eos, 1, l, &par) ;
660 press.set_etat_qcq() ;
662 for (
int l=0; l<
nzet; l++) {
667 tempo =
eos.press_ent(ent_eos, 1, l, &par) ;
675 nbar.set_std_base() ;
676 ener.set_std_base() ;
677 press.set_std_base() ;
690 "Etoile::hydro_euler : hydro_euler must be called via a derived class"
691 << endl <<
" of Etoile !" << endl ;
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Tbl & set(int l)
Read/write of the value in a given domain.
Equation of state of incompressible matter (Newtonian case).
Equation of state of incompressible matter (relativistic case).
Polytropic equation of state (Newtonian case).
Polytropic equation of state (relativistic case).
Equation of state base class.
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Tenseur logn_auto_div
Divergent part (if k_div!=0 ) of the logarithm of the part of the lapse N generated principaly by t...
int nzet
Number of domains of *mp occupied by the star.
double * p_mass_b
Baryon mass.
double * p_mass_g
Gravitational mass.
Tbl * p_xi_surf
Description of the stellar surface: 2-D Tbl containing the values of the radial coordinate on the su...
void operator=(const Etoile &)
Assignment to another Etoile.
Tenseur logn_auto_regu
Regular part of the logarithm of the part of the lapse N generated principaly by the star.
double ray_eq_pi() const
Coordinate radius at , [r_unit].
int k_div
Index of regularity of the gravitational potential logn_auto .
double ray_eq() const
Coordinate radius at , [r_unit].
Tenseur nnn
Total lapse function.
Tenseur logn_auto
Total of the logarithm of the part of the lapse N generated principaly by the star.
Tenseur nbar
Baryon density in the fluid frame.
const Eos & eos
Equation of state of the stellar matter.
virtual void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
Tenseur u_euler
Fluid 3-velocity with respect to the Eulerian observer.
Itbl * p_l_surf
Description of the stellar surface: 2-D Itbl containing the values of the domain index l on the surfa...
Tenseur gam_euler
Lorentz factor between the fluid and Eulerian observers.
friend ostream & operator<<(ostream &, const Etoile &)
Display.
Map & mp
Mapping associated with the star.
double * p_ray_eq_3pis2
Coordinate radius at , .
virtual void del_deriv() const
Deletes all the derived quantities.
double * p_ray_eq_pi
Coordinate radius at , .
virtual double mass_b() const
Baryon mass.
Tenseur ener
Total energy density in the fluid frame.
Etoile(Map &mp_i, int nzet_i, bool relat, const Eos &eos_i)
Standard constructor.
double ray_eq_pis2() const
Coordinate radius at , [r_unit].
virtual ~Etoile()
Destructor.
double * p_ray_pole
Coordinate radius at .
Tenseur d_logn_auto_div
Gradient of logn_auto_div (if k_div!=0 ).
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Tenseur press
Fluid pressure.
virtual double mass_g() const
Gravitational mass.
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one.
double * p_ray_eq_pis2
Coordinate radius at , .
Tenseur ener_euler
Total energy density in the Eulerian frame.
virtual void sauve(FILE *) const
Save in a file.
Tenseur shift
Total shift vector.
virtual void hydro_euler()
Computes the hydrodynamical quantities relative to the Eulerian observer from those in the fluid fram...
Tenseur s_euler
Trace of the stress tensor in the Eulerian frame.
Tenseur ent
Log-enthalpy (relativistic case) or specific enthalpy (Newtonian case).
virtual void del_hydro_euler()
Sets to ETATNONDEF (undefined state) the hydrodynamical quantities relative to the Eulerian observer.
Tenseur beta_auto
Logarithm of the part of the product AN generated principaly by by the star.
Tenseur a_car
Total conformal factor .
void set_enthalpy(const Cmp &)
Assignment of the enthalpy field.
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
double * p_ray_eq
Coordinate radius at , .
double ray_pole() const
Coordinate radius at [r_unit].
double * x
Array of values of at the nr collocation points.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_nzone() const
Returns the number of domains.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Tbl & set(int l)
Read/write of the Tbl in a given domain.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Tensor handling *** DEPRECATED : use class Tensor instead ***.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping,...
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Standard units of space, time and mass.