LORENE
strot_dirac_diff_global.C
1 /*
2  * Methods for computing global quantities within the class Star_rot_Dirac_diff
3  *
4  * (see file star.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2005 Motoyuki Saijo
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
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  * $Header: /cvsroot/Lorene/C++/Source/Star/strot_dirac_diff_global.C,v 1.4 2016/12/05 16:18:15 j_novak Exp $
32  *
33  */
34 
35 
36 // C headers
37 #include <cmath>
38 
39 // Lorene headers
40 #include "star_rot_dirac_diff.h"
41 
42 
43  //---------------------//
44  // T/W //
45  //---------------------//
46 
47 namespace Lorene {
48 double Star_rot_Dirac_diff::tsw() const {
49 
50  if (p_tsw == 0x0) { // a new computation is required
51 
52  Vector phi_kill(mp, CON, mp.get_bvect_spher()) ;
53 
54  phi_kill.set(1).set_etat_zero() ;
55  phi_kill.set(2).set_etat_zero() ;
56  phi_kill.set(3) = 1. ;
57  phi_kill.set(3).std_spectral_base() ;
58  phi_kill.set(3).mult_rsint() ;
59 
60  Scalar j_source = contract(contract(gamma.cov(), 0, j_euler, 0),
61  0, phi_kill, 0) ;
62 
63  Scalar dens = sqrt( gamma.determinant() ) * j_source * omega_field ;
64 
65  dens.std_spectral_base() ;
66 
67  double tcin = 0.5 * dens.integrale() ;
68 
69  Scalar dens2 = sqrt( gamma.determinant() ) * gam_euler * ener ;
70 
71  dens2.std_spectral_base() ;
72 
73  double mass_p = dens2.integrale() ;
74 
75  p_tsw = new double( tcin / ( mass_p + tcin - mass_g() ) ) ;
76 
77  }
78 
79  return *p_tsw ;
80 
81  cout << "T/W : " << p_tsw << '\n' ;
82 
83 }
84 }
virtual double tsw() const
Ratio T/W.
Map & mp
Mapping associated with the star.
Definition: star.h:180
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: scalar.C:330
Metric gamma
3-metric
Definition: star.h:235
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Definition: map.h:795
Lorene prototypes.
Definition: app_hor.h:67
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
Tensor field of valence 1.
Definition: vector.h:188
Scalar gam_euler
Lorentz factor between the fluid and Eulerian observers.
Definition: star.h:204
Scalar ener
Total energy density in the fluid frame.
Definition: star.h:193
virtual double mass_g() const
Gravitational mass.
double * p_tsw
Ratio T/W.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
virtual const Scalar & determinant() const
Returns the determinant.
Definition: metric.C:395
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition: metric.C:283
Scalar & set(int)
Read/write access to a component.
Definition: vector.C:302
Vector j_euler
Momentum density 3-vector with respect to the Eulerian observer.