| 1 |
/* |
| 2 |
* Reads a binary black hole configuration |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 2005 Philippe Grandclement |
| 8 |
* |
| 9 |
* This file is part of LORENE. |
| 10 |
* |
| 11 |
* LORENE is free software; you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License version 2 |
| 13 |
* as published by the Free Software Foundation. |
| 14 |
* |
| 15 |
* LORENE is distributed in the hope that it will be useful, |
| 16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
* GNU General Public License for more details. |
| 19 |
* |
| 20 |
* You should have received a copy of the GNU General Public License |
| 21 |
* along with LORENE; if not, write to the Free Software |
| 22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 |
* |
| 24 |
*/ |
| 25 |
|
| 26 |
char lit_holes_bin_mdiff_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_BH_mass_diff/lit_holes_bin_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $" ; |
| 27 |
|
| 28 |
/* |
| 29 |
* $Id: lit_holes_bin_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $ |
| 30 |
* $Log: lit_holes_bin_mdiff.C,v $ |
| 31 |
* Revision 1.3 2014/10/13 08:53:52 j_novak |
| 32 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 33 |
* |
| 34 |
* Revision 1.2 2014/10/06 15:09:41 j_novak |
| 35 |
* Modified #include directives to use c++ syntax. |
| 36 |
* |
| 37 |
* Revision 1.1 2005/08/29 15:10:19 p_grandclement |
| 38 |
* Addition of things needed : |
| 39 |
* 1) For BBH with different masses |
| 40 |
* 2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT |
| 41 |
* WORKING YET !!! |
| 42 |
* |
| 43 |
* |
| 44 |
* $Header: /cvsroot/Lorene/Codes/Bin_BH_mass_diff/lit_holes_bin_mdiff.C,v 1.3 2014/10/13 08:53:52 j_novak Exp $ |
| 45 |
* |
| 46 |
*/ |
| 47 |
|
| 48 |
//standard |
| 49 |
#include <cstdlib> |
| 50 |
#include <cmath> |
| 51 |
|
| 52 |
// LORENE |
| 53 |
#include "type_parite.h" |
| 54 |
#include "nbr_spx.h" |
| 55 |
#include "proto.h" |
| 56 |
#include "param.h" |
| 57 |
#include "coord.h" |
| 58 |
#include "cmp.h" |
| 59 |
#include "tenseur.h" |
| 60 |
#include "bhole.h" |
| 61 |
#include "graphique.h" |
| 62 |
#include "utilitaires.h" |
| 63 |
#include "unites.h" |
| 64 |
|
| 65 |
|
| 66 |
using namespace Lorene ; |
| 67 |
|
| 68 |
int main(int argc, char** argv) { |
| 69 |
|
| 70 |
using namespace Unites ; |
| 71 |
if (argc <2) { |
| 72 |
cout <<" Passer nom du ficher en arguments SVP !" << endl ; |
| 73 |
abort() ; |
| 74 |
} |
| 75 |
|
| 76 |
char* name_fich = argv[1] ; |
| 77 |
|
| 78 |
FILE* fich = fopen(name_fich, "r") ; |
| 79 |
|
| 80 |
Mg3d grille_un (fich) ; |
| 81 |
Mg3d grille_deux (fich) ; |
| 82 |
Map_af map_un (grille_un, fich) ; |
| 83 |
Map_af map_deux (grille_deux, fich) ; |
| 84 |
Bhole hole_un (map_un, fich) ; |
| 85 |
Bhole hole_deux (map_deux, fich) ; |
| 86 |
fclose(fich) ; |
| 87 |
|
| 88 |
assert (hole_un.get_omega() == hole_deux.get_omega()) ; |
| 89 |
|
| 90 |
Bhole_binaire systeme (map_un, map_deux) ; |
| 91 |
systeme.set(1) = hole_un ; |
| 92 |
systeme.set(2) = hole_deux ; |
| 93 |
systeme.set_omega(hole_un.get_omega()) ; |
| 94 |
|
| 95 |
// On initialise les grandeurs derivees : |
| 96 |
systeme.set(1).fait_n_comp (systeme(2)) ; |
| 97 |
systeme.set(1).fait_psi_comp (systeme(2)) ; |
| 98 |
systeme.set(2).fait_n_comp (systeme(1)) ; |
| 99 |
systeme.set(2).fait_psi_comp (systeme(1)) ; |
| 100 |
systeme.fait_decouple() ; |
| 101 |
systeme.fait_tkij() ; |
| 102 |
double distance = map_un.get_ori_x() - map_deux.get_ori_x() ; |
| 103 |
|
| 104 |
double beta = distance/systeme(1).get_rayon() ; |
| 105 |
double omega = systeme.get_omega() ; |
| 106 |
double adm = systeme.adm_systeme() ; |
| 107 |
double komar = systeme.komar_systeme() ; |
| 108 |
double moment_inf = systeme.moment_systeme_inf() ; |
| 109 |
double moment_hor = systeme.moment_systeme_hor() ; |
| 110 |
double distance_propre = systeme.distance_propre() ; |
| 111 |
double m1 = sqrt(systeme(1).area()/16/M_PI) ; |
| 112 |
double m2 = sqrt(systeme(2).area()/16/M_PI) ; |
| 113 |
double linear = systeme.linear_momentum_systeme_inf()(1) ; |
| 114 |
|
| 115 |
cout << "Beta : " << beta << endl ; |
| 116 |
cout << "Omega : " << omega << endl ; |
| 117 |
cout << "Masse ADM : " << adm << endl ; |
| 118 |
cout << "Masse Komar : " << komar << endl ; |
| 119 |
cout << "Masse un : " << m1 << endl ; |
| 120 |
cout << "Masse deux : " << m2 << endl ; |
| 121 |
cout << "Mu sur M : " << m1*m2/(m1+m2)/(m1+m2) << endl ; |
| 122 |
cout << "Moment infiny : " << moment_inf << endl ; |
| 123 |
cout << "Moment horizon : " << moment_hor << endl ; |
| 124 |
cout << "Distance propre : " << distance_propre << endl ; |
| 125 |
cout << "Quantite move : " << linear << endl ; |
| 126 |
|
| 127 |
// On verifie smarr : |
| 128 |
Cmp integrant_un (systeme(1).get_n_tot()().dsdr()* |
| 129 |
pow(systeme(1).get_psi_tot()(), 2)) ; |
| 130 |
integrant_un.std_base_scal() ; |
| 131 |
integrant_un.raccord(1) ; |
| 132 |
Cmp integrant_deux (systeme(2).get_n_tot()().dsdr()* |
| 133 |
pow(systeme(2).get_psi_tot()(), 2)) ; |
| 134 |
integrant_deux.std_base_scal() ; |
| 135 |
integrant_deux.raccord(1) ; |
| 136 |
|
| 137 |
double horizon = map_un.integrale_surface(integrant_un, systeme(1).get_rayon())+ |
| 138 |
map_deux.integrale_surface(integrant_deux, systeme(2).get_rayon()) ; |
| 139 |
|
| 140 |
horizon /= 4*M_PI ; |
| 141 |
|
| 142 |
double j_test = (komar-horizon)/2/systeme.get_omega() ; |
| 143 |
|
| 144 |
cout.precision(10) ; |
| 145 |
cout << "------------------------------------------" << endl ; |
| 146 |
cout << "Ecart entre les deux J : " << fabs(moment_inf-moment_hor)/moment_inf << endl ; |
| 147 |
cout << "Ecart infini et Smarr : " << fabs(moment_inf-j_test)/moment_inf << endl ; |
| 148 |
cout << "Ecart horizon et Smarr : " << fabs(moment_hor-j_test)/moment_inf << endl ; |
| 149 |
|
| 150 |
cout << "------------------------------------------" << endl ; |
| 151 |
cout << "Ecart Komar-ADM : " << fabs(komar-adm)/fabs(adm) << endl ; |
| 152 |
cout << "Ecart Kepler : " << 4*moment_inf*pow(omega, 1./3.)/pow(adm, 5./3.) |
| 153 |
<< endl ; |
| 154 |
cout << "------------------------------------------" << endl ; |
| 155 |
cout << "Masse ADM : " << adm/ggrav/msol << " Masses solaires" << endl ; |
| 156 |
cout << "Frequence : " << omega/2/M_PI*f_unit << " Hz" << endl ; |
| 157 |
|
| 158 |
cout <<"---------------------------------------------------------" << endl ; |
| 159 |
double misner = adm_serie(systeme(1).get_rayon(), distance, 1e-15) ; |
| 160 |
cout << "Ecart ADM-Misner : " << fabs(misner-adm)/misner << endl ; |
| 161 |
cout << "----------------------------------------------------------" << endl ; |
| 162 |
|
| 163 |
// PLOTS // |
| 164 |
// Les Cmp pour annuler : |
| 165 |
Cmp surface_un (map_un) ; |
| 166 |
surface_un = pow(map_un.r, 2.)-pow(systeme(1).get_rayon(), 2.) ; |
| 167 |
surface_un.annule(grille_un.get_nzone()-1) ; |
| 168 |
surface_un.std_base_scal() ; |
| 169 |
|
| 170 |
Cmp surface_deux (map_deux) ; |
| 171 |
surface_deux = pow(map_deux.r, 2.)-pow(systeme(2).get_rayon(), 2.) ; |
| 172 |
surface_deux.annule(grille_deux.get_nzone()-1) ; |
| 173 |
surface_deux.std_base_scal() ; |
| 174 |
|
| 175 |
// Des dessins, des dessins, des dessins |
| 176 |
double ta = 120 ; |
| 177 |
|
| 178 |
Cmp filtre_un (map_un) ; |
| 179 |
int zex = grille_un.get_nzone()-1 ; |
| 180 |
filtre_un = 1 ; |
| 181 |
double alpha = map_un.get_alpha()[zex] ; |
| 182 |
double rext = 1/(-2*alpha) ; |
| 183 |
int nr = grille_un.get_nr(zex) ; |
| 184 |
int np = grille_un.get_np(zex) ; |
| 185 |
int nt = grille_un.get_nt(zex) ; |
| 186 |
|
| 187 |
double uu, coloc ; |
| 188 |
for (int i=0 ; i<nr-1 ; i++) { |
| 189 |
coloc = -cos(M_PI*i/(nr-1)) ; |
| 190 |
uu = alpha*(coloc-1) ; |
| 191 |
if (uu <= 1./2/rext) |
| 192 |
for (int j=0 ; j<nt ; j++) |
| 193 |
for (int k=0 ; k<np ; k++) |
| 194 |
filtre_un.set(zex, k, j, i) = |
| 195 |
0.5*(cos(M_PI*2*rext*(uu-1./2/rext))+1) ; |
| 196 |
} |
| 197 |
for (int j=0 ; j<nt ; j++) |
| 198 |
for (int k=0 ; k<np ; k++) |
| 199 |
filtre_un.set(zex, k, j, nr-1) = 0 ; |
| 200 |
filtre_un.std_base_scal() ; |
| 201 |
|
| 202 |
Cmp filtre_deux (map_deux) ; |
| 203 |
zex = grille_deux.get_nzone()-1 ; |
| 204 |
filtre_deux = 1 ; |
| 205 |
alpha = map_deux.get_alpha()[zex] ; |
| 206 |
rext = 1/(-2*alpha) ; |
| 207 |
nr = grille_deux.get_nr(zex) ; |
| 208 |
np = grille_deux.get_np(zex) ; |
| 209 |
nt = grille_deux.get_nt(zex) ; |
| 210 |
|
| 211 |
for (int i=0 ; i<nr-1 ; i++) { |
| 212 |
coloc = -cos(M_PI*i/(nr-1)) ; |
| 213 |
uu = alpha*(coloc-1) ; |
| 214 |
if (uu <= 1./2/rext) |
| 215 |
for (int j=0 ; j<nt ; j++) |
| 216 |
for (int k=0 ; k<np ; k++) |
| 217 |
filtre_deux.set(zex, k, j, i) = |
| 218 |
0.5*(cos(M_PI*2*rext*(uu-1./2/rext))+1) ; |
| 219 |
} |
| 220 |
for (int j=0 ; j<nt ; j++) |
| 221 |
for (int k=0 ; k<np ; k++) |
| 222 |
filtre_deux.set(zex, k, j, nr-1) = 0 ; |
| 223 |
filtre_deux.std_base_scal() ; |
| 224 |
|
| 225 |
Tenseur shift_un (systeme(1).get_shift_auto()) ; |
| 226 |
Cmp xa_un (map_un) ; |
| 227 |
xa_un = omega/2*map_un.xa ; |
| 228 |
Cmp ya_un (map_un) ; |
| 229 |
ya_un = omega/2*map_un.ya ; |
| 230 |
shift_un.set(0) = shift_un(0)-ya_un ; |
| 231 |
shift_un.set(1) = shift_un(1)+xa_un ; |
| 232 |
for (int i=0 ; i<3 ; i++) { |
| 233 |
shift_un.set(i).annule(0) ; |
| 234 |
shift_un.set(i)= filtre_un*shift_un(i) ; |
| 235 |
shift_un.set(i).set_val_inf(0) ; |
| 236 |
} |
| 237 |
|
| 238 |
shift_un.set_std_base() ; |
| 239 |
|
| 240 |
Tenseur shift_deux (map_deux, 1, CON, map_un.get_bvect_cart()) ; |
| 241 |
shift_deux.set_etat_qcq() ; |
| 242 |
shift_deux.set(0) = -systeme(2).get_shift_auto()(0) ; |
| 243 |
shift_deux.set(1) = -systeme(2).get_shift_auto()(1) ; |
| 244 |
shift_deux.set(2) = systeme(2).get_shift_auto()(2) ; |
| 245 |
Cmp xa_deux (map_deux) ; |
| 246 |
xa_deux = omega/2*map_deux.xa ; |
| 247 |
Cmp ya_deux (map_deux) ; |
| 248 |
ya_deux = omega/2*map_deux.ya ; |
| 249 |
shift_deux.set(0) = shift_deux(0)-ya_deux ; |
| 250 |
shift_deux.set(1) = shift_deux(1)+xa_deux ; |
| 251 |
for (int i=0 ; i<3 ; i++) { |
| 252 |
shift_deux.set(i).annule(0) ; |
| 253 |
shift_deux.set(i) = filtre_deux*shift_deux(i) ; |
| 254 |
shift_deux.set(i).set_val_inf(0) ; |
| 255 |
} |
| 256 |
shift_deux.set_std_base() ; |
| 257 |
|
| 258 |
des_vect_bin_z (shift_un, shift_deux, 0, 1000, 1, -ta, ta, -ta, ta, |
| 259 |
"Shift vector (Z=0)", &surface_un, &surface_deux, false, 12, 12) ; |
| 260 |
|
| 261 |
|
| 262 |
ta = 120 ; |
| 263 |
Cmp dessin_un (systeme(1).get_n_auto()()) ; |
| 264 |
dessin_un.annule(0) ; |
| 265 |
|
| 266 |
Cmp dessin_deux (systeme(2).get_n_auto()()) ; |
| 267 |
dessin_deux.annule(0) ; |
| 268 |
|
| 269 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 270 |
-ta, ta, -ta, ta, "Lapse function (Z=0)", &surface_un, &surface_deux, |
| 271 |
false, 15, 300, 300) ; |
| 272 |
|
| 273 |
dessin_un = systeme(1).get_psi_auto()() ; |
| 274 |
dessin_un.annule(0) ; |
| 275 |
|
| 276 |
dessin_deux = systeme(2).get_psi_auto()() ; |
| 277 |
dessin_deux.annule(0) ; |
| 278 |
|
| 279 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 280 |
-ta, ta, -ta, ta, "Conformal factor (Z=0)", &surface_un, &surface_deux, |
| 281 |
false, 15, 300, 300) ; |
| 282 |
|
| 283 |
ta = 100 ; |
| 284 |
dessin_un = systeme(1).get_tkij_auto()(0, 0) ; |
| 285 |
dessin_un.std_base_scal() ; |
| 286 |
dessin_un.annule(0) ; |
| 287 |
dessin_un.dec2_dzpuis() ; |
| 288 |
|
| 289 |
dessin_deux = systeme(2).get_tkij_auto()(0, 0) ; |
| 290 |
dessin_deux.std_base_scal() ; |
| 291 |
dessin_deux.annule(0) ; |
| 292 |
dessin_deux.dec2_dzpuis() ; |
| 293 |
|
| 294 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 295 |
-ta, ta, -ta, ta, "A\\uXX\\d (Z=0)", &surface_un, &surface_deux, false |
| 296 |
, 15, 300, 300) ; |
| 297 |
|
| 298 |
dessin_un = systeme(1).get_tkij_auto()(1, 0) ; |
| 299 |
dessin_un.std_base_scal() ; |
| 300 |
dessin_un.annule(0) ; |
| 301 |
dessin_un.dec2_dzpuis() ; |
| 302 |
|
| 303 |
dessin_deux = systeme(2).get_tkij_auto()(1, 0) ; |
| 304 |
dessin_deux.std_base_scal() ; |
| 305 |
dessin_deux.annule(0) ; |
| 306 |
dessin_deux.dec2_dzpuis() ; |
| 307 |
|
| 308 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 309 |
-ta, ta, -ta, ta, "A\\uXY\\d (Z=0)", &surface_un, &surface_deux, false, |
| 310 |
15, 300, 300) ; |
| 311 |
|
| 312 |
dessin_un = systeme(1).get_tkij_auto()(1, 1) ; |
| 313 |
dessin_un.std_base_scal() ; |
| 314 |
dessin_un.annule(0) ; |
| 315 |
dessin_un.dec2_dzpuis() ; |
| 316 |
|
| 317 |
dessin_deux = systeme(2).get_tkij_auto()(1, 1) ; |
| 318 |
dessin_deux.std_base_scal() ; |
| 319 |
dessin_deux.annule(0) ; |
| 320 |
dessin_deux.dec2_dzpuis() ; |
| 321 |
|
| 322 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 323 |
-ta, ta, -ta, ta, "A\\uYY\\d (Z=0)", &surface_un, &surface_deux, |
| 324 |
false, 15, 300, 300) ; |
| 325 |
|
| 326 |
return 0; |
| 327 |
} |