Debian Codegraph @

Codes/Kerr2/kerr_QI.C

raw
1 /*
2 * Kerr metric in Quasi-Isotropic coordinates
3 */
4
5 /*
6 * Copyright (c) 2013 Claire Some, Eric Gourgoulhon
7 *
8 * This file is part of LORENE.
9 *
10 * LORENE is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * LORENE is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with LORENE; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25 char kerrQI_C[] = "$Header: /cvsroot/Lorene/Codes/Kerr2/kerr_QI.C,v 1.5 2014/10/13 08:53:57 j_novak Exp $" ;
26
27 /*
28 * $Id: kerr_QI.C,v 1.5 2014/10/13 08:53:57 j_novak Exp $
29 * $Log: kerr_QI.C,v $
30 * Revision 1.5 2014/10/13 08:53:57 j_novak
31 * Lorene classes and functions now belong to the namespace Lorene.
32 *
33 * Revision 1.4 2013/07/25 19:45:50 o_straub
34 * calculation of the marginally bound radius
35 *
36 * Revision 1.3 2013/04/04 15:33:47 e_gourgoulhon
37 * Comparison ISCO with analytic formula
38 *
39 * Revision 1.2 2013/04/03 12:11:19 e_gourgoulhon
40 * Added member kk to Compobj; suppressed tkij
41 *
42 * Revision 1.1 2013/04/02 23:18:30 e_gourgoulhon
43 * New code kerr_QI
44 *
45 *
46 * $Header: /cvsroot/Lorene/Codes/Kerr2/kerr_QI.C,v 1.5 2014/10/13 08:53:57 j_novak Exp $
47 *
48 */
49
50 // C++ headers
51 #include "headcpp.h"
52
53 // C headers
54 #include <cstdlib>
55 #include <cmath>
56
57 // Lorene headers
58 #include "compobj.h"
59 #include "nbr_spx.h"
60 #include "utilitaires.h"
61 #include "proto.h"
62 #include "graphique.h"
63
64
65 using namespace Lorene ;
66
67 int main() {
68
69 // Parameters of the computation
70 // -----------------------------
71
72 ifstream fpar("par_kerr_QI.d") ;
73 if ( !fpar.good() ) {
74 cerr << "Problem in opening the file par_kerr_QI.d ! " << endl ;
75 abort() ;
76 }
77
78 double mass ; // M
79 fpar >> mass ; fpar.ignore(1000,'\n') ;
80
81 double a_ov_m ; // Kerr parameter a/M
82 fpar >> a_ov_m ; fpar.ignore(1000,'\n') ;
83
84 int graphic_out ; // flag for graphical outputs
85 fpar >> graphic_out ; fpar.ignore(1000,'\n') ;
86
87 int nr ; // Number of collocation points in r in each domain
88 fpar >> nr; fpar.ignore(1000,'\n') ;
89
90 int nt ; // Number of collocation points in theta in each domain
91 fpar >> nt; fpar.ignore(1000,'\n') ;
92
93 int np ; // Number of collocation points in phi in each domain
94 fpar >> np; fpar.ignore(1000,'\n') ;
95
96 int nz ; // Number of domains
97 fpar >> nz ; fpar.ignore(1000,'\n') ;
98 int nzm1 = nz - 1 ; // Index of outermost domain
99
100 fpar.ignore(1000,'\n') ; // skip title
101 double* r_limits = new double[nz+1]; // radial boundaries of each domain in units of M
102 for (int l=0; l<nz; l++) {
103 fpar >> r_limits[l];
104 }
105 r_limits[nz] = __infinity ;
106
107 fpar.close();
108
109 cout << "M = " << mass << ", a/M = " << a_ov_m << endl ;
110 double r_hor = double(0.5)*mass*sqrt(double(1)-a_ov_m*a_ov_m) ;
111 cout << "Value of coordinate r at the event horizon : " << r_hor << endl ;
112 cout << "r_limits : " ;
113 for (int l=0; l<nz+1; l++) {
114 cout << r_limits[l] << " " ;
115 }
116 cout << endl ;
117
118 // Setup of a multi-domain grid (Lorene class Mg3d)
119 // ------------------------------------------------
120
121 int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane
122 int symmetry_phi = SYM ; // symmetry with respect to phi --> phi + pi
123 bool compact = true ; // external domain is compactified
124
125 Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ;
126
127 cout << mgrid << endl ;
128
129
130 // Setup of an affine mapping : grid --> physical space (Lorene class Map_af)
131 // --------------------------------------------------------------------------
132
133 Map_af map(mgrid, r_limits) ;
134
135 // Construction of the Kerr_QI object:
136 // ----------------------------------
137
138 Kerr_QI bh(map, mass, a_ov_m) ;
139
140 bh.update_metric() ;
141
142 cout.precision(15) ;
143 cout << bh << endl ;
144
145 // ISCO from Eq. (21) of Bardeen, Press & Teukolsky, ApJ 178, 347 (1972):
146 double third = double(1)/double(3) ;
147 double z1 = 1 + pow(1-a_ov_m*a_ov_m, third)*( pow(1+a_ov_m, third) +
148 pow(1-a_ov_m, third) ) ;
149 double z2 = sqrt(3*a_ov_m*a_ov_m + z1*z1) ;
150 double R_isco_p = 3 + z2 - sqrt((3-z1)*(3+z1+2*z2)) ;
151 double R_isco_r = 3 + z2 + sqrt((3-z1)*(3+z1+2*z2)) ;
152 cout << "Analytic value of R_ISCO (prograde orbits) : " << R_isco_p << " M" << endl ;
153 cout << "Numerical value of R_ISCO (prograde orbits) : " <<
154 bh.r_isco(0)/mass + mass*(1-a_ov_m*a_ov_m)/(4*bh.r_isco(0)) + 1 << " M" << endl ;
155 //cout << "Analytic value of R_ISCO (retrograde orbits): " << R_isco_r << " M" << endl ;
156
157
158
159
160 // R_mb analogue to Eq. (19) of Bardeen, Press & Teukolsky, ApJ 178, 347 (1972):
161 double R_mb = 2 - a_ov_m + 2*sqrt(1 - a_ov_m) ;
162 cout << "Analytic value of R_mb : " << R_mb << " M" << endl ;
163 cout << "Numerical value of R_mb : " << bh.r_mb(0)/mass + mass*(1 - a_ov_m*a_ov_m)/(4*bh.r_mb(0)) + 1 << " M ; " << (bh.r_mb(0)) << endl ;
164
165
166
167
168
169
170
171 // Drawings
172 if (graphic_out == 1) {
173 des_meridian(bh.get_nn(), 0, 1.1*r_limits[nzm1], "N", 1) ;
174
175 des_meridian(bh.get_nphi(), 0, 1.1*r_limits[nzm1], "Nphi", 3) ;
176
177 des_meridian(bh.get_gamma().cov()(1,1), 0, 1.1*r_limits[nzm1], "gamma_11", 4) ;
178 des_meridian(bh.get_gamma().cov()(2,2), 0, 1.1*r_limits[nzm1], "gamma_22", 5) ;
179 des_meridian(bh.get_gamma().cov()(3,3), 0, 1.1*r_limits[nzm1], "gamma_33", 6) ;
180
181 des_meridian(bh.get_kk()(1,3), 0, 1.1*r_limits[nzm1], "K_(r)(ph)", 7) ;
182 des_meridian(bh.get_kk()(2,3), 0, 1.1*r_limits[nzm1], "K_(th)(ph)", 8) ;
183
184 arrete() ;
185 }
186
187
188 // Output file for GYOTO
189 //----------------------
190
191 bh.gyoto_data("gyoto_kerr_QI.d") ;
192
193 return EXIT_SUCCESS ;
194
195 }
196
197
198
199
200
201
202
203
204
205
206
207
208