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 
30 
31 /*
32  * $Id: star_bin_global.C,v 1.7 2016/12/05 16:18:14 j_novak Exp $
33  * $Log: star_bin_global.C,v $
34  * Revision 1.7 2016/12/05 16:18:14 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.6 2014/10/13 08:53:38 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.5 2005/09/13 19:38:31 f_limousin
41  * Reintroduction of the resolution of the equations in cartesian coordinates.
42  *
43  * Revision 1.4 2005/02/17 17:33:25 f_limousin
44  * Change the name of some quantities to be consistent with other classes
45  * (for instance nnn is changed to nn, shift to beta, beta to lnq...)
46  *
47  * Revision 1.3 2004/02/27 09:54:24 f_limousin
48  * Generalisation of the formulas for mass_b and mass_g for non
49  * conformally flat metrics.
50  *
51  * Revision 1.2 2004/01/20 15:18:17 f_limousin
52  * First version
53  *
54  *
55  * $Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global.C,v 1.7 2016/12/05 16:18:14 j_novak Exp $
56  *
57  */
58 
59 // Headers C
60 
61 // Headers Lorene
62 #include "star.h"
63 #include "utilitaires.h"
64 
65  //--------------------------//
66  // Baryon mass //
67  //--------------------------//
68 
69 namespace Lorene {
70 double Star_bin::mass_b() const {
71 
72  if (p_mass_b == 0x0) { // a new computation is required
73 
74  Scalar det_gamma = gamma.determinant() ;
75 
76  Scalar dens = sqrt(det_gamma) * gam_euler * nbar ;
77 
78 // Scalar dens = psi4 * sqrt(psi4) * gam_euler * nbar ;
79 
80  dens.std_spectral_base() ;
81 
82  p_mass_b = new double( dens.integrale() ) ;
83 
84  }
85 
86  return *p_mass_b ;
87 
88 }
89 
90 
91 
92  //----------------------------//
93  // Gravitational mass //
94  //----------------------------//
95 
96 double Star_bin::mass_g() const {
97 
98  if (p_mass_g == 0x0) { // a new computation is required
99 
100  Scalar det_gamma = gamma.determinant() ;
101 
102  Scalar dens = sqrt(det_gamma) * nn
103  * ( ener_euler + s_euler ) ;
104 
105  dens.std_spectral_base() ;
106 
107  p_mass_g = new double( dens.integrale() ) ;
108 
109  }
110 
111  return *p_mass_g ;
112 
113 }
114 
115 
116  //----------------------------------//
117  // X coordinate of the barycenter //
118  //----------------------------------//
119 
120 
121 double Star_bin::xa_barycenter() const {
122 
123  if (p_xa_barycenter == 0x0) { // a new computation is required
124 
125  Scalar xxa(mp) ;
126  xxa = mp.xa ; // Absolute X coordinate
127  xxa.std_spectral_base() ;
128 
129  Scalar det_gamma = gamma.determinant() ;
130 
131  Scalar dens = sqrt(det_gamma) * gam_euler * nbar * xxa ;
132 
133  int nzone = mp.get_mg()->get_nzone() ;
134  dens.annule_domain(nzone - 1) ;
135 
136  dens.std_spectral_base() ;
137 
138  p_xa_barycenter = new double( dens.integrale() / mass_b() ) ;
139 
140  }
141 
142  return *p_xa_barycenter ;
143 
144 }
145 
146 }
Coord xa
Absolute x coordinate.
Definition: map.h:748
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Definition: tensor.C:675
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:223
Metric gamma
3-metric
Definition: star.h:235
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
double integrale() const
Computes the integral over all space of *this .
Definition: scalar_integ.C:64
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Definition: scalar.C:790
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:465
virtual const Scalar & determinant() const
Returns the determinant.
Definition: metric.C:395
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,.