87 #include "graphique.h" 104 int i_b = mg->
get_nr(l_b) - 1 ;
105 int j_b = mg->
get_nt(l_b) - 1 ;
145 double diff_ent = 1 ;
154 for(
int mer=0 ; (diff_ent > precis) && (mer<mermax) ; mer++ ) {
156 cout <<
"-----------------------------------------------" << endl ;
157 cout <<
"step: " << mer << endl ;
158 cout <<
"alpha_r: " << alpha_r << endl ;
159 cout <<
"diff_ent = " << diff_ent << endl ;
174 (source.
set()).set_dzpuis(4) ;
189 mpaff.
dsdr(logn(), dlogn) ;
192 source = - dlogn * dbeta ;
196 mpaff.
poisson(source(), par_nul, logn_quad.
set()) ;
207 double nu_mat0_b =
logn_auto()(l_b, k_b, j_b, i_b) ;
208 double nu_mat0_c =
logn_auto()(0, 0, 0, 0) ;
210 double nu_quad0_b = logn_quad()(l_b, k_b, j_b, i_b) ;
211 double nu_quad0_c = logn_quad()(0, 0, 0, 0) ;
213 double alpha_r2 = ( ent_c - ent_b - nu_quad0_b + nu_quad0_c )
214 / ( qpig*(nu_mat0_b - nu_mat0_c) ) ;
216 alpha_r =
sqrt(alpha_r2) ;
236 double logn_c = logn()(0, 0, 0, 0) ;
237 ent = ent_c - logn() + logn_c ;
252 int nz_search =
nzet + 1 ;
260 double precis_adapt = 1.e-14 ;
262 double reg_map = 1. ;
264 par_adapt.
add_int(nitermax, 0) ;
266 par_adapt.
add_int(nzadapt, 1) ;
269 par_adapt.
add_int(nz_search, 2) ;
271 par_adapt.
add_int(adapt_flag, 3) ;
292 if (pent_limit != 0x0) ent_limit = *pent_limit ;
294 par_adapt.
add_tbl(ent_limit, 0) ;
297 double* bornes =
new double[nz+1] ;
300 for(
int l=0; l<nz; l++) {
305 bornes[nz] = __infinity ;
314 double alphal, betal ;
316 for(
int l=0; l<nz; l++) {
328 int num_r1 = mg->
get_nr(0) - 1;
330 cout <<
"Pressure difference:" <<
get_press()()(0,0,0,num_r1) -
get_press()()(1,0,0,0) << endl ;
331 cout <<
"Difference in enthalpies at the domain boundary:" << endl ;
332 cout <<
get_ent()()(0,0,0,num_r1) << endl ;
333 cout <<
get_ent()()(1,0,0,0) << endl ;
335 cout <<
"Enthalpy difference: " <<
get_ent()()(0,0,0,num_r1) -
get_ent()()(1,0,0,0) << endl ;
356 mpaff.
dsdr(logn(), dlogn) ;
362 - 0.5 * ( dlogn * dlogn + dbeta * dbeta ) ;
421 <<
"Characteristics of the star obtained by Etoile::equilibrium_spher : " 423 <<
"-----------------------------------------------------------------" 426 double ray =
mp.
val_r(l_b, 1., M_PI/2., 0) ;
427 cout <<
"Coordinate radius : " << ray / km <<
" km" << endl ;
429 double rcirc = ray *
sqrt(
a_car()(l_b, k_b, j_b, i_b) ) ;
431 double compact = qpig/(4.*M_PI) *
mass_g() / rcirc ;
433 cout <<
"Circumferential radius R : " << rcirc/km <<
" km" << endl ;
434 cout <<
"Baryon mass : " <<
mass_b()/msol <<
" Mo" << endl ;
435 cout <<
"Gravitational mass M : " <<
mass_g()/msol <<
" Mo" << endl ;
436 cout <<
"Compacity parameter GM/(c^2 R) : " << compact << endl ;
447 double vir_mat = source().integrale() ;
453 source = - ( logn().dsdr() * logn().dsdr()
458 double vir_grav = source().integrale() ;
462 double grv3 = ( vir_mat + vir_grav ) / vir_mat ;
464 cout <<
"Virial theorem GRV3 : " << endl ;
465 cout <<
" 3P term : " << vir_mat << endl ;
466 cout <<
" grav. term : " << vir_grav << endl ;
467 cout <<
" relative error : " << grv3 << endl ;
472 for (
int ltrans = 0; ltrans <
nzet-1; ltrans++) {
473 cout << endl <<
"Values at boundary between domains no. " << ltrans <<
" and " << ltrans+1 <<
" for theta = pi/2 and phi = 0 :" << endl ;
475 double rt1 =
mp.
val_r(ltrans, 1., M_PI/2, 0.) ;
476 double rt2 =
mp.
val_r(ltrans+1, -1., M_PI/2, 0.) ;
477 cout <<
" Coord. r [km] (left, right, rel. diff) : " 478 << rt1 / km <<
" " << rt2 / km <<
" " << (rt2 - rt1)/rt1 << endl ;
480 int ntm1 = mg->
get_nt(ltrans) - 1;
481 int nrm1 = mg->
get_nr(ltrans) - 1 ;
482 double ent1 =
ent()(ltrans, 0, ntm1, nrm1) ;
483 double ent2 =
ent()(ltrans+1, 0, ntm1, 0) ;
484 cout <<
" Enthalpy (left, right, rel. diff) : " 485 << ent1 <<
" " << ent2 <<
" " << (ent2-ent1)/ent1 << endl ;
487 double press1 =
press()(ltrans, 0, ntm1, nrm1) ;
488 double press2 =
press()(ltrans+1, 0, ntm1, 0) ;
489 cout <<
" Pressure (left, right, rel. diff) : " 490 << press1 <<
" " << press2 <<
" " << (press2-press1)/press1 << endl ;
492 double nb1 =
nbar()(ltrans, 0, ntm1, nrm1) ;
493 double nb2 =
nbar()(ltrans+1, 0, ntm1, 0) ;
494 cout <<
" Baryon density (left, right, rel. diff) : " 495 << nb1 <<
" " << nb2 <<
" " << (nb2-nb1)/nb1 << endl ;
const Cmp & dsdr() const
Returns of *this .
void annule(int l)
Sets the Tenseur to zero in a given domain.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Cmp exp(const Cmp &)
Exponential.
const double * get_alpha() const
Returns the pointer on the array alpha.
Radial mapping of rather general form.
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
const double * get_alpha() const
Returns a pointer on the array alpha (values of in each domain)
const double * get_beta() const
Returns a pointer on the array beta (values of in each domain)
Cmp sqrt(const Cmp &)
Square root.
virtual void homothetie(double lambda)
Sets a new radial scale.
void set_std_base()
Set the standard spectal basis of decomposition for each component.
virtual double mass_g() const
Gravitational mass.
Standard units of space, time and mass.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Tenseur nnn
Total lapse function.
virtual void equilibrium_spher(double ent_c, double precis=1.e-14, const Tbl *ent_limit=0x0)
Computes a spherical static configuration.
Tenseur s_euler
Trace of the stress tensor in the Eulerian frame.
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
Tenseur press
Fluid pressure.
Tenseur shift
Total shift vector.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
const Tenseur & get_press() const
Returns the fluid pressure.
void set_beta(double beta0, int l)
Modifies the value of in domain no. l.
virtual double val_r(int l, double xi, double theta, double pphi) const =0
Returns the value of the radial coordinate r for a given in a given domain.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Tenseur u_euler
Fluid 3-velocity with respect to the Eulerian observer.
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
virtual void poisson(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation.
Tenseur nbar
Baryon density in the fluid frame.
Tenseur gam_euler
Lorentz factor between the fluid and Eulerian observers.
const double * get_beta() const
Returns the pointer on the array beta.
void add_tbl(const Tbl &ti, int position=0)
Adds the address of a new Tbl to the list.
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.
void set_alpha(double alpha0, int l)
Modifies the value of in domain no. l.
int nzet
Number of domains of *mp occupied by the star.
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 .
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one. ...
virtual void adapt(const Cmp &ent, const Param &par, int nbr_filtre=0)
Adaptation of the mapping to a given scalar field.
Tenseur ener
Total energy density in the fluid frame.
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)
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
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).
Tenseur ener_euler
Total energy density in the Eulerian frame.
virtual void dsdr(const Cmp &ci, Cmp &resu) const
Computes of a Cmp.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
const Tenseur & get_ent() const
Returns the enthalpy field.