00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 char bin_bhns_extr_orbit_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_bhns_extr/bin_bhns_extr_orbit.C,v 1.2 2005/02/28 23:07:47 k_taniguchi Exp $" ;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #include <math.h>
00047
00048
00049 #include "bin_bhns_extr.h"
00050 #include "eos.h"
00051 #include "param.h"
00052 #include "utilitaires.h"
00053 #include "unites.h"
00054
00055 double fonc_bhns_orbit_ks(double, const Param& ) ;
00056 double fonc_bhns_orbit_cf(double, const Param& ) ;
00057
00058
00059
00060 void Bin_bhns_extr::orbit_omega_ks(double fact_omeg_min,
00061 double fact_omeg_max) {
00062
00063 using namespace Unites ;
00064
00065
00066
00067
00068
00069 double dnulg, asn2, dasn2, nx, dnx, ny, dny, npn, dnpn ;
00070 double msr ;
00071
00072 const Map& mp = star.get_mp() ;
00073
00074 const Cmp& logn_auto_regu = star.get_logn_auto_regu()() ;
00075 const Cmp& loggam = star.get_loggam()() ;
00076 const Cmp& nnn = star.get_nnn()() ;
00077 const Cmp& a_car = star.get_a_car()() ;
00078 const Tenseur& shift = star.get_shift() ;
00079 const Tenseur& d_logn_auto_div = star.get_d_logn_auto_div() ;
00080
00081 Tenseur dln_auto_div = d_logn_auto_div ;
00082
00083 if ( *(dln_auto_div.get_triad()) != ref_triad ) {
00084
00085
00086 dln_auto_div.change_triad( mp.get_bvect_cart() ) ;
00087
00088
00089 dln_auto_div.change_triad( ref_triad ) ;
00090
00091 }
00092
00093 const Tenseur& d_logn_comp = star.get_d_logn_comp() ;
00094
00095 Tenseur dln_comp = d_logn_comp ;
00096
00097 if ( *(dln_comp.get_triad()) != ref_triad ) {
00098
00099
00100 dln_comp.change_triad( mp.get_bvect_cart() ) ;
00101
00102
00103 dln_comp.change_triad( ref_triad ) ;
00104
00105 }
00106
00107
00108
00109
00110
00111 msr = ggrav * mass_bh / separ ;
00112
00113
00114
00115
00116
00117
00118
00119 double factx ;
00120 if (fabs(mp.get_rot_phi()) < 1.e-14) {
00121 factx = 1. ;
00122 }
00123 else {
00124 if (fabs(mp.get_rot_phi() - M_PI) < 1.e-14) {
00125 factx = - 1. ;
00126 }
00127 else {
00128 cout << "Bin_bhns_extr::orbit_omega : unknown value of rot_phi !"
00129 << endl ;
00130 abort() ;
00131 }
00132 }
00133
00134 Cmp tmp = logn_auto_regu + loggam ;
00135
00136
00137 dnulg = dln_auto_div(0)(0, 0, 0, 0) + dln_comp(0)(0, 0, 0, 0)
00138 + factx * tmp.dsdx()(0, 0, 0, 0) ;
00139
00140
00141
00142
00143 double nc = nnn(0, 0, 0, 0) ;
00144 double a2c = a_car(0, 0, 0, 0) ;
00145 asn2 = a2c / (nc * nc) ;
00146
00147 if ( star.is_relativistic() ) {
00148
00149
00150
00151
00152
00153 double da2c = factx * a_car.dsdx()(0, 0, 0, 0) ;
00154 double dnc = factx * nnn.dsdx()(0, 0, 0, 0) ;
00155
00156 dasn2 = ( da2c - 2. * a2c / nc * dnc ) / (nc*nc) ;
00157
00158
00159
00160
00161 nx = shift(0)(0, 0, 0, 0) ;
00162
00163
00164
00165
00166 dnx = factx * shift(0).dsdx()(0, 0, 0, 0) ;
00167
00168
00169
00170
00171 ny = shift(1)(0, 0, 0, 0) ;
00172
00173
00174
00175
00176 dny = factx * shift(1).dsdx()(0, 0, 0, 0) ;
00177
00178
00179
00180
00181
00182 tmp = flat_scalar_prod(shift, shift)() ;
00183 npn = tmp(0, 0, 0, 0) ;
00184
00185
00186
00187
00188
00189 dnpn = factx * tmp.dsdx()(0, 0, 0, 0) ;
00190
00191 }
00192 else {
00193 cout << "Bin_bhns_extr::orbit_omega : "
00194 << "It should be the relativistic calculation !" << endl ;
00195 abort() ;
00196 }
00197
00198 cout << "Bin_bhns_extr::orbit_omega: coord. ori. d(nu+log(Gam))/dX : "
00199 << dnulg << endl ;
00200 cout << "Bin_bhns_extr::orbit_omega: coord. ori. A^2/N^2 : "
00201 << asn2 << endl ;
00202 cout << "Bin_bhns_extr::orbit_omega: coord. ori. d(A^2/N^2)/dX : "
00203 << dasn2 << endl ;
00204 cout << "Bin_bhns_extr::orbit_omega: coord. ori. N^X : " << nx << endl ;
00205 cout << "Bin_bhns_extr::orbit_omega: coord. ori. dN^X/dX : "
00206 << dnx << endl ;
00207 cout << "Bin_bhns_extr::orbit_omega: coord. ori. N^Y : " << ny << endl ;
00208 cout << "Bin_bhns_extr::orbit_omega: coord. ori. dN^Y/dX : "
00209 << dny << endl ;
00210 cout << "Bin_bhns_extr::orbit_omega: coord. ori. N.N : " << npn << endl ;
00211 cout << "Bin_bhns_extr::orbit_omega: coord. ori. d(N.N)/dX : "
00212 << dnpn << endl ;
00213
00214
00215
00216
00217 int relat = ( star.is_relativistic() ) ? 1 : 0 ;
00218
00219 Param parf ;
00220 parf.add_int(relat) ;
00221 parf.add_double( (star.get_mp()).get_ori_x(), 0) ;
00222 parf.add_double( dnulg, 1) ;
00223 parf.add_double( asn2, 2) ;
00224 parf.add_double( dasn2, 3) ;
00225 parf.add_double( nx, 4) ;
00226 parf.add_double( dnx, 5) ;
00227 parf.add_double( ny, 6) ;
00228 parf.add_double( dny, 7) ;
00229 parf.add_double( npn, 8) ;
00230 parf.add_double( dnpn, 9) ;
00231 parf.add_double( msr, 10) ;
00232
00233 double omega1 = fact_omeg_min * omega ;
00234 double omega2 = fact_omeg_max * omega ;
00235
00236 cout << "Bin_bhns_extr::orbit_omega: omega1, omega2 [rad/s] : "
00237 << omega1 * f_unit << " " << omega2 * f_unit << endl ;
00238
00239
00240
00241 int nsub = 50 ;
00242 Tbl* azer = 0x0 ;
00243 Tbl* bzer = 0x0 ;
00244 zero_list(fonc_bhns_orbit_ks, parf, omega1, omega2, nsub,
00245 azer, bzer) ;
00246
00247
00248
00249 double omeg_min, omeg_max ;
00250 int nzer = azer->get_taille() ;
00251 cout << "Bin_bhns_extr::orbit_omega : " << nzer <<
00252 "zero(s) found in the interval [omega1, omega2]." << endl ;
00253 cout << "omega, omega1, omega2 : " << omega << " " << omega1
00254 << " " << omega2 << endl ;
00255 cout << "azer : " << *azer << endl ;
00256 cout << "bzer : " << *bzer << endl ;
00257
00258 if (nzer == 0) {
00259 cout << "Bin_bhns_extr::orbit_omega: WARNING : "
00260 << "no zero detected in the interval" << endl
00261 << " [" << omega1 * f_unit << ", "
00262 << omega2 * f_unit << "] rad/s !" << endl ;
00263 omeg_min = omega1 ;
00264 omeg_max = omega2 ;
00265 }
00266 else {
00267 double dist_min = fabs(omega2 - omega1) ;
00268 int i_dist_min = -1 ;
00269 for (int i=0; i<nzer; i++) {
00270
00271
00272 double dist = fabs( omega - 0.5 * ( (*azer)(i) + (*bzer)(i) ) ) ;
00273
00274 if (dist < dist_min) {
00275 dist_min = dist ;
00276 i_dist_min = i ;
00277 }
00278 }
00279 omeg_min = (*azer)(i_dist_min) ;
00280 omeg_max = (*bzer)(i_dist_min) ;
00281 }
00282
00283 delete azer ;
00284 delete bzer ;
00285
00286 cout << "Bin_bhns_extr:orbit_omega : "
00287 << "interval selected for the search of the zero : "
00288 << endl << " [" << omeg_min << ", " << omeg_max << "] = ["
00289 << omeg_min * f_unit << ", " << omeg_max * f_unit << "] rad/s "
00290 << endl ;
00291
00292
00293
00294
00295 int nitermax = 200 ;
00296 int niter ;
00297 double precis = 1.e-13 ;
00298 omega = zerosec_b(fonc_bhns_orbit_ks, parf, omeg_min, omeg_max,
00299 precis, nitermax, niter) ;
00300
00301 cout << "Bin_bhns_extr::orbit_omega : "
00302 << "Number of iterations in zerosec for omega : "
00303 << niter << endl ;
00304
00305 cout << "Bin_bhns_extr::orbit_omega : omega [rad/s] : "
00306 << omega * f_unit << endl ;
00307
00308 }
00309
00310
00311 void Bin_bhns_extr::orbit_omega_cf(double fact_omeg_min,
00312 double fact_omeg_max) {
00313
00314 using namespace Unites ;
00315
00316
00317
00318
00319
00320 double dnulg, asn2, dasn2, ny, dny, npn, dnpn ;
00321
00322 const Map& mp = star.get_mp() ;
00323
00324 const Cmp& logn_auto_regu = star.get_logn_auto_regu()() ;
00325 const Cmp& logn_comp = star.get_logn_comp()() ;
00326 const Cmp& loggam = star.get_loggam()() ;
00327 const Cmp& nnn = star.get_nnn()() ;
00328 const Cmp& a_car = star.get_a_car()() ;
00329 const Tenseur& shift = star.get_shift() ;
00330 const Tenseur& d_logn_auto_div = star.get_d_logn_auto_div() ;
00331
00332 Tenseur dln_auto_div = d_logn_auto_div ;
00333
00334 if ( *(dln_auto_div.get_triad()) != ref_triad ) {
00335
00336
00337 dln_auto_div.change_triad( mp.get_bvect_cart() ) ;
00338
00339
00340 dln_auto_div.change_triad( ref_triad ) ;
00341
00342 }
00343
00344
00345
00346
00347
00348
00349
00350 double factx ;
00351 if (fabs(mp.get_rot_phi()) < 1.e-14) {
00352 factx = 1. ;
00353 }
00354 else {
00355 if (fabs(mp.get_rot_phi() - M_PI) < 1.e-14) {
00356 factx = - 1. ;
00357 }
00358 else {
00359 cout <<
00360 "Bin_bhns_extr::orbit_omega_cfc : unknown value of rot_phi !"
00361 << endl ;
00362 abort() ;
00363 }
00364 }
00365
00366 Cmp tmp = logn_auto_regu + logn_comp + loggam ;
00367
00368
00369 dnulg = dln_auto_div(0)(0, 0, 0, 0)
00370 + factx * tmp.dsdx()(0, 0, 0, 0) ;
00371
00372
00373
00374
00375 double nc = nnn(0, 0, 0, 0) ;
00376 double a2c = a_car(0, 0, 0, 0) ;
00377 asn2 = a2c / (nc * nc) ;
00378
00379 if ( star.is_relativistic() ) {
00380
00381
00382
00383
00384
00385 double da2c = factx * a_car.dsdx()(0, 0, 0, 0) ;
00386 double dnc = factx * nnn.dsdx()(0, 0, 0, 0) ;
00387
00388 dasn2 = ( da2c - 2. * a2c / nc * dnc ) / (nc*nc) ;
00389
00390
00391
00392
00393 ny = shift(1)(0, 0, 0, 0) ;
00394
00395
00396
00397
00398 dny = factx * shift(1).dsdx()(0, 0, 0, 0) ;
00399
00400
00401
00402
00403
00404 tmp = flat_scalar_prod(shift, shift)() ;
00405 npn = tmp(0, 0, 0, 0) ;
00406
00407
00408
00409
00410
00411 dnpn = factx * tmp.dsdx()(0, 0, 0, 0) ;
00412
00413 }
00414 else {
00415 cout << "Bin_bhns_extr::orbit_omega_cfc : "
00416 << "It should be the relativistic calculation !" << endl ;
00417 abort() ;
00418 }
00419
00420 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. d(nu+log(Gam))/dX : "
00421 << dnulg << endl ;
00422 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. A^2/N^2 : "
00423 << asn2 << endl ;
00424 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. d(A^2/N^2)/dX : "
00425 << dasn2 << endl ;
00426 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. N^Y : "
00427 << ny << endl ;
00428 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. dN^Y/dX : "
00429 << dny << endl ;
00430 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. N.N : "
00431 << npn << endl ;
00432 cout << "Bin_bhns_extr::orbit_omega_cfc: coord. ori. d(N.N)/dX : "
00433 << dnpn << endl ;
00434
00435
00436
00437
00438 int relat = ( star.is_relativistic() ) ? 1 : 0 ;
00439
00440 Param parf ;
00441 parf.add_int(relat) ;
00442 parf.add_double( (star.get_mp()).get_ori_x(), 0) ;
00443 parf.add_double( dnulg, 1) ;
00444 parf.add_double( asn2, 2) ;
00445 parf.add_double( dasn2, 3) ;
00446 parf.add_double( ny, 4) ;
00447 parf.add_double( dny, 5) ;
00448 parf.add_double( npn, 6) ;
00449 parf.add_double( dnpn, 7) ;
00450
00451 double omega1 = fact_omeg_min * omega ;
00452 double omega2 = fact_omeg_max * omega ;
00453
00454 cout << "Bin_bhns_extr::orbit_omega_cfc: omega1, omega2 [rad/s] : "
00455 << omega1 * f_unit << " " << omega2 * f_unit << endl ;
00456
00457
00458
00459 int nsub = 50 ;
00460 Tbl* azer = 0x0 ;
00461 Tbl* bzer = 0x0 ;
00462 zero_list(fonc_bhns_orbit_cf, parf, omega1, omega2, nsub,
00463 azer, bzer) ;
00464
00465
00466
00467 double omeg_min, omeg_max ;
00468 int nzer = azer->get_taille() ;
00469 cout << "Bin_bhns_extr::orbit_omega_cfc : " << nzer <<
00470 "zero(s) found in the interval [omega1, omega2]." << endl ;
00471 cout << "omega, omega1, omega2 : " << omega << " " << omega1
00472 << " " << omega2 << endl ;
00473 cout << "azer : " << *azer << endl ;
00474 cout << "bzer : " << *bzer << endl ;
00475
00476 if (nzer == 0) {
00477 cout << "Bin_bhns_extr::orbit_omega_cfc: WARNING : "
00478 << "no zero detected in the interval" << endl
00479 << " [" << omega1 * f_unit << ", "
00480 << omega2 * f_unit << "] rad/s !" << endl ;
00481 omeg_min = omega1 ;
00482 omeg_max = omega2 ;
00483 }
00484 else {
00485 double dist_min = fabs(omega2 - omega1) ;
00486 int i_dist_min = -1 ;
00487 for (int i=0; i<nzer; i++) {
00488
00489
00490 double dist = fabs( omega - 0.5 * ( (*azer)(i) + (*bzer)(i) ) ) ;
00491
00492 if (dist < dist_min) {
00493 dist_min = dist ;
00494 i_dist_min = i ;
00495 }
00496 }
00497 omeg_min = (*azer)(i_dist_min) ;
00498 omeg_max = (*bzer)(i_dist_min) ;
00499 }
00500
00501 delete azer ;
00502 delete bzer ;
00503
00504 cout << "Bin_bhns_extr:orbit_omega_cfc : "
00505 << "interval selected for the search of the zero : "
00506 << endl << " [" << omeg_min << ", " << omeg_max << "] = ["
00507 << omeg_min * f_unit << ", " << omeg_max * f_unit << "] rad/s "
00508 << endl ;
00509
00510
00511
00512
00513 int nitermax = 200 ;
00514 int niter ;
00515 double precis = 1.e-13 ;
00516 omega = zerosec_b(fonc_bhns_orbit_cf, parf, omeg_min, omeg_max,
00517 precis, nitermax, niter) ;
00518
00519 cout << "Bin_bhns_extr::orbit_omega_cfc : "
00520 << "Number of iterations in zerosec for omega : "
00521 << niter << endl ;
00522
00523 cout << "Bin_bhns_extr::orbit_omega_cfc : omega [rad/s] : "
00524 << omega * f_unit << endl ;
00525
00526 }
00527
00528
00529
00530
00531
00532
00533 double fonc_bhns_orbit_ks(double om, const Param& parf) {
00534
00535 int relat = parf.get_int() ;
00536
00537 double xc = parf.get_double(0) ;
00538 double dnulg = parf.get_double(1) ;
00539 double asn2 = parf.get_double(2) ;
00540 double dasn2 = parf.get_double(3) ;
00541 double nx = parf.get_double(4) ;
00542 double dnx = parf.get_double(5) ;
00543 double ny = parf.get_double(6) ;
00544 double dny = parf.get_double(7) ;
00545 double npn = parf.get_double(8) ;
00546 double dnpn = parf.get_double(9) ;
00547 double msr = parf.get_double(10) ;
00548
00549 double om2 = om*om ;
00550
00551 double dphi_cent ;
00552
00553 if (relat == 1) {
00554 double bpb = om2 * xc*xc - 2.*om * ny * xc + npn + 2.*msr * nx*nx;
00555
00556 dphi_cent = ( asn2* ( om* (ny + xc*dny) - om2*xc - 0.5*dnpn
00557 - 2.*msr * nx * dnx + msr * nx*nx / xc )
00558 - 0.5*bpb* dasn2 ) / ( 1 - asn2 * bpb ) ;
00559 }
00560 else {
00561 cout << "Bin_bhns_extr::orbit_omega_ks : "
00562 << "It should be the relativistic calculation !" << endl ;
00563 abort() ;
00564 }
00565
00566 return dnulg + dphi_cent ;
00567
00568 }
00569
00570 double fonc_bhns_orbit_cf(double om, const Param& parf) {
00571
00572 int relat = parf.get_int() ;
00573
00574 double xc = parf.get_double(0) ;
00575 double dnulg = parf.get_double(1) ;
00576 double asn2 = parf.get_double(2) ;
00577 double dasn2 = parf.get_double(3) ;
00578 double ny = parf.get_double(4) ;
00579 double dny = parf.get_double(5) ;
00580 double npn = parf.get_double(6) ;
00581 double dnpn = parf.get_double(7) ;
00582
00583 double om2 = om*om ;
00584
00585 double dphi_cent ;
00586
00587 if (relat == 1) {
00588 double bpb = om2 * xc*xc - 2.*om * ny * xc + npn ;
00589
00590 dphi_cent = ( asn2* ( om* (ny + xc*dny) - om2*xc - 0.5*dnpn )
00591 - 0.5*bpb* dasn2 ) / ( 1 - asn2 * bpb ) ;
00592 }
00593 else {
00594 cout << "Bin_bhns_extr::orbit_omega_cf : "
00595 << "It should be the relativistic calculation !" << endl ;
00596 abort() ;
00597 }
00598
00599 return dnulg + dphi_cent ;
00600
00601 }