Debian Codegraph @

C++/Source/Bin_ns_ncp/bin_ns_ncp_global.C

raw
1 /*
2 * Methods of class Bin_ns_ncp to compute global quantities
3 *
4 * (see file bin_ns_ncp.h for documentation)
5 */
6
7 /*
8 * Copyright (c) 2003 Francois Limousin
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
29 char bin_ns_ncp_global_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_ns_ncp/bin_ns_ncp_global.C,v 1.7 2014/10/13 08:52:43 j_novak Exp $" ;
30
31 /*
32 * $Header: /cvsroot/Lorene/C++/Source/Bin_ns_ncp/bin_ns_ncp_global.C,v 1.7 2014/10/13 08:52:43 j_novak Exp $
33 *
34 */
35
36 // Headers C
37 #include "math.h"
38
39 // Headers Lorene
40 #include "bin_ns_ncp.h"
41 #include "unites.h"
42
43 //---------------------------------//
44 // ADM mass //
45 //---------------------------------//
46
47 namespace Lorene {
48 double Bin_ns_ncp::mass_adm() const {
49
50 using namespace Unites ;
51
52 if (p_mass_adm == 0x0) { // a new computation is requireed
53
54 p_mass_adm = new double ;
55
56 *p_mass_adm = 0 ;
57
58 const Metrique& gtilde = (et[0]->get_gtilde()) ;
59 const Tenseur& gamma = (et[0]->get_gamma()) ;
60 const Metrique& flat = (et[0]->get_flat()) ;
61 Map_af map0 (et[0]->get_mp()) ;
62
63 Tenseur_sym met_gamma = pow(gamma, 1./3.)*gtilde.cov() ;
64 met_gamma.set_std_base() ;
65 Tenseur dcov_met_gamma = met_gamma.derive_cov(flat) ;
66
67 Tenseur dgamma_1 (map0, 1, CON, map0.get_bvect_cart()) ;
68 dgamma_1.set_etat_qcq() ;
69 dgamma_1 = contract( flat.con(), 1, contract(contract(flat.con()
70 , 0, dcov_met_gamma, 0), 0, 2), 0) ;
71 dgamma_1.change_triad(map0.get_bvect_spher()) ;
72 Cmp integrant_1 (dgamma_1(0)) ;
73
74 Tenseur dgamma_2 (map0, 1, CON, map0.get_bvect_cart()) ;
75 dgamma_2.set_etat_qcq() ;
76 dgamma_2 = contract( flat.con(), 1, contract(contract(flat.con()
77 , 0, dcov_met_gamma, 1), 0, 2), 0) ;
78 dgamma_2.change_triad(map0.get_bvect_spher()) ;
79 Cmp integrant_2 (dgamma_2(0)) ;
80
81 *p_mass_adm = map0.integrale_surface_infini (integrant_1 - integrant_2)/(4*qpig) ;
82
83
84 } // End of the case where a new computation was necessary
85
86 return *p_mass_adm ;
87
88 }
89
90
91 //---------------------------------//
92 // Komar mass //
93 //---------------------------------//
94
95 double Bin_ns_ncp::mass_kom() const {
96
97 using namespace Unites ;
98
99 if (p_mass_kom == 0x0) { // a new computation is requireed
100
101 p_mass_kom = new double ;
102
103 *p_mass_kom = 0 ;
104
105 const Tenseur& logn_auto = et[0]->get_logn_auto() ;
106 const Tenseur& logn_comp = et[0]->get_logn_comp() ;
107 const Metrique& gtilde = (et[0]->get_gtilde()) ;
108 const Tenseur& gamma = (et[0]->get_gamma()) ;
109 Map_af map0 (et[0]->get_mp()) ;
110
111 const Tenseur_sym metgamma_cov (pow(gamma, 1./3.)*gtilde.cov()) ;
112 const Metrique met_gamma(metgamma_cov, false) ;
113
114 Tenseur logn = logn_auto + logn_comp ;
115
116 Tenseur vect (map0, 1, CON, map0.get_bvect_cart()) ;
117 vect.set_etat_qcq() ;
118 vect = logn.derive_con(met_gamma) ;
119 vect.change_triad(map0.get_bvect_spher()) ;
120 Cmp integrant (vect(0)) ;
121
122 *p_mass_kom = map0.integrale_surface_infini (integrant) / qpig ;
123
124 } // End of the case where a new computation was necessary
125
126 return *p_mass_kom ;
127
128 }
129
130
131 //---------------------------------//
132 // Total angular momentum //
133 //---------------------------------//
134
135 const Tbl& Bin_ns_ncp::angu_mom() const {
136
137 if (p_angu_mom == 0x0) { // a new computation is requireed
138
139 p_angu_mom = new Tbl(3) ;
140
141 p_angu_mom->annule_hard() ; // fills the double array with zeros
142
143
144 Map_af map0 (et[0]->get_mp()) ;
145 const Tenseur_sym& kij_auto = et[0]->get_tkij_auto() ;
146 const Tenseur_sym& kij_comp = et[0]->get_tkij_auto() ;
147
148 Tenseur_sym kij = kij_auto + kij_comp ;
149
150 Cmp xx(map0) ;
151 Cmp yy(map0) ;
152 Cmp zz(map0) ;
153
154 xx = map0.xa ;
155 yy = map0.ya ;
156 zz = map0.za ;
157
158 // X component
159 // -----------
160
161 Tenseur vect_x(map0, 1, CON, map0.get_bvect_cart()) ;
162 vect_x.set_etat_qcq() ;
163
164 for (int i=0; i<=2; i++) {
165 vect_x.set(i) = yy*kij(2, i) - zz*kij(1, i) ;
166 }
167 vect_x.set_std_base() ;
168 vect_x.change_triad(map0.get_bvect_spher()) ;
169 Cmp integrant_x (vect_x(0)) ;
170
171 p_angu_mom->set(0) = map0.integrale_surface_infini (integrant_x)
172 / (8*M_PI) ;
173
174 // Y component
175 // -----------
176
177 Tenseur vect_y(map0, 1, CON, map0.get_bvect_cart()) ;
178 vect_y.set_etat_qcq() ;
179 for (int i=0; i<=2; i++) {
180 vect_y.set(i) = zz*kij(0, i) - xx*kij(2, i) ;
181 }
182 vect_y.set_std_base() ;
183 vect_y.change_triad(map0.get_bvect_spher()) ;
184 Cmp integrant_y (vect_y(0)) ;
185
186 p_angu_mom->set(1) = map0.integrale_surface_infini (integrant_y)
187 / (8*M_PI) ;
188
189 // Z component
190 // -----------
191
192 Tenseur vect_z(map0, 1, CON, map0.get_bvect_cart()) ;
193 vect_z.set_etat_qcq() ;
194 for (int i=0; i<=2; i++) {
195 vect_z.set(i) = xx*kij_auto(1, i) ;//- yy*kij_auto(0, i) ;
196 }
197 vect_z.set_std_base() ;
198 vect_z.change_triad(map0.get_bvect_spher()) ;
199 Cmp integrant_z (vect_z(0)) ;
200
201 p_angu_mom->set(2) = map0.integrale_surface_infini (integrant_z)
202 / (8*M_PI) ;
203
204
205
206 } // End of the case where a new computation was necessary
207
208 return *p_angu_mom ;
209
210 }
211
212
213
214 //---------------------------------//
215 // Total energy //
216 //---------------------------------//
217
218 double Bin_ns_ncp::total_ener() const {
219
220 if (p_total_ener == 0x0) { // a new computation is requireed
221
222 p_total_ener = new double ;
223
224 *p_total_ener = mass_adm() - star1.mass_b() - star2.mass_b() ;
225
226 } // End of the case where a new computation was necessary
227
228
229 return *p_total_ener ;
230
231 }
232
233
234 //---------------------------------//
235 // Error on the virial theorem //
236 //---------------------------------//
237
238 double Bin_ns_ncp::virial() const {
239
240 if (p_virial == 0x0) { // a new computation is requireed
241
242 p_virial = new double ;
243
244 *p_virial = 1. - mass_kom() / mass_adm() ;
245
246 }
247
248 return *p_virial ;
249
250 }
251
252
253 /* //----------------------------------------------//
254 // Virial error by Gourgoulhon and Bonazzola //
255 //----------------------------------------------//
256
257 double Bin_ns_ncp::virial_gb() const {
258
259 using namespace Unites ;
260
261 if (p_virial_gb == 0x0) { // a new computation is requireed
262
263 p_virial_gb = new double ;
264
265 if (star1.is_relativistic()) { // Relativistic case
266 // -----------------
267
268 assert( star2.is_relativistic() ) ;
269
270 *p_virial_gb = 0 ;
271
272 double vir_pres = 0. ;
273 double vir_extr = 0. ;
274 double vir_grav = 0. ;
275
276 for (int i=0; i<=1; i++) { // loop on the stars
277
278 const Cmp& a2 = (et[i]->get_a_car())() ;
279 const Cmp& se = (et[i]->get_s_euler())() ;
280 const Cmp& ak2_auto = (et[i]->get_akcar_auto())() ;
281 const Cmp& ak2_comp = (et[i]->get_akcar_comp())() ;
282
283 const Tenseur& dnu_auto = et[i]->get_d_logn_auto() ;
284 const Tenseur& dnu_comp = et[i]->get_d_logn_comp() ;
285 const Tenseur& dbe_auto = et[i]->get_d_beta_auto() ;
286 const Tenseur& dbe_comp = et[i]->get_d_beta_comp() ;
287
288 Cmp source = 2. * a2 * sqrt(a2) * se ;
289 vir_pres += source.integrale() ;
290
291 source = 1.5 * sqrt(a2) * (ak2_auto + ak2_comp) / qpig ;
292 vir_extr += source.integrale() ;
293
294 Tenseur sprod1 = flat_scalar_prod(dbe_auto, dbe_auto+dbe_comp) ;
295 Tenseur sprod2 = flat_scalar_prod(dnu_auto, dnu_auto+dnu_comp) ;
296 Tenseur sprod3 = flat_scalar_prod(dbe_auto, dnu_auto+dnu_comp) ;
297
298 source = sqrt(a2) * ( sprod1() - sprod2() - 2.*sprod3() )/qpig ;
299 vir_grav += source.integrale() ;
300
301 } // End of the loop on the stars
302
303
304 *p_virial_gb = (vir_pres + vir_extr + vir_grav) / mass_adm() ;
305
306 }
307 else { // Newtonian case
308 // --------------
309
310 *p_virial_gb = virial() ;
311
312
313 } // End of the Newtonian case
314
315 } // End of the case where a new computation was necessary
316
317 return *p_virial_gb ;
318
319 }
320
321
322 //------------------------------------------------//
323 // Virial error by Friedman, Uryu, and Shibata //
324 //------------------------------------------------//
325
326 double Bin_ns_ncp::virial_fus() const {
327
328 if (p_virial_fus == 0x0) { // a new computation is requireed
329
330 p_virial_fus = new double ;
331
332 if (star1.is_relativistic()) { // Relativistic case
333 // -----------------
334 using namespace Unites ;
335
336 assert( star2.is_relativistic() ) ;
337
338 *p_virial_fus = 0 ;
339
340 double vir_pres = 0. ;
341 double vir_extr = 0. ;
342 double vir_grav = 0. ;
343
344 for (int i=0; i<=1; i++) { // loop on the stars
345
346 const Cmp& lapse = (et[i]->get_nnn())() ;
347 const Cmp& a2 = (et[i]->get_a_car())() ;
348 const Cmp& se = (et[i]->get_s_euler())() ;
349 const Cmp& ak2_auto = (et[i]->get_akcar_auto())() ;
350 const Cmp& ak2_comp = (et[i]->get_akcar_comp())() ;
351
352 const Tenseur& dnu_auto = et[i]->get_d_logn_auto() ;
353 const Tenseur& dnu_comp = et[i]->get_d_logn_comp() ;
354 const Tenseur& dbe_auto = et[i]->get_d_beta_auto() ;
355 const Tenseur& dbe_comp = et[i]->get_d_beta_comp() ;
356
357 Cmp source = 2. * lapse * a2 * sqrt(a2) * se ;
358 vir_pres += source.integrale() ;
359
360 source = 1.5 * lapse * sqrt(a2) * (ak2_auto + ak2_comp) / qpig ;
361 vir_extr += source.integrale() ;
362
363 Tenseur sprod = flat_scalar_prod( dbe_auto, dbe_auto+dbe_comp )
364 - flat_scalar_prod( dnu_auto, dnu_auto+dnu_comp ) ;
365
366 source = lapse * sqrt(a2) * sprod() / qpig ;
367 vir_grav += source.integrale() ;
368
369 } // End of the loop on the stars
370
371
372 *p_virial_fus = (vir_pres + vir_extr + vir_grav) / mass_adm() ;
373
374 }
375 else { // Newtonian case
376 // --------------
377
378 *p_virial_fus = virial() ;
379
380
381 } // End of the Newtonian case
382
383 } // End of the case where a new computation was necessary
384
385 return *p_virial_fus ;
386
387 }
388
389 */
390 }