113 #include "utilitaires.h" 117 #include "graphique.h" 120 double fonc_binaire_axe(
double ,
const Param& ) ;
121 double fonc_binaire_orbit(
double ,
const Param& ) ;
134 double dnulg[2], asn2[2], dasn2[2], ny[2], dny[2], npn[2], dnpn[2], xgg[2] ;
135 double nyso[2], dnyso[2], npnso2[2], dnpnso2[2], ori_x[2] ;
137 for (
int i=0; i<2; i++) {
149 Tenseur dln_auto_div = d_logn_auto_div ;
175 cout <<
"Binaire::orbit : unknown value of rot_phi !" << endl ;
180 Cmp tmp = logn_auto_regu + logn_comp + loggam ;
183 dnulg[i] = dln_auto_div(0)(0, 0, 0, 0)
184 + factx * tmp.
dsdx()(0, 0, 0, 0) ;
186 tmp = logn_auto_regu + logn_comp ;
187 cout <<
"dlnndx_div_c : " << dln_auto_div(0)(0, 0, 0, 0) << endl ;
188 cout <<
"dlnndx_c : " << dln_auto_div(0)(0, 0, 0, 0) + factx*tmp.
dsdx()(0, 0, 0, 0) << endl ;
190 cout <<
"dloggamdx_c : " << factx*loggam.
dsdx()(0, 0, 0, 0) << endl ;
192 save_profile(stmp, 0., 10., 0.5*M_PI, 0.,
"prof_logn.d") ;
194 save_profile(stmp, 0., 1.8, 0.5*M_PI, 0.,
"prof_loggam.d") ;
200 double nc = nnn(0, 0, 0, 0) ;
201 double a2c = a_car(0, 0, 0, 0) ;
202 asn2[i] = a2c / (nc * nc) ;
204 if (
et[i]->is_relativistic() ) {
210 double da2c = factx * a_car.
dsdx()(0, 0, 0, 0) ;
211 double dnc = factx * nnn.
dsdx()(0, 0, 0, 0) ;
213 dasn2[i] = ( da2c - 2 * a2c / nc * dnc ) / (nc*nc) ;
219 ny[i] = shift(1)(0, 0, 0, 0) ;
220 nyso[i] = ny[i] /
omega ;
226 dny[i] = factx * shift(1).dsdx()(0, 0, 0, 0) ;
227 dnyso[i] = dny[i] /
omega ;
236 npn[i] = tmp(0, 0, 0, 0) ;
244 dnpn[i] = factx * tmp.
dsdx()(0, 0, 0, 0) ;
260 cout <<
"Binaire::orbit: central d(nu+log(Gam))/dX : " 261 << dnulg[i] << endl ;
262 cout <<
"Binaire::orbit: central A^2/N^2 : " << asn2[i] << endl ;
263 cout <<
"Binaire::orbit: central d(A^2/N^2)/dX : " << dasn2[i] << endl ;
264 cout <<
"Binaire::orbit: central N^Y : " << ny[i] << endl ;
265 cout <<
"Binaire::orbit: central dN^Y/dX : " << dny[i] << endl ;
266 cout <<
"Binaire::orbit: central N.N : " << npn[i] << endl ;
267 cout <<
"Binaire::orbit: central d(N.N)/dX : " << dnpn[i] << endl ;
275 ori_x[i] = (
et[i]->
get_mp()).get_ori_x() ;
289 double ori_x1 = ori_x[0] ;
290 double ori_x2 = ori_x[1] ;
319 int nitmax_axe = 200 ;
321 double precis_axe = 1.e-13 ;
323 x_axe =
zerosec(fonc_binaire_axe, paraxe, 0.9*ori_x1, 0.9*ori_x2,
324 precis_axe, nitmax_axe, nit_axe) ;
326 cout <<
"Binaire::orbit : Number of iterations in zerosec for x_axe : " 330 cout <<
"Binaire::orbit : x_axe [km] : " <<
x_axe / km << endl ;
348 double omega1 = fact_omeg_min *
omega ;
349 double omega2 = fact_omeg_max *
omega ;
350 cout <<
"Binaire::orbit: omega1, omega2 [rad/s] : " 351 << omega1 * f_unit <<
" " << omega2 * f_unit << endl ;
358 zero_list(fonc_binaire_orbit, parf, omega1, omega2, nsub,
363 double omeg_min, omeg_max ;
365 cout <<
"Binaire:orbit : " << nzer <<
366 " zero(s) found in the interval [omega1, omega2]." << endl ;
367 cout <<
"omega, omega1, omega2 : " <<
omega <<
" " << omega1
368 <<
" " << omega2 << endl ;
369 cout <<
"azer : " << *azer << endl ;
370 cout <<
"bzer : " << *bzer << endl ;
374 "Binaire::orbit: WARNING : no zero detected in the interval" 375 << endl <<
" [" << omega1 * f_unit <<
", " 376 << omega2 * f_unit <<
"] rad/s !" << endl ;
381 double dist_min = fabs(omega2 - omega1) ;
382 int i_dist_min = -1 ;
383 for (
int i=0; i<nzer; i++) {
386 double dist = fabs(
omega - 0.5 * ( (*azer)(i) + (*bzer)(i) ) ) ;
387 if (dist < dist_min) {
392 omeg_min = (*azer)(i_dist_min) ;
393 omeg_max = (*bzer)(i_dist_min) ;
399 cout <<
"Binaire:orbit : interval selected for the search of the zero : " 400 << endl <<
" [" << omeg_min <<
", " << omeg_max <<
"] = [" 401 << omeg_min * f_unit <<
", " << omeg_max * f_unit <<
"] rad/s " << endl ;
407 double precis = 1.e-13 ;
409 precis, nitermax, niter) ;
411 cout <<
"Binaire::orbit : Number of iterations in zerosec for omega : " 414 cout <<
"Binaire::orbit : omega [rad/s] : " 415 <<
omega * f_unit << endl ;
468 double mass1,
double mass2,
469 double& xgg1,
double& xgg2) {
477 double dnulg[2], asn2[2], dasn2[2], ny[2], dny[2], npn[2], dnpn[2], xgg[2] ;
478 double nyso[2], dnyso[2], npnso2[2], dnpnso2[2], ori_x[2] ;
480 for (
int i=0; i<2; i++) {
492 Tenseur dln_auto_div = d_logn_auto_div ;
518 cout <<
"Binaire::orbit : unknown value of rot_phi !" << endl ;
523 Cmp tmp = logn_auto_regu + logn_comp + loggam ;
526 dnulg[i] = dln_auto_div(0)(0, 0, 0, 0)
527 + factx * tmp.
dsdx()(0, 0, 0, 0) ;
533 double nc = nnn(0, 0, 0, 0) ;
534 double a2c = a_car(0, 0, 0, 0) ;
535 asn2[i] = a2c / (nc * nc) ;
537 if (
et[i]->is_relativistic() ) {
543 double da2c = factx * a_car.
dsdx()(0, 0, 0, 0) ;
544 double dnc = factx * nnn.
dsdx()(0, 0, 0, 0) ;
546 dasn2[i] = ( da2c - 2 * a2c / nc * dnc ) / (nc*nc) ;
552 ny[i] = shift(1)(0, 0, 0, 0) ;
553 nyso[i] = ny[i] /
omega ;
559 dny[i] = factx * shift(1).dsdx()(0, 0, 0, 0) ;
560 dnyso[i] = dny[i] /
omega ;
569 npn[i] = tmp(0, 0, 0, 0) ;
577 dnpn[i] = factx * tmp.
dsdx()(0, 0, 0, 0) ;
593 cout <<
"Binaire::orbit: central d(nu+log(Gam))/dX : " 594 << dnulg[i] << endl ;
595 cout <<
"Binaire::orbit: central A^2/N^2 : " << asn2[i] << endl ;
596 cout <<
"Binaire::orbit: central d(A^2/N^2)/dX : " << dasn2[i] << endl ;
597 cout <<
"Binaire::orbit: central N^Y : " << ny[i] << endl ;
598 cout <<
"Binaire::orbit: central dN^Y/dX : " << dny[i] << endl ;
599 cout <<
"Binaire::orbit: central N.N : " << npn[i] << endl ;
600 cout <<
"Binaire::orbit: central d(N.N)/dX : " << dnpn[i] << endl ;
608 ori_x[i] = (
et[i]->
get_mp()).get_ori_x() ;
622 double ori_x1 = ori_x[0] ;
623 double ori_x2 = ori_x[1] ;
625 if (
et[0]->get_eos() ==
et[1]->
get_eos() && mass1 == mass2 ) {
651 int nitmax_axe = 200 ;
653 double precis_axe = 1.e-13 ;
655 x_axe =
zerosec(fonc_binaire_axe, paraxe, 0.9*ori_x1, 0.9*ori_x2,
656 precis_axe, nitmax_axe, nit_axe) ;
658 cout <<
"Binaire::orbit : Number of iterations in zerosec for x_axe : " 662 cout <<
"Binaire::orbit : x_axe [km] : " <<
x_axe / km << endl ;
680 double omega1 = fact_omeg_min *
omega ;
681 double omega2 = fact_omeg_max *
omega ;
682 cout <<
"Binaire::orbit: omega1, omega2 [rad/s] : " 683 << omega1 * f_unit <<
" " << omega2 * f_unit << endl ;
690 zero_list(fonc_binaire_orbit, parf, omega1, omega2, nsub,
695 double omeg_min, omeg_max ;
697 cout <<
"Binaire:orbit : " << nzer <<
698 " zero(s) found in the interval [omega1, omega2]." << endl ;
699 cout <<
"omega, omega1, omega2 : " <<
omega <<
" " << omega1
700 <<
" " << omega2 << endl ;
701 cout <<
"azer : " << *azer << endl ;
702 cout <<
"bzer : " << *bzer << endl ;
706 "Binaire::orbit: WARNING : no zero detected in the interval" 707 << endl <<
" [" << omega1 * f_unit <<
", " 708 << omega2 * f_unit <<
"] rad/s !" << endl ;
713 double dist_min = fabs(omega2 - omega1) ;
714 int i_dist_min = -1 ;
715 for (
int i=0; i<nzer; i++) {
718 double dist = fabs(
omega - 0.5 * ( (*azer)(i) + (*bzer)(i) ) ) ;
719 if (dist < dist_min) {
724 omeg_min = (*azer)(i_dist_min) ;
725 omeg_max = (*bzer)(i_dist_min) ;
731 cout <<
"Binaire:orbit : interval selected for the search of the zero : " 732 << endl <<
" [" << omeg_min <<
", " << omeg_max <<
"] = [" 733 << omeg_min * f_unit <<
", " << omeg_max * f_unit <<
"] rad/s " << endl ;
739 double precis = 1.e-13 ;
741 precis, nitermax, niter) ;
743 cout <<
"Binaire::orbit : Number of iterations in zerosec for omega : " 746 cout <<
"Binaire::orbit : omega [rad/s] : " 747 <<
omega * f_unit << endl ;
803 double fonc_binaire_axe(
double x_rot,
const Param& paraxe) {
827 double x1 = ori_x1 - x_rot ;
828 double x2 = ori_x2 - x_rot ;
832 double andan_1 = 0.5 * dasn2_1 + asn2_1 * dnulg_1 ;
833 double andan_2 = 0.5 * dasn2_2 + asn2_2 * dnulg_2 ;
835 double bpb_1 = x1 * x1 - 2. * nyso_1 * x1 + npnso2_1 ;
836 double bpb_2 = x2 * x2 - 2. * nyso_2 * x2 + npnso2_2 ;
838 double cpc_1 = 0.5 * dnpnso2_1 + x1 * (1. - dnyso_1) - nyso_1 ;
839 double cpc_2 = 0.5 * dnpnso2_2 + x2 * (1. - dnyso_2) - nyso_2 ;
841 om2_star1 = dnulg_1 / (andan_1 * bpb_1 + asn2_1 * cpc_1) ;
842 om2_star2 = dnulg_2 / (andan_2 * bpb_2 + asn2_2 * cpc_2) ;
847 om2_star1 = dnulg_1 / x1 ;
848 om2_star2 = dnulg_2 / x2 ;
852 return om2_star1 - om2_star2 ;
860 double fonc_binaire_orbit(
double om,
const Param& parf) {
862 int relat = parf.get_int() ;
864 double xc = parf.get_double(0) ;
865 double dnulg = parf.get_double(1) ;
866 double asn2 = parf.get_double(2) ;
867 double dasn2 = parf.get_double(3) ;
868 double ny = parf.get_double(4) ;
869 double dny = parf.get_double(5) ;
870 double npn = parf.get_double(6) ;
871 double dnpn = parf.get_double(7) ;
872 double x_axe = parf.get_double(8) ;
874 double xx = xc -
x_axe ;
880 double bpb = om2 * xx*xx - 2*om * ny * xx + npn ;
882 dphi_cent = ( asn2* ( om* (ny + xx*dny) - om2*xx - 0.5*dnpn )
884 / ( 1 - asn2 * bpb ) ;
887 dphi_cent = - om2*xx ;
890 return dnulg + dphi_cent ;
const Tenseur & get_logn_auto_regu() const
Returns the regular part of the logarithm of the part of the lapse N generated principaly by the star...
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
const Cmp & dsdx() const
Returns of *this , where .
const Map & get_mp() const
Returns the mapping.
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
const Tenseur & get_a_car() const
Returns the total conformal factor .
Standard units of space, time and mass.
Tensor field of valence 0 (or component of a tensorial field).
const Tenseur & get_shift() const
Returns the total shift vector .
Base class for coordinate mappings.
Tenseur flat_scalar_prod(const Tenseur &t1, const Tenseur &t2)
Scalar product of two Tenseur when the metric is : performs the contraction of the last index of t1 w...
const Base_vect_cart ref_triad
Cartesian triad of the absolute reference frame.
double zerosec_b(double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter)
Finding the zero a function on a bounded domain.
double x_axe
Absolute X coordinate of the rotation axis.
virtual double xa_barycenter() const
Absolute coordinate X of the barycenter of the baryon density, defined according to the formula wher...
void orbit_eqmass(double fact_omeg_min, double fact_omeg_max, double mass1, double mass2, double &xgg1, double &xgg2)
Computes the orbital angular velocity { omega} and the position of the rotation axis { x_axe}...
double get_rot_phi() const
Returns the angle between the x –axis and X –axis.
double zerosec(double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter, bool abort=true)
Finding the zero a function.
const Tenseur & get_d_logn_auto_div() const
Returns the gradient of logn_auto_div.
const Tenseur & get_logn_comp() const
Returns the part of the lapse logarithm (gravitational potential at the Newtonian limit) generated pr...
Etoile_bin * et[2]
Array of the two stars (to perform loops on the stars): { et[0]} contains the address of { star1} and...
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
const Tenseur & get_loggam() const
Returns the logarithm of the Lorentz factor between the fluid and the co-orbiting observer...
void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
double omega
Angular velocity with respect to an asymptotically inertial observer.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
void zero_list(double(*f)(double, const Param &), const Param &par, double xmin, double xmax, int nsub, Tbl *&az, Tbl *&bz)
Locates approximatively all the zeros of a function in a given interval.
const Tenseur & get_nnn() const
Returns the total lapse function N.
void orbit(double fact_omeg_min, double fact_omeg_max, double &xgg1, double &xgg2)
Computes the orbital angular velocity { omega} and the position of the rotation axis { x_axe}...
void save_profile(const Scalar &uu, double r_min, double r_max, double theta, double phi, const char *filename)
Saves in a file the profile of a Scalar along some radial axis determined by a fixed value of ...
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
int get_taille() const
Gives the total size (ie dim.taille)
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
const double & get_double(int position=0) const
Returns the reference of a double stored in the list.
bool is_relativistic() const
Returns true for a relativistic star, false for a Newtonian one.
const Eos & get_eos() const
Returns the equation of state.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
const Tenseur & get_ent() const
Returns the enthalpy field.