Debian Codegraph @

C++/Source/Isol_hole/isol_hole.C

raw
1 /*
2 * Methods of class Isol_hole
3 *
4 * (see file isol_hole.h for documentation)
5 */
6
7 /*
8 * Copyright (c) 2009 Nicolas Vasset
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 as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28 // Headers Lorene
29 #include "isol_hole.h"
30 #include "spheroid.h"
31 #include "excision_surf.h"
32 #include "excision_hor.h"
33 #include "utilitaires.h"
34 #include "param.h"
35 #include "unites.h"
36 #include "proto.h"
37
38 namespace Lorene {
39
40 // Fundamental constants and units
41 // -------------------------------
42 using namespace Unites ;
43
44 //--------------//
45 // Constructors //
46 //--------------//
47
48
49 // Standard constructor
50 // --------------------
51 Isol_hole::Isol_hole (const Map& mpi, double Omega_i, bool NorKappa_i, Scalar NoK_i, bool isCF_i)
52 : mp(mpi),
53 Omega(Omega_i),
54 NorKappa(NorKappa_i),
55 boundNoK(NoK_i),
56 isCF (isCF_i),
57 lapse(mpi),
58 conf_fact(mpi),
59 shift(mpi, CON, mpi.get_bvect_spher()),
60 hij(mpi, CON, mpi.get_bvect_spher()),
61 hatA(mpi, CON, mpi.get_bvect_spher()){
62
63
64
65
66
67 assert (boundNoK.get_mp() == mpi); // Check if this is not too strong a condition
68
69 // Pointers of derived quantities initialized to zero :
70 set_der_0x0() ;
71
72 // Initializing primary quantities.
73
74 lapse = 1. ;
75 conf_fact = 1. ;
76 shift.set_etat_zero() ;
77 hij.set_etat_zero();
78 hatA.set_etat_zero();
79 }
80
81 // Copy constructor
82 // ----------------
83 Isol_hole::Isol_hole(const Isol_hole& ih)
84 : mp(ih.mp),
85 Omega(ih.Omega),
86 NorKappa(ih.NorKappa),
87 boundNoK(ih.boundNoK),
88 isCF (ih.isCF),
89 lapse(ih.lapse),
90 conf_fact(ih.conf_fact),
91 shift(ih.shift),
92 hij(ih.hij),
93 hatA(ih.hatA){
94
95 set_der_0x0() ;
96
97 }
98
99 // Constructor from a file
100 // -----------------------
101 Isol_hole::Isol_hole(const Map& mpi, double Omega_i, bool NorKappa_i, Scalar NoK_i, bool isCF_i, FILE* fich)
102 : mp(mpi),
103 Omega(Omega_i),
104 NorKappa(NorKappa_i),
105 boundNoK(NoK_i),
106 isCF(isCF_i),
107 lapse(mpi,*(mpi.get_mg()), fich),
108 conf_fact(mpi,*(mpi.get_mg()), fich),
109 shift(mpi, mpi.get_bvect_spher(), fich),
110 hij(mpi, mpi.get_bvect_spher(), fich),
111 hatA(mpi, mpi.get_bvect_spher(), fich){
112
113
114
115 // Pointers of derived quantities initialized to zero
116 // --------------------------------------------------
117 set_der_0x0() ;
118
119 }
120
121 //------------//
122 // Destructor //
123 //------------//
124
125 Isol_hole::~Isol_hole(){
126
127 del_deriv() ;
128
129 }
130
131
132 //----------------------------------//
133 // Management of derived quantities //
134 //----------------------------------//
135
136 void Isol_hole::del_deriv() const {
137 if (p_hor != 0x0) delete p_hor ;
138 if (p_adm_mass != 0x0) delete p_adm_mass ;
139 if (p_komar_angmom != 0x0) delete p_komar_angmom ;
140 if (p_virial_residue != 0x0) delete p_virial_residue ;
141 Isol_hole::set_der_0x0() ;
142 }
143
144
145 void Isol_hole::set_der_0x0() const {
146 p_hor = 0x0;
147 p_adm_mass = 0x0 ;
148 p_komar_angmom = 0x0 ;
149 p_virial_residue = 0x0 ;
150 }
151
152
153
154 //--------------//
155 // Assignment //
156 //--------------//
157
158 // Assignment to another Isol_hole
159 // ----------------------------
160 void Isol_hole::operator=(const Isol_hole& ih) {
161
162 assert( &(ih.mp) == &mp ) ; // Same mapping
163 Omega = ih.Omega;
164 NorKappa = ih.NorKappa ;
165 boundNoK = ih.boundNoK ;
166 isCF = ih.isCF ;
167 lapse = ih.lapse ;
168 conf_fact = ih.conf_fact ;
169 shift = ih.shift ;
170 hij = ih.hij ;
171 hatA = ih.hatA ;
172
173 del_deriv() ; // Deletes all derived quantities
174
175 }
176
177 //--------------//
178 // Outputs //
179 //--------------//
180
181 // Save in a file
182 // --------------
183 void Isol_hole::sauve(FILE* fich) const {
184
185 lapse.sauve(fich) ;
186 conf_fact.sauve(fich) ;
187 shift.sauve(fich);
188 hij.sauve(fich);
189 hatA.sauve(fich);}
190
191
192 // Prints out maximal errors in Einstein equations for the obtained metric fields
193
194 void Isol_hole::Einstein_errors() {
195
196 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
197 const Metric_flat& mets = (*map).flat_met_spher() ;
198
199 Sym_tensor gamtcon = mets.con() + hij;
200 Metric gamt(gamtcon);
201 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
202 gamcon.std_spectral_base();
203 Metric gam(gamcon);
204 Sym_tensor k_uu = hatA/(pow(conf_fact,10)) ;
205 k_uu.std_spectral_base();
206 k_uu.dec_dzpuis(k_uu(1,1).get_dzpuis()); //WTF?
207 Sym_tensor k_dd = k_uu.up_down(gam);
208
209 Scalar TrK3 = k_uu.trace(gam);
210
211 // Hamiltonian constraint
212 //-----------------------
213 Scalar ham_constr = gam.ricci_scal() ;
214 ham_constr.dec_dzpuis(3) ; // To check
215 ham_constr += TrK3*TrK3 - contract(k_uu, 0, 1, k_dd, 0, 1) ;
216 maxabs(ham_constr, "Hamiltonian constraint: ") ;
217
218 // Momentum constraint
219 //-------------------
220 Vector mom_constr = k_uu.divergence(gam) - TrK3.derive_con(gam) ;
221 mom_constr.dec_dzpuis(2) ; // To check
222 maxabs(mom_constr, "Momentum constraint: ") ;
223
224 // Evolution equations
225 //--------------------
226 Sym_tensor evol_eq = lapse*gam.ricci()
227 - lapse.derive_cov(gam).derive_cov(gam);
228 evol_eq.dec_dzpuis() ;
229 evol_eq += k_dd.derive_lie(shift) ;
230 evol_eq.dec_dzpuis(2) ; // To check
231 evol_eq += lapse*(TrK3*k_dd - 2*contract(k_dd, 1, k_dd.up(0, gam), 0) ) ;
232 maxabs(evol_eq, "Evolution equations: ") ;
233
234 return;
235 }
236
237
238
239
240
241 //----------------------------//
242 // Accessors/ Derived data //
243 //----------------------------//
244
245 // Computation of the Spheroid corresponding to the black hole horizon
246
247 Spheroid Isol_hole::hor() {
248 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
249 const Mg3d* mgrid = (*map).get_mg();
250
251 // Construct angular grid for h(theta,phi)
252 const Mg3d* g_angu = (*mgrid).get_angu_1dom() ;
253
254 const Coord& rr = (*map).r;
255 Scalar rrr (*map) ;
256 rrr = rr ;
257 rrr.std_spectral_base();
258 assert((rrr.val_grid_point(1,0,0,0) - 1.) <= 1.e-9); // For now the code handles only horizons at r=1, corresponding to the first shell inner boundary. This test assures this is the case with our mapping.
259
260 // Angular mapping defined for one domain (argument of spheroid Class)
261 //--------------------------------------------------------------------
262
263 double r_limits2[] = {rrr.val_grid_point(1,0,0,0), rrr.val_grid_point(2,0,0,0)} ;
264 const Map_af map_2(*g_angu, r_limits2);
265
266 //Full 3-metric and extrrinsic curvature
267 const Metric_flat& mets = (*map).flat_met_spher() ;
268
269 Sym_tensor gamtcon = mets.con() + hij;
270 Metric gamt(gamtcon);
271 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
272 Metric gam(gamcon);
273
274
275 Sym_tensor kuu = hatA/pow(conf_fact,10) ;
276 kuu.std_spectral_base();
277 Sym_tensor kdd = kuu.up_down(gam);
278
279 //---------------------------------------------------------
280 // Construction of the spheroid associated with those data
281 //--------------------------------------------------------
282 double hor_posd = rrr.val_grid_point(1,0,0,0);
283 Scalar hor_pos(map_2); hor_pos = hor_posd; hor_pos.std_spectral_base();
284 Spheroid hor_loc(hor_pos, gam, kdd);
285 return hor_loc;
286 }
287
288 // Computation of the ADM mass of the BH spacetime
289 double Isol_hole::adm_mass() {
290 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
291 const Metric_flat& mets = (*map).flat_met_spher() ;
292
293 Sym_tensor gamtcon = mets.con() + hij;
294 Metric gamt(gamtcon);
295 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
296 Metric gam(gamcon);
297
298 Scalar detgam = sqrt((gam.cov())(2,2)*(gam.cov())(3,3) - (gam.cov())(2,3)*(gam.cov())(3,2));
299 detgam.std_spectral_base();
300 Vector corr_adm = - (0.125*contract(gamt.cov().derive_con(mets),1,2));
301 Scalar admintegr = conf_fact.dsdr() + corr_adm(1);
302
303 double M_ADM = - (1/(2.*3.1415927*ggrav))*(*map).integrale_surface_infini(admintegr*detgam);
304 return M_ADM;
305 }
306
307
308 // Computation of the Komar angular momentum w.r.t. assumed rotational symmetry
309 double Isol_hole:: komar_angmom() {
310 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
311 const Metric_flat& mets = (*map).flat_met_spher() ;
312
313 Sym_tensor gamtcon = mets.con() + hij;
314 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
315 gamcon.std_spectral_base();
316 Metric gam(gamcon);
317 Sym_tensor k_uu = hatA/(pow(conf_fact,10));
318 k_uu.std_spectral_base();
319 k_uu.dec_dzpuis(k_uu(1,1).get_dzpuis()); //WTF?
320 Sym_tensor k_dd = k_uu.up_down(gam);
321
322 Scalar detgam = sqrt((gam.cov())(2,2)*(gam.cov())(3,3) - (gam.cov())(2,3)*(gam.cov())(3,2));
323 detgam.std_spectral_base();
324 Scalar contraction = k_dd(1,3); contraction.mult_r_dzpuis(2); contraction.mult_sint();
325 double angu_komar = - (1/(8.*3.1415927*ggrav))*(*map).integrale_surface_infini(detgam*contraction);
326
327 return angu_komar;
328 }
329
330
331 // Computation of the Virial residual, as rescaled difference at infinity
332 // between the ADM mass and the Komar integral associated to the mass
333
334 double Isol_hole::virial_residue() {
335 const Mg3d* mgrid = mp.get_mg();
336 const int nz = (*mgrid).get_nzone(); // Number of domains
337 Valeur** devel_psi (conf_fact.asymptot(1)) ;
338 Valeur** devel_n (lapse.asymptot(1)) ;
339
340
341 double erreur = (2*(*devel_psi[1])(nz-1, 0, 0, 0)
342 + (*devel_n[1])(nz-1, 0, 0, 0))/fabs ((*devel_n[1])(nz-1, 0, 0, 0)) ;
343
344 return erreur;
345 }
346
347
348
349
350
351 }