| 1 |
|
| 2 |
/* |
| 3 |
* Main code for Isolated Horizon in arbitrary gauge |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
/* |
| 8 |
* Copyright (c) 2004-2005 Jose Luis Jaramillo |
| 9 |
* Francois limousin |
| 10 |
* |
| 11 |
* This file is part of LORENE. |
| 12 |
* |
| 13 |
* LORENE is free software; you can redistribute it and/or modify |
| 14 |
* it under the terms of the GNU General Public License version 2 |
| 15 |
* as published by the Free Software Foundation. |
| 16 |
* |
| 17 |
* LORENE is distributed in the hope that it will be useful, |
| 18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
* GNU General Public License for more details. |
| 21 |
* |
| 22 |
* You should have received a copy of the GNU General Public License |
| 23 |
* along with LORENE; if not, write to the Free Software |
| 24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 |
* |
| 26 |
*/ |
| 27 |
|
| 28 |
char isolhor_C[] = "$Header: /cvsroot/Lorene/Codes/Isol_hor/isolhor.C,v 1.36 2014/10/13 08:53:56 j_novak Exp $" ; |
| 29 |
|
| 30 |
/* |
| 31 |
* $Id: isolhor.C,v 1.36 2014/10/13 08:53:56 j_novak Exp $ |
| 32 |
* $Log: isolhor.C,v $ |
| 33 |
* Revision 1.36 2014/10/13 08:53:56 j_novak |
| 34 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 35 |
* |
| 36 |
* Revision 1.35 2014/10/06 15:09:44 j_novak |
| 37 |
* Modified #include directives to use c++ syntax. |
| 38 |
* |
| 39 |
* Revision 1.34 2007/01/22 14:49:53 jl_jaramillo |
| 40 |
* versions ok for running tests |
| 41 |
* |
| 42 |
* Revision 1.33 2006/02/22 16:32:14 jl_jaramillo |
| 43 |
* dynamical relaxation |
| 44 |
* |
| 45 |
* Revision 1.32 2005/10/21 16:38:02 jl_jaramillo |
| 46 |
* Control of the expansion |
| 47 |
* |
| 48 |
* Revision 1.31 2005/10/21 16:20:18 jl_jaramillo |
| 49 |
* Version for the paper JaramL05 |
| 50 |
* |
| 51 |
* Revision 1.30 2005/09/12 12:34:09 f_limousin |
| 52 |
* Compilation Warning - Change of convention for the angular velocity |
| 53 |
* Add Berlin boundary condition in the case of binary horizons. |
| 54 |
* |
| 55 |
* Revision 1.29 2005/06/09 08:09:10 f_limousin |
| 56 |
* Implementation of the Kerr-Shild metric |
| 57 |
* |
| 58 |
* Revision 1.28 2005/04/08 12:14:42 f_limousin |
| 59 |
* Dependance in phi. |
| 60 |
* |
| 61 |
* Revision 1.27 2005/04/08 09:30:53 jl_jaramillo |
| 62 |
* Calculation of the expansion and its radial derivative |
| 63 |
* |
| 64 |
* Revision 1.26 2005/04/06 08:17:09 f_limousin |
| 65 |
* Writing of global quantities in resformat.d |
| 66 |
* |
| 67 |
* Revision 1.25 2005/04/03 19:48:52 f_limousin |
| 68 |
* Implementation of set_psi(psi_in). |
| 69 |
* |
| 70 |
* Revision 1.24 2005/04/02 15:52:05 f_limousin |
| 71 |
* New data member nz. Lichnerowicz choice for aquad. Delete function |
| 72 |
* compute_ww(). |
| 73 |
* |
| 74 |
* Revision 1.23 2005/03/31 09:46:33 f_limousin |
| 75 |
* New functions compute_ww(..) and aa_kerr_ww(). |
| 76 |
* |
| 77 |
* Revision 1.22 2005/03/30 12:08:33 f_limousin |
| 78 |
* Implementation of K^{ij} (Eq.(13) Of Sergio (2002)). |
| 79 |
* |
| 80 |
* Revision 1.21 2005/03/28 19:42:24 f_limousin |
| 81 |
* Implement the metric and A^{ij}A_{ij} of Sergio for pertubations |
| 82 |
* of Kerr black holes. |
| 83 |
* |
| 84 |
* Revision 1.20 2005/03/24 16:50:53 f_limousin |
| 85 |
* Add parameters solve_shift and solve_psi in par_isol.d and in function |
| 86 |
* init_dat(...). Implement Isolhor::kerr_perturb(). |
| 87 |
* |
| 88 |
* Revision 1.19 2005/03/22 13:25:49 f_limousin |
| 89 |
* Small changes. The angular velocity and A^{ij} are computed |
| 90 |
* with a differnet sign. |
| 91 |
* |
| 92 |
* Revision 1.18 2005/03/15 19:28:11 f_limousin |
| 93 |
* Implement initial data for Kerr black hole in isotropic coordinates. |
| 94 |
* |
| 95 |
* Revision 1.17 2005/03/09 10:33:31 f_limousin |
| 96 |
* Delete functions init_data_b_neumann(...) and init_data_berlin(...) |
| 97 |
* --> New parameter solve_lapse in the function init_data(...). |
| 98 |
* |
| 99 |
* Revision 1.16 2005/03/03 10:18:57 f_limousin |
| 100 |
* Addition of the boost in x and z-direction. |
| 101 |
* The grid and the mapping are now saved in the output file. |
| 102 |
* |
| 103 |
* Revision 1.15 2004/12/31 12:30:07 f_limousin |
| 104 |
* Change the construction of an Isol_hor and the function sauve(FILE*, bool). |
| 105 |
* |
| 106 |
* Revision 1.14 2004/11/18 10:02:37 jl_jaramillo |
| 107 |
* gamt and gamt_point well constructed as tensor in spaherical |
| 108 |
* components |
| 109 |
* |
| 110 |
* Revision 1.13 2004/11/09 12:40:08 f_limousin |
| 111 |
* Add some printing |
| 112 |
* |
| 113 |
* Revision 1.12 2004/11/05 17:53:26 f_limousin |
| 114 |
* Perturbations of the conformal metric and its time derivative. |
| 115 |
* |
| 116 |
* Revision 1.8 2004/11/02 17:42:00 f_limousin |
| 117 |
* New method sauve(...) to save in a binary file. |
| 118 |
* |
| 119 |
* Revision 1.6 2004/10/29 15:41:02 jl_jaramillo |
| 120 |
* ADM angular momentum added |
| 121 |
* |
| 122 |
* Revision 1.5 2004/10/01 16:48:47 f_limousin |
| 123 |
* *** empty log message *** |
| 124 |
* |
| 125 |
* Revision 1.4 2004/09/28 15:57:45 f_limousin |
| 126 |
* Add the 2 lines $Id and $Log to see the comments |
| 127 |
* |
| 128 |
* |
| 129 |
* Revision 1.1 2004/02/18 19:16:28 jl_jaramillo |
| 130 |
* First version: c'est loin d'etre pret tout ca !!! |
| 131 |
* |
| 132 |
* |
| 133 |
* $Header: /cvsroot/Lorene/Codes/Isol_hor/isolhor.C,v 1.36 2014/10/13 08:53:56 j_novak Exp $ |
| 134 |
* |
| 135 |
*/ |
| 136 |
|
| 137 |
// C++ headers |
| 138 |
#include "headcpp.h" |
| 139 |
|
| 140 |
// C headers |
| 141 |
#include <cstdlib> |
| 142 |
#include <cmath> |
| 143 |
#include <cstring> |
| 144 |
|
| 145 |
// Lorene headers |
| 146 |
#include "tenseur.h" |
| 147 |
#include "metric.h" |
| 148 |
#include "evolution.h" |
| 149 |
#include "param.h" |
| 150 |
#include "nbr_spx.h" |
| 151 |
#include "utilitaires.h" |
| 152 |
#include "graphique.h" |
| 153 |
#include "time_slice.h" |
| 154 |
#include "isol_hor.h" |
| 155 |
|
| 156 |
|
| 157 |
using namespace Lorene ; |
| 158 |
|
| 159 |
int main() { |
| 160 |
|
| 161 |
//====================================================================== |
| 162 |
// Construction and initialization of the various objects |
| 163 |
//====================================================================== |
| 164 |
|
| 165 |
// Setup of a multi-domain grid (Lorene class Mg3d) |
| 166 |
// ------------------------------------------------ |
| 167 |
|
| 168 |
int nz, nt, np, nr1, nrp1 ; |
| 169 |
|
| 170 |
ifstream fpar("par_hor.d") ; |
| 171 |
fpar.ignore(1000, '\n') ; |
| 172 |
fpar.ignore(1000, '\n') ; |
| 173 |
fpar >> nz; fpar.ignore(1000, '\n'); |
| 174 |
fpar >> nt; fpar.ignore(1000, '\n'); |
| 175 |
fpar >> np; fpar.ignore(1000, '\n'); |
| 176 |
fpar >> nr1; fpar.ignore(1000, '\n'); |
| 177 |
fpar >> nrp1; fpar.ignore(1000, '\n'); |
| 178 |
|
| 179 |
|
| 180 |
int type_t = SYM ; // symmetry with respect to the equatorial plane |
| 181 |
int type_p = NONSYM ; // no symmetry in phi |
| 182 |
|
| 183 |
// Reading of the parameter file |
| 184 |
// ------------------------------ |
| 185 |
|
| 186 |
int niter, bound_nn, bound_psi, bound_beta, solve_lapse, solve_psi ; |
| 187 |
int solve_shift ; |
| 188 |
double radius, relax_nn, relax_psi, relax_beta, seuil, ang_vel, boost_x, boost_z, lim_nn ; |
| 189 |
fpar >> radius; fpar.ignore(1000, '\n'); |
| 190 |
fpar >> relax_nn; fpar.ignore(1000, '\n'); |
| 191 |
fpar >> relax_psi; fpar.ignore(1000, '\n'); |
| 192 |
fpar >> relax_beta; fpar.ignore(1000, '\n'); |
| 193 |
fpar >> seuil; fpar.ignore(1000, '\n'); |
| 194 |
fpar >> niter; fpar.ignore(1000, '\n'); |
| 195 |
fpar >> ang_vel; fpar.ignore(1000, '\n'); |
| 196 |
fpar >> boost_x ; |
| 197 |
fpar >> boost_z; fpar.ignore(1000, '\n'); |
| 198 |
fpar >> bound_nn ; |
| 199 |
fpar >> lim_nn ; fpar.ignore(1000, '\n'); |
| 200 |
fpar >> bound_psi ; fpar.ignore(1000, '\n'); |
| 201 |
fpar >> bound_beta ; fpar.ignore(1000, '\n'); |
| 202 |
fpar >> solve_lapse ; fpar.ignore(1000, '\n'); |
| 203 |
fpar >> solve_psi ; fpar.ignore(1000, '\n'); |
| 204 |
fpar >> solve_shift ; fpar.ignore(1000, '\n'); |
| 205 |
|
| 206 |
|
| 207 |
int* nr_tab = new int[nz]; |
| 208 |
int* nt_tab = new int[nz]; |
| 209 |
int* np_tab = new int[nz]; |
| 210 |
double* bornes = new double[nz+1]; |
| 211 |
|
| 212 |
for (int l=0; l<nz; l++) { |
| 213 |
if (l==1) nr_tab[1] = nr1 ; |
| 214 |
else nr_tab[l] = nrp1 ; |
| 215 |
np_tab[l] = np ; |
| 216 |
nt_tab[l] = nt ; |
| 217 |
bornes[l] = pow(2., l-1) * radius ; |
| 218 |
} |
| 219 |
bornes[0] = 0. ; |
| 220 |
bornes[nz] = __infinity ; |
| 221 |
|
| 222 |
// Type of r sampling : |
| 223 |
int* type_r = new int[nz]; |
| 224 |
type_r[0] = RARE ; |
| 225 |
for (int l=1; l<nz-1; l++) { |
| 226 |
type_r[l] = FIN ; |
| 227 |
} |
| 228 |
type_r[nz-1] = UNSURR ; |
| 229 |
|
| 230 |
// Multi-domain grid construction: |
| 231 |
Mg3d mgrid(nz, nr_tab, type_r, nt_tab, type_t, np_tab, type_p) ; |
| 232 |
|
| 233 |
Map_af mp(mgrid, bornes) ; // Mapping construction |
| 234 |
|
| 235 |
// Denomination of various coordinates associated with the mapping |
| 236 |
// --------------------------------------------------------------- |
| 237 |
|
| 238 |
const Coord& r = mp.r ; // r field |
| 239 |
const Coord& theta = mp.tet ; // r field |
| 240 |
const Coord& costt = mp.cost ; // cos(theta) field |
| 241 |
const Coord& sintt = mp.sint ; // sin(theta) field |
| 242 |
const Coord& cospp = mp.cosp ; // cos(phi) field |
| 243 |
const Coord& sinpp = mp.sinp ; // sin(phi) field |
| 244 |
|
| 245 |
Scalar rr(mp) ; |
| 246 |
rr = r ; |
| 247 |
rr.std_spectral_base() ; |
| 248 |
|
| 249 |
Scalar cos2t (mp) ; |
| 250 |
cos2t = cos(2.*theta) ; |
| 251 |
|
| 252 |
Scalar cost (mp) ; |
| 253 |
cost = costt ; |
| 254 |
|
| 255 |
Scalar cosp (mp) ; |
| 256 |
cosp = cospp ; |
| 257 |
|
| 258 |
Scalar sint (mp) ; |
| 259 |
sint = sintt ; |
| 260 |
|
| 261 |
Scalar sinp (mp) ; |
| 262 |
sinp = sinpp ; |
| 263 |
|
| 264 |
// Flat metric f |
| 265 |
// ------------- |
| 266 |
|
| 267 |
const Metric_flat& ff = mp.flat_met_spher() ; |
| 268 |
const Base_vect_spher& otriad = mp.get_bvect_spher() ; |
| 269 |
|
| 270 |
// Working stuff |
| 271 |
// ------------- |
| 272 |
|
| 273 |
Scalar tmp_scal(mp) ; |
| 274 |
Vector tmp_vect(mp, CON, otriad) ; |
| 275 |
Sym_tensor tmp_sym(mp, CON, otriad) ; |
| 276 |
|
| 277 |
// Key function |
| 278 |
Scalar unsr(1./rr) ; |
| 279 |
unsr.set_domain(0) = 1 ; // scalar set to 1 in the nucleus |
| 280 |
unsr.std_spectral_base() ; |
| 281 |
|
| 282 |
Scalar expmr (exp (- 1/((rr-1)*(rr-1)))) ; |
| 283 |
expmr.std_spectral_base() ; |
| 284 |
|
| 285 |
Scalar expmrr (exp(-pow(rr-3,2.))) ; |
| 286 |
expmrr.std_spectral_base() ; |
| 287 |
|
| 288 |
|
| 289 |
// ================================================================= |
| 290 |
// ================================================================= |
| 291 |
|
| 292 |
// Physical Parameters |
| 293 |
//-------------------- |
| 294 |
|
| 295 |
// Set up of lapse function N |
| 296 |
// -------------------------- |
| 297 |
|
| 298 |
Scalar nn_init(mp) ; |
| 299 |
|
| 300 |
nn_init = 1. - 0.5*unsr ; |
| 301 |
nn_init.std_spectral_base() ; // sets standard spectral bases |
| 302 |
|
| 303 |
// Set up of field Psi |
| 304 |
// ------------------- |
| 305 |
|
| 306 |
Scalar psi_init(mp) ; |
| 307 |
psi_init = 1. ; |
| 308 |
psi_init.std_spectral_base() ; // sets standard spectral bases |
| 309 |
|
| 310 |
// Set up of shift vector beta |
| 311 |
// --------------------------- |
| 312 |
|
| 313 |
Vector beta_init(mp, CON, mp.get_bvect_spher()) ; |
| 314 |
beta_init.set(1) = 0.2*unsr*unsr ; |
| 315 |
beta_init.set(2) = 0. ; |
| 316 |
beta_init.set(3) = 0. ; |
| 317 |
beta_init.annule_domain(0) ; |
| 318 |
beta_init.std_spectral_base() ; |
| 319 |
|
| 320 |
// TrK, TrK_point |
| 321 |
// -------------- |
| 322 |
|
| 323 |
Scalar trK (mp) ; |
| 324 |
trK = 0.*unsr*unsr*unsr*unsr ; |
| 325 |
trK.std_spectral_base() ; |
| 326 |
trK.inc_dzpuis(2) ; |
| 327 |
|
| 328 |
Scalar trK_point (mp) ; |
| 329 |
trK_point = 0. ; |
| 330 |
trK_point.std_spectral_base() ; |
| 331 |
trK_point.inc_dzpuis(2) ; |
| 332 |
|
| 333 |
// gamt, gamt_point |
| 334 |
// ---------------- |
| 335 |
|
| 336 |
Scalar khi (mp) ; |
| 337 |
khi = 0.0 *unsr*unsr*sint*sint*sinp*cosp ; |
| 338 |
khi.std_spectral_base() ; |
| 339 |
khi.annule_domain(0) ; |
| 340 |
|
| 341 |
// cout << "khi : " << endl ; |
| 342 |
// cout << khi << endl ; |
| 343 |
|
| 344 |
Scalar mu (mp) ; |
| 345 |
mu = 0.0*unsr*unsr*cost ; |
| 346 |
|
| 347 |
mu.set_spectral_va().set_base_r(0,R_CHEBPIM_P) ; |
| 348 |
for (int i=1 ; i<nz-1 ; i++){ |
| 349 |
mu.set_spectral_va().set_base_r(i,R_CHEB) ; |
| 350 |
} |
| 351 |
mu.set_spectral_va().set_base_r(nz-1,R_CHEBU) ; |
| 352 |
|
| 353 |
mu.set_spectral_va().set_base_t(T_COSSIN_CI) ; |
| 354 |
mu.set_spectral_va().set_base_p(P_COSSIN) ; |
| 355 |
|
| 356 |
mu.annule_domain(0) ; |
| 357 |
|
| 358 |
Sym_tensor_tt hh_tmp (mp, otriad, ff) ; |
| 359 |
hh_tmp.set_khi_mu(khi, mu) ; |
| 360 |
|
| 361 |
|
| 362 |
//Construction of a gamt |
| 363 |
//---------------------- |
| 364 |
|
| 365 |
Sym_tensor gamt(mp, COV, mp.get_bvect_spher()) ; |
| 366 |
|
| 367 |
gamt = ff.cov() + hh_tmp.up_down(ff) ; |
| 368 |
|
| 369 |
cout << gamt << endl ; |
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
/* |
| 374 |
gamt.set(1,1) = gamt(1,1) * (1+0.3*sint*sint*cosp*cosp* |
| 375 |
(1/rr/rr - 1/rr/rr/rr)) ; |
| 376 |
gamt.set(2,2) = gamt(2,2) * (1+0.01*sint*sint*cosp*cosp* |
| 377 |
(1/rr/rr - 1/rr/rr/rr)) ; |
| 378 |
gamt.set(3,3) = gamt(3,3) * (1+0.01*sint*sint*cosp*cosp* |
| 379 |
(1/rr/rr - 1/rr/rr/rr)) ; |
| 380 |
gamt.set(1,3) = 0.1*sint*sint*cosp*(1/rr/rr - 1/rr/rr/rr) ; |
| 381 |
gamt.set(1,3).set_spectral_va().set_base_t(T_COSSIN_SI) ; |
| 382 |
*/ |
| 383 |
gamt.std_spectral_base() ; |
| 384 |
|
| 385 |
|
| 386 |
// Determinant of gamma tilde is put to one |
| 387 |
// ---------------------------------------- |
| 388 |
|
| 389 |
Metric met_gamt_tmp (gamt) ; |
| 390 |
Scalar det_ust = pow(met_gamt_tmp.determinant(), -1./3.) ; |
| 391 |
det_ust.std_spectral_base() ; |
| 392 |
|
| 393 |
gamt = gamt*det_ust ; |
| 394 |
Metric met_gamt (gamt) ; |
| 395 |
|
| 396 |
// Gamma-tilde_point |
| 397 |
//------------------ |
| 398 |
|
| 399 |
khi = 0. ; |
| 400 |
khi.std_spectral_base() ; |
| 401 |
|
| 402 |
mu = 0. ; |
| 403 |
mu.std_spectral_base() ; |
| 404 |
|
| 405 |
hh_tmp.set_khi_mu(khi, mu) ; |
| 406 |
|
| 407 |
Sym_tensor gamt_point(mp, CON, mp.get_bvect_spher()) ; |
| 408 |
gamt_point = hh_tmp ; |
| 409 |
gamt_point.inc_dzpuis(2) ; |
| 410 |
|
| 411 |
|
| 412 |
// ================================================================= |
| 413 |
// ================================================================= |
| 414 |
|
| 415 |
double mm, aaa, hh ; |
| 416 |
|
| 417 |
/* |
| 418 |
//-------------------------------------------------- |
| 419 |
// Construction of Kerr Metric |
| 420 |
//-------------------------------------------------- |
| 421 |
|
| 422 |
Scalar a2(mp) ; |
| 423 |
Scalar b2(mp) ; |
| 424 |
|
| 425 |
// Parameters |
| 426 |
// ----------- |
| 427 |
|
| 428 |
hh = 2. ; |
| 429 |
double jj = 0. ; |
| 430 |
aaa = - pow( 0.5*(pow(hh*hh*hh*hh+4.*jj*jj, 0.5) - hh*hh), 0.5) ; |
| 431 |
mm = pow(aaa*aaa + hh*hh, 0.5) ; |
| 432 |
|
| 433 |
|
| 434 |
a2 = 1. + 2.*mm/rr + (3.*mm*mm + aaa*aaa*cos2t)/(2.*rr*rr) |
| 435 |
+ (hh*hh*mm)/(2.*pow(rr, 3.)) + pow(hh,4.)/(16.*pow(rr,4.)) ; |
| 436 |
|
| 437 |
a2.std_spectral_base() ; |
| 438 |
a2.set_domain(0) = 1. ; |
| 439 |
|
| 440 |
b2 = ( pow(rr,8.) + 4.*mm*pow(rr,7.) + (7.*mm*mm + |
| 441 |
aaa*aaa*cost*cost)*pow(rr,6.) + mm*(7.*mm*mm+aaa*aaa) |
| 442 |
*pow(rr,5.) + (4.*pow(mm,4.) + hh*hh*(3.*hh*hh/4.+aaa*aaa*sint |
| 443 |
*sint)/2.)*pow(rr,4.) + hh*hh*mm*(2.*mm*mm-hh*hh/4.) |
| 444 |
*pow(rr,3.) + pow(hh,4.)/16.*(7.*mm*mm + aaa*aaa*cost |
| 445 |
*cost)*rr*rr + pow(hh,6.)*mm/16.*rr + pow(hh,8.)/256. ) |
| 446 |
/ ( pow(rr,8.) + 2.*mm*pow(rr,7.) + (3.*mm*mm + aaa*aaa |
| 447 |
*cos2t)/2.*pow(rr,6.) + hh*hh*mm/2.*pow(rr,5.) |
| 448 |
+ pow(hh,4.)/16.*pow(rr,4.)) ; |
| 449 |
|
| 450 |
b2.set_outer_boundary(nz-1 ,1.) ; |
| 451 |
b2.std_spectral_base() ; |
| 452 |
b2.set_domain(0) = 1. ; |
| 453 |
|
| 454 |
// Construction of the tilde metric |
| 455 |
// --------------------------------- |
| 456 |
|
| 457 |
Sym_tensor h_uu(mp, CON, mp.get_bvect_spher()) ; |
| 458 |
|
| 459 |
|
| 460 |
for (int i=1; i<=3; i++) |
| 461 |
for (int j=1; j<=i; j++){ |
| 462 |
if(i != j){ |
| 463 |
h_uu.set(i,j) = 0. ; |
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
h_uu.set(1,1) = pow(b2/a2, 1./3.) - 1 ; |
| 468 |
h_uu.set(2,2) = pow(b2/a2, 1./3.) - 1 ; |
| 469 |
h_uu.set(3,3) = pow(a2/b2, 2./3.) - 1 ; |
| 470 |
|
| 471 |
h_uu.annule_domain(0) ; |
| 472 |
h_uu.std_spectral_base() ; |
| 473 |
|
| 474 |
// Metric tgam (ff.con() + h_uu) ; |
| 475 |
Metric tgam (ff.con()) ; //For computing BY and DainLT |
| 476 |
gamt = tgam.cov() ; |
| 477 |
met_gamt = gamt ; |
| 478 |
|
| 479 |
// Determinant of gamma tilde is put to one |
| 480 |
// ---------------------------------------- |
| 481 |
|
| 482 |
met_gamt_tmp = met_gamt ; |
| 483 |
det_ust = pow(met_gamt_tmp.determinant(), -1./3.) ; |
| 484 |
det_ust.std_spectral_base() ; |
| 485 |
|
| 486 |
gamt = gamt*det_ust ; |
| 487 |
met_gamt = gamt ; |
| 488 |
|
| 489 |
cout << "norme de gamt" << endl << norme(gamt(1,1)) << endl |
| 490 |
<< norme(gamt(2,1)) << endl << norme(gamt(3,1)) << endl |
| 491 |
<< norme(gamt(2,2)) << endl << norme(gamt(3,2)) << endl |
| 492 |
<< norme(gamt(3,3)) << endl ; |
| 493 |
|
| 494 |
|
| 495 |
// Angular velocity |
| 496 |
// ---------------- |
| 497 |
|
| 498 |
ang_vel = -1.*aaa / (2*mm*(mm+pow(mm*mm-aaa*aaa, 0.5))) ; |
| 499 |
cout << "ang_vel = " << ang_vel << endl ; |
| 500 |
|
| 501 |
// Lapse function |
| 502 |
// -------------- |
| 503 |
|
| 504 |
Scalar nnn (mp) ; |
| 505 |
nnn = ( pow(rr, 8) + 2*mm*pow(rr, 7) + (mm*mm+aaa*aaa*cost |
| 506 |
*cost)*pow(rr, 6) |
| 507 |
- 0.5*hh*hh*mm*pow(rr, 5) - 0.5*hh*hh*(mm*mm+0.25*hh*hh |
| 508 |
+aaa*aaa*cost*cost)*pow(rr,4) |
| 509 |
- pow(hh,4)*mm/8.*rr*rr*rr + pow(hh,4)/16.*(mm*mm + |
| 510 |
aaa*aaa*cost*cost)*rr*rr + pow(hh,6)*mm/32.*rr |
| 511 |
+ pow(hh,8)/256.) / (pow(rr,8) + 4*mm*pow(rr,7) |
| 512 |
+ (7*mm*mm+aaa*aaa*cost*cost)*pow(rr,6) |
| 513 |
+ mm*(7*mm*mm+aaa*aaa)*pow(rr,5) + (4*mm*mm*mm*mm |
| 514 |
+ 0.5*hh*hh*(0.75*hh*hh+aaa*aaa*sint*sint))*pow(rr,4) |
| 515 |
+ hh*hh*mm*(2*mm*mm-0.25*hh*hh)*pow(rr,3) |
| 516 |
+ pow(hh,4)/16.*(7*mm*mm+aaa*aaa*cost*cost)*rr*rr |
| 517 |
+ pow(hh,6)*mm/16.*rr + pow(hh,8)/256.) ; |
| 518 |
|
| 519 |
nnn.std_spectral_base() ; |
| 520 |
if (bound_nn == 5 && solve_lapse == 1) |
| 521 |
nnn = pow(nnn, 0.5) + 0.2*unsr*unsr ; |
| 522 |
else |
| 523 |
nnn = pow(nnn, 0.5) + 0.2*unsr*unsr ; |
| 524 |
nnn.set_outer_boundary(nz-1 ,1.) ; |
| 525 |
if (bound_nn == 5 && solve_lapse == 1) |
| 526 |
nnn.set_inner_boundary(1, 0.2) ; |
| 527 |
else |
| 528 |
nnn.set_inner_boundary(1, 0.2) ; |
| 529 |
nnn.set_domain(0) = 1. ; |
| 530 |
nnn.std_spectral_base() ; |
| 531 |
|
| 532 |
nn_init = nnn ; |
| 533 |
|
| 534 |
// Shift vector |
| 535 |
// ------------ |
| 536 |
|
| 537 |
Scalar beta_phi (mp) ; |
| 538 |
beta_phi = 2*aaa*mm*unsr*unsr*sint/(a2*b2) |
| 539 |
*(1+mm*unsr+0.25*hh*hh*unsr*unsr) ; |
| 540 |
beta_phi.std_spectral_base() ; |
| 541 |
beta_phi.set_domain(0) = 0. ; |
| 542 |
|
| 543 |
Vector beta_kerr (mp, CON, mp.get_bvect_spher()) ; |
| 544 |
beta_kerr.set(1) = 0.0*unsr*unsr ; |
| 545 |
beta_kerr.set(2) = 0. ; |
| 546 |
beta_kerr.set(3) = beta_phi ; |
| 547 |
|
| 548 |
beta_kerr.std_spectral_base() ; |
| 549 |
beta_init = beta_kerr ; |
| 550 |
|
| 551 |
// Conformal factor Psi |
| 552 |
// --------------------- |
| 553 |
|
| 554 |
Scalar psi_kerr (pow(a2, 1./6.) * pow(b2,1./12.)) ; |
| 555 |
psi_kerr.std_spectral_base() ; |
| 556 |
psi_kerr.set_domain(0) = 1. ; |
| 557 |
psi_init = psi_kerr ; |
| 558 |
|
| 559 |
|
| 560 |
// -------------------------------------- |
| 561 |
// End of the setup of Kerr metric |
| 562 |
// -------------------------------------- |
| 563 |
*/ |
| 564 |
// Set up of extrinsic curvature |
| 565 |
// ----------------------------- |
| 566 |
|
| 567 |
Metric met_gam(psi_init*psi_init*psi_init*psi_init*gamt) ; |
| 568 |
Sym_tensor kk_init (mp, CON, mp.get_bvect_spher()) ; |
| 569 |
|
| 570 |
int check ; |
| 571 |
check = 0 ; |
| 572 |
for (int k=0; k<np_tab[1]; k++) |
| 573 |
for (int j=0; j<nt_tab[1]; j++){ |
| 574 |
if (nn_init.val_grid_point(1, k, j , 0) < 1e-12){ |
| 575 |
check = 1 ; |
| 576 |
break ; |
| 577 |
} |
| 578 |
} |
| 579 |
if (check == 0) |
| 580 |
kk_init = - 0.5 * met_gam.con().derive_lie(beta_init) / nn_init ; |
| 581 |
else { |
| 582 |
Sym_tensor kk_temp (mp, CON, mp.get_bvect_spher()) ; |
| 583 |
kk_temp = - 0.5 * met_gam.con().derive_lie(beta_init) ; |
| 584 |
|
| 585 |
Scalar nn_sxpun (division_xpun (Cmp(nn_init), 0)) ; |
| 586 |
nn_sxpun.set_domain(0) = 1. ; |
| 587 |
|
| 588 |
Scalar auxi (mp) ; |
| 589 |
for (int i=1 ; i<=3 ; i++) |
| 590 |
for (int j=i ; j<=3 ; j++) { |
| 591 |
auxi = kk_temp(i, j) ; |
| 592 |
auxi.annule_domain(0) ; |
| 593 |
auxi = division_xpun (auxi, 0) ; |
| 594 |
kk_init.set(i,j) = auxi / nn_sxpun ; |
| 595 |
} |
| 596 |
} |
| 597 |
|
| 598 |
Sym_tensor aa_init (mp, CON, mp.get_bvect_spher()) ; |
| 599 |
aa_init = psi_init*psi_init*psi_init*psi_init*kk_init |
| 600 |
- 1./3. * trK * met_gamt.con() ; |
| 601 |
|
| 602 |
|
| 603 |
//------------------------------------- |
| 604 |
// Construction of the space-time |
| 605 |
//------------------------------------- |
| 606 |
|
| 607 |
cout << met_gamt << endl ; |
| 608 |
|
| 609 |
|
| 610 |
Isol_hor isolhor(mp, nn_init, psi_init, beta_init, aa_init, met_gamt, |
| 611 |
gamt_point, trK, trK_point, ff, 3) ; |
| 612 |
|
| 613 |
// In order to initialise isolhor.k_uu() and k_dd() at the good value |
| 614 |
Sym_tensor bidon (mp, CON, mp.get_bvect_spher()) ; |
| 615 |
bidon = isolhor.k_uu() ; |
| 616 |
Sym_tensor bidon2 (isolhor.k_dd()) ; |
| 617 |
Scalar bidon3 (isolhor.aa_quad()) ; |
| 618 |
|
| 619 |
//------------------------------------------------------- |
| 620 |
// Test of the formula for A^{ij}A_{ij} in Sergio's paper |
| 621 |
//------------------------------------------------------- |
| 622 |
|
| 623 |
|
| 624 |
//isolhor.aa_kerr_ww(mm, aaa) ; |
| 625 |
|
| 626 |
// New initialisation of the metric quantities |
| 627 |
// -------------------------------------------- |
| 628 |
|
| 629 |
//psi_init = 0.9*psi_kerr ; |
| 630 |
// psi_init.std_spectral_base() ; |
| 631 |
// isolhor.set_psi(psi_init) ; |
| 632 |
|
| 633 |
// nn_init = 1. ; |
| 634 |
// nn_init.std_spectral_base() ; |
| 635 |
|
| 636 |
|
| 637 |
// Test of the constraints |
| 638 |
//------------------------ |
| 639 |
|
| 640 |
cout<< "----------------------------------------" <<endl ; |
| 641 |
|
| 642 |
isolhor.check_hamiltonian_constraint() ; |
| 643 |
isolhor.check_momentum_constraint() ; |
| 644 |
|
| 645 |
cout<< "----------------------------------------" <<endl ; |
| 646 |
|
| 647 |
//----------------------------------------- |
| 648 |
// "Call to init_data.C" |
| 649 |
//----------------------------------------- |
| 650 |
|
| 651 |
isolhor.set_omega(ang_vel) ; |
| 652 |
isolhor.set_boost_x(boost_x) ; |
| 653 |
isolhor.set_boost_z(boost_z) ; |
| 654 |
|
| 655 |
isolhor.init_data(bound_nn, lim_nn, bound_psi, bound_beta, solve_lapse, |
| 656 |
solve_psi, solve_shift, seuil, relax_nn, relax_psi, relax_beta, niter) ; |
| 657 |
|
| 658 |
// isolhor.init_data_CTS_gen(bound_nn, lim_nn, bound_psi, bound_beta, solve_lapse, |
| 659 |
// solve_psi, solve_shift, seuil, relax_nn, relax_psi, relax_beta, niter, -1., 4.) ; |
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
// Expansion |
| 664 |
//---------- |
| 665 |
|
| 666 |
Scalar expansion = contract(isolhor.gam().radial_vect().derive_cov(isolhor.gam()), 0,1) |
| 667 |
+ contract(contract(isolhor.k_dd(), 0, isolhor.gam().radial_vect(), 0), |
| 668 |
0, isolhor.gam().radial_vect(), 0) |
| 669 |
- isolhor.trk() ; |
| 670 |
|
| 671 |
double der_expansion_0 = expansion.derive_cov(isolhor.gam())(1) |
| 672 |
.val_point(1.00000001, 0, 0.) ; |
| 673 |
double der_expansion_1 = expansion.derive_cov(isolhor.gam())(1) |
| 674 |
.val_point(1.00000001, M_PI/4, 0.) ; |
| 675 |
double der_expansion_2 = expansion.derive_cov(isolhor.gam())(1) |
| 676 |
.val_point(1.00000001, M_PI/2, 0.) ; |
| 677 |
|
| 678 |
cout << "Radial derivative of the expansion at (1,0,0) = " |
| 679 |
<< der_expansion_0<<endl ; |
| 680 |
cout << "Radial derivative of the expansion at (1,Pi/4,0) = " |
| 681 |
<< der_expansion_1<<endl ; |
| 682 |
cout << "Radial derivative of the expansion at (1,Pi/2,0) = " |
| 683 |
<< der_expansion_2<<endl ; |
| 684 |
cout << "------------------------------------------------------"<<endl; |
| 685 |
|
| 686 |
/* |
| 687 |
des_meridian(expansion, 1, 1.2, "Expansion theta", 2) ; |
| 688 |
des_meridian(expansion, 1, 4., "Expansion theta", 1) ; |
| 689 |
des_meridian(expansion, 1, 10., "Expansion theta", 3) ; |
| 690 |
arrete() ; |
| 691 |
*/ |
| 692 |
|
| 693 |
double max_exp = expansion.val_grid_point(1, 0, 0, 0) ; |
| 694 |
double min_exp = expansion.val_grid_point(1, 0, 0, 0) ; |
| 695 |
int nnp = mp.get_mg()->get_np(1) ; |
| 696 |
int nnt = mp.get_mg()->get_nt(1) ; |
| 697 |
for (int k=0 ; k<nnp ; k++) |
| 698 |
for (int j=0 ; j<nnt ; j++){ |
| 699 |
if (expansion.val_grid_point(1, k, j, 0) > max_exp) |
| 700 |
max_exp = expansion.val_grid_point(1, k, j, 0) ; |
| 701 |
if (expansion.val_grid_point(1, k, j, 0) < min_exp) |
| 702 |
min_exp = expansion.val_grid_point(1, k, j, 0) ; |
| 703 |
} |
| 704 |
cout << "max_exp = " << max_exp << endl |
| 705 |
<< "min_exp = " << min_exp << endl ; |
| 706 |
|
| 707 |
|
| 708 |
// Save in a file |
| 709 |
// -------------- |
| 710 |
|
| 711 |
FILE* fresu = fopen("resu.d", "w") ; |
| 712 |
mgrid.sauve(fresu) ; |
| 713 |
mp.sauve(fresu) ; |
| 714 |
isolhor.sauve(fresu, true) ; |
| 715 |
fclose(fresu) ; |
| 716 |
|
| 717 |
// Test of the constraints |
| 718 |
//------------------------ |
| 719 |
|
| 720 |
if (solve_shift == 1) |
| 721 |
isolhor.update_aa() ; |
| 722 |
else |
| 723 |
isolhor.aa_kerr_ww(mm, aaa) ; |
| 724 |
|
| 725 |
cout<< "----------------------------------------" <<endl ; |
| 726 |
|
| 727 |
Tbl check_ham = isolhor.check_hamiltonian_constraint() ; |
| 728 |
Tbl check_mom = isolhor.check_momentum_constraint() ; |
| 729 |
|
| 730 |
cout<< "----------------------------------------" <<endl ; |
| 731 |
|
| 732 |
|
| 733 |
// Physical parameters of the Black Hole |
| 734 |
//-------------------------------------- |
| 735 |
|
| 736 |
cout<< "------------------------------------------------" <<endl; |
| 737 |
cout<< " Physical parameters of the Black Hole " <<endl; |
| 738 |
cout<< "------------------------------------------------" <<endl; |
| 739 |
|
| 740 |
double rr_hor = isolhor.radius_hor() ; |
| 741 |
cout<< "Radius of the horizon = " << rr_hor <<endl ; |
| 742 |
|
| 743 |
double jj_hor = isolhor.ang_mom_hor() ; |
| 744 |
cout<< "Angular momentum of the horizon = " << jj_hor <<endl ; |
| 745 |
|
| 746 |
double mm_hor = isolhor.mass_hor() ; |
| 747 |
cout<< "Mass of the horizon = " << mm_hor <<endl ; |
| 748 |
|
| 749 |
double kappa_hor = isolhor.kappa_hor() ; |
| 750 |
cout<< "Surface gravity of the horizon = " << kappa_hor <<endl ; |
| 751 |
|
| 752 |
double omega_hor = isolhor.omega_hor() ; |
| 753 |
cout<< "Orbital velocity of the horizon = " << omega_hor <<endl ; |
| 754 |
|
| 755 |
|
| 756 |
// Physical parameters of the Bulk |
| 757 |
//-------------------------------- |
| 758 |
|
| 759 |
cout.precision(8) ; |
| 760 |
cout<< endl; |
| 761 |
cout<< "------------------------------------------------" <<endl; |
| 762 |
cout<< " Physical parameters of the Bulk " <<endl; |
| 763 |
cout<< "------------------------------------------------" <<endl; |
| 764 |
|
| 765 |
double mm_adm = isolhor.adm_mass() ; |
| 766 |
cout << "ADM mass= " << mm_adm <<endl ; |
| 767 |
|
| 768 |
double jj_adm = isolhor.ang_mom_adm() ; |
| 769 |
cout << "ADM angular momentum= " << jj_adm <<endl ; |
| 770 |
|
| 771 |
double aa = jj_adm / mm_adm ; |
| 772 |
cout << "J / M (ADM) : " << aa << endl ; |
| 773 |
|
| 774 |
double aasmm = aa / mm_adm ; |
| 775 |
cout << "J / M^2 : " << aasmm << endl ; |
| 776 |
|
| 777 |
double epsa = isolhor.area_hor() / |
| 778 |
(8*M_PI*(mm_adm*mm_adm + pow(pow(mm_adm, 4.) - jj_adm*jj_adm, 0.5))) ; |
| 779 |
cout << "epsilon A : " << epsa << endl ; |
| 780 |
|
| 781 |
double diff_mm = (mm_adm - mm_hor) / mm_adm ; |
| 782 |
cout << "diff mass : " << diff_mm << endl ; |
| 783 |
|
| 784 |
double diff_jj = (jj_adm - jj_hor) / jj_adm ; |
| 785 |
cout << "diffangular momentum : " << diff_jj << endl ; |
| 786 |
|
| 787 |
// Writing of all global quantities in a file |
| 788 |
ofstream resformat("resformat.d") ; |
| 789 |
resformat.precision(6) ; |
| 790 |
resformat << "# Ham. constr. Mom. constr. " << endl ; |
| 791 |
resformat << max(check_ham) << " " << max(check_mom) << endl ; |
| 792 |
resformat.precision(10) ; |
| 793 |
resformat << "# r_hor J_hor M_hor kappa_hor omega_hor" << endl ; |
| 794 |
resformat << rr_hor << " " << jj_hor << " " << mm_hor << " " |
| 795 |
<< kappa_hor << " " << omega_hor << endl ; |
| 796 |
resformat << "# M_adm J_adm J/M J/M2 Eps_a" << endl ; |
| 797 |
resformat << mm_adm << " " << jj_adm << " " << aa << " " |
| 798 |
<< aasmm << " " << epsa << endl ; |
| 799 |
resformat << "# diff_mm diff_jj" << endl ; |
| 800 |
resformat << diff_mm << " " << diff_jj << endl ; |
| 801 |
|
| 802 |
resformat.close() ; |
| 803 |
|
| 804 |
//-------------------------------------- |
| 805 |
// Comparison |
| 806 |
//-------------------------------------- |
| 807 |
|
| 808 |
cout<<"Tout va bien boudiou / Todo bien!!! (Viva Cai!)"<<endl ; |
| 809 |
|
| 810 |
return EXIT_SUCCESS ; |
| 811 |
} |
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|