isol_hor.C

00001 /*
00002  *  Methods of class Isol_hor
00003  *
00004  *    (see file isol_hor.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2004 Jose Luis Jaramillo
00010  *                      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 version 2
00016  *   as published by the Free Software Foundation.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 char isol_hor_C[] = "$Header: /cvsroot/Lorene/C++/Source/Isol_hor/isol_hor.C,v 1.33 2009/05/18 22:04:27 j_novak Exp $" ;
00030 
00031 /*
00032  * $Id: isol_hor.C,v 1.33 2009/05/18 22:04:27 j_novak Exp $
00033  * $Log: isol_hor.C,v $
00034  * Revision 1.33  2009/05/18 22:04:27  j_novak
00035  * Changed pow(psi_in, 6) to psi*...*psi in the call to Time_slice_conf constructor. This is to get a well-defined basis.
00036  *
00037  * Revision 1.32  2008/12/02 15:02:21  j_novak
00038  * Implementation of the new constrained formalism, following Cordero et al. 2009
00039  * paper. The evolution eqs. are solved as a first-order system. Not tested yet!
00040  *
00041  * Revision 1.31  2006/05/24 16:55:31  f_limousin
00042  * Improvement of dn_comp() and dpsi_comp()
00043  *
00044  * Revision 1.30  2005/10/21 16:20:55  jl_jaramillo
00045  * Version for the paper JaramL05
00046  *
00047  * Revision 1.29  2005/09/13 18:33:17  f_limousin
00048  * New function vv_bound_cart_bin(double) for computing binaries with
00049  * berlin condition for the shift vector.
00050  * Suppress all the symy and asymy in the importations.
00051  *
00052  * Revision 1.28  2005/09/12 12:33:54  f_limousin
00053  * Compilation Warning - Change of convention for the angular velocity
00054  * Add Berlin boundary condition in the case of binary horizons.
00055  *
00056  * Revision 1.27  2005/07/08 13:15:23  f_limousin
00057  * Improvements of boundary_vv_cart(), boundary_nn_lapl().
00058  * Add a fonction to compute the departure of axisymmetry.
00059  *
00060  * Revision 1.26  2005/05/12 14:48:07  f_limousin
00061  * New boundary condition for the lapse : boundary_nn_lapl().
00062  *
00063  * Revision 1.25  2005/04/15 09:34:16  jl_jaramillo
00064  * Function "adapt_hor" for adapting the the excised surface to
00065  * a given surface. The zero expansion surface is not properly implemented
00066  *
00067  * Revision 1.24  2005/04/08 12:16:52  f_limousin
00068  * Function set_psi(). And dependance in phi.
00069  *
00070  * Revision 1.23  2005/04/03 19:48:22  f_limousin
00071  * Implementation of set_psi(psi_in). And minor changes to avoid warnings.
00072  *
00073  * Revision 1.22  2005/04/02 15:49:21  f_limousin
00074  * New choice (Lichnerowicz) for aaquad. New member data nz.
00075  *
00076  * Revision 1.21  2005/03/31 09:45:31  f_limousin
00077  * New functions compute_ww(...) and aa_kerr_ww().
00078  *
00079  * Revision 1.20  2005/03/30 12:08:20  f_limousin
00080  * Implementation of K^{ij} (Eq.(13) Of Sergio (2002)).
00081  *
00082  * Revision 1.19  2005/03/28 19:42:39  f_limousin
00083  * Implement the metric and A^{ij}A_{ij} of Sergio for pertubations
00084  * of Kerr black holes.
00085  *
00086  * Revision 1.18  2005/03/24 17:05:34  f_limousin
00087  * Small change
00088  *
00089  * Revision 1.17  2005/03/24 16:50:28  f_limousin
00090  * Add parameters solve_shift and solve_psi in par_isol.d and in function
00091  * init_dat(...). Implement Isolhor::kerr_perturb().
00092  *
00093  * Revision 1.16  2005/03/10 10:19:42  f_limousin
00094  * Add the regularisation of the shift in the case of a single black hole
00095  * and lapse zero on the horizon.
00096  *
00097  * Revision 1.15  2005/03/09 10:29:53  f_limousin
00098  * New function update_aa().
00099  *
00100  * Revision 1.14  2005/03/06 16:59:14  f_limousin
00101  * New function Isol_hor::aa() (the one belonging to the class
00102  * Time_slice_conf need to compute the time derivative of hh and thus
00103  * cannot work in the class Isol_hor).
00104  *
00105  * Revision 1.13  2005/03/03 15:12:17  f_limousin
00106  * Implement function operator>>
00107  *
00108  * Revision 1.12  2005/03/03 10:05:36  f_limousin
00109  * Introduction of members boost_x and boost_z.
00110  *
00111  * Revision 1.11  2005/02/07 10:35:05  f_limousin
00112  * Add the regularisation of the shift for the case N=0 on the horizon.
00113  *
00114  * Revision 1.10  2004/12/31 15:36:43  f_limousin
00115  * Add the constructor from a file and change the standard constructor.
00116  *
00117  * Revision 1.9  2004/12/29 16:14:22  f_limousin
00118  * Add new function beta_comp(const Isol_hor& comp).
00119  *
00120  * Revision 1.7  2004/11/05 10:57:03  f_limousin
00121  * Delete argument partial_save in the function sauve.
00122  *
00123  * Revision 1.6  2004/11/05 10:10:21  f_limousin
00124  * Construction of an isolhor with the Metric met_gamt instead
00125  * of a Sym_tensor.
00126  *
00127  * Revision 1.5  2004/11/03 17:16:06  f_limousin
00128  * Change the standart constructor. Add 4 memebers : trK, trK_point,
00129  * gamt and gamt_point.
00130  * Add also a constructor from a file.
00131  *
00132  * Revision 1.3  2004/10/29 15:44:45  jl_jaramillo
00133  * Remove two members
00134  *
00135  * Revision 1.2  2004/09/28 16:07:16  f_limousin
00136  * Remove all unused functions.
00137  *
00138  * Revision 1.1  2004/09/09 14:07:26  jl_jaramillo
00139  * First version
00140  *
00141  * Revision 1.1  2004/03/30 14:00:31  jl_jaramillo
00142  * New class Isol_hor (first version).
00143  *
00144  *
00145  * $Header: /cvsroot/Lorene/C++/Source/Isol_hor/isol_hor.C,v 1.33 2009/05/18 22:04:27 j_novak Exp $
00146  *
00147  */
00148 
00149 // C headers
00150 #include <stdlib.h>
00151 #include <assert.h>
00152 
00153 // Lorene headers
00154 #include "param.h"
00155 #include "utilitaires.h"
00156 #include "time_slice.h"
00157 #include "isol_hor.h"
00158 #include "tensor.h"
00159 #include "metric.h"
00160 #include "evolution.h"
00161 //#include "graphique.h"
00162 
00163 //--------------//
00164 // Constructors //
00165 //--------------//
00166 // Standard constructor
00167 // --------------------
00168 
00169 Isol_hor::Isol_hor(Map_af& mpi, int depth_in) : 
00170     Time_slice_conf(mpi, mpi.get_bvect_spher(), mpi.flat_met_spher()),
00171     mp(mpi), nz(mpi.get_mg()->get_nzone()), radius ((mpi.get_alpha())[0]), 
00172           omega(0), boost_x(0), boost_z(0), regul(0),
00173   n_auto_evol(depth_in), n_comp_evol(depth_in), 
00174   psi_auto_evol(depth_in), psi_comp_evol(depth_in),
00175   dn_evol(depth_in), dpsi_evol(depth_in),
00176   beta_auto_evol(depth_in), beta_comp_evol(depth_in),
00177   aa_auto_evol(depth_in), aa_comp_evol(depth_in),
00178   aa_nn(depth_in), aa_quad_evol(depth_in),
00179   met_gamt(mpi.flat_met_spher()), gamt_point(mpi, CON, mpi.get_bvect_spher()),
00180   trK(mpi), trK_point(mpi), decouple(mpi){
00181 }         
00182 
00183 // Constructor from conformal decomposition
00184 // ----------------------------------------
00185 
00186 Isol_hor::Isol_hor(Map_af& mpi, const Scalar& lapse_in, 
00187            const Scalar& psi_in, const Vector& shift_in,
00188            const Sym_tensor& aa_in, 
00189            const Metric& metgamt, const Sym_tensor& gamt_point_in, 
00190            const Scalar& trK_in, const Scalar& trK_point_in,
00191            const Metric_flat& ff_in, int depth_in)    
00192     : Time_slice_conf(lapse_in, shift_in, ff_in, psi_in, metgamt.con() -
00193               ff_in.con(), psi_in*psi_in*psi_in*psi_in*psi_in*psi_in*aa_in, 
00194               trK_in, depth_in),
00195       mp(mpi), nz(mpi.get_mg()->get_nzone()), radius ((mpi.get_alpha())[0]), 
00196       omega(0), boost_x(0), boost_z(0), regul(0),
00197       n_auto_evol(depth_in), n_comp_evol(depth_in), 
00198       psi_auto_evol(depth_in), psi_comp_evol(depth_in),
00199       dn_evol(depth_in), dpsi_evol(depth_in),
00200       beta_auto_evol(depth_in), beta_comp_evol(depth_in),
00201       aa_auto_evol(depth_in), aa_comp_evol(depth_in), 
00202       aa_nn(depth_in), aa_quad_evol(depth_in),
00203       met_gamt(metgamt), gamt_point(gamt_point_in),
00204       trK(trK_in), trK_point(trK_point_in), decouple(lapse_in.get_mp()){
00205 
00206     // hh_evol, trk_evol
00207     hh_evol.update(met_gamt.con() - ff.con(), jtime, the_time[jtime]) ;
00208     trk_evol.update(trK, jtime, the_time[jtime]) ;
00209  
00210 }
00211 
00212 // Copy constructor
00213 // ----------------
00214 
00215 Isol_hor::Isol_hor(const Isol_hor& isolhor_in) 
00216     : Time_slice_conf(isolhor_in),
00217       mp(isolhor_in.mp),
00218       nz(isolhor_in.nz),
00219       radius(isolhor_in.radius),
00220       omega(isolhor_in.omega),
00221       boost_x(isolhor_in.boost_x),
00222       boost_z(isolhor_in.boost_z),
00223       regul(isolhor_in.regul),
00224       n_auto_evol(isolhor_in.n_auto_evol),
00225       n_comp_evol(isolhor_in.n_comp_evol),
00226       psi_auto_evol(isolhor_in.psi_auto_evol),
00227       psi_comp_evol(isolhor_in.psi_comp_evol),
00228       dn_evol(isolhor_in.dn_evol),
00229       dpsi_evol(isolhor_in.dpsi_evol),
00230       beta_auto_evol(isolhor_in.beta_auto_evol),
00231       beta_comp_evol(isolhor_in.beta_comp_evol),
00232       aa_auto_evol(isolhor_in.aa_auto_evol),
00233       aa_comp_evol(isolhor_in.aa_comp_evol),
00234       aa_nn(isolhor_in.aa_nn),
00235       aa_quad_evol(isolhor_in.aa_quad_evol),
00236       met_gamt(isolhor_in.met_gamt),
00237       gamt_point(isolhor_in.gamt_point),
00238       trK(isolhor_in.trK),
00239       trK_point(isolhor_in.trK_point),
00240       decouple(isolhor_in.decouple){
00241 }
00242 
00243 // Constructor from a file
00244 // -----------------------
00245 
00246 Isol_hor::Isol_hor(Map_af& mpi, FILE* fich, 
00247            bool partial_read, int depth_in)
00248     : Time_slice_conf(mpi, mpi.get_bvect_spher(), mpi.flat_met_spher(), 
00249               fich, partial_read, depth_in),
00250       mp(mpi), nz(mpi.get_mg()->get_nzone()), radius ((mpi.get_alpha())[0]), 
00251       omega(0), boost_x(0), boost_z(0), regul(0),
00252       n_auto_evol(depth_in), n_comp_evol(depth_in), 
00253       psi_auto_evol(depth_in), psi_comp_evol(depth_in),
00254       dn_evol(depth_in), dpsi_evol(depth_in),
00255       beta_auto_evol(depth_in), beta_comp_evol(depth_in),
00256       aa_auto_evol(depth_in), aa_comp_evol(depth_in), 
00257       aa_nn(depth_in), aa_quad_evol(depth_in),
00258       met_gamt(mpi.flat_met_spher()), 
00259       gamt_point(mpi, CON, mpi.get_bvect_spher()),
00260       trK(mpi), trK_point(mpi), decouple(mpi){
00261 
00262     fread_be(&omega, sizeof(double), 1, fich) ;
00263     fread_be(&boost_x, sizeof(double), 1, fich) ;
00264     fread_be(&boost_z, sizeof(double), 1, fich) ;
00265   
00266     int jmin = jtime - depth + 1 ; 
00267     int indicator ; 
00268 
00269     // psi_evol
00270     for (int j=jmin; j<=jtime; j++) {
00271     fread_be(&indicator, sizeof(int), 1, fich) ;    
00272     if (indicator == 1) {
00273         Scalar psi_file(mp, *(mp.get_mg()), fich) ; 
00274         psi_evol.update(psi_file, j, the_time[j]) ; 
00275     }
00276     }
00277 
00278     // n_auto_evol
00279     for (int j=jmin; j<=jtime; j++) {
00280     fread_be(&indicator, sizeof(int), 1, fich) ;    
00281     if (indicator == 1) {
00282         Scalar nn_auto_file(mp, *(mp.get_mg()), fich) ; 
00283         n_auto_evol.update(nn_auto_file, j, the_time[j]) ; 
00284     }
00285     }
00286 
00287   // psi_auto_evol
00288   for (int j=jmin; j<=jtime; j++) {
00289       fread_be(&indicator, sizeof(int), 1, fich) ;  
00290       if (indicator == 1) {
00291       Scalar psi_auto_file(mp, *(mp.get_mg()), fich) ; 
00292       psi_auto_evol.update(psi_auto_file, j, the_time[j]) ; 
00293       }
00294   }
00295 
00296   // beta_auto_evol
00297   for (int j=jmin; j<=jtime; j++) {
00298       fread_be(&indicator, sizeof(int), 1, fich) ;  
00299       if (indicator == 1) {
00300       Vector beta_auto_file(mp, mpi.get_bvect_spher(), fich) ; 
00301       beta_auto_evol.update(beta_auto_file, j, the_time[j]) ; 
00302       }
00303   }
00304   
00305   // met_gamt, gamt_point, trK, trK_point
00306 
00307   Sym_tensor met_file (mp, mp.get_bvect_spher(), fich) ;
00308   met_gamt = met_file ;
00309 
00310   Sym_tensor gamt_point_file (mp, mp.get_bvect_spher(), fich) ;
00311   gamt_point = gamt_point_file ;
00312   
00313   Scalar trK_file (mp, *(mp.get_mg()), fich) ;
00314   trK = trK_file ;
00315   
00316   Scalar trK_point_file (mp, *(mp.get_mg()), fich) ;
00317   trK_point = trK_point_file ;
00318   
00319   // hh_evol, trk_evol
00320   hh_evol.update(met_gamt.con() - ff.con(), jtime, the_time[jtime]) ;
00321   trk_evol.update(trK, jtime, the_time[jtime]) ;
00322 
00323 }
00324 
00325                 //--------------//
00326                 //  Destructor  //
00327                 //--------------//
00328 
00329 Isol_hor::~Isol_hor(){}
00330 
00331 
00332                     //-----------------------//
00333                     // Mutators / assignment //
00334                     //-----------------------//
00335 
00336 void Isol_hor::operator=(const Isol_hor& isolhor_in) {
00337 
00338 Time_slice_conf::operator=(isolhor_in) ;
00339  mp = isolhor_in.mp ;
00340  nz = isolhor_in.nz ;
00341  radius = isolhor_in.radius ;
00342  omega = isolhor_in.omega ;
00343  boost_x = isolhor_in.boost_x ;
00344  boost_z = isolhor_in.boost_z ;
00345  regul = isolhor_in.regul ;
00346  n_auto_evol = isolhor_in.n_auto_evol ;
00347  n_comp_evol = isolhor_in.n_comp_evol ;
00348  psi_auto_evol = isolhor_in.psi_auto_evol ;
00349  psi_comp_evol = isolhor_in.psi_comp_evol ;
00350  dn_evol = isolhor_in.dn_evol ;
00351  dpsi_evol = isolhor_in.dpsi_evol ;
00352  beta_auto_evol = isolhor_in.beta_auto_evol ;
00353  beta_comp_evol = isolhor_in.beta_comp_evol ;
00354  aa_auto_evol = isolhor_in.aa_auto_evol ;
00355  aa_comp_evol = isolhor_in.aa_comp_evol ;
00356  aa_nn = isolhor_in.aa_nn ;
00357  aa_quad_evol = isolhor_in.aa_quad_evol ;
00358  met_gamt = isolhor_in.met_gamt ;
00359  gamt_point = isolhor_in.gamt_point ;
00360  trK = isolhor_in.trK ;
00361  trK_point = isolhor_in.trK_point ;
00362  decouple = isolhor_in.decouple ;
00363 }
00364 
00365 
00366                 //------------------//
00367                 //      output      //
00368                 //------------------//
00369 
00370 
00371 ostream& Isol_hor::operator>>(ostream& flux) const {
00372     
00373     Time_slice_conf::operator>>(flux) ; 
00374     
00375     flux << '\n' << "radius of the horizon  : " << radius << '\n' ;
00376     flux << "boost in x-direction   : " << boost_x << '\n' ;
00377     flux << "boost in z-direction   : " << boost_z << '\n' ;
00378     flux << "angular velocity omega : " << omega_hor() << '\n' ;
00379     flux << "area of the horizon    : " << area_hor() << '\n' ;
00380     flux << "ang. mom. of horizon   : " << ang_mom_hor() << '\n' ;
00381     flux << "ADM ang. mom.          : " << ang_mom_adm() << '\n' ;
00382     flux << "Mass of the horizon    : " << mass_hor() << '\n' ;
00383     flux << "ADM Mass               : " << adm_mass() << '\n' ;
00384    
00385     return flux ;     
00386 }
00387 
00388 
00389                 //--------------------------//
00390                 //      Save in a file      //
00391                 //--------------------------//
00392 
00393 
00394 void Isol_hor::sauve(FILE* fich, bool partial_save) const {
00395 
00396 
00397     // Writing of quantities common to all derived classes of Time_slice
00398     // -----------------------------------------------------------------
00399     
00400     Time_slice_conf::sauve(fich, partial_save) ; 
00401 
00402     fwrite_be (&omega, sizeof(double), 1, fich) ;
00403     fwrite_be (&boost_x, sizeof(double), 1, fich) ;
00404     fwrite_be (&boost_z, sizeof(double), 1, fich) ;
00405     
00406     // Writing of quantities common to Isol_hor
00407     // -----------------------------------------
00408 
00409     int jmin = jtime - depth + 1 ; 
00410 
00411     // psi_evol
00412     for (int j=jmin; j<=jtime; j++) {
00413     int indicator = (psi_evol.is_known(j)) ? 1 : 0 ; 
00414         fwrite_be(&indicator, sizeof(int), 1, fich) ;
00415         if (indicator == 1) psi_evol[j].sauve(fich) ; 
00416     }
00417     
00418     // n_auto_evol
00419     for (int j=jmin; j<=jtime; j++) {
00420     int indicator = (n_auto_evol.is_known(j)) ? 1 : 0 ; 
00421         fwrite_be(&indicator, sizeof(int), 1, fich) ;
00422         if (indicator == 1) n_auto_evol[j].sauve(fich) ; 
00423     }
00424      
00425     // psi_auto_evol
00426     for (int j=jmin; j<=jtime; j++) {
00427     int indicator = (psi_auto_evol.is_known(j)) ? 1 : 0 ; 
00428         fwrite_be(&indicator, sizeof(int), 1, fich) ;
00429         if (indicator == 1) psi_auto_evol[j].sauve(fich) ; 
00430     }
00431      
00432     // beta_auto_evol
00433     for (int j=jmin; j<=jtime; j++) {
00434     int indicator = (beta_auto_evol.is_known(j)) ? 1 : 0 ; 
00435         fwrite_be(&indicator, sizeof(int), 1, fich) ;
00436         if (indicator == 1) beta_auto_evol[j].sauve(fich) ; 
00437     }
00438     
00439     met_gamt.con().sauve(fich) ;
00440     gamt_point.sauve(fich) ;    
00441     trK.sauve(fich) ;
00442     trK_point.sauve(fich) ;
00443 }
00444 
00445 // Accessors
00446 // ---------
00447 
00448 const Scalar& Isol_hor::n_auto() const {
00449 
00450     assert( n_auto_evol.is_known(jtime) ) ; 
00451     return n_auto_evol[jtime] ;   
00452 } 
00453 
00454 const Scalar& Isol_hor::n_comp() const {
00455 
00456     assert( n_comp_evol.is_known(jtime) ) ; 
00457     return n_comp_evol[jtime] ;   
00458 } 
00459 
00460 const Scalar& Isol_hor::psi_auto() const {
00461 
00462     assert( psi_auto_evol.is_known(jtime) ) ; 
00463     return psi_auto_evol[jtime] ;   
00464 } 
00465 
00466 const Scalar& Isol_hor::psi_comp() const {
00467 
00468     assert( psi_comp_evol.is_known(jtime) ) ; 
00469     return psi_comp_evol[jtime] ;   
00470 } 
00471 
00472 const Vector& Isol_hor::dnn() const {
00473 
00474     assert( dn_evol.is_known(jtime) ) ; 
00475     return dn_evol[jtime] ;   
00476 } 
00477 
00478 const Vector& Isol_hor::dpsi() const {
00479 
00480     assert( dpsi_evol.is_known(jtime) ) ; 
00481     return dpsi_evol[jtime] ;   
00482 } 
00483 
00484 const Vector& Isol_hor::beta_auto() const {
00485 
00486     assert( beta_auto_evol.is_known(jtime) ) ; 
00487     return beta_auto_evol[jtime] ;   
00488 } 
00489 
00490 const Vector& Isol_hor::beta_comp() const {
00491 
00492     assert( beta_comp_evol.is_known(jtime) ) ; 
00493     return beta_comp_evol[jtime] ;   
00494 } 
00495 
00496 const Sym_tensor& Isol_hor::aa_auto() const {
00497 
00498     assert( aa_auto_evol.is_known(jtime) ) ; 
00499     return aa_auto_evol[jtime] ;   
00500 } 
00501 
00502 const Sym_tensor& Isol_hor::aa_comp() const {
00503 
00504     assert( aa_comp_evol.is_known(jtime) ) ; 
00505     return aa_comp_evol[jtime] ;   
00506 } 
00507 
00508 void Isol_hor::set_psi(const Scalar& psi_in) {
00509 
00510     psi_evol.update(psi_in, jtime, the_time[jtime]) ;
00511 
00512     // Reset of quantities depending on Psi:
00513     if (p_psi4 != 0x0) {
00514         delete p_psi4 ;
00515         p_psi4 = 0x0 ;
00516     }
00517     if (p_ln_psi != 0x0) {
00518         delete p_ln_psi ;
00519         p_ln_psi = 0x0 ;
00520     }
00521     if (p_gamma != 0x0) {
00522         delete p_gamma ;
00523         p_gamma = 0x0 ;
00524     }
00525     gam_dd_evol.downdate(jtime) ;
00526     gam_uu_evol.downdate(jtime) ;
00527     k_dd_evol.downdate(jtime) ;
00528     k_uu_evol.downdate(jtime) ;
00529     adm_mass_evol.downdate(jtime) ;
00530     
00531 }
00532 
00533 void Isol_hor::set_nn(const Scalar& nn_in) {
00534 
00535     n_evol.update(nn_in, jtime, the_time[jtime]) ;
00536 
00537     hata_evol.downdate(jtime) ;
00538     aa_quad_evol.downdate(jtime) ;
00539     k_dd_evol.downdate(jtime) ;
00540     k_uu_evol.downdate(jtime) ;
00541 }
00542 
00543 void Isol_hor::set_gamt(const Metric& gam_tilde) {
00544 
00545     if (p_tgamma != 0x0) {
00546         delete p_tgamma ;
00547         p_tgamma = 0x0 ;
00548     }
00549     if (p_gamma != 0x0) {
00550         delete p_gamma ;
00551         p_gamma = 0x0 ;
00552     }
00553 
00554     met_gamt = gam_tilde ;
00555  
00556     gam_dd_evol.downdate(jtime) ;
00557     gam_uu_evol.downdate(jtime) ;
00558     k_dd_evol.downdate(jtime) ;
00559     k_uu_evol.downdate(jtime) ;
00560     hh_evol.downdate(jtime) ;
00561 
00562     hh_evol.update(gam_tilde.con() - ff.con(), jtime, the_time[jtime]) ;
00563 
00564 }
00565 
00566 
00567 
00568 // Import the lapse from the companion (Bhole case)
00569 
00570 void Isol_hor::n_comp(const Isol_hor& comp) {
00571 
00572     double ttime = the_time[jtime] ;    
00573 
00574     Scalar temp (mp) ;
00575     temp.import(comp.n_auto()) ;
00576     temp.std_spectral_base() ;
00577     n_comp_evol.update(temp, jtime, ttime) ;
00578     n_evol.update(temp + n_auto(), jtime, ttime) ;
00579      
00580     Vector dn_comp (mp, COV, mp.get_bvect_cart()) ;
00581     dn_comp.set_etat_qcq() ;
00582     Vector auxi (comp.n_auto().derive_cov(comp.ff)) ;
00583     auxi.dec_dzpuis(2) ;
00584     auxi.change_triad(auxi.get_mp().get_bvect_cart()) ;
00585     for (int i=1 ; i<=3 ; i++){
00586       if (auxi(i).get_etat() != ETATZERO)
00587         auxi.set(i).raccord(3) ;
00588     }
00589 
00590     auxi.change_triad(mp.get_bvect_cart()) ;
00591     assert ( *(auxi.get_triad()) == *(dn_comp.get_triad())) ;
00592 
00593     for (int i=1 ; i<=3 ; i++){
00594     dn_comp.set(i).import(auxi(i)) ;
00595     dn_comp.set(i).set_spectral_va().set_base(auxi(i).get_spectral_va().
00596                           get_base()) ;
00597     }
00598     dn_comp.inc_dzpuis(2) ;
00599     dn_comp.change_triad(mp.get_bvect_spher()) ;
00600     /*    
00601     Vector dn_comp_zec (n_comp().derive_cov(ff)) ;
00602     for (int i=1 ; i<=3 ; i++)
00603       for (int l=nz-1 ; l<=nz-1 ; l++) {
00604       if (dn_comp.set(i).get_etat() == ETATQCQ)
00605         dn_comp.set(i).set_domain(l) = dn_comp_zec(i).domain(l) ;
00606       }
00607     */
00608     dn_evol.update(n_auto().derive_cov(ff) + dn_comp, jtime, ttime) ;
00609 
00610 
00611     /*
00612     Scalar tr_K (mp) ;
00613  
00614     Mtbl mxabs (mp.xa) ;
00615     Mtbl myabs (mp.ya) ;
00616     Mtbl mzabs (mp.za) ;
00617     Scalar comp_r (mp) ;
00618     comp_r.annule_hard() ;
00619     for (int l=1 ; l<mp.get_mg()->get_nzone() ; l++) {
00620     int nr = mp.get_mg()->get_nr (l) ;
00621     if (l==mp.get_mg()->get_nzone()-1)
00622         nr -- ; 
00623     int np = mp.get_mg()->get_np (l) ;
00624     int nt = mp.get_mg()->get_nt (l) ;
00625     double xabs, yabs, zabs, air, theta, phi ;
00626     
00627     for (int k=0 ; k<np ; k++)
00628     for (int j=0 ; j<nt ; j++)
00629         for (int i=0 ; i<nr ; i++) {
00630         
00631         xabs = mxabs (l, k, j, i) ;
00632         yabs = myabs (l, k, j, i) ;
00633         zabs = mzabs (l, k, j, i) ;
00634 
00635         // coordinates of the point in 2 :
00636         comp.mp.convert_absolute 
00637             (xabs, yabs, zabs, air, theta, phi) ;
00638         comp_r.set_grid_point(l,k,j,i) = air ;
00639         }
00640     }
00641 
00642     Scalar fact(mp) ;
00643     fact = 0.0000000000000001 ;
00644 
00645 //    Scalar fact(mp) ;
00646 //    fact = 0.7*gam().radial_vect().divergence(gam()) ;
00647 //    fact.dec_dzpuis(2) ;
00648 
00649     tr_K = 1/mp.r/mp.r ;
00650     tr_K = tr_K * fact ;
00651     tr_K += fact/comp_r/comp_r ;
00652     tr_K.std_spectral_base() ;
00653     tr_K.annule(0, 0) ;
00654     tr_K.raccord(1) ;
00655     tr_K.inc_dzpuis(2) ;
00656     trk_evol.update(tr_K, jtime, the_time[jtime]) ;
00657 */
00658 }
00659 
00660 // Import the conformal factor from the companion (Bhole case)
00661 
00662 void Isol_hor::psi_comp (const Isol_hor& comp) {
00663   
00664     double ttime = the_time[jtime] ;    
00665     
00666     Scalar temp (mp) ;
00667     temp.import(comp.psi_auto()) ;
00668     temp.std_spectral_base() ;
00669     psi_comp_evol.update(temp, jtime, ttime) ;
00670     psi_evol.update(temp + psi_auto(), jtime, ttime) ;
00671     
00672     Vector dpsi_comp (mp, COV, mp.get_bvect_cart()) ;
00673     dpsi_comp.set_etat_qcq() ;
00674     Vector auxi (comp.psi_auto().derive_cov(comp.ff)) ;
00675     auxi.dec_dzpuis(2) ;
00676     auxi.change_triad(auxi.get_mp().get_bvect_cart()) ;
00677     for (int i=1 ; i<=3 ; i++){
00678       if (auxi(i).get_etat() != ETATZERO)
00679         auxi.set(i).raccord(3) ;
00680     }
00681 
00682     auxi.change_triad(mp.get_bvect_cart()) ;
00683     assert ( *(auxi.get_triad()) == *(dpsi_comp.get_triad())) ;
00684 
00685     for (int i=1 ; i<=3 ; i++){
00686       dpsi_comp.set(i).import(auxi(i)) ;
00687       dpsi_comp.set(i).set_spectral_va().set_base(auxi(i).get_spectral_va().
00688                           get_base()) ;
00689     }
00690     dpsi_comp.inc_dzpuis(2) ;
00691     dpsi_comp.change_triad(mp.get_bvect_spher()) ;
00692     /*    
00693     Vector dpsi_comp_zec (psi_comp().derive_cov(ff)) ;
00694     for (int i=1 ; i<=3 ; i++)
00695       for (int l=nz-1 ; l<=nz-1 ; l++) {
00696     if (dpsi_comp.set(i).get_etat() == ETATQCQ)
00697       dpsi_comp.set(i).set_domain(l) = dpsi_comp_zec(i).domain(l) ;
00698       }
00699     */
00700     
00701     dpsi_evol.update(psi_auto().derive_cov(ff) + dpsi_comp, jtime, ttime) ;
00702 
00703 }
00704 
00705 void Isol_hor::beta_comp (const Isol_hor& comp) {
00706   
00707     double ttime = the_time[jtime] ;    
00708     
00709     Vector tmp_vect (mp, CON, mp.get_bvect_cart()) ;
00710     Vector shift_comp (comp.beta_auto()) ;
00711     shift_comp.change_triad(comp.mp.get_bvect_cart()) ;
00712     shift_comp.change_triad(mp.get_bvect_cart()) ;
00713     assert (*(shift_comp.get_triad()) == *(tmp_vect.get_triad())) ;
00714 
00715     tmp_vect.set(1).import(shift_comp(1)) ;
00716     tmp_vect.set(2).import(shift_comp(2)) ;
00717     tmp_vect.set(3).import(shift_comp(3)) ;
00718     tmp_vect.std_spectral_base() ;
00719     tmp_vect.change_triad(mp.get_bvect_spher()) ;
00720     
00721     beta_comp_evol.update(tmp_vect, jtime,ttime) ;
00722     beta_evol.update(beta_auto() + beta_comp(), jtime, ttime) ;
00723 }
00724 
00725 //Initialisation to Schwartzchild
00726 void Isol_hor::init_bhole () {
00727     
00728     double ttime = the_time[jtime] ;    
00729     Scalar auxi(mp) ;
00730     
00731     // Initialisation of the lapse different of zero on the horizon
00732     // at the first step
00733     auxi = 0.5 - 0.5/mp.r ;
00734     auxi.annule(0, 0);
00735     auxi.set_dzpuis(0) ;
00736     
00737     Scalar temp(mp) ;
00738     temp = auxi;
00739     temp.std_spectral_base() ;
00740     temp.raccord(1) ;
00741     n_auto_evol.update(temp, jtime, ttime) ;
00742 
00743     temp = 0.5 ;
00744     temp.std_spectral_base() ;
00745     n_comp_evol.update(temp, jtime, ttime) ;
00746     n_evol.update(n_auto() + n_comp(), jtime, ttime) ;
00747   
00748     auxi = 0.5 + radius/mp.r ;
00749     auxi.annule(0, 0);
00750     auxi.set_dzpuis(0) ;
00751     temp = auxi;
00752     temp.std_spectral_base() ;
00753     temp.raccord(1) ;
00754     psi_auto_evol.update(temp, jtime, ttime) ;
00755 
00756     temp = 0.5 ;
00757     temp.std_spectral_base() ;
00758     psi_comp_evol.update(temp, jtime, ttime) ;
00759     psi_evol.update(psi_auto() + psi_comp(), jtime, ttime) ;
00760     
00761     dn_evol.update(nn().derive_cov(ff), jtime, ttime) ;
00762     dpsi_evol.update(psi().derive_cov(ff), jtime, ttime) ;
00763     
00764     Vector temp_vect1(mp, CON, mp.get_bvect_spher()) ;
00765     temp_vect1.set(1) = 0.0/mp.r/mp.r ;
00766     temp_vect1.set(2) = 0. ;
00767     temp_vect1.set(3) = 0. ;
00768     temp_vect1.std_spectral_base() ;
00769 
00770     Vector temp_vect2(mp, CON, mp.get_bvect_spher()) ;
00771     temp_vect2.set_etat_zero() ;    
00772 
00773     beta_auto_evol.update(temp_vect1, jtime, ttime) ;
00774     beta_comp_evol.update(temp_vect2, jtime, ttime) ;
00775     beta_evol.update(temp_vect1, jtime, ttime) ;    
00776 }
00777 
00778 void Isol_hor::init_met_trK() {
00779  
00780   Metric flat (mp.flat_met_spher()) ;
00781   met_gamt = flat ;
00782 
00783   gamt_point.set_etat_zero() ;
00784   trK.set_etat_zero() ;
00785   trK_point.set_etat_zero() ;
00786  
00787 }
00788 
00789 
00790 void Isol_hor::init_bhole_seul () {
00791     
00792     double ttime = the_time[jtime] ;    
00793     Scalar auxi(mp) ;
00794     
00795     auxi = (1-radius/mp.r)/(1+radius/mp.r) ;
00796     auxi.annule(0, 0);
00797     auxi.set_outer_boundary((*mp.get_mg()).get_nzone(), 1.) ;
00798     auxi.set_dzpuis(0) ;
00799 
00800     Scalar temp(mp) ;
00801     temp = auxi;
00802     temp.std_spectral_base() ;
00803     temp.raccord(1) ;
00804     n_auto_evol.update(temp, jtime, ttime) ;
00805 
00806     temp.set_etat_zero() ;
00807     n_comp_evol.update(temp, jtime, ttime) ;
00808     n_evol.update(temp, jtime, ttime) ;
00809  
00810     
00811     auxi = 1 + radius/mp.r ;
00812     auxi.annule(0, 0);
00813     auxi.set_outer_boundary((*mp.get_mg()).get_nzone(), 1.) ;
00814     auxi.set_dzpuis(0) ;
00815   
00816     temp = auxi;
00817     temp.std_spectral_base() ;
00818     temp.raccord(1) ;
00819     psi_auto_evol.update(temp, jtime, ttime) ;
00820     temp.set_etat_zero() ;
00821     psi_comp_evol.update(temp, jtime, ttime) ;
00822     psi_evol.update(temp, jtime, ttime) ;
00823     
00824     dn_evol.update(nn().derive_cov(ff), jtime, ttime) ;
00825     dpsi_evol.update(psi().derive_cov(ff), jtime, ttime) ;
00826 
00827     Vector temp_vect(mp, CON, mp.get_bvect_spher()) ;
00828     temp_vect.set_etat_zero() ;
00829     beta_auto_evol.update(temp_vect, jtime, ttime) ;
00830     beta_comp_evol.update(temp_vect, jtime, ttime) ;
00831     beta_evol.update(temp_vect, jtime, ttime) ;     
00832 
00833 }          
00834 
00835 void Isol_hor::update_aa() {
00836     
00837   Sym_tensor aa_new (mp, CON, mp.get_bvect_spher()) ;
00838   int nnt = mp.get_mg()->get_nt(1) ;
00839   int nnp = mp.get_mg()->get_np(1) ;
00840 
00841   int check ;
00842   check = 0 ;
00843   for (int k=0; k<nnp; k++)
00844     for (int j=0; j<nnt; j++){
00845       if (nn().val_grid_point(1, k, j , 0) < 1e-12){
00846     check = 1 ;
00847     break ;
00848       }
00849     }
00850   
00851   if (check == 0)
00852     aa_new = ( beta().ope_killing_conf(met_gamt) + gamt_point ) 
00853       / (2.* nn()) ;            
00854   else {
00855     regul = regularise_one() ;
00856     cout << "regul = " << regul << endl ;
00857     Scalar nn_sxpun (division_xpun (Cmp(nn()), 0)) ;
00858     aa_new = beta().ope_killing_conf(met_gamt) + gamt_point ;
00859     
00860     Scalar auxi (mp) ;
00861     for (int i=1 ; i<=3 ; i++)
00862     for (int j=i ; j<=3 ; j++) {
00863         auxi = aa_new(i, j) ;
00864         auxi = division_xpun (auxi, 0) ;
00865         aa_new.set(i,j) = auxi / nn_sxpun / 2. ;
00866     }
00867   }
00868   
00869   Sym_tensor hata_new = aa_new*psi4()*psi()*psi() ;
00870   set_hata(hata_new) ;  // set aa to aa_new and delete values of 
00871                     // k_uu and k_dd.
00872   Sym_tensor aa_dd (aa_new.up_down(met_gamt)) ;
00873   Scalar aquad (contract(aa_dd, 0, 1, aa_new, 0, 1)*psi4()*psi4()*psi4()) ;
00874   aa_quad_evol.update(aquad, jtime, the_time[jtime]) ;
00875 }
00876 
00877 const Scalar& Isol_hor::aa_quad() const {
00878 
00879   if (!aa_quad_evol.is_known(jtime) ) {
00880     Sym_tensor aa_dd (aa().up_down(met_gamt)) ;
00881     Scalar aquad (contract(aa_dd, 0, 1, aa(), 0, 1)*psi4()*psi4()*psi4()) ;
00882     aa_quad_evol.update(aquad, jtime, the_time[jtime]) ;
00883   } 
00884 
00885     return aa_quad_evol[jtime] ;   
00886 } 
00887 
00888 void Isol_hor::met_kerr_perturb() {
00889 
00890     Sym_tensor gamm (gam().cov()) ;
00891     Sym_tensor gamt (gamm / gamm(3,3)) ;
00892 
00893     Metric metgamt (gamt) ;
00894     met_gamt = metgamt ;
00895 
00896     Scalar psi_perturb (pow(gamm(3,3), 0.25)) ;
00897     psi_perturb.std_spectral_base() ;
00898     set_psi(psi_perturb) ;
00899 
00900     cout << "met_gamt" << endl << norme(met_gamt.cov()(1,1)) << endl 
00901      << norme(met_gamt.cov()(2,1)) << endl << norme(met_gamt.cov()(3,1)) 
00902      << endl << norme(met_gamt.cov()(2,2)) << endl 
00903      << norme(met_gamt.cov()(3,2)) << endl << norme(met_gamt.cov()(3,3)) 
00904      << endl ;
00905     cout << "determinant" << norme(met_gamt.determinant()) << endl ;
00906 
00907     hh_evol.update(met_gamt.con() - ff.con(), jtime, the_time[jtime]) ;
00908 }
00909 
00910 
00911 void Isol_hor::aa_kerr_ww(double mm, double aaa) {
00912   
00913   Scalar rr(mp) ;
00914   rr = mp.r ;
00915   Scalar cost (mp) ;
00916   cost = mp.cost ;
00917   Scalar sint (mp) ;
00918   sint = mp.sint ;
00919   
00920   // rbl
00921   Scalar rbl = rr + mm + (mm*mm - aaa*aaa) / (4*rr) ;
00922   
00923   // sigma inverse
00924   Scalar sigma_inv = 1. / (rbl*rbl + aaa*aaa*cost*cost) ;
00925   sigma_inv.set_domain(0) = 1. ;
00926 
00927   // ww perturbation
00928   Scalar ww_pert (mp) ;
00929   ww_pert = - 1*(mm*aaa*aaa*aaa*pow(sint, 4.)*cost) * sigma_inv ;
00930   ww_pert.set_spectral_va().set_base_r(0,R_CHEBPIM_P) ;
00931   for (int l=1; l<nz-1; l++)
00932     ww_pert.set_spectral_va().set_base_r(l,R_CHEB) ;
00933   ww_pert.set_spectral_va().set_base_r(nz-1,R_CHEBU) ;
00934   ww_pert.set_spectral_va().set_base_t(T_COSSIN_CI) ;
00935   ww_pert.set_spectral_va().set_base_p(P_COSSIN) ;
00936 
00937   // Quadratic part A^{ij]A_{ij}
00938   // Lichnerowicz choice
00939   //----------------------------
00940 
00941   // BY - BY
00942   Vector dw_by (mp, COV, mp.get_bvect_spher()) ;
00943   dw_by.set(1) = 0. ;
00944   dw_by.set(2) = 3 * aaa*mm*sint*sint*sint / rr ;
00945   dw_by.set(3) = 0. ;
00946   dw_by.set(2).set_spectral_va().set_base_r(0,R_CHEBPIM_P) ;
00947   for (int l=1; l<nz-1; l++)
00948     dw_by.set(2).set_spectral_va().set_base_r(l,R_CHEB) ;
00949   dw_by.set(2).set_spectral_va().set_base_r(nz-1,R_CHEBU) ;
00950   dw_by.set(2).set_spectral_va().set_base_t(T_COSSIN_SI) ;
00951   dw_by.set(2).set_spectral_va().set_base_p(P_COSSIN) ;
00952 
00953   Scalar aquad_1 = 2*contract(dw_by, 0, dw_by.up_down(ff), 0) * 
00954       gam_dd()(3,3) / gam_dd()(1,1) ;
00955   aquad_1.div_rsint_dzpuis(1) ;
00956   aquad_1.div_rsint_dzpuis(2) ;
00957   aquad_1.div_rsint_dzpuis(3) ;
00958   aquad_1.div_rsint_dzpuis(4) ;
00959 
00960   // BY - dw_pert
00961   Vector dw_pert(ww_pert.derive_con(ff)) ;
00962   Scalar aquad_2 = 4*contract(dw_by, 0, dw_pert, 0) *
00963       gam_dd()(3,3) / gam_dd()(1,1) ;
00964 
00965   aquad_2.div_rsint_dzpuis(3) ;
00966   aquad_2.div_rsint_dzpuis(4) ;
00967   aquad_2.div_rsint() ;
00968   aquad_2.div_rsint() ;
00969 
00970   // dw_pert - dw_pert
00971   Scalar aquad_3 = 2*contract(dw_pert, 0, dw_pert.up_down(ff), 0) *
00972       gam_dd()(3,3) / gam_dd()(1,1) ;
00973 
00974   aquad_3.div_rsint() ;
00975   aquad_3.div_rsint() ;
00976   aquad_3.div_rsint() ;
00977   aquad_3.div_rsint() ;
00978 
00979   // Total
00980   Scalar aquad = aquad_1 + aquad_2 + aquad_3 ;
00981 
00982   aquad.set_domain(0) = 0. ;
00983   Base_val sauve_base (aquad.get_spectral_va().get_base()) ;
00984   
00985   aquad = aquad * pow(gam_dd()(1,1), 2.) * pow(gam_dd()(3,3), -2.) ;
00986   aquad.set_spectral_va().set_base(sauve_base) ;
00987  
00988 /*
00989   cout << "norme de aquad" << endl << norme(aquad) << endl ;
00990   cout << "norme de aa_quad" << endl << norme(aa_quad()) << endl ;
00991 
00992   des_meridian (aquad, 0, 4, "aquad", 1) ;
00993   des_meridian (aa_quad(), 0, 4, "aa_quad()", 2) ;
00994   des_meridian (aa_quad()-aquad, 0, 4, "diff aa_quad", 3) ;
00995   arrete() ;
00996 */
00997 
00998   aa_quad_evol.update(aquad, jtime, the_time[jtime]) ;
00999   
01000 
01001   // Extrinsic curvature A^{ij} and A_{ij}
01002   // Dynamical choice
01003   // -------------------------------------
01004 
01005     Scalar s_r (ww_pert.derive_cov(ff)(2)) ;
01006     s_r = - s_r * gam().cov()(3,3) / gam().cov()(1,1) ;
01007     s_r.div_rsint() ;
01008 
01009     Scalar temp = dw_by(2) ;
01010     temp = - temp *  gam().cov()(3,3) / gam().cov()(1,1) ;
01011     temp.div_rsint_dzpuis(2) ;
01012 
01013     s_r = s_r + temp ;
01014     s_r.annule_domain(0) ;
01015 
01016     Scalar s_t (ww_pert.derive_cov(ff)(1)) ;
01017     s_t = s_t * gam().cov()(3,3) / gam().cov()(1,1)  ;
01018     s_t.div_rsint() ;
01019 
01020     temp = dw_by(1) ;
01021     temp = temp *  gam().cov()(3,3) / gam().cov()(1,1) ;
01022     temp.div_rsint_dzpuis(2) ;
01023 
01024     s_t = s_t + temp ;
01025     s_t.annule_domain(0) ;
01026 
01027 
01028     Vector ss (mp, CON, mp.get_bvect_spher()) ;
01029     ss.set(1) = s_r ;
01030     ss.set(2) = s_t ;
01031     ss.set(3) = 0. ;
01032 
01033     Sym_tensor aij (mp, CON, mp.get_bvect_spher()) ;
01034     aij.set(1,1) = 0. ;
01035     aij.set(2,1) = 0. ;
01036     aij.set(2,2) = 0. ;
01037     aij.set(3,3) = 0. ;
01038     aij.set(3,1) = s_r ;
01039     aij.set(3,1).div_rsint() ;
01040     aij.set(3,2) = s_t ;
01041     aij.set(3,2).div_rsint() ;
01042 
01043     Base_val base_31 (aij(3,1).get_spectral_va().get_base()) ;
01044     Base_val base_32 (aij(3,2).get_spectral_va().get_base()) ;
01045 
01046     aij.set(3,1) = aij(3,1) * pow(gam_dd()(1,1), 5./3.) 
01047                         * pow(gam_dd()(3,3), -5./3.) ;
01048     aij.set(3,1) = aij(3,1) * pow(psi(), -6.) ;
01049     aij.set(3,1).set_spectral_va().set_base(base_31) ;
01050     aij.set(3,2) = aij(3,2) * pow(gam_dd()(1,1), 5./3.) 
01051                         * pow(gam_dd()(3,3), -5./3.) ;
01052     aij.set(3,2) = aij(3,2) * pow(psi(), -6.) ;
01053     aij.set(3,2).set_spectral_va().set_base(base_32) ;
01054 
01055     /*
01056     cout << "norme de A(3,1)" << endl << norme(aij(3,1)) << endl ;
01057     cout << "norme de A(3,2)" << endl << norme(aij(3,2)) << endl ;
01058     
01059     cout << "norme de A_init(3,1)" << endl << norme(aa()(3,1)) << endl ;
01060     cout << "norme de A_init(3,2)" << endl << norme(aa()(3,2)) << endl ;
01061 
01062     des_meridian(aij(3,1), 0., 4., "aij(3,1)", 0) ;
01063     des_meridian(aa()(3,1), 0., 4., "aa_init(3,1)", 1) ;
01064     des_meridian(aa()(3,1)-aij(3,1), 0., 4., "diff_aa(3,1)", 2) ;
01065     des_meridian(aij(3,2), 0., 4., "aij(3,2)", 3) ;
01066     des_meridian(aa()(3,2), 0., 4., "aa_init(3,2)", 4) ;
01067     des_meridian(aa()(3,2)-aij(3,2), 0., 4., "diff_aa(3,2)", 5) ;
01068     arrete() ;
01069     */
01070     Sym_tensor hataij = aij*psi4()*psi()*psi() ;
01071     hata_evol.update(hataij, jtime, the_time[jtime]) ;
01072     Sym_tensor kij (aij) ;
01073     kij = kij * pow(gam().determinant(), -1./3.) ;
01074     kij.std_spectral_base() ;
01075     k_uu_evol.update(kij, jtime, the_time[jtime]) ;
01076     k_dd_evol.update(kij.up_down(gam()), jtime, the_time[jtime]) ;
01077 
01078 }
01079 
01080 double Isol_hor::axi_break() const {
01081 
01082     Vector phi (ff.get_mp(), CON, *(ff.get_triad()) ) ;
01083 
01084     Scalar tmp (ff.get_mp() ) ;
01085     tmp = 1 ;
01086     tmp.std_spectral_base() ;
01087     tmp.mult_rsint() ;
01088 
01089     phi.set(1) = 0. ;
01090     phi.set(2) = 0. ;
01091     phi.set(3) = tmp ; 
01092     
01093     Sym_tensor q_uu ( gam_uu() - gam().radial_vect() * gam().radial_vect() ) ;
01094     Sym_tensor q_dd ( q_uu.up_down(gam()) ) ;
01095                   
01096     Sym_tensor L_phi_q_dd ( q_dd.derive_lie( phi) ) ;
01097     Sym_tensor L_phi_q_uu ( contract(contract(L_phi_q_dd, 0, q_uu, 0), 0,  q_uu,0) ) ;
01098     
01099  
01100     Scalar integrand ( contract(  L_phi_q_dd, 0, 1, L_phi_q_uu, 0, 1 ) * darea_hor()  ) ;
01101     
01102     double axibreak = mp.integrale_surface(integrand, 1.0000000001)/ 
01103     (4 * M_PI * radius_hor()* radius_hor() ) ;
01104     
01105     return axibreak ;
01106 
01107 }
01108 
01109 double fonc_expansion(double rr, const Param& par_expansion) {
01110 
01111   Scalar expa = par_expansion.get_scalar(0) ;
01112   double theta = par_expansion.get_double(0) ;
01113   double phi = par_expansion.get_double(1) ;
01114  
01115   return expa.val_point(rr, theta, phi) ;
01116     
01117 }
01118 void Isol_hor::adapt_hor(double c_min, double c_max) {
01119 
01120   Scalar expa (expansion()) ;
01121   Scalar app_hor(mp) ;
01122   app_hor.annule_hard() ;
01123   int nitmax = 200 ; 
01124   int nit ; 
01125 
01126   double precis = 1.e-13 ;
01127 
01128   // Calculation of the radius of the apparent horizon for each (theta, phi)
01129   // -----------------------------------------------------------------------
01130 
01131   for (int nt=0; nt<mp.get_mg()->get_nt(1); nt++)
01132     for (int np=0; np<mp.get_mg()->get_np(1); np++) {
01133 
01134       double theta = mp.get_mg()->get_grille3d(1)->tet[nt] ;
01135       double phi = mp.get_mg()->get_grille3d(1)->phi[np] ;
01136 
01137       Param par_expansion ;
01138       par_expansion.add_scalar(expa, 0) ;
01139       par_expansion.add_double(theta, 0) ;
01140       par_expansion.add_double(phi, 1) ;
01141       double r_app_hor = zerosec_b(fonc_expansion, par_expansion, c_min, c_max, 
01142                  precis, nitmax, nit) ;
01143    
01144       app_hor.set_grid_point(1, np, nt, 0) = r_app_hor ;
01145     }
01146   
01147   // Transformation of the 3-metric and extrinsic curvature 
01148   // ------------------------------------------------------
01149   
01150   Scalar rr (mp) ;
01151   rr = mp.r ;
01152   
01153   Scalar trans_11 (mp) ;
01154   Scalar r_new (mp) ;
01155   r_new.annule_hard() ;
01156   //  trans_11.annule_hard() ;
01157   for (int l=1; l<nz; l++)
01158     for (int nr=0; nr<mp.get_mg()->get_nr(1); nr++)
01159       for (int nt=0; nt<mp.get_mg()->get_nt(1); nt++)
01160     for (int np=0; np<mp.get_mg()->get_np(1); np++) {
01161       r_new.set_grid_point(l, np, nt, nr) = rr.val_grid_point(l, np, nt, nr) -
01162         app_hor.val_grid_point(1, np, nt, 0) + 1 ;
01163       //      trans_11.set_grid_point(l, np, nt, nr) = 1. / 
01164       //  app_hor.val_grid_point(1, np, nt, 0) ;                 // !
01165     }
01166   r_new.std_spectral_base() ;
01167       
01168   Itbl comp(2) ;
01169   comp.set(0) = CON ;
01170   comp.set(1) = COV ;
01171 
01172   Scalar trans_12 (r_new.dsdt()) ;
01173   trans_12.div_r() ;
01174   Scalar trans_13 (r_new.stdsdp()) ;
01175   trans_13.div_r() ;                                        
01176   for (int nr=0; nr<mp.get_mg()->get_nr(1); nr++)
01177     for (int nt=0; nt<mp.get_mg()->get_nt(1); nt++)
01178       for (int np=0; np<mp.get_mg()->get_np(1); np++) {
01179     trans_12.set_grid_point(nz-1, np, nt, nr) = trans_12.val_grid_point(1, np, nt, nr) ;  
01180     trans_13.set_grid_point(nz-1, np, nt, nr) = trans_13.val_grid_point(1, np, nt, nr) ;  
01181       }
01182       
01183   // Transformation matrix
01184   Tensor trans (mp, 2, comp, mp.get_bvect_spher()) ;
01185   trans.set(1,1) = 1 ;
01186   trans.set(1,2) = 0;//trans_12 ;
01187   trans.set(1,3) = 0;//trans_13 ;
01188   trans.set(2,2) = 1. ;  
01189   trans.set(3,3) = 1. ;
01190   trans.set(2,1) = 0. ;
01191   trans.set(3,1) = 0. ;
01192   trans.set(3,2) = 0. ;
01193   trans.set(2,3) = 0. ;
01194   trans.std_spectral_base() ;
01195 
01196   cout << "trans(1,3)" << endl << norme(trans(1,3)) << endl ;
01197 
01198   Sym_tensor gamma_uu (gam().con()) ;
01199   Sym_tensor kk_uu (k_uu()) ;
01200 
01201   gamma_uu = contract(gamma_uu, 0, 1, trans * trans, 1, 3) ;
01202   kk_uu = contract(kk_uu, 0, 1, trans * trans, 1, 3) ;
01203   
01204   Sym_tensor copie_gamma (gamma_uu) ;
01205   Sym_tensor copie_kk (kk_uu) ;
01206 
01207   // dz_puis set to zero
01208   kk_uu.dec_dzpuis(2) ;
01209   for(int i=1; i<=3; i++)
01210     for(int j=i; j<=3; j++){
01211       kk_uu.set(i,j).annule_hard() ;
01212       gamma_uu.set(i,j).annule_hard() ;
01213     }
01214 
01215   copie_kk.dec_dzpuis(2) ;
01216 
01217   Scalar expa_trans(mp) ;
01218   expa_trans.annule_hard() ;
01219   expa.dec_dzpuis(2) ;
01220   
01221   /*
01222   copie_gamma.set(2,2).div_r() ;
01223   copie_gamma.set(2,2).div_r() ;
01224   copie_gamma.set(3,3).div_rsint() ;
01225   copie_gamma.set(3,3).div_rsint() ;
01226   copie_gamma.set(1,2).div_r() ;
01227   copie_gamma.set(1,3).div_rsint() ;
01228   //  gamma_uu.set(2,3).div_r() ;           
01229   //  gamma_uu.set(2,3).div_rsint() ;       
01230   */  
01231 
01232   //Importation
01233   for(int i=1; i<=3; i++)
01234     for(int j=i; j<=3; j++)
01235       for (int l=1; l<nz; l++)
01236     for (int nr=0; nr<mp.get_mg()->get_nr(1); nr++)
01237       for (int nt=0; nt<mp.get_mg()->get_nt(1); nt++)
01238         for (int np=0; np<mp.get_mg()->get_np(1); np++) {
01239           
01240           double theta = mp.get_mg()->get_grille3d(1)->tet[nt] ;
01241           double phi = mp.get_mg()->get_grille3d(1)->phi[np] ;
01242           double r_inv = rr.val_grid_point(l, np, nt, nr) +
01243         app_hor.val_grid_point(1, np, nt, 0) - 1. ;
01244                   
01245           gamma_uu.set(i,j).set_grid_point(l, np, nt, nr) = 
01246         copie_gamma(i,j).val_point(r_inv, theta, phi) ;
01247           kk_uu.set(i,j).set_grid_point(l, np, nt, nr) = 
01248         copie_kk(i,j).val_point(r_inv, theta, phi) ;
01249 
01250           expa_trans.set_grid_point(l, np, nt, nr) = expa.val_point(r_inv, theta, phi) ;
01251         }
01252   kk_uu.std_spectral_base() ;                 // Save the base?
01253   gamma_uu.std_spectral_base() ;
01254   expa_trans.std_spectral_base() ;
01255   
01256   for (int l=1; l<nz; l++)
01257     for (int nr=0; nr<mp.get_mg()->get_nr(1); nr++)
01258       for (int nt=0; nt<mp.get_mg()->get_nt(1); nt++)
01259     for (int np=0; np<mp.get_mg()->get_np(1); np++) {
01260       gamma_uu.set(1,2).set_grid_point(l,np,nt,nr) =  gamma_uu.set(1,2).val_grid_point(l,np,nt,nr) 
01261          / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01262         - 1 / rr.val_grid_point(l, np, nt, nr) ) ;
01263       gamma_uu.set(1,3).set_grid_point(l,np,nt,nr) =  gamma_uu.set(1,3).val_grid_point(l,np,nt,nr) 
01264          / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01265         - 1 / rr.val_grid_point(l, np, nt, nr) ) ;
01266       gamma_uu.set(2,2).set_grid_point(l,np,nt,nr) =  gamma_uu.set(2,2).val_grid_point(l,np,nt,nr) 
01267          / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01268         - 1 / rr.val_grid_point(l, np, nt, nr) ) 
01269           / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01270          - 1 / rr.val_grid_point(l, np, nt, nr) ) ;
01271       gamma_uu.set(2,3).set_grid_point(l,np,nt,nr) =  gamma_uu.set(2,3).val_grid_point(l,np,nt,nr) 
01272          / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01273         - 1 / rr.val_grid_point(l, np, nt, nr) ) 
01274           / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01275          - 1 / rr.val_grid_point(l, np, nt, nr) ) ;
01276       gamma_uu.set(3,3).set_grid_point(l,np,nt,nr) =  gamma_uu.set(3,3).val_grid_point(l,np,nt,nr) 
01277          / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01278         - 1 / rr.val_grid_point(l, np, nt, nr) ) 
01279           / (1 +app_hor.val_grid_point(1, np, nt, 0)/ rr.val_grid_point(l, np, nt, nr) 
01280          - 1 / rr.val_grid_point(l, np, nt, nr) ) ;
01281     }
01282       
01283   /*
01284   gamma_uu.set(2,2).mult_r() ;
01285   gamma_uu.set(2,2).mult_r() ;
01286   gamma_uu.set(3,3).mult_rsint() ;
01287   gamma_uu.set(3,3).mult_rsint() ;
01288   gamma_uu.set(1,2).mult_r() ;
01289   gamma_uu.set(1,3).mult_rsint() ;
01290   //  gamma_uu.set(2,3).mult_r() ;                
01291   //  gamma_uu.set(2,3).mult_rsint() ;            
01292   */
01293   
01294 
01295 
01296   cout << "gamma_uu(1,1)" << endl << norme(gamma_uu(1,1)) << endl ;
01297   cout << "gamma_uu(2,1)" << endl << norme(gamma_uu(2,1)) << endl ;
01298   cout << "gamma_uu(3,1)" << endl << norme(gamma_uu(3,1)) << endl ;
01299   cout << "gamma_uu(2,2)" << endl << norme(gamma_uu(2,2)) << endl ;
01300   cout << "gamma_uu(3,2)" << endl << norme(gamma_uu(3,2)) << endl ;
01301   cout << "gamma_uu(3,3)" << endl << norme(gamma_uu(3,3)) << endl ;
01302 
01303   kk_uu.inc_dzpuis(2) ;
01304   expa_trans.inc_dzpuis(2) ;
01305 
01306   Metric gamm (gamma_uu) ;
01307 
01308   // Updates
01309   gam_uu_evol.update(gamma_uu, jtime, the_time[jtime]) ;
01310   gam_dd_evol.update(gamm.cov(), jtime, the_time[jtime]) ;
01311   k_uu_evol.update(kk_uu, jtime, the_time[jtime]) ;
01312   
01313     if (p_psi4 != 0x0) {
01314         delete p_psi4 ;
01315         p_psi4 = 0x0 ;
01316     }
01317     if (p_ln_psi != 0x0) {
01318         delete p_ln_psi ;
01319         p_ln_psi = 0x0 ;
01320     }
01321     if (p_gamma != 0x0) {
01322         delete p_gamma ;
01323         p_gamma = 0x0 ;
01324     }
01325     if (p_tgamma != 0x0) {
01326         delete p_tgamma ;
01327         p_tgamma = 0x0 ;
01328     }
01329     if (p_hdirac != 0x0) {
01330       delete p_hdirac ;
01331       p_hdirac = 0x0 ;
01332     }
01333 
01334   k_dd_evol.downdate(jtime) ;
01335   psi_evol.downdate(jtime) ;
01336   hata_evol.downdate(jtime) ;
01337   aa_quad_evol.downdate(jtime) ;
01338   beta_evol.downdate(jtime) ;
01339   n_evol.downdate(jtime) ;
01340   hh_evol.downdate(jtime) ;
01341   
01342 
01343   Scalar new_expa (expansion()) ;
01344   //des_meridian(expa_trans, 1., 6., "Expansion trans", 1) ;
01345   //des_meridian(new_expa, 1.000000001, 6., "Expansion new", 2) ;
01346   //des_meridian(expa_trans- new_expa, 1.000000001, 4., "diff Expansion trans", 3) ;
01347   
01348 
01349 
01350 }
01351 

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