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
00030 char bhole_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole/bhole.C,v 1.13 2007/04/26 13:16:21 f_limousin Exp $" ;
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
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 #include <stdlib.h>
00159 #include <math.h>
00160
00161
00162 #include "tenseur.h"
00163 #include "bhole.h"
00164 #include "proto.h"
00165 #include "utilitaires.h"
00166 #include "et_bin_nsbh.h"
00167 #include "graphique.h"
00168
00169
00170 Bhole::Bhole (Map_af& mpi) : mp(mpi),
00171 rayon ((mp.get_alpha())[0]),
00172 omega(0), omega_local(0), rot_state(COROT), boost (new double[3]), regul(0),
00173 n_auto(mpi), n_comp(mpi), n_tot(mpi),
00174 psi_auto(mpi), psi_comp(mpi), psi_tot(mpi),
00175 grad_n_tot (mpi, 1, COV, mpi.get_bvect_cart()),
00176 grad_psi_tot (mpi, 1, COV, mpi.get_bvect_cart()),
00177 shift_auto(mpi, 1, CON, mpi.get_bvect_cart()),
00178 taij_auto(mpi, 2, CON, mpi.get_bvect_cart()),
00179 taij_comp(mpi, 2, CON, mpi.get_bvect_cart()),
00180 taij_tot (mpi, 2, CON, mpi.get_bvect_cart()),
00181 tkij_auto (mpi, 2, CON, mpi.get_bvect_cart()),
00182 tkij_tot (mpi, 2, CON, mpi.get_bvect_cart()),
00183 decouple (mpi) {
00184 for (int i=0 ; i<3 ; i++)
00185 boost[i] = 0 ;
00186 }
00187
00188
00189
00190 Bhole::Bhole (const Bhole& source) :
00191 mp(source.mp), rayon(source.rayon), omega (source.omega), omega_local(source.omega_local), rot_state(source.rot_state),
00192 boost (new double [3]), regul(source.regul), n_auto(source.n_auto),
00193 n_comp(source.n_comp), n_tot(source.n_tot), psi_auto(source.psi_auto),
00194 psi_comp(source.psi_comp), psi_tot(source.psi_tot),
00195 grad_n_tot (source.grad_n_tot), grad_psi_tot (source.grad_psi_tot),
00196 shift_auto(source.shift_auto),
00197 taij_auto (source.taij_auto),
00198 taij_comp(source.taij_comp), taij_tot(source.taij_tot),
00199 tkij_auto(source.tkij_auto), tkij_tot(source.tkij_tot), decouple(source.decouple) {
00200
00201 for (int i=0 ; i<3 ; i++)
00202 boost[i] = source.boost[i] ;
00203 }
00204
00205
00206 Bhole::~Bhole() {
00207 delete [] boost ;
00208 }
00209
00210
00211 void Bhole::operator= (const Bhole& source) {
00212
00213 assert (&mp == &source.mp) ;
00214
00215 rayon = source.rayon ;
00216 omega = source.omega ;
00217 omega_local = source.omega_local ;
00218 rot_state = source.rot_state ;
00219 for (int i=0 ; i<3 ; i++)
00220 boost[i] = source.boost[i] ;
00221 regul = regul ;
00222
00223 n_auto = source.n_auto ;
00224 n_comp = source.n_comp ;
00225 n_tot = source.n_tot ;
00226
00227 psi_auto = source.psi_auto ;
00228 psi_comp = source.psi_comp ;
00229 psi_tot = source.psi_tot ;
00230
00231 grad_n_tot = source.grad_n_tot ;
00232 grad_psi_tot = source.grad_psi_tot ;
00233
00234 shift_auto = source.shift_auto ;
00235
00236 taij_auto = source.taij_auto ;
00237 taij_comp = source.taij_comp ;
00238 taij_tot = source.taij_tot ;
00239
00240 tkij_auto = source.tkij_auto ;
00241 tkij_tot = source.tkij_tot ;
00242 decouple = source.decouple ;
00243 }
00244
00245
00246
00247 void Bhole::fait_n_comp (const Bhole& comp) {
00248
00249 n_comp.set_etat_qcq() ;
00250 n_comp.set().import_symy(comp.n_auto()) ;
00251 n_comp.set_std_base() ;
00252
00253 n_tot = n_comp + n_auto ;
00254 n_tot.set_std_base() ;
00255
00256 Tenseur auxi (comp.n_auto.gradient()) ;
00257 auxi.dec2_dzpuis() ;
00258
00259 Tenseur grad_comp (mp, 1, COV, *auxi.get_triad()) ;
00260 grad_comp.set_etat_qcq() ;
00261 grad_comp.set(0).import_symy(auxi(0)) ;
00262 grad_comp.set(1).import_asymy(auxi(1)) ;
00263 grad_comp.set(2).import_symy(auxi(2)) ;
00264 grad_comp.set_std_base() ;
00265 grad_comp.inc2_dzpuis() ;
00266 grad_comp.change_triad(mp.get_bvect_cart()) ;
00267
00268 grad_n_tot = n_auto.gradient() + grad_comp ;
00269 }
00270
00271
00272
00273 void Bhole::fait_psi_comp (const Bhole& comp) {
00274
00275 psi_comp.set_etat_qcq() ;
00276 psi_comp.set().import_symy(comp.psi_auto()) ;
00277 psi_comp.set_std_base() ;
00278
00279 psi_tot = psi_comp + psi_auto ;
00280 psi_tot.set_std_base() ;
00281
00282
00283 Tenseur auxi (comp.psi_auto.gradient()) ;
00284 auxi.dec2_dzpuis() ;
00285
00286 Tenseur grad_comp (mp, 1, COV, *auxi.get_triad()) ;
00287 grad_comp.set_etat_qcq() ;
00288 grad_comp.set(0).import_symy(auxi(0)) ;
00289 grad_comp.set(1).import_asymy(auxi(1)) ;
00290 grad_comp.set(2).import_symy(auxi(2)) ;
00291 grad_comp.set_std_base() ;
00292 grad_comp.inc2_dzpuis() ;
00293 grad_comp.change_triad(mp.get_bvect_cart()) ;
00294
00295 grad_psi_tot = psi_auto.gradient() + grad_comp ;
00296 }
00297
00298
00299
00300 void Bhole::fait_n_comp (const Et_bin_nsbh& comp) {
00301
00302 n_comp.set_etat_qcq() ;
00303 if (regul == 0)
00304 n_comp.set().import(comp.get_n_auto()()) ;
00305 else
00306 n_comp.set().import_symy(comp.get_n_auto()()) ;
00307
00308 n_comp.set_std_base() ;
00309
00310 n_tot = n_comp + n_auto ;
00311 n_tot.set_std_base() ;
00312
00313 Tenseur grad_comp (mp, 1, COV, mp.get_bvect_cart()) ;
00314 Tenseur auxi (comp.get_d_n_auto()) ;
00315 auxi.dec2_dzpuis() ;
00316 grad_comp.set_etat_qcq() ;
00317 if (regul == 0){
00318 grad_comp.set(0).import(auxi(0)) ;
00319 grad_comp.set(1).import(auxi(1)) ;
00320 grad_comp.set(2).import(auxi(2)) ;
00321 }
00322 else{
00323 grad_comp.set(0).import_symy(auxi(0)) ;
00324 grad_comp.set(1).import_asymy(auxi(1)) ;
00325 grad_comp.set(2).import_symy(auxi(2)) ;
00326 }
00327 grad_comp.set_std_base() ;
00328 grad_comp.inc2_dzpuis() ;
00329 grad_comp.set_triad( *(auxi.get_triad()) ) ;
00330 grad_comp.change_triad(mp.get_bvect_cart()) ;
00331
00332 grad_n_tot = n_auto.gradient() + grad_comp ;
00333 }
00334
00335
00336
00337 void Bhole::fait_psi_comp (const Et_bin_nsbh& comp) {
00338
00339 psi_comp.set_etat_qcq() ;
00340 if (regul == 0)
00341 psi_comp.set().import(comp.get_confpsi_auto()()) ;
00342 else
00343 psi_comp.set().import_symy(comp.get_confpsi_auto()()) ;
00344 psi_comp.set_std_base() ;
00345
00346 psi_tot = psi_comp + psi_auto ;
00347 psi_tot.set_std_base() ;
00348
00349 Tenseur grad_comp (mp, 1, COV, mp.get_bvect_cart()) ;
00350 Tenseur auxi (comp.get_d_confpsi_auto()) ;
00351 auxi.dec2_dzpuis() ;
00352 grad_comp.set_etat_qcq() ;
00353 if (regul == 0){
00354 grad_comp.set(0).import(auxi(0)) ;
00355 grad_comp.set(1).import(auxi(1)) ;
00356 grad_comp.set(2).import(auxi(2)) ;
00357 }
00358 else{
00359 grad_comp.set(0).import_symy(auxi(0)) ;
00360 grad_comp.set(1).import_asymy(auxi(1)) ;
00361 grad_comp.set(2).import_symy(auxi(2)) ;
00362 }
00363 grad_comp.set_std_base() ;
00364 grad_comp.inc2_dzpuis() ;
00365 grad_comp.set_triad( *(auxi.get_triad()) ) ;
00366 grad_comp.change_triad(mp.get_bvect_cart()) ;
00367
00368 grad_psi_tot = psi_auto.gradient() + grad_comp ;
00369 }
00370
00371
00372 void Bhole::fait_taij_auto () {
00373
00374 if (shift_auto.get_etat() == ETATZERO)
00375 taij_auto.set_etat_zero() ;
00376 else {
00377 Tenseur grad (shift_auto.gradient()) ;
00378 Tenseur trace (mp) ;
00379 trace = grad(0, 0)+grad(1, 1)+grad(2, 2) ;
00380
00381 taij_auto.set_etat_qcq() ;
00382 taij_auto.set_std_base() ;
00383 for (int i=0 ; i<3 ; i++) {
00384 for (int j=i+1 ; j<3 ; j++)
00385 taij_auto.set(i, j) = grad(i, j)+grad(j, i) ;
00386 taij_auto.set(i, i) = 2*grad(i, i) -2./3.*trace() ;
00387 }
00388
00389 for (int i=0 ; i<3 ; i++)
00390 for (int j=0 ; j<3 ; j++)
00391 taij_auto.set(i, j).raccord(1) ;
00392 }
00393 }
00394
00395
00396 void Bhole::regularise_shift (const Tenseur& shift_comp) {
00397 regul = regle (shift_auto, shift_comp, omega, omega_local) ;
00398 }
00399
00400
00401
00402 void Bhole::init_bhole () {
00403
00404 Cmp auxi(mp) ;
00405
00406 auxi = 1./2.-rayon/mp.r ;
00407 auxi.annule(0);
00408 auxi.set_dzpuis(0) ;
00409 n_auto = auxi;
00410 n_auto.set_std_base() ;
00411 n_auto.set().raccord(1) ;
00412 n_comp =0.5;
00413 n_comp.set_std_base() ;
00414 n_tot = n_comp+n_auto ;
00415
00416 auxi = 0.5+rayon/mp.r ;
00417 auxi.annule(0);
00418 auxi.set_dzpuis(0) ;
00419 psi_auto = auxi;
00420 psi_auto.set_std_base() ;
00421 psi_auto.set().raccord(1) ;
00422 psi_comp = 0.5;
00423 psi_comp.set_std_base() ;
00424 psi_tot = psi_comp+psi_auto ;
00425
00426 grad_n_tot = n_tot.gradient() ;
00427 grad_psi_tot = psi_tot.gradient() ;
00428
00429 shift_auto.set_etat_zero() ;
00430 taij_auto.set_etat_zero();
00431 taij_comp.set_etat_zero();
00432 taij_tot.set_etat_zero() ;
00433 tkij_auto.set_etat_zero() ;
00434 tkij_tot.set_etat_zero();
00435 decouple.set_etat_zero() ;
00436 }
00437
00438 void Bhole::init_bhole_seul () {
00439
00440 Cmp auxi(mp) ;
00441
00442 auxi = (1-rayon/mp.r)/(1+rayon/mp.r) ;
00443 auxi.annule(0);
00444 auxi.set_val_inf(1) ;
00445 auxi.set_dzpuis(0) ;
00446 n_auto = auxi;
00447 n_auto.set_std_base() ;
00448 n_auto.set().raccord(1) ;
00449 n_comp.set_etat_zero();
00450 n_tot.set_etat_zero() ;
00451
00452 auxi = 1+rayon/mp.r ;
00453 auxi.annule(0);
00454 auxi.set_val_inf(1) ;
00455 auxi.set_dzpuis(0) ;
00456 psi_auto = auxi;
00457 psi_auto.set_std_base() ;
00458 psi_auto.set().raccord(1) ;
00459 psi_comp.set_etat_zero() ;
00460 psi_tot.set_etat_zero() ;
00461
00462 grad_n_tot = n_tot.gradient() ;
00463 grad_psi_tot = psi_tot.gradient() ;
00464
00465 shift_auto.set_etat_zero() ;
00466 taij_auto.set_etat_zero();
00467 taij_comp.set_etat_zero();
00468 taij_tot.set_etat_zero() ;
00469 tkij_auto.set_etat_zero() ;
00470 tkij_tot.set_etat_zero();
00471 decouple.set_etat_zero() ;
00472 }
00473
00474
00475 void Bhole::sauve (FILE* fich) const {
00476
00477 fwrite_be (&omega, sizeof(double), 1, fich) ;
00478 fwrite_be (&omega_local, sizeof(double), 1, fich) ;
00479 fwrite_be (&rot_state, sizeof(int), 1, fich) ;
00480 fwrite_be (boost, sizeof(double), 3, fich) ;
00481 fwrite_be (®ul, sizeof(double), 1, fich) ;
00482
00483 n_auto.sauve(fich) ;
00484 psi_auto.sauve(fich) ;
00485 shift_auto.sauve(fich) ;
00486 }
00487
00488
00489 Bhole::Bhole(Map_af& mpi, FILE* fich, bool old) :
00490 mp(mpi), rayon ((mp.get_alpha())[0]),
00491 boost (new double[3]), n_auto(mpi), n_comp(mpi), n_tot(mpi),
00492 psi_auto(mpi), psi_comp(mpi), psi_tot(mpi),
00493 grad_n_tot (mpi, 1, COV, mpi.get_bvect_cart()),
00494 grad_psi_tot (mpi, 1, COV, mpi.get_bvect_cart()),
00495 shift_auto(mpi, 1, CON, mpi.get_bvect_cart()),
00496 taij_auto(mpi, 2, CON, mpi.get_bvect_cart()),
00497 taij_comp(mpi, 2, CON, mpi.get_bvect_cart()),
00498 taij_tot (mpi, 2, CON, mpi.get_bvect_cart()),
00499 tkij_auto (mpi, 2, CON, mpi.get_bvect_cart()) ,
00500 tkij_tot (mpi, 2, CON, mpi.get_bvect_cart()) ,
00501 decouple (mpi) {
00502
00503 fread_be(&omega, sizeof(double), 1, fich) ;
00504
00505 if (!old) {
00506 fread_be(&omega_local, sizeof(double), 1, fich) ;
00507 fread_be(&rot_state, sizeof(int), 1, fich) ;
00508 }
00509 fread_be(boost, sizeof(double), 3, fich) ;
00510 fread_be(®ul, sizeof(double), 1, fich) ;
00511
00512 Tenseur n_auto_file (mp, fich) ;
00513 n_auto = n_auto_file ;
00514
00515 Tenseur psi_auto_file (mp, fich) ;
00516 psi_auto = psi_auto_file ;
00517
00518 Tenseur shift_auto_file (mp, mp.get_bvect_cart(), fich) ;
00519 shift_auto = shift_auto_file ;
00520
00521 grad_n_tot.set_etat_qcq() ;
00522 grad_psi_tot.set_etat_zero() ;
00523
00524 taij_auto.set_etat_zero();
00525 taij_comp.set_etat_zero();
00526 taij_tot.set_etat_zero() ;
00527
00528 tkij_auto.set_etat_zero() ;
00529 tkij_tot.set_etat_zero() ;
00530 decouple.set_etat_zero() ;
00531 }
00532
00533
00534
00535
00536
00537
00538 double Bhole::area() const {
00539
00540 Cmp integrant( pow(psi_tot(), 4) ) ;
00541
00542 integrant.std_base_scal() ;
00543 integrant.raccord(1) ;
00544
00545 return mp.integrale_surface(integrant, rayon) ;
00546
00547 }
00548
00549
00550
00551
00552
00553 double Bhole::local_momentum() const {
00554
00555 Cmp xx (mp) ;
00556 xx = mp.x ;
00557 xx.std_base_scal() ;
00558
00559 Cmp yy (mp) ;
00560 yy = mp.y ;
00561 yy.std_base_scal() ;
00562
00563 Tenseur vecteur (mp, 1, CON, mp.get_bvect_cart()) ;
00564 vecteur.set_etat_qcq() ;
00565 for (int i=0 ; i<3 ; i++)
00566 vecteur.set(i) = (-yy*tkij_tot(0, i)+xx*tkij_tot(1, i)) ;
00567 vecteur.set_std_base() ;
00568 vecteur.annule(mp.get_mg()->get_nzone()-1) ;
00569 vecteur.change_triad (mp.get_bvect_spher()) ;
00570
00571 Cmp integrant (pow(psi_tot(), 6)*vecteur(0)) ;
00572 integrant.std_base_scal() ;
00573 double moment = mp.integrale_surface(integrant, rayon)/8/M_PI ;
00574
00575 return moment ;
00576 }
00577