1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773
|
/*
* Copyright- (c) 2004-2005 Francois Limousin
* Jose-Luis Jaramillo
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char binhor_equations_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_equations.C,v 1.21 2014/10/13 08:52:42 j_novak Exp $" ;
/*
* $Id: binhor_equations.C,v 1.21 2014/10/13 08:52:42 j_novak Exp $
* $Log: binhor_equations.C,v $
* Revision 1.21 2014/10/13 08:52:42 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.20 2014/10/06 15:13:01 j_novak
* Modified #include directives to use c++ syntax.
*
* Revision 1.19 2008/02/06 18:20:02 f_limousin
* Fixed an error in the triad
*
* Revision 1.18 2007/08/22 16:12:33 f_limousin
* Changed the name of the function computing \tilde{\gamma}_{ij}
*
* Revision 1.17 2007/04/13 15:28:55 f_limousin
* Lots of improvements, generalisation to an arbitrary state of
* rotation, implementation of the spatial metric given by Samaya.
*
* Revision 1.16 2006/08/01 14:37:19 f_limousin
* New version
*
* Revision 1.15 2006/06/29 08:51:00 f_limousin
* *** empty log message ***
*
* Revision 1.14 2006/05/24 16:56:37 f_limousin
* Many small modifs.
*
* Revision 1.13 2005/11/15 14:04:00 f_limousin
* Minor change to control the resolution of the equation for psi.
*
* Revision 1.12 2005/10/23 16:39:43 f_limousin
* Simplification of the equation in the case of a conformally
* flat metric and maximal slicing
*
* Revision 1.11 2005/09/13 18:33:15 f_limousin
* New function vv_bound_cart_bin(double) for computing binaries with
* berlin condition for the shift vector.
* Suppress all the symy and asymy in the importations.
*
* Revision 1.10 2005/07/11 08:21:57 f_limousin
* Implementation of a new boundary condition for the lapse in the binary
* case : boundary_nn_Dir_lapl().
*
* Revision 1.9 2005/06/09 16:12:04 f_limousin
* Implementation of amg_mom_adm().
*
* Revision 1.8 2005/04/29 14:02:44 f_limousin
* Important changes : manage the dependances between quantities (for
* instance psi and psi4). New function write_global(ost).
*
* Revision 1.7 2005/03/10 17:21:52 f_limousin
* Add the Berlin boundary condition for the shift.
* Some changes to avoid warnings.
*
* Revision 1.6 2005/03/03 10:29:02 f_limousin
* Delete omega in the parameters of the function boundary_beta_z().
*
* Revision 1.5 2005/02/24 17:25:23 f_limousin
* The boundary conditions for psi, N and beta are now parameters in
* par_init.d and par_coal.d.
*
* Revision 1.4 2005/02/11 18:21:38 f_limousin
* Dirichlet_binaire and neumann_binaire are taking Scalars as arguments
* instead of Cmps.
*
* Revision 1.3 2005/02/07 10:46:28 f_limousin
* Many changes !! The sources are written differently to minimize the
* numerical error, the boundary conditions are changed...
*
* Revision 1.2 2004/12/31 15:41:26 f_limousin
* Correction of an error
*
* Revision 1.1 2004/12/29 16:11:34 f_limousin
* First version
*
*
* $Header: /cvsroot/Lorene/C++/Source/Bin_hor/binhor_equations.C,v 1.21 2014/10/13 08:52:42 j_novak Exp $
*
*/
//standard
#include <cstdlib>
#include <cmath>
// Lorene
#include "nbr_spx.h"
#include "tensor.h"
#include "tenseur.h"
#include "isol_hor.h"
#include "proto.h"
#include "utilitaires.h"
//#include "graphique.h"
// Resolution for the lapse
// ------------------------
namespace Lorene {
void Bin_hor::solve_lapse (double precision, double relax, int bound_nn,
double lim_nn) {
assert ((relax >0) && (relax<=1)) ;
cout << "-----------------------------------------------" << endl ;
cout << "Resolution LAPSE" << endl ;
Scalar lapse_un_old (hole1.n_auto) ;
Scalar lapse_deux_old (hole2.n_auto) ;
Sym_tensor taa_un = hole1.aa.up_down(hole1.tgam) ;
Scalar aa_quad_un = contract(taa_un, 0, 1, hole1.aa_auto, 0, 1) ;
Sym_tensor taa_deux = hole2.aa.up_down(hole2.tgam) ;
Scalar aa_quad_deux = contract(taa_deux, 0, 1, hole2.aa_auto, 0, 1) ;
Tensor hdirac1 (contract((hole1.hh).derive_cov(hole1.ff),0,2)) ;
Tensor hdirac2 (contract((hole2.hh).derive_cov(hole2.ff),0,2)) ;
// Source 1
// --------
Scalar source_un (hole1.mp) ;
// Conformally flat
/*
source_un = hole1.get_psi4()*hole1.nn*aa_quad_un
-2.*contract(hole1.dn, 0, hole1.psi_auto
.derive_con(hole1.ff), 0)/hole1.psi ;
*/
source_un = hole1.get_psi4()*( hole1.nn*( aa_quad_un + 0.3333333333333333 *
hole1.trK*hole1.trK*hole1.decouple)
- hole1.trK_point*hole1.decouple )
-2.*contract(contract(hole1.hh, 0, hole1.n_auto
.derive_cov(hole1.ff), 0), 0, hole1.dpsi, 0)/hole1.psi
-2.*contract(hole1.dn, 0, hole1.psi_auto
.derive_con(hole1.ff), 0)/hole1.psi ;
- contract(hdirac1, 0, hole1.n_auto.derive_cov(hole1.ff), 0) ;
Scalar tmp_un (hole1.mp) ;
tmp_un = hole1.get_psi4()* contract(hole1.beta_auto, 0, hole1.trK.
derive_cov(hole1.ff), 0)
- contract( hole1.hh, 0, 1, hole1.n_auto.derive_cov(hole1.ff)
.derive_cov(hole1.ff), 0, 1 ) ;
tmp_un.inc_dzpuis() ; // dzpuis: 3 -> 4
source_un += tmp_un ;
// Source 2
// ---------
Scalar source_deux (hole2.mp) ;
// Conformally flat
/*
source_deux = hole2.get_psi4()*hole2.nn*aa_quad_deux
-2.*contract(hole2.dn, 0, hole2.psi_auto
.derive_con(hole2.ff), 0)/hole2.psi ;
*/
source_deux = hole2.get_psi4()*( hole2.nn*( aa_quad_deux + 0.3333333333333333
* hole2.trK*hole2.trK*hole2.decouple)
- hole2.trK_point*hole2.decouple )
-2.*contract(contract(hole2.hh, 0, hole2.n_auto
.derive_cov(hole2.ff), 0), 0, hole2.dpsi, 0)/hole2.psi
-2.*contract(hole2.dn, 0, hole2.psi_auto
.derive_con(hole2.ff), 0)/hole2.psi ;
- contract(hdirac2, 0, hole2.n_auto.derive_cov(hole2.ff), 0) ;
Scalar tmp_deux (hole2.mp) ;
tmp_deux = hole2.get_psi4()* contract(hole2.beta_auto, 0, hole2.trK.
derive_cov(hole2.ff), 0)
- contract( hole2.hh, 0, 1, hole2.n_auto.derive_cov(hole2.ff)
.derive_cov(hole2.ff), 0, 1 ) ;
tmp_deux.inc_dzpuis() ; // dzpuis: 3 -> 4
source_deux += tmp_deux ;
cout << "source lapse" << endl << norme(source_un) << endl ;
// Boundary conditions and resolution
// -----------------------------------
Valeur lim_un (hole1.mp.get_mg()-> get_angu()) ;
Valeur lim_deux (hole1.mp.get_mg()-> get_angu()) ;
Scalar n_un_temp (hole1.n_auto) ;
Scalar n_deux_temp (hole2.n_auto) ;
switch (bound_nn) {
case 0 : {
lim_un = hole1.boundary_nn_Dir(lim_nn) ;
lim_deux = hole2.boundary_nn_Dir(lim_nn) ;
n_un_temp = n_un_temp - 1./2. ;
n_deux_temp = n_deux_temp - 1./2. ;
dirichlet_binaire (source_un, source_deux, lim_un, lim_deux,
n_un_temp, n_deux_temp, 0, precision) ;
break ;
}
case 1 : {
lim_un = hole1.boundary_nn_Neu(lim_nn) ;
lim_deux = hole2.boundary_nn_Neu(lim_nn) ;
neumann_binaire (source_un, source_deux, lim_un, lim_deux,
n_un_temp, n_deux_temp, 0, precision) ;
break ;
}
default : {
cout << "Unexpected type of boundary conditions for the lapse!"
<< endl
<< " bound_nn = " << bound_nn << endl ;
abort() ;
break ;
}
} // End of switch
n_un_temp = n_un_temp + 1./2. ;
n_deux_temp = n_deux_temp + 1./2. ;
n_un_temp.raccord(3) ;
n_deux_temp.raccord(3) ;
// Check: has the Poisson equation been correctly solved ?
// -----------------------------------------------------
int nz = hole1.mp.get_mg()->get_nzone() ;
cout << "lapse auto" << endl << norme (n_un_temp) << endl ;
Tbl tdiff_nn = diffrel(n_un_temp.laplacian(), source_un) ;
cout <<
"Relative error in the resolution of the equation for the lapse : "
<< endl ;
for (int l=0; l<nz; l++) {
cout << tdiff_nn(l) << " " ;
}
cout << endl ;
// Relaxation :
// -------------
n_un_temp = relax*n_un_temp + (1-relax)*lapse_un_old ;
n_deux_temp = relax*n_deux_temp + (1-relax)*lapse_deux_old ;
hole1.n_auto = n_un_temp ;
hole2.n_auto = n_deux_temp ;
hole1.n_comp_import(hole2) ;
hole2.n_comp_import(hole1) ;
}
// Resolution for Psi
// -------------------
void Bin_hor::solve_psi (double precision, double relax, int bound_psi) {
assert ((relax>0) && (relax<=1)) ;
cout << "-----------------------------------------------" << endl ;
cout << "Resolution PSI" << endl ;
Scalar psi_un_old (hole1.psi_auto) ;
Scalar psi_deux_old (hole2.psi_auto) ;
Sym_tensor taa_un = hole1.aa.up_down(hole1.tgam) ;
Scalar aa_quad_un = contract(taa_un, 0, 1, hole1.aa_auto, 0, 1) ;
Sym_tensor taa_deux = hole2.aa.up_down(hole2.tgam) ;
Scalar aa_quad_deux = contract(taa_deux, 0, 1, hole2.aa_auto, 0, 1) ;
Tensor hdirac1 (contract((hole1.hh).derive_cov(hole1.ff),0,2)) ;
Tensor hdirac2 (contract((hole2.hh).derive_cov(hole2.ff),0,2)) ;
// Source 1
// ---------
Scalar source_un (hole1.mp) ;
/*
// Conformally flat source
source_un.annule_hard() ;
source_un.set_dzpuis(4) ;
source_un += - hole1.psi*hole1.get_psi4()* 0.125* aa_quad_un ;
source_un.std_spectral_base() ;
*/
Scalar tmp_un (hole1.mp) ;
tmp_un = 0.125* hole1.psi_auto * (hole1.tgam).ricci_scal()
- contract(hole1.hh, 0, 1, hole1.psi_auto.derive_cov(hole1.ff)
.derive_cov(hole1.ff), 0, 1 ) ;
tmp_un.inc_dzpuis() ; // dzpuis : 3 -> 4
tmp_un -= contract(hdirac1, 0, hole1.psi_auto
.derive_cov(hole1.ff), 0) ;
source_un = tmp_un - hole1.psi*hole1.get_psi4()* ( 0.125* aa_quad_un
- 8.33333333333333e-2* hole1.trK*hole1.trK*hole1.decouple ) ;
source_un.std_spectral_base() ;
// Source 2
// ---------
Scalar source_deux (hole2.mp) ;
/*
// Conformally flat source
source_deux.annule_hard() ;
source_deux.set_dzpuis(4) ;
source_deux += - hole2.psi*hole2.get_psi4()* 0.125* aa_quad_deux ;
source_deux.std_spectral_base() ;
*/
Scalar tmp_deux (hole2.mp) ;
tmp_deux = 0.125* hole2.psi_auto * (hole2.tgam).ricci_scal()
- contract(hole2.hh, 0, 1, hole2.psi_auto.derive_cov(hole2.ff)
.derive_cov(hole2.ff), 0, 1 ) ;
tmp_deux.inc_dzpuis() ; // dzpuis : 3 -> 4
tmp_deux -= contract(hdirac2, 0, hole2.psi_auto
.derive_cov(hole2.ff), 0) ;
source_deux = tmp_deux - hole2.psi*hole2.get_psi4()* ( 0.125* aa_quad_deux
- 8.33333333333333e-2* hole2.trK*hole2.trK*hole2.decouple ) ;
source_deux.std_spectral_base() ;
cout << "source psi" << endl << norme(source_un) << endl ;
// Boundary conditions and resolution :
// ------------------------------------
Valeur lim_un (hole1.mp.get_mg()-> get_angu()) ;
Valeur lim_deux (hole1.mp.get_mg()-> get_angu()) ;
Scalar psi_un_temp (hole1.psi_auto) ;
Scalar psi_deux_temp (hole2.psi_auto) ;
switch (bound_psi) {
case 0 : {
lim_un = hole1.boundary_psi_app_hor() ;
lim_deux = hole2.boundary_psi_app_hor() ;
neumann_binaire (source_un, source_deux, lim_un, lim_deux,
psi_un_temp, psi_deux_temp, 0, precision) ;
break ;
}
default : {
cout << "Unexpected type of boundary conditions for psi!"
<< endl
<< " bound_psi = " << bound_psi << endl ;
abort() ;
break ;
}
} // End of switch
psi_un_temp = psi_un_temp + 1./2. ;
psi_deux_temp = psi_deux_temp + 1./2. ;
psi_un_temp.raccord(3) ;
psi_deux_temp.raccord(3) ;
// Check: has the Poisson equation been correctly solved ?
// -----------------------------------------------------
int nz = hole1.mp.get_mg()->get_nzone() ;
cout << "psi auto" << endl << norme (psi_un_temp) << endl ;
Tbl tdiff_psi = diffrel(psi_un_temp.laplacian(), source_un) ;
cout <<
"Relative error in the resolution of the equation for psi : "
<< endl ;
for (int l=0; l<nz; l++) {
cout << tdiff_psi(l) << " " ;
}
cout << endl ;
// Relaxation :
// -------------
psi_un_temp = relax*psi_un_temp + (1-relax)*psi_un_old ;
psi_deux_temp = relax*psi_deux_temp + (1-relax)*psi_deux_old ;
hole1.psi_auto = psi_un_temp ;
hole2.psi_auto = psi_deux_temp ;
hole1.psi_comp_import(hole2) ;
hole2.psi_comp_import(hole1) ;
hole1.set_der_0x0() ;
hole2.set_der_0x0() ;
//set_hh_Samaya() ;
}
// Resolution for shift with omega fixed.
// --------------------------------------
void Bin_hor::solve_shift (double precision, double relax, int bound_beta,
double omega_eff) {
cout << "------------------------------------------------" << endl ;
cout << "Resolution shift : Omega = " << omega << endl ;
Sym_tensor taa_un = hole1.aa.up_down(hole1.tgam) ;
Scalar aa_quad_un = contract(taa_un, 0, 1, hole1.aa_auto, 0, 1) ;
Sym_tensor taa_deux = hole2.aa.up_down(hole2.tgam) ;
Scalar aa_quad_deux = contract(taa_deux, 0, 1, hole2.aa_auto, 0, 1) ;
Tensor hdirac1 (contract((hole1.hh).derive_cov(hole1.ff),0,2)) ;
Tensor hdirac2 (contract((hole2.hh).derive_cov(hole2.ff),0,2)) ;
// Source 1
// ---------
Vector source_un (hole1.mp, CON, hole1.mp.get_bvect_spher()) ;
/*
// Conformally flat source
source_un = 2.* contract(hole1.aa_auto, 1, hole1.dn, 0)
- 12.*hole1.nn*contract(hole1.aa_auto, 1, hole1.dpsi, 0)
/hole1.psi;
*/
Vector tmp_vect_un (hole1.mp, CON, hole1.mp.get_bvect_spher()) ;
source_un = 2.* contract(hole1.aa_auto, 1, hole1.dn, 0)
- 12.*hole1.nn*contract(hole1.aa_auto, 1, hole1.dpsi, 0)
/hole1.psi;
tmp_vect_un = 2./3.* hole1.trK.derive_con(hole1.tgam)
* hole1.decouple ;
tmp_vect_un.inc_dzpuis() ;
source_un += 2.* hole1.nn * ( tmp_vect_un
- contract(hole1.tgam.connect().get_delta(), 1, 2,
hole1.aa_auto, 0, 1) ) ;
Vector vtmp_un = contract(hole1.hh, 0, 1,
hole1.beta_auto.derive_cov(hole1.ff)
.derive_cov(hole1.ff), 1, 2)
+ 1./3.*contract(hole1.hh, 1, hole1.beta_auto
.divergence(hole1.ff).derive_cov(hole1.ff), 0)
- hdirac1.derive_lie(hole1.beta_auto)
+ hole1.gamt_point.divergence(hole1.ff)*hole1.decouple ;
vtmp_un.inc_dzpuis() ; // dzpuis: 3 -> 4
source_un -= vtmp_un ;
source_un += 2./3.* hole1.beta_auto.divergence(hole1.ff)
* hdirac1 ;
source_un.std_spectral_base() ;
// Source 2
// ---------
Vector source_deux (hole2.mp, CON, hole2.mp.get_bvect_spher()) ;
/*
// Conformally flat source
source_deux = 2.* contract(hole2.aa_auto, 1, hole2.dn, 0)
- 12.*hole2.nn*contract(hole2.aa_auto, 1, hole2.dpsi, 0)
/hole2.psi;
*/
Vector tmp_vect_deux (hole2.mp, CON, hole2.mp.get_bvect_spher()) ;
source_deux = 2.* contract(hole2.aa_auto, 1, hole2.dn, 0)
- 12.*hole2.nn*contract(hole2.aa_auto, 1, hole2.dpsi, 0)
/hole2.psi;
tmp_vect_deux = 2./3.* hole2.trK.derive_con(hole2.tgam)
* hole2.decouple ;
tmp_vect_deux.inc_dzpuis() ;
source_deux += 2.* hole2.nn * ( tmp_vect_deux
- contract(hole2.tgam.connect().get_delta(), 1, 2,
hole2.aa*hole2.decouple, 0, 1) ) ;
Vector vtmp_deux = contract(hole2.hh, 0, 1,
hole2.beta_auto.derive_cov(hole2.ff)
.derive_cov(hole2.ff), 1, 2)
+ 1./3.*contract(hole2.hh, 1, hole2.beta_auto
.divergence(hole2.ff).derive_cov(hole2.ff), 0)
- hdirac2.derive_lie(hole2.beta_auto)
+ hole2.gamt_point.divergence(hole2.ff)*hole2.decouple ;
vtmp_deux.inc_dzpuis() ; // dzpuis: 3 -> 4
source_deux -= vtmp_deux ;
source_deux += 2./3.* hole2.beta_auto.divergence(hole2.ff)
* hdirac2 ;
source_deux.std_spectral_base() ;
Vector source_1 (source_un) ;
Vector source_2 (source_deux) ;
source_1.change_triad(hole1.mp.get_bvect_cart()) ;
source_2.change_triad(hole2.mp.get_bvect_cart()) ;
cout << "source shift_x" << endl << norme(source_1(1)) << endl ;
cout << "source shift_y" << endl << norme(source_1(2)) << endl ;
cout << "source shift_z" << endl << norme(source_1(3)) << endl ;
// Filter for high frequencies.
for (int i=1 ; i<=3 ; i++) {
source_un.set(i).filtre(4) ;
source_deux.set(i).filtre(4) ;
}
// Boundary conditions
// --------------------
Valeur lim_x_un (hole1.mp.get_mg()-> get_angu()) ;
Valeur lim_y_un (hole1.mp.get_mg()-> get_angu()) ;
Valeur lim_z_un (hole1.mp.get_mg()-> get_angu()) ;
Valeur lim_x_deux (hole2.mp.get_mg()-> get_angu()) ;
Valeur lim_y_deux (hole2.mp.get_mg()-> get_angu()) ;
Valeur lim_z_deux (hole2.mp.get_mg()-> get_angu()) ;
switch (bound_beta) {
case 0 : {
lim_x_un = hole1.boundary_beta_x(omega, omega_eff) ;
lim_y_un = hole1.boundary_beta_y(omega, omega_eff) ;
lim_z_un = hole1.boundary_beta_z() ;
lim_x_deux = hole2.boundary_beta_x(omega, omega_eff) ;
lim_y_deux = hole2.boundary_beta_y(omega, omega_eff) ;
lim_z_deux = hole2.boundary_beta_z() ;
break ;
}
default : {
cout << "Unexpected type of boundary conditions for beta!"
<< endl
<< " bound_beta = " << bound_beta << endl ;
abort() ;
break ;
}
} // End of switch
// We solve :
// -----------
Vector beta_un_old (hole1.beta_auto) ;
Vector beta_deux_old (hole2.beta_auto) ;
Vector beta1 (hole1.beta_auto) ;
Vector beta2 (hole2.beta_auto) ;
poisson_vect_binaire (1./3., source_un, source_deux,
lim_x_un, lim_y_un, lim_z_un,
lim_x_deux, lim_y_deux, lim_z_deux,
beta1, beta2, 0, precision) ;
beta1.change_triad(hole1.mp.get_bvect_cart()) ;
beta2.change_triad(hole2.mp.get_bvect_cart()) ;
for (int i=1 ; i<=3 ; i++) {
beta1.set(i).raccord(3) ;
beta2.set(i).raccord(3) ;
}
cout << "shift_auto x" << endl << norme(beta1(1)) << endl ;
cout << "shift_auto y" << endl << norme(beta1(2)) << endl ;
cout << "shift_auto z" << endl << norme(beta1(3)) << endl ;
beta1.change_triad(hole1.mp.get_bvect_spher()) ;
beta2.change_triad(hole2.mp.get_bvect_spher()) ;
// Check: has the Poisson equation been correctly solved ?
// -----------------------------------------------------
int nz = hole1.mp.get_mg()->get_nzone() ;
Vector lap_beta = (beta1.derive_con(hole1.ff)).divergence(hole1.ff)
+ 1./3.* beta1.divergence(hole1.ff).derive_con(hole1.ff) ;
source_un.dec_dzpuis() ;
Tbl tdiff_beta_r = diffrel(lap_beta(1), source_un(1)) ;
Tbl tdiff_beta_t = diffrel(lap_beta(2), source_un(2)) ;
Tbl tdiff_beta_p = diffrel(lap_beta(3), source_un(3)) ;
cout <<
"Relative error in the resolution of the equation for beta : "
<< endl ;
cout << "r component : " ;
for (int l=0; l<nz; l++) {
cout << tdiff_beta_r(l) << " " ;
}
cout << endl ;
cout << "t component : " ;
for (int l=0; l<nz; l++) {
cout << tdiff_beta_t(l) << " " ;
}
cout << endl ;
cout << "p component : " ;
for (int l=0; l<nz; l++) {
cout << tdiff_beta_p(l) << " " ;
}
cout << endl ;
// Relaxation
// -----------
Vector beta1_new (hole1.mp, CON, hole1.mp.get_bvect_spher()) ;
Vector beta2_new (hole2.mp, CON, hole2.mp.get_bvect_spher()) ;
// Construction of Omega d/dphi
// ----------------------------
Vector omdsdp1 (hole1.mp, CON, hole1.mp.get_bvect_cart()) ;
Scalar yya1 (hole1.mp) ;
yya1 = hole1.mp.ya ;
Scalar xxa1 (hole1.mp) ;
xxa1 = hole1.mp.xa ;
if (fabs(hole1.mp.get_rot_phi()) < 1e-10){
omdsdp1.set(1) = - omega * yya1 ;
omdsdp1.set(2) = omega * xxa1 ;
omdsdp1.set(3).annule_hard() ;
}
else{
omdsdp1.set(1) = omega * yya1 ;
omdsdp1.set(2) = - omega * xxa1 ;
omdsdp1.set(3).annule_hard() ;
}
omdsdp1.set(1).set_spectral_va()
.set_base(*(hole1.mp.get_mg()->std_base_vect_cart()[0])) ;
omdsdp1.set(2).set_spectral_va()
.set_base(*(hole1.mp.get_mg()->std_base_vect_cart()[1])) ;
omdsdp1.set(3).set_spectral_va()
.set_base(*(hole1.mp.get_mg()->std_base_vect_cart()[2])) ;
omdsdp1.annule_domain(nz-1) ;
omdsdp1.change_triad(hole1.mp.get_bvect_spher()) ;
Vector omdsdp2 (hole2.mp, CON, hole2.mp.get_bvect_cart()) ;
Scalar yya2 (hole2.mp) ;
yya2 = hole2.mp.ya ;
Scalar xxa2 (hole2.mp) ;
xxa2 = hole2.mp.xa ;
if (fabs(hole2.mp.get_rot_phi()) < 1e-10){
omdsdp2.set(1) = - omega * yya2 ;
omdsdp2.set(2) = omega * xxa2 ;
omdsdp2.set(3).annule_hard() ;
}
else{
omdsdp2.set(1) = omega * yya2 ;
omdsdp2.set(2) = - omega * xxa2 ;
omdsdp2.set(3).annule_hard() ;
}
omdsdp2.set(1).set_spectral_va()
.set_base(*(hole2.mp.get_mg()->std_base_vect_cart()[0])) ;
omdsdp2.set(2).set_spectral_va()
.set_base(*(hole2.mp.get_mg()->std_base_vect_cart()[1])) ;
omdsdp2.set(3).set_spectral_va()
.set_base(*(hole2.mp.get_mg()->std_base_vect_cart()[2])) ;
omdsdp2.annule_domain(nz-1) ;
omdsdp2.change_triad(hole2.mp.get_bvect_spher()) ;
// New shift
beta1_new = relax*(beta1+hole1.decouple*omdsdp1) + (1-relax)*beta_un_old ;
beta2_new = relax*(beta2+hole2.decouple*omdsdp2) + (1-relax)*beta_deux_old ;
hole1.beta_auto = beta1_new ;
hole2.beta_auto = beta2_new ;
hole1.beta_comp_import(hole2) ;
hole2.beta_comp_import(hole1) ;
// Regularisation of the shifts if necessary
// -----------------------------------------
int nnt = hole1.mp.get_mg()->get_nt(1) ;
int nnp = hole1.mp.get_mg()->get_np(1) ;
int check ;
check = 0 ;
for (int k=0; k<nnp; k++)
for (int j=0; j<nnt; j++){
if (fabs((hole1.n_auto+hole1.n_comp).val_grid_point(1, k, j , 0)) < 1e-8){
check = 1 ;
break ;
}
}
if (check == 1){
double diff_un = hole1.regularisation (hole1.beta_auto,
hole2.beta_auto, omega) ;
double diff_deux = hole2.regularisation (hole2.beta_auto,
hole1.beta_auto, omega) ;
hole1.regul = diff_un ;
hole2.regul = diff_deux ;
}
else {
hole1.regul = 0. ;
hole2.regul = 0. ;
}
}
}
|