LORENE
bin_bhns_extr_global.C
1 /*
2  * Methods of class Bin_bhns_extr to compute global quantities
3  *
4  * (see file bin_bhns_extr.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2004-2005 Keisuke Taniguchi
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
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 
30 /*
31  * $Id: bin_bhns_extr_global.C,v 1.5 2016/12/05 16:17:46 j_novak Exp $
32  * $Log: bin_bhns_extr_global.C,v $
33  * Revision 1.5 2016/12/05 16:17:46 j_novak
34  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
35  *
36  * Revision 1.4 2014/10/13 08:52:42 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.3 2014/10/06 15:13:00 j_novak
40  * Modified #include directives to use c++ syntax.
41  *
42  * Revision 1.2 2005/02/28 23:07:12 k_taniguchi
43  * Suppression of the ADM mass and so on.
44  *
45  * Revision 1.1 2004/11/30 20:46:13 k_taniguchi
46  * *** empty log message ***
47  *
48  *
49  * $Header: /cvsroot/Lorene/C++/Source/Bin_bhns_extr/bin_bhns_extr_global.C,v 1.5 2016/12/05 16:17:46 j_novak Exp $
50  *
51  */
52 
53 // C headers
54 #include <cmath>
55 
56 // Lorene headers
57 #include "bin_bhns_extr.h"
58 #include "coord.h"
59 #include "unites.h"
60 
61  //--------------------------------------------------//
62  // X coordinate of the barycenter //
63  //--------------------------------------------------//
64 
65 namespace Lorene {
67 
68  using namespace Unites ;
69 
70  if (p_xa_barycenter_extr == 0x0) { // a new computation is required
71 
72  p_xa_barycenter_extr = new double ;
73 
75 
76  const Map& mp = star.get_mp() ;
77  Cmp xxa(mp) ;
78  xxa = mp.xa ; // Absolute X coordinate
79  xxa.std_base_scal() ;
80 
81  if (star.in_kerrschild()) { // Kerr-Schild background metric
82 
83  const Coord& xx = mp.x ;
84  const Coord& yy = mp.y ;
85  const Coord& zz = mp.z ;
86 
87  Tenseur r_bh(mp) ;
88  r_bh.set_etat_qcq() ;
89  r_bh.set() = pow( (xx+separ)*(xx+separ) + yy*yy + zz*zz, 0.5) ;
90  r_bh.set_std_base() ;
91 
92  Tenseur msr(mp) ;
93  msr = ggrav * mass_bh / r_bh ;
94  msr.set_std_base() ;
95 
96  Cmp tmp = sqrt(1. + 2.*msr()) ;
97  tmp.std_base_scal() ;
98 
99  Tenseur acar = star.get_a_car() ;
100  acar.set_std_base() ;
101 
102  Tenseur g_euler = star.get_gam_euler() ;
103  g_euler.set_std_base() ;
104 
105  Tenseur nbary = star.get_nbar() ;
106  nbary.set_std_base() ;
107 
108  Cmp dens = acar() * sqrt(acar()) * g_euler() * nbary()
109  * tmp * xxa ;
110  dens.std_base_scal() ;
111 
113 
114  }
115  else { // Conformally flat background metrci
116 
117  Tenseur acar = star.get_a_car() ;
118  acar.set_std_base() ;
119 
120  Tenseur g_euler = star.get_gam_euler() ;
121  g_euler.set_std_base() ;
122 
123  Tenseur nbary = star.get_nbar() ;
124  nbary.set_std_base() ;
125 
126  Cmp dens = acar() * sqrt(acar()) * g_euler() * nbary() * xxa ;
127  dens.std_base_scal() ;
128 
130 
131  }
132 
133  }
134 
135  return *p_xa_barycenter_extr ;
136 
137 }
138 
139  //--------------------------------------------------//
140  // Y coordinate of the barycenter //
141  //--------------------------------------------------//
142 
144 
145  using namespace Unites ;
146 
147  if (p_ya_barycenter_extr == 0x0) { // a new computation is required
148 
149  p_ya_barycenter_extr = new double ;
150 
151  *p_ya_barycenter_extr = 0 ;
152 
153  const Map& mp = star.get_mp() ;
154  Cmp yya(mp) ;
155  yya = mp.ya ; // Absolute Y coordinate
156  yya.std_base_scal() ;
157 
158  if (star.in_kerrschild()) { // Kerr-Schild background metric
159 
160  const Coord& xx = mp.x ;
161  const Coord& yy = mp.y ;
162  const Coord& zz = mp.z ;
163 
164  Tenseur r_bh(mp) ;
165  r_bh.set_etat_qcq() ;
166  r_bh.set() = pow( (xx+separ)*(xx+separ) + yy*yy + zz*zz, 0.5) ;
167  r_bh.set_std_base() ;
168 
169  Tenseur msr(mp) ;
170  msr = ggrav * mass_bh / r_bh ;
171  msr.set_std_base() ;
172 
173  Cmp tmp = sqrt(1. + 2.*msr()) ;
174  tmp.std_base_scal() ;
175 
176  Tenseur acar = star.get_a_car() ;
177  acar.set_std_base() ;
178 
179  Tenseur g_euler = star.get_gam_euler() ;
180  g_euler.set_std_base() ;
181 
182  Tenseur nbary = star.get_nbar() ;
183  nbary.set_std_base() ;
184 
185  Cmp dens = acar() * sqrt(acar()) * g_euler() * nbary()
186  * tmp * yya ;
187  dens.std_base_scal() ;
188 
190 
191  }
192  else { // Conformally flat background metric
193  // It should be zero !
194 
195  Tenseur acar = star.get_a_car() ;
196  acar.set_std_base() ;
197 
198  Tenseur g_euler = star.get_gam_euler() ;
199  g_euler.set_std_base() ;
200 
201  Tenseur nbary = star.get_nbar() ;
202  nbary.set_std_base() ;
203 
204  Cmp dens = acar() * sqrt(acar()) * g_euler() * nbary() * yya ;
205  dens.std_base_scal() ;
206 
208 
209  }
210 
211  }
212 
213  return *p_ya_barycenter_extr ;
214 
215 }
216 
217  //-------------------------------//
218  // Baryon mass //
219  //-------------------------------//
220 
222 
223  using namespace Unites ;
224 
225  if (p_mass_b_extr == 0x0) { // a new computation is required
226 
227  p_mass_b_extr = new double ;
228 
229  if (star.is_relativistic()) { // Relativistic case
230 
231  *p_mass_b_extr = 0 ;
232 
233  if (star.in_kerrschild()) { // Kerr-Schild background metric
234 
235  const Map& mp = star.get_mp() ;
236 
237  const Coord& xx = mp.x ;
238  const Coord& yy = mp.y ;
239  const Coord& zz = mp.z ;
240 
241  Tenseur r_bh(mp) ;
242  r_bh.set_etat_qcq() ;
243  r_bh.set() = pow( (xx+separ)*(xx+separ) + yy*yy + zz*zz, 0.5) ;
244  r_bh.set_std_base() ;
245 
246  Tenseur msr(mp) ;
247  msr = ggrav * mass_bh / r_bh ;
248  msr.set_std_base() ;
249 
250  Cmp tmp = sqrt(1. + 2.*msr()) ;
251  tmp.std_base_scal() ;
252 
253  Tenseur acar = star.get_a_car() ;
254  acar.set_std_base() ;
255 
256  Tenseur g_euler = star.get_gam_euler() ;
257  g_euler.set_std_base() ;
258 
259  Tenseur nbary = star.get_nbar() ;
260  nbary.set_std_base() ;
261 
262  Cmp dens = acar() * sqrt(acar()) * g_euler() * nbary() * tmp ;
263  dens.std_base_scal() ;
264 
265  *p_mass_b_extr = dens.integrale() ;
266 
267  }
268  else { // Conformally flat background metric
269 
270  Tenseur acar = star.get_a_car() ;
271  acar.set_std_base() ;
272 
273  Tenseur g_euler = star.get_gam_euler() ;
274  g_euler.set_std_base() ;
275 
276  Tenseur nbary = star.get_nbar() ;
277  nbary.set_std_base() ;
278 
279  Cmp dens = acar() * sqrt(acar()) * g_euler() * nbary() ;
280  dens.std_base_scal() ;
281 
282  *p_mass_b_extr = dens.integrale() ;
283 
284  }
285 
286  }
287  else {
288 
289  cout << "BH-NS binary system should be relativistic!!!" << endl ;
290  abort() ;
291 
292  }
293  }
294 
295  return *p_mass_b_extr ;
296 
297 }
298 }
Coord xa
Absolute x coordinate.
Definition: map.h:748
double * p_xa_barycenter_extr
Absolute coordinate X of the barycenter of the baryon density in the Kerr-Schild background metric or...
Definition: bin_bhns_extr.h:86
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
const Map & get_mp() const
Returns the mapping.
Definition: etoile.h:662
const Tenseur & get_a_car() const
Returns the total conformal factor .
Definition: etoile.h:736
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Definition: tenseur.C:1186
double xa_barycenter_extr() const
Absolute coordinate X of the barycenter of the baryon density in the Kerr-Schild background metric or...
Lorene prototypes.
Definition: app_hor.h:67
Standard units of space, time and mass.
Base class for coordinate mappings.
Definition: map.h:688
Et_bin_bhns_extr star
Neutron star.
Definition: bin_bhns_extr.h:66
bool in_kerrschild() const
Returns true for the Kerr-Schild background metric, false for the conformally flat one...
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:840
double ya_barycenter_extr() const
in the Kerr-Schild background metric
double integrale() const
Computes the integral over all space of *this .
Definition: cmp_integ.C:58
const Tenseur & get_gam_euler() const
Returns the Lorentz factor between the fluid and Eulerian observers.
Definition: etoile.h:694
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
Active physical coordinates and mapping derivatives.
Definition: coord.h:90
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Definition: cmp.C:647
Coord ya
Absolute y coordinate.
Definition: map.h:749
Coord y
y coordinate centered on the grid
Definition: map.h:745
Coord x
x coordinate centered on the grid
Definition: map.h:744
double separ
Absolute orbital separation between two centers of BH and NS.
Definition: bin_bhns_extr.h:74
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:652
double * p_mass_b_extr
Baryon mass of the neutron star in the Kerr-Schild background metric or in the conformally flat one...
Definition: bin_bhns_extr.h:96
Coord z
z coordinate centered on the grid
Definition: map.h:746
const Tenseur & get_nbar() const
Returns the proper baryon density.
Definition: etoile.h:679
bool is_relativistic() const
Returns true for a relativistic star, false for a Newtonian one.
Definition: etoile.h:670
double mass_bh
Gravitational mass of BH.
Definition: bin_bhns_extr.h:77
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
double * p_ya_barycenter_extr
Absolute coordinate Y of the barycenter of the baryon density in the Kerr-Schild background metric...
Definition: bin_bhns_extr.h:91
double mass_b_extr() const
Baryon mass of the neutron star in the Kerr-Schild background metric or in the conformally flat...