135 #include "utilitaires.h" 159 u_euler(mpi, 1, CON, mp.get_bvect_cart()),
163 d_logn_auto_div(mpi, 1, COV, mp.get_bvect_spher()),
166 shift(mpi, 1, CON, mp.get_bvect_cart()),
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 ;
251 relativistic(et.relativistic),
259 ener_euler(et.ener_euler),
261 gam_euler(et.gam_euler),
263 logn_auto(et.logn_auto),
264 logn_auto_regu(et.logn_auto_regu),
265 logn_auto_div(et.logn_auto_div),
266 d_logn_auto_div(et.d_logn_auto_div),
267 beta_auto(et.beta_auto),
288 u_euler(mpi, 1, CON, mp.get_bvect_cart()),
292 d_logn_auto_div(mpi, 1, COV, mp.get_bvect_spher()),
295 shift(mpi, 1, CON, mp.get_bvect_cart()),
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 ;
435 assert( &(et.
mp) == &
mp ) ;
436 assert( &(et.
eos) == &
eos ) ;
509 ostream& operator<<(ostream& ost,
const Etoile& et) {
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 ;
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 ;
636 for (
int l=0; l<
nzet; l++) {
649 for (
int l=0; l<
nzet; l++) {
662 for (
int l=0; l<
nzet; l++) {
690 "Etoile::hydro_euler : hydro_euler must be called via a derived class" 691 << endl <<
" of Etoile !" << endl ;
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Base class for stars *** DEPRECATED : use class Star instead ***.
int k_div
Index of regularity of the gravitational potential logn_auto .
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Cmp ener_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the total energy density from the log-enthalpy and extra parameters.
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
double ray_eq_pis2() const
Coordinate radius at , [r_unit].
void set_std_base()
Set the standard spectal basis of decomposition for each component.
virtual double mass_g() const
Gravitational mass.
virtual void sauve(FILE *) const
Save in a file.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
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...
Standard units of space, time and mass.
Equation of state base class.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Tenseur nnn
Total lapse function.
Tenseur s_euler
Trace of the stress tensor in the Eulerian frame.
double ray_eq() const
Coordinate radius at , [r_unit].
Base class for coordinate mappings.
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
Tenseur press
Fluid pressure.
double * x
Array of values of at the nr collocation points.
void set_enthalpy(const Cmp &)
Assignment of the enthalpy field.
Tenseur shift
Total shift vector.
virtual void sauve(FILE *) const
Save in a file.
double * p_ray_pole
Coordinate radius at .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Tenseur logn_auto_div
Divergent part (if k_div!=0 ) of the logarithm of the part of the lapse N generated principaly by t...
virtual void del_deriv() const
Deletes all the derived quantities.
Cmp nbar_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the baryon density field from the log-enthalpy field and extra parameters.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Tenseur u_euler
Fluid 3-velocity with respect to the Eulerian observer.
void sauve(FILE *) const
Save in a file.
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Tenseur nbar
Baryon density in the fluid frame.
Tenseur gam_euler
Lorentz factor between the fluid and Eulerian observers.
Polytropic equation of state (relativistic case).
virtual double mass_b() const
Baryon mass.
Map & mp
Mapping associated with the star.
int get_nzone() const
Returns the number of domains.
virtual void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
const Eos & eos
Equation of state of the stellar matter.
Tbl * p_xi_surf
Description of the stellar surface: 2-D Tbl containing the values of the radial coordinate on the su...
virtual void hydro_euler()
Computes the hydrodynamical quantities relative to the Eulerian observer from those in the fluid fram...
double * p_ray_eq
Coordinate radius at , .
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.
Etoile(Map &mp_i, int nzet_i, bool relat, const Eos &eos_i)
Standard constructor.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Tbl & set(int l)
Read/write of the Tbl in a given domain.
double * p_mass_g
Gravitational mass.
Polytropic equation of state (Newtonian case).
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
int nzet
Number of domains of *mp occupied by the star.
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 get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Tenseur a_car
Total conformal factor .
virtual ~Etoile()
Destructor.
double * p_ray_eq_pis2
Coordinate radius at , .
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one. ...
double * p_ray_eq_3pis2
Coordinate radius at , .
double ray_pole() const
Coordinate radius at [r_unit].
Tbl & set(int l)
Read/write of the value in a given domain.
Tenseur ener
Total energy density in the fluid frame.
double ray_eq_pi() const
Coordinate radius at , [r_unit].
Tenseur logn_auto
Total of the logarithm of the part of the lapse N generated principaly by the star.
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...
double * p_ray_eq_pi
Coordinate radius at , .
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Tenseur beta_auto
Logarithm of the part of the product AN generated principaly by by the star.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Equation of state of incompressible matter (Newtonian case).
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
Tenseur ener_euler
Total energy density in the Eulerian frame.
Tenseur d_logn_auto_div
Gradient of logn_auto_div (if k_div!=0 )
Equation of state of incompressible matter (relativistic case).
double * p_mass_b
Baryon mass.
Cmp press_ent(const Cmp &ent, int nzet, int l_min=0, Param *par=0x0) const
Computes the pressure from the log-enthalpy and extra parameters.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
Itbl * p_l_surf
Description of the stellar surface: 2-D Itbl containing the values of the domain index l on the surfa...