LORENE
bin_bhns_rotaxis.C
1 /*
2  * Methods of class Bin_bhns to compute the location of the rotation axis
3  *
4  * (see file bin_bhns.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2005-2006 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_rotaxis_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_bhns/bin_bhns_rotaxis.C,v 1.3 2014/10/13 08:52:41 j_novak Exp $" ;
29 
30 /*
31  * $Id: bin_bhns_rotaxis.C,v 1.3 2014/10/13 08:52:41 j_novak Exp $
32  * $Log: bin_bhns_rotaxis.C,v $
33  * Revision 1.3 2014/10/13 08:52:41 j_novak
34  * Lorene classes and functions now belong to the namespace Lorene.
35  *
36  * Revision 1.2 2014/10/06 15:13:00 j_novak
37  * Modified #include directives to use c++ syntax.
38  *
39  * Revision 1.1 2007/06/22 01:10:47 k_taniguchi
40  * *** empty log message ***
41  *
42  *
43  * $Header: /cvsroot/Lorene/C++/Source/Bin_bhns/bin_bhns_rotaxis.C,v 1.3 2014/10/13 08:52:41 j_novak Exp $
44  *
45  */
46 
47 // C++ headers
48 //#include <>
49 
50 // C headers
51 #include <cmath>
52 
53 // Lorene headers
54 #include "bin_bhns.h"
55 #include "unites.h"
56 
57 namespace Lorene {
58 void Bin_bhns::rotation_axis_x(double rot_exp_x) {
59 
60  using namespace Unites ;
61 
62  double momunit = (hole.get_mass_bh()+star.mass_g_bhns())*omega*separ ;
63 
64  double error_y = line_mom_bhns()(1) / momunit ;
65 
66  if (error_y >= 1.) {
67  cout << "Bin_bhns::rotation_axis:" << endl ;
68  cout << " !!! WARNING : error_y is larger than +1 !!!" << endl ;
69  error_y *= 0.1 ;
70  }
71 
72  // Sets X_BH and X_NS
73  // ------------------
74 
75  double gg = pow( (2.-error_y)/(2.-2.*error_y), rot_exp_x) ;
76 
77  double xbh_old = hole.get_mp().get_ori_x() ;
78 
79  cout << "Bin_bhns::rotation_axis:" << endl ;
80  cout << " error_y : " << error_y << " gg : " << gg << endl ;
81  cout << " old X_BH : " << hole.get_mp().get_ori_x() / km << " [km]"
82  << " old X_NS : " << star.get_mp().get_ori_x() / km << " [km]"
83  << endl ;
84 
85  double xbh_new = xbh_old * gg ;
86  double xns_new = xbh_new + separ ;
87 
88  cout << " new X_BH : " << xbh_new / km << " [km]"
89  << " new X_NS : " << xns_new / km << " [km]"
90  << endl ;
91 
92  double yns_old = star.get_mp().get_ori_y() ;
93 
94  (hole.set_mp()).set_ori(xbh_new, 0., 0.) ;
95  (star.set_mp()).set_ori(xns_new, yns_old, 0.) ;
96 
97  set_x_rot() = 0. ;
98 
99 }
100 
101 void Bin_bhns::rotation_axis_y(double thres_rot, double rot_exp_y,
102  double fact) {
103 
104  using namespace Unites ;
105 
106  double momunit = (hole.get_mass_bh()+star.mass_g_bhns())*omega*separ ;
107 
108  double error_x = line_mom_bhns()(0) / momunit ;
109 
110  if (error_x <= -1.) {
111  cout << "Bin_bhns::rotation_axis:" << endl ;
112  cout << " !!! WARNING : error_x is smaller than -1 !!!" << endl ;
113  error_x *= 0.1 ;
114  }
115 
116  // Sets Y_NS
117  // ---------
118 
119  double ff = pow( (2.+error_x)/(2.+2.*error_x), rot_exp_y) ;
120 
121  double yns_old = star.get_mp().get_ori_y() ;
122 
123  if ( fabs(error_x) < thres_rot ) {
124  cout << "Bin_bhns::rotation_axis:" << endl ;
125  cout << " ff is set to 1 because error_x is smaller than" << endl ;
126  cout << " the threshold value (" << thres_rot << ")" << endl ;
127 
128  ff = 1. ;
129  }
130 
131  cout << "Local center of mass of NS:" << endl ;
132  cout << " X_CM : " << xa_barycenter() / km << " [km]"
133  << " Y_CM : " << ya_barycenter() / km << " [km]" << endl ;
134 
135  cout << "Bin_bhns::rotation_axis:" << endl ;
136  cout << " error_x : " << error_x << " ff : " << ff << endl ;
137  cout << " old Y_BH : " << hole.get_mp().get_ori_y() / km << " [km]"
138  << " old Y_NS : " << star.get_mp().get_ori_y() / km << " [km]"
139  << endl ;
140 
141  double aa = fact * separ ;
142  double yns_new = yns_old + aa * (1. - ff) ;
143 
144  cout << " new Y_BH : " << 0. / km << " [km]"
145  << " new Y_NS : " << yns_new / km << " [km]"
146  << endl ;
147 
148  double xbh_old = hole.get_mp().get_ori_x() ;
149  double xns_old = star.get_mp().get_ori_x() ;
150 
151  (hole.set_mp()).set_ori(xbh_old, 0., 0.) ;
152  (star.set_mp()).set_ori(xns_old, yns_new, 0.) ;
153 
154  set_y_rot() = 0. ;
155 
156 }
157 }
double get_mass_bh() const
Returns the gravitational mass of BH [{ m_unit}].
Definition: blackhole.h:221
Hole_bhns hole
Black hole.
Definition: bin_bhns.h:72
const Tbl & line_mom_bhns() const
Total linear momentum.
double ya_barycenter() const
Absolute coordinate Y of the barycenter of the baryon density.
double & set_x_rot()
Sets the absolute coordinate X of the rotation axis [{ r_unit}].
Definition: bin_bhns.h:215
double get_ori_y() const
Returns the y coordinate of the origin.
Definition: map.h:770
Lorene prototypes.
Definition: app_hor.h:64
Standard units of space, time and mass.
double xa_barycenter() const
Absolute coordinate X of the barycenter of the baryon density.
double get_ori_x() const
Returns the x coordinate of the origin.
Definition: map.h:768
const Map & get_mp() const
Returns the mapping.
Definition: star.h:355
double separ
Absolute orbital separation between two centers of BH and NS.
Definition: bin_bhns.h:83
double omega
Angular velocity with respect to an asymptotically inertial observer.
Definition: bin_bhns.h:80
Map & set_mp()
Read/write of the mapping.
Definition: blackhole.h:204
Star_bhns star
Neutron star.
Definition: bin_bhns.h:75
const Map & get_mp() const
Returns the mapping.
Definition: blackhole.h:213
void rotation_axis_x(double rot_exp_x)
Computes the position of the rotation axis X.
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:348
double & set_y_rot()
Sets the absolute coordinate Y of the rotation axis [{ r_unit}].
Definition: bin_bhns.h:218
void rotation_axis_y(double thres_rot, double rot_exp_y, double fact)
Computes the position of the rotation axis Y.
Map & set_mp()
Read/write of the mapping.
Definition: star.h:322