LORENE
star_bin_hydro_xcts.C
1/*
2 * Methods of the class Star_bin_xcts for computing hydro quantities
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_hydro_xcts.C,v 1.4 2016/12/05 16:18:14 j_novak Exp $
30 * $Log: star_bin_hydro_xcts.C,v $
31 * Revision 1.4 2016/12/05 16:18:14 j_novak
32 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
33 *
34 * Revision 1.3 2014/10/13 08:53:38 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.2 2010/12/09 10:43:53 m_bejger
38 * Small changes, annule --> annule_domain
39 *
40 * Revision 1.1 2010/05/04 07:51:05 m_bejger
41 * Initial version
42 *
43 * $Header: /cvsroot/Lorene/C++/Source/Star/star_bin_hydro_xcts.C,v 1.4 2016/12/05 16:18:14 j_novak Exp $
44 *
45 */
46
47// Headers Lorene
48#include "star.h"
49#include "utilitaires.h"
50
51namespace Lorene {
53
54 int nzm1 = mp.get_mg()->get_nzone() - 1 ;
55
56 Sym_tensor gamma_cov (gamma.cov()) ;
57 Sym_tensor gamma_con (gamma.con()) ;
58
59 gamma_cov.change_triad(mp.get_bvect_cart()) ;
60 gamma_con.change_triad(mp.get_bvect_cart()) ;
61
62 //----------------------------------
63 // Specific relativistic enthalpy ---> hhh
64 //----------------------------------
65
66 Scalar hhh = exp(ent) ; // = 1 at the Newtonian limit
67 hhh.std_spectral_base() ;
68
69 //---------------------------------------------------
70 // Lorentz factor between the co-orbiting
71 // observer and the Eulerian one
72 // Eqs. 23 and 24 from Gourgoulhon et al. (2001)
73 //---------------------------------------------------
74
75 Scalar gam0 = 1 / sqrt( 1 - contract(gamma_cov, 0, 1, bsn * bsn, 0, 1)) ;
76 gam0.std_spectral_base() ;
77
78 //------------------------------------------
79 // Lorentz factor and 3-velocity of the fluid
80 // with respect to the Eulerian observer
81 //------------------------------------------
82
83 if (irrotational) {
84
85 // See Eq. 32 from Gourgoulhon et al. (2001)
86 gam_euler = sqrt( 1 + contract(gamma_con, 0, 1, d_psi * d_psi, 0, 1)
87 / (hhh%hhh) ) ;
88 gam_euler.std_spectral_base() ;
89
90 u_euler = contract(gamma_con, 0, d_psi, 0)
91 /( hhh % gam_euler ) ;
92 u_euler.std_spectral_base() ;
93
94 } else {
95
96 // Rigid rotation
97 // --------------
98
99 gam_euler = gam0 ;
100 gam_euler.std_spectral_base() ;
101 u_euler = bsn ;
102
103 }
104
105 //------------------------------------
106 // Energy density E with respect to the Eulerian observer
107 // Eq. 53 from Gourgoulhon et al. (2001)
108 //--------------------------------------
109
111
112 //-------------------------------------------
113 // Trace of the stress tensor with respect to the Eulerian observer
114 // See Eq (54) from Gourgoulhon et al. (2001)
115 //-------------------------------------------
116
117 s_euler = 3 * press + ( ener_euler + press ) %
118 contract(gamma_cov, 0, 1, u_euler * u_euler, 0 ,1) ;
119
120 //-------------------------------------------
121 // Spatial part of the stress-energy tensor with respect
122 // to the Eulerian observer.
123 //-------------------------------------------
124
125 for(int i=1; i<=3; i++) {
126 for(int j=1; j<=3; j++){
127 stress_euler.set(i,j) = (ener_euler + press )*u_euler(i)
128 *u_euler(j) + press * gamma_con(i,j) ;
129 }
130 }
131
132 //-------------------------------------------
133 // Lorentz factor between the fluid and ---> gam
134 // co-orbiting observers
135 // See Eq (58) from Gourgoulhon et al. (2001)
136 //--------------------------------------------
137
138 if (irrotational) {
139
140 Scalar tmp = ( 1 - contract(gamma_cov, 0, 1, bsn * u_euler, 0, 1) ) ;
141 tmp.std_spectral_base() ;
142 Scalar gam = gam0 % gam_euler % tmp ;
143
144 //-------------------------------------------
145 // Spatial projection of the fluid 3-velocity
146 // with respect to the co-orbiting observer
147 //--------------------------------------------
148
149 wit_w = - gam_euler / gam * u_euler + gam0 * bsn ;
150
151 wit_w.std_spectral_base() ; // set the bases for spectral expansions
152 wit_w.annule_domain(nzm1) ; // zero in the ZEC
153
154
155 //-------------------------------------------
156 // Logarithm of the Lorentz factor between
157 // the fluid and co-orbiting observers
158 //--------------------------------------------
159
160 loggam = log( gam ) ;
161 loggam.std_spectral_base() ; // set the bases for spectral expansions
162
163 //------------------------------------------------
164 // Velocity fields set to zero in external domains
165 //------------------------------------------------
166
167 loggam.annule_domain(nzm1) ; // zero in the ZEC only
168 loggam.set_dzpuis(0) ;
169
170 wit_w.annule(nzet,nzm1) ; // zero outside the star
171 u_euler.annule(nzet,nzm1) ; // zero outside the star
172
173
174 } else {
175
176 loggam = 0 ;
177 wit_w.set_etat_zero() ;
178 }
179
180 // The derived quantities are obsolete
181 // -----------------------------------
182
183 del_deriv() ;
184
185}
186}
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:393
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
Vector wit_w
Spatial projection of the fluid 3-velocity with respect to the co-orbiting observer.
Definition star.h:1115
Vector bsn
3-vector shift, divided by N, of the rotating coordinates, .
Definition star.h:1126
Scalar loggam
Logarithm of the Lorentz factor between the fluid and the co-orbiting observer.
Definition star.h:1120
virtual void hydro_euler()
Computes the hydrodynamical quantities relative to the Eulerian observer from those in the fluid fram...
bool irrotational
true for an irrotational star, false for a corotating one
Definition star.h:1099
virtual void del_deriv() const
Deletes all the derived quantities.
Vector d_psi
Gradient of (in the irrotational case) (Spherical components with respect to the mapping of the star...
Definition star.h:1109
Scalar ener
Total energy density in the fluid frame.
Definition star.h:193
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
Metric gamma
3-metric
Definition star.h:235
Sym_tensor stress_euler
Spatial part of the stress-energy tensor with respect to the Eulerian observer.
Definition star.h:212
Scalar press
Fluid pressure.
Definition star.h:194
Scalar ent
Log-enthalpy.
Definition star.h:190
Vector u_euler
Fluid 3-velocity with respect to the Eulerian observer.
Definition star.h:207
Map & mp
Mapping associated with the star.
Definition star.h:180
int nzet
Number of domains of *mp occupied by the star.
Definition star.h:183
Class intended to describe valence-2 symmetric tensors.
Definition sym_tensor.h:226
Cmp sqrt(const Cmp &)
Square root.
Definition cmp_math.C:223
Cmp exp(const Cmp &)
Exponential.
Definition cmp_math.C:273
Cmp log(const Cmp &)
Neperian logarithm.
Definition cmp_math.C:299
virtual void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Lorene prototypes.
Definition app_hor.h:67