LORENE
strot_diff_cfc_global.C
1 /*
2  * Methods for computing global quantities within the class Star_rot_diff_CFC
3  *
4  * (see file star_rot_diff_cfc.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2025 Santiago Jaraba
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 // C headers
30 #include <cmath>
31 
32 // Lorene headers
33 #include "star_rot_diff_cfc.h"
34 
35 
36  //---------------------//
37  // T/W //
38  //---------------------//
39 
40 namespace Lorene {
41 double Star_rot_diff_CFC::tsw() const {
42 
43  if (p_tsw == 0x0) { // a new computation is required
44 
45  Vector phi_kill(mp, CON, mp.get_bvect_spher()) ;
46 
47  phi_kill.set(1).set_etat_zero() ;
48  phi_kill.set(2).set_etat_zero() ;
49  phi_kill.set(3) = 1. ;
50  phi_kill.set(3).std_spectral_base() ;
51  phi_kill.set(3).mult_rsint() ;
52 
53  Scalar j_source = contract(contract(gamma.cov(), 0, j_euler, 0),
54  0, phi_kill, 0) ;
55 
56  Scalar dens = omega_field * psi4*psi2 * j_source ;
57 
58  dens.std_spectral_base() ;
59 
60  double tcin = 0.5 * dens.integrale() ;
61 
62  Scalar dens2 = psi4*psi2 * gam_euler * ener ;
63 
64  dens2.std_spectral_base() ;
65 
66  double mass_p = dens2.integrale() ;
67 
68  p_tsw = new double( tcin / ( mass_p + tcin - mass_g() ) ) ;
69 
70  }
71 
72  return *p_tsw ;
73 
74 }
75 
76 }
Map & mp
Mapping associated with the star.
Definition: star.h:180
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:810
Lorene prototypes.
Definition: app_hor.h:67
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:399
double integrale() const
Computes the integral over all space of *this .
Definition: scalar_integ.C:67
Scalar psi4
Conformal factor .
Definition: star_rot_cfc.h:81
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
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition: metric.C:283
double * p_tsw
Ratio T/W.
Definition: star_rot_cfc.h:100
virtual double tsw() const
Ratio T/W.
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.
Definition: star_rot_cfc.h:75
virtual double mass_g() const
Gravitational mass.