80 #include "bin_ns_bh.h" 82 #include "graphique.h" 85 void Bin_ns_bh::coal (
double precis,
double relax,
int itemax_equil,
86 int itemax_mp_et,
double ent_c_init,
double seuil_masses,
87 double dist,
double m1,
double m2,
double spin_cible,
88 double scale_ome_local,
const int sortie,
int bound_nn,
101 double scale_linear = (mass_ns+mass_bh)/2.*distance*
omega ;
103 char name_iteration[40] ;
104 char name_correction[40] ;
105 char name_viriel[40] ;
107 char name_linear[40] ;
109 char name_error_m1[40] ;
110 char name_error_m2[40] ;
115 char name_ome_local[40] ;
117 sprintf(name_iteration,
"ite.dat") ;
118 sprintf(name_correction,
"cor.dat") ;
119 sprintf(name_viriel,
"vir.dat") ;
120 sprintf(name_ome,
"ome.dat") ;
121 sprintf(name_linear,
"linear.dat") ;
122 sprintf(name_axe,
"axe.dat") ;
123 sprintf(name_error_m1,
"error_m_bh.dat") ;
124 sprintf(name_error_m2,
"error_m_ns.dat") ;
125 sprintf(name_hor,
"hor.dat") ;
126 sprintf(name_entc,
"entc.dat") ;
127 sprintf(name_dist,
"distance.dat") ;
128 sprintf(name_spin,
"spin.dat") ;
129 sprintf(name_ome_local,
"ome_local.dat") ;
131 ofstream fiche_iteration(name_iteration) ;
132 fiche_iteration.precision(8) ;
134 ofstream fiche_correction(name_correction) ;
135 fiche_correction.precision(8) ;
137 ofstream fiche_viriel(name_viriel) ;
138 fiche_viriel.precision(8) ;
140 ofstream fiche_ome(name_ome) ;
141 fiche_ome.precision(8) ;
143 ofstream fiche_linear(name_linear) ;
144 fiche_linear.precision(8) ;
146 ofstream fiche_axe(name_axe) ;
147 fiche_axe.precision(8) ;
149 ofstream fiche_error_m1 (name_error_m1) ;
150 fiche_error_m1.precision(8) ;
152 ofstream fiche_error_m2 (name_error_m2) ;
153 fiche_error_m2.precision(8) ;
155 ofstream fiche_hor (name_hor) ;
156 fiche_hor.precision(8) ;
158 ofstream fiche_entc (name_entc) ;
159 fiche_entc.precision(8) ;
161 ofstream fiche_dist (name_dist) ;
162 fiche_dist.precision(8) ;
164 ofstream fiche_spin (name_spin) ;
165 fiche_spin.precision(8) ;
167 ofstream fiche_ome_local (name_ome_local) ;
168 fiche_ome_local.precision(8) ;
171 bool search_masses = false ;
172 double ent_c = ent_c_init ;
174 Cmp shift_bh_old (
hole.
mp) ;
175 Cmp shift_ns_old (
star.
mp) ;
190 spin =
hole.local_momentum() ;
193 fiche_spin << conte <<
" " << spin/m1/m1 << endl ;
196 double conv_spin = fabs(spin-spin_old) ;
197 double error_spin = spin - spin_cible ;
198 double rel_diff_spin = (spin_cible==0) ? fabs(error_spin) :
199 fabs(error_spin)/spin_cible ;
200 if ((conv_spin*2<rel_diff_spin) && (search_masses) &&
202 double func = scale_ome_local*
log((2+error_spin)/(2+2*error_spin));
206 old_mass_ns = mass_ns ;
223 diff.set_etat_qcq() ;
228 relax, itemax_mp_et, relax, diff) ;
232 hole.equilibrium (
star, precis, relax, bound_nn, lim_nn) ;
233 cout <<
"Apres equilibrium" << endl ;
236 cout <<
"Apres star::update_metric" << endl ;
239 cout <<
"Apres star::update_metric_der_comp" << endl ;
241 cout <<
"Apres Bin_ns_bh::fait_tkij" << endl ;
245 for (
int i=1 ; i<nz_bh ; i++)
246 if (diff_bh(i) > erreur)
247 erreur = diff_bh(i) ;
249 for (
int i=0 ; i<nz_ns ; i++)
250 if (diff_ns(i) > erreur)
251 erreur = diff_ns(i) ;
253 if (erreur<seuil_masses)
254 search_masses = true ;
258 cout <<
"Avant viriel" << endl ;
259 double error_viriel = viriel() ;
260 cout <<
"Apres viriel" << endl ;
261 double error_linear = linear_momentum_systeme_inf()(1)/scale_linear ;
262 cout <<
"Apres linear" << endl ;
264 cout <<
"Apres Mbh" << endl ;
265 double error_m2 = 1 - mass_ns/m2 ;
266 cout <<
"Apres Mns" << endl ;
269 fiche_iteration << conte <<
" " << erreur << endl ;
270 fiche_correction << conte <<
" " <<
hole.
regul << endl ;
271 fiche_viriel << conte <<
" " << error_viriel << endl ;
272 fiche_linear << conte <<
" " << error_linear << endl ;
273 fiche_error_m1 << conte <<
" " << error_m1 << endl ;
274 fiche_error_m2 << conte <<
" " << error_m2 << endl ;
275 fiche_hor << conte <<
" " <<
hole.
mp.
val_r(0, 1, 0,0) << endl ;
276 fiche_entc << conte <<
" " << ent_c << endl ;
277 fiche_dist << conte <<
" " << distance << endl ;
278 fiche_ome << conte <<
" " <<
omega << endl ;
279 fiche_axe << conte <<
" " << axe_pos << endl ;
283 double scaling_axe =
pow((2+error_linear)/(2+2*error_linear), 0.1) ;
284 axe_pos *= scaling_axe ;
289 double new_ome =
star.compute_angul() ;
297 double error_dist = (distance-dist)/dist ;
298 double scale_d =
pow((2+error_dist)/(2+2*error_dist), 0.2) ;
299 distance *= scale_d ;
305 double scaling_r =
pow((2-error_m1)/(2-2*error_m1), 0.25) ;
311 double convergence = fabs(mass_ns - old_mass_ns)/mass_ns ;
312 double rel_diff = fabs(error_m2) ;
313 if ((search_masses) && (convergence*2 < rel_diff)) {
314 double scaling_ent =
pow((2-error_m2)/(2-2*error_m2), 1) ;
315 ent_c *= scaling_ent ;
321 cout <<
"PAS TOTAL : " << conte <<
" DIFFERENCE : " << erreur << endl ;
331 fiche_iteration.close() ;
332 fiche_correction.close() ;
333 fiche_viriel.close() ;
335 fiche_linear.close() ;
337 fiche_error_m1.close() ;
338 fiche_error_m2.close() ;
343 fiche_ome_local.close() ;
Cmp log(const Cmp &)
Neperian logarithm.
void set_omega(double)
Sets the orbital angular velocity [{ f_unit}].
Cmp sqrt(const Cmp &)
Square root.
Standard units of space, time and mass.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
virtual void kinematics(double omega, double x_axe)
Computes the quantities bsn and pot_centri .
void set_rayon(double ray)
Sets the radius of the horizon to ray .
double get_ori_x() const
Returns the x coordinate of the origin.
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 update_metric_der_comp(const Bhole &comp)
Computes the derivative of metric functions related to the companion black hole.
double omega_local
local angular velocity
virtual double mass_g() const
Gravitational mass.
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
Map & set_mp()
Read/write of the mapping.
double x_axe
Absolute X coordinate of the rotation axis.
Et_bin_nsbh star
The neutron star.
void fait_d_psi()
Computes the gradient of the total velocity potential .
double area() const
Computes the area of the throat.
Map_af & mp
Affine mapping.
Map & mp
Mapping associated with the star.
int get_nzone() const
Returns the number of domains.
void set_omega_local(double ome)
Sets the local angular velocity to ome .
double get_rayon() const
Returns the radius of the horizon.
int get_etat() const
Returns the logical state.
double omega
Angular velocity with respect to an asymptotically inertial observer.
Cmp pow(const Cmp &, int)
Power .
void update_metric(const Bhole &comp)
Computes metric coefficients from known potentials, when the companion is a black hole...
double get_rot_state() const
Returns the state of rotation.
Map_af & set_mp()
Read/write of the mapping.
void fait_tkij(int bound_nn=-1, double lim_nn=0)
Computation of the extrinsic curvature tensor for both { star} and { bhole}.
const Tenseur & get_shift_auto() const
Returns the part of generated by the hole.
Bhole hole
The black hole.
void homothetie_interne(double lambda)
Sets a new radial scale at the bondary between the nucleus and the first shell.
double masse_adm_seul() const
Calculates the ADM mass of the black hole using : .
const Tenseur & get_shift_auto() const
Returns the part of the shift vector generated principaly by the star.
virtual double mass_b() const
Baryon mass.
virtual void equilibrium_nsbh(double ent_c, int mermax, int mermax_poisson, double relax_poisson, int mermax_potvit, double relax_potvit, double thres_adapt, const Tbl &fact, Tbl &diff)
Computes an equilibrium configuration in a NS-BH binary system.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
double regul
Intensity of the correction on the shift vector.
virtual void hydro_euler()
Computes the hydrodynamical quantities relative to the Eulerian observer from those in the fluid fram...