LORENE
et_bin_nsbh_angul.C
1 /*
2  * Copyright (c) 2005 Philippe Grandclément
3  *
4  * This file is part of LORENE.
5  *
6  * LORENE is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * LORENE is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with LORENE; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 
23 
24 
25 /*
26  * $Id: et_bin_nsbh_angul.C,v 1.6 2016/12/05 16:17:53 j_novak Exp $
27  * $Log: et_bin_nsbh_angul.C,v $
28  * Revision 1.6 2016/12/05 16:17:53 j_novak
29  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
30  *
31  * Revision 1.5 2014/10/13 08:52:56 j_novak
32  * Lorene classes and functions now belong to the namespace Lorene.
33  *
34  * Revision 1.4 2014/10/06 15:13:08 j_novak
35  * Modified #include directives to use c++ syntax.
36  *
37  * Revision 1.3 2005/08/31 09:53:19 m_saijo
38  * Delete unnecessary words around headers
39  *
40  * Revision 1.2 2005/08/31 09:13:45 p_grandclement
41  * add math.h
42  *
43  * Revision 1.1 2005/08/29 15:10:16 p_grandclement
44  * Addition of things needed :
45  * 1) For BBH with different masses
46  * 2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
47  * WORKING YET !!!
48  *
49  *
50  * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_nsbh_angul.C,v 1.6 2016/12/05 16:17:53 j_novak Exp $
51  *
52  */
53 
54 // C Headers
55 #include <cmath>
56 
57 // Headers Lorene
58 #include "et_bin_nsbh.h"
59 #include "graphique.h"
60 
61 namespace Lorene {
62 double Et_bin_nsbh::compute_angul() const {
63 
64  // On récupère les trucs qui vont servir :
65  Cmp dx_mu (nnn().dsdx() / nnn());
66  Cmp dx_loggam (loggam().dsdx()) ;
67  double part_dx = dx_mu(0,0,0,0) + dx_loggam(0,0,0,0) ;
68 
69  Cmp xabs (mp) ;
70  xabs = mp.xa ;
71 
72  Cmp yabs (mp) ;
73  yabs = mp.ya ;
74 
75  // Derivee_square
76  Cmp G_square_cmp (-pow(confpsi(), 4)/nnn()/nnn()*(xabs*xabs+yabs*yabs)) ;
77  G_square_cmp.std_base_scal() ;
78  double dG_square = G_square_cmp.dsdx()(0,0,0,0) ;
79 
80  // Derive single
81  Cmp G_single_cmp (-2*pow(confpsi(), 4)/nnn()/nnn()*(shift(1)*xabs-shift(0)*yabs)) ;
82  G_single_cmp.std_base_scal() ;
83  double dG_single = G_single_cmp.dsdx()(0,0,0,0) ;
84 
85  // Derive const
86  Cmp G_const_cmp = 1-pow(confpsi(), 4)/nnn()/nnn()*(shift(0)*shift(0) + shift(1)*shift(1) + shift(2)*shift(2)) ;
87  G_const_cmp.std_base_scal() ;
88  double dG_const = G_const_cmp.dsdx()(0,0,0,0) ;
89 
90  // coefficients de G
91  double G_square = G_square_cmp (0,0,0,0) ;
92  double G_single = G_single_cmp (0,0,0,0) ;
93  double G_const = G_const_cmp (0,0,0,0) ;
94 
95  // Les coefficients du polynome :
96  double a_coef = dG_square + 2*G_square*part_dx ;
97  double b_coef = dG_single + 2*G_single*part_dx ;
98  double c_coef = dG_const + 2*G_const *part_dx;
99 
100  double determinant = b_coef*b_coef - 4*a_coef*c_coef ;
101 
102  bool soluce = true ;
103  double res ;
104 
105  if (determinant <0) {
106  soluce = false ;
107  }
108 
109  else {
110  double sol_un = (-b_coef - sqrt(determinant))/2/a_coef ;
111  double sol_deux = (-b_coef + sqrt(determinant))/2/a_coef ;
112 
113  bool signe_un = (sol_un >0) ? true : false ;
114  bool signe_deux = (sol_deux >0) ? true : false ;
115 
116 
117  if (signe_un == signe_deux) {
118  soluce = false ;
119  }
120  else {
121  res = (signe_un) ? sol_un : sol_deux ;
122  }
123 }
124 
125  if (soluce == false)
126  return 0 ;
127  else
128  return res ;
129 }
130 }
Coord xa
Absolute x coordinate.
Definition: map.h:748
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
Lorene prototypes.
Definition: app_hor.h:67
Tenseur nnn
Total lapse function.
Definition: etoile.h:512
Tenseur shift
Total shift vector.
Definition: etoile.h:515
Tenseur confpsi
Total conformal factor $$.
Definition: et_bin_nsbh.h:101
Map & mp
Mapping associated with the star.
Definition: etoile.h:432
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
Coord ya
Absolute y coordinate.
Definition: map.h:749
Tenseur loggam
Logarithm of the Lorentz factor between the fluid and the co-orbiting observer.
Definition: etoile.h:852