Debian Codegraph @

Codes/Kerr2/kerr.C

raw
1 /* Computes the Kerr metric in Dirac gauge.
2 *
3 */
4
5 /*
6 * Copyright (c) 2010 Nicolas Vasset
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
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
27 char kerr_C[] = "$Header: /cvsroot/Lorene/Codes/Kerr2/kerr.C,v 1.6 2014/10/13 08:53:57 j_novak Exp $" ;
28
29 // headers Lorene
30 #include "nbr_spx.h"
31 #include "excised_slice.h"
32 #include "unites.h"
33
34 using namespace Lorene ;
35
36 int main(){
37
38 using namespace Unites ;
39 //------------------------------------------------------------------
40 // Parameters of the computation
41 //------------------------------------------------------------------
42
43 int nr, nt, np, CFornot, mer_max, mer_max2;
44 double relax, precis, Omega, N_hor;
45 bool isCF;
46
47 ifstream fpar("parkerr.d") ;
48 fpar.ignore(1000, '\n') ;
49 fpar.ignore(1000, '\n') ;
50 fpar >> nr; fpar.ignore(1000, '\n');
51 fpar >> nt; fpar.ignore(1000, '\n');
52 fpar >> np; fpar.ignore(1000, '\n');
53 fpar >> CFornot; fpar.ignore(1000, '\n');
54 isCF = (CFornot == 1) ;
55
56 int nz=6; // Number of domain; unable to change it in parameter file until now, bu can be changed inside the code.
57
58 cout << "==========GRID PARAMETERS========" << endl;
59 cout << "total number of domains : nz = " << nz << endl ;
60 cout << "number of points in r : nr = " << nr << endl ;
61 cout << "number of points in phi : np = " << np << endl ;
62 cout << "number of points in theta : nt = " << nt << endl ;
63
64 fpar >> relax; fpar.ignore(1000, '\n');
65 fpar >> precis; fpar.ignore(1000, '\n');
66 fpar >> mer_max; fpar.ignore(1000, '\n');
67 fpar >> mer_max2; fpar.ignore(1000, '\n');
68 fpar >> Omega; fpar.ignore(1000, '\n');
69 fpar >> N_hor; fpar.ignore(1000, '\n');
70
71 cout << "=============PHYSICAL PARAMETERS===============" << endl;
72 cout << "Chosen rotation parameter : Omega= " << Omega << endl;
73 cout << "Value for the lapse at the horizon : N= " << N_hor << endl;
74
75 fpar.close();
76
77 //----------------------------------------------------------
78 // Construction of a multi-grid (Mg3d) and associated mapping
79 // ----------------------------------------------------------
80
81 // Note that the horizon radius is set by default to 1, which is
82 // the inner boundary of the first shell.
83
84 int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane
85 int symmetry_phi = SYM ; // symmetry in phi
86 int nbr[] = {nr, nr, nr, nr, nr, nr};
87 int nbt[] = {nt, nt, nt, nt, nt, nt} ;
88 int nbp[] = {np, np, np, np, np, np} ;
89 int tipe_r[] = {RARE, FIN, FIN, FIN, FIN, UNSURR} ;
90
91 Mg3d mgrid(nz, nbr, tipe_r, nbt, symmetry_theta, nbp, symmetry_phi) ;
92
93 // Construct angular grid for h(theta,phi)
94 const Mg3d& g_angu = *mgrid.get_angu_1dom() ;
95
96 // Construction of an affine mapping (Map_af)
97 // ------------------------------------------
98
99 // Boundaries of each domains
100 double Rmax = (1/0.3) ;
101 double r_limits[] = {0., 0.3*Rmax, 0.6*Rmax, 1.*Rmax, 2.*Rmax, 4.*Rmax, __infinity} ;
102 double r_limits2[] = {0.3*Rmax, 0.6*Rmax} ;
103
104 const Map_af map(mgrid, r_limits);
105 const Map_af map_2(g_angu, r_limits2);
106
107 // Some helpful stuff...
108 const Coord& rr = map.r;
109 Scalar rrr (map) ;
110 rrr = rr ;
111 rrr.std_spectral_base();
112 // const Metric_flat& mets = map.flat_met_spher() ;
113
114 // Definition of the class for black hole data containing an isolated horizon
115 //---------------------------------------------------------------------------
116 Scalar lapse_hor(map); lapse_hor = N_hor; lapse_hor.std_spectral_base();
117 Excised_slice Kerr_hole(*(dynamic_cast<const Map*>(&map)), 1 ,1);
118
119 // Compute the metric data using the Isol_hole class
120 //--------------------------------------------------
121 Kerr_hole.compute_stat_metric(precis, Omega, false, lapse_hor, isCF, relax, mer_max, mer_max2);
122
123 // Once metric fields are calculated, it is possible to perform several diagnostics on the data.
124
125 cout << "==============================================" << endl;
126 cout << " Computation for the ADM mass" << endl;
127 cout << " (LORENE Units) " << endl;
128 cout << " M_ADM = " << Kerr_hole.adm_mass() << endl;
129 cout << "==============================================" << endl;
130
131 cout << "==============================================" << endl;
132 cout << " Total Komar angular momentum " << endl;
133 cout << " (LORENE Units) " << endl;
134 cout << " J_K = " << Kerr_hole.komar_angmom() << endl;
135 cout << "==============================================" << endl;
136
137 cout << "==============================================" << endl;
138 cout << " Virial residue (stationarity marker) " << endl;
139 cout << " Difference between Komar and ADM masses" << endl;
140 cout << " (Rescaled values) " << endl;
141 cout << " Vir = " << Kerr_hole.virial_residue() << endl;
142 cout << "==============================================" << endl;
143
144 cout << "==============================================" << endl;
145 cout << " Violation of Einstein Equations " << endl;
146
147 Kerr_hole.Einstein_errors();
148
149 cout << "==============================================" << endl;
150
151
152 // The computed metric fields are saved as a whole in Isol_hole data.
153
154 FILE* Kerr_holedata = fopen("Kerr_data_Om0.05_N0.55.d", "w");
155 Kerr_hole.get_mp().get_mg()->sauve(Kerr_holedata) ; // writing of the grid
156 Kerr_hole.get_mp().sauve(Kerr_holedata) ;
157 Kerr_hole.sauve(Kerr_holedata);
158
159 fclose(Kerr_holedata);
160
161 return EXIT_SUCCESS ;
162
163 }
164
165