LORENE
et_bin_nsbh_axe.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_axe.C,v 1.6 2016/12/05 16:17:53 j_novak Exp $
27  * $Log: et_bin_nsbh_axe.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:58 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_axe.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_axe(double omega) 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  // Derivee_square
73  Cmp C_cmp (-pow(confpsi(), 4)/nnn()/nnn()*omega*omega) ;
74  C_cmp.std_base_scal() ;
75  double dC = C_cmp.dsdx()(0,0,0,0) ;
76 
77  // Derive single
78  Cmp B_cmp (2*pow(confpsi(), 4)/nnn()/nnn()*shift(1)*omega) ;
79  B_cmp.std_base_scal() ;
80  double dB = B_cmp.dsdx()(0,0,0,0) ;
81 
82  // Derive const
83  Cmp A_cmp = 1-pow(confpsi(), 4)/nnn()/nnn()*(shift(0)*shift(0) + shift(1)*shift(1) + shift(2)*shift(2)) ;
84  A_cmp.std_base_scal() ;
85  double dA = A_cmp.dsdx()(0,0,0,0) ;
86 
87  // coefficients de G
88  double A = A_cmp (0,0,0,0) ;
89  double B = B_cmp (0,0,0,0) ;
90  double C = C_cmp (0,0,0,0) ;
91 
92  // Les coefficients du polynome :
93  double a_coef = dC + 2*C*part_dx ;
94  double b_coef = dB + 2*C + 2*B*part_dx ;
95  double c_coef = dA + B + 2*A*part_dx;
96 
97  cout << a_coef << " " << b_coef << " " << c_coef << endl ;
98 
99  double determinant = b_coef*b_coef - 4*a_coef*c_coef ;
100 
101  if (determinant <0) {
102  cout << "No solution for Xabs found in Et_bin_nsbh_compute_axe !" << endl ;
103  abort() ;
104  }
105 
106  double sol_un = (-b_coef - sqrt(determinant))/2/a_coef ;
107  double sol_deux = (-b_coef + sqrt(determinant))/2/a_coef ;
108 
109  bool signe_un = (sol_un >0) ? true : false ;
110  bool signe_deux = (sol_deux >0) ? true : false ;
111 
112  double res ;
113 
114  if (signe_un == signe_deux) {
115  cout << "To many solutions in Et_bin_nsbh_compute_axe !" << endl ;
116  abort() ;
117  }
118  else {
119  res = (signe_un) ? sol_un : sol_deux ;
120  }
121 
122  return res ;
123 }
124 }
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
Tenseur loggam
Logarithm of the Lorentz factor between the fluid and the co-orbiting observer.
Definition: etoile.h:852