| 1 |
/* |
| 2 |
* Reads a binary black hole configuration |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright (c) 2002 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_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_BH/lit_holes_bin.C,v 1.7 2014/10/13 08:53:52 j_novak Exp $" ; |
| 27 |
|
| 28 |
/* |
| 29 |
* $Id: lit_holes_bin.C,v 1.7 2014/10/13 08:53:52 j_novak Exp $ |
| 30 |
* $Log: lit_holes_bin.C,v $ |
| 31 |
* Revision 1.7 2014/10/13 08:53:52 j_novak |
| 32 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 33 |
* |
| 34 |
* Revision 1.6 2014/10/06 15:09:41 j_novak |
| 35 |
* Modified #include directives to use c++ syntax. |
| 36 |
* |
| 37 |
* Revision 1.5 2005/08/25 12:14:11 p_grandclement |
| 38 |
* Addition of a new method to solve the scalar Poisson equation, based on a multi-domain Tau-method |
| 39 |
* |
| 40 |
* Revision 1.4 2004/03/25 12:35:35 j_novak |
| 41 |
* now using namespace Unites |
| 42 |
* |
| 43 |
* Revision 1.3 2003/11/14 08:14:52 p_grandclement |
| 44 |
* Correction of the codes for binary black holes in circular orbit |
| 45 |
* |
| 46 |
* Revision 1.2 2003/04/09 15:05:09 e_gourgoulhon |
| 47 |
* Added copyright and log messages. |
| 48 |
* |
| 49 |
* |
| 50 |
* Revision 1.1 |
| 51 |
* date: 2003/03/31 16:08:23; author: p_grandclement; state: Exp; |
| 52 |
* Add codes for the binary black holes computation : |
| 53 |
* - init_bh.C : computes the Misner-Lindquist solution (used as initial guess for the coal code) |
| 54 |
* - param_statiques.d : example of parameter file for init_bh |
| 55 |
* - coal_bh.C : computation of the binary |
| 56 |
* - param_coal.d : example of the paramater file for coal_bh |
| 57 |
* - lit_holes_bin.C : reads a configuration. |
| 58 |
* |
| 59 |
* $Header: /cvsroot/Lorene/Codes/Bin_BH/lit_holes_bin.C,v 1.7 2014/10/13 08:53:52 j_novak Exp $ |
| 60 |
* |
| 61 |
*/ |
| 62 |
|
| 63 |
//standard |
| 64 |
#include <cstdlib> |
| 65 |
#include <cmath> |
| 66 |
|
| 67 |
// LORENE |
| 68 |
#include "type_parite.h" |
| 69 |
#include "nbr_spx.h" |
| 70 |
#include "proto.h" |
| 71 |
#include "param.h" |
| 72 |
#include "coord.h" |
| 73 |
#include "cmp.h" |
| 74 |
#include "tenseur.h" |
| 75 |
#include "bhole.h" |
| 76 |
#include "graphique.h" |
| 77 |
#include "utilitaires.h" |
| 78 |
#include "unites.h" |
| 79 |
|
| 80 |
|
| 81 |
using namespace Lorene ; |
| 82 |
|
| 83 |
int main(int argc, char** argv) { |
| 84 |
|
| 85 |
using namespace Unites ; |
| 86 |
if (argc <2) { |
| 87 |
cout <<" Passer nom du ficher en arguments SVP !" << endl ; |
| 88 |
abort() ; |
| 89 |
} |
| 90 |
|
| 91 |
char* name_fich = argv[1] ; |
| 92 |
|
| 93 |
FILE* fich = fopen(name_fich, "r") ; |
| 94 |
|
| 95 |
Mg3d grille (fich) ; |
| 96 |
Map_af map_un (grille, fich) ; |
| 97 |
Map_af map_deux (grille, fich) ; |
| 98 |
Bhole hole_un (map_un, fich) ; |
| 99 |
Bhole hole_deux (map_deux, fich) ; |
| 100 |
fclose(fich) ; |
| 101 |
|
| 102 |
assert (hole_un.get_omega() == hole_deux.get_omega()) ; |
| 103 |
|
| 104 |
Bhole_binaire systeme (map_un, map_deux) ; |
| 105 |
systeme.set(1) = hole_un ; |
| 106 |
systeme.set(2) = hole_deux ; |
| 107 |
systeme.set_omega(hole_un.get_omega()) ; |
| 108 |
|
| 109 |
// On initialise les grandeurs derivees : |
| 110 |
systeme.set(1).fait_n_comp (systeme(2)) ; |
| 111 |
systeme.set(1).fait_psi_comp (systeme(2)) ; |
| 112 |
systeme.set(2).fait_n_comp (systeme(1)) ; |
| 113 |
systeme.set(2).fait_psi_comp (systeme(1)) ; |
| 114 |
systeme.fait_decouple() ; |
| 115 |
systeme.fait_tkij() ; |
| 116 |
|
| 117 |
double distance = map_un.get_ori_x() - map_deux.get_ori_x() ; |
| 118 |
|
| 119 |
double beta = distance/systeme(1).get_rayon() ; |
| 120 |
double omega = systeme.get_omega() ; |
| 121 |
double adm = systeme.adm_systeme() ; |
| 122 |
double komar = systeme.komar_systeme() ; |
| 123 |
double moment_inf = systeme.moment_systeme_inf() ; |
| 124 |
double moment_hor = systeme.moment_systeme_hor() ; |
| 125 |
double distance_propre = systeme.distance_propre() ; |
| 126 |
double aire = sqrt(systeme(1).area()/16/M_PI) + |
| 127 |
sqrt(systeme(2).area()/16/M_PI) ; |
| 128 |
|
| 129 |
cout << "Beta : " << beta << endl ; |
| 130 |
cout << "Omega : " << omega << endl ; |
| 131 |
cout << "Masse ADM : " << adm << endl ; |
| 132 |
cout << "Masse Komar : " << komar << endl ; |
| 133 |
cout << "Masse aire : " << aire << endl ; |
| 134 |
cout << "Moment infiny : " << moment_inf << endl ; |
| 135 |
cout << "Moment horizon : " << moment_hor << endl ; |
| 136 |
cout << "Distance propre : " << distance_propre << endl ; |
| 137 |
|
| 138 |
// On verifie smarr : |
| 139 |
Cmp integrant_un (systeme(1).get_n_tot()().dsdr()* |
| 140 |
pow(systeme(1).get_psi_tot()(), 2)) ; |
| 141 |
integrant_un.std_base_scal() ; |
| 142 |
integrant_un.raccord(1) ; |
| 143 |
Cmp integrant_deux (systeme(2).get_n_tot()().dsdr()* |
| 144 |
pow(systeme(2).get_psi_tot()(), 2)) ; |
| 145 |
integrant_deux.std_base_scal() ; |
| 146 |
integrant_deux.raccord(1) ; |
| 147 |
|
| 148 |
double horizon = map_un.integrale_surface(integrant_un, systeme(1).get_rayon())+ |
| 149 |
map_deux.integrale_surface(integrant_deux, systeme(2).get_rayon()) ; |
| 150 |
|
| 151 |
horizon /= 4*M_PI ; |
| 152 |
|
| 153 |
double j_test = (komar-horizon)/2/systeme.get_omega() ; |
| 154 |
|
| 155 |
cout.precision(10) ; |
| 156 |
cout << "------------------------------------------" << endl ; |
| 157 |
cout << "Ecart entre les deux J : " << fabs(moment_inf-moment_hor)/moment_inf << endl ; |
| 158 |
cout << "Ecart infini et Smarr : " << fabs(moment_inf-j_test)/moment_inf << endl ; |
| 159 |
cout << "Ecart horizon et Smarr : " << fabs(moment_hor-j_test)/moment_inf << endl ; |
| 160 |
|
| 161 |
cout << "------------------------------------------" << endl ; |
| 162 |
cout << "Ecart Komar-ADM : " << fabs(komar-adm)/fabs(adm) << endl ; |
| 163 |
cout << "Ecart Kepler : " << 4*moment_inf*pow(omega, 1./3.)/pow(adm, 5./3.) |
| 164 |
<< endl ; |
| 165 |
cout << "------------------------------------------" << endl ; |
| 166 |
cout << "Masse ADM : " << adm/ggrav/msol << "Masses solaires" << endl ; |
| 167 |
cout << "Frequence : " << omega/2/M_PI*f_unit << " Hz" << endl ; |
| 168 |
|
| 169 |
cout <<"---------------------------------------------------------" << endl ; |
| 170 |
double misner = adm_serie(systeme(1).get_rayon(), distance, 1e-15) ; |
| 171 |
cout << "Ecart ADM-Misner : " << fabs(misner-adm)/misner << endl ; |
| 172 |
cout << "----------------------------------------------------------" << endl ; |
| 173 |
|
| 174 |
cout << beta << " " << omega << " " << adm << " " << moment_inf << " " << |
| 175 |
aire << endl ; |
| 176 |
|
| 177 |
|
| 178 |
// PLOTS // |
| 179 |
// Les Cmp pour annuler : |
| 180 |
Cmp surface_un (map_un) ; |
| 181 |
surface_un = pow(map_un.r, 2.)-pow(systeme(1).get_rayon(), 2.) ; |
| 182 |
surface_un.annule(grille.get_nzone()-1) ; |
| 183 |
surface_un.std_base_scal() ; |
| 184 |
|
| 185 |
Cmp surface_deux (map_deux) ; |
| 186 |
surface_deux = pow(map_deux.r, 2.)-pow(systeme(2).get_rayon(), 2.) ; |
| 187 |
surface_deux.annule(grille.get_nzone()-1) ; |
| 188 |
surface_deux.std_base_scal() ; |
| 189 |
|
| 190 |
|
| 191 |
// Des dessins, des dessins, des dessins |
| 192 |
double ta = 15 ; |
| 193 |
Cmp filtre_un (map_un) ; |
| 194 |
int zex = grille.get_nzone()-1 ; |
| 195 |
filtre_un = 1 ; |
| 196 |
double alpha = map_un.get_alpha()[zex] ; |
| 197 |
double rext = 1/(-2*alpha) ; |
| 198 |
int nr = grille.get_nr(zex) ; |
| 199 |
int np = grille.get_np(zex) ; |
| 200 |
int nt = grille.get_nt(zex) ; |
| 201 |
|
| 202 |
double uu, coloc ; |
| 203 |
for (int i=0 ; i<nr-1 ; i++) { |
| 204 |
coloc = -cos(M_PI*i/(nr-1)) ; |
| 205 |
uu = alpha*(coloc-1) ; |
| 206 |
if (uu <= 1./2/rext) |
| 207 |
for (int j=0 ; j<nt ; j++) |
| 208 |
for (int k=0 ; k<np ; k++) |
| 209 |
filtre_un.set(zex, k, j, i) = |
| 210 |
0.5*(cos(M_PI*2*rext*(uu-1./2/rext))+1) ; |
| 211 |
} |
| 212 |
for (int j=0 ; j<nt ; j++) |
| 213 |
for (int k=0 ; k<np ; k++) |
| 214 |
filtre_un.set(zex, k, j, nr-1) = 0 ; |
| 215 |
filtre_un.std_base_scal() ; |
| 216 |
|
| 217 |
Cmp filtre_deux (map_deux) ; |
| 218 |
filtre_deux.set_etat_qcq() ; |
| 219 |
filtre_deux.va = filtre_un.va ; |
| 220 |
|
| 221 |
Tenseur shift_un (systeme(1).get_shift_auto()) ; |
| 222 |
Cmp xa_un (map_un) ; |
| 223 |
xa_un = omega/2*map_un.xa ; |
| 224 |
Cmp ya_un (map_un) ; |
| 225 |
ya_un = omega/2*map_un.ya ; |
| 226 |
shift_un.set(0) = shift_un(0)-ya_un ; |
| 227 |
shift_un.set(1) = shift_un(1)+xa_un ; |
| 228 |
for (int i=0 ; i<3 ; i++) { |
| 229 |
shift_un.set(i).annule(0) ; |
| 230 |
shift_un.set(i)= filtre_un*shift_un(i) ; |
| 231 |
shift_un.set(i).set_val_inf(0) ; |
| 232 |
} |
| 233 |
|
| 234 |
shift_un.set_std_base() ; |
| 235 |
|
| 236 |
Tenseur shift_deux (map_deux, 1, CON, map_un.get_bvect_cart()) ; |
| 237 |
shift_deux.set_etat_qcq() ; |
| 238 |
shift_deux.set(0) = -systeme(1).get_shift_auto()(0) ; |
| 239 |
shift_deux.set(1) = -systeme(1).get_shift_auto()(1) ; |
| 240 |
shift_deux.set(2) = systeme(1).get_shift_auto()(2) ; |
| 241 |
Cmp xa_deux (map_deux) ; |
| 242 |
xa_deux = omega/2*map_deux.xa ; |
| 243 |
Cmp ya_deux (map_deux) ; |
| 244 |
ya_deux = omega/2*map_deux.ya ; |
| 245 |
shift_deux.set(0) = shift_deux(0)-ya_deux ; |
| 246 |
shift_deux.set(1) = shift_deux(1)+xa_deux ; |
| 247 |
for (int i=0 ; i<3 ; i++) { |
| 248 |
shift_deux.set(i).annule(0) ; |
| 249 |
shift_deux.set(i) = filtre_deux*shift_deux(i) ; |
| 250 |
shift_deux.set(i).set_val_inf(0) ; |
| 251 |
} |
| 252 |
shift_deux.set_std_base() ; |
| 253 |
|
| 254 |
des_vect_bin_z (shift_un, shift_deux, 0, 200, 1, -ta, ta, -ta, ta, |
| 255 |
"Shift vector (Z=0)", &surface_un, &surface_deux, false, 12, 12) ; |
| 256 |
|
| 257 |
ta = 13.5 ; |
| 258 |
Cmp dessin_un (systeme(1).get_n_auto()()) ; |
| 259 |
dessin_un.annule(0) ; |
| 260 |
|
| 261 |
Cmp dessin_deux (systeme(2).get_n_auto()()) ; |
| 262 |
dessin_deux.annule(0) ; |
| 263 |
|
| 264 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 265 |
-ta, ta, -ta, ta, "Lapse function (Z=0)", &surface_un, &surface_deux, |
| 266 |
false, 15, 300, 300) ; |
| 267 |
|
| 268 |
dessin_un = systeme(1).get_psi_auto()() ; |
| 269 |
dessin_un.annule(0) ; |
| 270 |
|
| 271 |
dessin_deux = systeme(2).get_psi_auto()() ; |
| 272 |
dessin_deux.annule(0) ; |
| 273 |
|
| 274 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 275 |
-ta, ta, -ta, ta, "Conformal factor (Z=0)", &surface_un, &surface_deux, |
| 276 |
false, 15, 300, 300) ; |
| 277 |
|
| 278 |
ta = 18.5 ; |
| 279 |
dessin_un = systeme(1).get_tkij_auto()(0, 0) ; |
| 280 |
dessin_un.std_base_scal() ; |
| 281 |
dessin_un.annule(0) ; |
| 282 |
dessin_un.dec2_dzpuis() ; |
| 283 |
|
| 284 |
dessin_deux = systeme(2).get_tkij_auto()(0, 0) ; |
| 285 |
dessin_deux.std_base_scal() ; |
| 286 |
dessin_deux.annule(0) ; |
| 287 |
dessin_deux.dec2_dzpuis() ; |
| 288 |
|
| 289 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 290 |
-ta, ta, -ta, ta, "A\\uXX\\d (Z=0)", &surface_un, &surface_deux, false |
| 291 |
, 15, 300, 300) ; |
| 292 |
|
| 293 |
dessin_un = systeme(1).get_tkij_auto()(1, 0) ; |
| 294 |
dessin_un.std_base_scal() ; |
| 295 |
dessin_un.annule(0) ; |
| 296 |
dessin_un.dec2_dzpuis() ; |
| 297 |
|
| 298 |
dessin_deux = systeme(2).get_tkij_auto()(1, 0) ; |
| 299 |
dessin_deux.std_base_scal() ; |
| 300 |
dessin_deux.annule(0) ; |
| 301 |
dessin_deux.dec2_dzpuis() ; |
| 302 |
|
| 303 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 304 |
-ta, ta, -ta, ta, "A\\uXY\\d (Z=0)", &surface_un, &surface_deux, false, |
| 305 |
15, 300, 300) ; |
| 306 |
|
| 307 |
dessin_un = systeme(1).get_tkij_auto()(1, 1) ; |
| 308 |
dessin_un.std_base_scal() ; |
| 309 |
dessin_un.annule(0) ; |
| 310 |
dessin_un.dec2_dzpuis() ; |
| 311 |
|
| 312 |
dessin_deux = systeme(2).get_tkij_auto()(1, 1) ; |
| 313 |
dessin_deux.std_base_scal() ; |
| 314 |
dessin_deux.annule(0) ; |
| 315 |
dessin_deux.dec2_dzpuis() ; |
| 316 |
|
| 317 |
des_coupe_bin_z (dessin_un, dessin_deux, 0, |
| 318 |
-ta, ta, -ta, ta, "A\\uYY\\d (Z=0)", &surface_un, &surface_deux, |
| 319 |
false, 15, 300, 300) ; |
| 320 |
|
| 321 |
return 1; |
| 322 |
} |