blackhole_rk_phi.C

00001 /*
00002  *  Methods of class Black_hole to compute a forth-order Runge-Kutta
00003  *  integration to the phi direction for the solution of the Killing vectors
00004  *
00005  *    (see file blackhole.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 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_rk_phi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_rk_phi.C,v 1.2 2008/07/02 20:43:54 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: blackhole_rk_phi.C,v 1.2 2008/07/02 20:43:54 k_taniguchi Exp $
00033  * $Log: blackhole_rk_phi.C,v $
00034  * Revision 1.2  2008/07/02 20:43:54  k_taniguchi
00035  * Typos removed.
00036  *
00037  * Revision 1.1  2008/05/15 19:33:32  k_taniguchi
00038  * *** empty log message ***
00039  *
00040  *
00041  * $Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_rk_phi.C,v 1.2 2008/07/02 20:43:54 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           //--------------------------------------------------//
00057           //      Forth-order Runge-Kutta on the equator      //
00058           //--------------------------------------------------//
00059 
00060 Tbl Black_hole::runge_kutta_phi_bh(const Tbl& xi_i, const double& phi_i,
00061                    const int& nrk_phi) const {
00062 
00063     using namespace Unites ;
00064 
00065     const Mg3d* mg = mp.get_mg() ;
00066     int np = mg->get_np(1) ;
00067 
00068     Tbl xi_f(3) ;  // xi_f(0)=xi_hat{theta}, xi_f(1)=xi_hat{phi}, xi_f(2)=L
00069     xi_f.set_etat_qcq() ;
00070 
00071     if (kerrschild) {
00072 
00073       cout << "Not yet prepared!!!" << endl ;
00074       abort() ;
00075 
00076     }
00077     else {  // Isotropic coordinates
00078 
00079       // Initial data at phi=0 on the equator
00080       double xi_t0 = xi_i(0) ;  // xi_hat{theta}
00081       double xi_p0 = xi_i(1) ;  // xi_hat{phi}
00082       double xi_l0 = xi_i(2) ;  // L
00083       double phi0 = phi_i ;
00084 
00085       double dp = 2. * M_PI / double(np) / double(nrk_phi) ;
00086 
00087       double rah = rad_ah() ;
00088 
00089       Scalar dlnconfo(mp) ;
00090       dlnconfo = confo.dsdt() / confo ;
00091       dlnconfo.std_spectral_base() ;
00092 
00093       Scalar laplnconfo(mp) ;
00094       laplnconfo = confo.lapang() / confo ;
00095       laplnconfo.std_spectral_base() ;
00096 
00097       Scalar confo2(mp) ;
00098       confo2 = confo * confo ;
00099       confo2.std_spectral_base() ;
00100 
00101       double xi_t1, xi_t2, xi_t3, xi_t4, xi_tf ;
00102       double xi_p1, xi_p2, xi_p3, xi_p4, xi_pf ;
00103       double xi_l1, xi_l2, xi_l3, xi_l4, xi_lf ;
00104       double f1, f2, f3, f4 ;
00105       double g1, g2, g3, g4 ;
00106       double h1, h2, h3, h4 ;
00107 
00108       // Forth-order Runge-Kutta
00109       // (nrk_phi times steps between two collocation points)
00110       // ----------------------------------------------------
00111 
00112       for (int i=0; i<nrk_phi; i++) {
00113 
00114     // First
00115     f1 = - xi_l0 * rah * confo2.val_point(rah, M_PI/2., phi0)
00116       + 2. * xi_p0 * dlnconfo.val_point(rah, M_PI/2., phi0) ;
00117     g1 = -2. * xi_t0 * dlnconfo.val_point(rah, M_PI/2., phi0) ;
00118     h1 = (1. - 2.*laplnconfo.val_point(rah, M_PI/2., phi0)) * xi_t0
00119       / rah / confo2.val_point(rah, M_PI/2., phi0) ;
00120 
00121     xi_t1 = dp * f1 ;
00122     xi_p1 = dp * g1 ;
00123     xi_l1 = dp * h1 ;
00124 
00125     // Second
00126     f2 = - (xi_l0+0.5*xi_l1) * rah
00127       * confo2.val_point(rah, M_PI/2., phi0+0.5*dp)
00128       + 2. * (xi_p0+0.5*xi_p1)
00129       * dlnconfo.val_point(rah, M_PI/2., phi0+0.5*dp) ;
00130     g2 = -2. * (xi_t0+0.5*xi_t1)
00131       * dlnconfo.val_point(rah, M_PI/2., phi0+0.5*dp) ;
00132     h2 = (1. - 2.*laplnconfo.val_point(rah, M_PI/2., phi0+0.5*dp))
00133       * (xi_t0+0.5*xi_t1) / rah
00134       / confo2.val_point(rah, M_PI/2., phi0+0.5*dp) ;
00135 
00136     xi_t2 = dp * f2 ;
00137     xi_p2 = dp * g2 ;
00138     xi_l2 = dp * h2 ;
00139 
00140     // Third
00141     f3 = - (xi_l0+0.5*xi_l2) * rah
00142       * confo2.val_point(rah, M_PI/2., phi0+0.5*dp)
00143       + 2. * (xi_p0+0.5*xi_p2)
00144       * dlnconfo.val_point(rah, M_PI/2., phi0+0.5*dp) ;
00145     g3 = -2. * (xi_t0+0.5*xi_t2)
00146       * dlnconfo.val_point(rah, M_PI/2., phi0+0.5*dp) ;
00147     h3 = (1. - 2.*laplnconfo.val_point(rah, M_PI/2., phi0+0.5*dp))
00148       * (xi_t0+0.5*xi_t2) / rah
00149       / confo2.val_point(rah, M_PI/2., phi0+0.5*dp) ;
00150 
00151     xi_t3 = dp * f3 ;
00152     xi_p3 = dp * g3 ;
00153     xi_l3 = dp * h3 ;
00154 
00155     // Forth
00156     f4 = - (xi_l0+xi_l3) * rah * confo2.val_point(rah, M_PI/2., phi0+dp)
00157       + 2. * (xi_p0+xi_p3) * dlnconfo.val_point(rah, M_PI/2., phi0+dp) ;
00158     g4 = -2. * (xi_t0+xi_t3) * dlnconfo.val_point(rah, M_PI/2., phi0+dp) ;
00159     h4 = (1. - 2.*laplnconfo.val_point(rah, M_PI/2., phi0+dp))
00160       * (xi_t0+xi_t3) / rah / confo2.val_point(rah, M_PI/2., phi0+dp) ;
00161 
00162     xi_t4 = dp * f4 ;
00163     xi_p4 = dp * g4 ;
00164     xi_l4 = dp * h4 ;
00165 
00166     // Final results
00167     // -------------
00168     xi_tf = xi_t0 + (xi_t1 + 2.*xi_t2 + 2.*xi_t3 + xi_t4) / 6. ;
00169     xi_pf = xi_p0 + (xi_p1 + 2.*xi_p2 + 2.*xi_p3 + xi_p4) / 6. ;
00170     xi_lf = xi_l0 + (xi_l1 + 2.*xi_l2 + 2.*xi_l3 + xi_l4) / 6. ;
00171 
00172     // Final results are put into the initial data
00173     // in order for the next step
00174     // -------------------------------------------
00175     xi_t0 = xi_tf ;
00176     xi_p0 = xi_pf ;
00177     xi_l0 = xi_lf ;
00178 
00179       } // End of the loop
00180 
00181       xi_f.set(0) = xi_tf ;
00182       xi_f.set(1) = xi_pf ;
00183       xi_f.set(2) = xi_lf ;
00184 
00185     }
00186 
00187     return xi_f ;
00188 
00189 }

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