Debian Codegraph @

Codes/Bin_ns_bh/lit_bin_ns_bh.C

raw
1 /*
2 * Code for reading a equilibrium configuration of a NS-BH binary system.
3 *
4 */
5
6 /*
7 * Copyright (c) 2005 Philippe Grandclement
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 char lit_bin_ns_bh_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_ns_bh/lit_bin_ns_bh.C,v 1.10 2014/10/13 08:53:53 j_novak Exp $" ;
27
28 /*
29 * $Id: lit_bin_ns_bh.C,v 1.10 2014/10/13 08:53:53 j_novak Exp $
30 * $Log: lit_bin_ns_bh.C,v $
31 * Revision 1.10 2014/10/13 08:53:53 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.9 2014/10/06 15:09:42 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.8 2008/09/26 08:44:04 p_grandclement
38 * Mixted binaries with non vanishing spin
39 *
40 * Revision 1.6 2006/09/06 11:52:46 p_grandclement
41 * Update of the Bin_ns_bh codes
42 *
43 * Revision 1.4 2006/04/25 07:22:00 p_grandclement
44 * Various changes for the NS_BH project
45 *
46 * Revision 1.2 2005/10/18 13:12:34 p_grandclement
47 * update of the mixted binary codes
48 *
49 * Revision 1.1 2005/08/29 15:10:19 p_grandclement
50 * Addition of things needed :
51 * 1) For BBH with different masses
52 * 2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
53 * WORKING YET !!!
54 * *
55 *
56 *
57 * $Header: /cvsroot/Lorene/Codes/Bin_ns_bh/lit_bin_ns_bh.C,v 1.10 2014/10/13 08:53:53 j_novak Exp $
58 *
59 */
60
61 //standard
62 #include <cstdlib>
63 #include <cmath>
64
65 // LORENE
66 #include "type_parite.h"
67 #include "nbr_spx.h"
68 #include "proto.h"
69 #include "param.h"
70 #include "coord.h"
71 #include "cmp.h"
72 #include "tenseur.h"
73 #include "bhole.h"
74 #include "bin_ns_bh.h"
75 #include "graphique.h"
76 #include "utilitaires.h"
77 #include "unites.h"
78 #include "eos.h"
79
80
81 using namespace Lorene ;
82
83 int main(int argc, char** argv) {
84
85 using namespace Unites ;
86 if (argc <2) {
87 cout <<" Passer nom du ficher en arguments SVP !" << endl ;
88 abort() ;
89 }
90
91 char* name_fich = argv[1] ;
92
93 FILE* fich = fopen(name_fich, "r") ;
94 Mg3d mg_ns(fich) ;
95 Map_et mp_ns(mg_ns, fich) ;
96 Eos* peos = Eos::eos_from_file(fich) ;
97
98 Mg3d mg_bh(fich) ;
99 Map_af mp_bh(mg_bh, fich) ;
100
101 Bin_ns_bh bibi(mp_ns, *peos, mp_bh, fich) ;
102 fclose(fich) ;
103
104 // On initialise les grandeurs derivees
105 bibi.set_ns().update_metric( bibi.get_bh() ) ;
106 bibi.set_bh().fait_n_comp( bibi.get_ns() ) ;
107 bibi.set_bh().fait_psi_comp( bibi.get_ns() ) ;
108 bibi.set_bh().fait_taij_auto( ) ;
109 bibi.set_ns().update_metric_der_comp( bibi.get_bh() ) ;
110 bibi.set_bh().update_metric (bibi.get_ns()) ;
111 bibi.fait_tkij() ;
112
113 // Initialisation of hydro quantities for NS
114 // -----------------------------------------
115 bibi.set_ns().equation_of_state() ;
116 bibi.set_ns().kinematics(bibi.get_omega(), bibi.get_x_axe()) ;
117 bibi.set_ns().fait_d_psi() ;
118 bibi.set_ns().hydro_euler() ;
119
120 double omega = bibi.get_omega() ;
121 double omega_local = bibi.get_bh().get_omega_local() ;
122 double adm = bibi.adm_systeme() ;
123 double adm_vol = bibi.adm_systeme_volume() ;
124 double komar = bibi.komar_systeme() ;
125 double moment = bibi.moment_systeme_inf() ;
126 double moment_hor = bibi.moment_systeme_hor() ;
127 double masse_smarr = bibi.smarr() ;
128 double area_bh = bibi.get_bh().area() ;
129 double M_bh = sqrt(area_bh/16/M_PI) ;
130 double Mb_ns = bibi.get_ns().mass_b() ;
131 double Mg_ns = bibi.get_ns().mass_g() ;
132
133 // Calcul de Ki
134 int nzet = bibi.get_ns().get_nzet() ;
135 Cmp dent (bibi.get_ns().get_ent()().dsdr()) ;
136 int nr = mg_ns.get_nr(nzet-1) ;
137 int nt = mg_ns.get_nt(nzet-1) ;
138 double ki = dent(nzet-1, 0, nt-1, nr-1) / dent(nzet-1, 0,0, nr-1) ;
139
140 cout.precision(10) ;
141 cout << "Omega : " << omega*f_unit << " Hz" << endl ;
142 cout << "Local omega : " << omega_local*f_unit << " Hz" << endl ;
143 cout << "Masse ADM : " << adm/ggrav/msol << " solar mass" << endl ;
144 cout << "Masse ADM vol. : " << adm_vol/ggrav/msol << " solar mass" << endl ;
145 cout << "Masse Komar : " << komar/ggrav/msol << " solar mass" << endl ;
146 cout << "Masse Smarr : " << masse_smarr/ggrav/msol << " solar mass" << endl ;
147 cout << "Moment inf : " << moment << " (Lorene units)" << endl ;
148 cout << "Moment hor : " << moment_hor << " (Lorene units)" << endl ;
149 cout << "Regularization : " << bibi.get_bh().get_regul() << endl ;
150 cout << "BH area mass : " << M_bh/msol/ggrav << " solar mass" << endl ;
151 cout << "NS baryon mass : " << Mb_ns/msol << " solar mass" << endl ;
152 cout << "NS grav. mass : " << Mg_ns/msol << " solar mass" << endl ;
153 cout << "Deformation : " << ki << endl ;
154
155 double x_bh = bibi.get_bh().get_mp().get_ori_x() ;
156 double x_ns = bibi.get_ns().get_mp().get_ori_x() ;
157 double centre = (x_ns+x_bh)/2 ;
158 double taille = 1.3*(fabs (x_bh) + fabs(x_ns)) ;
159 // PLOTS //
160 // Les Cmp pour annuler :
161 Cmp surface_bh (mp_bh) ;
162 surface_bh = pow(mp_bh.r, 2.)-pow(bibi.get_bh().get_rayon(), 2.) ;
163 surface_bh.annule(mg_bh.get_nzone()-1) ;
164 surface_bh.std_base_scal() ;
165
166 Cmp surface_ns (bibi.get_ns().get_ent()()) ;
167
168 des_coupe_bin_z (bibi.get_ns().get_n_auto()(), bibi.get_bh().get_n_auto()(), 0, x_bh-1, x_bh+1, -1, 1, "Lapse function (Z=0)",
169 &surface_ns, &surface_bh,
170 false, 15, 300, 300) ;
171
172 /*
173 taille -= 3 ;
174 Cmp p1 (bibi.get_ns().get_taij_auto()(0,0)) ;
175 p1.dec2_dzpuis() ;
176 Cmp p2 (bibi.get_bh().get_taij_auto()(0,0)) ;
177 p2.dec2_dzpuis() ;
178 des_coupe_bin_z (p1, p2, 0, centre-taille, centre+taille, -taille, taille, "A\\uXX\\d (Z=0)", &surface_ns, &surface_bh, false, 15, 300, 300) ;
179
180
181 des_coupe_bin_z (bibi.get_ns().get_n_auto()(), bibi.get_bh().get_n_auto()(), 0, centre-taille, centre+taille, -taille, taille, "Lapse") ;
182 des_coupe_bin_z (bibi.get_ns().get_confpsi_auto()(), bibi.get_bh().get_psi_auto()(), 0, centre-taille, centre+taille, -taille, taille, "Psi") ;
183 Tenseur u_euler (bibi.get_ns().get_u_euler()) ;
184 u_euler.annule(1, bibi.get_ns().get_mp().get_mg()->get_nzone()-1) ;
185 des_coupe_vect_z (u_euler, 0, -1, 0.5, 1, "U euler") ;
186
187 des_coupe_z (bibi.get_ns().get_ent()(), 0, x_ns-4, x_ns+4, -4, 4, "Enthalpie") ;
188 des_vect_bin_z (bibi.get_ns().get_shift_auto(),bibi.get_bh().get_shift_auto(), 0, 500, 0.5, centre-taille, centre+taille,
189 -taille, taille, "Shift") ;
190
191 for (int i=0 ; i<2 ; i++)
192 for (int j=0 ; j<2 ; j++) {
193 Cmp p1 (bibi.get_ns().get_taij_auto()(i,j)) ;
194 p1.dec2_dzpuis() ;
195 Cmp p2 (bibi.get_bh().get_taij_auto()(i,j)) ;
196 p2.dec2_dzpuis() ;
197 des_coupe_bin_z (p1, p2, 0, centre-taille, centre+taille, -taille, taille, "A_ij") ;
198 }
199 */
200
201 return EXIT_SUCCESS;
202 }