LORENE
et_bin_global.C
1 /*
2  * Methods for computing global quantities within the class Etoile_bin
3  *
4  * (see file etoile.h for documentation)
5  */
6 
7 /*
8  * Copyright (c) 2000-2001 Eric Gourgoulhon
9  *
10  * This file is part of LORENE.
11  *
12  * LORENE is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
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 /*
32  * $Id: et_bin_global.C,v 1.13 2016/12/05 16:17:53 j_novak Exp $
33  * $Log: et_bin_global.C,v $
34  * Revision 1.13 2016/12/05 16:17:53 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.12 2014/10/13 08:52:55 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.11 2004/12/30 17:24:42 f_limousin
41  * Remove #include "et_bin_ncp.h"
42  *
43  * Revision 1.10 2004/12/30 17:22:25 f_limousin
44  * Remove all functions belonging to the class Et_bin_ncp
45  *
46  * Revision 1.9 2003/06/20 14:02:44 f_limousin
47  * pow(gamma(), 1./2.) is changed to pow(a_car(), 3./2.)
48  *
49  * Revision 1.8 2003/02/06 17:25:56 f_limousin
50  * Add global quantities for the class et_bin_ncp
51  *
52  * Revision 1.7 2003/01/17 13:32:27 f_limousin
53  * Add comments
54  *
55  * Revision 1.6 2002/12/17 09:48:21 k_taniguchi
56  * Suppress every desaliasing multiplications using "%".
57  *
58  * Revision 1.5 2002/12/16 17:32:47 k_taniguchi
59  * Suppress the things I did in the previous version.
60  *
61  * Revision 1.4 2002/12/16 16:59:39 k_taniguchi
62  * Set some Cmp to the state of "std_base_scal()".
63  *
64  * Revision 1.3 2002/12/16 14:36:39 k_taniguchi
65  * Introduce a new Cmp for the calculation of gravitational mass.
66  *
67  * Revision 1.2 2002/12/10 15:45:25 k_taniguchi
68  * Change the multiplication "*" to "%".
69  *
70  * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
71  * LORENE
72  *
73  * Revision 2.4 2000/07/06 10:02:22 eric
74  * *** empty log message ***
75  *
76  * Revision 2.3 2000/07/06 09:40:37 eric
77  * Ajout de la fonction xa_barycenter().
78  *
79  * Revision 2.2 2000/02/02 09:23:12 eric
80  * 1ere version operationnelle dans le cas relativiste.
81  *
82  * Revision 2.1 2000/02/01 16:00:13 eric
83  * Le calcul de mass_b est implemente dans le cas relativiste.
84  *
85  * Revision 2.0 2000/01/31 15:57:21 eric
86  * *** empty log message ***
87  *
88  *
89  * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_global.C,v 1.13 2016/12/05 16:17:53 j_novak Exp $
90  *
91  */
92 
93 // Headers C
94 
95 // Headers Lorene
96 #include "etoile.h"
97 
98  //--------------------------//
99  // Baryon mass //
100  //--------------------------//
101 
102 namespace Lorene {
103 double Etoile_bin::mass_b() const {
104 
105  if (p_mass_b == 0x0) { // a new computation is required
106 
107  if (relativistic) {
108 
109  Cmp sqrt_acar = sqrt(a_car()) ;
110  sqrt_acar.std_base_scal() ;
111 
112  // See Eq (69) from Gourgoulhon et al. (2001)
113  // Cmp dens = a_car() % sqrt_acar % gam_euler() % nbar() ;
114 
115  Cmp dens = a_car() * sqrt( a_car() ) * gam_euler() * nbar() ;
116 
117  dens.std_base_scal() ;
118 
119  p_mass_b = new double( dens.integrale() ) ;
120 
121  }
122  else{
123  assert(nbar.get_etat() == ETATQCQ) ;
124 
125  p_mass_b = new double( nbar().integrale() ) ;
126 
127  }
128 
129  }
130 
131  return *p_mass_b ;
132 
133 }
134 
135 
136  //----------------------------//
137  // Gravitational mass //
138  //----------------------------//
139 
140 double Etoile_bin::mass_g() const {
141 
142  if (p_mass_g == 0x0) { // a new computation is required
143 
144  if (relativistic) {
145 
146 
147  Cmp sqrt_acar = sqrt(a_car()) ;
148  sqrt_acar.std_base_scal() ;
149  Cmp dens = a_car() * sqrt( a_car() ) * nnn()
150  * ( ener_euler() + s_euler() ) ;
151 
152  dens.std_base_scal() ;
153 
154  p_mass_g = new double( dens.integrale() ) ;
155 
156  }
157  else{
158  p_mass_g = new double( mass_b() ) ; // in the Newtonian case
159  // M_g = M_b
160  }
161  }
162 
163  return *p_mass_g ;
164 
165 }
166 
167 
168 
169  //----------------------------------//
170  // X coordinate of the barycenter //
171  //----------------------------------//
172 
174 
175  if (p_xa_barycenter == 0x0) { // a new computation is required
176 
177  Cmp xxa(mp) ;
178  xxa = mp.xa ; // Absolute X coordinate
179  xxa.std_base_scal() ;
180 
181  Cmp dens = a_car() * sqrt( a_car() ) * gam_euler() * nbar() * xxa ;
182 
183  dens.std_base_scal() ;
184 
185  p_xa_barycenter = new double( dens.integrale() / mass_b() ) ;
186 
187  }
188 
189  return *p_xa_barycenter ;
190 
191 }
192 
193 
194 
195 }
Coord xa
Absolute x coordinate.
Definition: map.h:742
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
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 s_euler
Trace of the stress tensor in the Eulerian frame.
Definition: etoile.h:471
virtual double mass_g() const
Gravitational mass.
virtual double xa_barycenter() const
Absolute coordinate X of the barycenter of the baryon density, defined according to the formula wher...
Tenseur nbar
Baryon density in the fluid frame.
Definition: etoile.h:462
Tenseur gam_euler
Lorentz factor between the fluid and Eulerian observers.
Definition: etoile.h:474
Map & mp
Mapping associated with the star.
Definition: etoile.h:432
double integrale() const
Computes the integral over all space of *this .
Definition: cmp_integ.C:58
int get_etat() const
Returns the logical state.
Definition: tenseur.h:710
double * p_mass_g
Gravitational mass.
Definition: etoile.h:551
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Definition: cmp.C:647
Tenseur a_car
Total conformal factor .
Definition: etoile.h:518
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one. ...
Definition: etoile.h:440
double * p_xa_barycenter
Absolute coordinate X of the barycenter of the baryon density.
Definition: etoile.h:1009
Tenseur ener_euler
Total energy density in the Eulerian frame.
Definition: etoile.h:468
virtual double mass_b() const
Baryon mass.
double * p_mass_b
Baryon mass.
Definition: etoile.h:550