isol_hole.C

00001 /*
00002  * Methods of class Isol_hole
00003  *
00004  * (see file isol_hole.h for documentation)
00005  */
00006 
00007 /*
00008  *   Copyright (c) 2009 Nicolas Vasset
00009 
00010  *   This file is part of LORENE.
00011  *
00012  *   LORENE is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU General Public License as published by
00014  *   the Free Software Foundation; either version 2 of the License, or
00015  *   (at your option) any later version.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 
00029 // Headers C
00030 #include "math.h"
00031 
00032 // Headers Lorene
00033 #include "isol_hole.h"
00034 #include "spheroid.h"
00035 #include "excision_surf.h"
00036 #include "excision_hor.h"
00037 #include "utilitaires.h"
00038 #include "param.h"
00039 #include "unites.h"
00040 #include "proto.h"
00041 #include "map.h"
00042 #include "scalar.h"
00043 
00044     // Fundamental constants and units
00045     // -------------------------------
00046     using namespace Unites ;
00047 
00048                 //--------------//
00049                 // Constructors //
00050                 //--------------//
00051 
00052 
00053 // Standard constructor
00054 // --------------------
00055 Isol_hole::Isol_hole (const Map& mpi, double Omega_i, bool NorKappa_i, Scalar NoK_i, bool isCF_i)
00056   : mp(mpi), 
00057                    Omega(Omega_i),
00058            NorKappa(NorKappa_i),
00059            boundNoK(NoK_i),
00060            isCF (isCF_i),
00061            lapse(mpi),
00062            conf_fact(mpi),
00063            shift(mpi, CON, mpi.get_bvect_spher()),
00064            hij(mpi, CON, mpi.get_bvect_spher()),
00065            hatA(mpi, CON, mpi.get_bvect_spher()){
00066            
00067 
00068 
00069 
00070 
00071   assert (boundNoK.get_mp() == mpi); // Check if this is not too strong a condition
00072     
00073       // Pointers of derived quantities initialized to zero : 
00074     set_der_0x0() ;
00075 
00076   // Initializing primary quantities.
00077  
00078     lapse = 1. ;
00079     conf_fact = 1. ;
00080     shift.set_etat_zero() ;
00081     hij.set_etat_zero();
00082     hatA.set_etat_zero();
00083 }
00084      
00085 // Copy constructor
00086 // ----------------
00087 Isol_hole::Isol_hole(const Isol_hole& ih) 
00088          : mp(ih.mp), 
00089            Omega(ih.Omega),
00090            NorKappa(ih.NorKappa),
00091            boundNoK(ih.boundNoK),
00092            isCF (ih.isCF),
00093            lapse(ih.lapse),
00094            conf_fact(ih.conf_fact),
00095            shift(ih.shift),
00096            hij(ih.hij),
00097            hatA(ih.hatA){
00098            
00099     set_der_0x0() ;
00100 
00101 }
00102 
00103 // Constructor from a file
00104 // -----------------------
00105 Isol_hole::Isol_hole(const Map& mpi, double Omega_i, bool NorKappa_i, Scalar NoK_i, bool isCF_i, FILE* fich)
00106          : mp(mpi),
00107            Omega(Omega_i),
00108            NorKappa(NorKappa_i),
00109            boundNoK(NoK_i),
00110            isCF(isCF_i),
00111                    lapse(mpi,*(mpi.get_mg()), fich), 
00112            conf_fact(mpi,*(mpi.get_mg()), fich), 
00113            shift(mpi, mpi.get_bvect_spher(), fich),
00114            hij(mpi, mpi.get_bvect_spher(), fich),
00115            hatA(mpi, mpi.get_bvect_spher(), fich){
00116 
00117 
00118 
00119     // Pointers of derived quantities initialized to zero 
00120     // --------------------------------------------------
00121     set_der_0x0() ;
00122     
00123 }
00124 
00125                 //------------//
00126                 // Destructor //
00127                 //------------//
00128 
00129 Isol_hole::~Isol_hole(){
00130 
00131     del_deriv() ; 
00132 
00133 }
00134 
00135 
00136             //----------------------------------//
00137             // Management of derived quantities //
00138             //----------------------------------//
00139 
00140 void Isol_hole::del_deriv() const {
00141   if (p_hor != 0x0) delete p_hor ;
00142   if (p_adm_mass != 0x0) delete p_adm_mass ;
00143   if (p_komar_angmom != 0x0) delete p_komar_angmom ;
00144   if (p_virial_residue != 0x0) delete p_virial_residue ;
00145     Isol_hole::set_der_0x0() ; 
00146 }               
00147 
00148 
00149 void Isol_hole::set_der_0x0() const {
00150   p_hor = 0x0;
00151     p_adm_mass = 0x0 ; 
00152     p_komar_angmom = 0x0 ;
00153     p_virial_residue = 0x0 ;
00154 }               
00155 
00156 
00157 
00158                 //--------------//
00159                 //  Assignment  //
00160                 //--------------//
00161 
00162 // Assignment to another Isol_hole
00163 // ----------------------------
00164 void Isol_hole::operator=(const Isol_hole& ih) {
00165 
00166     assert( &(ih.mp) == &mp ) ;         // Same mapping  
00167     Omega = ih.Omega;
00168     NorKappa = ih.NorKappa ;
00169     boundNoK = ih.boundNoK ;
00170     isCF = ih.isCF ;
00171     lapse = ih.lapse ;
00172     conf_fact = ih.conf_fact ;
00173     shift = ih.shift ;
00174     hij = ih.hij ;
00175     hatA = ih.hatA ;
00176 
00177     del_deriv() ;  // Deletes all derived quantities
00178 
00179 }   
00180 
00181                 //--------------//
00182                 //    Outputs   //
00183                 //--------------//
00184 
00185 // Save in a file
00186 // --------------
00187 void Isol_hole::sauve(FILE* fich) const {
00188 
00189     lapse.sauve(fich) ;
00190     conf_fact.sauve(fich) ;
00191     shift.sauve(fich);
00192     hij.sauve(fich);
00193     hatA.sauve(fich);}
00194 
00195 
00196 // Prints out maximal errors in Einstein equations for the obtained metric fields 
00197 
00198 void Isol_hole::Einstein_errors() {
00199 
00200 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00201  const Metric_flat& mets = (*map).flat_met_spher() ; 
00202   
00203   Sym_tensor gamtcon = mets.con() + hij;
00204   Metric gamt(gamtcon);
00205   Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00206   gamcon.std_spectral_base();
00207   Metric gam(gamcon);
00208   Sym_tensor k_uu = hatA/(pow(conf_fact,10)) ;
00209   k_uu.std_spectral_base();
00210   k_uu.dec_dzpuis(k_uu(1,1).get_dzpuis()); //WTF?
00211   Sym_tensor k_dd = k_uu.up_down(gam);
00212 
00213   Scalar TrK3 = k_uu.trace(gam);
00214  
00215   // Hamiltonian constraint
00216   //-----------------------
00217   Scalar ham_constr = gam.ricci_scal() ;
00218   ham_constr.dec_dzpuis(3) ; // To check
00219   ham_constr +=  TrK3*TrK3 - contract(k_uu, 0, 1, k_dd, 0, 1) ;
00220   maxabs(ham_constr, "Hamiltonian constraint: ") ;
00221  
00222   // Momentum constraint
00223   //-------------------
00224   Vector mom_constr = k_uu.divergence(gam)  - TrK3.derive_con(gam) ;
00225   mom_constr.dec_dzpuis(2) ; // To check
00226   maxabs(mom_constr, "Momentum constraint: ") ;
00227 
00228   // Evolution equations
00229   //--------------------
00230   Sym_tensor evol_eq = lapse*gam.ricci() 
00231     - lapse.derive_cov(gam).derive_cov(gam);
00232   evol_eq.dec_dzpuis() ;
00233   evol_eq += k_dd.derive_lie(shift) ;
00234   evol_eq.dec_dzpuis(2) ; // To check
00235   evol_eq += lapse*(TrK3*k_dd - 2*contract(k_dd, 1, k_dd.up(0, gam), 0) ) ;
00236   maxabs(evol_eq, "Evolution equations: ") ;
00237     
00238   return; 
00239 }
00240 
00241 
00242 
00243 
00244 
00245                   //----------------------------//
00246                   //  Accessors/ Derived data   //
00247                   //----------------------------//
00248 
00249 // Computation of the Spheroid corresponding to the black hole horizon
00250 
00251 Spheroid Isol_hole::hor() {
00252  const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00253   const Mg3d* mgrid = (*map).get_mg();
00254     
00255   // Construct angular grid for h(theta,phi) 
00256   const Mg3d* g_angu = (*mgrid).get_angu_1dom() ;
00257 
00258   const Coord& rr = (*map).r;
00259    Scalar rrr (*map) ; 
00260   rrr = rr ; 
00261   rrr.std_spectral_base();  
00262   assert((rrr.val_grid_point(1,0,0,0) - 1.) <= 1.e-9); // For now the code handles only horizons at r=1, corresponding to the first shell inner boundary. This test assures this is the case with our mapping.
00263  
00264   // Angular mapping defined for one domain (argument of spheroid Class)
00265   //--------------------------------------------------------------------
00266 
00267   double r_limits2[] = {rrr.val_grid_point(1,0,0,0), rrr.val_grid_point(2,0,0,0)} ; 
00268   const Map_af map_2(*g_angu, r_limits2);
00269 
00270   //Full 3-metric and extrrinsic curvature 
00271  const Metric_flat& mets = (*map).flat_met_spher() ; 
00272   
00273   Sym_tensor gamtcon = mets.con() + hij;
00274   Metric gamt(gamtcon);
00275   Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00276   Metric gam(gamcon);
00277 
00278 
00279   Sym_tensor kuu = hatA/pow(conf_fact,10) ;
00280   kuu.std_spectral_base();
00281   Sym_tensor kdd = kuu.up_down(gam);
00282  
00283   //---------------------------------------------------------
00284   // Construction of the spheroid associated with those data 
00285   //--------------------------------------------------------
00286   double hor_posd = rrr.val_grid_point(1,0,0,0);
00287   Scalar hor_pos(map_2); hor_pos = hor_posd; hor_pos.std_spectral_base();
00288   Spheroid hor_loc(hor_pos, gam, kdd);
00289   return hor_loc; 
00290 }
00291 
00292 // Computation of the ADM mass of the BH spacetime
00293 double Isol_hole::adm_mass() {
00294  const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00295  const Metric_flat& mets = (*map).flat_met_spher() ; 
00296   
00297   Sym_tensor gamtcon = mets.con() + hij;
00298   Metric gamt(gamtcon);
00299   Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00300   Metric gam(gamcon);
00301 
00302   Scalar detgam = sqrt((gam.cov())(2,2)*(gam.cov())(3,3) - (gam.cov())(2,3)*(gam.cov())(3,2));
00303     detgam.std_spectral_base();  
00304     Vector corr_adm =  - (0.125*contract(gamt.cov().derive_con(mets),1,2));
00305     Scalar admintegr = conf_fact.dsdr() + corr_adm(1);
00306  
00307     double M_ADM = - (1/(2.*3.1415927*ggrav))*(*map).integrale_surface_infini(admintegr*detgam);
00308   return M_ADM;
00309 }
00310 
00311 
00312 // Computation of the Komar angular momentum w.r.t. assumed rotational symmetry
00313 double Isol_hole:: komar_angmom() {
00314 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00315  const Metric_flat& mets = (*map).flat_met_spher() ; 
00316   
00317   Sym_tensor gamtcon = mets.con() + hij;
00318   Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00319   gamcon.std_spectral_base();
00320   Metric gam(gamcon);
00321   Sym_tensor k_uu = hatA/(pow(conf_fact,10));
00322   k_uu.std_spectral_base();
00323   k_uu.dec_dzpuis(k_uu(1,1).get_dzpuis()); //WTF?
00324   Sym_tensor k_dd = k_uu.up_down(gam);
00325  
00326   Scalar detgam = sqrt((gam.cov())(2,2)*(gam.cov())(3,3) - (gam.cov())(2,3)*(gam.cov())(3,2));
00327   detgam.std_spectral_base();
00328     Scalar contraction = k_dd(1,3); contraction.mult_r_dzpuis(2); contraction.mult_sint();
00329     double angu_komar = - (1/(8.*3.1415927*ggrav))*(*map).integrale_surface_infini(detgam*contraction);
00330 
00331   return angu_komar;
00332 }
00333 
00334 
00335 // Computation of the Virial residual, as rescaled difference at infinity
00336 // between the ADM mass and the Komar integral associated to the mass
00337 
00338 double Isol_hole::virial_residue() {
00339   const Mg3d* mgrid = mp.get_mg();
00340   const int nz = (*mgrid).get_nzone();  // Number of domains
00341   Valeur** devel_psi (conf_fact.asymptot(1)) ;
00342     Valeur** devel_n (lapse.asymptot(1)) ;
00343     
00344 
00345     double erreur = (2*(*devel_psi[1])(nz-1, 0, 0, 0)
00346              + (*devel_n[1])(nz-1, 0, 0, 0))/fabs ((*devel_n[1])(nz-1, 0, 0, 0)) ;
00347 
00348     return erreur;
00349 }
00350 
00351 
00352 
00353 
00354 

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