Debian Codegraph @

C++/Source/Star/star_rot_upmetr.C

raw
1 /*
2 * Methods Star_rot::update_metric and Star_rot::extrinsic_curvature
3 *
4 * (see file star_rot.h for documentation)
5 *
6 */
7
8 /*
9 * Copyright (c) 2010 Eric Gourgoulhon
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 as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * LORENE is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with LORENE; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 */
28
29
30 char star_rot_upmetr_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_rot_upmetr.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $" ;
31
32 /*
33 * $Id: star_rot_upmetr.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $
34 * $Log: star_rot_upmetr.C,v $
35 * Revision 1.2 2014/10/13 08:53:39 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.1 2010/01/25 18:15:52 e_gourgoulhon
39 * First version.
40 *
41 *
42 * $Header: /cvsroot/Lorene/C++/Source/Star/star_rot_upmetr.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $
43 *
44 */
45
46 // Headers Lorene
47 #include "star_rot.h"
48
49
50 namespace Lorene {
51 void Star_rot::update_metric() {
52
53 // Lapse function N
54 // ----------------
55
56 nn = exp( unsurc2 * logn ) ;
57
58 nn.std_spectral_base() ; // set the bases for spectral expansions
59
60
61 // Metric factor A^2
62 // -----------------
63
64 a_car = exp( 2*unsurc2*( dzeta - logn ) ) ;
65
66 a_car.std_spectral_base() ; // set the bases for spectral expansions
67
68 // Metric factor B
69 // ---------------
70
71 Scalar tmp = tggg ;
72 tmp.div_rsint() ; //... Division of tG by r sin(theta)
73
74 bbb = (1 + tmp) / nn ;
75
76 bbb.std_spectral_base() ; // set the bases for spectral expansions
77
78 b_car = bbb * bbb ;
79
80 // Full 3-metric
81 // -------------
82
83 Sym_tensor gam(mp, COV, mp.get_bvect_spher()) ;
84 gam.set(1,1) = a_car ;
85 gam.set(1,2) = 0 ;
86 gam.set(1,3) = 0 ;
87 gam.set(2,2) = a_car ;
88 gam.set(2,3) = 0 ;
89 gam.set(3,3) = b_car ;
90
91 gamma = gam ;
92
93 // Tensor B^{-2} K_{ij} and Scalar A^2 K_{ij} K^{ij}
94 // -------------------------------------------------
95
96 extrinsic_curvature() ;
97
98
99 // The derived quantities are no longer up to date :
100 // -----------------------------------------------
101
102 del_deriv() ;
103
104 }
105
106
107 /*************************************************************************************/
108
109
110 void Star_rot::extrinsic_curvature(){
111
112
113 // ---------------------------------------
114 // Special treatment for axisymmetric case
115 // ---------------------------------------
116
117 if ( (mp.get_mg())->get_np(0) == 1) {
118
119 tkij.set_etat_zero() ; // initialisation
120
121 // Computation of K_xy
122 // -------------------
123
124 Scalar dnpdr = nphi.dsdr() ; // d/dr (N^phi)
125 Scalar dnpdt = nphi.srdsdt() ; // 1/r d/dtheta (N^phi)
126
127 // What follows is valid only for a mapping of class Map_radial :
128 assert( dynamic_cast<const Map_radial*>(&mp) != 0x0 ) ;
129
130 if (dnpdr.get_etat() == ETATQCQ) {
131 // multiplication by sin(theta)
132 dnpdr.set_spectral_va() = (dnpdr.get_spectral_va()).mult_st() ;
133 }
134
135 if (dnpdt.get_etat() == ETATQCQ) {
136 // multiplication by cos(theta)
137 dnpdt.set_spectral_va() = (dnpdt.get_spectral_va()).mult_ct() ;
138 }
139
140 Scalar tmp = dnpdr + dnpdt ;
141
142 tmp.mult_rsint() ; // multiplication by r sin(theta)
143
144 tkij.set(1,2) = - 0.5 * tmp / nn ; // component (x,y)
145
146
147 // Computation of K_yz
148 // -------------------
149
150 dnpdr = nphi.dsdr() ; // d/dr (N^phi)
151 dnpdt = nphi.srdsdt() ; // 1/r d/dtheta (N^phi)
152
153 if (dnpdr.get_etat() == ETATQCQ) {
154 // multiplication by cos(theta)
155 dnpdr.set_spectral_va() = (dnpdr.get_spectral_va()).mult_ct() ;
156 }
157
158 if (dnpdt.get_etat() == ETATQCQ) {
159 // multiplication by sin(theta)
160 dnpdt.set_spectral_va() = (dnpdt.get_spectral_va()).mult_st() ;
161 }
162
163 tmp = dnpdr - dnpdt ;
164
165 tmp.mult_rsint() ; // multiplication by r sin(theta)
166
167 tkij.set(2,3) = - 0.5 * tmp / nn ; // component (y,z)
168
169 // The other components are set to zero
170 // ------------------------------------
171 tkij.set(1,1) = 0 ; // component (x,x)
172 tkij.set(1,3) = 0 ; // component (x,z)
173 tkij.set(2,2) = 0 ; // component (y,y)
174 tkij.set(3,3) = 0 ; // component (z,z)
175
176 }
177 else {
178
179 // ------------
180 // General case
181 // ------------
182
183 // Gradient (Cartesian components) of the shift
184 // D_j N^i
185
186 Tensor dn = - beta.derive_cov( mp.flat_met_cart() ) ;
187
188 // Trace of D_j N^i = divergence of N^i :
189 Scalar divn = contract(dn, 0, 1) ;
190
191 if (divn.get_etat() == ETATQCQ) {
192
193 // Computation of B^{-2} K_{ij}
194 // ----------------------------
195 tkij.set_etat_qcq() ;
196 for (int i=1; i<=3; i++) {
197 for (int j=i; j<=3; j++) {
198 tkij.set(i, j) = dn(i, j) + dn(j, i) ;
199 }
200 tkij.set(i, i) -= double(2) /double(3) * divn ;
201 }
202
203 tkij = - 0.5 * tkij / nn ;
204
205 }
206 else{
207 assert( divn.get_etat() == ETATZERO ) ;
208 tkij.set_etat_zero() ;
209 }
210 }
211
212 // Computation of A^2 K_{ij} K^{ij}
213 // --------------------------------
214
215 ak_car = 0 ;
216
217 for (int i=1; i<=3; i++) {
218 for (int j=1; j<=3; j++) {
219
220 ak_car += tkij(i, j) * tkij(i, j) ;
221
222 }
223 }
224
225 ak_car = b_car * ak_car ;
226
227 }
228
229 }