blackhole_killing.C

00001 /*
00002  *  Methods of class Black_hole to compute Killing vectors
00003  *
00004  *    (see file blackhole.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2007 Keisuke Taniguchi
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License version 2
00015  *   as published by the Free Software Foundation.
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 char blackhole_killing_C[] = "$Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_killing.C,v 1.2 2008/07/02 20:45:07 k_taniguchi Exp $" ;
00029 
00030 /*
00031  * $Id: blackhole_killing.C,v 1.2 2008/07/02 20:45:07 k_taniguchi Exp $
00032  * $Log: blackhole_killing.C,v $
00033  * Revision 1.2  2008/07/02 20:45:07  k_taniguchi
00034  * A bug removed.
00035  *
00036  * Revision 1.1  2008/05/15 19:33:12  k_taniguchi
00037  * *** empty log message ***
00038  *
00039  *
00040  * $Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_killing.C,v 1.2 2008/07/02 20:45:07 k_taniguchi Exp $
00041  *
00042  */
00043 
00044 // C++ headers
00045 //#include <>
00046 
00047 // C headers
00048 #include <math.h>
00049 
00050 // Lorene headers
00051 #include "blackhole.h"
00052 #include "unites.h"
00053 #include "utilitaires.h"
00054 
00055                //---------------------------------------------//
00056                //          Killing vectors on the AH          //
00057                //---------------------------------------------//
00058 
00059 Vector Black_hole::killing_vect_bh(const Tbl& xi_i, const double& phi_i,
00060                    const double& theta_i, const int& nrk_phi,
00061                    const int& nrk_theta) const {
00062 
00063     using namespace Unites ;
00064 
00065     assert(xi_i.get_ndim() == 1) ;
00066     assert(xi_i.get_dim(0) == 3) ;
00067 
00068     const Mg3d* mg = mp.get_mg() ;
00069     int nr = mg->get_nr(1) ;
00070     int nt = mg->get_nt(1) ;
00071     int np = mg->get_np(1) ;
00072 
00073     // Vector which is returned to the main code
00074     // Spherical basis, covariant
00075     Vector killing(mp, COV, mp.get_bvect_spher()) ;
00076 
00077     if (kerrschild) {
00078 
00079       cout << "Not yet prepared!!!" << endl ;
00080       abort() ;
00081 
00082     }
00083     else {  // Isotropic coordinates
00084 
00085         // Solution of the Killing vector on the equator
00086         // ---------------------------------------------
00087 
00088         double dp = 2. * M_PI / double(np) ;  // Angular step
00089 
00090     // Killing vector on the equator
00091     // np+1 is for the check of xi(phi=0)= xi(phi=2pi)
00092     Tbl xi_t(np+1) ;
00093     xi_t.set_etat_qcq() ;
00094     Tbl xi_p(np+1) ;
00095     xi_p.set_etat_qcq() ;
00096     Tbl xi_l(np+1) ;
00097     xi_l.set_etat_qcq() ;
00098 
00099     xi_t.set(0) = xi_i(0) ;
00100     xi_p.set(0) = xi_i(1) ;
00101     xi_l.set(0) = xi_i(2) ;
00102 
00103     Tbl xi(3) ;
00104     xi.set_etat_qcq() ;
00105 
00106     Tbl xi_ini(3) ;
00107     xi_ini.set_etat_qcq() ;
00108     xi_ini.set(0) = xi_i(0) ;
00109     xi_ini.set(1) = xi_i(1) ;
00110     xi_ini.set(2) = xi_i(2) ;
00111 
00112     double pp_0 = phi_i ;  // azimuthal angle phi
00113 
00114     for (int i=1; i<np+1; i++) {
00115 
00116         xi = runge_kutta_phi_bh(xi_ini, pp_0, nrk_phi) ;
00117 
00118         xi_t.set(i) = xi(0) ;
00119         xi_p.set(i) = xi(1) ;
00120         xi_l.set(i) = xi(2) ;
00121 
00122         // New data for the next step
00123         //  -------------------------
00124         pp_0 += dp ;  // New angle
00125         xi_ini = xi ;
00126 
00127     }
00128 
00129     /*
00130     for (int i=0; i<np+1; i++) {
00131 
00132       cout << "xi_t    xi_p    xi_l" << endl ;
00133       cout << xi_t(i) << "  " << xi_p(i) << "  " << xi_l(i) << endl ;
00134 
00135     }
00136     arrete() ;
00137     */
00138 
00139     // Normalization of the Killing vector
00140     // -----------------------------------
00141 
00142     // Initialization of the Killing vector to the phi direction
00143     Scalar xi_phi(mp) ;
00144     xi_phi = 0.5 ;  // If we use "1." for the initialization value,
00145                     // the state flag becomes "ETATUN" which does not
00146                     // work for "set_grid_point".
00147 
00148     for (int k=0; k<np; k++) {
00149       xi_phi.set_grid_point(0, k, nt-1, nr-1) = xi_p(k) ;
00150       xi_phi.set_grid_point(1, k, nt-1, 0) = xi_p(k) ;
00151     }
00152     xi_phi.std_spectral_base() ;
00153     /*
00154     for (int l=0; l<2; l++) {
00155       for (int k=0; k<np; k++) {
00156         for (int j=0; j<nt; j++) {
00157           for (int i=0; i<nr; i++) {
00158         cout << "(l,k,j,i)=" << l << "," << k << "," << j
00159              << "," << i << ": "
00160              << xi_phi.val_grid_point(l,k,j,i) << endl ;
00161           }
00162           arrete() ;
00163         }
00164         arrete() ;
00165       }
00166       arrete() ;
00167     }
00168     */
00169 
00170     // Normalization of the Killing vector
00171     Scalar rr(mp) ;
00172     rr = mp.r ;
00173     rr.std_spectral_base() ;
00174 
00175     Scalar st(mp) ;
00176     st = mp.sint ;
00177     st.std_spectral_base() ;
00178 
00179     Scalar source_phi(mp) ;
00180     source_phi = pow(confo, 2.) * rr * st / xi_phi ;
00181     source_phi.std_spectral_base() ;
00182 
00183     double rah = rad_ah() ;
00184 
00185     int nn = 1000 ;
00186     double hh = 2. * M_PI / double(nn) ;
00187     double integ = 0. ;
00188 
00189     int mm ;
00190     double t1, t2, t3, t4, t5 ;
00191 
00192     // Boole's Rule (Newton-Cotes Integral) for integration
00193     // ----------------------------------------------------
00194 
00195     assert(nn%4 == 0) ;
00196     mm = nn/4 ;
00197 
00198     for (int i=0; i<mm; i++) {
00199 
00200         t1 = hh * double(4*i) ;
00201         t2 = hh * double(4*i+1) ;
00202         t3 = hh * double(4*i+2) ;
00203         t4 = hh * double(4*i+3) ;
00204         t5 = hh * double(4*i+4) ;
00205 
00206         integ += (hh/45.) * (14.*source_phi.val_point(rah,M_PI/2.,t1)
00207                  + 64.*source_phi.val_point(rah,M_PI/2.,t2)
00208                  + 24.*source_phi.val_point(rah,M_PI/2.,t3)
00209                  + 64.*source_phi.val_point(rah,M_PI/2.,t4)
00210                  + 14.*source_phi.val_point(rah,M_PI/2.,t5)
00211                  ) ;
00212 
00213     }
00214 
00215     cout << "Black_hole:: t_f = " << integ << endl ;
00216     double ratio = 0.5 * integ / M_PI ;
00217 
00218     cout << "Black_hole:: t_f / 2M_PI = " << ratio << endl ;
00219 
00220     for (int k=0; k<np; k++) {
00221       xi_p.set(k) = xi_phi.val_grid_point(1, k, nt-1, 0) * ratio ;
00222     }
00223 
00224     /*
00225     for (int k=0; k<np; k++) {
00226       cout << "Normalized xi_p" << "(" << k << ") :" << xi_p(k) << endl ;
00227     }
00228     */
00229 
00230         // Solution of the Killing vector to the pole angle
00231         // ------------------------------------------------
00232 
00233     double dt = 0.5 * M_PI / double(nt-1) ;  // Angular step
00234 
00235     // Killing vector to the polar angle
00236     Tbl xi_th(nt, np) ;
00237     xi_th.set_etat_qcq() ;
00238     Tbl xi_ph(nt, np) ;
00239     xi_ph.set_etat_qcq() ;
00240     Tbl xi_ll(nt, np) ;
00241     xi_ll.set_etat_qcq() ;
00242 
00243     // Values on the equator
00244     for (int i=0; i<np; i++) {
00245 
00246         xi_th.set(nt-1, i) = xi_t(i) ;
00247         xi_ph.set(nt-1, i) = xi_p(i) ;
00248         xi_ll.set(nt-1, i) = xi_l(i) ;
00249 
00250     }
00251 
00252     for (int i=0; i<np; i++) {
00253 
00254         // Value at theta=pi/2, phi=phi_i
00255         xi_ini.set(0) = xi_t(i) ;
00256         xi_ini.set(1) = xi_p(i) ;
00257         xi_ini.set(2) = xi_l(i) ;
00258 
00259         double pp = double(i) * dp ;
00260         double tt_0 = theta_i ;  // polar angle theta
00261 
00262         for (int j=1; j<nt; j++) {
00263 
00264             xi = runge_kutta_theta_bh(xi_ini, tt_0, pp, nrk_theta) ;
00265 
00266         xi_th.set(nt-1-j, i) = xi(0) ;
00267         xi_ph.set(nt-1-j, i) = xi(1) ;
00268         xi_ll.set(nt-1-j, i) = xi(2) ;
00269 
00270         // New data for the nxt step
00271         // -------------------------
00272         tt_0 -= dt ;  // New angle
00273         xi_ini = xi ;
00274 
00275         }  // End of the loop to the polar direction
00276 
00277     }  // End of the loop to the azimuhtal direction
00278 
00279 
00280     // Construction of the Killing vector
00281     // ----------------------------------
00282 
00283     // Definition of the vector is at the top of this code
00284     killing.set_etat_qcq() ;
00285     killing.set(1) = 0. ;  // r component
00286     killing.set(2) = 0.5 ;  // initialization of the theta component
00287     killing.set(3) = 0.5 ;  // initialization of the phi component
00288 
00289     for (int l=0; l<2; l++) {
00290       for (int i=0; i<nr; i++) {
00291         for (int j=0; j<nt; j++) {
00292           for (int k=0; k<np; k++) {
00293         (killing.set(2)).set_grid_point(l, k, j, i) = xi_th(j, k) ;
00294         (killing.set(3)).set_grid_point(l, k, j, i) = xi_ph(j, k) ;
00295           }
00296         }
00297       }
00298     }
00299     killing.std_spectral_base() ;
00300 
00301     // Check the normalization
00302     // -----------------------
00303 
00304     double check_norm = 0. ;
00305     source_phi = pow(confo, 2.) * rr * st / killing(3) ;
00306     source_phi.std_spectral_base() ;
00307 
00308     for (int i=0; i<mm; i++) {
00309 
00310         t1 = hh * double(4*i) ;
00311         t2 = hh * double(4*i+1) ;
00312         t3 = hh * double(4*i+2) ;
00313         t4 = hh * double(4*i+3) ;
00314         t5 = hh * double(4*i+4) ;
00315 
00316         check_norm += (hh/45.) *
00317           ( 14.*source_phi.val_point(rah,M_PI/4.,t1)
00318         + 64.*source_phi.val_point(rah,M_PI/4.,t2)
00319         + 24.*source_phi.val_point(rah,M_PI/4.,t3)
00320         + 64.*source_phi.val_point(rah,M_PI/4.,t4)
00321         + 14.*source_phi.val_point(rah,M_PI/4.,t5) ) ;
00322 
00323     }
00324 
00325     cout << "Black_hole:: t_f for M_PI/4 = " << check_norm / M_PI
00326          << " M_PI" << endl ;
00327 
00328     }  // End of the loop for isotropic coordinates
00329 
00330     return killing ;
00331 
00332 }

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