LORENE
star_bin_global_xcts.C
1 /*
2  * Methods for computing global quantities within the class Star_bin_xcts
3  * (see file star.h for documentation)
4  */
5 
6 /*
7  * Copyright (c) 2010 Michal Bejger
8  *
9  * This file is part of LORENE.
10  *
11  * LORENE is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2
13  * as published by the Free Software Foundation.
14  *
15  * LORENE is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with LORENE; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */
25 
26 
27 
28 /*
29  * $Id: star_bin_global_xcts.C,v 1.3 2016/12/05 16:18:14 j_novak Exp $
30  * $Log: star_bin_global_xcts.C,v $
31  * Revision 1.3 2016/12/05 16:18:14 j_novak
32  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
33  *
34  * Revision 1.2 2014/10/13 08:53:38 j_novak
35  * Lorene classes and functions now belong to the namespace Lorene.
36  *
37  * Revision 1.1 2010/05/04 07:51:05 m_bejger
38  * Initial version
39  *
40  * $Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global_xcts.C,v 1.3 2016/12/05 16:18:14 j_novak Exp $
41  *
42  */
43 
44 // Headers Lorene
45 #include "star.h"
46 #include "utilitaires.h"
47 
48  //--------------------------//
49  // Baryon mass //
50  //--------------------------//
51 
52 namespace Lorene {
53 double Star_bin_xcts::mass_b() const {
54 
55  if (p_mass_b == 0x0) { // a new computation is required
56 
57  Scalar det_gamma = gamma.determinant() ;
58 
59  Scalar dens = sqrt(det_gamma) * gam_euler * nbar ;
60 
61  dens.std_spectral_base() ;
62 
63  p_mass_b = new double( dens.integrale() ) ;
64 
65  }
66 
67  return *p_mass_b ;
68 
69 }
70 
71 
72 
73  //----------------------------//
74  // Gravitational mass //
75  //----------------------------//
76 
77 double Star_bin_xcts::mass_g() const {
78 
79  if (p_mass_g == 0x0) { // a new computation is required
80 
81  Scalar det_gamma = gamma.determinant() ;
82 
83  Scalar dens = sqrt(det_gamma) * nn
84  * ( ener_euler + s_euler ) ;
85 
86  dens.std_spectral_base() ;
87 
88  p_mass_g = new double( dens.integrale() ) ;
89 
90  }
91 
92  return *p_mass_g ;
93 
94 }
95 
96 
97  //----------------------------------//
98  // X coordinate of the barycenter //
99  //----------------------------------//
100 
101 
103 
104  if (p_xa_barycenter == 0x0) { // a new computation is required
105 
106  Scalar xxa(mp) ;
107  xxa = mp.xa ; // Absolute X coordinate
108  xxa.std_spectral_base() ;
109 
110  Scalar det_gamma = gamma.determinant() ;
111 
112  Scalar dens = sqrt(det_gamma) * gam_euler * nbar * xxa ;
113 
114  int nzone = mp.get_mg()->get_nzone() ;
115  dens.annule_domain(nzone - 1) ;
116 
117  dens.std_spectral_base() ;
118 
119  p_xa_barycenter = new double( dens.integrale() / mass_b() ) ;
120 
121  }
122 
123  return *p_xa_barycenter ;
124 
125 }
126 }
Coord xa
Absolute x coordinate.
Definition: map.h:742
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
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:777
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
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
virtual double mass_g() const
Gravitational mass.
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
double * p_xa_barycenter
Absolute coordinate X of the barycenter of the baryon density.
Definition: star.h:1240
virtual double xa_barycenter() const
Absolute coordinate X of the barycenter of the baryon density,.
virtual double mass_b() const
Baryon 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