00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 char blackhole_C[] = "$Header: /cvsroot/Lorene/C++/Source/Black_hole/blackhole.C,v 1.3 2008/07/03 14:55:26 k_taniguchi Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include <math.h>
00052
00053
00054 #include "blackhole.h"
00055 #include "utilitaires.h"
00056 #include "unites.h"
00057
00058
00059
00060
00061
00062
00063
00064 Black_hole::Black_hole(Map& mp_i, bool kerrschild_i, double massbh)
00065 : mp(mp_i),
00066 kerrschild(kerrschild_i),
00067 mass_bh(massbh),
00068 lapconf(mp_i),
00069 lapconf_rs(mp_i),
00070 lapconf_bh(mp_i),
00071 lapse(mp_i),
00072 shift(mp_i, CON, mp_i.get_bvect_cart()),
00073 shift_rs(mp_i, CON, mp_i.get_bvect_cart()),
00074 shift_bh(mp_i, CON, mp_i.get_bvect_cart()),
00075 confo(mp_i),
00076 taij(mp_i, CON, mp_i.get_bvect_cart()),
00077 taij_rs(mp_i, CON, mp_i.get_bvect_cart()),
00078 taij_quad(mp_i),
00079 taij_quad_rs(mp_i),
00080 flat(mp_i, mp_i.get_bvect_cart()) {
00081
00082
00083 set_der_0x0() ;
00084
00085
00086 lapconf = 1. ;
00087 lapconf.std_spectral_base() ;
00088 lapconf_rs = 0. ;
00089 lapconf_rs.std_spectral_base() ;
00090 lapconf_bh = 1. ;
00091 lapconf_bh.std_spectral_base() ;
00092 lapse = 1. ;
00093 lapse.std_spectral_base() ;
00094 shift.set_etat_zero() ;
00095 shift_rs.set_etat_zero() ;
00096 shift_bh.set_etat_zero() ;
00097 confo = 1. ;
00098 confo.std_spectral_base() ;
00099
00100 taij.set_etat_zero() ;
00101 taij_rs.set_etat_zero() ;
00102 taij_quad = 0. ;
00103 taij_quad.std_spectral_base() ;
00104 taij_quad_rs = 0. ;
00105 taij_quad_rs.std_spectral_base() ;
00106
00107 }
00108
00109
00110
00111 Black_hole::Black_hole(const Black_hole& bh)
00112 : mp(bh.mp),
00113 kerrschild(bh.kerrschild),
00114 mass_bh(bh.mass_bh),
00115 lapconf(bh.lapconf),
00116 lapconf_rs(bh.lapconf_rs),
00117 lapconf_bh(bh.lapconf_bh),
00118 lapse(bh.lapse),
00119 shift(bh.shift),
00120 shift_rs(bh.shift_rs),
00121 shift_bh(bh.shift_bh),
00122 confo(bh.confo),
00123 taij(bh.taij),
00124 taij_rs(bh.taij_rs),
00125 taij_quad(bh.taij_quad),
00126 taij_quad_rs(bh.taij_quad_rs),
00127 flat(bh.flat) {
00128
00129 set_der_0x0() ;
00130
00131 }
00132
00133
00134
00135 Black_hole::Black_hole(Map& mp_i, FILE* fich)
00136 : mp(mp_i),
00137 lapconf(mp_i),
00138 lapconf_rs(mp_i, *(mp_i.get_mg()), fich),
00139 lapconf_bh(mp_i),
00140 lapse(mp_i),
00141 shift(mp_i, CON, mp_i.get_bvect_cart()),
00142 shift_rs(mp_i, mp_i.get_bvect_cart(), fich),
00143 shift_bh(mp_i, CON, mp_i.get_bvect_cart()),
00144 confo(mp_i, *(mp_i.get_mg()), fich),
00145 taij(mp_i, CON, mp_i.get_bvect_cart()),
00146 taij_rs(mp_i, CON, mp_i.get_bvect_cart()),
00147 taij_quad(mp_i),
00148 taij_quad_rs(mp_i),
00149 flat(mp_i, mp_i.get_bvect_cart()) {
00150
00151
00152
00153 fread(&kerrschild, sizeof(bool), 1, fich) ;
00154 fread(&mass_bh, sizeof(double), 1, fich) ;
00155
00156
00157
00158 lapconf = lapconf_rs ;
00159 lapconf.std_spectral_base() ;
00160 lapconf_bh = 0. ;
00161 lapconf_bh.std_spectral_base() ;
00162
00163 lapse = lapconf / confo ;
00164
00165 shift = shift_rs ;
00166 shift.std_spectral_base() ;
00167 shift_bh.set_etat_zero() ;
00168
00169 taij.set_etat_zero() ;
00170 taij_rs.set_etat_zero() ;
00171 taij_quad = 0. ;
00172 taij_quad.std_spectral_base() ;
00173 taij_quad_rs = 0. ;
00174 taij_quad_rs.std_spectral_base() ;
00175
00176
00177
00178 set_der_0x0() ;
00179
00180 }
00181
00182
00183
00184
00185
00186
00187 Black_hole::~Black_hole() {
00188
00189 del_deriv() ;
00190
00191 }
00192
00193
00194
00195
00196
00197
00198 void Black_hole::del_deriv() const {
00199
00200 if (p_mass_irr != 0x0) delete p_mass_irr ;
00201 if (p_mass_adm != 0x0) delete p_mass_adm ;
00202 if (p_mass_kom != 0x0) delete p_mass_kom ;
00203 if (p_rad_ah != 0x0) delete p_rad_ah ;
00204 if (p_spin_am_bh != 0x0) delete p_spin_am_bh ;
00205 if (p_angu_mom_bh != 0x0) delete p_angu_mom_bh ;
00206
00207 set_der_0x0() ;
00208
00209 }
00210
00211 void Black_hole::set_der_0x0() const {
00212
00213 p_mass_irr = 0x0 ;
00214 p_mass_adm = 0x0 ;
00215 p_mass_kom = 0x0 ;
00216 p_rad_ah = 0x0 ;
00217 p_spin_am_bh = 0x0 ;
00218 p_angu_mom_bh = 0x0 ;
00219
00220 }
00221
00222
00223
00224
00225
00226
00227
00228
00229 void Black_hole::operator=(const Black_hole& bh) {
00230
00231 assert( &(bh.mp) == &mp ) ;
00232
00233 kerrschild = bh.kerrschild ;
00234 mass_bh = bh.mass_bh ;
00235 lapconf = bh.lapconf ;
00236 lapconf_rs = bh.lapconf_rs ;
00237 lapconf_bh = bh.lapconf_bh ;
00238 lapse = bh.lapse ;
00239 shift = bh.shift ;
00240 shift_rs = bh.shift_rs ;
00241 shift_bh = bh.shift_bh ;
00242 confo = bh.confo ;
00243 taij = bh.taij ;
00244 taij_rs = bh.taij_rs ;
00245 taij_quad = bh.taij_quad ;
00246 taij_quad_rs = bh.taij_quad_rs ;
00247 flat = bh.flat ;
00248
00249 del_deriv() ;
00250
00251 }
00252
00253
00254
00255
00256
00257
00258
00259
00260 void Black_hole::sauve(FILE* fich) const {
00261
00262 lapconf_rs.sauve(fich) ;
00263 shift_rs.sauve(fich) ;
00264 confo.sauve(fich) ;
00265
00266 fwrite(&kerrschild, sizeof(bool), 1, fich) ;
00267 fwrite(&mass_bh, sizeof(double), 1, fich) ;
00268
00269 }
00270
00271
00272
00273 ostream& operator<<(ostream& ost, const Black_hole& bh) {
00274
00275 bh >> ost ;
00276 return ost ;
00277
00278 }
00279
00280 ostream& Black_hole::operator>>(ostream& ost) const {
00281
00282 using namespace Unites ;
00283
00284 const Mg3d* mg = mp.get_mg() ;
00285 int nt = mg->get_nt(1) ;
00286
00287 ost << endl ;
00288 if (kerrschild) {
00289 ost << "Kerr-Schild background" << endl ;
00290 ost << "----------------------" << endl ;
00291 }
00292 else {
00293 ost << "Conformally flat background" << endl ;
00294 ost << "---------------------------" << endl ;
00295 }
00296
00297 ost << "lapconf on the AH : "
00298 << lapconf.val_grid_point(1,0,nt-1,0) << endl ;
00299 ost << "lapse on the AH : "
00300 << lapse.val_grid_point(1,0,nt-1,0) << endl ;
00301 ost << "shift(1) on the AH : "
00302 << shift(1).val_grid_point(1,0,nt-1,0) << endl ;
00303 ost << "shift(2) on the AH : "
00304 << shift(2).val_grid_point(1,0,nt-1,0) << endl ;
00305 ost << "shift(3) on the AH : "
00306 << shift(3).val_grid_point(1,0,nt-1,0) << endl ;
00307 ost << "confo on the AH : "
00308 << confo.val_grid_point(1,0,nt-1,0) << endl ;
00309 ost << "Gravitational mass : "
00310 << mass_bh / msol << " M_sol" << endl ;
00311 ost << "Irreducible mass : "
00312 << mass_irr() / msol << " M_sol" << endl ;
00313 ost << "ADM mass : "
00314 << mass_adm() / msol << " M_sol" << endl ;
00315 ost << "Komar mass : "
00316 << mass_kom() / msol << " M_sol" << endl ;
00317
00318 double irr_gm, adm_gm, kom_gm ;
00319 irr_gm = mass_irr() / mass_bh - 1. ;
00320 adm_gm = mass_adm() / mass_bh - 1. ;
00321 kom_gm = mass_kom() / mass_bh - 1. ;
00322 ost << "Diff. (Mirr-Mg)/Mg : " << irr_gm << endl ;
00323 ost << "Diff. (Madm-Mg)/Mg : " << adm_gm << endl ;
00324 ost << "Diff. (Mkom-Mg)/Mg : " << kom_gm << endl ;
00325
00326 return ost ;
00327
00328 }