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 bin_bhns_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_bhns/bin_bhns.C,v 1.2 2008/05/15 18:58:01 k_taniguchi Exp $" ;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #include <math.h>
00050
00051
00052 #include "bin_bhns.h"
00053 #include "eos.h"
00054 #include "utilitaires.h"
00055 #include "unites.h"
00056
00057
00058
00059
00060
00061
00062
00063 Bin_bhns::Bin_bhns(Map& mp_bh, Map& mp_ns, int nzet_i, const Eos& eos_i,
00064 bool irrot_ns, bool kerrschild_i,
00065 bool bc_lapconf_nd, bool bc_lapconf_fs, bool irrot_bh,
00066 double massbh)
00067 : ref_triad(0., "Absolute frame Cartesian basis"),
00068 hole(mp_bh,kerrschild_i,bc_lapconf_nd,bc_lapconf_fs,irrot_bh, massbh),
00069 star(mp_ns, nzet_i, eos_i, irrot_ns)
00070 {
00071
00072 omega = 0. ;
00073 separ = 0. ;
00074 x_rot = 0. ;
00075 y_rot = 0. ;
00076
00077
00078 set_der_0x0() ;
00079
00080 }
00081
00082
00083
00084 Bin_bhns::Bin_bhns(const Bin_bhns& bibi)
00085 : ref_triad(0., "Absolute frame Cartesian basis"),
00086 hole(bibi.hole),
00087 star(bibi.star),
00088 omega(bibi.omega),
00089 separ(bibi.separ),
00090 x_rot(bibi.x_rot),
00091 y_rot(bibi.y_rot)
00092 {
00093
00094
00095 set_der_0x0() ;
00096
00097 }
00098
00099
00100
00101 Bin_bhns::Bin_bhns(Map& mp_bh, Map& mp_ns, const Eos& eos_i, FILE* fich)
00102 : ref_triad(0., "Absolute frame Cartesian basis"),
00103 hole(mp_bh, fich),
00104 star(mp_ns, eos_i, fich)
00105 {
00106
00107
00108 fread_be(&omega, sizeof(double), 1, fich) ;
00109 fread_be(&separ, sizeof(double), 1, fich) ;
00110 fread_be(&x_rot, sizeof(double), 1, fich) ;
00111 fread_be(&y_rot, sizeof(double), 1, fich) ;
00112
00113
00114 set_der_0x0() ;
00115
00116 }
00117
00118
00119
00120
00121
00122
00123 Bin_bhns::~Bin_bhns()
00124 {
00125
00126 del_deriv() ;
00127
00128 }
00129
00130
00131
00132
00133
00134
00135 void Bin_bhns::del_deriv() const {
00136
00137 if (p_mass_adm_bhns_surf != 0x0) delete p_mass_adm_bhns_surf ;
00138 if (p_mass_adm_bhns_vol != 0x0) delete p_mass_adm_bhns_vol ;
00139 if (p_mass_kom_bhns_surf != 0x0) delete p_mass_kom_bhns_surf ;
00140 if (p_mass_kom_bhns_vol != 0x0) delete p_mass_kom_bhns_vol ;
00141 if (p_line_mom_bhns != 0x0) delete p_line_mom_bhns ;
00142 if (p_angu_mom_bhns != 0x0) delete p_angu_mom_bhns ;
00143 if (p_virial_bhns_surf != 0x0) delete p_virial_bhns_surf ;
00144 if (p_virial_bhns_vol != 0x0) delete p_virial_bhns_vol ;
00145 if (p_xa_barycenter != 0x0) delete p_xa_barycenter ;
00146 if (p_ya_barycenter != 0x0) delete p_ya_barycenter ;
00147 if (p_omega_two_points != 0x0) delete p_omega_two_points ;
00148
00149
00150
00151 set_der_0x0() ;
00152
00153 }
00154
00155 void Bin_bhns::set_der_0x0() const {
00156
00157 p_mass_adm_bhns_surf = 0x0 ;
00158 p_mass_adm_bhns_vol = 0x0 ;
00159 p_mass_kom_bhns_surf = 0x0 ;
00160 p_mass_kom_bhns_vol = 0x0 ;
00161 p_line_mom_bhns = 0x0 ;
00162 p_angu_mom_bhns = 0x0 ;
00163 p_virial_bhns_surf = 0x0 ;
00164 p_virial_bhns_vol = 0x0 ;
00165 p_xa_barycenter = 0x0 ;
00166 p_ya_barycenter = 0x0 ;
00167 p_omega_two_points = 0x0 ;
00168
00169
00170
00171 }
00172
00173
00174
00175
00176
00177
00178
00179
00180 void Bin_bhns::operator=(const Bin_bhns& bibi) {
00181
00182 assert( bibi.ref_triad == ref_triad ) ;
00183
00184 hole = bibi.hole ;
00185 star = bibi.star ;
00186
00187 omega = bibi.omega ;
00188 separ = bibi.separ ;
00189 x_rot = bibi.x_rot ;
00190 y_rot = bibi.y_rot ;
00191
00192 del_deriv() ;
00193
00194 }
00195
00196
00197
00198
00199
00200
00201
00202
00203 void Bin_bhns::sauve(FILE* fich) const {
00204
00205 hole.sauve(fich) ;
00206 star.sauve(fich) ;
00207
00208 fwrite_be(&omega, sizeof(double), 1, fich) ;
00209 fwrite_be(&separ, sizeof(double), 1, fich) ;
00210 fwrite_be(&x_rot, sizeof(double), 1, fich) ;
00211 fwrite_be(&y_rot, sizeof(double), 1, fich) ;
00212
00213 }
00214
00215
00216
00217 ostream& operator<<(ostream& ost, const Bin_bhns& bibi) {
00218
00219 bibi >> ost ;
00220 return ost ;
00221
00222 }
00223
00224 ostream& Bin_bhns::operator>>(ostream& ost) const {
00225
00226 using namespace Unites ;
00227
00228 ost << endl ;
00229 ost << "BH-NS binary system" << endl ;
00230 ost << "===================" << endl ;
00231
00232 ost << endl
00233 << "Orbital angular velocity : "
00234 << omega * f_unit << " [rad/s]" << endl ;
00235 ost << "Coordinate separation between BH and NS : "
00236 << separ / km << " [km]" << endl ;
00237 ost << "Position of the rotation axis : "
00238 << x_rot / km << " [km]" << endl ;
00239
00240 ost << endl << "Black hole : " ;
00241 ost << endl << "========== " << endl ;
00242
00243 int nt = (hole.get_mp()).get_mg()->get_nt(1) ;
00244
00245 ost << "Irreducible mass of BH : "
00246 << hole.mass_irr_bhns() / msol << " [Mo]" << endl ;
00247 ost << "Mass in the background : "
00248 << hole.get_mass_bh() / msol << " [Mo]" << endl ;
00249 ost << "Radius of the apparent horison : "
00250 << hole.rad_ah() / km << " [km]" << endl ;
00251 ost << "Lapse function on the AH : "
00252 << (hole.get_lapse_tot()).val_grid_point(1,0,nt-1,0) << endl ;
00253 ost << "Conformal factor on the AH : "
00254 << (hole.get_confo_tot()).val_grid_point(1,0,nt-1,0) << endl ;
00255 ost << "shift(1) on the AH : "
00256 << (hole.get_shift_tot()(1)).val_grid_point(1,0,nt-1,0) << endl ;
00257 ost << "shift(2) on the AH : "
00258 << (hole.get_shift_tot()(2)).val_grid_point(1,0,nt-1,0) << endl ;
00259 ost << "shift(3) on the AH : "
00260 << (hole.get_shift_tot()(3)).val_grid_point(1,0,nt-1,0) << endl ;
00261
00262 ost << endl << "Neutron star : " ;
00263 ost << endl << "============ " << endl ;
00264
00265 ost << "Baryon mass of NS in isolation : "
00266 << star.mass_b()/msol << " [Mo]" << endl ;
00267 ost << "Gravitational mass of NS : "
00268 << star.mass_g_bhns()/msol << " [Mo]" << endl ;
00269 ost << "Baryon mass of NS in BH bg. : "
00270 << star.mass_b_bhns(hole.is_kerrschild(),hole.get_mass_bh(),separ)/msol
00271 << " [Mo]" << endl ;
00272 ost << "Coordinate radius R_eq_tow : "
00273 << star.ray_eq_pi() / km << " [km]" << endl ;
00274 ost << "Coordinate radius R_eq_opp : "
00275 << star.ray_eq() / km << " [km]" << endl ;
00276 ost << "Coordinate radius R_eq_orb : "
00277 << star.ray_eq_pis2() / km << " [km]" << endl ;
00278 ost << "Coordinate radius R_eq_orb_opp : "
00279 << star.ray_eq_3pis2() / km << " [km]" << endl ;
00280 ost << "Coordinate radius R_pole : "
00281 << star.ray_pole() / km << " [km]" << endl ;
00282 ost << "Central enthalpy H_ent : "
00283 << (star.get_ent()).val_grid_point(0,0,0,0) << endl ;
00284 ost << "Lapse function at the center of NS : "
00285 << (star.get_lapse_tot()).val_grid_point(0,0,0,0) << endl ;
00286 ost << "Conformal factor at the center of NS : "
00287 << (star.get_confo_tot()).val_grid_point(0,0,0,0) << endl ;
00288 ost << "shift(1) at the center of NS : "
00289 << (star.get_shift_tot()(1)).val_grid_point(0,0,0,0) << endl ;
00290 ost << "shift(2) at the center of NS : "
00291 << (star.get_shift_tot()(2)).val_grid_point(0,0,0,0) << endl ;
00292 ost << "shift(3) at the center of NS : "
00293 << (star.get_shift_tot()(3)).val_grid_point(0,0,0,0) << endl ;
00294
00295
00296 return ost ;
00297
00298 }
00299
00300
00301
00302 void Bin_bhns::display_poly(ostream& ost) const {
00303
00304 using namespace Unites ;
00305
00306 const Eos* p_eos = &( star.get_eos() ) ;
00307 const Eos_poly* p_eos_poly = dynamic_cast<const Eos_poly*>( p_eos ) ;
00308
00309 if (p_eos_poly != 0x0) {
00310
00311 double kappa = p_eos_poly->get_kap() ;
00312 double gamma = p_eos_poly->get_gam() ;
00313 double kap_ns2 = pow( kappa, 0.5 /(gamma-1) ) ;
00314
00315
00316 double r_poly = kap_ns2 / sqrt(ggrav) ;
00317
00318
00319 double t_poly = r_poly ;
00320
00321
00322 double m_poly = r_poly / ggrav ;
00323
00324
00325
00326
00327 double r0 = 0.5 * ( star.ray_eq() + star.ray_eq_pi() ) ;
00328
00329
00330
00331
00332 double y_ns = star.get_mp().get_ori_y() ;
00333 double d_coord = sqrt(separ*separ + y_ns*y_ns) ;
00334
00335 ost.precision(16) ;
00336 ost << endl << "Quantities in polytropic units : " ;
00337 ost << endl << "==============================" << endl ;
00338 ost << " ( r_poly = " << r_poly / km << " km )" << endl ;
00339 ost << " d_separ : " << separ / r_poly << endl ;
00340 ost << " d_coord : " << d_coord / r_poly << endl ;
00341 ost << " Omega : " << omega * t_poly << endl ;
00342 ost << " Omega M_irr : "
00343 << omega * t_poly * hole.mass_irr_bhns() / m_poly << endl ;
00344 ost << " Omega_spin : " << hole.get_omega_spin() * t_poly << endl ;
00345 ost << " M_irr : " << hole.mass_irr_bhns() / m_poly << endl ;
00346 ost << " M_bh : " << hole.get_mass_bh() / m_poly << endl ;
00347 ost << " R_ah : " << hole.rad_ah() / r_poly << endl ;
00348 ost << " M_bar(NS)iso : " << star.mass_b() / m_poly
00349 << endl ;
00350 ost << " M_bar(NS) : "
00351 << star.mass_b_bhns(hole.is_kerrschild(),hole.get_mass_bh(),separ)
00352 / m_poly << endl ;
00353 ost << " M_g(NS)iso : " << star.mass_g_bhns() / m_poly << endl ;
00354 ost << " R_0(NS) : " << r0 / r_poly << endl ;
00355
00356 }
00357
00358 }