00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 char binhor_kij_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_kij.C,v 1.9 2007/04/13 15:28:55 f_limousin Exp $" ;
00025
00026
00027
00028
00029
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 #include <stdlib.h>
00070 #include <math.h>
00071
00072
00073 #include "nbr_spx.h"
00074 #include "tenseur.h"
00075 #include "tensor.h"
00076 #include "isol_hor.h"
00077 #include "proto.h"
00078 #include "utilitaires.h"
00079
00080
00081 void Bin_hor::extrinsic_curvature () {
00082
00083
00084 int nnt = hole1.mp.get_mg()->get_nt(1) ;
00085 int nnp = hole1.mp.get_mg()->get_np(1) ;
00086
00087 int check ;
00088 check = 0 ;
00089 for (int k=0; k<nnp; k++)
00090 for (int j=0; j<nnt; j++){
00091 if ((hole1.n_auto+hole1.n_comp).val_grid_point(1, k, j , 0) < 1e-4){
00092 check = 1 ;
00093 break ;
00094 }
00095 }
00096
00097 Sym_tensor aa_auto_un (hole1.mp, CON, hole1.mp.get_bvect_spher()) ;
00098 Sym_tensor aa_auto_deux (hole2.mp, CON, hole2.mp.get_bvect_spher()) ;
00099
00100 if (check == 0){
00101
00102
00103
00104 aa_auto_un = ( hole1.beta_auto.ope_killing_conf(hole1.tgam) +
00105 hole1.gamt_point*hole1.decouple ) / (2.* hole1.nn) ;
00106
00107 aa_auto_deux = ( hole2.beta_auto.ope_killing_conf(hole2.tgam) +
00108 hole2.gamt_point*hole2.decouple ) / (2.* hole2.nn) ;
00109
00110
00111 aa_auto_un.change_triad(hole1.mp.get_bvect_cart()) ;
00112 aa_auto_deux.change_triad(hole2.mp.get_bvect_cart()) ;
00113
00114 for (int i=1 ; i<=3 ; i++)
00115 for (int j=i ; j<=3 ; j++) {
00116 if (aa_auto_un(i,j).get_etat() != ETATZERO)
00117 aa_auto_un.set(i, j).raccord(3) ;
00118 if (aa_auto_deux(i,j).get_etat() != ETATZERO)
00119 aa_auto_deux.set(i, j).raccord(3) ;
00120 }
00121
00122 aa_auto_un.change_triad(hole1.mp.get_bvect_spher()) ;
00123 aa_auto_deux.change_triad(hole2.mp.get_bvect_spher()) ;
00124
00125 hole1.aa_auto = aa_auto_un ;
00126 hole2.aa_auto = aa_auto_deux ;
00127
00128
00129
00130
00131 aa_auto_un.dec_dzpuis(2) ;
00132 aa_auto_deux.dec_dzpuis(2) ;
00133
00134 Sym_tensor aa_comp_un (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00135 aa_comp_un.set_etat_qcq() ;
00136 Sym_tensor aa_comp_deux (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00137 aa_comp_deux.set_etat_qcq() ;
00138
00139 aa_auto_deux.change_triad(hole2.mp.get_bvect_cart()) ;
00140 aa_auto_deux.change_triad(hole1.mp.get_bvect_cart()) ;
00141 assert(*(aa_auto_deux.get_triad()) == *(aa_comp_un.get_triad())) ;
00142
00143
00144 for (int i=1 ; i<=3 ; i++)
00145 for (int j=i ; j<=3 ; j++) {
00146 aa_comp_un.set(i, j).import(aa_auto_deux(i, j)) ;
00147 aa_comp_un.set(i, j).set_spectral_va().set_base(aa_auto_deux(i, j).
00148 get_spectral_va().get_base()) ;
00149 }
00150
00151 aa_comp_un.inc_dzpuis(2) ;
00152 aa_comp_un.change_triad(hole1.mp.get_bvect_spher()) ;
00153
00154 aa_auto_un.change_triad(hole1.mp.get_bvect_cart()) ;
00155 aa_auto_un.change_triad(hole2.mp.get_bvect_cart()) ;
00156 assert(*(aa_auto_un.get_triad()) == *(aa_comp_deux.get_triad())) ;
00157
00158 for (int i=1 ; i<=3 ; i++)
00159 for (int j=i ; j<=3 ; j++) {
00160 aa_comp_deux.set(i, j).import(aa_auto_un(i, j)) ;
00161 aa_comp_deux.set(i, j).set_spectral_va().set_base(aa_auto_un(i, j).
00162 get_spectral_va().get_base()) ;
00163 }
00164
00165 aa_comp_deux.inc_dzpuis(2) ;
00166 aa_comp_deux.change_triad(hole2.mp.get_bvect_spher()) ;
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 hole1.aa_comp = aa_comp_un ;
00198 hole2.aa_comp = aa_comp_deux ;
00199
00200
00201 hole1.aa = hole1.aa_auto + hole1.aa_comp ;
00202 hole2.aa = hole2.aa_auto + hole2.aa_comp ;
00203
00204 }
00205 else {
00206
00207
00208
00209 aa_auto_un = ( hole1.beta_auto.ope_killing_conf(hole1.tgam) +
00210 hole1.gamt_point*hole1.decouple ) ;
00211 aa_auto_deux = ( hole2.beta_auto.ope_killing_conf(hole2.tgam) +
00212 hole2.gamt_point*hole2.decouple ) ;
00213
00214 aa_auto_un.change_triad(hole1.mp.get_bvect_cart()) ;
00215 aa_auto_deux.change_triad(hole2.mp.get_bvect_cart()) ;
00216
00217 for (int i=1 ; i<=3 ; i++)
00218 for (int j=1 ; j<=3 ; j++) {
00219 if (aa_auto_un(i,j).get_etat() != ETATZERO)
00220 aa_auto_un.set(i, j).raccord(3) ;
00221 if (aa_auto_deux(i,j).get_etat() != ETATZERO)
00222 aa_auto_deux.set(i, j).raccord(3) ;
00223 }
00224
00225
00226
00227 Sym_tensor aa_auto_1 (aa_auto_un) ;
00228 Sym_tensor aa_auto_2 (aa_auto_deux) ;
00229
00230 aa_auto_1.dec_dzpuis(2) ;
00231 aa_auto_2.dec_dzpuis(2) ;
00232
00233 Sym_tensor aa_comp_un (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00234 aa_comp_un.set_etat_qcq() ;
00235 Sym_tensor aa_comp_deux (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00236 aa_comp_deux.set_etat_qcq() ;
00237
00238 aa_auto_2.change_triad(hole1.mp.get_bvect_cart()) ;
00239 assert(*(aa_auto_2.get_triad()) == *(aa_comp_un.get_triad())) ;
00240
00241 aa_comp_un.set(1, 1).import(aa_auto_2(1, 1)) ;
00242 aa_comp_un.set(1, 2).import(aa_auto_2(1, 2)) ;
00243 aa_comp_un.set(1, 3).import(aa_auto_2(1, 3)) ;
00244 aa_comp_un.set(2, 2).import(aa_auto_2(2, 2)) ;
00245 aa_comp_un.set(2, 3).import(aa_auto_2(2, 3)) ;
00246 aa_comp_un.set(3, 3).import(aa_auto_2(3, 3)) ;
00247
00248 aa_comp_un.std_spectral_base() ;
00249 aa_comp_un.inc_dzpuis(2) ;
00250
00251 aa_auto_1.change_triad(hole2.mp.get_bvect_cart()) ;
00252 assert(*(aa_auto_1.get_triad()) == *(aa_comp_deux.get_triad())) ;
00253
00254 aa_comp_deux.set(1, 1).import(aa_auto_1(1, 1)) ;
00255 aa_comp_deux.set(1, 2).import(aa_auto_1(1, 2)) ;
00256 aa_comp_deux.set(1, 3).import(aa_auto_1(1, 3)) ;
00257 aa_comp_deux.set(2, 2).import(aa_auto_1(2, 2)) ;
00258 aa_comp_deux.set(2, 3).import(aa_auto_1(2, 3)) ;
00259 aa_comp_deux.set(3, 3).import(aa_auto_1(3, 3)) ;
00260
00261 aa_comp_deux.std_spectral_base() ;
00262 aa_comp_deux.inc_dzpuis(2) ;
00263
00264
00265 Sym_tensor aa_tot_un (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00266 Sym_tensor aa_tot_deux (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00267 aa_tot_un = aa_auto_un + aa_comp_un ;
00268 aa_tot_deux = aa_auto_deux + aa_comp_deux ;
00269
00270 Sym_tensor temp_aa_tot1 (aa_tot_un) ;
00271 Sym_tensor temp_aa_tot2 (aa_tot_deux) ;
00272
00273 temp_aa_tot1.change_triad(hole1.mp.get_bvect_spher()) ;
00274 temp_aa_tot2.change_triad(hole2.mp.get_bvect_spher()) ;
00275
00276
00277
00278
00279 Sym_tensor aa_un (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
00280 Sym_tensor aa_deux (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
00281
00282 int nz_un = hole1.mp.get_mg()->get_nzone() ;
00283 int nz_deux = hole2.mp.get_mg()->get_nzone() ;
00284
00285 Scalar ntot_un (hole1.n_auto+hole1.n_comp) ;
00286 ntot_un = division_xpun (ntot_un, 0) ;
00287 ntot_un.raccord(1) ;
00288
00289 Scalar ntot_deux (hole2.n_auto+hole2.n_comp) ;
00290 ntot_deux = division_xpun (ntot_deux, 0) ;
00291 ntot_deux.raccord(1) ;
00292
00293
00294 double orientation_un = aa_auto_un.get_mp().get_rot_phi() ;
00295 assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00296 double orientation_deux = aa_auto_deux.get_mp().get_rot_phi() ;
00297 assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00298 int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00299
00300
00301
00302 for (int lig = 1 ; lig<=3 ; lig++)
00303 for (int col = lig ; col<=3 ; col++) {
00304
00305
00306 int ind = 1 ;
00307 if (lig !=3)
00308 ind *= -1 ;
00309 if (col != 3)
00310 ind *= -1 ;
00311 if (same_orient == 1)
00312 ind = 1 ;
00313
00314
00315 Scalar auxi_un (aa_tot_un(lig, col)/2.) ;
00316 auxi_un.dec_dzpuis(2) ;
00317 auxi_un = division_xpun (auxi_un, 0) ;
00318 auxi_un = auxi_un / ntot_un ;
00319 if (auxi_un.get_etat() != ETATZERO)
00320 auxi_un.raccord(1) ;
00321
00322
00323 Scalar auxi_deux (aa_tot_deux(lig, col)/2.) ;
00324 auxi_deux.dec_dzpuis(2) ;
00325 auxi_deux = division_xpun (auxi_deux, 0) ;
00326 auxi_deux = auxi_deux / ntot_deux ;
00327 if (auxi_deux.get_etat() != ETATZERO)
00328 auxi_deux.raccord(1) ;
00329
00330
00331 Scalar copie_un (aa_tot_un(lig, col)) ;
00332 copie_un.dec_dzpuis(2) ;
00333
00334 Scalar copie_deux (aa_tot_deux(lig, col)) ;
00335 copie_deux.dec_dzpuis(2) ;
00336
00337 double lim_un = hole1.mp.get_alpha()[1] + hole1.mp.get_beta()[1] ;
00338 double lim_deux = hole2.mp.get_alpha()[1] + hole2.mp.get_beta()[1] ;
00339
00340 Mtbl xabs_un (hole1.mp.xa) ;
00341 Mtbl yabs_un (hole1.mp.ya) ;
00342 Mtbl zabs_un (hole1.mp.za) ;
00343
00344 Mtbl xabs_deux (hole2.mp.xa) ;
00345 Mtbl yabs_deux (hole2.mp.ya) ;
00346 Mtbl zabs_deux (hole2.mp.za) ;
00347
00348 double xabs, yabs, zabs, air, theta, phi ;
00349
00350 if (auxi_un.get_etat() != ETATZERO){
00351
00352 for (int l=2 ; l<nz_un ; l++) {
00353
00354 int nr = hole1.mp.get_mg()->get_nr (l) ;
00355
00356 if (l==nz_un-1)
00357 nr -- ;
00358
00359 int np = hole1.mp.get_mg()->get_np (l) ;
00360 int nt = hole1.mp.get_mg()->get_nt (l) ;
00361
00362 for (int k=0 ; k<np ; k++)
00363 for (int j=0 ; j<nt ; j++)
00364 for (int i=0 ; i<nr ; i++) {
00365
00366 xabs = xabs_un (l, k, j, i) ;
00367 yabs = yabs_un (l, k, j, i) ;
00368 zabs = zabs_un (l, k, j, i) ;
00369
00370
00371 hole2.mp.convert_absolute
00372 (xabs, yabs, zabs, air, theta, phi) ;
00373
00374 if (air >= lim_deux)
00375
00376 auxi_un.set_grid_point(l, k, j, i) =
00377 copie_un.val_grid_point(l, k, j, i) /
00378 ntot_un.val_grid_point(l, k, j, i)/2. ;
00379 else
00380
00381 auxi_un.set_grid_point(l, k, j, i) =
00382 ind * auxi_deux.val_point (air, theta, phi) ;
00383
00384 }
00385
00386
00387 if (l==nz_un-1)
00388 for (int k=0 ; k<np ; k++)
00389 for (int j=0 ; j<nt ; j++)
00390 auxi_un.set_grid_point(nz_un-1, k, j, nr) = 0 ;
00391 }
00392 }
00393
00394 if (auxi_deux.get_etat() != ETATZERO){
00395
00396 for (int l=2 ; l<nz_deux ; l++) {
00397
00398 int nr = hole2.mp.get_mg()->get_nr (l) ;
00399
00400 if (l==nz_deux-1)
00401 nr -- ;
00402
00403 int np = hole2.mp.get_mg()->get_np (l) ;
00404 int nt = hole2.mp.get_mg()->get_nt (l) ;
00405
00406 for (int k=0 ; k<np ; k++)
00407 for (int j=0 ; j<nt ; j++)
00408 for (int i=0 ; i<nr ; i++) {
00409
00410 xabs = xabs_deux (l, k, j, i) ;
00411 yabs = yabs_deux (l, k, j, i) ;
00412 zabs = zabs_deux (l, k, j, i) ;
00413
00414
00415 hole1.mp.convert_absolute
00416 (xabs, yabs, zabs, air, theta, phi) ;
00417
00418 if (air >= lim_un)
00419
00420 auxi_deux.set_grid_point(l, k, j, i) =
00421 copie_deux.val_grid_point(l, k, j, i) /
00422 ntot_deux.val_grid_point(l, k, j, i) /2.;
00423 else
00424
00425 auxi_deux.set_grid_point(l, k, j, i) =
00426 ind * auxi_un.val_point (air, theta, phi) ;
00427 }
00428
00429 if (l==nz_deux-1)
00430 for (int k=0 ; k<np ; k++)
00431 for (int j=0 ; j<nt ; j++)
00432 auxi_un.set_grid_point(nz_deux-1, k, j, nr) = 0 ;
00433 }
00434 }
00435
00436 auxi_un.inc_dzpuis(2) ;
00437 auxi_deux.inc_dzpuis(2) ;
00438
00439 aa_un.set(lig, col) = auxi_un ;
00440 aa_deux.set(lig, col) = auxi_deux ;
00441 }
00442
00443 aa_un.change_triad(hole1.mp.get_bvect_spher()) ;
00444 aa_deux.change_triad(hole2.mp.get_bvect_spher()) ;
00445
00446 hole1.aa = aa_un ;
00447 hole2.aa = aa_deux ;
00448
00449 aa_auto_un.change_triad(hole1.mp.get_bvect_spher()) ;
00450 aa_auto_deux.change_triad(hole2.mp.get_bvect_spher()) ;
00451
00452 for (int lig=1 ; lig<=3 ; lig++)
00453 for (int col=lig ; col<=3 ; col++) {
00454 aa_auto_un.set(lig, col) = aa_un(lig, col)*hole1.decouple ;
00455 aa_auto_deux.set(lig, col) = aa_deux(lig, col)*hole2.decouple ;
00456 }
00457
00458 hole1.aa_auto = aa_auto_un ;
00459 hole2.aa_auto = aa_auto_deux ;
00460
00461 }
00462
00463 }
00464
00465
00466 void Bin_hor::decouple () {
00467
00468 int nz_un = hole1.mp.get_mg()->get_nzone() ;
00469 int nz_deux = hole2.mp.get_mg()->get_nzone() ;
00470
00471
00472 double distance = hole1.mp.get_ori_x() - hole2.mp.get_ori_x() ;
00473 double lim_un = distance/2. ;
00474 double lim_deux = distance/2. ;
00475 double int_un = distance/6. ;
00476 double int_deux = distance/6. ;
00477
00478
00479 Scalar fonction_f_un (hole1.mp) ;
00480 fonction_f_un = 0.5*pow(
00481 cos((hole1.mp.r-int_un)*M_PI/2./(lim_un-int_un)), 2.)+0.5 ;
00482 fonction_f_un.std_spectral_base();
00483
00484 Scalar fonction_g_un (hole1.mp) ;
00485 fonction_g_un = 0.5*pow
00486 (sin((hole1.mp.r-int_un)*M_PI/2./(lim_un-int_un)), 2.) ;
00487 fonction_g_un.std_spectral_base();
00488
00489 Scalar fonction_f_deux (hole2.mp) ;
00490 fonction_f_deux = 0.5*pow(
00491 cos((hole2.mp.r-int_deux)*M_PI/2./(lim_deux-int_deux)), 2.)+0.5 ;
00492 fonction_f_deux.std_spectral_base();
00493
00494 Scalar fonction_g_deux (hole2.mp) ;
00495 fonction_g_deux = 0.5*pow(
00496 sin((hole2.mp.r-int_deux)*M_PI/2./(lim_un-int_deux)), 2.) ;
00497 fonction_g_deux.std_spectral_base();
00498
00499
00500 Scalar decouple_un (hole1.mp) ;
00501 decouple_un.allocate_all() ;
00502 Scalar decouple_deux (hole2.mp) ;
00503 decouple_deux.allocate_all() ;
00504
00505 Mtbl xabs_un (hole1.mp.xa) ;
00506 Mtbl yabs_un (hole1.mp.ya) ;
00507 Mtbl zabs_un (hole1.mp.za) ;
00508
00509 Mtbl xabs_deux (hole2.mp.xa) ;
00510 Mtbl yabs_deux (hole2.mp.ya) ;
00511 Mtbl zabs_deux (hole2.mp.za) ;
00512
00513 double xabs, yabs, zabs, air_un, air_deux, theta, phi ;
00514
00515 for (int l=0 ; l<nz_un ; l++) {
00516 int nr = hole1.mp.get_mg()->get_nr (l) ;
00517
00518 if (l==nz_un-1)
00519 nr -- ;
00520
00521 int np = hole1.mp.get_mg()->get_np (l) ;
00522 int nt = hole1.mp.get_mg()->get_nt (l) ;
00523
00524 for (int k=0 ; k<np ; k++)
00525 for (int j=0 ; j<nt ; j++)
00526 for (int i=0 ; i<nr ; i++) {
00527
00528 xabs = xabs_un (l, k, j, i) ;
00529 yabs = yabs_un (l, k, j, i) ;
00530 zabs = zabs_un (l, k, j, i) ;
00531
00532
00533 hole1.mp.convert_absolute
00534 (xabs, yabs, zabs, air_un, theta, phi) ;
00535 hole2.mp.convert_absolute
00536 (xabs, yabs, zabs, air_deux, theta, phi) ;
00537
00538 if (air_un <= lim_un)
00539 if (air_un < int_un)
00540 decouple_un.set_grid_point(l, k, j, i) = 1 ;
00541 else
00542
00543 decouple_un.set_grid_point(l, k, j, i) =
00544 fonction_f_un.val_grid_point(l, k, j, i) ;
00545 else
00546 if (air_deux <= lim_deux)
00547 if (air_deux < int_deux)
00548 decouple_un.set_grid_point(l, k, j, i) = 0 ;
00549 else
00550
00551 decouple_un.set_grid_point(l, k, j, i) =
00552 fonction_g_deux.val_point (air_deux, theta, phi) ;
00553
00554 else
00555
00556 decouple_un.set_grid_point(l, k, j, i) = 0.5 ;
00557 }
00558
00559
00560 if (l==nz_un-1)
00561 for (int k=0 ; k<np ; k++)
00562 for (int j=0 ; j<nt ; j++)
00563 decouple_un.set_grid_point(nz_un-1, k, j, nr)=0.5 ;
00564 }
00565
00566 for (int l=0 ; l<nz_deux ; l++) {
00567 int nr = hole2.mp.get_mg()->get_nr (l) ;
00568
00569 if (l==nz_deux-1)
00570 nr -- ;
00571
00572 int np = hole2.mp.get_mg()->get_np (l) ;
00573 int nt = hole2.mp.get_mg()->get_nt (l) ;
00574
00575 for (int k=0 ; k<np ; k++)
00576 for (int j=0 ; j<nt ; j++)
00577 for (int i=0 ; i<nr ; i++) {
00578
00579 xabs = xabs_deux (l, k, j, i) ;
00580 yabs = yabs_deux (l, k, j, i) ;
00581 zabs = zabs_deux (l, k, j, i) ;
00582
00583
00584 hole1.mp.convert_absolute
00585 (xabs, yabs, zabs, air_un, theta, phi) ;
00586 hole2.mp.convert_absolute
00587 (xabs, yabs, zabs, air_deux, theta, phi) ;
00588
00589 if (air_deux <= lim_deux)
00590 if (air_deux < int_deux)
00591 decouple_deux.set_grid_point(l, k, j, i) = 1 ;
00592 else
00593
00594 decouple_deux.set_grid_point(l, k, j, i) =
00595 fonction_f_deux.val_grid_point(l, k, j, i) ;
00596 else
00597 if (air_un <= lim_un)
00598 if (air_un < int_un)
00599 decouple_deux.set_grid_point(l, k, j, i) = 0 ;
00600 else
00601
00602 decouple_deux.set_grid_point(l, k, j, i) =
00603 fonction_g_un.val_point (air_un, theta, phi) ;
00604
00605 else
00606
00607 decouple_deux.set_grid_point(l, k, j, i) = 0.5 ;
00608 }
00609
00610
00611 if (l==nz_deux-1)
00612 for (int k=0 ; k<np ; k++)
00613 for (int j=0 ; j<nt ; j++)
00614 decouple_deux.set_grid_point(nz_un-1, k, j, nr)=0.5 ;
00615 }
00616
00617 decouple_un.std_spectral_base() ;
00618 decouple_deux.std_spectral_base() ;
00619
00620 hole1.decouple = decouple_un ;
00621 hole2.decouple = decouple_deux ;
00622
00623 }