LORENE
binary_global_xcts.C
1/*
2 * Methods of class Binary_xcts to compute global quantities
3 * (see file binary_xcts.h for documentation)
4 */
5
6/*
7 * Copyright (c) 2010 Michal Bejger
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
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
28/*
29 * $Id: binary_global_xcts.C,v 1.12 2016/12/05 16:17:47 j_novak Exp $
30 * $Log: binary_global_xcts.C,v $
31 * Revision 1.12 2016/12/05 16:17:47 j_novak
32 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
33 *
34 * Revision 1.11 2014/10/13 08:52:45 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.10 2010/12/21 11:15:46 m_bejger
38 * Linear momentum properly defined
39 *
40 * Revision 1.9 2010/12/20 15:45:40 m_bejger
41 * Spectral basis in lin_mom() was not defined
42 *
43 * Revision 1.8 2010/12/20 09:54:09 m_bejger
44 * Angular momentum correction, stub for linear momentum added
45 *
46 * Revision 1.7 2010/12/09 10:39:41 m_bejger
47 * Further corrections to integral quantities
48 *
49 * Revision 1.6 2010/10/26 19:16:26 m_bejger
50 * Cleanup of some diagnostic messages
51 *
52 * Revision 1.5 2010/10/25 15:02:08 m_bejger
53 * mass_kom_vol() corrected
54 *
55 * Revision 1.4 2010/10/24 21:45:24 m_bejger
56 * mass_adm() corrected
57 *
58 * Revision 1.3 2010/06/17 14:48:14 m_bejger
59 * Minor corrections
60 *
61 * Revision 1.2 2010/06/04 19:54:19 m_bejger
62 * Minor corrections, mass volume integrals need to be checked out
63 *
64 * Revision 1.1 2010/05/04 07:35:54 m_bejger
65 * Initial version
66 *
67 * $Header: /cvsroot/Lorene/C++/Source/Binary_xcts/binary_global_xcts.C,v 1.12 2016/12/05 16:17:47 j_novak Exp $
68 *
69 */
70
71// Headers C
72#include "math.h"
73
74// Headers Lorene
75#include "nbr_spx.h"
76#include "binary_xcts.h"
77#include "unites.h"
78#include "metric.h"
79
80 //---------------------------------//
81 // ADM mass //
82 //---------------------------------//
83
84namespace Lorene {
85double Binary_xcts::mass_adm() const {
86
87 using namespace Unites ;
88
89 if (p_mass_adm == 0x0) { // a new computation is required
90
91 p_mass_adm = new double ;
92 *p_mass_adm = 0 ;
93
94 const Map_af map0 (et[0]->get_mp()) ;
95 const Metric& flat = (et[0]->get_flat()) ;
96
97 Vector dpsi((et[0]->get_Psi()).derive_cov(flat)) ;
98
99 dpsi.change_triad(map0.get_bvect_spher()) ;
100
101 Scalar integrand ( dpsi(1) ) ;
102
103 *p_mass_adm = - 2.* map0.integrale_surface_infini(integrand)/ qpig ;
104
105 }
106
107 return *p_mass_adm ;
108
109}
110
111 //---------------------------------//
112 // ADM mass //
113 // (volume integral) //
114 //---------------------------------//
115
117
118 using namespace Unites ;
119
120 double massadm = 0. ;
121
122 for (int i=0; i<=1; i++) { // loop on the stars
123
124 // Declaration of all fields
125
126 const Scalar& psi(et[i]->get_Psi()) ;
127 Scalar psi5 = pow(psi, 5.) ;
128 psi5.std_spectral_base() ;
129
130 Scalar spsi7 = pow(psi, -7.) ;
131 spsi7.std_spectral_base() ;
132
133 const Scalar& ener_euler = et[i]->get_ener_euler() ;
134 const Scalar& hacar_auto = et[i]->get_hacar_auto() ;
135 const Scalar& hacar_comp = et[i]->get_hacar_comp() ;
136
137 Scalar source = psi5 % ener_euler
138 + spsi7 % (hacar_auto + hacar_comp)/(4.*qpig) ;
139
140 source.std_spectral_base() ;
141
142 massadm += source.integrale() ;
143 }
144
145 return massadm ;
146}
147
148 //---------------------------------//
149 // Komar mass //
150 //---------------------------------//
151
152double Binary_xcts::mass_kom() const {
153
154 using namespace Unites ;
155
156 if (p_mass_kom == 0x0) { // a new computation is requireed
157
158 p_mass_kom = new double ;
159 *p_mass_kom = 0 ;
160
161 const Scalar& logn = et[0]->get_logn() ;
162 const Metric& flat = et[0]->get_flat() ;
163
164 Map_af map0 (et[0]->get_mp()) ;
165
166 Vector vect = logn.derive_con(flat) ;
167 vect.change_triad(map0.get_bvect_spher()) ;
168
169 Scalar integrant (vect(1)) ;
170
171 *p_mass_kom = map0.integrale_surface_infini (integrant) / qpig ;
172
173 } // End of the case where a new computation was necessary
174
175 return *p_mass_kom ;
176
177}
178
180
181 using namespace Unites ;
182
183 double masskom = 0.;
184
185 for (int i=0; i<=1; i++) { // loop on the stars
186
187 const Scalar& Psi = et[i]->get_Psi() ;
188 const Scalar& psi4 = et[i]->get_psi4() ;
189 const Scalar& chi = et[i]->get_chi() ;
190
191 const Scalar& ener_euler = et[i]->get_ener_euler() ;
192 const Scalar& s_euler = et[i]->get_s_euler() ;
193 const Scalar& hacar_auto = et[i]->get_hacar_auto() ;
194 const Scalar& hacar_comp = et[i]->get_hacar_comp() ;
195
196 Scalar psi4chi = psi4 % chi ;
197 psi4chi.std_spectral_base() ;
198
199 Scalar source = 0.5 * ener_euler * (psi4chi + psi4 % Psi)
200 + psi4chi * s_euler + pow(Psi, -7.) * (7.*chi/Psi + 1.)
201 * (hacar_auto + hacar_comp) / (8.*qpig) ;
202 source.std_spectral_base() ;
203
204 masskom += source.integrale() ;
205
206 }
207
208 return masskom ;
209
210}
211
212 //-------------------------------------//
213 // Total angular momentum (z-axis) //
214 //-------------------------------------//
215
217
218 using namespace Unites ;
219
220 if (p_angu_mom == 0x0) { // a new computation is required
221
222 p_angu_mom = new Tbl(3) ;
223 p_angu_mom->annule_hard() ; // fills the double array with zeros
224
225 // Reference Cartesian vector basis of the Absolute frame
226 Base_vect_cart bvect_ref(0.) ; // 0. = parallel to the Absolute frame
227
228 for (int i=0; i<=1; i++) { // loop on the stars
229
230 const Map& mp = et[i]->get_mp() ;
231
232 // Azimuthal vector d/dphi
233 Vector vphi(mp, CON, bvect_ref) ;
234 Scalar yya (mp) ; yya = mp.ya ;
235 Scalar xxa (mp) ; xxa = mp.xa ;
236 vphi.set(1) = - yya ; // phi^X
237 vphi.set(2) = xxa ;
238 vphi.set(3) = 0 ;
239
240 vphi.std_spectral_base() ;
241 vphi.change_triad(mp.get_bvect_cart()) ;
242
243 // Matter part
244 // -----------
245 const Scalar& ee = et[i]->get_ener_euler() ;
246 const Scalar& pp = et[i]->get_press() ;
247
248 Vector jmom = pow(et[i]->get_Psi(), 10) * (ee + pp)
249 * (et[i]->get_u_euler()) ;
250 jmom.std_spectral_base() ;
251
252 const Metric& flat = et[i]->get_flat() ;
253 Vector vphi_cov = vphi.up_down(flat) ;
254
255 Scalar integrand = contract(jmom, 0, vphi_cov, 0) ;
256
257 p_angu_mom->set(2) += integrand.integrale() ;
258
259 } // End of the loop on the stars
260
261 } // End of the case where a new computation was necessary
262
263 return *p_angu_mom ;
264
265}
266
267 //---------------------------------//
268 // Total linear momentum //
269 //---------------------------------//
270
271const Tbl& Binary_xcts::lin_mom() const {
272
273 using namespace Unites ;
274
275 if (p_lin_mom == 0x0) { // a new computation is required
276
277 p_lin_mom = new Tbl(3) ;
278 p_lin_mom->annule_hard() ;
279
280 // Reference Cartesian vector basis of the Absolute frame
281 Base_vect_cart bvect_ref(0.) ; // 0. = parallel to the Absolute frame
282
283 for (int i=0; i<=1; i++) { // loop on the stars
284
285 const Scalar& ee = et[i]->get_ener_euler() ;
286 const Scalar& pp = et[i]->get_press() ;
287 Vector lmom = pow(et[i]->get_Psi(), 10) * (ee + pp)
288 * ( et[i]->get_u_euler() ) ;
289
290 lmom.std_spectral_base() ;
291 lmom.change_triad(bvect_ref) ;
292
293 // loop on the components
294 for (int j=1; j<=2; j++)
295 p_lin_mom->set(j-1) += lmom(j).integrale() ;
296
297
298 } // End of the loop on the stars
299
300 } // End of the case where a new computation was necessary
301
302 return *p_lin_mom ;
303
304}
305
306 //---------------------------------//
307 // Total energy //
308 //---------------------------------//
309
311
312 if (p_total_ener == 0x0) { // a new computation is requireed
313
314 p_total_ener = new double ;
315
316 *p_total_ener = mass_adm() - star1.mass_b() - star2.mass_b() ;
317
318 } // End of the case where a new computation was necessary
319
320 return *p_total_ener ;
321
322}
323
324
325 //---------------------------------//
326 // Error on the virial theorem //
327 //---------------------------------//
328
329double Binary_xcts::virial() const {
330
331 if (p_virial == 0x0) { // a new computation is requireed
332
333 p_virial = new double ;
334
335 *p_virial = 1. - mass_kom() / mass_adm() ;
336
337 }
338
339 return *p_virial ;
340
341}
342
343 //---------------------------------//
344 // Error on the virial theorem //
345 // (volume version) //
346 //---------------------------------//
347
349
350 if (p_virial_vol == 0x0) { // a new computation is requireed
351
352 p_virial_vol = new double ;
353
354 *p_virial_vol = 1. - mass_kom_vol() / mass_adm_vol() ;
355
356 }
357
358 return *p_virial_vol ;
359
360}
361}
Cartesian vectorial bases (triads).
Definition base_vect.h:201
const Tbl & lin_mom() const
Total linear momentum.
double total_ener() const
Total energy (excluding the rest mass energy).
double virial_vol() const
Estimates the relative error on the virial theorem (volume version).
double * p_mass_kom
Total Komar mass of the system.
Definition binary_xcts.h:94
Star_bin_xcts star2
Second star of the system.
Definition binary_xcts.h:69
double mass_adm_vol() const
Total ADM mass (computed by a volume integral).
double * p_virial_vol
Virial theorem error (volume version).
Tbl * p_lin_mom
Total linear momentum of the system.
double mass_kom_vol() const
Total Komar mass (computed by a volume integral).
Star_bin_xcts star1
First star of the system.
Definition binary_xcts.h:66
double mass_adm() const
Total ADM mass.
double * p_mass_adm
Total ADM mass of the system.
Definition binary_xcts.h:91
double * p_total_ener
Total energy of the system.
double mass_kom() const
Total Komar mass.
double virial() const
Estimates the relative error on the virial theorem.
Tbl * p_angu_mom
Total angular momentum of the system.
Definition binary_xcts.h:97
Star_bin_xcts * et[2]
Array of the two stars (to perform loops on the stars): et[0] contains the address of star1 and et[1]...
Definition binary_xcts.h:75
double * p_virial
Virial theorem error.
const Tbl & angu_mom() const
Total angular momentum.
Affine radial mapping.
Definition map.h:2042
double integrale_surface_infini(const Cmp &ci) const
Performs the surface integration of ci at infinity.
Metric for tensor calculation.
Definition metric.h:90
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:393
double integrale() const
Computes the integral over all space of *this .
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
Definition scalar.C:790
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Basic array class.
Definition tbl.h:161
Tensor field of valence 1.
Definition vector.h:188
virtual void std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
Definition vector.C:319
virtual void change_triad(const Base_vect &)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Scalar & set(int)
Read/write access to a component.
Definition vector.C:299
Cmp pow(const Cmp &, int)
Power .
Definition cmp_math.C:351
Tensor up_down(const Metric &gam) const
Computes a new tensor by raising or lowering all the indices of *this .
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Lorene prototypes.
Definition app_hor.h:67
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Definition map.C:142
Standard units of space, time and mass.