98#include "utilitaires.h"
100#include "graphique.h"
112 :
ref_triad(0.,
"Absolute frame Cartesian basis"),
125 : ref_triad(0.,
"Absolute frame Cartesian basis"),
138 :
ref_triad(0.,
"Absolute frame Cartesian basis"),
140 hole(mp_bh, fich, old) {
156Bin_ns_bh::~Bin_ns_bh(){
239 return star.mp.get_ori_x() -
hole.mp.get_ori_x() ;
249void Bin_ns_bh::sauve(FILE* fich)
const {
260void Bin_ns_bh::init_auto () {
266 double rlim_ns =
star.
get_mp().val_r (0, 1, 0, 0) ;
267 filtre_ns = 0.5 * (1 +
exp(-radius_ns*radius_ns/rlim_ns/rlim_ns)) ;
268 filtre_ns.std_base_scal() ;
274 filtre_bh = 0.5 * (1 +
exp(-radius_bh*radius_bh/rlim_bh/rlim_bh)) ;
275 filtre_bh.std_base_scal() ;
291 Cmp soustrait ((filtre_bh-0.5)*2*
exp(1.)) ;
292 int nz =
hole.
get_mp().get_mg()->get_nzone() ;
299 double xa_abs, ya_abs, za_abs ;
304 for (
int k=0 ; k<np ; k++)
305 for (
int j=0 ; j<nt ; j++) {
307 xa_abs = xa_hole(1,k,j,0) ;
308 ya_abs = ya_hole(1,k,j,0) ;
309 za_abs = za_hole(1,k,j,0) ;
312 for (
int l=1 ; l<nz ; l++)
314 hole.set_n_auto().
set(l,k,j,i) -= (val_star+val_hole)*soustrait(l,k,j,i) ;
316 hole.set_n_auto().std_base_scal() ;
317 hole.set_n_auto().raccord(1) ;
324void Bin_ns_bh::affecte(
const Bin_ns_bh& so) {
327 star.nzet = so.star.nzet ;
330 star.set_mp().set_ori (so.star.mp.get_ori_x(), 0., 0.) ;
331 hole.set_mp().set_ori (so.hole.mp.get_ori_x(), 0., 0.) ;
332 star.set_mp().set_rot_phi (so.star.mp.get_rot_phi()) ;
333 hole.set_mp().set_rot_phi (so.hole.mp.get_rot_phi()) ;
335 hole.set_mp().homothetie_interne (so.hole.get_rayon()/
hole.rayon) ;
336 hole.set_rayon(so.hole.get_rayon()) ;
339 Map_et* map_et =
dynamic_cast<Map_et*
>(&
star.mp) ;
340 Map_et* map_et_so =
dynamic_cast<Map_et*
>(&so.star.mp) ;
344 int np = map_et->get_mg()->get_np(
star.nzet-1) ;
345 int nt = map_et->get_mg()->get_nt(
star.nzet-1) ;
346 Mtbl
phi (map_et->get_mg()) ;
348 Mtbl
tet (map_et->get_mg()) ;
351 for (
int k=0 ; k<np ; k++)
352 for (
int j=0 ; j<nt ; j++) {
353 double rcourant = map_et_so->val_r(
star.nzet-1, 1,
tet(0,k,j,0),
phi(0,k,j,0)) ;
354 if (rcourant > rmax) {
361 double old_r = map_et->val_r(
star.nzet-1, 1,
tet(0,kmax,jmax,0),
phi(0,kmax,jmax,0)) ;
362 map_et->homothetie (rmax/old_r) ;
364 star.ent.allocate_all() ;
365 star.ent.set().import(
star.nzet, so.star.ent()) ;
366 star.ent.set_std_base() ;
372 int nz_search =
star.nzet + 1 ;
373 double precis_secant = 1.e-14 ;
374 double alpha_r = 1. ;
375 double reg_map = 1. ;
376 Tbl ent_limit(
star.nzet) ;
378 par_adapt.add_int(nitermax, 0) ;
379 par_adapt.add_int(
star.nzet, 1) ;
380 par_adapt.add_int(nz_search, 2) ;
381 par_adapt.add_int(adapt_flag, 3) ;
382 par_adapt.add_int(jmax, 4) ;
383 par_adapt.add_int(kmax, 5) ;
384 par_adapt.add_int_mod(niter_adapt, 0) ;
385 par_adapt.add_double(precis_secant, 0) ;
386 par_adapt.add_double(reg_map, 1) ;
387 par_adapt.add_double(alpha_r, 2) ;
388 par_adapt.add_tbl(ent_limit, 0) ;
390 Map_et mp_prev = *map_et ;
391 ent_limit.set_etat_qcq() ;
392 for (
int l=0; l<
star.nzet-1; l++) {
393 int nr = map_et->get_mg()->get_nr(l) ;
394 ent_limit.set(l) =
star.ent()(l, kmax, jmax, nr-1) ;
396 ent_limit.set(
star.nzet-1) = 0 ;
399 map_et->adapt(
star.ent(), par_adapt) ;
400 mp_prev.homothetie(alpha_r) ;
401 map_et->reevaluate_symy (&mp_prev,
star.nzet,
star.ent.set()) ;
403 star.ent.set().import(
star.nzet, so.star.ent()) ;
407 hole.n_auto.allocate_all() ;
408 Cmp auxi_n (so.hole.n_auto()) ;
410 hole.n_auto.set().import(auxi_n) ;
411 hole.n_auto.set().std_base_scal() ;
412 hole.n_auto.set().raccord(1) ;
415 hole.psi_auto.allocate_all() ;
416 Cmp auxi_psi (so.hole.psi_auto()) ;
417 auxi_psi.raccord(1) ;
418 hole.psi_auto.set().import(auxi_psi) ;
419 hole.psi_auto.set().std_base_scal() ;
420 hole.psi_auto.set().raccord(1) ;
423 hole.shift_auto.allocate_all() ;
424 Tenseur auxi_shift (so.hole.shift_auto) ;
425 for (
int i=0 ; i<3 ; i++)
426 auxi_shift.set(i).raccord(1) ;
427 hole.shift_auto.set(0).import(auxi_shift(0)) ;
428 hole.shift_auto.set(1).import(auxi_shift(1)) ;
429 hole.shift_auto.set(2).import(auxi_shift(2)) ;
430 hole.shift_auto.set_std_base() ;
433 star.n_auto.allocate_all() ;
434 star.n_auto.set().import(so.star.n_auto()) ;
435 star.n_auto.set().std_base_scal() ;
438 star.confpsi_auto.allocate_all() ;
439 star.confpsi_auto.set().import(so.star.confpsi_auto()) ;
440 star.confpsi_auto.set().std_base_scal() ;
442 star.w_shift.allocate_all() ;
443 star.w_shift.set(0).import(so.star.w_shift(0)) ;
444 star.w_shift.set(1).import(so.star.w_shift(1)) ;
445 star.w_shift.set(2).import(so.star.w_shift(2)) ;
446 star.w_shift.set_std_base() ;
447 star.khi_shift.allocate_all() ;
448 star.khi_shift.set().import(so.star.khi_shift()) ;
449 star.khi_shift.set().std_base_scal() ;
450 star.fait_shift_auto() ;
452 Tenseur copie_dpsi (so.star.d_psi) ;
453 copie_dpsi.set(2).dec2_dzpuis() ;
454 if (so.star.is_irrotational()) {
455 star.d_psi.allocate_all() ;
456 star.d_psi.set(0).import(
star.nzet, copie_dpsi(0)) ;
457 star.d_psi.set(1).import(
star.nzet, copie_dpsi(1)) ;
458 star.d_psi.set(2).import(
star.nzet, copie_dpsi(2)) ;
459 star.d_psi.set_std_base() ;
471 star.equation_of_state() ;
489 ost <<
"Neutron star - black hole binary system" << endl ;
490 ost <<
"=======================================" << endl ;
492 "Orbital angular velocity : " <<
omega * f_unit <<
" rad/s" << endl ;
494 "Absolute coordinate X of the rotation axis : " <<
x_axe / km
496 ost << endl <<
"Neutron star : " << endl ;
497 ost <<
"============ " << endl ;
498 ost <<
star << endl ;
500 ost <<
"Black hole : " << endl ;
501 ost <<
"========== " << endl ;
502 ost <<
"Coordinate radius of the throat : " <<
hole.get_rayon() / km <<
" km" << endl ;
503 ost <<
"Absolute abscidia of the throat center : " << (
hole.get_mp()).get_ori_x() / km
const Tenseur & get_n_auto() const
Returns the part of N generated by the hole.
const Map_af & get_mp() const
Returns the mapping (readonly).
Tenseur n_auto
Part of N generated by the hole.
const Tenseur & get_psi_auto() const
Returns the part of generated by the hole.
void sauve(FILE *fich) const
Write on a file.
Neutron star - black hole binary system.
friend ostream & operator<<(ostream &, const Bin_ns_bh &)
Save in a file.
double * p_mass_kom
Total Komar mass of the system.
double * p_virial
Virial theorem error.
void fait_tkij(int bound_nn=-1, double lim_nn=0)
Computation of the extrinsic curvature tensor for both {\tt star} and {\tt bhole}.
void set_omega(double)
Sets the orbital angular velocity [{\tt f_unit}].
double * p_total_ener
Total energy of the system.
void operator=(const Bin_ns_bh &)
Assignment to another Bin_ns_bh.
ostream & operator>>(ostream &) const
Operator >> (function called by the operator <<).
double x_axe
Absolute X coordinate of the rotation axis.
void set_x_axe(double)
Sets the absolute coordinate X of the rotation axis [{\tt r_unit}].
Et_bin_nsbh star
The neutron star.
double * p_virial_gb
Virial theorem error by E.Gourgoulhon and S.Bonazzola.
Bhole hole
The black hole.
Tbl * p_mom_constr
Relative error on the momentum constraint.
double * p_mass_adm
Total ADM mass of the system.
double separation() const
Return the separation.
double * p_ham_constr
Relative error on the Hamiltonian constraint.
const Base_vect_cart ref_triad
Cartesian triad of the absolute reference frame.
void set_der_0x0() const
Sets to {\tt 0x0} all the pointers on derived quantities.
void del_deriv() const
Destructor.
double * p_virial_fus
Virial theorem error by J.L.Friedman, K.Uryu, and M.Shibata.
Tbl * p_angu_mom
Total angular momentum of the system.
Bin_ns_bh(Map &mp_ns, int nzet, const Eos &eos, bool irrot_ns, Map_af &mp_bh)
Standard constructor.
double omega
Angular velocity with respect to an asymptotically inertial observer.
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Tbl & set(int l)
Read/write of the value in a given domain.
Equation of state base class.
const Tenseur & get_n_auto() const
Returns the part of the lapse {\it N} generated principaly by the star.
Tenseur & set_n_auto()
Read/write the lapse {\it N} generated principaly by the star.
Tenseur & set_confpsi_auto()
Read/write the conformal factor $\Psi$ generated principaly by the star.
virtual void sauve(FILE *) const
Save in a file.
const Map & get_mp() const
Returns the mapping.
const Tenseur & get_beta_auto() const
Returns the logarithm of the part of the product AN generated principaly by the star.
const Tenseur & get_logn_auto() const
Returns the logarithm of the part of the lapse N generated principaly by the star.
virtual double val_r(int l, double xi, double theta, double pphi) const
Returns the value of the radial coordinate r for a given in a given domain.
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Cmp sqrt(const Cmp &)
Square root.
Cmp exp(const Cmp &)
Exponential.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Coord tet
coordinate centered on the grid
Standard units of space, time and mass.