Debian Codegraph @

C++/Source/Star/star_bin_hydro_xcts.C

raw
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 char star_bin_hydro_xcts_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_bin_hydro_xcts.C,v 1.3 2014/10/13 08:53:38 j_novak Exp $" ;
27
28 /*
29 * $Id: star_bin_hydro_xcts.C,v 1.3 2014/10/13 08:53:38 j_novak Exp $
30 * $Log: star_bin_hydro_xcts.C,v $
31 * Revision 1.3 2014/10/13 08:53:38 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.2 2010/12/09 10:43:53 m_bejger
35 * Small changes, annule --> annule_domain
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_hydro_xcts.C,v 1.3 2014/10/13 08:53:38 j_novak Exp $
41 *
42 */
43
44 // Headers Lorene
45 #include "star.h"
46 #include "utilitaires.h"
47
48 namespace Lorene {
49 void Star_bin_xcts::hydro_euler() {
50
51 int nzm1 = mp.get_mg()->get_nzone() - 1 ;
52
53 Sym_tensor gamma_cov (gamma.cov()) ;
54 Sym_tensor gamma_con (gamma.con()) ;
55
56 gamma_cov.change_triad(mp.get_bvect_cart()) ;
57 gamma_con.change_triad(mp.get_bvect_cart()) ;
58
59 //----------------------------------
60 // Specific relativistic enthalpy ---> hhh
61 //----------------------------------
62
63 Scalar hhh = exp(ent) ; // = 1 at the Newtonian limit
64 hhh.std_spectral_base() ;
65
66 //---------------------------------------------------
67 // Lorentz factor between the co-orbiting
68 // observer and the Eulerian one
69 // Eqs. 23 and 24 from Gourgoulhon et al. (2001)
70 //---------------------------------------------------
71
72 Scalar gam0 = 1 / sqrt( 1 - contract(gamma_cov, 0, 1, bsn * bsn, 0, 1)) ;
73 gam0.std_spectral_base() ;
74
75 //------------------------------------------
76 // Lorentz factor and 3-velocity of the fluid
77 // with respect to the Eulerian observer
78 //------------------------------------------
79
80 if (irrotational) {
81
82 // See Eq. 32 from Gourgoulhon et al. (2001)
83 gam_euler = sqrt( 1 + contract(gamma_con, 0, 1, d_psi * d_psi, 0, 1)
84 / (hhh%hhh) ) ;
85 gam_euler.std_spectral_base() ;
86
87 u_euler = contract(gamma_con, 0, d_psi, 0)
88 /( hhh % gam_euler ) ;
89 u_euler.std_spectral_base() ;
90
91 } else {
92
93 // Rigid rotation
94 // --------------
95
96 gam_euler = gam0 ;
97 gam_euler.std_spectral_base() ;
98 u_euler = bsn ;
99
100 }
101
102 //------------------------------------
103 // Energy density E with respect to the Eulerian observer
104 // Eq. 53 from Gourgoulhon et al. (2001)
105 //--------------------------------------
106
107 ener_euler = gam_euler % gam_euler % ( ener + press ) - press ;
108
109 //-------------------------------------------
110 // Trace of the stress tensor with respect to the Eulerian observer
111 // See Eq (54) from Gourgoulhon et al. (2001)
112 //-------------------------------------------
113
114 s_euler = 3 * press + ( ener_euler + press ) %
115 contract(gamma_cov, 0, 1, u_euler * u_euler, 0 ,1) ;
116
117 //-------------------------------------------
118 // Spatial part of the stress-energy tensor with respect
119 // to the Eulerian observer.
120 //-------------------------------------------
121
122 for(int i=1; i<=3; i++) {
123 for(int j=1; j<=3; j++){
124 stress_euler.set(i,j) = (ener_euler + press )*u_euler(i)
125 *u_euler(j) + press * gamma_con(i,j) ;
126 }
127 }
128
129 //-------------------------------------------
130 // Lorentz factor between the fluid and ---> gam
131 // co-orbiting observers
132 // See Eq (58) from Gourgoulhon et al. (2001)
133 //--------------------------------------------
134
135 if (irrotational) {
136
137 Scalar tmp = ( 1 - contract(gamma_cov, 0, 1, bsn * u_euler, 0, 1) ) ;
138 tmp.std_spectral_base() ;
139 Scalar gam = gam0 % gam_euler % tmp ;
140
141 //-------------------------------------------
142 // Spatial projection of the fluid 3-velocity
143 // with respect to the co-orbiting observer
144 //--------------------------------------------
145
146 wit_w = - gam_euler / gam * u_euler + gam0 * bsn ;
147
148 wit_w.std_spectral_base() ; // set the bases for spectral expansions
149 wit_w.annule_domain(nzm1) ; // zero in the ZEC
150
151
152 //-------------------------------------------
153 // Logarithm of the Lorentz factor between
154 // the fluid and co-orbiting observers
155 //--------------------------------------------
156
157 loggam = log( gam ) ;
158 loggam.std_spectral_base() ; // set the bases for spectral expansions
159
160 //------------------------------------------------
161 // Velocity fields set to zero in external domains
162 //------------------------------------------------
163
164 loggam.annule_domain(nzm1) ; // zero in the ZEC only
165 loggam.set_dzpuis(0) ;
166
167 wit_w.annule(nzet,nzm1) ; // zero outside the star
168 u_euler.annule(nzet,nzm1) ; // zero outside the star
169
170
171 } else {
172
173 loggam = 0 ;
174 wit_w.set_etat_zero() ;
175 }
176
177 // The derived quantities are obsolete
178 // -----------------------------------
179
180 del_deriv() ;
181
182 }
183 }