00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 char star_binupmetr_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_bin_upmetr.C,v 1.13 2005/09/13 19:38:31 f_limousin Exp $" ;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #include "cmp.h"
00081 #include "star.h"
00082 #include "graphique.h"
00083 #include "utilitaires.h"
00084
00085
00086
00087
00088
00089 void Star_bin::update_metric(const Star_bin& comp, double om) {
00090
00091
00092
00093
00094 int nz = mp.get_mg()->get_nzone() ;
00095 int nr = mp.get_mg()->get_nr(0);
00096 int nt = mp.get_mg()->get_nt(0);
00097 int np = mp.get_mg()->get_np(0);
00098
00099 const Map& mp_comp (comp.get_mp()) ;
00100
00101 if ( (comp.logn_auto).get_etat() == ETATZERO ) {
00102 logn_comp.set_etat_zero() ;
00103 }
00104 else{
00105 logn_comp.set_etat_qcq() ;
00106 logn_comp.import( comp.logn_auto ) ;
00107 logn_comp.std_spectral_base() ;
00108 }
00109
00110
00111 beta_comp.set_etat_qcq() ;
00112 beta_comp.set_triad(mp.get_bvect_cart()) ;
00113
00114 Vector comp_beta(comp.beta_auto) ;
00115 comp_beta.change_triad(mp_comp.get_bvect_cart()) ;
00116 comp_beta.change_triad(mp.get_bvect_cart()) ;
00117
00118 assert ( *(beta_comp.get_triad()) == *(comp_beta.get_triad())) ;
00119
00120 (beta_comp.set(1)).import( comp_beta(1) ) ;
00121 (beta_comp.set(2)).import( comp_beta(2) ) ;
00122 (beta_comp.set(3)).import( comp_beta(3) ) ;
00123
00124 beta_comp.std_spectral_base() ;
00125
00126 if ( (comp.lnq_auto).get_etat() == ETATZERO ) {
00127 lnq_comp.set_etat_zero() ;
00128 }
00129 else{
00130 lnq_comp.set_etat_qcq() ;
00131 lnq_comp.import( comp.lnq_auto ) ;
00132 lnq_comp.std_spectral_base() ;
00133 }
00134
00135
00136 hij_comp.set_triad(mp.get_bvect_cart()) ;
00137 Sym_tensor comp_hij(comp.hij_auto) ;
00138 comp_hij.change_triad(mp_comp.get_bvect_cart()) ;
00139 comp_hij.change_triad(mp.get_bvect_cart()) ;
00140
00141 assert ( *(hij_comp.get_triad()) == *(comp_hij.get_triad())) ;
00142
00143 for(int i=1; i<=3; i++)
00144 for(int j=i; j<=3; j++) {
00145
00146 hij_comp.set(i,j).set_etat_qcq() ;
00147 hij_comp.set(i,j).import( (comp_hij)(i,j) ) ;
00148 }
00149
00150 hij_comp.std_spectral_base() ;
00151
00152
00153
00154
00155 logn = logn_auto + logn_comp ;
00156
00157 nn = exp( logn ) ;
00158
00159 nn.std_spectral_base() ;
00160
00161
00162
00163
00164 lnq = lnq_auto + lnq_comp ;
00165
00166 psi4 = exp(2*lnq) / (nn * nn) ;
00167 psi4.std_spectral_base() ;
00168
00169
00170
00171
00172 beta = beta_auto + beta_comp ;
00173
00174
00175
00176
00177 Sym_tensor gtilde_con (mp, CON, mp.get_bvect_cart()) ;
00178
00179 for(int i=1; i<=3; i++)
00180 for(int j=i; j<=3; j++) {
00181
00182 hij.set(i,j) = hij_auto(i,j) + hij_comp(i,j) ;
00183 gtilde_con.set(i,j) = hij(i,j) + flat.con()(i,j) ;
00184 }
00185
00186 gtilde = gtilde_con ;
00187
00188 Sym_tensor tens_gamma = gtilde_con / psi4 ;
00189 gamma = tens_gamma ;
00190
00191
00192
00193
00194
00195 if (conf_flat) {
00196 hij_auto.set_etat_zero() ;
00197 hij_comp.set_etat_zero() ;
00198 hij.set_etat_zero() ;
00199 gtilde = flat ;
00200 tens_gamma = flat.con() / psi4 ;
00201 gamma = tens_gamma ;
00202 }
00203
00204
00205
00206
00207 Scalar det_gtilde (gtilde.determinant()) ;
00208
00209 double* max_det = new double[nz] ;
00210 double* min_det = new double[nz] ;
00211 double* moy_det = new double[nz] ;
00212
00213 for (int i=0; i<nz; i++){
00214 min_det[i] = 2 ;
00215 moy_det[i] = 0 ;
00216 max_det[i] = 0 ;
00217 }
00218
00219 for (int l=0; l<nz; l++)
00220 for (int k=0; k<np; k++)
00221 for (int j=0; j<nt; j++)
00222 for (int i=0; i<nr; i++){
00223
00224 moy_det[l] = moy_det[l] + det_gtilde.val_grid_point(l,k,j,i) ;
00225 if (det_gtilde.val_grid_point(l,k,j,i) > max_det[l]){
00226 max_det[l] = det_gtilde.val_grid_point(l,k,j,i) ;
00227 }
00228 if (det_gtilde.val_grid_point(l,k,j,i) < min_det[l]){
00229 min_det[l] = det_gtilde.val_grid_point(l,k,j,i) ;
00230 }
00231 }
00232
00233 cout << "average determinant of gtilde in each zone : " << endl ;
00234 for (int l=0; l<nz; l++){
00235 cout << moy_det[l]/(nr*nt*np) << " " ;
00236 }
00237 cout << endl ;
00238
00239
00240 cout << "maximum of the determinant of gtilde in each zone : " << endl ;
00241 for (int l=0; l<nz; l++){
00242 cout << max_det[l] << " " ;
00243 }
00244 cout << endl ;
00245
00246 cout << "minimum of the determinant of gtilde in each zone : " << endl ;
00247 for (int l=0; l<nz; l++){
00248 cout << min_det[l] << " " ;
00249 }
00250 cout << endl ;
00251
00252
00253 extrinsic_curvature(om) ;
00254
00255
00256
00257
00258
00259 del_deriv() ;
00260
00261 delete max_det ;
00262 delete moy_det ;
00263 delete min_det ;
00264 }
00265
00266
00267
00268
00269
00270
00271
00272 void Star_bin::update_metric(const Star_bin& comp,
00273 const Star_bin& star_jm1,
00274 double relax, double om) {
00275
00276
00277
00278
00279
00280 int nz = mp.get_mg()->get_nzone() ;
00281 int nr = mp.get_mg()->get_nr(0);
00282 int nt = mp.get_mg()->get_nt(0);
00283 int np = mp.get_mg()->get_np(0);
00284
00285 const Map& mp_comp (comp.get_mp()) ;
00286
00287 if ( (comp.logn_auto).get_etat() == ETATZERO ) {
00288 logn_comp.set_etat_zero() ;
00289 }
00290 else{
00291 logn_comp.set_etat_qcq() ;
00292 logn_comp.import( comp.logn_auto ) ;
00293 logn_comp.std_spectral_base() ;
00294 }
00295
00296
00297 beta_comp.set_etat_qcq() ;
00298 beta_comp.set_triad(mp.get_bvect_cart()) ;
00299
00300 Vector comp_beta(comp.beta_auto) ;
00301 comp_beta.change_triad(mp_comp.get_bvect_cart()) ;
00302 comp_beta.change_triad(mp.get_bvect_cart()) ;
00303
00304 assert ( *(beta_comp.get_triad()) == *(comp_beta.get_triad())) ;
00305
00306 (beta_comp.set(1)).import( comp_beta(1) ) ;
00307 (beta_comp.set(2)).import( comp_beta(2) ) ;
00308 (beta_comp.set(3)).import( comp_beta(3) ) ;
00309
00310 beta_comp.std_spectral_base() ;
00311
00312
00313 if ( (comp.lnq_auto).get_etat() == ETATZERO ) {
00314 lnq_comp.set_etat_zero() ;
00315 }
00316 else{
00317 lnq_comp.set_etat_qcq() ;
00318 lnq_comp.import( comp.lnq_auto ) ;
00319 lnq_comp.std_spectral_base() ;
00320 }
00321
00322 hij_comp.set_triad(mp.get_bvect_cart()) ;
00323
00324 Sym_tensor comp_hij(comp.hij_auto) ;
00325 comp_hij.change_triad(mp_comp.get_bvect_cart()) ;
00326 comp_hij.change_triad(mp.get_bvect_cart()) ;
00327
00328 assert ( *(hij_comp.get_triad()) == *(comp_hij.get_triad())) ;
00329
00330
00331 for(int i=1; i<=3; i++)
00332 for(int j=i; j<=3; j++) {
00333
00334 hij_comp.set(i,j).set_etat_qcq() ;
00335 hij_comp.set(i,j).import( (comp_hij)(i,j) ) ;
00336 }
00337
00338 hij_comp.std_spectral_base() ;
00339
00340
00341
00342 double relaxjm1 = 1. - relax ;
00343
00344 logn_comp = relax * logn_comp + relaxjm1 * (star_jm1.logn_comp) ;
00345
00346 beta_comp = relax * beta_comp + relaxjm1
00347 * (star_jm1.beta_comp) ;
00348
00349 lnq_comp = relax * lnq_comp + relaxjm1 * (star_jm1.lnq_comp) ;
00350
00351
00352 for(int i=1; i<=3; i++)
00353 for(int j=i; j<=3; j++) {
00354
00355 hij_comp.set(i,j) = relax * hij_comp(i,j)
00356 + relaxjm1 * (star_jm1.hij_comp)(i,j) ;
00357
00358 }
00359
00360
00361
00362
00363 logn = logn_auto + logn_comp ;
00364
00365 nn = exp( logn ) ;
00366
00367 nn.std_spectral_base() ;
00368
00369
00370
00371
00372
00373 lnq = lnq_auto + lnq_comp ;
00374
00375 psi4 = exp(2*lnq) / (nn * nn) ;
00376 psi4.std_spectral_base() ;
00377
00378
00379
00380
00381 beta = beta_auto + beta_comp ;
00382
00383
00384
00385
00386 Sym_tensor gtilde_con(mp, CON, mp.get_bvect_cart()) ;
00387
00388 for(int i=1; i<=3; i++)
00389 for(int j=i; j<=3; j++) {
00390
00391 hij.set(i,j) = hij_auto(i,j) + hij_comp(i,j) ;
00392 gtilde_con.set(i,j) = hij(i,j) + flat.con()(i,j) ;
00393 }
00394
00395
00396 gtilde = gtilde_con ;
00397 Sym_tensor tens_gamma(gtilde_con / psi4) ;
00398 gamma = tens_gamma ;
00399
00400
00401
00402
00403 if (conf_flat) {
00404 hij_auto.set_etat_zero() ;
00405 hij_comp.set_etat_zero() ;
00406 hij.set_etat_zero() ;
00407 gtilde = flat ;
00408 tens_gamma = flat.con() / psi4 ;
00409 gamma = tens_gamma ;
00410 }
00411
00412
00413
00414 Scalar det_gtilde (gtilde.determinant()) ;
00415
00416 double* max_det = new double[nz] ;
00417 double* min_det = new double[nz] ;
00418 double* moy_det = new double[nz] ;
00419
00420 for (int i=0; i<nz; i++){
00421 min_det[i] = 2 ;
00422 moy_det[i] = 0 ;
00423 max_det[i] = 0 ;
00424 }
00425
00426 for (int l=0; l<nz; l++)
00427 for (int k=0; k<np; k++)
00428 for (int j=0; j<nt; j++)
00429 for (int i=0; i<nr; i++){
00430
00431 moy_det[l] = moy_det[l] + det_gtilde.val_grid_point(l,k,j,i) ;
00432 if (det_gtilde.val_grid_point(l,k,j,i) > max_det[l]){
00433 max_det[l] = det_gtilde.val_grid_point(l,k,j,i) ;
00434 }
00435 if (det_gtilde.val_grid_point(l,k,j,i) < min_det[l]){
00436 min_det[l] = det_gtilde.val_grid_point(l,k,j,i) ;
00437 }
00438 }
00439
00440 cout << "average determinant of gtilde in each zone : " << endl ;
00441 for (int l=0; l<nz; l++){
00442 cout << moy_det[l]/(nr*nt*np) << " " ;
00443 }
00444 cout << endl ;
00445
00446
00447 cout << "maximum of the determinant of gtilde in each zone : " << endl ;
00448 for (int l=0; l<nz; l++){
00449 cout << max_det[l] << " " ;
00450 }
00451 cout << endl ;
00452
00453 cout << "minimum of the determinant of gtilde in each zone : " << endl ;
00454 for (int l=0; l<nz; l++){
00455 cout << min_det[l] << " " ;
00456 }
00457 cout << endl ;
00458
00459
00460
00461 extrinsic_curvature(om) ;
00462
00463
00464
00465
00466
00467 del_deriv() ;
00468
00469 delete max_det ;
00470 delete moy_det ;
00471 delete min_det ;
00472
00473 }
00474