30 char etoile_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Etoile/etoile.C,v 1.10 2014/10/13 08:52:58 j_novak Exp $" ;
132 #include "utilitaires.h"
156 u_euler(mpi, 1, CON, mp.get_bvect_cart()),
160 d_logn_auto_div(mpi, 1, COV, mp.get_bvect_spher()),
163 shift(mpi, 1, CON, mp.get_bvect_cart()),
176 if (p_eos_poly_newt != 0x0) {
178 "Etoile::Etoile : the EOS Eos_poly_newt must not be employed"
179 <<
" for a relativistic star ! " << endl ;
180 cout <<
"(Use Eos_poly instead)" << endl ;
183 if (p_eos_incomp_newt != 0x0) {
185 "Etoile::Etoile : the EOS Eos_incomp_newt must not be employed"
186 <<
" for a relativistic star ! " << endl ;
187 cout <<
"(Use Eos_incomp instead)" << endl ;
194 if ( (p_eos_poly != 0x0) && (p_eos_poly_newt == 0x0) ) {
196 "Etoile::Etoile : the EOS Eos_poly must not be employed"
197 <<
" for a Newtonian star ! " << endl ;
198 cout <<
"(Use Eos_poly_newt instead)" << endl ;
201 if ( (p_eos_incomp != 0x0) && (p_eos_incomp_newt == 0x0) ) {
203 "Etoile::Etoile : the EOS Eos_incomp must not be employed"
204 <<
" for a relativistic star ! " << endl ;
205 cout <<
"(Use Eos_incomp_newt instead)" << endl ;
248 relativistic(et.relativistic),
256 ener_euler(et.ener_euler),
258 gam_euler(et.gam_euler),
260 logn_auto(et.logn_auto),
261 logn_auto_regu(et.logn_auto_regu),
262 logn_auto_div(et.logn_auto_div),
263 d_logn_auto_div(et.d_logn_auto_div),
264 beta_auto(et.beta_auto),
285 u_euler(mpi, 1, CON, mp.get_bvect_cart()),
289 d_logn_auto_div(mpi, 1, COV, mp.get_bvect_spher()),
292 shift(mpi, 1, CON, mp.get_bvect_cart()),
300 fread_be(&xx,
sizeof(
int), 1, fich) ;
317 if (
eos != *p_eos_file) {
319 "Etoile::Etoile(const Map&, const Eos&, FILE*) : the EOS given in "
321 " argument and that read in the file are different !" << endl ;
432 assert( &(et.
mp) == &
mp ) ;
433 assert( &(et.
eos) == &
eos ) ;
506 ostream& operator<<(ostream& ost,
const Etoile& et) {
517 ost <<
"Relativistic star" << endl ;
518 ost <<
"-----------------" << endl ;
521 ost <<
"Newtonian star" << endl ;
522 ost <<
"--------------" << endl ;
525 ost <<
"Number of domains occupied by the star : " <<
nzet << endl ;
527 ost <<
"Equation of state : " << endl ;
530 ost << endl <<
"Central enthalpy : " <<
ent()(0,0,0,0) <<
" c^2" << endl ;
531 ost <<
"Central proper baryon density : " <<
nbar()(0,0,0,0)
532 <<
" x 0.1 fm^-3" << endl ;
533 ost <<
"Central proper energy density : " <<
ener()(0,0,0,0)
534 <<
" rho_nuc c^2" << endl ;
535 ost <<
"Central pressure : " <<
press()(0,0,0,0)
536 <<
" rho_nuc c^2" << endl ;
539 <<
"Regularization index of the gravitational potential : k_div = "
541 ost <<
"Central lapse N : " <<
nnn()(0,0,0,0) << endl ;
542 ost <<
"Central value of A^2 : " <<
a_car()(0,0,0,0) << endl ;
545 <<
"Coordinate equatorial radius (phi=0) a1 = "
546 <<
ray_eq()/km <<
" km" << endl ;
547 ost <<
"Coordinate equatorial radius (phi=pi/2) a2 = "
549 ost <<
"Coordinate equatorial radius (phi=pi): "
551 ost <<
"Coordinate polar radius a3 = "
556 ost << endl <<
"Baryon mass : " <<
mass_b() / msol <<
" M_sol" << endl ;
557 ost <<
"Gravitational mass : " <<
mass_g() / msol <<
" M_sol" << endl ;
575 double epsilon = 1.e-12 ;
582 for (
int l=0; l<nz; l++) {
584 for (
int k=0; k<mg->
get_np(l); k++) {
585 for (
int j=0; j<mg->
get_nt(l); j++) {
586 for (
int i=0; i<mg->
get_nr(l); i++) {
598 fact_ent.
set(0) = 1 + epsilon * xi(0) * xi(0) ;
599 fact_ent.
set(1) = 1 - 0.25 * epsilon * (xi(1) - 1) * (xi(1) - 1) ;
601 for (
int l=
nzet; l<nz; l++) {
602 fact_ent.
set(l) = 1 ;
608 fact_ent.
set(1) = 1 - 0.5 * epsilon * (xi(1) - 0.5) * (xi(1) - 0.5) ;
609 fact_ent.
set(2) = 1 - 0.25 * epsilon * (xi(2) - 1) * (xi(2) - 1) ;
614 cout <<
"Etoile::equation_of_state: not ready yet for nzet > 3 !"
618 ent_eos = fact_ent * ent_eos ;
633 for (
int l=0; l<
nzet; l++) {
646 for (
int l=0; l<
nzet; l++) {
659 for (
int l=0; l<
nzet; l++) {
687 "Etoile::hydro_euler : hydro_euler must be called via a derived class"
688 << endl <<
" of Etoile !" << endl ;
Tenseur press
Fluid pressure.
Tenseur a_car
Total conformal factor .
int nzet
Number of domains of *mp occupied by the star.
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one.
Tenseur u_euler
Fluid 3-velocity with respect to the Eulerian observer.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
double * p_ray_pole
Coordinate radius at .
Tenseur ent
Log-enthalpy (relativistic case) or specific enthalpy (Newtonian case)
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_hydro_euler()
Sets to ETATNONDEF (undefined state) the hydrodynamical quantities relative to the Eulerian observer.
Tenseur logn_auto
Total of the logarithm of the part of the lapse N generated principaly by the star.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Tenseur nbar
Baryon density in the fluid frame.
Cmp press_ent(const Cmp &ent, int nzet, int l_min=0, const Param *par=0x0) const
Computes the pressure from the log-enthalpy and extra parameters.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Map & mp
Mapping associated with the star.
void sauve(FILE *) const
Save in a file.
Equation of state base class.
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_mass_b
Baryon mass.
const Eos & eos
Equation of state of the stellar matter.
Equation of state of incompressible matter (Newtonian case).
Itbl * p_l_surf
Description of the stellar surface: 2-D Itbl containing the values of the domain index l on the surfa...
double ray_pole() const
Coordinate radius at [r_unit].
virtual ~Etoile()
Destructor.
double ray_eq_pi() const
Coordinate radius at , [r_unit].
double * p_mass_g
Gravitational mass.
int k_div
Index of regularity of the gravitational potential logn_auto .
virtual void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
virtual double mass_g() const
Gravitational mass.
Tenseur logn_auto_regu
Regular part of the logarithm of the part of the lapse N generated principaly by the star.
Tenseur nnn
Total lapse function.
double * p_ray_eq_3pis2
Coordinate radius at , .
Standard units of space, time and mass.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Equation of state of incompressible matter (relativistic case).
Tenseur ener
Total energy density in the fluid frame.
Cmp ener_ent(const Cmp &ent, int nzet, int l_min=0, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy and extra parameters.
double ray_eq_pis2() const
Coordinate radius at , [r_unit].
Tenseur d_logn_auto_div
Gradient of logn_auto_div (if k_div!=0 )
Base class for stars *** DEPRECATED : use class Star instead ***.
double * p_ray_eq_pi
Coordinate radius at , .
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Polytropic equation of state (Newtonian case).
Polytropic equation of state (relativistic case).
int get_nzone() const
Returns the number of domains.
Tenseur beta_auto
Logarithm of the part of the product AN generated principaly by by the star.
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 value in a given domain.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Tenseur ener_euler
Total energy density in the Eulerian frame.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
Tenseur shift
Total shift vector.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
virtual void del_deriv() const
Deletes all the derived quantities.
Tbl & set(int l)
Read/write of the Tbl in a given domain.
Cmp nbar_ent(const Cmp &ent, int nzet, int l_min=0, const Param *par=0x0) const
Computes the baryon density field from the log-enthalpy field and extra parameters.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
double * x
Array of values of at the nr collocation points.
Tenseur gam_euler
Lorentz factor between the fluid and Eulerian observers.
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.
double ray_eq() const
Coordinate radius at , [r_unit].
virtual double mass_b() const
Baryon mass.
void operator=(const Etoile &)
Assignment to another Etoile.
Etoile(Map &mp_i, int nzet_i, bool relat, const Eos &eos_i)
Standard constructor.
virtual void sauve(FILE *) const
Save in a file.
Base class for coordinate mappings.
virtual void equation_of_state()
Computes the proper baryon and energy density, as well as pressure from the enthalpy.
Tenseur s_euler
Trace of the stress tensor in the Eulerian frame.
void set_enthalpy(const Cmp &)
Assignment of the enthalpy field.
double * p_ray_eq
Coordinate radius at , .
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
virtual void sauve(FILE *) const
Save in a file.
double * p_ray_eq_pis2
Coordinate radius at , .
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_std_base()
Set the standard spectal basis of decomposition for each component.