binary_orbite.C

00001 /*
00002  * Method of class Binary to compute the orbital angular velocity {\tt omega}
00003  * and the position of the rotation axis {\tt x_axe}.
00004  *
00005  * (See file binary.h for documentation)
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2004 Francois Limousin
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License as published by
00016  *   the Free Software Foundation; either version 2 of the License, or
00017  *   (at your option) any later version.
00018  *
00019  *   LORENE is distributed in the hope that it will be useful,
00020  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  *   GNU General Public License for more details.
00023  *
00024  *   You should have received a copy of the GNU General Public License
00025  *   along with LORENE; if not, write to the Free Software
00026  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  *
00028  */
00029 
00030 
00031 char binary_orbite_C[] = "$Header: /cvsroot/Lorene/C++/Source/Binary/binary_orbite.C,v 1.6 2005/09/13 19:38:31 f_limousin Exp $" ;
00032 
00033 /*
00034  * $Id: binary_orbite.C,v 1.6 2005/09/13 19:38:31 f_limousin Exp $
00035  * $Log: binary_orbite.C,v $
00036  * Revision 1.6  2005/09/13 19:38:31  f_limousin
00037  * Reintroduction of the resolution of the equations in cartesian coordinates.
00038  *
00039  * Revision 1.5  2005/02/17 17:35:35  f_limousin
00040  * Change the name of some quantities to be consistent with other classes
00041  * (for instance nnn is changed to nn, shift to beta, beta to lnq...)
00042  *
00043  * Revision 1.4  2004/03/25 10:29:02  j_novak
00044  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
00045  *
00046  * Revision 1.3  2004/02/24 12:39:30  f_limousin
00047  * Change fonc_bin_ncp_orbit to fonc_binary_orbit and fonc_bin_ncp_axe
00048  * to fonc_binary_axe.
00049  *
00050  * Revision 1.2  2004/02/21 17:05:13  e_gourgoulhon
00051  * Method Scalar::point renamed Scalar::val_grid_point.
00052  * Method Scalar::set_point renamed Scalar::set_grid_point.
00053  *
00054  * Revision 1.1  2004/01/20 15:22:19  f_limousin
00055  * First version
00056  *
00057  *
00058  * $Header: /cvsroot/Lorene/C++/Source/Binary/binary_orbite.C,v 1.6 2005/09/13 19:38:31 f_limousin Exp $
00059  *
00060  */
00061 
00062 // Headers C
00063 #include <math.h>
00064 
00065 // Headers Lorene 
00066 #include "binary.h"
00067 #include "eos.h"
00068 #include "param.h"
00069 #include "utilitaires.h"
00070 #include "unites.h"
00071 
00072 double  fonc_binary_axe(double , const Param& ) ;
00073 double  fonc_binary_orbit(double , const Param& ) ;
00074 
00075 //******************************************************************************
00076 
00077 void Binary::orbit(double fact_omeg_min, double fact_omeg_max, double& xgg1, 
00078              double& xgg2) {
00079 
00080 using namespace Unites ;
00081     
00082     //-------------------------------------------------------------
00083     // Evaluation of various quantities at the center of each star
00084     //-------------------------------------------------------------
00085 
00086 
00087     double g00[2], g10[2], g20[2], g11[2], g21[2], g22[2], bx[2], by[2] ;
00088       
00089     double bz[2], d1sn2[2], unsn2[2] ;
00090 
00091     double dnulg[2], xgg[2], ori_x[2], dg00[2], dg10[2], dg20[2], dg11[2] ;
00092       
00093     double dg21[2], dg22[2], dbx[2], dby[2], dbz[2], dbymo[2] ;
00094 
00095     for (int i=0; i<2; i++) {
00096     
00097     const Scalar& logn_auto = et[i]->get_logn_auto() ; 
00098     const Scalar& logn_comp = et[i]->get_logn_comp() ; 
00099     const Scalar& loggam = et[i]->get_loggam() ; 
00100     const Scalar& nn = et[i]->get_nn() ; 
00101     Vector shift = et[i]->get_beta() ; 
00102     const Metric& gamma = et[i]->get_gamma() ;
00103 
00104     Tensor gamma_cov = gamma.cov() ;
00105 
00106     // With the new convention for shift (beta^i = - N^i)
00107     shift = - shift ;
00108 
00109     // All tensors must be in the cartesian triad
00110 
00111     shift.change_triad(et[i]->mp.get_bvect_cart()) ;
00112     gamma_cov.change_triad(et[i]->mp.get_bvect_cart()) ;
00113 
00114     const Scalar& gg00 = gamma_cov(1,1) ;
00115     const Scalar& gg10 = gamma_cov(2,1) ;
00116     const Scalar& gg20 = gamma_cov(3,1) ;
00117     const Scalar& gg11 = gamma_cov(2,2) ;
00118     const Scalar& gg21 = gamma_cov(3,2) ;
00119     const Scalar& gg22 = gamma_cov(3,3) ;
00120 
00121     const Scalar& bbx = shift(1) ;
00122     const Scalar& bby = shift(2) ;
00123     const Scalar& bbz = shift(3) ;
00124 
00125     cout << "gg00" << endl << norme(gg00) << endl ;
00126     cout << "gg10" << endl << norme(gg10) << endl ;
00127     cout << "gg20" << endl << norme(gg20) << endl ;
00128     cout << "gg11" << endl << norme(gg11) << endl ;
00129     cout << "gg21" << endl << norme(gg21) << endl ;
00130     cout << "gg22" << endl << norme(gg22) << endl ;
00131 
00132     cout << "bbx" << endl << norme(bbx) << endl ;
00133     cout << "bby" << endl << norme(bby) << endl ;
00134     cout << "bbz" << endl << norme(bbz) << endl ;
00135 
00136     //----------------------------------
00137     // Calcul de d/dX( nu + ln(Gamma) ) au centre de l'etoile ---> dnulg[i]
00138     //----------------------------------
00139 
00140     Scalar tmp = logn_auto + logn_comp + loggam ;
00141     
00142     cout << "logn" << endl << norme(logn_auto + logn_comp) << endl ;
00143     cout << "loggam" << endl << norme(loggam) << endl ;
00144     cout << "dnulg" << endl << norme(tmp.dsdx()) << endl ;
00145 
00146     // ... gradient suivant X :         
00147     dnulg[i] = tmp.dsdx().val_grid_point(0, 0, 0, 0) ; 
00148 
00149     cout.precision(8) ;
00150     cout << "dnulg = " << dnulg[i] << endl ;
00151 
00152 
00153     //----------------------------------
00154     // Calcul de gij, lapse et shift au centre de l'etoile
00155     //----------------------------------
00156 
00157     g00[i] = gg00.val_grid_point(0,0,0,0) ; 
00158     g10[i] = gg10.val_grid_point(0,0,0,0) ; 
00159     g20[i] = gg20.val_grid_point(0,0,0,0) ; 
00160     g11[i] = gg11.val_grid_point(0,0,0,0) ; 
00161     g21[i] = gg21.val_grid_point(0,0,0,0) ; 
00162     g22[i] = gg22.val_grid_point(0,0,0,0) ; 
00163 
00164     bx[i] = bbx.val_grid_point(0,0,0,0) ;
00165     by[i] = bby.val_grid_point(0,0,0,0) ;
00166     bz[i] = bbz.val_grid_point(0,0,0,0) ;
00167 
00168     unsn2[i] = 1/(nn.val_grid_point(0,0,0,0)*nn.val_grid_point(0,0,0,0)) ; 
00169 
00170     //----------------------------------
00171     // Calcul de d/dX(gij), d/dX(shift) au centre de l'etoile
00172     //----------------------------------
00173     
00174     dg00[i] = gg00.dsdx().val_grid_point(0,0,0,0) ;
00175     dg10[i] = gg10.dsdx().val_grid_point(0,0,0,0) ;
00176     dg20[i] = gg20.dsdx().val_grid_point(0,0,0,0) ;
00177     dg11[i] = gg11.dsdx().val_grid_point(0,0,0,0) ;
00178     dg21[i] = gg21.dsdx().val_grid_point(0,0,0,0) ;
00179     dg22[i] = gg22.dsdx().val_grid_point(0,0,0,0) ;
00180 
00181     dbx[i] = bbx.dsdx().val_grid_point(0,0,0,0) ;
00182     dby[i] = bby.dsdx().val_grid_point(0,0,0,0) ;
00183     dbz[i] = bbz.dsdx().val_grid_point(0,0,0,0) ;
00184 
00185     dbymo[i] = bby.dsdx().val_grid_point(0,0,0,0) - omega ;
00186 
00187 
00188     d1sn2[i] = (1/(nn*nn)).dsdx().val_grid_point(0,0,0,0) ;
00189 
00190 
00191     cout << "Binary::orbit: central d(nu+log(Gam))/dX : " 
00192          << dnulg[i] << endl ; 
00193     cout << "Binary::orbit: central g00 :" << g00[i] << endl ;
00194     cout << "Binary::orbit: central g10 :" << g10[i] << endl ;
00195     cout << "Binary::orbit: central g20 :" << g20[i] << endl ;
00196     cout << "Binary::orbit: central g11 :" << g11[i] << endl ;
00197     cout << "Binary::orbit: central g21 :" << g21[i] << endl ;
00198     cout << "Binary::orbit: central g22 :" << g22[i] << endl ;
00199 
00200     cout << "Binary::orbit: central shift_x :" << bx[i] << endl ;
00201     cout << "Binary::orbit: central shift_y :" << by[i] << endl ;
00202     cout << "Binary::orbit: central shift_z :" << bz[i] << endl ;
00203 
00204     cout << "Binary::orbit: central d/dX(g00) :" << dg00[i] << endl ;
00205     cout << "Binary::orbit: central d/dX(g10) :" << dg10[i] << endl ;
00206     cout << "Binary::orbit: central d/dX(g20) :" << dg20[i] << endl ;
00207     cout << "Binary::orbit: central d/dX(g11) :" << dg11[i] << endl ;
00208     cout << "Binary::orbit: central d/dX(g21) :" << dg21[i] << endl ;
00209     cout << "Binary::orbit: central d/dX(g22) :" << dg22[i] << endl ;
00210 
00211     cout << "Binary::orbit: central d/dX(shift_x) :" << dbx[i] << endl ;
00212     cout << "Binary::orbit: central d/dX(shift_y) :" << dby[i] << endl ;
00213     cout << "Binary::orbit: central d/dX(shift_z) :" << dbz[i] << endl ;
00214 
00215     //----------------------
00216     // Pour information seulement : 1/ calcul des positions des "centres de
00217     //                  de masse"
00218     //              2/ calcul de dH/dX en r=0
00219     //-----------------------
00220 
00221         ori_x[i] = (et[i]->get_mp()).get_ori_x() ;
00222 
00223     xgg[i] = (et[i]->xa_barycenter() - ori_x[i]) ;
00224          
00225     } // fin de la boucle sur les etoiles 
00226 
00227     xgg1 = xgg[0] ;
00228     xgg2 = xgg[1] ;
00229     
00230    //---------------------------------
00231    //  Position de l'axe de rotation   
00232    //---------------------------------
00233 
00234     double ori_x1 = ori_x[0] ;
00235     double ori_x2 = ori_x[1] ;
00236 
00237     if ( et[0]->get_eos() == et[1]->get_eos() &&
00238      et[0]->get_ent().val_grid_point(0,0,0,0) == 
00239                   et[1]->get_ent().val_grid_point(0,0,0,0) ) {
00240 
00241         x_axe = 0. ;
00242 
00243     }
00244     else {
00245 
00246     Param paraxe ;
00247     paraxe.add_double( ori_x1, 0) ;
00248     paraxe.add_double( ori_x2, 1) ;
00249     paraxe.add_double( dnulg[0], 2) ;
00250     paraxe.add_double( dnulg[1], 3) ;
00251     paraxe.add_double( g00[0], 4) ;
00252     paraxe.add_double( g00[1], 5) ;
00253     paraxe.add_double( g10[0], 6) ;
00254     paraxe.add_double( g10[1], 7) ;
00255     paraxe.add_double( g20[0], 8) ;
00256     paraxe.add_double( g20[1], 9) ;
00257     paraxe.add_double( g11[0], 10) ;
00258     paraxe.add_double( g11[1], 11) ;
00259     paraxe.add_double( g21[0], 12) ;
00260     paraxe.add_double( g21[1], 13) ;
00261     paraxe.add_double( g22[0], 14) ;
00262     paraxe.add_double( g22[1], 15) ;
00263     paraxe.add_double( bx[0], 16) ;
00264     paraxe.add_double( bx[1], 17) ;
00265     paraxe.add_double( by[0], 18) ;
00266     paraxe.add_double( by[1], 19) ;
00267     paraxe.add_double( bz[0], 20) ;
00268     paraxe.add_double( bz[1], 21) ;
00269     paraxe.add_double( dg00[0], 22) ;
00270     paraxe.add_double( dg00[1], 23) ;
00271     paraxe.add_double( dg10[0], 24) ;
00272     paraxe.add_double( dg10[1], 25) ;
00273     paraxe.add_double( dg20[0], 26) ;
00274     paraxe.add_double( dg20[1], 27) ;
00275     paraxe.add_double( dg11[0], 28) ;
00276     paraxe.add_double( dg11[1], 29) ;
00277     paraxe.add_double( dg21[0], 30) ;
00278     paraxe.add_double( dg21[1], 31) ;
00279     paraxe.add_double( dg22[0], 32) ;
00280     paraxe.add_double( dg22[1], 33) ;
00281     paraxe.add_double( dbx[0], 34) ;
00282     paraxe.add_double( dbx[1], 35) ;
00283     paraxe.add_double( dbz[0], 36) ;
00284     paraxe.add_double( dbz[1], 37) ;
00285     paraxe.add_double( dbymo[0], 38) ;
00286     paraxe.add_double( dbymo[1], 39) ;
00287     paraxe.add_double( d1sn2[0], 40) ;
00288     paraxe.add_double( d1sn2[1], 41) ;
00289     paraxe.add_double( unsn2[0], 42) ;
00290     paraxe.add_double( unsn2[1], 43) ;
00291     paraxe.add_double( omega, 44) ;
00292 
00293     int nitmax_axe = 200 ; 
00294     int nit_axe ; 
00295     double precis_axe = 1.e-13 ;
00296 
00297     x_axe = zerosec(fonc_binary_axe, paraxe, 0.9*ori_x1, 0.9*ori_x2,
00298             precis_axe, nitmax_axe, nit_axe) ;
00299 
00300     cout << "Binary::orbit : Number of iterations in zerosec for x_axe : "
00301          << nit_axe << endl ;
00302     }
00303 
00304     cout << "Binary::orbit : x_axe [km] : " << x_axe / km << endl ; 
00305 
00306 //-------------------------------------
00307 //  Calcul de la vitesse orbitale    
00308 //-------------------------------------
00309 
00310     Param parf ; 
00311     parf.add_double( (et[0]->get_mp()).get_ori_x(), 0) ; 
00312     parf.add_double( dnulg[0], 1) ;
00313     parf.add_double( g00[0], 2) ;
00314     parf.add_double( g10[0], 3) ;
00315     parf.add_double( g20[0], 4) ;
00316     parf.add_double( g11[0], 5) ;
00317     parf.add_double( g21[0], 6) ;
00318     parf.add_double( g22[0], 7) ;
00319     parf.add_double( bx[0], 8) ;
00320     parf.add_double( by[0], 9) ;
00321     parf.add_double( bz[0], 10) ;
00322     parf.add_double( dg00[0], 11) ;
00323     parf.add_double( dg10[0], 12) ;
00324     parf.add_double( dg20[0], 13) ;
00325     parf.add_double( dg11[0], 14) ;
00326     parf.add_double( dg21[0], 15) ;
00327     parf.add_double( dg22[0], 16) ;
00328     parf.add_double( dbx[0], 17) ;
00329     parf.add_double( dbz[0], 18) ;
00330     parf.add_double( dby[0], 19) ;
00331     parf.add_double( d1sn2[0], 20) ;
00332     parf.add_double( unsn2[0], 21) ;
00333     parf.add_double( x_axe, 22) ;
00334  
00335 
00336     double omega1 = fact_omeg_min * omega  ; 
00337     double omega2 = fact_omeg_max * omega ; 
00338     cout << "Binary::orbit: omega1,  omega2 [rad/s] : " 
00339      << omega1 * f_unit << "  " << omega2 * f_unit << endl ; 
00340 
00341 
00342     // Search for the various zeros in the interval [omega1,omega2]
00343     // ------------------------------------------------------------
00344     int nsub = 50 ;  // total number of subdivisions of the interval
00345     Tbl* azer = 0x0 ;
00346     Tbl* bzer = 0x0 ; 
00347     zero_list(fonc_binary_orbit, parf, omega1, omega2, nsub,
00348           azer, bzer) ; 
00349     
00350     // Search for the zero closest to the previous value of omega
00351     // ----------------------------------------------------------
00352     double omeg_min, omeg_max ; 
00353     int nzer = azer->get_taille() ; // number of zeros found by zero_list
00354     cout << "Binary:orbit : " << nzer << 
00355          " zero(s) found in the interval [omega1,  omega2]." << endl ; 
00356     cout << "omega, omega1, omega2 : " << omega << "  " << omega1
00357         << "  " << omega2 << endl ; 
00358     cout << "azer : " << *azer << endl ;
00359     cout << "bzer : " << *bzer << endl ;
00360     
00361     if (nzer == 0) {
00362         cout << 
00363         "Binary::orbit: WARNING : no zero detected in the interval"
00364         << endl << "   [" << omega1 * f_unit << ", " 
00365         << omega2 * f_unit << "]  rad/s  !" << endl ; 
00366         omeg_min = omega1 ; 
00367         omeg_max = omega2 ; 
00368     }
00369     else {
00370         double dist_min = fabs(omega2 - omega1) ;  
00371         int i_dist_min = -1 ;       
00372         for (int i=0; i<nzer; i++) {
00373             // Distance of previous value of omega from the center of the
00374             //  interval [azer(i), bzer(i)] 
00375             double dist = fabs( omega - 0.5 * ( (*azer)(i) + (*bzer)(i) ) ) ; 
00376             if (dist < dist_min) {
00377                 dist_min = dist ; 
00378                 i_dist_min = i ; 
00379             } 
00380         }
00381         omeg_min = (*azer)(i_dist_min) ;
00382         omeg_max = (*bzer)(i_dist_min) ;
00383     }
00384 
00385     delete azer ; // Tbl allocated by zero_list
00386     delete bzer ; //  
00387     cout << "Binary::orbit : interval selected for the search of the zero : "
00388      << endl << "  [" << omeg_min << ", " << omeg_max << "]  =  [" 
00389      << omeg_min * f_unit << ", " << omeg_max * f_unit << "] rad/s " << endl ; 
00390     
00391     // Computation of the zero in the selected interval by the secant method
00392     // ---------------------------------------------------------------------
00393 
00394     int nitermax = 200 ; 
00395     int niter ; 
00396     double precis = 1.e-13 ;
00397     omega = zerosec_b(fonc_binary_orbit, parf, omeg_min, omeg_max,
00398             precis, nitermax, niter) ;
00399     
00400     cout << "Binary::orbit : Number of iterations in zerosec for omega : "
00401      << niter << endl ; 
00402     
00403     cout << "Binary::orbit : omega [rad/s] : "
00404      << omega * f_unit << endl ; 
00405           
00406 
00407 }
00408 
00409 
00410 //-------------------------------------------------
00411 //  Function used for search of the rotation axis
00412 //-------------------------------------------------
00413 
00414 double  fonc_binary_axe(double x_rot, const Param& paraxe) {
00415 
00416     double ori_x1 = paraxe.get_double(0) ;
00417     double ori_x2 = paraxe.get_double(1) ;
00418     double dnulg_1 = paraxe.get_double(2) ;
00419     double dnulg_2 = paraxe.get_double(3) ;
00420     double g00_1 = paraxe.get_double(4) ;
00421     double g00_2 = paraxe.get_double(5) ;
00422     double g10_1 = paraxe.get_double(6) ;
00423     double g10_2 = paraxe.get_double(7) ;
00424     double g20_1 = paraxe.get_double(8) ;
00425     double g20_2 = paraxe.get_double(9) ;
00426     double g11_1 = paraxe.get_double(10) ;
00427     double g11_2 = paraxe.get_double(11) ;
00428     double g21_1 = paraxe.get_double(12) ;
00429     double g21_2 = paraxe.get_double(13) ;
00430     double g22_1 = paraxe.get_double(14) ;
00431     double g22_2 = paraxe.get_double(15) ;
00432     double bx_1 = paraxe.get_double(16) ;
00433     double bx_2 = paraxe.get_double(17) ;
00434     double by_1 = paraxe.get_double(18) ;
00435     double by_2 = paraxe.get_double(19) ;
00436     double bz_1 = paraxe.get_double(20) ;
00437     double bz_2 = paraxe.get_double(21) ;
00438     double dg00_1 = paraxe.get_double(22) ;
00439     double dg00_2 = paraxe.get_double(23) ;
00440     double dg10_1 = paraxe.get_double(24) ;
00441     double dg10_2 = paraxe.get_double(25) ;
00442     double dg20_1 = paraxe.get_double(26) ;
00443     double dg20_2 = paraxe.get_double(27) ;
00444     double dg11_1 = paraxe.get_double(28) ;
00445     double dg11_2 = paraxe.get_double(29) ;
00446     double dg21_1 = paraxe.get_double(30) ;
00447     double dg21_2 = paraxe.get_double(31) ;
00448     double dg22_1 = paraxe.get_double(32) ;
00449     double dg22_2 = paraxe.get_double(33) ;
00450     double dbx_1 = paraxe.get_double(34) ;
00451     double dbx_2 = paraxe.get_double(35) ;
00452     double dbz_1 = paraxe.get_double(36) ;
00453     double dbz_2 = paraxe.get_double(37) ;
00454     double dbymo_1 = paraxe.get_double(38) ;
00455     double dbymo_2 = paraxe.get_double(39) ;
00456     double d1sn2_1 = paraxe.get_double(40) ;
00457     double d1sn2_2 = paraxe.get_double(41) ;
00458     double unsn2_1 = paraxe.get_double(42) ;
00459     double unsn2_2 = paraxe.get_double(43) ;
00460     double omega = paraxe.get_double(44) ;
00461 
00462     double om2_star1 ;
00463     double om2_star2 ;
00464 
00465     double x1 = ori_x1 - x_rot ;
00466     double x2 = ori_x2 - x_rot ;
00467 
00468     double bymxo_1 = by_1-x1*omega ; 
00469     double bymxo_2 = by_2-x2*omega ;
00470 
00471     
00472     double beta1 = g00_1*bx_1*bx_1 + 2*g10_1*bx_1*bymxo_1 + 2*g20_1*bx_1*bz_1 ;
00473     double beta2 = g11_1*bymxo_1*bymxo_1 + 2*g21_1*bz_1*bymxo_1 
00474                    + g22_1*bz_1*bz_1 ;
00475 
00476     double beta_1 = beta1 + beta2 ;
00477 
00478 
00479     double delta1 = dg00_1*bx_1*bx_1 + 2*g00_1*dbx_1*bx_1 
00480     + 2*dg10_1*bx_1*bymxo_1 ;
00481     double delta2 = 2*g10_1*bymxo_1*dbx_1 + 2*g10_1*bx_1*dbymo_1 
00482     + 2*dg20_1*bx_1*bz_1 ;
00483     double delta3 = 2*g20_1*bx_1*dbz_1 +2*g20_1*bz_1*dbx_1 + dg11_1*bymxo_1*bymxo_1 ;
00484     double delta4 = 2*g11_1*bymxo_1*dbymo_1 + 2*dg21_1*bz_1*bymxo_1;
00485     double delta5 = 2*g21_1*bymxo_1*dbz_1 +2*g21_1*bz_1*dbymo_1 
00486     + dg22_1*bz_1*bz_1 + 2*g22_1*bz_1*dbz_1 ;
00487 
00488     double delta_1 = delta1 + delta2 + delta3 + delta4 + delta5 ;
00489 
00490     // Computation of omega for star 1
00491     //---------------------------------
00492 
00493     om2_star1 = dnulg_1 / (beta_1/(omega*omega)*(dnulg_1*unsn2_1 + d1sn2_1/2.) 
00494                + unsn2_1*delta_1/(omega*omega)/2.) ;
00495 
00496 
00497 
00498     double beta3 = g00_2*bx_2*bx_2 + 2*g10_2*bx_2*bymxo_2 + 2*g20_2*bx_2*bz_2 ;
00499     double beta4 = g11_2*bymxo_2*bymxo_2 + 2*g21_2*bz_2*bymxo_2
00500                    + g22_2*bz_2*bz_2 ;
00501 
00502     double beta_2 = beta3 + beta4 ;
00503 
00504        
00505     double delta6 = dg00_2*bx_2*bx_2 + 2*g00_2*dbx_2*bx_2 
00506     + 2*dg10_2*bx_2*bymxo_2 ;
00507     double delta7 = 2*g10_2*bymxo_2*dbx_2 + 2*g10_2*bx_2*dbymo_2 
00508     + 2*dg20_2*bx_2*bz_2 ;
00509     double delta8 = 2*g20_2*bx_2*dbz_2 +2*g20_2*bz_2*dbx_2 
00510     + dg11_2*bymxo_2*bymxo_2 ;
00511     double delta9 = 2*g11_2*bymxo_2*dbymo_2 + 2*dg21_2*bz_2*bymxo_2;
00512     double delta10 = 2*g21_2*bymxo_2*dbz_2 +2*g21_2*bz_2*dbymo_2 
00513     + dg22_2*bz_2*bz_2 + 2*g22_2*bz_2*dbz_2 ;
00514 
00515     double delta_2 = delta6 + delta7 + delta8 + delta9 + delta10 ;
00516 
00517     // Computation of omega for star 2
00518     //---------------------------------
00519 
00520     om2_star2 = dnulg_2 / (beta_2/(omega*omega)*(dnulg_2*unsn2_2 + d1sn2_2/2.) 
00521                + unsn2_2*delta_2/(omega*omega)/2.) ;
00522                                                                             ; 
00523   
00524     return om2_star1 - om2_star2 ;
00525 
00526 }
00527 
00528 //----------------------------------------------------------------------------
00529 //  Fonction utilisee pour la recherche de omega par la methode de la secante
00530 //----------------------------------------------------------------------------
00531 
00532 double fonc_binary_orbit(double om, const Param& parf) {
00533 
00534     double xc = parf.get_double(0) ; 
00535     double dnulg = parf.get_double(1) ;
00536     double g00 = parf.get_double(2) ;
00537     double g10 = parf.get_double(3) ;
00538     double g20 = parf.get_double(4) ;
00539     double g11 = parf.get_double(5) ;
00540     double g21 = parf.get_double(6) ;
00541     double g22 = parf.get_double(7) ;
00542     double bx = parf.get_double(8) ;
00543     double by = parf.get_double(9) ;
00544     double bz = parf.get_double(10) ;
00545     double dg00 = parf.get_double(11) ;
00546     double dg10 = parf.get_double(12) ;
00547     double dg20 = parf.get_double(13) ;
00548     double dg11 = parf.get_double(14) ;
00549     double dg21 = parf.get_double(15) ;
00550     double dg22 = parf.get_double(16) ;
00551     double dbx = parf.get_double(17) ;
00552     double dbz = parf.get_double(18) ;
00553     double dby = parf.get_double(19) ;
00554     double d1sn2 = parf.get_double(20) ;
00555     double unsn2 = parf.get_double(21) ;
00556     double x_axe = parf.get_double(22) ;
00557  
00558 
00559     double dbymo = dby - om ;
00560     double xx = xc - x_axe ; 
00561     
00562     double bymxo = by-xx*om ;  
00563 
00564     //    bymxo = - bymxo ;
00565     //dbymo = - dbymo ;
00566 
00567     double beta1 = g00*bx*bx + 2*g10*bx*bymxo + 2*g20*bx*bz ;
00568     double beta2 = g11*bymxo*bymxo + 2*g21*bz*bymxo+ g22*bz*bz ;
00569     double beta = beta1 + beta2 ;
00570        
00571     double alpha = 1 - unsn2*beta ;
00572 
00573     double delta1 = dg00*bx*bx + 2*g00*dbx*bx + 2*dg10*bx*bymxo ;
00574     double delta2 = 2*g10*bymxo*dbx + 2*g10*bx*dbymo + 2*dg20*bx*bz ;
00575     double delta3 = 2*g20*bx*dbz +2*g20*bz*dbx + dg11*bymxo*bymxo ;
00576     double delta4 = 2*g11*bymxo*dbymo + 2*dg21*bz*bymxo;
00577     double delta5 = 2*g21*bymxo*dbz +2*g21*bz*dbymo + dg22*bz*bz 
00578                 + 2*g22*bz*dbz ;
00579 
00580     double delta = delta1 + delta2 + delta3 + delta4 + delta5 ;
00581 
00582     // Difference entre les 2 termes de l'eq.(95) de Gourgoulhon et.al (2001)  
00583     //centre de l'etoile 
00584     //-----------------------------------------------------------------------
00585 
00586     double diff = dnulg + (1/(2.*alpha))*(-d1sn2*beta - unsn2*delta) ; 
00587  
00588     /*
00589     double bpb = om*om*xx*xx - 2*om*by*xx + by*by ;
00590     double dphi_cent = (g00*unsn2*( om*(by+xx*dby) - om*om*xx - by*dby )
00591             - 0.5*bpb*(dg00 + g00*d1sn2/unsn2)*unsn2 )
00592       / (1 - g00*unsn2*bpb) ;
00593     double diff = dnulg + dphi_cent ;
00594 
00595     
00596      cout.precision(8) ;
00597      cout << "bpb = " << bpb << endl ;
00598      cout << "om = " << om << endl ;
00599      cout << "by = " << by << endl ;
00600      cout << "xx = " << xx << endl ;
00601      cout << "dby = " << dby << endl ;
00602      cout << "part11 = " << g00*unsn2 << endl ;
00603      cout << "part12 = " << om*(by+xx*dby) << endl ;
00604      cout << "part13 = " <<- om*om*xx  << endl ;
00605      cout << "part14 = " << - by*dby << endl ;
00606      cout << "part1 = " << g00*unsn2*( om*(by+xx*dby) - om*om*xx - by*dby ) << endl ;
00607      cout << "part2 = " << - 0.5*bpb*(dg00 + g00*d1sn2/unsn2)*unsn2 << endl ;     
00608      cout << "part3 = " << (1 - g00*unsn2*bpb) << endl ;     
00609      cout << "dnulg = " << dnulg << endl ;
00610      cout << "dphi_cent = " << dphi_cent << endl ;
00611      cout << "diff = " << diff << endl ;
00612      cout << endl ;
00613     */
00614 
00615      return diff ; 
00616 
00617 
00618      
00619 }
00620 
00621 
00622    

Generated on Tue Feb 7 01:35:15 2012 for LORENE by  doxygen 1.4.6