89#include "utilitaires.h"
103 Map& mp2,
int nzet2,
const Eos& eos2,
int irrot2,
105 :
star1(mp1, nzet1, eos1, irrot1, conf_flat),
106 star2(mp2, nzet2, eos2, irrot2, conf_flat)
138 :
star1(mp1, eos1, fich),
139 star2(mp2, eos2, fich)
244 ost <<
"Binary neutron stars" << endl ;
245 ost <<
"=============" << endl ;
247 "Orbital angular velocity : " <<
omega * f_unit <<
" rad/s" << endl ;
249 "Coordinate separation between the two stellar centers : "
252 "Absolute coordinate X of the rotation axis : " <<
x_axe / km
254 ost << endl <<
"Star 1 : " << endl ;
255 ost <<
"====== " << endl ;
256 ost <<
star1 << endl ;
257 ost <<
"Star 2 : " << endl ;
258 ost <<
"====== " << endl ;
259 ost <<
star2 << endl ;
270 const Eos* p_eos1 = &(
star1.get_eos() ) ;
273 if (p_eos_poly != 0x0) {
275 assert(
star1.get_eos() ==
star2.get_eos() ) ;
277 double kappa = p_eos_poly->
get_kap() ;
278 double gamma = p_eos_poly->
get_gam() ; ;
279 double kap_ns2 =
pow( kappa, 0.5 /(gamma-1) ) ;
282 double r_poly = kap_ns2 /
sqrt(ggrav) ;
285 double t_poly = r_poly ;
288 double m_poly = r_poly / ggrav ;
291 double j_poly = r_poly * r_poly / ggrav ;
294 ost << endl <<
"Quantities in polytropic units : " << endl ;
295 ost <<
"==============================" << endl ;
296 ost <<
" ( r_poly = " << r_poly / km <<
" km )" << endl ;
297 ost <<
" d_e_max : " <<
separation() / r_poly << endl ;
299 << (
star2.xa_barycenter() -
star1.xa_barycenter() ) / r_poly
301 ost <<
" Omega : " <<
omega * t_poly << endl ;
302 ost <<
" J : " <<
angu_mom()(2) / j_poly << endl ;
303 ost <<
" M_ADM : " <<
mass_adm() / m_poly << endl ;
304 ost <<
" M_Komar : " <<
mass_kom() / m_poly << endl ;
305 ost <<
" M_bar(star 1) : " <<
star1.mass_b() / m_poly << endl ;
306 ost <<
" M_bar(star 2) : " <<
star2.mass_b() / m_poly << endl ;
307 ost <<
" R_0(star 1) : " <<
308 0.5 * (
star1.ray_eq() +
star1.ray_eq_pi() ) / r_poly << endl ;
309 ost <<
" R_0(star 2) : " <<
310 0.5 * (
star2.ray_eq() +
star2.ray_eq_pi() ) / r_poly << endl ;
320 int nz_un =
star1.get_mp().get_mg()->get_nzone() ;
321 int nz_deux =
star2.get_mp().get_mg()->get_nzone() ;
324 double distance =
star2.get_mp().get_ori_x() -
star1.get_mp().get_ori_x() ;
325 cout <<
"distance = " << distance << endl ;
326 double lim_un = distance/2. ;
327 double lim_deux = distance/2. ;
328 double int_un = distance/6. ;
329 double int_deux = distance/6. ;
333 fonction_f_un = 0.5*
pow(
334 cos((
star1.get_mp().r-int_un)*M_PI/2./(lim_un-int_un)), 2.)+0.5 ;
338 fonction_g_un = 0.5*
pow
339 (
sin((
star1.get_mp().r-int_un)*M_PI/2./(lim_un-int_un)), 2.) ;
343 fonction_f_deux = 0.5*
pow(
344 cos((
star2.get_mp().r-int_deux)*M_PI/2./(lim_deux-int_deux)), 2.)+0.5 ;
348 fonction_g_deux = 0.5*
pow(
349 sin((
star2.get_mp().r-int_deux)*M_PI/2./(lim_un-int_deux)), 2.) ;
366 double xabs, yabs, zabs, air_un, air_deux, theta,
phi ;
368 for (
int l=0 ; l<nz_un ; l++) {
369 int nr =
star1.get_mp().get_mg()->get_nr (l) ;
374 int np =
star1.get_mp().get_mg()->get_np (l) ;
375 int nt =
star1.get_mp().get_mg()->get_nt (l) ;
377 for (
int k=0 ; k<np ; k++)
378 for (
int j=0 ; j<nt ; j++)
379 for (
int i=0 ; i<nr ; i++) {
381 xabs = xabs_un (l, k, j, i) ;
382 yabs = yabs_un (l, k, j, i) ;
383 zabs = zabs_un (l, k, j, i) ;
386 star1.get_mp().convert_absolute
387 (xabs, yabs, zabs, air_un, theta,
phi) ;
388 star2.get_mp().convert_absolute
389 (xabs, yabs, zabs, air_deux, theta,
phi) ;
391 if (air_un <= lim_un)
399 if (air_deux <= lim_deux)
400 if (air_deux < int_deux)
414 for (
int k=0 ; k<np ; k++)
415 for (
int j=0 ; j<nt ; j++)
419 for (
int l=0 ; l<nz_deux ; l++) {
420 int nr =
star2.get_mp().get_mg()->get_nr (l) ;
425 int np =
star2.get_mp().get_mg()->get_np (l) ;
426 int nt =
star2.get_mp().get_mg()->get_nt (l) ;
428 for (
int k=0 ; k<np ; k++)
429 for (
int j=0 ; j<nt ; j++)
430 for (
int i=0 ; i<nr ; i++) {
432 xabs = xabs_deux (l, k, j, i) ;
433 yabs = yabs_deux (l, k, j, i) ;
434 zabs = zabs_deux (l, k, j, i) ;
437 star1.get_mp().convert_absolute
438 (xabs, yabs, zabs, air_un, theta,
phi) ;
439 star2.get_mp().convert_absolute
440 (xabs, yabs, zabs, air_deux, theta,
phi) ;
442 if (air_deux <= lim_deux)
443 if (air_deux < int_deux)
450 if (air_un <= lim_un)
465 for (
int k=0 ; k<np ; k++)
466 for (
int j=0 ; j<nt ; j++)
473 int nr =
star1.get_mp().get_mg()->get_nr (1) ;
474 int nt =
star1.get_mp().get_mg()->get_nt (1) ;
475 int np =
star1.get_mp().get_mg()->get_np (1) ;
476 cout <<
"decouple_un" << endl <<
norme(decouple_un/(nr*nt*np)) << endl ;
477 cout <<
"decouple_deux" << endl <<
norme(decouple_deux/(nr*nt*np))
480 star1.decouple = decouple_un ;
481 star2.decouple = decouple_deux ;
489 const Mg3d* mg1 = mp1.get_mg() ;
493 ost <<
"# Grid 1 : " << nz1 <<
"x"
495 <<
" R_out(l) [km] : " ;
496 for (
int l=0; l<nz1; l++) {
497 ost <<
" " << mp1.val_r(l, 1., M_PI/2, 0) / km ;
501 ost <<
"# VE(M) " << endl ;
504 ost.setf(ios::scientific) ;
513 <<
" M_ADM_vol [M_sol] "
514 <<
" M_Komar [M_sol] "
515 <<
" M_Komar_vol [M_sol] "
516 <<
" J [G M_sol^2/c] " << endl ;
521 ost << (
star2.xa_barycenter() -
star1.xa_barycenter() ) / km ; ost.width(22) ;
523 ost <<
omega / (2*M_PI)* f_unit ; ost.width(22) ;
524 ost <<
mass_adm() / msol ; ost.width(22) ;
526 ost <<
mass_kom() / msol ; ost.width(22) ;
528 ost <<
angu_mom()(2)/ ( qpig / (4* M_PI) * msol*msol) << endl ;
530 ost <<
"# H_c(1)[c^2] "
531 <<
" e_c(1)[rho_nuc] "
532 <<
" M_B(1) [M_sol] "
535 <<
" a3/a1(1) " << endl ;
538 ost <<
star1.get_ent().val_grid_point(0,0,0,0) ; ost.width(22) ;
539 ost <<
star1.get_ener().val_grid_point(0,0,0,0) ; ost.width(22) ;
540 ost <<
star1.mass_b() / msol ; ost.width(22) ;
541 ost <<
star1.ray_eq() / km ; ost.width(22) ;
542 ost <<
star1.ray_eq_pis2() /
star1.ray_eq() ; ost.width(22) ;
543 ost <<
star1.ray_pole() /
star1.ray_eq() << endl ;
545 ost <<
"# H_c(2)[c^2] "
546 <<
" e_c(2)[rho_nuc] "
547 <<
" M_B(2) [M_sol] "
550 <<
" a3/a1(2) " << endl ;
553 ost <<
star2.get_ent().val_grid_point(0,0,0,0) ; ost.width(22) ;
554 ost <<
star2.get_ener().val_grid_point(0,0,0,0) ; ost.width(22) ;
555 ost <<
star2.mass_b() / msol ; ost.width(22) ;
556 ost <<
star2.ray_eq() / km ; ost.width(22) ;
557 ost <<
star2.ray_eq_pis2() /
star1.ray_eq() ; ost.width(22) ;
558 ost <<
star2.ray_pole() /
star1.ray_eq() << endl ;
562 const Eos* p_eos1 = &(
star1.get_eos() ) ;
565 if ((p_eos_poly != 0x0) && (
star1.get_eos() ==
star2.get_eos() )) {
567 double kappa = p_eos_poly->
get_kap() ;
568 double gamma = p_eos_poly->
get_gam() ; ;
569 double kap_ns2 =
pow( kappa, 0.5 /(gamma-1.) ) ;
572 double r_poly = kap_ns2 /
sqrt(ggrav) ;
575 double t_poly = r_poly ;
578 double m_poly = r_poly / ggrav ;
581 double j_poly = r_poly * r_poly / ggrav ;
589 <<
" M_B(2) [poly] " << endl ;
592 ost <<
separation() / r_poly ; ost.width(22) ;
593 ost << (
star2.xa_barycenter() -
star1.xa_barycenter() ) / r_poly ; ost.width(22) ;
594 ost <<
omega * t_poly ; ost.width(22) ;
595 ost <<
mass_adm() / m_poly ; ost.width(22) ;
596 ost <<
angu_mom()(2) / j_poly ; ost.width(22) ;
597 ost <<
star1.mass_b() / m_poly ; ost.width(22) ;
598 ost <<
star2.mass_b() / m_poly << endl ;
612 double dx =
star1.mp.get_ori_x() -
star2.mp.get_ori_x() ;
613 double dy =
star1.mp.get_ori_y() -
star2.mp.get_ori_y() ;
614 double dz =
star1.mp.get_ori_z() -
star2.mp.get_ori_z() ;
616 return sqrt( dx*dx + dy*dy + dz*dz ) ;
double mass_adm_vol() const
Total ADM mass (computed by a volume integral).
void sauve(FILE *) const
Save in a file.
void display_poly(ostream &) const
Display in polytropic units.
double mass_kom_vol() const
Total Komar mass (computed by a volume integral).
void write_global(ostream &) const
Write global quantities in a formatted file.
void del_deriv() const
Deletes all the derived quantities.
Star_bin * et[2]
Array of the two stars (to perform loops on the stars): et[0] contains the address of star1 and et[1]...
double omega
Angular velocity with respect to an asymptotically inertial observer.
double * p_total_ener
Total energy of the system.
Tbl * p_angu_mom
Total angular momentum of the system.
Star_bin star2
Second star of the system.
const Tbl & angu_mom() const
Total angular momentum.
friend ostream & operator<<(ostream &, const Binary &)
Display.
void fait_decouple()
Calculates decouple which is used to obtain qq_auto by the formula : qq_auto = decouple * qq.
Star_bin star1
First star of the system.
double * p_mass_adm
Total ADM mass of the system.
double * p_virial
Virial theorem error.
double mass_adm() const
Total ADM mass.
void operator=(const Binary &)
Assignment to another Binary.
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
double virial() const
Estimates the relative error on the virial theorem.
double x_axe
Absolute X coordinate of the rotation axis.
Tbl * p_mom_constr
Relative error on the momentum constraint.
Binary(Map &mp1, int nzet1, const Eos &eos1, int irrot1, Map &mp2, int nzet2, const Eos &eos2, int irrot2, int conf_flat)
Standard constructor.
double * p_mass_kom
Total Komar mass of the system.
double mass_kom() const
Total Komar mass.
double separation() const
Returns the coordinate separation of the two stellar centers [r_unit].
double * p_ham_constr
Relative error on the Hamiltonian constraint.
ostream & operator>>(ostream &) const
Operator >> (function called by the operator <<).
Polytropic equation of state (relativistic case).
double get_gam() const
Returns the adiabatic index (cf. Eq. (3)).
double get_kap() const
Returns the pressure coefficient (cf.
Equation of state base class.
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.
Tensor field of valence 0 (or component of a tensorial field).
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
double & set_grid_point(int l, int k, int j, int i)
Setting the value of the field at a given grid point.
double val_point(double r, double theta, double phi) const
Computes the value of the field at an arbitrary point , by means of the spectral expansion.
Cmp sqrt(const Cmp &)
Square root.
Cmp sin(const Cmp &)
Sine.
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Cmp pow(const Cmp &, int)
Power .
Cmp cos(const Cmp &)
Cosine.
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.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Standard units of space, time and mass.