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