bhole_glob.C

00001 /*
00002  *   Copyright (c) 2001 Philippe Grandclement
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char bhole_glob_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_glob.C,v 1.3 2005/08/29 15:10:14 p_grandclement Exp $" ;
00024 
00025 /*
00026  * $Id: bhole_glob.C,v 1.3 2005/08/29 15:10:14 p_grandclement Exp $
00027  * $Log: bhole_glob.C,v $
00028  * Revision 1.3  2005/08/29 15:10:14  p_grandclement
00029  * Addition of things needed :
00030  *   1) For BBH with different masses
00031  *   2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
00032  *   WORKING YET !!!
00033  *
00034  * Revision 1.2  2002/10/16 14:36:33  j_novak
00035  * Reorganization of #include instructions of standard C++, in order to
00036  * use experimental version 3 of gcc.
00037  *
00038  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00039  * LORENE
00040  *
00041  * Revision 2.5  2001/06/28  12:11:19  eric
00042  * Correction d'un memory leak dans Bhole_binaire::moment_systeme_inf()
00043  *   (ajout de delete [] bornes).
00044  *
00045  * Revision 2.4  2001/05/07  12:24:19  phil
00046  * correction de calcul de J
00047  *
00048  * Revision 2.3  2001/05/07  09:12:09  phil
00049  * *** empty log message ***
00050  *
00051  * Revision 2.2  2001/03/22  10:49:47  phil
00052  * *** empty log message ***
00053  *
00054  * Revision 2.1  2001/03/22  10:44:20  phil
00055  * *** empty log message ***
00056  *
00057  * Revision 2.0  2001/03/01  08:18:13  phil
00058  * *** empty log message ***
00059  *
00060  *
00061  * $Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_glob.C,v 1.3 2005/08/29 15:10:14 p_grandclement Exp $
00062  *
00063  */
00064 
00065 
00066 
00067 //standard
00068 #include <stdlib.h>
00069 #include <math.h>
00070 
00071 // Lorene
00072 #include "nbr_spx.h"
00073 #include "tenseur.h"
00074 #include "bhole.h"
00075 #include "proto.h"
00076 #include "utilitaires.h"
00077 #include "graphique.h"
00078 
00079 double Bhole_binaire::adm_systeme() const {
00080     Cmp der_un (hole1.psi_auto().dsdr()) ;
00081     Cmp der_deux (hole2.psi_auto().dsdr()) ;
00082     
00083     double masse = hole1.mp.integrale_surface_infini(der_un) + 
00084     hole2.mp.integrale_surface_infini(der_deux) ;
00085     
00086     masse /= -2*M_PI ;
00087     return masse ;
00088 }
00089 
00090 double Bhole_binaire::komar_systeme() const {
00091     Cmp der_un (hole1.n_auto().dsdr()) ;
00092     Cmp der_deux (hole2.n_auto().dsdr()) ;
00093     
00094     double masse = hole1.mp.integrale_surface_infini(der_un) + 
00095     hole2.mp.integrale_surface_infini(der_deux) ;
00096     
00097     masse /= 4*M_PI ;
00098     return masse ;
00099 }
00100 
00101 double Bhole_binaire::moment_systeme_hor() const {
00102     
00103     if (omega == 0)
00104     return 0 ;
00105     else {
00106     // Alignes ou non ?
00107     double orientation_un = hole1.mp.get_rot_phi() ;
00108     assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00109     double orientation_deux = hole2.mp.get_rot_phi() ;
00110     assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00111     int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00112     
00113     // Integrale sur le premiere horizon :
00114     Cmp xa_un (hole1.mp) ;
00115     xa_un = hole1.mp.xa ;
00116     xa_un.std_base_scal() ;
00117     
00118     Cmp ya_un (hole1.mp) ;
00119     ya_un = hole1.mp.ya ;
00120     ya_un.std_base_scal() ;
00121     
00122     Tenseur vecteur_un (hole1.mp, 1, CON, hole1.mp.get_bvect_cart()) ;
00123     vecteur_un.set_etat_qcq() ;
00124     for (int i=0 ; i<3 ; i++)
00125         vecteur_un.set(i) = (-ya_un*hole1.tkij_tot(0, i)+
00126         xa_un * hole1.tkij_tot(1, i)) ;
00127     vecteur_un.set_std_base() ;
00128     vecteur_un.annule(hole1.mp.get_mg()->get_nzone()-1) ;
00129     vecteur_un.change_triad (hole1.mp.get_bvect_spher()) ;
00130     
00131     Cmp integrant_un (pow(hole1.psi_tot(), 6)*vecteur_un(0)) ;
00132     integrant_un.std_base_scal() ;
00133     double moment_un = hole1.mp.integrale_surface
00134         (integrant_un, hole1.rayon)/8/M_PI ;
00135     
00136     //Integrale sur le second horizon :
00137     Cmp xa_deux (hole2.mp) ;
00138     xa_deux = hole2.mp.xa ;
00139     xa_deux.std_base_scal() ;
00140     
00141     Cmp ya_deux (hole2.mp) ;
00142     ya_deux = hole2.mp.ya ;
00143     ya_deux.std_base_scal() ;
00144     
00145     Tenseur vecteur_deux (hole2.mp, 1, CON, hole2.mp.get_bvect_cart()) ;
00146     vecteur_deux.set_etat_qcq() ;
00147     for (int i=0 ; i<3 ; i++)
00148         vecteur_deux.set(i) = -ya_deux*hole2.tkij_tot(0, i)+
00149         xa_deux * hole2.tkij_tot(1, i) ;
00150     vecteur_deux.set_std_base() ;
00151     vecteur_deux.annule(hole2.mp.get_mg()->get_nzone()-1) ;
00152     vecteur_deux.change_triad (hole2.mp.get_bvect_spher()) ;
00153     
00154     Cmp integrant_deux (pow(hole2.psi_tot(), 6)*vecteur_deux(0)) ;
00155     integrant_deux.std_base_scal() ;
00156     double moment_deux = hole2.mp.integrale_surface
00157         (integrant_deux, hole2.rayon)/8/M_PI ;
00158     
00159     return moment_un+same_orient*moment_deux ;
00160     }
00161 }
00162 
00163 double Bhole_binaire::moment_systeme_inf() {
00164     
00165     if (omega == 0)
00166     return 0 ;
00167     else {
00168     // Alignes ou non ?
00169     double orientation_un = hole1.mp.get_rot_phi() ;
00170     assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00171     double orientation_deux = hole2.mp.get_rot_phi() ;
00172     assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00173     int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00174 
00175     // On construit une grille et un mapping auxiliaire :
00176     int nzones = hole1.mp.get_mg()->get_nzone() ;
00177     double* bornes = new double [nzones+1] ;
00178     double courant = (hole1.mp.get_ori_x()-hole2.mp.get_ori_x())+1 ;
00179     for (int i=nzones-1 ; i>0 ; i--) {
00180         bornes[i] = courant ;
00181         courant /= 2. ;
00182         }
00183     bornes[0] = 0 ;
00184     bornes[nzones] = __infinity ;
00185     
00186     Map_af mapping (*hole1.mp.get_mg(), bornes) ;
00187     
00188     delete [] bornes ; 
00189     
00190     // On construit k_total dessus :
00191     Tenseur_sym k_total (mapping, 2, CON, mapping.get_bvect_cart()) ;
00192     k_total.set_etat_qcq() ;
00193     
00194     Tenseur shift_un (mapping, 1, CON, mapping.get_bvect_cart()) ;
00195     shift_un.set_etat_qcq() ;
00196     
00197     Tenseur shift_deux (mapping, 1, CON, mapping.get_bvect_cart()) ;
00198     shift_deux.set_etat_qcq() ;
00199     
00200     shift_un.set(0).import_asymy(hole1.shift_auto(0)) ;
00201     shift_un.set(1).import_symy(hole1.shift_auto(1)) ;
00202     shift_un.set(2).import_asymy(hole1.shift_auto(2)) ;
00203     
00204     shift_deux.set(0).import_asymy(same_orient*hole2.shift_auto(0)) ;
00205     shift_deux.set(1).import_symy(same_orient*hole2.shift_auto(1)) ;
00206     shift_deux.set(2).import_asymy(hole2.shift_auto(2)) ;
00207     
00208     Tenseur shift_tot (shift_un+shift_deux) ;
00209     shift_tot.set_std_base() ;
00210     shift_tot.annule(0, nzones-2) ;
00211     // On enleve les residus
00212     shift_tot.inc2_dzpuis() ;
00213     shift_tot.dec2_dzpuis() ;
00214     
00215     Tenseur grad (shift_tot.gradient()) ;
00216     Tenseur trace (grad(0, 0)+grad(1, 1)+grad(2, 2)) ;
00217     for (int i=0 ; i<3 ; i++) {
00218         k_total.set(i, i) = grad(i, i)-trace()/3. ;
00219         for (int j=i+1 ; j<3 ; j++)
00220         k_total.set(i, j) = (grad(i, j)+grad(j, i))/2. ;
00221         }   
00222     
00223     for (int lig=0 ; lig<3 ; lig++)
00224        for (int col=lig ; col<3 ; col++)
00225         k_total.set(lig, col).mult_r_zec() ;
00226     
00227     Tenseur vecteur_un (mapping, 1, CON, mapping.get_bvect_cart()) ;
00228     vecteur_un.set_etat_qcq() ;
00229     for (int i=0 ; i<3 ; i++)
00230         vecteur_un.set(i) = k_total(0, i) ;
00231     vecteur_un.change_triad (mapping.get_bvect_spher()) ;
00232     Cmp integrant_un (vecteur_un(0)) ;
00233     
00234     Tenseur vecteur_deux (mapping, 1, CON, mapping.get_bvect_cart()) ;
00235     vecteur_deux.set_etat_qcq() ;
00236     for (int i=0 ; i<3 ; i++)
00237         vecteur_deux.set(i) = k_total(1, i) ;
00238     vecteur_deux.change_triad (mapping.get_bvect_spher()) ;
00239     Cmp integrant_deux (vecteur_deux(0)) ;
00240     
00241     // On multiplie par y et x :
00242     integrant_un.va = integrant_un.va.mult_st() ;
00243     integrant_un.va = integrant_un.va.mult_sp() ;
00244     
00245     integrant_deux.va = integrant_deux.va.mult_st() ;
00246     integrant_deux.va = integrant_deux.va.mult_cp() ;
00247     
00248     double moment = mapping.integrale_surface_infini (-integrant_un+integrant_deux) ;
00249     
00250     moment /= 8*M_PI ;
00251     return moment ;
00252     }
00253 }
00254 
00255 double Bhole_binaire::distance_propre(const int nr) const {
00256     
00257     // On determine les rayons coordonnes des points limites de l'integrale :
00258     double x_un = hole1.mp.get_ori_x() - hole1.rayon ;
00259     double x_deux = hole2.mp.get_ori_x() + hole2.rayon ;
00260     
00261     // Les coefficients du changement de variable :
00262     double pente = 2./(x_un-x_deux) ;
00263     double constante = - (x_un+x_deux)/(x_un-x_deux) ;
00264     
00265     
00266     double ksi ; // variable d'integration.
00267     double xabs ; // x reel.
00268     double air_un, theta_un, phi_un ; // coordonnee spheriques 1
00269     double air_deux, theta_deux, phi_deux ; // coordonnee spheriques 2
00270     
00271     double* coloc = new double[nr] ;
00272     double* coef = new double[nr] ;
00273     int* deg = new int[3] ;
00274     deg[0] = 1 ; deg[1] = 1 ; deg[2] = nr ;
00275     
00276     for (int i=0 ; i<nr ; i++) {
00277     ksi = -cos (M_PI*i/(nr-1)) ;
00278     xabs = (ksi-constante)/pente ;
00279     
00280     hole1.mp.convert_absolute (xabs, 0, 0, air_un, theta_un, phi_un) ;
00281     hole2.mp.convert_absolute (xabs, 0, 0, air_deux, theta_deux, phi_deux) ;
00282     
00283     coloc[i] = pow (hole1.psi_auto().val_point (air_un, theta_un, phi_un) +
00284            hole2.psi_auto().val_point (air_deux, theta_deux, phi_deux), 2.) ;
00285     }
00286     
00287     // On prend les coefficients de la fonction
00288     cfrcheb(deg, deg, coloc, deg, coef) ;
00289     
00290     // On integre
00291     double* som = new double[nr] ;
00292     som[0] = 2 ;
00293     for (int i=2 ; i<nr ; i+=2)
00294     som[i] = 1./(i+1)-1./(i-1) ;
00295     for (int i=1 ; i<nr ; i+=2)
00296     som[i] = 0 ;
00297     
00298     double res = 0 ;
00299     for (int i=0 ; i<nr ; i++)
00300     res += som[i]*coef[i] ;
00301     
00302     res /= pente ;
00303     
00304     delete [] deg ;
00305     delete [] coef ;
00306     delete [] coloc ;
00307     delete [] som ;
00308     
00309     return res ;
00310 }
00311 
00312 Tbl Bhole_binaire::linear_momentum_systeme_inf() const {
00313     
00314     Tbl res (3) ;
00315     res.set_etat_qcq() ;
00316     
00317     // Alignes ou non ?
00318     double orientation_un = hole1.mp.get_rot_phi() ;
00319     assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00320     double orientation_deux = hole2.mp.get_rot_phi() ;
00321     assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00322     int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00323 
00324     // On construit une grille et un mapping auxiliaire :
00325     int nzones = hole1.mp.get_mg()->get_nzone() ;
00326     double* bornes = new double [nzones+1] ;
00327     double courant = (hole1.mp.get_ori_x()-hole2.mp.get_ori_x())+1 ;
00328     for (int i=nzones-1 ; i>0 ; i--) {
00329         bornes[i] = courant ;
00330         courant /= 2. ;
00331         }
00332     bornes[0] = 0 ;
00333     bornes[nzones] = __infinity ;
00334     
00335     Map_af mapping (*hole1.mp.get_mg(), bornes) ;
00336     
00337     delete [] bornes ; 
00338     
00339     // On construit k_total dessus :
00340     Tenseur_sym k_total (mapping, 2, CON, mapping.get_bvect_cart()) ;
00341     k_total.set_etat_qcq() ;
00342     
00343     Tenseur shift_un (mapping, 1, CON, mapping.get_bvect_cart()) ;
00344     shift_un.set_etat_qcq() ;
00345     
00346     Tenseur shift_deux (mapping, 1, CON, mapping.get_bvect_cart()) ;
00347     shift_deux.set_etat_qcq() ;
00348     
00349     shift_un.set(0).import_asymy(hole1.shift_auto(0)) ;
00350     shift_un.set(1).import_symy(hole1.shift_auto(1)) ;
00351     shift_un.set(2).import_asymy(hole1.shift_auto(2)) ;
00352     
00353     shift_deux.set(0).import_asymy(same_orient*hole2.shift_auto(0)) ;
00354     shift_deux.set(1).import_symy(same_orient*hole2.shift_auto(1)) ;
00355     shift_deux.set(2).import_asymy(hole2.shift_auto(2)) ;
00356     
00357     Tenseur shift_tot (shift_un+shift_deux) ;
00358     shift_tot.set_std_base() ;
00359     shift_tot.annule(0, nzones-2) ;
00360     
00361     // On enleve les residus
00362     Tenseur shift_old (shift_tot) ;
00363     shift_tot.inc2_dzpuis() ;
00364     shift_tot.dec2_dzpuis() ;
00365     for (int i=0 ; i< 3 ; i++)
00366         cout << max(diffrelmax(shift_tot(i), shift_old(i))) << " " ;
00367     cout << endl ;
00368     
00369     Tenseur grad (shift_tot.gradient()) ;
00370     Tenseur trace (grad(0, 0)+grad(1, 1)+grad(2, 2)) ;
00371     for (int i=0 ; i<3 ; i++) {
00372         k_total.set(i, i) = grad(i, i)-trace()/3. ;
00373         for (int j=i+1 ; j<3 ; j++)
00374         k_total.set(i, j) = (grad(i, j)+grad(j, i))/2. ;
00375         }   
00376 
00377         
00378     for (int lig=0 ; lig<3 ; lig++)
00379        for (int col=lig ; col<3 ; col++)
00380         k_total.set(lig, col).mult_r_zec() ;
00381     
00382     for (int comp=0 ; comp<3 ; comp++) {
00383         Tenseur vecteur (mapping, 1, CON, mapping.get_bvect_cart()) ;
00384         vecteur.set_etat_qcq() ;
00385         for (int i=0 ; i<3 ; i++)
00386                 vecteur.set(i) = k_total(i, comp) ;
00387         vecteur.change_triad (mapping.get_bvect_spher()) ;
00388         Cmp integrant (vecteur(0)) ;
00389         
00390         res.set(comp) = mapping.integrale_surface_infini (integrant)/8/M_PI ;
00391     }
00392     return res ;
00393 }

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