binhor_hh.C

00001 /*
00002  *   Copyright (c) 2004-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_hh_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_hh.C,v 1.3 2008/01/09 14:28:58 jl_jaramillo Exp $" ;
00025 
00026 /*
00027  * $Id: binhor_hh.C,v 1.3 2008/01/09 14:28:58 jl_jaramillo Exp $
00028  * $Log: binhor_hh.C,v $
00029  * Revision 1.3  2008/01/09 14:28:58  jl_jaramillo
00030  * Improved the construction of hh1 and hh2
00031  *
00032  * Revision 1.2  2007/08/22 16:10:35  f_limousin
00033  * Correction of many errors in binhor_hh.C
00034  *
00035  * Revision 1.1  2007/04/18 14:27:19  f_limousin
00036  * First version
00037  *
00038  *
00039  *
00040  * $Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_hh.C,v 1.3 2008/01/09 14:28:58 jl_jaramillo Exp $
00041  *
00042  */
00043 
00044 //standard
00045 #include <stdlib.h>
00046 
00047 // Lorene
00048 #include "tensor.h"
00049 #include "cmp.h"
00050 #include "isol_hor.h"
00051 #include "graphique.h"
00052 #include "utilitaires.h"
00053 
00054 
00055 
00056 Sym_tensor Bin_hor::hh_Samaya_hole1 () {
00057 
00058   //========
00059   //  Grid 1
00060   //========
00061   int nz1 = hole1.mp.get_mg()->get_nzone() ;
00062   int nz2 = hole2.mp.get_mg()->get_nzone() ;
00063   
00064   // General coordinate values
00065   const Coord& xx_1 = hole1.mp.x ; 
00066   const Coord& yy_1 = hole1.mp.y ;   
00067   const Coord& zz_1 = hole1.mp.z ; 
00068 
00069   //========
00070   //  Grid 2
00071   //========
00072   
00073   // General coordinate values
00074   const Coord& xx_2 = hole2.mp.x ; 
00075   const Coord& yy_2 = hole2.mp.y ;   
00076   const Coord& zz_2 = hole2.mp.z ; 
00077 
00078   //===================================
00079   // Definition of the relevant vectors
00080   //===================================
00081 
00082   // Coordinate vector from hole 1 in the grid 1: nn1
00083   //--------------------------------------------------
00084   Vector rr1 (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00085   rr1.set(1) = xx_1 ;
00086   rr1.set(2) = yy_1 ;
00087   rr1.set(3) = zz_1 ;
00088   rr1.std_spectral_base() ;  
00089 
00090   // Norm r1
00091   Scalar r1 (hole1.mp) ;
00092   r1 = hole1.mp.r ;
00093   r1.std_spectral_base() ;
00094   Scalar temp1 (r1) ;
00095   temp1.raccord(1) ;
00096   r1.set_domain(0) = temp1.domain(0) ;
00097 
00098   // Unitary vector
00099   Vector nn1 (rr1);
00100   nn1 = nn1/r1 ;
00101   
00102   for (int i=0; i<hole1.mp.get_mg()->get_nr(nz1-1); i++)
00103     for (int j=0; j<hole1.mp.get_mg()->get_nt(nz1-1); j++)
00104       for (int k=0; k<hole1.mp.get_mg()->get_np(nz1-1); k++)
00105     for (int ind=1; ind<=3; ind++){
00106       nn1.set(ind).set_grid_point(nz1-1,k,j,i) = nn1(ind).val_grid_point(1,k,j,0) ;
00107       }
00108     
00109   
00110   //cout << "nn1(1)" << endl << nn1(1) << endl ;
00111   //des_profile(nn1(1), 0., 20., M_PI/2, 0.);
00112   //des_profile(nn1(2), 0., 20., M_PI/2, M_PI/2);
00113   //des_profile(nn1(3), 0., 20., 0., 0.);
00114   //cout << "nn1(1)" << endl << nn1(1) << endl ;
00115   //cout << "nn1(2)" << endl << nn1(2) << endl ;
00116   //cout << "nn1(3)" << endl << nn1(3) << endl ;
00117   //cout << "r1" << endl << r1 << endl ;
00118       
00119 
00120   // Coordinate vector from hole 2 in the grid 2: nn2_2
00121   //-----------------------------------------------------
00122   Vector rr2_2 (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00123   rr2_2.set(1) = xx_2 ;
00124   rr2_2.set(2) = yy_2 ;
00125   rr2_2.set(3) = zz_2 ;
00126   rr2_2.std_spectral_base() ;  
00127 
00128   // Norm r2_g2 
00129   Scalar r2_2 (hole2.mp) ;
00130   r2_2 = hole2.mp.r ;
00131   r2_2.std_spectral_base() ;
00132   Scalar temp2 (r2_2) ;
00133   temp2.raccord(1) ;
00134   r2_2.set_domain(0) = temp2.domain(0) ;
00135    
00136   // Unitary vector
00137   Vector nn2_2 (rr2_2);
00138   nn2_2 = nn2_2/r2_2 ;
00139   
00140   for (int i=0; i<hole2.mp.get_mg()->get_nr(nz2-1); i++)
00141     for (int j=0; j<hole2.mp.get_mg()->get_nt(nz2-1); j++)
00142       for (int k=0; k<hole2.mp.get_mg()->get_np(nz2-1); k++)
00143       for (int ind=1; ind<=3; ind++){
00144         nn2_2.set(ind).set_grid_point(nz2-1,k,j,i) = nn2_2(ind).val_grid_point(1,k,j,0) ;
00145       }
00146 
00147   Scalar unsr1 (hole1.mp) ;
00148   unsr1 = 1./hole1.mp.r ;
00149   unsr1.std_spectral_base() ;
00150   unsr1.raccord(1) ;
00151  
00152   /*
00153   Scalar unsr1_2 (hole2.mp) ;
00154   unsr1_2.set_etat_qcq() ;
00155   unsr1_2.import(unsr1) ;
00156   unsr1_2.set_spectral_va().set_base(unsr1.get_spectral_va().get_base()) ;
00157   
00158   Scalar r2sr1_2 (hole2.mp) ;
00159   r2sr1_2 = r2_2*unsr1_2 ;
00160   r2sr1_2.set_outer_boundary(nz2-1, 1.) ;
00161 
00162   des_meridian(r2sr1_2, 0., 20., "r2sr1_2", 10) ;
00163   arrete() ;
00164   des_profile(r2sr1_2, 0., 20., M_PI/2, M_PI) ;
00165   des_profile(r2sr1_2, 0., 20., M_PI/2, 0) ;
00166 
00167   Scalar r2sr1 (hole1.mp) ;
00168   r2sr1.set_etat_qcq() ;
00169   r2sr1.import(r2sr1_2) ;
00170   r2sr1.set_spectral_va().set_base(r2sr1_2.get_spectral_va().get_base()) ;
00171   
00172   des_meridian(r2sr1, 0., 20., "r2sr1", 11) ;
00173   arrete() ;
00174   des_profile(r2sr1, 0., 20., M_PI/2, M_PI) ;
00175   des_profile(r2sr1, 0., 20., M_PI/2, 0) ;
00176 
00177   */
00178   
00179 
00180   // Coordinate vector from hole 2 in the grid 1: nn2
00181   //-----------------------------------------------------
00182   Vector nn2 (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00183   nn2_2.change_triad(hole1.mp.get_bvect_cart()) ;
00184   nn2.set_etat_qcq() ;
00185   for (int i=1 ; i<=3 ; i++){ 
00186     nn2.set(i).import(nn2_2(i)) ;
00187     nn2.set(i).set_spectral_va().set_base(nn2_2(i).get_spectral_va().get_base()) ;
00188   }  
00189   
00190   // r2/r1
00191   // -----
00192   Scalar unsr2_2 (hole2.mp) ;
00193   unsr2_2 = 1./hole2.mp.r ;
00194   unsr2_2.std_spectral_base() ;
00195   unsr2_2.raccord(1) ;
00196 
00197   Scalar unsr2 (hole1.mp) ;
00198   unsr2.set_etat_qcq() ;
00199   unsr2.import(unsr2_2) ;
00200   unsr2.set_spectral_va().set_base(unsr2_2.get_spectral_va().get_base()) ;
00201 
00202   Scalar r1sr2 (unsr2*r1) ;
00203   r1sr2.set_outer_boundary(nz1-1, 1.) ;
00204   
00205   Scalar r2sr1 (1./unsr2*unsr1) ;
00206   r2sr1.set_outer_boundary(nz1-1, 1.) ;
00207   /*
00208   des_meridian(r2sr1, 0., 20., "r2sr1", 14) ;
00209   arrete() ;
00210   des_profile(r2sr1, 0., 20., M_PI/2, M_PI) ;
00211   des_profile(r2sr1, 0., 20., M_PI/2, 0) ;
00212   
00213   des_meridian(1./r2sr1, 0., 20., "1./r2sr1", 12) ;
00214   arrete() ;
00215   des_profile(1./r2sr1, 0., 20., M_PI/2, M_PI) ;
00216   des_profile(1./r2sr1, 0., 20., M_PI/2, 0) ;
00217 
00218   des_meridian(1./r1, 0., 20., "1./r1", 13) ;
00219   arrete() ;
00220   des_profile(1./r1, 0., 20., M_PI/2, M_PI) ;
00221   des_profile(1./r1, 0., 20., M_PI/2, 0) ;
00222 
00223   des_meridian(1./(r1*r2sr1), 0., 20., "1./r1*r2sr1", 14) ;
00224   arrete() ;
00225   des_profile(1./(r1*r2sr1), 0., 20., M_PI/2, M_PI) ;
00226   des_profile(1./(r1*r2sr1), 0., 20., M_PI/2, 0) ;
00227   */
00228     
00229   // Coordinate vector from hole 1 to hole 2 in the grid 1: nn12
00230   //----------------------------------------------------------------
00231   // Warning! Valid only in the symmetric case (for the general case it would
00232   // necessary to construct this whole function as a Bin_hor function 
00233   Vector rr12 (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00234   rr12.set(1) = hole1.mp.get_ori_x() - hole2.mp.get_ori_x() ;
00235   rr12.set(2) = hole1.mp.get_ori_y() - hole2.mp.get_ori_y() ;
00236   rr12.set(3) = hole1.mp.get_ori_z() - hole2.mp.get_ori_z() ;
00237   rr12.std_spectral_base() ;  
00238 
00239   //Norm r12
00240   Scalar r12 (hole1.mp) ;
00241   r12 = sqrt( rr12(1)*rr12(1) + rr12(2)*rr12(2) + rr12(3)*rr12(3)) ;
00242   r12.std_spectral_base() ;
00243 
00244   // Unitary vector
00245   Vector nn12 ( rr12 );
00246   nn12 = nn12/ r12 ;
00247 
00248 
00249   Scalar f_delta (hole1.mp) ;
00250   Scalar f_delta_zec (hole1.mp) ;
00251   Scalar f_1_1 (hole1.mp) ;
00252   Scalar f_1_1_zec (hole1.mp) ;
00253   Scalar f_1_12 (hole1.mp) ;
00254   Scalar f_1_12_zec (hole1.mp) ;
00255   Scalar f_12_12 (hole1.mp) ;
00256   Scalar f_1_2 (hole1.mp) ;
00257 
00258   f_delta.set_etat_qcq() ;
00259   f_delta_zec.set_etat_qcq() ;
00260   f_1_1.set_etat_qcq() ;
00261   f_1_1_zec.set_etat_qcq() ;
00262   f_1_12.set_etat_qcq() ;
00263   f_1_12_zec.set_etat_qcq() ;
00264   f_12_12.set_etat_qcq() ;
00265   f_1_2.set_etat_qcq() ;  
00266  
00267   // Function exp(-(r-r_0)^2/sigma^2)
00268   // --------------------------------
00269   
00270   double r0 = hole1.mp.val_r(nz1-2, 1, 0, 0) ;
00271   double sigma = 1.*r0 ;
00272   
00273   Scalar rr (hole1.mp) ;
00274   rr = hole1.mp.r ;
00275 
00276   Scalar fexp (hole1.mp) ;
00277   fexp = exp( -(rr - r0)*(rr - r0)/sigma/sigma ) ;
00278   for (int ii=0; ii<nz1-1; ii++)
00279     fexp.set_domain(ii) = 1. ;
00280   fexp.set_outer_boundary(nz1-1, 0) ;
00281   fexp.std_spectral_base() ;
00282  
00283   // Conformal metric
00284   //=================
00285 
00286   // tilde{gamma}- \delta = m_1*m_2* ( f_delta \delta_{ij} 
00287   //                        + f_1_1 nn1*nn1 + f_1_12 nn1*nn12
00288   //                        + f_12_12 nn12*nn12
00289   //                        + f_2_2 nn2*nn2 + f_2_12 nn2*nn12
00290   //                        + f_1_2 nn1*nn2
00291  
00292   // f_delta
00293   //--------
00294   f_delta = -5.*r1/(8.*r12*r12*r12) - 15./(8.*r1*r12) + 
00295     5.*r1*r1*unsr2/(8.*r12*r12*r12) + 1./(r1+1./unsr2+r12)/(r1+1./unsr2+r12)* 
00296     (1 + r1/r12 + r12/r1 - r1sr2 - r1*r1sr2/r12 + r12*r12*unsr2/(2*r1)) +
00297     1./(r1+1./unsr2+r12)*(-7./r1 + 2./r12) ;  
00298 
00299   f_delta.annule_domain(nz1-1) ;
00300   
00301   f_delta_zec = - 15./(8.*r1*r12) + 1./(r1+1./unsr2+r12)/(r1+1./unsr2+r12)* 
00302     (1 + r1/r12 + r12/r1 - r1sr2 - r1*r1sr2/r12 + r12*r12*unsr2/(2*r1)) +
00303     1./(r1+1./unsr2+r12)*(-7./r1 + 2./r12) ;
00304   f_delta_zec += fexp*(-5.*r1/(8.*r12*r12*r12)+5.*r1*r1*unsr2/(8.*r12*r12*r12)) ;
00305 
00306   f_delta_zec.set_outer_boundary(nz1-1, 0.) ;
00307   for (int i=0 ;i<nz1-1 ; i++){
00308     f_delta_zec.annule_domain(i) ;
00309   }
00310   
00311   f_delta = f_delta + f_delta_zec ;
00312   
00313   /*
00314   des_meridian(f_delta, 0., 20., "f_delta", 10) ;
00315   arrete() ;
00316   des_profile(f_delta, 0., 20., M_PI/2, M_PI) ;
00317   des_profile(f_delta, 0., 20., M_PI/2, 0) ;
00318   des_profile(f_delta, 0., 20., 0, M_PI) ;
00319   des_coupe_z (f_delta, 0., 2) ;
00320   des_coupe_z (f_delta, 0., 3) ;
00321   des_coupe_z (f_delta, 0., 4) ;
00322   des_coupe_z (f_delta, 0., 5) ;
00323   */
00324 
00325   // f_1_1
00326   //------
00327   f_1_1 = r1/(8.*r12*r12*r12) + 11./(8.*r1*r12) -
00328     1./(8.*r1*unsr2*unsr2*r12*r12*r12) + 7./(r1+1./unsr2+r12)/(r1+1./unsr2+r12) +
00329     7./r1/(r1+1./unsr2+r12) ;
00330   f_1_1.annule_domain(nz1-1) ;
00331   
00332   f_1_1_zec = 11./(8.*r1*r12) + 7./(r1+1./unsr2+r12)/(r1+1./unsr2+r12) +
00333     7./r1/(r1+1./unsr2+r12) ;
00334   f_1_1_zec += fexp*(r1/(8.*r12*r12*r12)-1./(8.*r1*unsr2*unsr2*r12*r12*r12)) ;
00335   f_1_1_zec.set_outer_boundary(nz1-1, 0.) ;
00336 
00337   for (int i=0 ; i<nz1-1 ; i++){
00338     f_1_1_zec.annule_domain(i) ;
00339   }
00340   
00341   f_1_1 = f_1_1 + f_1_1_zec ;
00342 
00343   /*
00344   des_meridian(f_1_1, 0., 20., "f_1_1", 14) ;
00345   arrete() ;
00346   des_profile(f_1_1, 0., 20., M_PI/2, M_PI) ;
00347   des_profile(f_1_1, 0., 20., M_PI/2, 0) ;
00348   des_profile(f_1_1, 0., 20., 0, M_PI) ;
00349   des_coupe_z (f_1_1, 0., 2) ;
00350   des_coupe_z (f_1_1, 0., 3) ;
00351   des_coupe_z (f_1_1, 0., 4) ;
00352   des_coupe_z (f_1_1, 0., 5) ;
00353   */
00354 
00355   // f_1_12
00356   //------
00357   f_1_12 = - 7./(2*r12*r12) + 8./(r1+1./unsr2+r12)/(r1+1./unsr2+r12) ;
00358   f_1_12.annule_domain(nz1-1) ;
00359   
00360   f_1_12_zec = 8./(r1+1./unsr2+r12)/(r1+1./unsr2+r12) ;
00361   f_1_12_zec += fexp*(- 7./(2*r12*r12)) ;
00362   f_1_12_zec.set_outer_boundary(nz1-1, 0.) ;
00363 
00364   for (int i=0 ; i<nz1-1 ; i++){
00365     f_1_12_zec.annule_domain(i) ;
00366   }
00367    
00368   f_1_12 = f_1_12 + f_1_12_zec ;
00369   
00370   /*
00371   des_meridian(f_1_12, 0., 40., "f_1_12", 15) ;
00372   arrete() ;
00373   des_profile(f_1_12, 0., 20., M_PI/2, M_PI) ;
00374   des_profile(f_1_12, 0., 20., M_PI/2, 0) ;
00375   des_profile(f_1_12, 0., 20., 0, M_PI) ;
00376   des_coupe_z (f_1_12, 0., 2) ;
00377   des_coupe_z (f_1_12, 0., 3) ;
00378   des_coupe_z (f_1_12, 0., 4) ;
00379   des_coupe_z (f_1_12, 0., 5) ;
00380   */
00381  
00382   // f_12_12
00383   //-------
00384   f_12_12 = (-4./(r1+1./unsr2+r12)/(r1+1./unsr2+r12) -  // facteur 2  ???????
00385         4./r12/(r1+1./unsr2+r12)) ;
00386   f_12_12.set_outer_boundary(nz1-1, 0.) ;
00387 
00388   /*
00389   des_meridian(f_12_12, 0., 40., "f_12_12", 15) ;
00390   arrete() ;
00391   des_profile(f_12_12, 0., 20., M_PI/2, M_PI) ;
00392   des_profile(f_12_12, 0., 20., M_PI/2, 0) ;
00393   des_profile(f_12_12, 0., 20., 0, M_PI) ;
00394   des_coupe_z (f_12_12, 0., 2) ;
00395   des_coupe_z (f_12_12, 0., 3) ;
00396   des_coupe_z (f_12_12, 0., 4) ;
00397   des_coupe_z (f_12_12, 0., 5) ;
00398   */
00399 
00400   // f_1_2
00401   //-------
00402   f_1_2 = 11./(r1+1./unsr2+r12)/(r1+1./unsr2+r12);        // facteur 2  ???????
00403   f_1_2.set_outer_boundary(nz1-1, 0.) ;
00404 
00405   /*
00406   des_meridian(f_1_2, 0., 40., "f_1_1", 15) ;
00407   arrete() ;
00408   des_profile(f_1_2, 0., 20., M_PI/2, M_PI) ;
00409   des_profile(f_1_2, 0., 20., M_PI/2, 0) ;
00410   des_profile(f_1_2, 0., 20., 0, M_PI) ;
00411   des_coupe_z (f_1_2, 0., 2) ;
00412   des_coupe_z (f_1_2, 0., 3) ;
00413   des_coupe_z (f_1_2, 0., 4) ;
00414   des_coupe_z (f_1_2, 0., 5) ;
00415   */
00416 
00417   // First part of the correction metric (needed to be complemented by the (1 <-> 2) term
00418   
00419   Sym_tensor hh_temp(hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00420   
00421   for (int i=1 ; i<= 3 ; i++){
00422     for (int j=i ; j<= 3 ; j++){
00423       hh_temp.set(i,j) =   f_delta * hole1.ff.con()(i,j) + f_1_1 * nn1(i)*nn1(j) 
00424     + f_1_12 * 0.5 *(nn1(i) * nn12(j) + nn1(j) * nn12(i)) 
00425     + f_12_12 * nn12(i)*nn12(j) 
00426     + f_1_2 * 0.5*(nn1(i)*nn2(j) + nn1(j)*nn2(i) ) ;
00427     }
00428   }
00429   /*
00430   des_meridian(hh_temp, 0., 20., "hh_temp", 25) ;
00431   arrete() ;
00432   for (int i=1 ; i<= 3 ; i++)
00433     for (int j=i ; j<= 3 ; j++){
00434       des_profile(hh_temp(i,j), 0., 20., M_PI/2, M_PI) ;
00435       des_profile(hh_temp(i,j), 0., 20., M_PI/2, 0) ;
00436       des_profile(hh_temp(i,j), 0., 20., 0, M_PI) ;
00437       des_coupe_z (hh_temp(i,j), 0., 5) ;
00438     }
00439   */
00440 
00441   return hh_temp ;
00442   
00443 }
00444 
00445 
00446 Sym_tensor Bin_hor::hh_Samaya_hole2() {
00447 
00448 
00449   //========
00450   //  Grid 1
00451   //========
00452   int nz1 = hole1.mp.get_mg()->get_nzone() ;
00453   int nz2 = hole2.mp.get_mg()->get_nzone() ;
00454   
00455   // General coordinate values
00456   const Coord& xx_1 = hole1.mp.x ; 
00457   const Coord& yy_1 = hole1.mp.y ;   
00458   const Coord& zz_1 = hole1.mp.z ; 
00459 
00460   //========
00461   //  Grid 2
00462   //========
00463   
00464   // General coordinate values
00465   const Coord& xx_2 = hole2.mp.x ; 
00466   const Coord& yy_2 = hole2.mp.y ;   
00467   const Coord& zz_2 = hole2.mp.z ; 
00468 
00469 
00470   //===================================
00471   // Definition of the relevant vectors
00472   //===================================
00473 
00474   // Coordinate vector from hole 2 in the grid 2: nn2
00475   //--------------------------------------------------
00476   Vector rr2 (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00477   rr2.set(1) = xx_2 ;
00478   rr2.set(2) = yy_2 ;
00479   rr2.set(3) = zz_2 ;
00480   rr2.std_spectral_base() ;  
00481 
00482   // Norm r2
00483   Scalar r2 (hole2.mp) ;
00484   r2 = hole1.mp.r ;
00485   r2.std_spectral_base() ;
00486   Scalar temp2 (r2) ;
00487   temp2.raccord(1) ;
00488   r2.set_domain(0) = temp2.domain(0) ;
00489 
00490   // Unitary vector
00491   Vector nn2 (rr2);
00492   nn2 = nn2/r2 ;
00493   
00494   for (int i=0; i<hole2.mp.get_mg()->get_nr(nz2-1); i++)
00495     for (int j=0; j<hole2.mp.get_mg()->get_nt(nz2-1); j++)
00496       for (int k=0; k<hole2.mp.get_mg()->get_np(nz2-1); k++)
00497     for (int ind=1; ind<=3; ind++){
00498       nn2.set(ind).set_grid_point(nz2-1,k,j,i) = nn2(ind).val_grid_point(1,k,j,0) ;
00499       }
00500     
00501   // Coordinate vector from hole 1 in the grid 1: nn1_1
00502   //-----------------------------------------------------
00503   Vector rr1_1 (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00504   rr1_1.set(1) = xx_1 ;
00505   rr1_1.set(2) = yy_1 ;
00506   rr1_1.set(3) = zz_1 ;
00507   rr1_1.std_spectral_base() ;  
00508 
00509   // Norm r1_g1 
00510   Scalar r1_1 (hole1.mp) ;
00511   r1_1 = hole1.mp.r ;
00512   r1_1.std_spectral_base() ;
00513   Scalar temp1 (r1_1) ;
00514   temp1.raccord(1) ;
00515   r1_1.set_domain(0) = temp1.domain(0) ;
00516    
00517   // Unitary vector
00518   Vector nn1_1 (rr1_1);
00519   nn1_1 = nn1_1/r1_1 ;
00520   
00521   for (int i=0; i<hole1.mp.get_mg()->get_nr(nz1-1); i++)
00522     for (int j=0; j<hole1.mp.get_mg()->get_nt(nz1-1); j++)
00523       for (int k=0; k<hole1.mp.get_mg()->get_np(nz1-1); k++)
00524       for (int ind=1; ind<=3; ind++){
00525         nn1_1.set(ind).set_grid_point(nz1-1,k,j,i) = nn1_1(ind).val_grid_point(1,k,j,0) ;
00526       }
00527 
00528   Scalar unsr2 (hole2.mp) ;
00529   unsr2 = 1./hole2.mp.r ;
00530   unsr2.std_spectral_base() ;
00531   unsr2.raccord(1) ;
00532  
00533   // Coordinate vector from hole 1 in the grid 2: nn1
00534   //-----------------------------------------------------
00535   Vector nn1 (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00536   nn1_1.change_triad(hole2.mp.get_bvect_cart()) ;
00537   nn1.set_etat_qcq() ;
00538   for (int i=1 ; i<=3 ; i++){ 
00539     nn1.set(i).import(nn1_1(i)) ;
00540     nn1.set(i).set_spectral_va().set_base(nn1_1(i).get_spectral_va().get_base()) ;
00541   }  
00542   
00543   // r1/r2
00544   // -----
00545   Scalar unsr1_1 (hole1.mp) ;
00546   unsr1_1 = 1./hole1.mp.r ;
00547   unsr1_1.std_spectral_base() ;
00548   unsr1_1.raccord(1) ;
00549 
00550   Scalar unsr1 (hole2.mp) ;
00551   unsr1.set_etat_qcq() ;
00552   unsr1.import(unsr1_1) ;
00553   unsr1.set_spectral_va().set_base(unsr1_1.get_spectral_va().get_base()) ;
00554 
00555   Scalar r2sr1 (unsr1*r2) ;
00556   r2sr1.set_outer_boundary(nz2-1, 1.) ;
00557   
00558   Scalar r1sr2 (1./unsr1*unsr2) ;
00559   r1sr2.set_outer_boundary(nz2-1, 1.) ;
00560 
00561   // Coordinate vector from hole 2 to hole 1 in the grid 2: nn21
00562   //----------------------------------------------------------------
00563   // Warning! Valid only in the symmetric case (for the general case it would
00564   // necessary to construct this whole function as a Bin_hor function 
00565   Vector rr21 (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00566   rr21.set(1) = hole2.mp.get_ori_x() - hole1.mp.get_ori_x() ;
00567   rr21.set(2) = hole2.mp.get_ori_y() - hole1.mp.get_ori_y() ;
00568   rr21.set(3) = hole2.mp.get_ori_z() - hole1.mp.get_ori_z() ;
00569   rr21.std_spectral_base() ;  
00570 
00571   //Norm r21
00572   Scalar r21 (hole2.mp) ;
00573   r21 = sqrt( rr21(1)*rr21(1) + rr21(2)*rr21(2) + rr21(3)*rr21(3)) ;
00574   r21.std_spectral_base() ;
00575 
00576   // Unitary vector
00577   Vector nn21 ( rr21 );
00578   nn21 = nn21/ r21 ;
00579 
00580 
00581   Scalar f_delta (hole2.mp) ;
00582   Scalar f_delta_zec (hole2.mp) ;
00583   Scalar f_2_2 (hole2.mp) ;
00584   Scalar f_2_2_zec (hole2.mp) ;
00585   Scalar f_2_21 (hole2.mp) ;
00586   Scalar f_2_21_zec (hole2.mp) ;
00587   Scalar f_21_21 (hole2.mp) ;
00588   Scalar f_2_1 (hole2.mp) ;
00589 
00590   f_delta.set_etat_qcq() ;
00591   f_delta_zec.set_etat_qcq() ;
00592   f_2_2.set_etat_qcq() ;
00593   f_2_2_zec.set_etat_qcq() ;
00594   f_2_21.set_etat_qcq() ;
00595   f_2_21_zec.set_etat_qcq() ;
00596   f_21_21.set_etat_qcq() ;
00597   f_2_1.set_etat_qcq() ;  
00598  
00599   // Function exp(-(r-r_0)^2/sigma^2)
00600   // --------------------------------
00601   
00602   double r0 = hole2.mp.val_r(nz2-2, 1, 0, 0) ;
00603   double sigma = 1.*r0 ;
00604   
00605   Scalar rr (hole2.mp) ;
00606   rr = hole2.mp.r ;
00607 
00608   Scalar fexp (hole2.mp) ;
00609   fexp = exp( -(rr - r0)*(rr - r0)/sigma/sigma ) ;
00610   for (int ii=0; ii<nz2-1; ii++)
00611     fexp.set_domain(ii) = 1. ;
00612   fexp.set_outer_boundary(nz2-1, 0) ;
00613   fexp.std_spectral_base() ;
00614  
00615   // Conformal metric
00616   //=================
00617 
00618   // tilde{gamma}- \delta = m_1*m_2* ( f_delta \delta_{ij} 
00619   //                        + f_2_2 nn2*nn2 + f_2_21 nn2*nn21
00620   //                        + f_21_21 nn21*nn21
00621   //                        + f_1_1 nn1*nn1 + f_1_21 nn1*nn21
00622   //                        + f_2_1 nn2*nn1
00623  
00624   // f_delta
00625   //--------
00626   f_delta = -5.*r2/(8.*r21*r21*r21) - 15./(8.*r2*r21) + 
00627     5.*r2*r2*unsr1/(8.*r21*r21*r21) + 1./(r2+1./unsr1+r21)/(r2+1./unsr1+r21)* 
00628     (1 + r2/r21 + r21/r2 - r2sr1 - r2*r2sr1/r21 + r21*r21*unsr1/(2*r2)) +
00629     1./(r2+1./unsr1+r21)*(-7./r2 + 2./r21) ;  
00630 
00631   f_delta.annule_domain(nz2-1) ;
00632   
00633   f_delta_zec = - 15./(8.*r2*r21) + 1./(r2+1./unsr1+r21)/(r2+1./unsr1+r21)* 
00634     (1 + r2/r21 + r21/r2 - r2sr1 - r2*r2sr1/r21 + r21*r21*unsr1/(2*r2)) +
00635     1./(r2+1./unsr1+r21)*(-7./r2 + 2./r21) ;  
00636   f_delta_zec += fexp*(-5.*r2/(8.*r21*r21*r21)+5.*r2*r2*unsr1/(8.*r21*r21*r21)) ;
00637 
00638   f_delta_zec.set_outer_boundary(nz2-1, 0.) ;
00639   for (int i=0 ;i<nz2-1 ; i++){
00640     f_delta_zec.annule_domain(i) ;
00641   }
00642   
00643   f_delta = f_delta + f_delta_zec ;
00644   
00645   /*
00646   des_meridian(f_delta, 0., 20., "f_delta", 10) ;
00647   arrete() ;
00648   des_profile(f_delta, 0., 20., M_PI/2, M_PI) ;
00649   des_profile(f_delta, 0., 20., M_PI/2, 0) ;
00650   des_profile(f_delta, 0., 20., 0, M_PI) ;
00651   des_coupe_z (f_delta, 0., 2) ;
00652   des_coupe_z (f_delta, 0., 3) ;
00653   des_coupe_z (f_delta, 0., 4) ;
00654   des_coupe_z (f_delta, 0., 5) ;
00655   */
00656 
00657   // f_2_2
00658   //------
00659   f_2_2 = r2/(8.*r21*r21*r21) + 11./(8.*r2*r21) -
00660     1./(8.*r2*unsr1*unsr1*r21*r21*r21) + 7./(r2+1./unsr1+r21)/(r2+1./unsr1+r21) +
00661     7./r2/(r2+1./unsr1+r21) ;
00662   f_2_2.annule_domain(nz2-1) ;
00663   
00664   f_2_2_zec = 11./(8.*r2*r21) + 7./(r2+1./unsr1+r21)/(r2+1./unsr1+r21) +
00665     7./r2/(r2+1./unsr1+r21) ;
00666   f_2_2_zec += fexp*(r2/(8.*r21*r21*r21)-1./(8.*r2*unsr1*unsr1*r21*r21*r21)) ;
00667   f_2_2_zec.set_outer_boundary(nz2-1, 0.) ;
00668 
00669   for (int i=0 ; i<nz2-1 ; i++){
00670     f_2_2_zec.annule_domain(i) ;
00671   }
00672   
00673   f_2_2 = f_2_2 + f_2_2_zec ;
00674 
00675   /*
00676   des_meridian(f_2_2, 0., 20., "f_2_2", 14) ;
00677   arrete() ;
00678   des_profile(f_2_2, 0., 20., M_PI/2, M_PI) ;
00679   des_profile(f_2_2, 0., 20., M_PI/2, 0) ;
00680   des_profile(f_2_2, 0., 20., 0, M_PI) ;
00681   des_coupe_z (f_2_2, 0., 2) ;
00682   des_coupe_z (f_2_2, 0., 3) ;
00683   des_coupe_z (f_2_2, 0., 4) ;
00684   des_coupe_z (f_2_2, 0., 5) ;
00685   */
00686 
00687   // f_2_21
00688   //------
00689   f_2_21 = - 7./(2*r21*r21) + 8./(r2+1./unsr1+r21)/(r2+1./unsr1+r21) ;
00690   f_2_21.annule_domain(nz2-1) ;
00691   
00692   f_2_21_zec = 8./(r2+1./unsr1+r21)/(r2+1./unsr1+r21) ;
00693   f_2_21_zec += fexp*(- 7./(2*r21*r21)) ;
00694   f_2_21_zec.set_outer_boundary(nz2-1, 0.) ;
00695 
00696   for (int i=0 ; i<nz2-1 ; i++){
00697     f_2_21_zec.annule_domain(i) ;
00698   }
00699    
00700   f_2_21 = f_2_21 + f_2_21_zec ;
00701   
00702   /*
00703   des_meridian(f_2_21, 0., 40., "f_2_21", 15) ;
00704   arrete() ;
00705   des_profile(f_2_21, 0., 20., M_PI/2, M_PI) ;
00706   des_profile(f_2_21, 0., 20., M_PI/2, 0) ;
00707   des_profile(f_2_21, 0., 20., 0, M_PI) ;
00708   des_coupe_z (f_2_21, 0., 2) ;
00709   des_coupe_z (f_2_21, 0., 3) ;
00710   des_coupe_z (f_2_21, 0., 4) ;
00711   des_coupe_z (f_2_21, 0., 5) ;
00712   */
00713 
00714   // f_21_21
00715   //-------
00716   f_21_21 = (-4./(r2+1./unsr1+r21)/(r2+1./unsr1+r21) -  // facteur 2  ???????
00717         4./r21/(r2+1./unsr1+r21)) ;
00718   f_21_21.set_outer_boundary(nz2-1, 0.) ;
00719 
00720   /*
00721   des_meridian(f_21_21, 0., 40., "f_21_21", 15) ;
00722   arrete() ;
00723   des_profile(f_21_21, 0., 20., M_PI/2, M_PI) ;
00724   des_profile(f_21_21, 0., 20., M_PI/2, 0) ;
00725   des_profile(f_21_21, 0., 20., 0, M_PI) ;
00726   des_coupe_z (f_21_21, 0., 2) ;
00727   des_coupe_z (f_21_21, 0., 3) ;
00728   des_coupe_z (f_21_21, 0., 4) ;
00729   des_coupe_z (f_21_21, 0., 5) ;
00730   */
00731 
00732  // f_2_1
00733   //-------
00734   f_2_1 = 11./(r2+1./unsr1+r21)/(r2+1./unsr1+r21);        // facteur 2  ???????
00735   f_2_1.set_outer_boundary(nz2-1, 0.) ;
00736 
00737   /*
00738   des_meridian(f_2_1, 0., 40., "f_2_1", 15) ;
00739   arrete() ;
00740   des_profile(f_2_1, 0., 20., M_PI/2, M_PI) ;
00741   des_profile(f_2_1, 0., 20., M_PI/2, 0) ;
00742   des_profile(f_2_1, 0., 20., 0, M_PI) ;
00743   des_coupe_z (f_2_1, 0., 2) ;
00744   des_coupe_z (f_2_1, 0., 3) ;
00745   des_coupe_z (f_2_1, 0., 4) ;
00746   des_coupe_z (f_2_1, 0., 5) ;
00747   */
00748 
00749   // First part of the correction metric (needed to be complemented by the (1 <-> 2) term
00750   
00751   Sym_tensor hh_temp(hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00752   
00753   for (int i=1 ; i<= 3 ; i++){
00754     for (int j=i ; j<= 3 ; j++){
00755       hh_temp.set(i,j) =   f_delta * hole2.ff.con()(i,j) + f_2_2 * nn2(i)*nn2(j) 
00756     - f_2_21 * 0.5 *(nn2(i) * nn21(j) + nn2(j) * nn21(i)) 
00757     + f_21_21 * nn21(i)*nn21(j) 
00758     + f_2_1 * 0.5*(nn2(i)*nn1(j) + nn2(j)*nn1(i) ) ;
00759     }
00760   }
00761   /*
00762   des_meridian(hh_temp, 0., 20., "hh_temp", 25) ;
00763   arrete() ;
00764   for (int i=1 ; i<= 3 ; i++)
00765     for (int j=i ; j<= 3 ; j++){
00766       des_profile(hh_temp(i,j), 0., 20., M_PI/2, M_PI) ;
00767       des_profile(hh_temp(i,j), 0., 20., M_PI/2, 0) ;
00768       des_profile(hh_temp(i,j), 0., 20., 0, M_PI) ;
00769       des_coupe_z (hh_temp(i,j), 0., 5) ;
00770     }
00771   */
00772 
00773   return hh_temp ;
00774   
00775 
00776 
00777 }
00778 
00779 void Bin_hor::set_hh_Samaya() {
00780 
00781   Sym_tensor hh1 ( hh_Samaya_hole1() ) ;  
00782   Sym_tensor hh2 ( hh_Samaya_hole2() ) ;
00783 
00784   // Definition of the surface
00785   // -------------------------
00786   
00787   Cmp surface_un (hole1.mp) ;
00788   surface_un = pow(hole1.mp.r, 2.)-pow(hole1.get_radius(), 2.) ;
00789   surface_un.annule(hole1.mp.get_mg()->get_nzone()-1) ;
00790   surface_un.std_base_scal() ;
00791   
00792   Cmp surface_deux (hole2.mp) ;
00793   surface_deux = pow(hole2.mp.r, 2.)-pow(hole2.get_radius(), 2.) ;
00794   surface_deux.annule(hole1.mp.get_mg()->get_nzone()-1) ;
00795   surface_deux.std_base_scal() ;
00796   /*
00797   double ta = 12 ;
00798   for (int i=1 ; i<= 3 ; i++)
00799     for (int j=i ; j<= 3 ; j++){
00800       Cmp dessin_un (hh1(i,j)) ;
00801       dessin_un.annule(0) ;
00802   
00803       Cmp dessin_deux (hh2(i,j)) ;
00804       dessin_deux.annule(0) ;
00805   
00806       des_coupe_bin_z (dessin_un, dessin_deux, 0, 
00807                -ta, ta, -ta, ta, "hh(1,1)", &surface_un, &surface_deux, 
00808                false, 15, 300, 300) ;
00809     }
00810   */
00811 
00812   // Importation 
00813   // ----------------
00814 
00815   Sym_tensor hh2_1 (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00816   hh2_1.set_etat_qcq() ;  
00817   Sym_tensor hh1_2 (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00818   hh1_2.set_etat_qcq() ;  
00819 
00820   /*
00821   Scalar temp (hh1(1,1)) ;
00822   temp.annule_domain(0) ;
00823   des_profile(temp, 0., 4., M_PI/2, M_PI) ;
00824   des_profile(temp, 0., 4., M_PI/2, 0) ;
00825   des_profile(temp, 0., 4., 0, M_PI) ;
00826   des_coupe_z (temp, 0., 5) ;
00827   temp.raccord(1) ;
00828   des_profile(temp, 0., 4., M_PI/2, M_PI) ;
00829   des_profile(temp, 0., 4., M_PI/2, 0) ;
00830   des_profile(temp, 0., 4., 0, M_PI) ;
00831   des_coupe_z (temp, 0., 5) ;
00832   */
00833 
00834   /*
00835   for (int i=1 ; i<= 3 ; i++)
00836     for (int j=i ; j<= 3 ; j++){
00837       des_profile(hh1(i,j), 0., 20., M_PI/2, M_PI) ;
00838       des_profile(hh1(i,j), 0., 20., M_PI/2, 0) ;
00839       des_profile(hh1(i,j), 0., 20., 0, M_PI) ;
00840       des_coupe_z (hh1(i,j), 0., 5) ;
00841     }
00842   */
00843   for (int i=1 ; i<=3 ; i++)
00844     for (int j=i ; j<=3 ; j++){ 
00845         hh1.set(i,j).raccord(1) ;
00846         hh2.set(i,j).raccord(1) ;
00847     }
00848   /*
00849   for (int i=1 ; i<= 3 ; i++)
00850     for (int j=i ; j<= 3 ; j++){
00851       des_profile(hh1(i,j), 0., 20., M_PI/2, M_PI) ;
00852       des_profile(hh1(i,j), 0., 20., M_PI/2, 0) ;
00853       des_profile(hh1(i,j), 0., 20., 0, M_PI) ;
00854       des_coupe_z (hh1(i,j), 0., 5) ;
00855     }
00856   */
00857 
00858   hh2.change_triad(hole1.mp.get_bvect_cart()) ;
00859   for (int i=1 ; i<=3 ; i++){ 
00860     for (int j=i ; j<=3 ; j++){ 
00861     hh2_1.set(i,j).import(hh2(i,j)) ;
00862     hh2_1.set(i,j).set_spectral_va().set_base(hh2(i,j).get_spectral_va().get_base()) ;
00863     }    
00864   }  
00865   hh2.change_triad(hole2.mp.get_bvect_cart()) ;
00866 
00867   hh1.change_triad(hole2.mp.get_bvect_cart()) ;
00868   for (int i=1 ; i<=3 ; i++){ 
00869     for (int j=i ; j<=3 ; j++){ 
00870       hh1_2.set(i,j).import(hh1(i,j)) ;
00871       hh1_2.set(i,j).set_spectral_va().set_base(hh1(i,j).get_spectral_va().get_base()) ;
00872     }    
00873   }  
00874   hh1.change_triad(hole1.mp.get_bvect_cart()) ;
00875 
00876   double m1, m2 ;
00877   m1 = pow(hole1.area_hor()/(16.*M_PI) + hole1.ang_mom_hor()/hole1.radius, 0.5) ;
00878   m2 = pow(hole2.area_hor()/(16.*M_PI) + hole2.ang_mom_hor()/hole2.radius, 0.5) ;
00879   
00880   
00881   hh1 = hh1 + hh2_1 ;
00882   hh2 = hh2 + hh1_2 ;
00883 
00884   cout << hole1.mp.r << endl ;
00885   cout << hole1.mp.phi << endl ;
00886   cout << hole1.mp.tet << endl ;
00887 
00888 
00889   //des_meridian(hh1, 0., 20., "hh1 cart", 20) ;
00890   for (int i=1 ; i<= 3 ; i++)
00891     for (int j=i ; j<= 3 ; j++){
00892       //      des_profile(hh1(i,j), 0., 20., M_PI/2, M_PI) ;
00893       //des_profile(hh1(i,j), 0., 20., M_PI/2, 0) ;
00894       //des_profile(hh1(i,j), 0., 20., 0, M_PI) ;
00895       des_coupe_z (hh1(i,j), 0., 5) ;
00896     }
00897 
00898   hh1.change_triad(hole1.mp.get_bvect_spher()) ;
00899   hh2.change_triad(hole2.mp.get_bvect_spher()) ;
00900 
00901   hole1.hh = m1*m2* hh1 ;
00902   hole2.hh = m1*m2* hh2 ;
00903 
00904   Metric tgam_1 ( hole1.ff.con() +  hh1 ) ;
00905   Metric tgam_2 ( hole2.ff.con() +  hh2 ) ;
00906 
00907   hole1.tgam = tgam_1 ;
00908   hole2.tgam = tgam_2 ;
00909 
00910   
00911   des_meridian(hh1, 0., 20., "hh1", 0) ;
00912 
00913 
00914 }

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