Debian Codegraph @

Codes/Test/Metrique/test_metconf_kerr.C

raw
1 /*
2 * Test code for the classe Metconf and the associated covariant
3 * derivatives, using Kerr metric.
4 *
5 */
6
7 /*
8 * Copyright (c) 2002 Jerome Novak
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27 char metconf_kerr_C[] = "$Header: /cvsroot/Lorene/Codes/Test/Metrique/test_metconf_kerr.C,v 1.6 2014/10/13 08:54:01 j_novak Exp $" ;
28
29 /*
30 * $Id: test_metconf_kerr.C,v 1.6 2014/10/13 08:54:01 j_novak Exp $
31 * $Log: test_metconf_kerr.C,v $
32 * Revision 1.6 2014/10/13 08:54:01 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.5 2014/10/06 15:12:53 j_novak
36 * Modified #include directives to use c++ syntax.
37 *
38 * Revision 1.4 2002/10/16 14:37:18 j_novak
39 * Reorganization of #include instructions of standard C++, in order to
40 * use experimental version 3 of gcc.
41 *
42 * Revision 1.3 2002/09/10 14:16:14 j_novak
43 * Modif commentaires
44 *
45 *
46 * $Header: /cvsroot/Lorene/Codes/Test/Metrique/test_metconf_kerr.C,v 1.6 2014/10/13 08:54:01 j_novak Exp $
47 *
48 */
49
50 //standard
51 #include <cmath>
52
53 // Headers Lorene :
54 #include "utilitaires.h"
55 #include "param.h"
56 #include "metconf.h"
57 #include "graphique.h"
58 #include "proto.h"
59 #include "nbr_spx.h"
60
61 using namespace Lorene ;
62
63 int main() {
64
65 double M = 1. ;
66 double a = 0.999 ;
67
68 int nz = 4 ;
69 double R = 0.3*M ;
70
71 // Nombre points en r
72 int nr = 21 ;
73
74 // echantillonnage en phi :
75 int* np = new int [nz] ;
76 for (int l=0 ; l<nz ; l++)
77 np[l] = 4 ;
78 int type_p = SYM ;
79
80 // echantillonnage en theta :
81 int* nt = new int [nz] ;
82 for (int l=0 ; l<nz ; l++)
83 nt[l] = 17 ;
84 int type_t = SYM ;
85
86 int* type_r = new int[nz] ;
87 type_r[0] = FIN ;
88 for (int l=1 ; l<nz ; l++)
89 type_r[l] = FIN ;
90 type_r[nz-1] = UNSURR ;
91
92 // Construction de la grille
93
94 // echantillonage en r :
95 int* nr0 = new int [nz] ;
96 for (int l=0 ; l<nz ; l++)
97 nr0[l] = nr ;
98 nr0[nz-1] = 2*nr-1 ;
99
100 Mg3d grille (nz, nr0, type_r, nt, type_t, np, type_p) ;
101 cout << grille ;
102
103 //Construction du mapping :
104 double* bornes = new double[nz+1] ;
105 bornes[0] = R ;
106 for (int i=1 ; i<nz ; i++)
107 bornes[i] = R*double(i+nz)/double(nz) ;
108 bornes[nz] = __infinity ;
109 Map_af mapping(grille, bornes) ;
110
111 Coord& r = mapping.r ;
112 Coord& sint = mapping.sint ;
113 Coord& cost = mapping.cost ;
114 Mtbl erre(1.+M/r + (M*M - a*a)/(4*r*r)) ;
115 Mtbl rs(r + M + (M*M - a*a)/(4*r)) ;
116 Mtbl sigmasr(rs + (a*a*cost*cost)/rs) ;
117 Cmp adeux(mapping) ; Cmp bdeux(mapping) ;
118 adeux = erre*erre + (a*a*cost*cost)/(r*r) ; //Kerr dans la jauge quasi-
119 bdeux = erre*erre + a*a/(r*r) + 2*a*a*sint*sint*M/(sigmasr*r*r) ; //isotrope
120
121 Tenseur_sym gspher(mapping, 2, COV, mapping.get_bvect_spher() ) ;
122 gspher.set_etat_qcq() ;
123 for (int i=0; i<3; i++)
124 for (int j=0; j<i; j++)
125 gspher.set(i,j) = 0 ;
126 gspher.set(0,0) = adeux ;
127 gspher.set(1,1) = adeux ;
128 gspher.set(2,2) = bdeux ;
129 gspher.set_std_base() ;
130
131 Tenseur_sym gcart(gspher) ;
132 gcart.change_triad(mapping.get_bvect_cart() ) ;
133 gcart.set_std_base() ;
134
135 Metrique gij(gcart) ;
136 Tenseur_sym plat(mapping, 2, COV, mapping.get_bvect_cart() ) ;
137 plat.set_etat_qcq() ;
138 for (int i=0; i<3; i++) {
139 for (int j=0; j<i; j++)
140 plat.set(i,j) = 0 ;
141 plat.set(i,i) = 1 ;
142 }
143 plat.set_std_base() ;
144
145 Metrique fij(plat, true) ;
146 Metconf gtilde(pow(gij.determinant(),(-1./3.))*gcart, fij) ;
147
148 cout << "--------------------" << endl ;
149 cout << "Norme de D_k g~_ij: " << endl ;
150 cout << "--------------------" << endl ;
151 for (int i=0; i<3; i++)
152 for (int j=0; j<3; j++)
153 for (int k=j; k<3; k++) {
154 cout << "k, i, j : " << i << ", " << j << ", " << k << endl ;
155 cout << norme(gtilde.cov().derive_cov(gij)(i,j,k)) ;
156 }
157 arrete() ;
158
159 cout << "---------------------" << endl ;
160 cout << "Norme de D~_k g~_ij: " << endl ;
161 cout << "---------------------" << endl ;
162 for (int i=0; i<3; i++)
163 for (int j=0; j<3; j++)
164 for (int k=j; k<3; k++) {
165 cout << "k, i, j : " << i << ", " << j << ", " << k << endl ;
166 cout << norme(gtilde.cov().derive_cov(gtilde)(i,j,k)) ;
167 }
168 arrete() ;
169
170 cout << "------------" << endl ;
171 cout << "Delta^k_ik: " << endl ;
172 cout << "------------" << endl ;
173 Tenseur beta(contract(gtilde.delta(),0,1)) ;
174 for (int i=0; i<3; i++) {
175 cout << "i: " << i << endl ;
176 cout << norme(beta(i)) ;
177 }
178 arrete() ;
179
180 cout << "---------------------------------------------------------"
181 << endl ;
182 cout << "Erreur relative sur C~ - gamma + gamma~ [formule (169)]: "
183 << endl ;
184 cout << "---------------------------------------------------------"
185 << endl ;
186 Tenseur T1(contract(gij.con(),1,gij.cov().derive_cov(gtilde),1)) ;
187 Tenseur T2(contract(gij.con(),1,gij.cov().derive_cov(gtilde),0)) ;
188 Tenseur_sym ctilde(gij.gamma()) ;
189 for (int k=0; k<3; k++)
190 for (int i=0; i<3; i++)
191 for (int j=0; j<3; j++) {
192 ctilde.set(k,i,j) = 0.5*(T1(k,i,j) + T1(k,j,i) - T2(k,i,j)) ;
193 }
194
195 Tenseur diff(ctilde - gij.gamma() + gtilde.gamma()) ;
196 for (int i=0; i<3; i++)
197 for (int j=0; j<3; j++)
198 for (int k=j; k<3; k++) {
199 cout << "k, i, j : " << i << ", " << j << ", " << k << endl ;
200 cout << norme(diff(i,j,k))/norme(ctilde(i,j,k)) ;
201 }
202 arrete() ;
203
204 cout << "----------------------------------------------------" << endl ;
205 cout << "Verification de la relation entre Rij et R~ij (178):" << endl ;
206 cout << "----------------------------------------------------" << endl ;
207 Tenseur lnh(log(gij.determinant())) ;
208 lnh.set_std_base() ;
209 Tenseur gradh(lnh.gradient()) ;
210 Tenseur gradh2(gradh) ;
211 gradh2.dec2_dzpuis() ;
212 Tenseur_sym ggh(gradh2.derive_cov(gtilde)) ;
213 ggh.inc_dzpuis() ;
214
215 Tenseur_sym R1(fij.cov()) ;
216 for(int i=0; i<3; i++)
217 for (int j=i; j<3; j++)
218 R1.set(i,j) = gradh(i)*gradh(j)/6. ;
219 R1.dec_dzpuis() ;
220 Tenseur Raux(contract(gtilde.con(),0,ggh+R1,0)) ;
221 Tenseur_sym R2(contract(Raux,0,1)*gtilde.cov()) ;
222 Tenseur_sym Rij(gij.ricci() - gtilde.ricci() + (ggh - R1 + R2)/6.) ;
223 for(int i=0; i<3; i++)
224 for (int j=i; j<3; j++) {
225 cout << "Erreur relative/composante: " << i << ", " << j << endl ;
226 cout << norme(Rij(i,j))/norme(gij.ricci()(i,j)) ;}
227 arrete() ;
228
229 cout << "------------------------------------------------" << endl ;
230 cout << "Verification de la relation entre R et R~ (182):" << endl ;
231 cout << "------------------------------------------------" << endl ;
232 Raux = contract(gij.con(), 0,(ggh - R1 + R2)/6., 0) ;
233 Tenseur R3(contract(Raux,0,1)) ;
234 Tenseur R4(gtilde.ricci_scal()) ;
235 if (gtilde.dirac_gauge()) R4.dec_dzpuis() ;
236 Tenseur RR(gij.ricci_scal() - pow(gij.determinant(), -1./3.)*R4 + R3) ;
237 cout << norme(RR())/norme(gtilde.ricci_scal()()) ;
238 arrete() ;
239
240 cout << "--------------------------------------------" << endl ;
241 cout << "Verification de la formule (199) pour R~_ij:" << endl ;
242 cout << "--------------------------------------------" << endl ;
243 Tenseur_sym L1(contract(contract(gtilde.delta(),0, gtilde.delta(),2),
244 1,2) );
245 L1.dec_dzpuis() ;
246 Tenseur_sym del2(gtilde.delta()) ;
247 del2.dec2_dzpuis() ;
248 Tenseur_sym L2(contract(del2.derive_cov(fij), 0, 1)) ;
249 L2.inc_dzpuis() ;
250
251 Tenseur_sym fin(gtilde.ricci() - L2 + L1) ;
252 for (int i=0; i<3; i++)
253 for (int j=i; j<3; j++) {
254 cout << "i, j: " << i << ", " << j << endl ;
255 cout << norme(fin(i,j))/norme(gtilde.ricci()(i,j)) ;
256 }
257
258 delete [] np ;
259 delete [] nt ;
260 delete [] nr0 ;
261 delete [] type_r ;
262 delete [] bornes ;
263 return EXIT_SUCCESS ;
264 }
265
266
267
268
269
270