LORENE
star_bin_global.C
1 /*
2  * Methods for computing global quantities within the class Star_bin
3  *
4  * (see file star.h for documentation)
5  */
6 
7 /*
8  * Copyright (c) 2004 Francois Limousin
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 char star_bin_global_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global.C,v 1.6 2014/10/13 08:53:38 j_novak Exp $" ;
30 
31 /*
32  * $Id: star_bin_global.C,v 1.6 2014/10/13 08:53:38 j_novak Exp $
33  * $Log: star_bin_global.C,v $
34  * Revision 1.6 2014/10/13 08:53:38 j_novak
35  * Lorene classes and functions now belong to the namespace Lorene.
36  *
37  * Revision 1.5 2005/09/13 19:38:31 f_limousin
38  * Reintroduction of the resolution of the equations in cartesian coordinates.
39  *
40  * Revision 1.4 2005/02/17 17:33:25 f_limousin
41  * Change the name of some quantities to be consistent with other classes
42  * (for instance nnn is changed to nn, shift to beta, beta to lnq...)
43  *
44  * Revision 1.3 2004/02/27 09:54:24 f_limousin
45  * Generalisation of the formulas for mass_b and mass_g for non
46  * conformally flat metrics.
47  *
48  * Revision 1.2 2004/01/20 15:18:17 f_limousin
49  * First version
50  *
51  *
52  * $Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global.C,v 1.6 2014/10/13 08:53:38 j_novak Exp $
53  *
54  */
55 
56 // Headers C
57 
58 // Headers Lorene
59 #include "star.h"
60 #include "utilitaires.h"
61 
62  //--------------------------//
63  // Baryon mass //
64  //--------------------------//
65 
66 namespace Lorene {
67 double Star_bin::mass_b() const {
68 
69  if (p_mass_b == 0x0) { // a new computation is required
70 
71  Scalar det_gamma = gamma.determinant() ;
72 
73  Scalar dens = sqrt(det_gamma) * gam_euler * nbar ;
74 
75 // Scalar dens = psi4 * sqrt(psi4) * gam_euler * nbar ;
76 
77  dens.std_spectral_base() ;
78 
79  p_mass_b = new double( dens.integrale() ) ;
80 
81  }
82 
83  return *p_mass_b ;
84 
85 }
86 
87 
88 
89  //----------------------------//
90  // Gravitational mass //
91  //----------------------------//
92 
93 double Star_bin::mass_g() const {
94 
95  if (p_mass_g == 0x0) { // a new computation is required
96 
97  Scalar det_gamma = gamma.determinant() ;
98 
99  Scalar dens = sqrt(det_gamma) * nn
100  * ( ener_euler + s_euler ) ;
101 
102  dens.std_spectral_base() ;
103 
104  p_mass_g = new double( dens.integrale() ) ;
105 
106  }
107 
108  return *p_mass_g ;
109 
110 }
111 
112 
113  //----------------------------------//
114  // X coordinate of the barycenter //
115  //----------------------------------//
116 
117 
118 double Star_bin::xa_barycenter() const {
119 
120  if (p_xa_barycenter == 0x0) { // a new computation is required
121 
122  Scalar xxa(mp) ;
123  xxa = mp.xa ; // Absolute X coordinate
124  xxa.std_spectral_base() ;
125 
126  Scalar det_gamma = gamma.determinant() ;
127 
128  Scalar dens = sqrt(det_gamma) * gam_euler * nbar * xxa ;
129 
130  int nzone = mp.get_mg()->get_nzone() ;
131  dens.annule_domain(nzone - 1) ;
132 
133  dens.std_spectral_base() ;
134 
135  p_xa_barycenter = new double( dens.integrale() / mass_b() ) ;
136 
137  }
138 
139  return *p_xa_barycenter ;
140 
141 }
142 
143 }
Coord xa
Absolute x coordinate.
Definition: map.h:730
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Definition: tensor.C:666
double * p_mass_b
Baryon mass.
Definition: star.h:268
Map & mp
Mapping associated with the star.
Definition: star.h:180
virtual double mass_b() const
Baryon mass.
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:220
Metric gamma
3-metric
Definition: star.h:235
Lorene prototypes.
Definition: app_hor.h:64
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:387
double integrale() const
Computes the integral over all space of *this .
Definition: scalar_integ.C:61
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Definition: scalar.C:784
Scalar nbar
Baryon density in the fluid frame.
Definition: star.h:192
double * p_xa_barycenter
Absolute coordinate X of the barycenter of the baryon density.
Definition: star.h:687
Scalar s_euler
Trace of the stress scalar in the Eulerian frame.
Definition: star.h:201
Scalar gam_euler
Lorentz factor between the fluid and Eulerian observers.
Definition: star.h:204
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:448
virtual const Scalar & determinant() const
Returns the determinant.
Definition: metric.C:392
Scalar nn
Lapse function N .
Definition: star.h:225
virtual double mass_g() const
Gravitational mass.
Scalar ener_euler
Total energy density in the Eulerian frame.
Definition: star.h:198
double * p_mass_g
Gravitational mass.
Definition: star.h:269
virtual double xa_barycenter() const
Absolute coordinate X of the barycenter of the baryon density,.