bhole_kij.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_kij_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_kij.C,v 1.4 2005/08/29 15:10:14 p_grandclement Exp $" ;
00024 
00025 /*
00026  * $Id: bhole_kij.C,v 1.4 2005/08/29 15:10:14 p_grandclement Exp $
00027  * $Log: bhole_kij.C,v $
00028  * Revision 1.4  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.3  2004/05/27 07:10:22  p_grandclement
00035  * Correction of some shadowed variables
00036  *
00037  * Revision 1.2  2002/10/16 14:36:33  j_novak
00038  * Reorganization of #include instructions of standard C++, in order to
00039  * use experimental version 3 of gcc.
00040  *
00041  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00042  * LORENE
00043  *
00044  * Revision 1.6  2001/05/07  09:12:02  phil
00045  * *** empty log message ***
00046  *
00047  * Revision 1.5  2001/04/30  09:22:52  phil
00048  * cas omega = 0
00049  *
00050  * Revision 1.4  2001/04/27  11:44:01  phil
00051  * correction devant assurer la symetrie entre les deux trous
00052  *
00053  * Revision 1.3  2001/04/26  12:04:44  phil
00054  * *** empty log message ***
00055  *
00056  * Revision 1.2  2001/04/25  15:54:30  phil
00057  * corrections diverses rien de bien mechant
00058  *
00059  * Revision 1.1  2001/04/25  15:10:23  phil
00060  * Initial revision
00061  *
00062  *
00063  * $Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_kij.C,v 1.4 2005/08/29 15:10:14 p_grandclement Exp $
00064  *
00065  */
00066 
00067 
00068 //standard
00069 #include <stdlib.h>
00070 #include <math.h>
00071 
00072 // Lorene
00073 #include "nbr_spx.h"
00074 #include "tenseur.h"
00075 #include "bhole.h"
00076 #include "proto.h"
00077 #include "utilitaires.h"
00078 #include "graphique.h"
00079 
00080 //calcul de kij total. (la regularisation ayant ete faite)
00081 void Bhole_binaire::fait_tkij () {
00082     
00083     hole1.tkij_tot.set_etat_qcq() ;
00084     hole2.tkij_tot.set_etat_qcq() ;
00085     
00086     // On construit a_ij a partir du shift ...
00087     // taij tot doit etre nul sur les deux horizons.
00088     hole1.fait_taij_auto () ;
00089     hole2.fait_taij_auto () ;
00090     
00091     // On trouve les trucs du compagnon
00092     hole1.taij_comp.set_etat_qcq() ;
00093     hole2.taij_comp.set_etat_qcq() ;
00094     
00095     Tenseur sans_dz_un (hole1.taij_auto) ;
00096     sans_dz_un.dec2_dzpuis() ;
00097     Tenseur sans_dz_deux (hole2.taij_auto) ;
00098     sans_dz_deux.dec2_dzpuis() ;
00099     
00100     // ON DOIT VERIFIER SI LES DEUX Aij sont alignes ou non !
00101     // Les bases des deux vecteurs doivent etre alignees ou non alignees :
00102     double orientation_un = hole1.taij_auto.get_mp()->get_rot_phi() ;
00103     assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00104     double orientation_deux = hole2.taij_auto.get_mp()->get_rot_phi() ;
00105     assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00106     int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00107     
00108     // Les importations :
00109     if (hole2.taij_auto.get_etat() == ETATZERO)
00110     hole1.taij_comp.set_etat_zero() ;
00111     else {
00112     hole1.taij_comp.set(0, 0).import_asymy(sans_dz_deux(0, 0)) ;
00113     hole1.taij_comp.set(0, 1).import_symy(sans_dz_deux(0, 1)) ;
00114     hole1.taij_comp.set(0, 2).import_asymy(same_orient*sans_dz_deux(0, 2)) ;
00115     hole1.taij_comp.set(1, 1).import_asymy(sans_dz_deux(1, 1)) ;
00116     hole1.taij_comp.set(1, 2).import_symy(same_orient*sans_dz_deux(1, 2)) ;
00117     hole1.taij_comp.set(2, 2).import_asymy(sans_dz_deux(2, 2)) ;
00118     }
00119     
00120      if (hole1.taij_auto.get_etat() == ETATZERO)
00121     hole2.taij_comp.set_etat_zero() ;
00122     else {
00123     hole2.taij_comp.set(0, 0).import_asymy(sans_dz_un(0, 0)) ;
00124     hole2.taij_comp.set(0, 1).import_symy(sans_dz_un(0, 1)) ;
00125     hole2.taij_comp.set(0, 2).import_asymy(same_orient*sans_dz_un(0, 2)) ;
00126     hole2.taij_comp.set(1, 1).import_asymy(sans_dz_un(1, 1)) ;
00127     hole2.taij_comp.set(1, 2).import_symy(same_orient*sans_dz_un(1, 2)) ;
00128     hole2.taij_comp.set(2, 2).import_asymy(sans_dz_un(2, 2)) ;
00129     }
00130     
00131     hole1.taij_comp.set_std_base() ;
00132     hole2.taij_comp.set_std_base() ;
00133     hole1.taij_comp.inc2_dzpuis() ;
00134     hole2.taij_comp.inc2_dzpuis() ;
00135     
00136     // Et enfin les trucs totaux...
00137     hole1.taij_tot = hole1.taij_auto + hole1.taij_comp ;
00138     hole2.taij_tot = hole2.taij_auto + hole2.taij_comp ;
00139     
00140     if ((hole1.taij_tot.get_etat() == ETATZERO) && 
00141     (hole2.taij_tot.get_etat() == ETATZERO)) {
00142         
00143         hole1.tkij_tot.set_etat_zero() ;
00144         hole1.tkij_auto.set_etat_zero() ;
00145         hole2.tkij_tot.set_etat_zero() ;
00146         hole2.tkij_auto.set_etat_zero() ;
00147     }
00148     else {
00149     int nz_un = hole1.mp.get_mg()->get_nzone() ;
00150     int nz_deux = hole2.mp.get_mg()->get_nzone() ;
00151     
00152     Cmp ntot_un (hole1.n_tot()) ;
00153     ntot_un = division_xpun (ntot_un, 0) ;
00154     ntot_un.raccord(1) ;
00155     
00156     Cmp ntot_deux (hole2.n_tot()) ;
00157     ntot_deux = division_xpun (ntot_deux, 0) ;
00158     ntot_deux.raccord(1) ;
00159     
00160     // Boucle sur les composantes :
00161     for (int lig = 0 ; lig<3 ; lig++)
00162     for (int col = lig ; col<3 ; col++) {
00163         
00164         // Le sens d orientation
00165         int ind = 1 ;
00166         if (lig !=2)
00167         ind *= -1 ;
00168         if (col != 2)
00169         ind *= -1 ;
00170         if (same_orient == 1)
00171         ind = 1 ;
00172         
00173         // Pres de H1 :
00174         Cmp auxi_un (hole1.taij_tot(lig, col)/2.) ;
00175         auxi_un.dec2_dzpuis() ;
00176         auxi_un = division_xpun (auxi_un, 0) ;
00177         auxi_un = auxi_un / ntot_un ;
00178         auxi_un.raccord(1) ;
00179         
00180         // Pres de H2 :
00181         Cmp auxi_deux (hole2.taij_tot(lig, col)/2.) ;
00182         auxi_deux.dec2_dzpuis() ;
00183         auxi_deux = division_xpun (auxi_deux, 0) ;
00184         auxi_deux = auxi_deux / ntot_deux ;
00185         auxi_deux.raccord(1) ;
00186         
00187         // copie :
00188         Cmp copie_un (hole1.taij_tot(lig, col)) ;
00189         copie_un.dec2_dzpuis() ;
00190         
00191         Cmp copie_deux (hole2.taij_tot(lig, col)) ;
00192         copie_deux.dec2_dzpuis() ;
00193         
00194         // Double les rayons limites :
00195         double lim_un = hole1.mp.get_alpha()[1] + hole1.mp.get_beta()[1] ;
00196         double lim_deux = hole2.mp.get_alpha()[1] + hole2.mp.get_beta()[1] ;
00197         
00198         Mtbl xabs_un (hole1.mp.xa) ;
00199         Mtbl yabs_un (hole1.mp.ya) ;
00200         Mtbl zabs_un (hole1.mp.za) ;
00201         
00202         Mtbl xabs_deux (hole2.mp.xa) ;
00203         Mtbl yabs_deux (hole2.mp.ya) ;
00204         Mtbl zabs_deux (hole2.mp.za) ;
00205         
00206         double xabs, yabs, zabs, air, theta, phi ;
00207         
00208         // On boucle sur les autres zones :
00209         for (int l=2 ; l<nz_un ; l++) {
00210         
00211         int nr = hole1.mp.get_mg()->get_nr (l) ;
00212         
00213         if (l==nz_un-1)
00214             nr -- ;
00215         
00216         int np = hole1.mp.get_mg()->get_np (l) ;
00217         int nt = hole1.mp.get_mg()->get_nt (l) ;
00218         
00219         for (int k=0 ; k<np ; k++)
00220             for (int j=0 ; j<nt ; j++)
00221             for (int i=0 ; i<nr ; i++) {
00222                 
00223                 xabs = xabs_un (l, k, j, i) ;
00224                 yabs = yabs_un (l, k, j, i) ;
00225                 zabs = zabs_un (l, k, j, i) ;
00226                 
00227                 // les coordonnees du point en 2 :
00228                 hole2.mp.convert_absolute 
00229                 (xabs, yabs, zabs, air, theta, phi) ;
00230             
00231                 if (air >= lim_deux)
00232                 // On est loin du trou 2 : pas de pb :
00233                 auxi_un.set(l, k, j, i) = 
00234         copie_un(l, k, j, i) / ntot_un (l, k, j, i)/2. ;
00235                 else 
00236                 // On est pres du trou deux :
00237                 auxi_un.set(l, k, j, i) = 
00238         ind * auxi_deux.val_point (air, theta, phi) ;
00239                 }
00240                 
00241         // Cas infini :
00242         if (l==nz_un-1)
00243             for (int k=0 ; k<np ; k++)
00244             for (int j=0 ; j<nt ; j++)
00245                 auxi_un.set(nz_un-1, k, j, nr-1) = 0 ;
00246         }
00247         
00248         // Le second trou :
00249         for (int l=2 ; l<nz_deux ; l++) {
00250         
00251         int nr = hole2.mp.get_mg()->get_nr (l) ;
00252         
00253         if (l==nz_deux-1)
00254             nr -- ;
00255         
00256         int np = hole2.mp.get_mg()->get_np (l) ;
00257         int nt = hole2.mp.get_mg()->get_nt (l) ;
00258         
00259         for (int k=0 ; k<np ; k++)
00260             for (int j=0 ; j<nt ; j++)
00261             for (int i=0 ; i<nr ; i++) {
00262                 
00263                 xabs = xabs_deux (l, k, j, i) ;
00264                 yabs = yabs_deux (l, k, j, i) ;
00265                 zabs = zabs_deux (l, k, j, i) ;
00266                 
00267                 // les coordonnees du point en 1 :
00268                 hole1.mp.convert_absolute 
00269                 (xabs, yabs, zabs, air, theta, phi) ;
00270             
00271                 if (air >= lim_un)
00272                 // On est loin du trou 1 : pas de pb :
00273                 auxi_deux.set(l, k, j, i) = 
00274         copie_deux(l, k, j, i) / ntot_deux (l, k, j, i) /2.;
00275                 else 
00276                 // On est pres du trou deux :
00277                 auxi_deux.set(l, k, j, i) = 
00278         ind * auxi_un.val_point (air, theta, phi) ;
00279                 }
00280         // Cas infini :
00281         if (l==nz_deux-1)
00282             for (int k=0 ; k<np ; k++)
00283             for (int j=0 ; j<nt ; j++)
00284                 auxi_deux.set(nz_deux-1, k, j, nr-1) = 0 ;
00285         }
00286         
00287         auxi_un.inc2_dzpuis() ;
00288         auxi_deux.inc2_dzpuis() ;
00289         
00290         hole1.tkij_tot.set(lig, col) = auxi_un ;
00291         hole2.tkij_tot.set(lig, col) = auxi_deux ;
00292     }
00293     
00294     hole1.tkij_auto.set_etat_qcq() ;
00295     hole2.tkij_auto.set_etat_qcq() ;
00296     
00297     for (int lig=0 ; lig<3 ; lig++)
00298     for (int col=lig ; col<3 ; col++) {
00299         hole1.tkij_auto.set(lig, col) = hole1.tkij_tot(lig, col)*
00300         hole1.decouple ;
00301         hole2.tkij_auto.set(lig, col) = hole2.tkij_tot(lig, col)*
00302         hole2.decouple ;
00303     }
00304     }
00305 }
00306 
00307 void Bhole_binaire::fait_decouple () {
00308     
00309     int nz_un = hole1.mp.get_mg()->get_nzone() ;
00310     int nz_deux = hole2.mp.get_mg()->get_nzone() ;
00311     
00312     // On determine R_limite (pour le moment en tout cas...) :
00313     double distance = hole1.mp.get_ori_x() - hole2.mp.get_ori_x() ;
00314     double lim_un = distance/2. ;
00315     double lim_deux = distance/2. ;
00316     double int_un = distance/6. ;
00317     double int_deux = distance/6. ;
00318     
00319     // Les fonctions de base
00320     Cmp fonction_f_un (hole1.mp) ;
00321     fonction_f_un = 0.5*pow(
00322     cos((hole1.mp.r-int_un)*M_PI/2./(lim_un-int_un)), 2.)+0.5 ;
00323     fonction_f_un.std_base_scal();
00324     
00325     Cmp fonction_g_un (hole1.mp) ;
00326     fonction_g_un = 0.5*pow
00327     (sin((hole1.mp.r-int_un)*M_PI/2./(lim_un-int_un)), 2.) ;
00328     fonction_g_un.std_base_scal();
00329     
00330     Cmp fonction_f_deux (hole2.mp) ;
00331     fonction_f_deux = 0.5*pow(
00332     cos((hole2.mp.r-int_deux)*M_PI/2./(lim_deux-int_deux)), 2.)+0.5 ;
00333     fonction_f_deux.std_base_scal();
00334     
00335     Cmp fonction_g_deux (hole2.mp) ;
00336     fonction_g_deux = 0.5*pow(
00337     sin((hole2.mp.r-int_deux)*M_PI/2./(lim_un-int_deux)), 2.) ;
00338     fonction_g_deux.std_base_scal();
00339         
00340     // Les fonctions totales :
00341     Cmp decouple_un (hole1.mp) ;
00342     decouple_un.allocate_all() ;
00343     Cmp decouple_deux (hole2.mp) ;
00344     decouple_deux.allocate_all() ;
00345     
00346     Mtbl xabs_un (hole1.mp.xa) ;
00347     Mtbl yabs_un (hole1.mp.ya) ;
00348     Mtbl zabs_un (hole1.mp.za) ;
00349         
00350     Mtbl xabs_deux (hole2.mp.xa) ;
00351     Mtbl yabs_deux (hole2.mp.ya) ;
00352     Mtbl zabs_deux (hole2.mp.za) ;
00353         
00354     double xabs, yabs, zabs, air_un, air_deux, theta, phi ;
00355         
00356     // On boucle sur les autres zones :
00357     for (int l=0 ; l<nz_un ; l++) {
00358     int nr = hole1.mp.get_mg()->get_nr (l) ;
00359         
00360     if (l==nz_un-1)
00361         nr -- ;
00362         
00363     int np = hole1.mp.get_mg()->get_np (l) ;
00364     int nt = hole1.mp.get_mg()->get_nt (l) ;
00365         
00366     for (int k=0 ; k<np ; k++)
00367         for (int j=0 ; j<nt ; j++)
00368         for (int i=0 ; i<nr ; i++) {
00369                 
00370             xabs = xabs_un (l, k, j, i) ;
00371             yabs = yabs_un (l, k, j, i) ;
00372             zabs = zabs_un (l, k, j, i) ;
00373                 
00374             // les coordonnees du point :
00375             hole1.mp.convert_absolute 
00376             (xabs, yabs, zabs, air_un, theta, phi) ;
00377             hole2.mp.convert_absolute 
00378             (xabs, yabs, zabs, air_deux, theta, phi) ;
00379         
00380             if (air_un <= lim_un)
00381             if (air_un < int_un)
00382                 decouple_un.set(l, k, j, i) = 1 ;
00383             else
00384             // pres du trou un :
00385             decouple_un.set(l, k, j, i) = 
00386                 fonction_f_un (l, k, j, i) ;
00387             else 
00388             if (air_deux <= lim_deux)
00389                 if (air_deux < int_deux)
00390                 decouple_un.set(l, k, j, i) = 0 ;
00391                 else
00392             // On est pres du trou deux :
00393                 decouple_un.set(l, k, j, i) = 
00394         fonction_g_deux.val_point (air_deux, theta, phi) ;
00395         
00396             else
00397                 // On est loin des deux trous :
00398                 decouple_un.set(l, k, j, i) = 0.5 ;
00399         }
00400                 
00401         // Cas infini :
00402         if (l==nz_un-1)
00403             for (int k=0 ; k<np ; k++)
00404             for (int j=0 ; j<nt ; j++)
00405                 decouple_un.set(nz_un-1, k, j, nr) = 0.5 ;
00406         }
00407    
00408     for (int l=0 ; l<nz_deux ; l++) {
00409     
00410     int nr = hole2.mp.get_mg()->get_nr (l) ;
00411         
00412     if (l==nz_deux-1)
00413         nr -- ;
00414         
00415     int np = hole2.mp.get_mg()->get_np (l) ;
00416     int nt = hole2.mp.get_mg()->get_nt (l) ;
00417         
00418     for (int k=0 ; k<np ; k++)
00419         for (int j=0 ; j<nt ; j++)
00420         for (int i=0 ; i<nr ; i++) {
00421         
00422             xabs = xabs_deux (l, k, j, i) ;
00423             yabs = yabs_deux (l, k, j, i) ;
00424             zabs = zabs_deux (l, k, j, i) ;
00425                 
00426             // les coordonnees du point  :
00427             hole1.mp.convert_absolute 
00428             (xabs, yabs, zabs, air_un, theta, phi) ;
00429             hole2.mp.convert_absolute 
00430             (xabs, yabs, zabs, air_deux, theta, phi) ;
00431             
00432             if (air_deux <= lim_deux)
00433             if (air_deux < int_deux)
00434                 decouple_deux.set(l, k, j, i) = 1 ;
00435             else
00436             // pres du trou deux :
00437             decouple_deux.set(l, k, j, i) = 
00438                 fonction_f_deux (l, k, j, i) ;
00439             else 
00440             if (air_un <= lim_un)
00441                 if (air_un < int_un)
00442                 decouple_deux.set(l, k, j, i) = 0 ;
00443                 else
00444             // On est pres du trou un :
00445                 decouple_deux.set(l, k, j, i) = 
00446         fonction_g_un.val_point (air_un, theta, phi) ;
00447         
00448             else
00449                 // On est loin des deux trous :
00450                 decouple_deux.set(l, k, j, i) = 0.5 ;
00451         }
00452                 
00453         // Cas infini :
00454         if (l==nz_deux-1)
00455             for (int k=0 ; k<np ; k++)
00456             for (int j=0 ; j<nt ; j++)
00457                 decouple_deux.set(nz_deux-1, k, j, nr) = 0.5 ;
00458    }
00459     
00460    hole1.decouple = decouple_un ;
00461    hole2.decouple = decouple_deux ;
00462 }

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