blackhole_bc.C

00001 /*
00002  *  Methods of class Black_hole to compute the inner boundary condition
00003  *  at the excised surface
00004  *
00005  *    (see file blackhole.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2005-2007 Keisuk 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_bc_C[] = "$Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_bc.C,v 1.3 2008/07/03 14:53:47 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: blackhole_bc.C,v 1.3 2008/07/03 14:53:47 k_taniguchi Exp $
00033  * $Log: blackhole_bc.C,v $
00034  * Revision 1.3  2008/07/03 14:53:47  k_taniguchi
00035  * Modification of a signature in bc_shift_x and bc_shift_y.
00036  *
00037  * Revision 1.2  2008/05/15 19:25:43  k_taniguchi
00038  * Change of some parameters.
00039  *
00040  * Revision 1.1  2007/06/22 01:18:23  k_taniguchi
00041  * *** empty log message ***
00042  *
00043  *
00044  * $Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole_bc.C,v 1.3 2008/07/03 14:53:47 k_taniguchi Exp $
00045  *
00046  */
00047 
00048 // C++ headers
00049 //#include <>
00050 
00051 // C headers
00052 #include <math.h>
00053 
00054 // Lorene headers
00055 #include "blackhole.h"
00056 #include "valeur.h"
00057 #include "grilles.h"
00058 #include "unites.h"
00059 
00060                     //----------------------------------//
00061                     //     Inner boundary condition     //
00062                     //----------------------------------//
00063 
00064 const Valeur Black_hole::bc_lapconf(bool neumann, bool first) const {
00065 
00066     // Fundamental constants and units
00067     // -------------------------------
00068     using namespace Unites ;
00069 
00070     const Mg3d* mg = mp.get_mg() ;
00071     const Mg3d* mg_angu = mg->get_angu() ;
00072     Valeur bc(mg_angu) ;
00073 
00074     if (kerrschild) {
00075 
00076         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00077     abort() ;
00078 
00079     /*
00080         if (neumann) {
00081 
00082         if (first) {
00083 
00084             Scalar rr(mp) ;
00085         rr = mp.r ;
00086         rr.std_spectral_base() ;
00087 
00088         int nt = mg->get_nt(0) ;
00089         int np = mg->get_np(0) ;
00090 
00091         Scalar tmp(mp) ;
00092 
00093             tmp = - pow(lapse_bh,3.) * ggrav * mass_bh / rr / rr ;
00094         // dlapse/dr = 0
00095 
00096         bc = 1. ;
00097         for (int j=0; j<nt; j++) {
00098             for (int k=0; k<np; k++) {
00099                 bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00100             }
00101         }
00102         }
00103         else {
00104 
00105             bc = 0. ;  // dlapse/dr = 0.25*lapse/rr
00106 
00107         }
00108     }
00109     else {
00110         if (first) {  // The poisson solver in LORENE assumes the
00111                       // asymptotic behavior of the function -> 0
00112             bc = 0.5 - 1./sqrt(2.) ;  // <- bc of the real function = 0.5
00113 
00114         }
00115         else {
00116 
00117             bc = 0. ; // <- bc of the real function = 1./sqrt(2.)
00118 
00119         }
00120     }
00121     */
00122     }
00123     else {  // Isotropic coordinates with the maximal slicing
00124 
00125         if (neumann) {
00126 
00127         if (first) {
00128 
00129             bc = 0. ;  // d(lapconf)/dr = 0
00130 
00131         }
00132         else {
00133 
00134             Scalar rr(mp) ;
00135         rr = mp.r ;
00136         rr.std_spectral_base() ;
00137 
00138             int nt = mg->get_nt(0) ;
00139         int np = mg->get_np(0) ;
00140 
00141         Scalar tmp(mp) ;
00142 
00143         tmp = 0.5 * lapconf / rr ;
00144         // d(lapconf)/dr = lapconf/2/rah
00145 
00146         bc = 1. ;
00147         for (int j=0; j<nt; j++) {
00148             for (int k=0; k<np; k++) {
00149                 bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00150             }
00151         }
00152 
00153 
00154         }
00155 
00156     }
00157     else {
00158 
00159         if (first) {
00160 
00161             cout << "!!!!! WARNING: Not yet prepared !!!!!" << endl ;
00162         abort() ;
00163         //          bc = - 0.5 ;  // lapconf = 0.5
00164 
00165         }
00166         else {
00167 
00168             cout << "!!!!! WARNING: Not yet prepared !!!!!" << endl ;
00169         abort() ;
00170             /*
00171             Scalar r_are(mp) ;
00172         r_are = r_coord(neumann, first) ;
00173         r_are.std_spectral_base() ;
00174         r_are.annule_domain(0) ;
00175         r_are.raccord(1) ;
00176 
00177         int nt = mg->get_nt(0) ;
00178         int np = mg->get_np(0) ;
00179 
00180         Scalar tmp(mp) ;
00181 
00182         tmp = sqrt(0.5*r_are) - 1. ;  // lapse = 1./sqrt(2.)
00183 
00184         bc = 1. ;
00185         for (int j=0; j<nt; j++) {
00186             for (int k=0; k<np; k++) {
00187                 bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00188             }
00189         }
00190         */
00191 
00192         }
00193 
00194     }
00195 
00196     }
00197 
00198     bc.std_base_scal() ;
00199     return bc ;
00200 
00201 }
00202 
00203 
00204 const Valeur Black_hole::bc_shift_x(double omega_r) const {
00205 
00206     // Fundamental constants and units
00207     // -------------------------------
00208     using namespace Unites ;
00209 
00210     const Mg3d* mg = mp.get_mg() ;
00211     const Mg3d* mg_angu = mg->get_angu() ;
00212     Valeur bc(mg_angu) ;
00213 
00214     Base_val** bases = mp.get_mg()->std_base_vect_cart() ;
00215 
00216     Scalar rr(mp) ;
00217     rr = mp.r ;
00218     rr.std_spectral_base() ;
00219     Scalar st(mp) ;
00220     st = mp.sint ;
00221     st.std_spectral_base() ;
00222     Scalar cp(mp) ;
00223     cp = mp.cosp ;
00224     cp.std_spectral_base() ;
00225     Scalar yy(mp) ;
00226     yy = mp.y ;
00227     yy.std_spectral_base() ;
00228 
00229     Scalar tmp(mp) ;
00230 
00231     if (kerrschild) {
00232 
00233         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00234     abort() ;
00235     /*
00236         tmp = lapse_bh * (lapse / confo / confo) * st * cp
00237       - omega_r * yy - shift_bh(1) ;
00238     */
00239 
00240     //        tmp = lap_bh * lap_bh * st * cp - omega_r * yy ;
00241     }
00242     else {  // Isotropic coordinates with the maximal slicing
00243 
00244         // Note: the signature of omega_r is opposite to that in the
00245         // binary case because of the direction of the spin
00246         tmp = lapconf / pow(confo, 3.) * st * cp + omega_r * yy ;
00247     //  tmp = lapconf / pow(confo, 3.) * st * cp - omega_r * yy ;
00248 
00249     }
00250 
00251     int nt = mg->get_nt(0) ;
00252     int np = mg->get_np(0) ;
00253 
00254     bc = 1. ;
00255     for (int j=0; j<nt; j++) {
00256         for (int k=0; k<np; k++) {
00257         bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00258     }
00259     }
00260 
00261     bc.base = *bases[0] ;
00262     //    bc.std_base_scal() ;
00263 
00264     for (int i=0; i<3; i++)
00265       delete bases[i] ;
00266 
00267     delete [] bases ;
00268 
00269     return bc ;
00270 
00271 }
00272 
00273 
00274 const Valeur Black_hole::bc_shift_y(double omega_r) const {
00275 
00276     // Fundamental constants and units
00277     // -------------------------------
00278     using namespace Unites ;
00279 
00280     const Mg3d* mg = mp.get_mg() ;
00281     const Mg3d* mg_angu = mg->get_angu() ;
00282     Valeur bc(mg_angu) ;
00283 
00284     Base_val** bases = mp.get_mg()->std_base_vect_cart() ;
00285 
00286     Scalar rr(mp) ;
00287     rr = mp.r ;
00288     rr.std_spectral_base() ;
00289     Scalar st(mp) ;
00290     st = mp.sint ;
00291     st.std_spectral_base() ;
00292     Scalar sp(mp) ;
00293     sp = mp.sinp ;
00294     sp.std_spectral_base() ;
00295     Scalar xx(mp) ;
00296     xx = mp.x ;
00297     xx.std_spectral_base() ;
00298 
00299     Scalar tmp(mp) ;
00300 
00301     if (kerrschild) {
00302 
00303         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00304     abort() ;
00305     /*
00306         tmp = lapse_bh * (lapse / confo / confo) * st * sp
00307       + omega_r * xx - shift_bh(2) ;
00308     */
00309     //        tmp = lap_bh * lap_bh * st * sp + omega_r * xx ;
00310     }
00311     else {
00312 
00313         // Note: the signature of omega_r is opposite to that in the
00314         // binary case because of the direction of the spin
00315         tmp = lapconf / pow(confo, 3.) * st * sp - omega_r * xx ;
00316     //        tmp = lapconf / pow(confo, 3.) * st * sp + omega_r * xx ;
00317 
00318     }
00319 
00320     int nt = mg->get_nt(0) ;
00321     int np = mg->get_np(0) ;
00322 
00323     bc = 1. ;
00324     for (int j=0; j<nt; j++) {
00325         for (int k=0; k<np; k++) {
00326         bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00327     }
00328     }
00329 
00330     bc.base = *bases[1] ;
00331     //    bc.std_base_scal() ;
00332 
00333     for (int i=0; i<3; i++)
00334       delete bases[i] ;
00335 
00336     delete [] bases ;
00337 
00338     return bc ;
00339 
00340 }
00341 
00342 
00343 const Valeur Black_hole::bc_shift_z() const {
00344 
00345     // Fundamental constants and units
00346     // -------------------------------
00347     using namespace Unites ;
00348 
00349     const Mg3d* mg = mp.get_mg() ;
00350     const Mg3d* mg_angu = mg->get_angu() ;
00351     Valeur bc(mg_angu) ;
00352 
00353     Base_val** bases = mp.get_mg()->std_base_vect_cart() ;
00354 
00355     Scalar rr(mp) ;
00356     rr = mp.r ;
00357     rr.std_spectral_base() ;
00358     Scalar ct(mp) ;
00359     ct = mp.cost ;
00360     ct.std_spectral_base() ;
00361 
00362     Scalar tmp(mp) ;
00363 
00364     if (kerrschild) {
00365 
00366         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00367     abort() ;
00368     /*
00369         tmp = lapse_bh * (lapse / confo / confo) * ct
00370       - shift_bh(3) ;
00371     */
00372         //        tmp = lap_bh * lap_bh * ct ;
00373     }
00374     else {
00375 
00376         tmp = lapconf / pow(confo, 3.) * ct ;
00377 
00378     }
00379 
00380     int nt = mg->get_nt(0) ;
00381     int np = mg->get_np(0) ;
00382 
00383     bc = 1. ;
00384     for (int j=0; j<nt; j++) {
00385         for (int k=0; k<np; k++) {
00386         bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00387     }
00388     }
00389 
00390     bc.base = *bases[2] ;
00391     //    bc.std_base_scal() ;
00392 
00393     for (int i=0; i<3; i++)
00394       delete bases[i] ;
00395 
00396     delete [] bases ;
00397 
00398     return bc ;
00399 
00400 }
00401 
00402 
00403 const Valeur Black_hole::bc_confo() const {
00404 
00405     // Fundamental constants and units
00406     // -------------------------------
00407     using namespace Unites ;
00408 
00409     const Mg3d* mg = mp.get_mg() ;
00410     const Mg3d* mg_angu = mg->get_angu() ;
00411     Valeur bc(mg_angu) ;
00412 
00413     double mass = ggrav * mass_bh ;
00414 
00415     Scalar rr(mp) ;
00416     rr = mp.r ;
00417     rr.std_spectral_base() ;
00418     Scalar st(mp) ;
00419     st = mp.sint ;
00420     st.std_spectral_base() ;
00421     Scalar ct(mp) ;
00422     ct = mp.cost ;
00423     ct.std_spectral_base() ;
00424     Scalar sp(mp) ;
00425     sp = mp.sinp ;
00426     sp.std_spectral_base() ;
00427     Scalar cp(mp) ;
00428     cp = mp.cosp ;
00429     cp.std_spectral_base() ;
00430 
00431     int nt = mg->get_nt(0) ;
00432     int np = mg->get_np(0) ;
00433 
00434     Scalar tmp(mp) ;
00435 
00436     if (kerrschild) { // Assumes that r_BH = 1.
00437 
00438         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00439     abort() ;
00440     /*
00441     Scalar divshift(mp) ;
00442     divshift = shift_rs(1).deriv(1) + shift_rs(2).deriv(2)
00443       + shift_rs(3).deriv(3) ;
00444     divshift.std_spectral_base() ;
00445 
00446     Scalar llshift(mp) ;
00447     llshift = st*cp*shift_rs(1) + st*sp*shift_rs(2) + ct*shift_rs(3) ;
00448     llshift.std_spectral_base() ;
00449 
00450     Scalar lldllsh = llshift.dsdr() ;
00451     lldllsh.std_spectral_base() ;
00452 
00453     Scalar tmp1 = divshift ;
00454     Scalar tmp2 = -3.*lldllsh ;
00455 
00456         Scalar tmp5 = 0.5*confo*(lapse_bh*confo*confo/lapse - 1.)/rr ;
00457         tmp1.set_dzpuis(tmp5.get_dzpuis()) ;
00458     tmp2.set_dzpuis(tmp5.get_dzpuis()) ;
00459 
00460         Scalar tmp3 = 2. * lapse_bh * lapse_bh * mass * llshift / rr / rr ;
00461     Scalar tmp4 = 4. * pow(lapse_bh,3.) * mass * (1.+3.*mass/rr)
00462       * lapse_rs / rr / rr ;
00463 
00464     tmp3.set_dzpuis(tmp5.get_dzpuis()) ;
00465     tmp4.set_dzpuis(tmp5.get_dzpuis()) ;
00466 
00467         tmp = tmp5 + pow(confo,3.)*(tmp1+tmp2+tmp3+tmp4)/12./lapse/lapse_bh ;
00468     */
00469     //  tmp = -0.5 * (1. - 2. * mass / rr) / rr ;
00470 
00471     }
00472     else {  // Isotropic coordinates with the maximal slicing
00473 
00474         Scalar divshift(mp) ;
00475     divshift = shift(1).deriv(1) + shift(2).deriv(2)
00476       + shift(3).deriv(3) ;
00477     divshift.std_spectral_base() ;
00478 
00479     Scalar llshift(mp) ;
00480     llshift = st*cp*shift(1) + st*sp*shift(2) + ct*shift(3) ;
00481     llshift.std_spectral_base() ;
00482 
00483     Scalar lldllsh = llshift.dsdr() ;
00484     lldllsh.std_spectral_base() ;
00485 
00486     Scalar tmp1 = divshift ;
00487     Scalar tmp2 = -3.*lldllsh ;
00488 
00489         Scalar tmp5 = - 0.5 * confo / rr ;
00490 
00491     tmp1.set_dzpuis(tmp5.get_dzpuis()) ;
00492     tmp2.set_dzpuis(tmp5.get_dzpuis()) ;
00493 
00494     tmp = tmp5 + pow(confo, 4.) * (tmp1 + tmp2) / 12. / lapconf ;
00495 
00496     }
00497 
00498     bc = 1. ;
00499     for (int j=0; j<nt; j++) {
00500         for (int k=0; k<np; k++) {
00501         bc.set(0,k,j,0) = tmp.val_grid_point(1,k,j,0) ;
00502     }
00503     }
00504 
00505     bc.std_base_scal() ;
00506     return bc ;
00507 
00508 }

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