Debian Codegraph @

Codes/Bin_ns_bh/coal_ns_bh.C

raw
1 /*
2 * Main code for computation of equilibrium configuration of a NS-BH binary system.
3 *
4 */
5
6 /*
7 * Copyright (c) 2004 Philippe Grandclement, Keisuke Taniguchi,
8 * Eric Gourgoulhon
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27 char coal_ns_bh_C[] = "$Header: /cvsroot/Lorene/Codes/Bin_ns_bh/coal_ns_bh.C,v 1.14 2014/10/13 08:53:53 j_novak Exp $" ;
28
29 /*
30 * $Id: coal_ns_bh.C,v 1.14 2014/10/13 08:53:53 j_novak Exp $
31 * $Log: coal_ns_bh.C,v $
32 * Revision 1.14 2014/10/13 08:53:53 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.13 2014/10/06 15:09:42 j_novak
36 * Modified #include directives to use c++ syntax.
37 *
38 * Revision 1.12 2008/09/26 08:44:04 p_grandclement
39 * Mixted binaries with non vanishing spin
40 *
41 * Revision 1.8 2006/06/01 12:47:54 p_grandclement
42 * update of the Bin_ns_bh project
43 *
44 * Revision 1.7 2006/04/25 07:22:00 p_grandclement
45 * Various changes for the NS_BH project
46 *
47 * Revision 1.6 2005/10/18 13:12:34 p_grandclement
48 * update of the mixted binary codes
49 *
50 * Revision 1.4 2004/03/25 12:35:35 j_novak
51 * now using namespace Unites
52 *
53 * Revision 1.3 2003/11/29 07:01:25 k_taniguchi
54 * Large modification. However, the code has not worked yet.
55 *
56 * Revision 1.2 2002/12/19 14:58:20 e_gourgoulhon
57 * First non-empty version.
58 *
59 * Revision 1.1 2002/12/18 10:33:10 e_gourgoulhon
60 * Computations of NS - BH binaries
61 *
62 *
63 *
64 *
65 * $Header: /cvsroot/Lorene/Codes/Bin_ns_bh/coal_ns_bh.C,v 1.14 2014/10/13 08:53:53 j_novak Exp $
66 *
67 */
68
69 // C++ headers
70 #include "headcpp.h"
71
72 // C headers
73 #include <cstdlib>
74 #include <cmath>
75
76 // Lorene headers
77 #include "bhole.h"
78 #include "bin_ns_bh.h"
79 #include "nbr_spx.h"
80 #include "eos.h"
81 #include "utilitaires.h"
82 #include "unites.h"
83 #include "graphique.h"
84
85
86 using namespace Lorene ;
87
88 int main(int argc, char** argv) {
89
90 using namespace Unites ;
91
92 //Lecture du fichier de parametres :
93 if (argc <3) {
94 cout <<" Passer nom des fichiers en arguments SVP !" << endl ;
95 abort() ; }
96 //------------------------------------------------------------------
97 // Parameters of the computation
98 //------------------------------------------------------------------
99 char blabla[120] ;
100 double distance, precis, relax, search, m1, m2, scale_ome_local, spin, mirr, lapse_hori ;
101 int itemax_equil, itemax_mp_et ;
102
103 char* name_fich = argv[1] ;
104 ifstream fpar(name_fich) ;
105 fpar >> distance ; fpar.getline(blabla, 120) ;
106 fpar >> m1 ; fpar >> m2 ; fpar.getline(blabla, 120) ;
107 fpar >> search ; fpar.getline(blabla, 120) ;
108 fpar >> precis ; fpar.getline(blabla, 120) ;
109 fpar >> relax ; fpar.getline(blabla, 120) ;
110 fpar >> itemax_equil ; fpar.getline(blabla, 120) ;
111 fpar >> itemax_mp_et ; fpar.getline(blabla, 120) ;
112 fpar >> spin ; fpar.getline(blabla, 120) ;
113 fpar >> scale_ome_local ; fpar.getline(blabla, 120) ;
114 fpar >> lapse_hori ; fpar.getline(blabla, 120) ;
115 fpar.close() ;
116
117 //------------------------------------------------------------------
118 // Read of the initial conditions
119 //------------------------------------------------------------------
120 name_fich = argv[2] ;
121 FILE* fich = fopen(name_fich, "r") ;
122 Mg3d mg_ns(fich) ;
123 Map_et mp_ns(mg_ns, fich) ;
124 Eos* peos = Eos::eos_from_file(fich) ;
125 Mg3d mg_bh(fich) ;
126 Map_af mp_bh(mg_bh, fich) ;
127 cout << "Make an object of Bin_ns_bh" << endl ;
128 Bin_ns_bh bin(mp_ns, *peos, mp_bh, fich) ;
129 fclose(fich) ;
130
131
132 //------------------------------------------------------------------
133 // Update of the initial conditions
134 //------------------------------------------------------------------
135 cout << "Update the initial conditions for NS" << endl ;
136 bin.set_ns().update_metric(bin.get_bh()) ;
137 bin.set_bh().fait_n_comp (bin.get_ns()) ;
138 bin.set_bh().fait_psi_comp (bin.get_ns()) ;
139 bin.set_bh().fait_taij_auto( ) ;
140
141 cout << "Update the initial conditions for BH" << endl ;
142 // Initialisation of gradients of companion potentials
143 // ---------------------------------------------------
144 bin.set_ns().update_metric_der_comp (bin.get_bh()) ;
145 bin.set_bh().update_metric (bin.get_ns()) ;
146 bin.fait_tkij(0, lapse_hori) ;
147
148 // Initialisation of hydro quantities for NS
149 // -----------------------------------------
150 bin.set_ns().equation_of_state() ;
151 bin.set_ns().hydro_euler() ;
152 bin.analytical_omega() ;
153 bin.set_ns().kinematics (bin.get_omega(), bin.get_x_axe()) ;
154 bin.set_ns().fait_d_psi() ;
155
156 // Masses in good units :
157 m1 *= ggrav*msol ;
158 m2 *= msol ;
159 spin *= m1*m1 ;
160 mirr = sqrt(0.5*(m1*m1+sqrt(m1*m1*m1*m1-spin*spin))) ;
161
162
163 double ent_c_init = bin.get_ns().get_ent()()(0,0,0,0) ;
164 bin.coal (precis, relax, itemax_equil, itemax_mp_et, ent_c_init, search, distance, m1, m2, spin,
165 scale_ome_local, 1, 0, lapse_hori) ;
166
167 // On sauve
168 char name[20] ;
169 sprintf(name, "bin.dat") ;
170 FILE* fresu = fopen(name, "w") ;
171 mg_ns.sauve(fresu) ;
172 mp_ns.sauve(fresu) ;
173 peos->sauve(fresu) ;
174 mg_bh.sauve(fresu) ;
175 mp_bh.sauve(fresu) ;
176 bin.sauve(fresu) ;
177 fclose(fresu) ;
178
179 return 0 ;
180 }