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 char star_bin_global_xcts_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global_xcts.C,v 1.2 2014/10/13 08:53:38 j_novak Exp $" ;
27 
28 /*
29  * $Id: star_bin_global_xcts.C,v 1.2 2014/10/13 08:53:38 j_novak Exp $
30  * $Log: star_bin_global_xcts.C,v $
31  * Revision 1.2 2014/10/13 08:53:38 j_novak
32  * Lorene classes and functions now belong to the namespace Lorene.
33  *
34  * Revision 1.1 2010/05/04 07:51:05 m_bejger
35  * Initial version
36  *
37  * $Header: /cvsroot/Lorene/C++/Source/Star/star_bin_global_xcts.C,v 1.2 2014/10/13 08:53:38 j_novak Exp $
38  *
39  */
40 
41 // Headers Lorene
42 #include "star.h"
43 #include "utilitaires.h"
44 
45  //--------------------------//
46  // Baryon mass //
47  //--------------------------//
48 
49 namespace Lorene {
50 double Star_bin_xcts::mass_b() const {
51 
52  if (p_mass_b == 0x0) { // a new computation is required
53 
54  Scalar det_gamma = gamma.determinant() ;
55 
56  Scalar dens = sqrt(det_gamma) * gam_euler * nbar ;
57 
58  dens.std_spectral_base() ;
59 
60  p_mass_b = new double( dens.integrale() ) ;
61 
62  }
63 
64  return *p_mass_b ;
65 
66 }
67 
68 
69 
70  //----------------------------//
71  // Gravitational mass //
72  //----------------------------//
73 
74 double Star_bin_xcts::mass_g() const {
75 
76  if (p_mass_g == 0x0) { // a new computation is required
77 
78  Scalar det_gamma = gamma.determinant() ;
79 
80  Scalar dens = sqrt(det_gamma) * nn
81  * ( ener_euler + s_euler ) ;
82 
83  dens.std_spectral_base() ;
84 
85  p_mass_g = new double( dens.integrale() ) ;
86 
87  }
88 
89  return *p_mass_g ;
90 
91 }
92 
93 
94  //----------------------------------//
95  // X coordinate of the barycenter //
96  //----------------------------------//
97 
98 
100 
101  if (p_xa_barycenter == 0x0) { // a new computation is required
102 
103  Scalar xxa(mp) ;
104  xxa = mp.xa ; // Absolute X coordinate
105  xxa.std_spectral_base() ;
106 
107  Scalar det_gamma = gamma.determinant() ;
108 
109  Scalar dens = sqrt(det_gamma) * gam_euler * nbar * xxa ;
110 
111  int nzone = mp.get_mg()->get_nzone() ;
112  dens.annule_domain(nzone - 1) ;
113 
114  dens.std_spectral_base() ;
115 
116  p_xa_barycenter = new double( dens.integrale() / mass_b() ) ;
117 
118  }
119 
120  return *p_xa_barycenter ;
121 
122 }
123 }
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
Coord xa
Absolute x coordinate.
Definition: map.h:730
virtual const Scalar & determinant() const
Returns the determinant.
Definition: metric.C:392
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:448
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
virtual double xa_barycenter() const
Absolute coordinate X of the barycenter of the baryon density,.
virtual double mass_g() const
Gravitational mass.
virtual double mass_b() const
Baryon mass.
double * p_xa_barycenter
Absolute coordinate X of the barycenter of the baryon density.
Definition: star.h:1240
Scalar nn
Lapse function N .
Definition: star.h:225
double * p_mass_b
Baryon mass.
Definition: star.h:268
Scalar nbar
Baryon density in the fluid frame.
Definition: star.h:192
Scalar ener_euler
Total energy density in the Eulerian frame.
Definition: star.h:198
Scalar gam_euler
Lorentz factor between the fluid and Eulerian observers.
Definition: star.h:204
Scalar s_euler
Trace of the stress scalar in the Eulerian frame.
Definition: star.h:201
double * p_mass_g
Gravitational mass.
Definition: star.h:269
Metric gamma
3-metric
Definition: star.h:235
Map & mp
Mapping associated with the star.
Definition: star.h:180
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:220
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Definition: tensor.C:666
Lorene prototypes.
Definition: app_hor.h:64