single_hor.C

00001 /*
00002  *  Methods of class single_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 single_hor_C[] = "$Header: /cvsroot/Lorene/C++/Source/Isol_hor/single_hor.C,v 1.1 2007/04/13 15:28:35 f_limousin Exp $" ;
00030 
00031 /*
00032  * $Id: single_hor.C,v 1.1 2007/04/13 15:28:35 f_limousin Exp $
00033  * $Log: single_hor.C,v $
00034  * Revision 1.1  2007/04/13 15:28:35  f_limousin
00035  * Lots of improvements, generalisation to an arbitrary state of
00036  * rotation, implementation of the spatial metric given by Samaya.
00037  *
00038  *
00039  * $Header: /cvsroot/Lorene/C++/Source/Isol_hor/single_hor.C,v 1.1 2007/04/13 15:28:35 f_limousin Exp $
00040  *
00041  */
00042 
00043 // C headers
00044 #include <stdlib.h>
00045 #include <assert.h>
00046 
00047 // Lorene headers
00048 #include "param.h"
00049 #include "utilitaires.h"
00050 #include "time_slice.h"
00051 #include "isol_hor.h"
00052 #include "tensor.h"
00053 #include "metric.h"
00054 #include "evolution.h"
00055 //#include "graphique.h"
00056 
00057 //--------------//
00058 // Constructors //
00059 //--------------//
00060 // Standard constructor
00061 // --------------------
00062 
00063 Single_hor::Single_hor(Map_af& mpi) : 
00064   mp(mpi), nz(mpi.get_mg()->get_nzone()), radius ((mpi.get_alpha())[0]), 
00065   omega(0),regul(0),
00066   n_auto(mpi), n_comp(mpi), nn(mpi), 
00067   psi_auto(mpi), psi_comp(mpi), psi(mpi),
00068   dn(mpi, COV, mpi.get_bvect_spher()), 
00069   dpsi(mpi, COV, mpi.get_bvect_spher()),
00070   beta_auto(mpi, CON, mpi.get_bvect_spher()), 
00071   beta_comp(mpi, CON, mpi.get_bvect_spher()),
00072   beta(mpi, CON, mpi.get_bvect_spher()),
00073   aa_auto(mpi, CON, mpi.get_bvect_spher()), 
00074   aa_comp(mpi, CON, mpi.get_bvect_spher()),
00075   aa(mpi, CON, mpi.get_bvect_spher()),
00076   tgam(mpi.flat_met_spher()), 
00077   ff(mpi.flat_met_spher()), 
00078   hh(mpi, CON, mpi.get_bvect_spher()),
00079   gamt_point(mpi, CON, mpi.get_bvect_spher()),
00080   trK(mpi), trK_point(mpi), decouple(mpi){
00081   
00082   hh.set_etat_zero() ;
00083   set_der_0x0() ;
00084 }         
00085 
00086 // Copy constructor
00087 // ----------------
00088 
00089 Single_hor::Single_hor(const Single_hor& singlehor_in) 
00090     : mp(singlehor_in.mp),
00091       nz(singlehor_in.nz),
00092       radius(singlehor_in.radius),
00093       omega(singlehor_in.omega),
00094       regul(singlehor_in.regul),      
00095       n_auto(singlehor_in.n_auto),
00096       n_comp(singlehor_in.n_comp),
00097       nn(singlehor_in.nn),
00098       psi_auto(singlehor_in.psi_auto),
00099       psi_comp(singlehor_in.psi_comp),
00100       psi(singlehor_in.psi),
00101       dn(singlehor_in.dn),
00102       dpsi(singlehor_in.dpsi),
00103       beta_auto(singlehor_in.beta_auto),
00104       beta_comp(singlehor_in.beta_comp),
00105       beta(singlehor_in.beta),
00106       aa_auto(singlehor_in.aa_auto),
00107       aa_comp(singlehor_in.aa_comp),
00108       aa(singlehor_in.aa),
00109       tgam(singlehor_in.tgam),
00110       ff(singlehor_in.ff),
00111       hh(singlehor_in.hh),
00112       gamt_point(singlehor_in.gamt_point),
00113       trK(singlehor_in.trK),
00114       trK_point(singlehor_in.trK_point),
00115       decouple(singlehor_in.decouple){
00116 
00117   set_der_0x0() ;
00118 }
00119 
00120 // Constructor from a file
00121 // -----------------------
00122 
00123 Single_hor::Single_hor(Map_af& mpi, FILE* fich)
00124   : mp(mpi), nz(mpi.get_mg()->get_nzone()), radius ((mpi.get_alpha())[0]), 
00125     omega(0),regul(0), 
00126     n_auto(mpi, *(mpi.get_mg()), fich), n_comp(mpi), 
00127     nn(mpi), 
00128     psi_auto(mpi, *(mpi.get_mg()), fich), psi_comp(mpi), 
00129     psi(mpi),
00130     dn(mpi, COV, mpi.get_bvect_spher()), 
00131     dpsi(mpi, COV, mpi.get_bvect_spher()),
00132     beta_auto(mpi, mpi.get_bvect_spher(), fich), 
00133     beta_comp(mpi, CON, mpi.get_bvect_spher()),
00134     beta(mpi, CON, mpi.get_bvect_spher()),
00135     aa_auto(mpi, CON, mpi.get_bvect_spher()), 
00136     aa_comp(mpi, CON, mpi.get_bvect_spher()),
00137     aa(mpi, CON, mpi.get_bvect_spher()),
00138     tgam(mpi.flat_met_spher()), 
00139     ff(mpi.flat_met_spher()), 
00140     hh(mpi, CON, mpi.get_bvect_spher()),
00141     gamt_point(mpi, CON, mpi.get_bvect_spher()),
00142     trK(mpi), trK_point(mpi), decouple(mpi){
00143   
00144   fread_be(&omega, sizeof(double), 1, fich) ;
00145 
00146  // tgam, gamt_point, trK, trK_point
00147 
00148   Sym_tensor met_file (mp, mp.get_bvect_spher(), fich) ;
00149   tgam = met_file ;
00150 
00151   Sym_tensor gamt_point_file (mp, mp.get_bvect_spher(), fich) ;
00152   gamt_point = gamt_point_file ;
00153   
00154   Scalar trK_file (mp, *(mp.get_mg()), fich) ;
00155   trK = trK_file ;
00156   
00157   Scalar trK_point_file (mp, *(mp.get_mg()), fich) ;
00158   trK_point = trK_point_file ;
00159   
00160   set_der_0x0() ;
00161   hh = tgam.con() - ff.con() ;
00162 
00163 }
00164 
00165                 //--------------//
00166                 //  Destructor  //
00167                 //--------------//
00168 
00169 Single_hor::~Single_hor(){
00170 
00171   Single_hor::del_deriv() ;
00172 }
00173 
00174 
00175                     //-----------------------//
00176                     // Mutators / assignment //
00177                     //-----------------------//
00178 
00179 void Single_hor::operator=(const Single_hor& singlehor_in) {
00180 
00181  mp = singlehor_in.mp ;
00182  nz = singlehor_in.nz ;
00183  radius = singlehor_in.radius ;
00184  omega = singlehor_in.omega ;
00185  regul = singlehor_in.regul ;
00186  n_auto = singlehor_in.n_auto ;
00187  n_comp = singlehor_in.n_comp ;
00188  nn = singlehor_in.nn ;
00189  psi_auto = singlehor_in.psi_auto ;
00190  psi_comp = singlehor_in.psi_comp ;
00191  psi = singlehor_in.psi ;
00192  dn = singlehor_in.dn ;
00193  dpsi = singlehor_in.dpsi ;
00194  beta_auto = singlehor_in.beta_auto ;
00195  beta_comp = singlehor_in.beta_comp ;
00196  beta = singlehor_in.beta ;
00197  aa_auto = singlehor_in.aa_auto ;
00198  aa_comp = singlehor_in.aa_comp ;
00199  aa = singlehor_in.aa ;
00200  tgam = singlehor_in.tgam ;
00201  ff = singlehor_in.ff ;
00202  hh = singlehor_in.hh ;
00203  gamt_point = singlehor_in.gamt_point ;
00204  trK = singlehor_in.trK ;
00205  trK_point = singlehor_in.trK_point ;
00206  decouple = singlehor_in.decouple ;
00207 }
00208 
00209 
00210                     //---------------------//
00211                     //  Memory management  //
00212                     //---------------------//
00213 
00214 void Single_hor::del_deriv() const {
00215 
00216     if (p_psi4 != 0x0) delete p_psi4 ; 
00217     if (p_gam != 0x0) delete p_gam ; 
00218     if (p_k_dd != 0x0) delete p_k_dd ; 
00219     
00220     set_der_0x0() ;
00221 }
00222 
00223 
00224 void Single_hor::set_der_0x0() const {
00225 
00226     p_psi4 = 0x0 ; 
00227     p_gam = 0x0 ; 
00228     p_k_dd = 0x0 ; 
00229     
00230 }
00231 
00232                 //--------------------------//
00233                 //      Save in a file      //
00234                 //--------------------------//
00235 
00236 
00237 void Single_hor::sauve(FILE* fich) const {
00238 
00239   n_auto.sauve(fich) ;
00240   psi_auto.sauve(fich) ;
00241   beta_auto.sauve(fich) ;
00242   
00243   fwrite_be (&omega, sizeof(double), 1, fich) ;
00244   
00245   tgam.con().sauve(fich) ;
00246   gamt_point.sauve(fich) ;    
00247   trK.sauve(fich) ;
00248   trK_point.sauve(fich) ;
00249 }
00250 
00251 // Accessors
00252 // ---------
00253 
00254 const Scalar& Single_hor::get_n_auto() const {
00255 
00256     return n_auto ;   
00257 } 
00258 
00259 const Scalar& Single_hor::get_n_comp() const {
00260 
00261     return n_comp ;   
00262 } 
00263 const Scalar& Single_hor::get_nn() const {
00264 
00265     return nn ;   
00266 } 
00267 
00268 const Scalar& Single_hor::get_psi_auto() const {
00269 
00270     return psi_auto ;   
00271 } 
00272 
00273 const Scalar& Single_hor::get_psi_comp() const {
00274 
00275     return psi_comp ;   
00276 } 
00277 const Scalar& Single_hor::get_psi() const {
00278 
00279     return psi ;   
00280 } 
00281 const Scalar& Single_hor::get_psi4() const {
00282 
00283   if (p_psi4 == 0x0)  {
00284     
00285     p_psi4 = new Scalar( pow( psi, 4.) ) ; 
00286     p_psi4->std_spectral_base() ;
00287   }
00288   
00289   return *p_psi4 ;
00290 } 
00291 
00292 const Vector& Single_hor::get_dn() const {
00293 
00294   return dn ;   
00295 } 
00296 
00297 const Vector& Single_hor::get_dpsi() const {
00298 
00299   return dpsi ;   
00300 } 
00301 
00302 const Vector& Single_hor::get_beta_auto() const {
00303 
00304   return beta_auto ;   
00305 } 
00306 
00307 const Vector& Single_hor::get_beta_comp() const {
00308 
00309   return beta_comp ;   
00310 
00311 } 
00312 const Vector& Single_hor::get_beta() const {
00313 
00314   return beta ;   
00315 } 
00316 
00317 const Sym_tensor& Single_hor::get_aa_auto() const {
00318 
00319   return aa_auto ;   
00320 } 
00321 
00322 const Sym_tensor& Single_hor::get_aa_comp() const {
00323 
00324   return aa_comp ;   
00325 
00326 } 
00327 const Sym_tensor& Single_hor::get_aa() const {
00328 
00329   return aa ;   
00330 
00331 } 
00332 const Metric& Single_hor::get_gam() const {
00333 
00334   if (p_gam == 0x0) {
00335     p_gam = new Metric( get_psi4()*tgam.cov() ) ; 
00336   }
00337   
00338   return *p_gam ; 
00339 } 
00340 
00341 const Sym_tensor& Single_hor::get_k_dd() const {
00342 
00343   if (p_k_dd == 0x0)  {
00344     
00345     Sym_tensor temp (aa/get_psi4()+1./3.*trK*get_gam().con()) ;
00346     
00347     p_k_dd = new Sym_tensor( temp.up_down(get_gam()) ) ; 
00348         p_k_dd->std_spectral_base() ;
00349   }
00350   
00351   return *p_k_dd ;
00352 } 
00353 
00354 
00355 void Single_hor::set_psi_auto(const Scalar& psi_in) {
00356 
00357   psi_auto = psi_in ;    
00358 }
00359 void Single_hor::set_n_auto(const Scalar& n_in) {
00360 
00361   n_auto = n_in ;    
00362 }
00363 void Single_hor::set_beta_auto(const Scalar& beta_in) {
00364 
00365   beta_auto = beta_in ;    
00366 }
00367 void Single_hor::set_aa_auto(const Scalar& aa_in) {
00368 
00369   aa_auto = aa_in ;    
00370 }
00371 void Single_hor::set_aa_comp(const Scalar& aa_in) {
00372 
00373   aa_comp = aa_in ;    
00374 }
00375 void Single_hor::set_aa(const Scalar& aa_in) {
00376 
00377   aa = aa_in ;    
00378 }
00379 
00380 
00381 // Import the lapse from the companion (Bhole case)
00382 
00383 void Single_hor::n_comp_import(const Single_hor& comp) {
00384 
00385     Scalar temp (mp) ;
00386     temp.import(comp.n_auto) ;
00387     temp.std_spectral_base() ;
00388     n_comp = temp ;
00389     nn = temp + n_auto ;
00390      
00391     Vector dn_comp (mp, COV, mp.get_bvect_cart()) ;
00392     dn_comp.set_etat_qcq() ;
00393     Vector auxi (comp.n_auto.derive_cov(comp.ff)) ;
00394     auxi.dec_dzpuis(2) ;
00395     auxi.change_triad(auxi.get_mp().get_bvect_cart()) ;
00396     for (int i=1 ; i<=3 ; i++){
00397       if (auxi(i).get_etat() != ETATZERO)
00398         auxi.set(i).raccord(3) ;
00399     }
00400 
00401     auxi.change_triad(mp.get_bvect_cart()) ;
00402     assert ( *(auxi.get_triad()) == *(dn_comp.get_triad())) ;
00403 
00404     for (int i=1 ; i<=3 ; i++){
00405     dn_comp.set(i).import(auxi(i)) ;
00406     dn_comp.set(i).set_spectral_va().set_base(auxi(i).get_spectral_va().
00407                           get_base()) ;
00408     }
00409     dn_comp.inc_dzpuis(2) ;
00410     dn_comp.change_triad(mp.get_bvect_spher()) ;
00411 
00412     dn = n_auto.derive_cov(ff) + dn_comp ;
00413 }
00414 
00415 // Import the conformal factor from the companion (Bhole case)
00416 
00417 void Single_hor::psi_comp_import(const Single_hor& comp) {
00418 
00419     Scalar temp (mp) ;
00420     temp.import(comp.psi_auto) ;
00421     temp.std_spectral_base() ;
00422     psi_comp = temp ;
00423     psi = temp + psi_auto ;
00424     
00425     Vector dpsi_comp (mp, COV, mp.get_bvect_cart()) ;
00426     dpsi_comp.set_etat_qcq() ;
00427     Vector auxi (comp.psi_auto.derive_cov(comp.ff)) ;
00428     auxi.dec_dzpuis(2) ;
00429     auxi.change_triad(auxi.get_mp().get_bvect_cart()) ;
00430     for (int i=1 ; i<=3 ; i++){
00431       if (auxi(i).get_etat() != ETATZERO)
00432         auxi.set(i).raccord(3) ;
00433     }
00434 
00435     auxi.change_triad(mp.get_bvect_cart()) ;
00436     assert ( *(auxi.get_triad()) == *(dpsi_comp.get_triad())) ;
00437 
00438     for (int i=1 ; i<=3 ; i++){
00439       dpsi_comp.set(i).import(auxi(i)) ;
00440       dpsi_comp.set(i).set_spectral_va().set_base(auxi(i).get_spectral_va().
00441                           get_base()) ;
00442     }
00443     dpsi_comp.inc_dzpuis(2) ;
00444     dpsi_comp.change_triad(mp.get_bvect_spher()) ;
00445     /*    
00446     Vector dpsi_comp_zec (psi_comp().derive_cov(ff)) ;
00447     for (int i=1 ; i<=3 ; i++)
00448       for (int l=nz-1 ; l<=nz-1 ; l++) {
00449     if (dpsi_comp.set(i).get_etat() == ETATQCQ)
00450       dpsi_comp.set(i).set_domain(l) = dpsi_comp_zec(i).domain(l) ;
00451       }
00452     */
00453     
00454     dpsi = psi_auto.derive_cov(ff) + dpsi_comp ;
00455 
00456 }
00457 
00458 void Single_hor::beta_comp_import(const Single_hor& comp) {
00459 
00460     Vector tmp_vect (mp, CON, mp.get_bvect_cart()) ;
00461     Vector shift_comp (comp.beta_auto) ;
00462     shift_comp.change_triad(comp.mp.get_bvect_cart()) ;
00463     shift_comp.change_triad(mp.get_bvect_cart()) ;
00464     assert (*(shift_comp.get_triad()) == *(tmp_vect.get_triad())) ;
00465 
00466     tmp_vect.set(1).import(shift_comp(1)) ;
00467     tmp_vect.set(2).import(shift_comp(2)) ;
00468     tmp_vect.set(3).import(shift_comp(3)) ;
00469     tmp_vect.std_spectral_base() ;
00470     tmp_vect.change_triad(mp.get_bvect_spher()) ;
00471     
00472     beta_comp = tmp_vect ;
00473     beta = beta_auto + beta_comp ;
00474 }
00475 
00476 //Initialisation to Schwartzchild
00477 void Single_hor::init_bhole () {
00478     
00479   Scalar auxi(mp) ;
00480     
00481     // Initialisation of the lapse different of zero on the horizon
00482     // at the first step
00483     auxi = 0.5 - 0.5/mp.r ;
00484     auxi.annule(0, 0);
00485     auxi.set_dzpuis(0) ;
00486     
00487     Scalar temp(mp) ;
00488     temp = auxi;
00489     temp.std_spectral_base() ;
00490     temp.raccord(1) ;
00491     n_auto = temp ;
00492 
00493     temp = 0.5 ;
00494     temp.std_spectral_base() ;
00495     n_comp = temp ;
00496     nn = n_auto  ;
00497   
00498     auxi = 0.5 + radius/mp.r ;
00499     auxi.annule(0, 0);
00500     auxi.set_dzpuis(0) ;
00501     temp = auxi;
00502     temp.std_spectral_base() ;
00503     temp.raccord(1) ;
00504     psi_auto = temp ;
00505 
00506     temp = 0.5 ;
00507     temp.std_spectral_base() ;
00508     psi_comp = temp ;
00509     psi = psi_auto + psi_comp ;
00510 
00511     dn = nn.derive_cov(ff) ;
00512     dpsi = psi.derive_cov(ff) ;
00513     
00514     Vector temp_vect1(mp, CON, mp.get_bvect_spher()) ;
00515     temp_vect1.set(1) = 0.0/mp.r/mp.r ;
00516     temp_vect1.set(2) = 0. ;
00517     temp_vect1.set(3) = 0. ;
00518     temp_vect1.std_spectral_base() ;
00519 
00520     Vector temp_vect2(mp, CON, mp.get_bvect_spher()) ;
00521     temp_vect2.set_etat_zero() ;    
00522 
00523     beta_auto = temp_vect1 ;
00524     beta_comp = temp_vect2 ;
00525     beta = temp_vect1 ;    
00526 
00527 }
00528 
00529 void Single_hor::init_met_trK() {
00530  
00531   Metric flat (mp.flat_met_spher()) ;
00532   tgam = flat ;
00533 
00534   gamt_point.set_etat_zero() ;
00535   trK.set_etat_zero() ;
00536   trK_point.set_etat_zero() ;
00537  
00538 }
00539 
00540 
00541 void Single_hor::init_bhole_seul () {
00542     
00543     Scalar auxi(mp) ;
00544     
00545     auxi = (1-radius/mp.r)/(1+radius/mp.r) ;
00546     auxi.annule(0, 0);
00547     auxi.set_outer_boundary((*mp.get_mg()).get_nzone(), 1.) ;
00548     auxi.set_dzpuis(0) ;
00549 
00550     Scalar temp(mp) ;
00551     temp = auxi;
00552     temp.std_spectral_base() ;
00553     temp.raccord(1) ;
00554     n_auto = temp;
00555 
00556     temp.set_etat_zero() ;
00557     n_comp = temp ;
00558     nn = temp ; 
00559     
00560     auxi = 1 + radius/mp.r ;
00561     auxi.annule(0, 0);
00562     auxi.set_outer_boundary((*mp.get_mg()).get_nzone(), 1.) ;
00563     auxi.set_dzpuis(0) ;
00564   
00565     temp = auxi;
00566     temp.std_spectral_base() ;
00567     temp.raccord(1) ;
00568     psi_auto = temp ;
00569     temp.set_etat_zero() ;
00570     psi_comp = temp ;
00571     psi = temp ;
00572     
00573     dn = nn.derive_cov(ff) ;
00574     dpsi = psi.derive_cov(ff) ;
00575 
00576     Vector temp_vect(mp, CON, mp.get_bvect_spher()) ;
00577     temp_vect.set_etat_zero() ;
00578     beta_auto = temp_vect ;
00579     beta_comp = temp_vect ;
00580     beta = temp_vect ;      
00581 
00582 }          
00583 
00584 
00585 

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