| 1 |
/* |
| 2 |
* Code for reading scalar-hair BH from a file |
| 3 |
* Scalar-hair BH are the KBHsSH described in Herdeiro & Radu (2015) |
| 4 |
* CQG, 32, 144001 |
| 5 |
*/ |
| 6 |
|
| 7 |
/* |
| 8 |
* Copyright (c) 2015 Frederic Vincent, Eric Gourgoulhon |
| 9 |
* |
| 10 |
* This file is part of LORENE. |
| 11 |
* |
| 12 |
* LORENE is free software; you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License version 2 |
| 14 |
* as published by the Free Software Foundation. |
| 15 |
* |
| 16 |
* LORENE is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License |
| 22 |
* along with LORENE; if not, write to the Free Software |
| 23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
* |
| 25 |
*/ |
| 26 |
|
| 27 |
char scalarbh_C[] = "$Header: /cvsroot/Lorene/Codes/Alternatives/scalarbh.C,v 1.5 2016/05/10 12:57:18 f_vincent Exp $" ; |
| 28 |
|
| 29 |
/* |
| 30 |
* $Id: scalarbh.C,v 1.5 2016/05/10 12:57:18 f_vincent Exp $ |
| 31 |
* $Log: scalarbh.C,v $ |
| 32 |
* Revision 1.5 2016/05/10 12:57:18 f_vincent |
| 33 |
* scalarBH: added the computation of quantities needed to define an accretion torus in any BS or scalar BH spacetime |
| 34 |
* |
| 35 |
* Revision 1.4 2015/12/15 06:47:11 f_vincent |
| 36 |
* Code cleaning in scalarBH |
| 37 |
* |
| 38 |
* Revision 1.3 2015/11/09 16:01:42 f_vincent |
| 39 |
* Updated scalarBH code |
| 40 |
* |
| 41 |
* Revision 1.2 2015/11/05 17:32:11 f_vincent |
| 42 |
* Updated code for class scalarBH. |
| 43 |
* |
| 44 |
* Revision 1.1 2015/10/22 09:20:02 f_vincent |
| 45 |
* New code scalarbh |
| 46 |
* |
| 47 |
* |
| 48 |
* $Header: /cvsroot/Lorene/Codes/Alternatives/scalarbh.C,v 1.5 2016/05/10 12:57:18 f_vincent Exp $ |
| 49 |
* |
| 50 |
*/ |
| 51 |
|
| 52 |
// C++ headers |
| 53 |
#include "headcpp.h" |
| 54 |
|
| 55 |
// C headers |
| 56 |
#include <cstdlib> |
| 57 |
#include <cmath> |
| 58 |
#include <cstdio> |
| 59 |
#include <iostream> |
| 60 |
using namespace std ; |
| 61 |
|
| 62 |
// Lorene headers |
| 63 |
#include "compobj.h" |
| 64 |
#include "nbr_spx.h" |
| 65 |
#include "utilitaires.h" |
| 66 |
#include "proto.h" |
| 67 |
#include "graphique.h" |
| 68 |
|
| 69 |
using namespace Lorene ; |
| 70 |
|
| 71 |
int main() { |
| 72 |
|
| 73 |
// Parameters of the computation |
| 74 |
// ----------------------------- |
| 75 |
|
| 76 |
ifstream fpar("par_scalarbh.d") ; |
| 77 |
if ( !fpar.good() ) { |
| 78 |
cerr << "Problem in opening the file par_scalarbh.d ! " << endl ; |
| 79 |
abort() ; |
| 80 |
} |
| 81 |
|
| 82 |
char file_name[256] ; |
| 83 |
fpar.getline(file_name, 256) ; |
| 84 |
cout << "File to be read: " << file_name << endl ; |
| 85 |
|
| 86 |
ifstream file(file_name) ; |
| 87 |
if ( !file.good() ) { |
| 88 |
cerr << "Problem in opening the file " << file_name << endl ; |
| 89 |
abort() ; |
| 90 |
} |
| 91 |
double rHor ; |
| 92 |
int nrfile, nthetafile; |
| 93 |
file >> nrfile >> nthetafile ; |
| 94 |
file >> rHor ; |
| 95 |
cout << "Event horizon is present at r= " << rHor << endl; |
| 96 |
|
| 97 |
double mass ; // M_{object,ADM} in units of m_planck^2 / m_boson |
| 98 |
fpar >> mass ; fpar.ignore(1000,'\n') ; |
| 99 |
|
| 100 |
int graphic_out ; // flag for graphical outputs |
| 101 |
fpar >> graphic_out ; fpar.ignore(1000,'\n') ; |
| 102 |
|
| 103 |
int compute_qty ; // flag for computing useful doughnut quantities |
| 104 |
fpar >> compute_qty ; fpar.ignore(1000,'\n') ; |
| 105 |
|
| 106 |
double ell ; // value of the constant angular momentum l = -u_phi/u_t |
| 107 |
fpar >> ell ; fpar.ignore(1000,'\n') ; |
| 108 |
|
| 109 |
int nr ; // Number of collocation points in r in each domain |
| 110 |
fpar >> nr; fpar.ignore(1000,'\n') ; |
| 111 |
|
| 112 |
int nt ; // Number of collocation points in theta in each domain |
| 113 |
fpar >> nt; fpar.ignore(1000,'\n') ; |
| 114 |
|
| 115 |
int np ; // Number of collocation points in phi in each domain |
| 116 |
fpar >> np; fpar.ignore(1000,'\n') ; |
| 117 |
|
| 118 |
int nz ; // Number of domains |
| 119 |
fpar >> nz ; fpar.ignore(1000,'\n') ; |
| 120 |
int nzm1 = nz - 1 ; // Index of outermost domain |
| 121 |
|
| 122 |
fpar.ignore(1000,'\n') ; // skip title |
| 123 |
double* r_limits = new double[nz+1]; // inner boundaries of each domain in units of M |
| 124 |
for (int l=0; l<nz; l++) |
| 125 |
{ |
| 126 |
fpar >> r_limits[l]; |
| 127 |
} |
| 128 |
r_limits[nz] = __infinity ; |
| 129 |
|
| 130 |
fpar.close(); |
| 131 |
|
| 132 |
|
| 133 |
// Setup of a multi-domain grid (Lorene class Mg3d) |
| 134 |
// ------------------------------------------------ |
| 135 |
|
| 136 |
int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane |
| 137 |
int symmetry_phi = SYM ; // symmetry with respect to phi --> phi + pi |
| 138 |
bool compact = true ; // external domain is compactified |
| 139 |
|
| 140 |
Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ; |
| 141 |
|
| 142 |
//cout << mgrid << endl ; |
| 143 |
|
| 144 |
|
| 145 |
// Setup of an affine mapping : grid --> physical space (Lorene class Map_af) |
| 146 |
// -------------------------------------------------------------------------- |
| 147 |
|
| 148 |
Map_af map(mgrid, r_limits) ; |
| 149 |
|
| 150 |
// Construction of the ScalarBH object: |
| 151 |
// ---------------------------------- |
| 152 |
|
| 153 |
ScalarBH object(map, file_name) ; |
| 154 |
|
| 155 |
//object.update_metric() ; // TO BE ADDED WHEN WRITTEN |
| 156 |
|
| 157 |
cout.precision(15) ; |
| 158 |
//cout << endl << "******* object ******** " << endl ; |
| 159 |
//cout << object << endl ; |
| 160 |
|
| 161 |
/*cout << "Lapse= " << endl; |
| 162 |
cout << object.get_nn() << endl; |
| 163 |
|
| 164 |
cout << "F0= " << endl; |
| 165 |
cout << object.get_ff0() << endl;*/ |
| 166 |
|
| 167 |
cout << "betap far= " << object.get_beta()(3).val_point(1e5,M_PI/2.,0.) << endl; |
| 168 |
double rtest=10.; |
| 169 |
cout << "grr, gthth, gpp in Gyoto basis= " << object.get_gamma().cov()(1,1).val_point(rtest,M_PI/2.,0.) << " " << rtest*rtest*object.get_gamma().cov()(2,2).val_point(rtest,M_PI/2.,0.) << " " << rtest*rtest*object.get_gamma().cov()(3,3).val_point(rtest,M_PI/2.,0.) << endl; |
| 170 |
//cout << "lapse far= " << object.get_nn().val_point(10000,0.157,0.) << endl; |
| 171 |
|
| 172 |
// Drawings |
| 173 |
if (graphic_out == 1) |
| 174 |
{ |
| 175 |
double r_min=0., r_max = 1.5;//1.5*map.val_r(nzm1,-1.,0.,0.) ; |
| 176 |
//des_meridian(object.get_sfield(), 0, r_max, "Phi", 1) ; |
| 177 |
|
| 178 |
|
| 179 |
des_meridian(object.get_nn(), r_min, r_max, "N", 1) ; |
| 180 |
|
| 181 |
des_meridian(object.get_gamma().cov()(1,1), r_min, r_max, "gamma_11", 2); |
| 182 |
des_meridian(object.get_gamma().cov()(2,2), r_min, r_max, "gamma_22", 3) ; |
| 183 |
des_meridian(object.get_gamma().cov()(3,3), r_min, r_max, "gamma_33", 4) ; |
| 184 |
|
| 185 |
des_meridian(object.get_beta()(3), r_min, r_max, "Nphi", 5) ; |
| 186 |
//des_meridian(object.get_beta()(3), 1e10, 1e12, "Nphi", 6) ; |
| 187 |
//des_meridian(object.get_beta()(3), 1.62, 1.63, "Nphi", 6) ; |
| 188 |
|
| 189 |
des_meridian(object.get_kk()(1,3), r_min, r_max, "K_(r)(ph)", 7) ; |
| 190 |
des_meridian(object.get_kk()(2,3), r_min, r_max, "K_(th)(ph)", 8) ; |
| 191 |
|
| 192 |
arrete() ; |
| 193 |
} |
| 194 |
|
| 195 |
// Computing useful doughnut quantities |
| 196 |
/* |
| 197 |
This if loop computes quite a few relevant quantities that are necessary |
| 198 |
in order to properly define an accretion torus ("ion torus") in a given |
| 199 |
boson-star or scalar BH spacetime. These quantities will be saved in |
| 200 |
the file output.dat. |
| 201 |
*/ |
| 202 |
if (compute_qty == 1) |
| 203 |
{ |
| 204 |
ofstream outputfile; |
| 205 |
outputfile.open("output.dat"); |
| 206 |
int nsize = 50000; |
| 207 |
double rout=50.; |
| 208 |
double rstart=rHor; |
| 209 |
double dr=(rout-rstart)/double(nsize); |
| 210 |
double Madm = mass; |
| 211 |
//ell *= Madm; // no: ell is given in Mrond units already now |
| 212 |
for(int ii=1;ii<nsize;ii++){ |
| 213 |
double rr = rstart+ii*dr; |
| 214 |
// equatorial plane quantities, theta=pi/2 |
| 215 |
// Caution, switching from Lorene orthonormal to Gyoto coord basis: |
| 216 |
double betap_Lorene = object.get_beta()(3).val_point(rr,M_PI/2.,0.); |
| 217 |
double betap = 1./rr*betap_Lorene; |
| 218 |
double gpp = rr*rr*object.get_gamma().cov()(3,3).val_point(rr,M_PI/2.,0.); |
| 219 |
double BB = sqrt(gpp/(rr*rr)); |
| 220 |
double NN = object.get_nn().val_point(rr,M_PI/2.,0.); |
| 221 |
double Phi = fabs(object.get_sfield().val_point(rr,M_PI/2.,0.)); // I take fabs as the sign does not matter, I want it >0 to plot it |
| 222 |
double dbetapdr = |
| 223 |
1./rr*(object.get_beta()(3).dsdr().val_point(rr,M_PI/2.,0.) - betap); |
| 224 |
double dNdr = object.get_nn().dsdr().val_point(rr,M_PI/2.,0.); |
| 225 |
double gppr = |
| 226 |
rr*rr*object.get_gamma().cov()(3,3).dsdr().val_point(rr,M_PI/2.,0.) |
| 227 |
+2./rr*gpp; |
| 228 |
double dBdr = |
| 229 |
1./(2.*BB)*object.get_gamma().cov()(3,3).dsdr().val_point(rr,M_PI/2.,0.); |
| 230 |
double DD = BB*BB*rr*rr/(NN*NN)*dbetapdr*dbetapdr |
| 231 |
+ 4.*dNdr/NN*(dBdr/BB+1./rr); |
| 232 |
double V_Kepler_ZAMO_plus = |
| 233 |
0.5*(-BB*rr/NN*dbetapdr+sqrt(DD))/(1./rr+dBdr/BB); |
| 234 |
double V_Kepler_ZAMO_minus = |
| 235 |
0.5*(-BB*rr/NN*dbetapdr-sqrt(DD))/(1./rr+dBdr/BB); |
| 236 |
double E_Kepler = |
| 237 |
1./sqrt(1-V_Kepler_ZAMO_plus*V_Kepler_ZAMO_plus) |
| 238 |
*(NN-betap*BB*rr*V_Kepler_ZAMO_plus); |
| 239 |
double l_Kepler = BB*rr*V_Kepler_ZAMO_plus |
| 240 |
/(NN-betap*BB*rr*V_Kepler_ZAMO_plus); |
| 241 |
|
| 242 |
double d2Ndr2 = object.get_nn().dsdr().dsdr().val_point(rr,M_PI/2.,0.); |
| 243 |
double d2lnN_over_dr2 = 1./(NN*NN)*(d2Ndr2*NN-dNdr*dNdr); |
| 244 |
double d2omega_over_dr2 = |
| 245 |
2./(rr*rr)*(object.get_beta()(3).dsdr().val_point(rr,M_PI/2.,0.) |
| 246 |
- betap) |
| 247 |
-1./rr*object.get_beta()(3).dsdr().dsdr().val_point(rr,M_PI/2.,0.); |
| 248 |
double d2Bdr2 = |
| 249 |
1./BB*(0.5*object.get_gamma().cov()(3,3).dsdr().dsdr().val_point(rr,M_PI/2.,0.) - dBdr*dBdr); |
| 250 |
double d2lnB_over_dr2 = 1./(BB*BB)*(d2Bdr2*BB-dBdr*dBdr); |
| 251 |
double iscoeq = |
| 252 |
d2lnN_over_dr2 - 2.*dNdr*dNdr/(NN*NN) |
| 253 |
+ V_Kepler_ZAMO_plus*BB*rr/NN*(d2omega_over_dr2 + 4.*dNdr/NN*dbetapdr) |
| 254 |
+ V_Kepler_ZAMO_plus*V_Kepler_ZAMO_plus*(-d2lnB_over_dr2+4./rr*dBdr/BB+2.*dBdr/BB*dBdr/BB+3./(rr*rr)) |
| 255 |
- V_Kepler_ZAMO_plus*V_Kepler_ZAMO_plus*BB*BB*rr*rr/(NN*NN)*dbetapdr*dbetapdr; |
| 256 |
|
| 257 |
double term1 = betap*BB*BB*rr*rr, term2 = -NN*NN+betap*term1; |
| 258 |
double delta = term1*term1-term2*BB*BB*rr*rr; |
| 259 |
double lmax = (-term1-sqrt(delta))/term2; |
| 260 |
double gtp = gpp*betap; |
| 261 |
double gtt = -NN*NN + gpp*betap*betap; |
| 262 |
double utdownstairs2_nume = gtp*gtp-gtt*gpp; |
| 263 |
double utdownstairs2_deno = gtt*ell*ell+2.*ell*gtp+gpp; |
| 264 |
double Eminus=0, Eplus=0, EminusD=0, EplusD=0, photonpot=0, |
| 265 |
epsVzerominus=0, epsVzeroplus=0, particlepotential=0, |
| 266 |
epsVprimeplus=0, epsVprimeminus=0, g_tt=0, g_rr=0, g_thth=0, |
| 267 |
g_pp=0, g_tp=0; // just for fitting historical format |
| 268 |
|
| 269 |
// this should give the same output as the readKadathData.C routine for BS |
| 270 |
outputfile << ell << " " << Madm << " " << rr << " " << betap << " " << BB << " " << NN << " " << Phi << " " << DD << " " << V_Kepler_ZAMO_plus << " " << E_Kepler << " " << l_Kepler << " " << lmax << " " << utdownstairs2_nume << " " << utdownstairs2_deno << " "<< BB*BB*rr*rr/(NN*NN)*dbetapdr*dbetapdr << " " << V_Kepler_ZAMO_minus << " " << dBdr << " " << dbetapdr << " " << dNdr << " " << particlepotential << " " << Eminus << " " << Eplus << " " << EminusD << " " << EplusD << " " << photonpot << " " << epsVzerominus << " " << epsVzeroplus << " " << epsVprimeminus << " " << epsVprimeplus << " " << g_tt << " " << g_rr << " " << g_thth << " " << g_pp << " " << g_tp << " " << iscoeq << endl; |
| 271 |
} |
| 272 |
|
| 273 |
outputfile.close(); |
| 274 |
} |
| 275 |
|
| 276 |
//---------------------- |
| 277 |
// Output file for GYOTO |
| 278 |
//---------------------- |
| 279 |
object.gyoto_data("gyoto_scalarBH.d") ; |
| 280 |
|
| 281 |
return EXIT_SUCCESS ; |
| 282 |
} |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|