115 #include "utilitaires.h" 138 u_euler(mpi, CON, mp.get_bvect_spher()),
139 stress_euler(mpi, CON, mp.get_bvect_spher()),
142 beta(mpi, CON, mp.get_bvect_spher()),
144 gamma(mp.flat_met_spher()){
209 ener_euler(et.ener_euler),
211 gam_euler(et.gam_euler),
213 stress_euler(et.stress_euler),
236 u_euler(mpi, CON, mp.get_bvect_spher()),
237 stress_euler(mpi, CON, mp.get_bvect_spher()),
238 logn(mpi, *(mpi.get_mg()), fich),
240 beta(mpi, CON, mp.get_bvect_spher()),
241 lnq(mpi, *(mpi.get_mg()), fich),
242 gamma(mpi.flat_met_spher()){
249 fread_be(&xx,
sizeof(
int), 1, fich) ;
259 if (
eos != *p_eos_file) {
261 "Star::Star(const Map&, const Eos&, FILE*) : the EOS given in " 263 " argument and that read in the file are different !" << endl ;
356 assert( &(et.
mp) == &
mp ) ;
357 assert( &(et.
eos) == &
eos ) ;
415 ostream& operator<<(ostream& ost,
const Star& et) {
426 ost <<
"Number of domains occupied by the star : " <<
nzet << endl ;
428 ost <<
"Equation of state : " << endl ;
431 ost << endl <<
"Central enthalpy : " <<
ent.
val_grid_point(0,0,0,0) <<
" c^2" << endl ;
433 <<
" x 0.1 fm^-3" << endl ;
435 <<
" rho_nuc c^2" << endl ;
437 <<
" rho_nuc c^2" << endl ;
444 <<
"Coordinate equatorial radius (phi=0) a1 = " 445 <<
ray_eq()/km <<
" km" << endl ;
446 ost <<
"Coordinate equatorial radius (phi=pi/2) a2 = " 448 ost <<
"Coordinate equatorial radius (phi=pi): " 450 ost <<
"Coordinate polar radius a3 = " 454 ost << endl <<
"Baryon mass : " <<
mass_b() / msol <<
" M_sol" << endl ;
455 ost <<
"Gravitational mass : " <<
mass_g() / msol <<
" M_sol" << endl ;
474 double epsilon = 1.e-12 ;
481 for (
int l=0; l<nz; l++) {
483 for (
int k=0; k<mg->
get_np(l); k++) {
484 for (
int j=0; j<mg->
get_nt(l); j++) {
485 for (
int i=0; i<mg->
get_nr(l); i++) {
497 fact_ent.
set_domain(0) = 1 + epsilon * xi(0) * xi(0) ;
498 fact_ent.
set_domain(1) = 1 - 0.25 * epsilon * (xi(1) - 1) * (xi(1) - 1) ;
500 for (
int l=
nzet; l<nz; l++) {
507 fact_ent.
set_domain(1) = 1 - 0.5 * epsilon * (xi(1) - 0.5) * (xi(1) - 0.5) ;
508 fact_ent.
set_domain(2) = 1 - 0.25 * epsilon * (xi(2) - 1) * (xi(2) - 1) ;
513 cout <<
"Star::equation_of_state: not ready yet for nzet > 3 !" 517 ent_eos = fact_ent * ent_eos ;
532 for (
int l=0; l<
nzet; l++) {
545 for (
int l=0; l<
nzet; l++) {
558 for (
int l=0; l<
nzet; l++) {
583 "Star::hydro_euler : hydro_euler must be called via a derived class" 584 << endl <<
" of Star !" << endl ;
double * p_mass_b
Baryon mass.
Metric for tensor calculation.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
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.
Map & mp
Mapping associated with the star.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
double * p_ray_eq_3pis2
Coordinate radius at , .
double * p_ray_eq_pi
Coordinate radius at , .
const Eos & eos
Equation of state of the stellar matter.
Standard units of space, time and mass.
Equation of state base class.
Sym_tensor stress_euler
Spatial part of the stress-energy tensor with respect to the Eulerian observer.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Tensor field of valence 0 (or component of a tensorial field).
virtual void set_etat_nondef()
Sets the logical state of all components to ETATNONDEF (undefined state).
Base class for coordinate mappings.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Scalar nbar
Baryon density in the fluid frame.
virtual void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
double * x
Array of values of at the nr collocation points.
Scalar s_euler
Trace of the stress scalar in the Eulerian frame.
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double * p_ray_eq
Coordinate radius at , .
Tbl & set_domain(int l)
Read/write of the value in a given domain.
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Tbl * p_xi_surf
Description of the stellar surface: 2-D Tbl containing the values of the radial coordinate on the su...
virtual void sauve(FILE *) const
Save in a file.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double * p_ray_eq_pis2
Coordinate radius at , .
void operator=(const Star &)
Assignment to another Star.
int nzet
Number of domains of *mp occupied by the star.
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.
Scalar gam_euler
Lorentz factor between the fluid and Eulerian observers.
virtual void sauve(FILE *) const
Save in a file.
Scalar ener
Total energy density in the fluid frame.
virtual void hydro_euler()
Computes the hydrodynamical quantities relative to the Eulerian observer from those in the fluid fram...
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Scalar press
Fluid pressure.
Star(Map &mp_i, int nzet_i, const Eos &eos_i)
Standard constructor.
double ray_eq_pis2() const
Coordinate radius at , [r_unit].
double * p_ray_pole
Coordinate radius at .
int get_nzone() const
Returns the number of domains.
virtual ~Star()
Destructor.
Vector u_euler
Fluid 3-velocity with respect to the Eulerian observer.
double ray_eq_pi() const
Coordinate radius at , [r_unit].
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.
Scalar logn
Logarithm of the lapse N .
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 ray_pole() const
Coordinate radius at [r_unit].
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.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
virtual void del_deriv() const
Deletes all the derived quantities.
virtual void del_hydro_euler()
Sets to ETATNONDEF (undefined state) the hydrodynamical quantities relative to the Eulerian observer...
Scalar nn
Lapse function N .
double ray_eq() const
Coordinate radius at , [r_unit].
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
virtual double mass_b() const =0
Baryon mass.
virtual void sauve(FILE *) const
Save in a file.
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
Scalar ener_euler
Total energy density in the Eulerian frame.
Itbl * p_l_surf
Description of the stellar surface: 2-D Itbl containing the values of the domain index l on the surfa...
double * p_mass_g
Gravitational mass.
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
void set_enthalpy(const Scalar &)
Assignment of the enthalpy field.
virtual double mass_g() const =0
Gravitational 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.