binhor_global.C

00001 /*
00002  *   Copyright (c) 2005 Francois Limousin
00003  *                      Jose Luis Jaramillo
00004  *
00005  *   This file is part of LORENE.
00006  *
00007  *   LORENE is free software; you can redistribute it and/or modify
00008  *   it under the terms of the GNU General Public License as published by
00009  *   the Free Software Foundation; either version 2 of the License, or
00010  *   (at your option) any later version.
00011  *
00012  *   LORENE is distributed in the hope that it will be useful,
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *   GNU General Public License for more details.
00016  *
00017  *   You should have received a copy of the GNU General Public License
00018  *   along with LORENE; if not, write to the Free Software
00019  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 
00024 char binhor_glob_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_global.C,v 1.8 2007/04/13 15:28:55 f_limousin Exp $" ;
00025 
00026 /*
00027  * $Id: binhor_global.C,v 1.8 2007/04/13 15:28:55 f_limousin Exp $
00028  * $Log: binhor_global.C,v $
00029  * Revision 1.8  2007/04/13 15:28:55  f_limousin
00030  * Lots of improvements, generalisation to an arbitrary state of
00031  * rotation, implementation of the spatial metric given by Samaya.
00032  *
00033  * Revision 1.7  2006/05/24 16:56:37  f_limousin
00034  * Many small modifs.
00035  *
00036  * Revision 1.6  2005/09/24 08:31:38  f_limousin
00037  * Improve the computation of moment_adm() and moment_hor().
00038  *
00039  * Revision 1.5  2005/09/13 18:33:15  f_limousin
00040  * New function vv_bound_cart_bin(double) for computing binaries with
00041  * berlin condition for the shift vector.
00042  * Suppress all the symy and asymy in the importations.
00043  *
00044  * Revision 1.4  2005/06/09 16:12:04  f_limousin
00045  * Implementation of amg_mom_adm().
00046  *
00047  * Revision 1.3  2005/04/29 14:02:44  f_limousin
00048  * Important changes : manage the dependances between quantities (for
00049  * instance psi and psi4). New function write_global(ost).
00050  *
00051  * Revision 1.2  2005/03/04 17:09:57  jl_jaramillo
00052  * Change to avoid warnings
00053  *
00054  * Revision 1.1  2005/03/03 13:48:56  f_limousin
00055  * First version
00056  *
00057  *
00058  * $Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_global.C,v 1.8 2007/04/13 15:28:55 f_limousin Exp $
00059  *
00060  */
00061 
00062 
00063 
00064 //standard
00065 #include <stdlib.h>
00066 #include <math.h>
00067 
00068 // Lorene
00069 #include "nbr_spx.h"
00070 #include "tensor.h"
00071 #include "isol_hor.h"
00072 #include "proto.h"
00073 #include "utilitaires.h"
00074 //#include "graphique.h"
00075 
00076 double Bin_hor::adm_mass() const {
00077  
00078    Vector dpsi_un (hole1.psi_auto.derive_con(hole1.ff)) ;
00079     Vector dpsi_deux (hole2.psi_auto.derive_con(hole2.ff)) ;
00080     
00081     Tensor hdirac1 (contract((hole1.hh).derive_cov(hole1.ff),0,2)) ;
00082     Vector ww (0.125*(hdirac1 - (hole1.hh.trace(hole1.ff)).
00083               derive_con(hole1.ff))) ;
00084 
00085     double inf = hole1.mp.val_r(hole1.mp.get_mg()->get_nzone()-1, 1., 0., 0.) ;
00086     
00087     double masse = dpsi_un.flux(inf, hole1.ff) + 
00088                dpsi_deux.flux(inf, hole2.ff) +
00089                ww.flux(inf, hole1.ff) ;
00090     masse /= -2*M_PI ;
00091     return masse ;
00092 }
00093 
00094 double Bin_hor::komar_mass() const {
00095 
00096     Vector dnn_un (hole1.n_auto.derive_con(hole1.ff)) ;
00097     Vector dnn_deux (hole2.n_auto.derive_con(hole2.ff)) ;
00098     
00099     Vector ww (contract(hole1.hh, 1, hole1.nn.derive_cov(hole1.ff), 0)) ;
00100            
00101     double inf = hole1.mp.val_r(hole1.mp.get_mg()->get_nzone()-1, 1., 0., 0.) ;
00102 
00103     double mass = dnn_un.flux(inf, hole1.ff) + 
00104     dnn_deux.flux(inf, hole2.ff) + 
00105     ww.flux(inf, hole1.ff) ;
00106     
00107     mass /= 4*M_PI ;
00108     return mass ;
00109 }
00110     
00111 double Bin_hor::ang_mom_hor() const {
00112     
00113     if (omega == 0)
00114     return 0 ;
00115     else {
00116     // Alignement
00117     double orientation_un = hole1.mp.get_rot_phi() ;
00118     assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00119     double orientation_deux = hole2.mp.get_rot_phi() ;
00120     assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00121     int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00122     
00123     // Integral on the first horizon :
00124     Scalar xa_un (hole1.mp) ;
00125     xa_un = hole1.mp.xa ;
00126     xa_un.std_spectral_base() ;
00127     
00128     Scalar ya_un (hole1.mp) ;
00129     ya_un = hole1.mp.ya ;
00130     ya_un.std_spectral_base() ;
00131     
00132     Sym_tensor tkij_un (hole1.aa) ;
00133     tkij_un.change_triad(hole1.mp.get_bvect_cart()) ;
00134 
00135     Vector vecteur_un (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00136     for (int i=1 ; i<=3 ; i++)
00137         vecteur_un.set(i) = -ya_un*tkij_un(1, i)+
00138         xa_un * tkij_un(2, i) ;
00139     vecteur_un.annule_domain(hole1.mp.get_mg()->get_nzone()-1) ;
00140     vecteur_un.change_triad (hole1.mp.get_bvect_spher()) ;
00141     
00142     Scalar integrant_un (hole1.get_psi4()*hole1.psi*hole1.psi
00143                  *vecteur_un(1)) ;
00144     double moment_un = hole1.mp.integrale_surface
00145         (integrant_un, hole1.radius+1e-12)/8/M_PI ;
00146     
00147     //Integral on the second horizon :
00148     Scalar xa_deux (hole2.mp) ;
00149     xa_deux = hole2.mp.xa ;
00150     xa_deux.std_spectral_base() ;
00151     
00152     Scalar ya_deux (hole2.mp) ;
00153     ya_deux = hole2.mp.ya ;
00154     ya_deux.std_spectral_base() ;
00155     
00156     Sym_tensor tkij_deux (hole2.aa) ;
00157     tkij_deux.change_triad(hole2.mp.get_bvect_cart()) ;
00158 
00159     Vector vecteur_deux (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00160     for (int i=1 ; i<=3 ; i++)
00161         vecteur_deux.set(i) = -ya_deux*tkij_deux(1, i)+
00162         xa_deux * tkij_deux(2, i) ;
00163     vecteur_deux.annule_domain(hole2.mp.get_mg()->get_nzone()-1) ;
00164     vecteur_deux.change_triad (hole2.mp.get_bvect_spher()) ;
00165     
00166     Scalar integrant_deux (hole2.get_psi4()*hole2.psi*hole2.psi
00167                    *vecteur_deux(1)) ;
00168     double moment_deux = hole2.mp.integrale_surface
00169         (integrant_deux, hole2.radius+1e-12)/8/M_PI ;
00170     
00171     return moment_un+same_orient*moment_deux ;
00172     }
00173 }
00174 
00175 
00176 
00177 double Bin_hor::ang_mom_adm() const {
00178 /*    
00179     Scalar integrand_un (hole1.k_dd()(1,3) - hole1.gam_dd()(1,3) * hole1.trK) ;
00180     
00181     integrand_un.mult_rsint() ;  // in order to pass from the triad components
00182     
00183     double mom = hole1.mp.integrale_surface_infini(integrand_un) ;    
00184     mom /= 8*M_PI ;
00185     return mom ;
00186 */
00187 
00188     if (omega == 0)
00189     return 0 ;
00190     else {
00191     // Alignement 
00192     double orientation_un = hole1.mp.get_rot_phi() ;
00193     assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00194     double orientation_deux = hole2.mp.get_rot_phi() ;
00195     assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00196     int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00197     
00198     // Construction of an auxiliar grid and mapping
00199     int nzones = hole1.mp.get_mg()->get_nzone() ;
00200     double* bornes = new double [nzones+1] ;
00201     double courant = (hole1.mp.get_ori_x()-hole2.mp.get_ori_x())+1 ;
00202     for (int i=nzones-1 ; i>0 ; i--) {
00203     bornes[i] = courant ;
00204     courant /= 2. ;
00205     }
00206     bornes[0] = 0 ;
00207     bornes[nzones] = __infinity ;
00208     
00209     Map_af mapping (*hole1.mp.get_mg(), bornes) ;
00210     
00211     delete [] bornes ; 
00212     
00213     // Construction of k_total
00214     Sym_tensor k_total (mapping, CON, mapping.get_bvect_cart()) ;
00215     
00216     Vector shift_un (mapping, CON, mapping.get_bvect_cart()) ;
00217     Vector shift_deux (mapping, CON, mapping.get_bvect_cart()) ;
00218     
00219     Vector beta_un (hole1.beta_auto) ;
00220     Vector beta_deux (hole2.beta_auto) ;
00221     beta_un.change_triad(hole1.mp.get_bvect_cart()) ;
00222     beta_deux.change_triad(hole2.mp.get_bvect_cart()) ;
00223     
00224     shift_un.set(1).import(beta_un(1)) ;
00225     shift_un.set(2).import(beta_un(2)) ;
00226     shift_un.set(3).import(beta_un(3)) ;
00227     
00228     shift_deux.set(1).import(same_orient*beta_deux(1)) ;
00229     shift_deux.set(2).import(same_orient*beta_deux(2)) ;
00230     shift_deux.set(3).import(beta_deux(3)) ;
00231     
00232     Vector shift_tot (shift_un+shift_deux) ;
00233     shift_tot.std_spectral_base() ;
00234     shift_tot.annule(0, nzones-2) ;
00235 
00236     // Substract the residuals
00237     shift_tot.inc_dzpuis(2) ;
00238     shift_tot.dec_dzpuis(2) ;
00239     
00240     const Metric_flat& flat0 (mapping.flat_met_cart()) ;
00241 
00242     k_total = shift_tot.ope_killing_conf(flat0) / 2. ;
00243     //- flat0.con() * hole1.trK;
00244 
00245     for (int lig=1 ; lig<=3 ; lig++)
00246         for (int col=lig ; col<=3 ; col++)
00247         k_total.set(lig, col).mult_r_ced() ;
00248     
00249     Vector vecteur_un (mapping, CON, mapping.get_bvect_cart()) ;
00250     for (int i=1 ; i<=3 ; i++)
00251         vecteur_un.set(i) = k_total(1, i) ;
00252     vecteur_un.change_triad (mapping.get_bvect_spher()) ;
00253     Scalar integrant_un (vecteur_un(1)) ;
00254     
00255     Vector vecteur_deux (mapping, CON, mapping.get_bvect_cart()) ;
00256     for (int i=1 ; i<=3 ; i++)
00257         vecteur_deux.set(i) = k_total(2, i) ;
00258     vecteur_deux.change_triad (mapping.get_bvect_spher()) ;
00259     Scalar integrant_deux (vecteur_deux(1)) ;
00260     
00261     // Multiplication by y and x :
00262     integrant_un.set_spectral_va() = integrant_un.get_spectral_va()
00263         .mult_st() ;
00264     integrant_un.set_spectral_va() = integrant_un.get_spectral_va()
00265         .mult_sp() ;
00266     
00267     integrant_deux.set_spectral_va() = integrant_deux.get_spectral_va()
00268         .mult_st() ;
00269     integrant_deux.set_spectral_va() = integrant_deux.get_spectral_va()
00270         .mult_cp() ;
00271     
00272     double moment = mapping.integrale_surface_infini (-integrant_un
00273                               +integrant_deux) ;
00274     
00275     moment /= 8*M_PI ;
00276     
00277     return moment ;
00278     }
00279 }
00280 
00281 
00282 /*
00283 double Bin_hor::proper_distance(const int nr) const {
00284     
00285 
00286     // On determine les rayons coordonnes des points limites de l'integrale :
00287     double x_un = hole1.mp.get_ori_x() - hole1.rayon ;
00288     double x_deux = hole2.mp.get_ori_x() + hole2.rayon ;
00289     
00290     // Les coefficients du changement de variable :
00291     double pente = 2./(x_un-x_deux) ;
00292     double constante = - (x_un+x_deux)/(x_un-x_deux) ;
00293     
00294     
00295     double ksi ; // variable d'integration.
00296     double xabs ; // x reel.
00297     double air_un, theta_un, phi_un ; // coordonnee spheriques 1
00298     double air_deux, theta_deux, phi_deux ; // coordonnee spheriques 2
00299     
00300     double* coloc = new double[nr] ;
00301     double* coef = new double[nr] ;
00302     int* deg = new int[3] ;
00303     deg[0] = 1 ; deg[1] = 1 ; deg[2] = nr ;
00304     
00305     for (int i=0 ; i<nr ; i++) {
00306     ksi = -cos (M_PI*i/(nr-1)) ;
00307     xabs = (ksi-constante)/pente ;
00308     
00309     hole1.mp.convert_absolute (xabs, 0, 0, air_un, theta_un, phi_un) ;
00310     hole2.mp.convert_absolute (xabs, 0, 0, air_deux, theta_deux, phi_deux) ;
00311     
00312     coloc[i] = pow (hole1.psi_auto().val_point (air_un, theta_un, phi_un) +
00313            hole2.psi_auto().val_point (air_deux, theta_deux, phi_deux), 2.) ;
00314     }
00315     
00316     // On prend les coefficients de la fonction
00317     cfrcheb(deg, deg, coloc, deg, coef) ;
00318     
00319     // On integre
00320     double* som = new double[nr] ;
00321     som[0] = 2 ;
00322     for (int i=2 ; i<nr ; i+=2)
00323     som[i] = 1./(i+1)-1./(i-1) ;
00324     for (int i=1 ; i<nr ; i+=2)
00325     som[i] = 0 ;
00326     
00327     double res = 0 ;
00328     for (int i=0 ; i<nr ; i++)
00329     res += som[i]*coef[i] ;
00330     
00331     res /= pente ;
00332     
00333     delete [] deg ;
00334     delete [] coef ;
00335     delete [] coloc ;
00336     delete [] som ;
00337    
00338     return res ;
00339 
00340 }
00341 */

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