blackhole_r_coord.C

00001 /*
00002  *  Method of class Black_hole to express the radial coordinate
00003  *  in Kerr-Schild coordinates by that in spatially isotropic coordinates
00004  *
00005  *    (see file blackhole.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2006-2007 Keisuke Taniguchi
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 blackhole_r_coord_C[] = "$Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_r_coord.C,v 1.2 2008/05/15 19:29:58 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: blackhole_r_coord.C,v 1.2 2008/05/15 19:29:58 k_taniguchi Exp $
00033  * $Log: blackhole_r_coord.C,v $
00034  * Revision 1.2  2008/05/15 19:29:58  k_taniguchi
00035  * Change of some parameters.
00036  *
00037  * Revision 1.1  2007/06/22 01:20:33  k_taniguchi
00038  * *** empty log message ***
00039  *
00040  *
00041  * $Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_r_coord.C,v 1.2 2008/05/15 19:29:58 k_taniguchi Exp $
00042  *
00043  */
00044 
00045 // C++ headers
00046 //#include <>
00047 
00048 // C headers
00049 #include <math.h>
00050 
00051 // Lorene headers
00052 #include "blackhole.h"
00053 #include "unites.h"
00054 #include "utilitaires.h"
00055 
00056 // Local function
00057 double gg(double, const double) ;
00058 
00059 const Scalar Black_hole::r_coord(bool neumann, bool first) const {
00060 
00061     // Fundamental constants and units
00062     // -------------------------------
00063     using namespace Unites ;
00064 
00065     const Mg3d* mg = mp.get_mg() ;
00066     int nz = mg->get_nzone() ;          // total number of domains
00067     int nr = mg->get_nr(0) ;
00068     int nt = mg->get_nt(0) ;
00069     int np = mg->get_np(0) ;
00070 
00071     double mass = ggrav * mass_bh ;
00072 
00073     Scalar r_iso(mp) ;
00074     r_iso = mp.r ;
00075     r_iso.std_spectral_base() ;
00076 
00077     Scalar r_are(mp) ;
00078     r_are = r_iso ;  // Initialization
00079     r_are.std_spectral_base() ;
00080 
00081     // Sets C/M^2 for each case of the lapse boundary condition
00082     // --------------------------------------------------------
00083     double cc ;
00084 
00085     if (neumann) {  // Neumann boundary condition
00086         if (first) {  // First condition
00087       // d(\alpha \psi)/dr = 0
00088       // ---------------------
00089       cc = 2. * (sqrt(13.) - 1.) / 3. ;
00090     }
00091     else {  // Second condition
00092       // d(\alpha \psi)/dr = (\alpha \psi)/(2 rah)
00093       // -----------------------------------------
00094       cc = 4. / 3. ;
00095     }
00096     }
00097     else {  // Dirichlet boundary condition
00098        if (first) {  // First condition
00099      // (\alpha \psi) = 1/2
00100      // -------------------
00101      cout << "!!!!! WARNING: Not yet prepared !!!!!" << endl ;
00102      abort() ;
00103        }
00104        else {  // Second condition
00105      // (\alpha \psi) = 1/sqrt(2.) \psi_KS
00106      // ----------------------------------
00107      cout << "!!!!! WARNING: Not yet prepared !!!!!" << endl ;
00108      abort() ;
00109        }
00110     }
00111 
00112     int ll ;
00113     double diff ;
00114     double ratio ;
00115     double precis = 1.e-15 ;
00116     double dp ;
00117     double tmp ;
00118     double tr ;
00119 
00120     int nn = 1000 ;
00121     assert(nn%4 == 0) ;
00122     int mm = nn/4 ;
00123     double x1, x2, x3, x4, x5 ;
00124     double hh, integ ;
00125 
00126     // Boole's Rule (Newton-Cotes Integral) for integration
00127     // ----------------------------------------------------
00128 
00129     for (int l=1; l<nz; l++) {
00130 
00131       for (int i=0; i<nr; i++) {
00132 
00133     ratio = 1. ;
00134     dp = 10. ;
00135     tr = r_iso.val_grid_point(l,0,0,i) ;
00136 
00137     while ( dp > precis ) {
00138 
00139       diff = 1. ;  // Initialization
00140       ll = 0 ;
00141       dp = 0.1 * dp ;
00142 
00143       while ( diff > precis ) {
00144 
00145         ll++ ;
00146         tmp = ratio + ll * dp ;
00147 
00148         double r_max = 2.*mass/tmp/tr ;
00149 
00150         hh = r_max / double(nn) ;
00151         integ = 0. ;
00152 
00153         for (int n=0; n<mm; n++) {
00154 
00155           x1 = hh * double(4*n) ;
00156           x2 = hh * double(4*n+1) ;
00157           x3 = hh * double(4*n+2) ;
00158           x4 = hh * double(4*n+3) ;
00159           x5 = hh * double(4*n+4) ;
00160 
00161           integ += (hh/45.) * (14.*gg(x1,cc) + 64.*gg(x2,cc)
00162                    + 24.*gg(x3,cc) + 64.*gg(x4,cc)
00163                    + 14.*gg(x5,cc)) ;
00164 
00165         }
00166 
00167         diff = -log( tmp ) - integ ;
00168 
00169         //      cout << "diff: " << diff << "  x: " << tmp << endl ;
00170 
00171       }
00172 
00173       ratio += (ll - 1) * dp ;
00174 
00175     }
00176 
00177     for (int j=0; j<nt; j++) {
00178       for (int k=0; k<np; k++) {
00179 
00180         r_are.set_grid_point(l,k,j,i) = ratio ;
00181 
00182       }
00183     }
00184 
00185     //  arrete() ;
00186 
00187       }
00188     }
00189 
00190     r_are.std_spectral_base() ;
00191     r_are.annule_domain(0) ;
00192     r_are.raccord(1) ;
00193 
00194     /*
00195     cout << "r_are:" << endl ;
00196     for (int l=0; l<nz; l++) {
00197       cout << r_are.val_grid_point(l,0,0,0) << "  "
00198        << r_are.val_grid_point(l,0,0,nr-1) << endl ;
00199     }
00200     */
00201 
00202     return r_are ;
00203 
00204 }
00205 
00206 //*****************************************************************
00207 
00208 double gg(double xx, const double cc) {
00209 
00210     double tcc2 = cc*cc/16. ;
00211     double tmp = sqrt(1. - xx + tcc2*pow(xx, 4.)) ;
00212 
00213     double resu = (-1. + tcc2 * pow(xx, 3.)) / tmp / (1. + tmp) ;
00214 
00215     return resu ;
00216 
00217 }

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