30char 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 ) ;
506ostream& 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 ;
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.
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.
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
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.
virtual void sauve(FILE *) const
Save in a file.
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.
Base class for stars *** DEPRECATED : use class Star instead ***.
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.
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.
Base class for coordinate mappings.
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.
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 ***.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
void sauve(FILE *) const
Save in a file.
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.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
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.
Standard units of space, time and mass.