27char bin_ns_bh_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Bin_ns_bh/bin_ns_bh.C,v 1.15 2014/10/13 08:52:42 j_novak Exp $" ;
95#include "utilitaires.h"
109 :
ref_triad(0.,
"Absolute frame Cartesian basis"),
122 : ref_triad(0.,
"Absolute frame Cartesian basis"),
135 :
ref_triad(0.,
"Absolute frame Cartesian basis"),
137 hole(mp_bh, fich, old) {
153Bin_ns_bh::~Bin_ns_bh(){
236 return star.mp.get_ori_x() -
hole.mp.get_ori_x() ;
246void Bin_ns_bh::sauve(FILE* fich)
const {
257void Bin_ns_bh::init_auto () {
263 double rlim_ns =
star.
get_mp().val_r (0, 1, 0, 0) ;
264 filtre_ns = 0.5 * (1 +
exp(-radius_ns*radius_ns/rlim_ns/rlim_ns)) ;
265 filtre_ns.std_base_scal() ;
271 filtre_bh = 0.5 * (1 +
exp(-radius_bh*radius_bh/rlim_bh/rlim_bh)) ;
272 filtre_bh.std_base_scal() ;
288 Cmp soustrait ((filtre_bh-0.5)*2*
exp(1.)) ;
289 int nz =
hole.
get_mp().get_mg()->get_nzone() ;
296 double xa_abs, ya_abs, za_abs ;
301 for (
int k=0 ; k<np ; k++)
302 for (
int j=0 ; j<nt ; j++) {
304 xa_abs = xa_hole(1,k,j,0) ;
305 ya_abs = ya_hole(1,k,j,0) ;
306 za_abs = za_hole(1,k,j,0) ;
309 for (
int l=1 ; l<nz ; l++)
311 hole.set_n_auto().
set(l,k,j,i) -= (val_star+val_hole)*soustrait(l,k,j,i) ;
313 hole.set_n_auto().std_base_scal() ;
314 hole.set_n_auto().raccord(1) ;
321void Bin_ns_bh::affecte(
const Bin_ns_bh& so) {
324 star.nzet = so.star.nzet ;
327 star.set_mp().set_ori (so.star.mp.get_ori_x(), 0., 0.) ;
328 hole.set_mp().set_ori (so.hole.mp.get_ori_x(), 0., 0.) ;
329 star.set_mp().set_rot_phi (so.star.mp.get_rot_phi()) ;
330 hole.set_mp().set_rot_phi (so.hole.mp.get_rot_phi()) ;
332 hole.set_mp().homothetie_interne (so.hole.get_rayon()/
hole.rayon) ;
333 hole.set_rayon(so.hole.get_rayon()) ;
336 Map_et* map_et =
dynamic_cast<Map_et*
>(&
star.mp) ;
337 Map_et* map_et_so =
dynamic_cast<Map_et*
>(&so.star.mp) ;
341 int np = map_et->get_mg()->get_np(
star.nzet-1) ;
342 int nt = map_et->get_mg()->get_nt(
star.nzet-1) ;
343 Mtbl
phi (map_et->get_mg()) ;
345 Mtbl
tet (map_et->get_mg()) ;
348 for (
int k=0 ; k<np ; k++)
349 for (
int j=0 ; j<nt ; j++) {
350 double rcourant = map_et_so->val_r(
star.nzet-1, 1,
tet(0,k,j,0),
phi(0,k,j,0)) ;
351 if (rcourant > rmax) {
358 double old_r = map_et->val_r(
star.nzet-1, 1,
tet(0,kmax,jmax,0),
phi(0,kmax,jmax,0)) ;
359 map_et->homothetie (rmax/old_r) ;
361 star.ent.allocate_all() ;
362 star.ent.set().import(
star.nzet, so.star.ent()) ;
363 star.ent.set_std_base() ;
369 int nz_search =
star.nzet + 1 ;
370 double precis_secant = 1.e-14 ;
371 double alpha_r = 1. ;
372 double reg_map = 1. ;
373 Tbl ent_limit(
star.nzet) ;
375 par_adapt.add_int(nitermax, 0) ;
376 par_adapt.add_int(
star.nzet, 1) ;
377 par_adapt.add_int(nz_search, 2) ;
378 par_adapt.add_int(adapt_flag, 3) ;
379 par_adapt.add_int(jmax, 4) ;
380 par_adapt.add_int(kmax, 5) ;
381 par_adapt.add_int_mod(niter_adapt, 0) ;
382 par_adapt.add_double(precis_secant, 0) ;
383 par_adapt.add_double(reg_map, 1) ;
384 par_adapt.add_double(alpha_r, 2) ;
385 par_adapt.add_tbl(ent_limit, 0) ;
387 Map_et mp_prev = *map_et ;
388 ent_limit.set_etat_qcq() ;
389 for (
int l=0; l<
star.nzet-1; l++) {
390 int nr = map_et->get_mg()->get_nr(l) ;
391 ent_limit.set(l) =
star.ent()(l, kmax, jmax, nr-1) ;
393 ent_limit.set(
star.nzet-1) = 0 ;
396 map_et->adapt(
star.ent(), par_adapt) ;
397 mp_prev.homothetie(alpha_r) ;
398 map_et->reevaluate_symy (&mp_prev,
star.nzet,
star.ent.set()) ;
400 star.ent.set().import(
star.nzet, so.star.ent()) ;
404 hole.n_auto.allocate_all() ;
405 Cmp auxi_n (so.hole.n_auto()) ;
407 hole.n_auto.set().import(auxi_n) ;
408 hole.n_auto.set().std_base_scal() ;
409 hole.n_auto.set().raccord(1) ;
412 hole.psi_auto.allocate_all() ;
413 Cmp auxi_psi (so.hole.psi_auto()) ;
414 auxi_psi.raccord(1) ;
415 hole.psi_auto.set().import(auxi_psi) ;
416 hole.psi_auto.set().std_base_scal() ;
417 hole.psi_auto.set().raccord(1) ;
420 hole.shift_auto.allocate_all() ;
421 Tenseur auxi_shift (so.hole.shift_auto) ;
422 for (
int i=0 ; i<3 ; i++)
423 auxi_shift.set(i).raccord(1) ;
424 hole.shift_auto.set(0).import(auxi_shift(0)) ;
425 hole.shift_auto.set(1).import(auxi_shift(1)) ;
426 hole.shift_auto.set(2).import(auxi_shift(2)) ;
427 hole.shift_auto.set_std_base() ;
430 star.n_auto.allocate_all() ;
431 star.n_auto.set().import(so.star.n_auto()) ;
432 star.n_auto.set().std_base_scal() ;
435 star.confpsi_auto.allocate_all() ;
436 star.confpsi_auto.set().import(so.star.confpsi_auto()) ;
437 star.confpsi_auto.set().std_base_scal() ;
439 star.w_shift.allocate_all() ;
440 star.w_shift.set(0).import(so.star.w_shift(0)) ;
441 star.w_shift.set(1).import(so.star.w_shift(1)) ;
442 star.w_shift.set(2).import(so.star.w_shift(2)) ;
443 star.w_shift.set_std_base() ;
444 star.khi_shift.allocate_all() ;
445 star.khi_shift.set().import(so.star.khi_shift()) ;
446 star.khi_shift.set().std_base_scal() ;
447 star.fait_shift_auto() ;
449 Tenseur copie_dpsi (so.star.d_psi) ;
450 copie_dpsi.set(2).dec2_dzpuis() ;
451 if (so.star.is_irrotational()) {
452 star.d_psi.allocate_all() ;
453 star.d_psi.set(0).import(
star.nzet, copie_dpsi(0)) ;
454 star.d_psi.set(1).import(
star.nzet, copie_dpsi(1)) ;
455 star.d_psi.set(2).import(
star.nzet, copie_dpsi(2)) ;
456 star.d_psi.set_std_base() ;
468 star.equation_of_state() ;
486 ost <<
"Neutron star - black hole binary system" << endl ;
487 ost <<
"=======================================" << endl ;
489 "Orbital angular velocity : " <<
omega * f_unit <<
" rad/s" << endl ;
491 "Absolute coordinate X of the rotation axis : " <<
x_axe / km
493 ost << endl <<
"Neutron star : " << endl ;
494 ost <<
"============ " << endl ;
495 ost <<
star << endl ;
497 ost <<
"Black hole : " << endl ;
498 ost <<
"========== " << endl ;
499 ost <<
"Coordinate radius of the throat : " <<
hole.get_rayon() / km <<
" km" << endl ;
500 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.