etoile_bin.C

00001 /*
00002  * Methods for the class Etoile_bin
00003  *
00004  * (see file etoile.h for documentation)
00005  */
00006 
00007 /*
00008  *   Copyright (c) 2000-2001 Eric Gourgoulhon
00009  *   Copyright (c) 2000-2001 Keisuke Taniguchi
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License as published by
00015  *   the Free Software Foundation; either version 2 of the License, or
00016  *   (at your option) any later version.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 
00030 char etoile_bin_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/etoile_bin.C,v 1.12 2004/11/25 09:53:55 m_bejger Exp $" ;
00031 
00032 /*
00033  * $Id: etoile_bin.C,v 1.12 2004/11/25 09:53:55 m_bejger Exp $
00034  * $Log: etoile_bin.C,v $
00035  * Revision 1.12  2004/11/25 09:53:55  m_bejger
00036  * Corrected error in fait_d_psi() in the case where nzet > 1.
00037  *
00038  * Revision 1.11  2004/05/07 12:35:16  f_limousin
00039  * Add new member ssjm1_psi
00040  *
00041  * Revision 1.10  2004/03/25 10:29:06  j_novak
00042  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
00043  *
00044  * Revision 1.9  2003/10/21 11:47:56  k_taniguchi
00045  * Delete various things for the Bin_ns_bh project.
00046  * They are moved to et_bin_nsbh.C.
00047  *
00048  * Revision 1.8  2003/10/20 15:08:22  k_taniguchi
00049  * Minor changes.
00050  *
00051  * Revision 1.7  2003/10/20 14:51:26  k_taniguchi
00052  * Addition of various things for the Bin_ns_bh project
00053  * which are related with the part of the neutron star.
00054  *
00055  * Revision 1.6  2003/02/06 16:08:36  f_limousin
00056  * Modified Etoile_bin::sprod in order to avoid a warning from the compiler
00057  *
00058  * Revision 1.5  2003/02/03 12:52:15  f_limousin
00059  * *** empty log message ***
00060  *
00061  * Revision 1.4  2003/01/31 16:57:12  p_grandclement
00062  * addition of the member Cmp decouple used to compute the K_ij auto, once
00063  * the K_ij total is known
00064  *
00065  * Revision 1.3  2003/01/17 13:39:51  f_limousin
00066  * Modification of sprod routine
00067  *
00068  * Revision 1.2  2002/12/17 21:20:29  e_gourgoulhon
00069  * Suppression of the member p_companion,
00070  * as well as the associated function set_companion.
00071  *
00072  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00073  * LORENE
00074  *
00075  * Revision 2.31  2001/06/25  12:53:15  eric
00076  * Ajout du membre p_companion et des fonctions associees set_companion() et get_companion().
00077  *
00078  * Revision 2.30  2000/12/22  13:09:09  eric
00079  * Modif fait_d_psi : prolongement C^1 de dpsi en dehors de l'etoile.
00080  *
00081  * Revision 2.29  2000/09/29  11:54:40  keisuke
00082  * Add the relaxations for logn_auto_div and d_logn_auto_div.
00083  *
00084  * Revision 2.28  2000/09/29  09:57:26  keisuke
00085  * Add the relaxation for logn_auto_regu.
00086  *
00087  * Revision 2.27  2000/09/22  15:51:19  keisuke
00088  * d_logn_auto_div devient desormais un membre de la classe Etoile
00089  * et non plus de la classe derivee Etoile_bin.
00090  *
00091  * Revision 2.26  2000/09/07  14:35:31  keisuke
00092  * Ajout du membre d_logn_auto_regu.
00093  *
00094  * Revision 2.25  2000/08/29  11:38:03  eric
00095  * Ajout du membre d_logn_auto_div.
00096  *
00097  * Revision 2.24  2000/07/06  09:53:22  eric
00098  * Ajout de xa_barycenter dans l'affichage.
00099  *
00100  * Revision 2.23  2000/07/06  09:40:11  eric
00101  *  Ajout du membre derive p_xa_barycenter.
00102  *
00103  * Revision 2.22  2000/06/15  15:50:02  eric
00104  * Ajout du calcul de d_tilde dans l'affichage.
00105  *
00106  * Revision 2.21  2000/05/23  12:28:00  phil
00107  * changement apres modification de skxk
00108  *
00109  * Revision 2.20  2000/03/15  11:04:58  eric
00110  * Ajout des fonctions Etoile_bin::set_w_shift() et Etoile_bin::set_khi_shift()
00111  *
00112  * Revision 2.19  2000/02/24  09:12:56  keisuke
00113  * Add an output for the velocity field in the corotating frame.
00114  *
00115  * Revision 2.18  2000/02/21  16:31:58  eric
00116  * Modif affichage.
00117  *
00118  * Revision 2.17  2000/02/21  14:54:13  eric
00119  * fait_d_psi appel d_psi.set_etat_nondef() et return dans le cas
00120  * corotation.
00121  *
00122  * Revision 2.16  2000/02/21  14:31:43  eric
00123  * gam_euler est desormais sauve dans le fichier (cas irrotationnel seulement)
00124  * psi0 n'est sauve que dans le cas irrotationnel.
00125  *
00126  * Revision 2.15  2000/02/21  13:58:22  eric
00127  * Suppression du membre psi: remplacement par psi0.
00128  *
00129  * Revision 2.14  2000/02/17  15:30:04  eric
00130  * Ajout de la fonction Etoile_bin::relaxation.
00131  *
00132  * Revision 2.13  2000/02/17  14:42:09  eric
00133  * Modif affichage.
00134  *
00135  * Revision 2.12  2000/02/16  17:12:25  eric
00136  * Modif initialisation de w_shift, khi_shift et ssjm1_wshift dans le
00137  * constructeur standard.
00138  *
00139  * Revision 2.11  2000/02/16  16:08:10  eric
00140  * w_shift et ssjm1_wshift sont desormais definis sur la triade du mapping.
00141  *
00142  * Revision 2.10  2000/02/16  15:06:11  eric
00143  *  Ajout des membres w_shift et khi_shift.
00144  * (sauves dans les fichiers a la place de shift_auto).
00145  * Ajout de la fonction Etoile_bin::fait_shift_auto.
00146  *
00147  * Revision 2.9  2000/02/16  13:47:22  eric
00148  * Ajout des membres ssjm1_khi et ssjm1_wshift.
00149  * (sauvegardes dans les fichiers).
00150  *
00151  * Revision 2.8  2000/02/16  11:54:40  eric
00152  * Ajout des membres ssjm1_logn et ssjm1_beta (sauvegarde dans les fichiers).
00153  *
00154  * Revision 2.7  2000/02/10  18:56:52  eric
00155  * Modifs routine d'affichage.
00156  *
00157  * Revision 2.6  2000/02/10  16:12:05  eric
00158  * Ajout de la fonction fait_d_psi
00159  *
00160  * Revision 2.5  2000/02/09  20:24:03  eric
00161  * Appel de set_triad(ref_triad) sur u_euler et shift dans les
00162  * constructeurs.
00163  * ,.
00164  *
00165  * Revision 2.4  2000/02/09  19:31:33  eric
00166  * La triade de decomposition doit desormais figurer en argument des
00167  *  constructeurs de Tenseur.
00168  *
00169  * Revision 2.3  2000/02/08  19:29:50  eric
00170  * La fonction Etoile_bin::scal_prod est rebaptisee Etoile_bin::sprod
00171  *
00172  * Revision 2.2  2000/02/04  17:15:36  eric
00173  * Ajout du membre ref_triad.
00174  *
00175  * Revision 2.1  2000/02/01  16:00:00  eric
00176  * Ajout de la fonction Etoile_bin::scal_prod.
00177  *
00178  * Revision 2.0  2000/01/31  15:57:12  eric
00179  * *** empty log message ***
00180  *
00181  *
00182  * $Header: /cvsroot/Lorene/C++/Source/Etoile/etoile_bin.C,v 1.12 2004/11/25 09:53:55 m_bejger Exp $
00183  *
00184  */
00185 
00186 // Headers C
00187 #include "math.h"
00188 
00189 // Headers Lorene
00190 #include "etoile.h"
00191 #include "eos.h"
00192 #include "unites.h"     
00193 
00194 // Local prototype
00195 Cmp raccord_c1(const Cmp& uu, int l1) ; 
00196 
00197                 //--------------//
00198                 // Constructors //
00199                 //--------------//
00200 
00201 // Standard constructor
00202 // --------------------
00203 Etoile_bin::Etoile_bin(Map& mpi, int nzet_i, bool relat, const Eos& eos_i, 
00204                bool irrot, const Base_vect& ref_triad_i)
00205                : Etoile(mpi, nzet_i, relat, eos_i), 
00206              irrotational(irrot), 
00207              ref_triad(ref_triad_i), 
00208              psi0(mpi), 
00209              d_psi(mpi, 1, COV, ref_triad), 
00210              wit_w(mpi, 1, CON, ref_triad), 
00211              loggam(mpi), 
00212              logn_comp(mpi), 
00213              d_logn_auto(mpi, 1, COV, ref_triad), 
00214              d_logn_auto_regu(mpi, 1, COV, ref_triad), 
00215              d_logn_comp(mpi, 1, COV, ref_triad), 
00216              beta_comp(mpi), 
00217              d_beta_auto(mpi, 1, COV, ref_triad), 
00218              d_beta_comp(mpi, 1, COV, ref_triad), 
00219              shift_auto(mpi, 1, CON, ref_triad), 
00220              shift_comp(mpi, 1, CON, ref_triad), 
00221              w_shift(mpi, 1, CON, mp.get_bvect_cart()), 
00222              khi_shift(mpi), 
00223              tkij_auto(mpi, 2, CON, ref_triad), 
00224              tkij_comp(mpi, 2, CON, ref_triad), 
00225              akcar_auto(mpi), 
00226              akcar_comp(mpi), 
00227              bsn(mpi, 1, CON, ref_triad), 
00228              pot_centri(mpi), 
00229              ssjm1_logn(mpi), 
00230              ssjm1_beta(mpi), 
00231              ssjm1_khi(mpi), 
00232                          ssjm1_wshift(mpi, 1, CON, mp.get_bvect_cart()),
00233              ssjm1_psi(mpi), 
00234                          decouple(mpi)
00235 {
00236     
00237     // Pointers of derived quantities initialized to zero : 
00238     set_der_0x0() ;
00239     
00240     // The reference triad is assigned to the vectors u_euler and shift :
00241     u_euler.set_triad(ref_triad) ; 
00242     shift.set_triad(ref_triad) ;
00243 
00244     // All quantities are initialized to zero : 
00245     psi0 = 0 ; 
00246     d_psi = 0 ; 
00247     wit_w = 0 ; 
00248     loggam = 0 ; 
00249     logn_comp = 0 ; 
00250     d_logn_auto = 0 ; 
00251     d_logn_auto_regu = 0 ; 
00252     d_logn_comp = 0 ; 
00253     beta_comp = 0 ; 
00254     d_beta_auto = 0 ; 
00255     d_beta_comp = 0 ; 
00256     shift_auto = 0 ; 
00257     shift_comp = 0 ; 
00258 
00259     w_shift.set_etat_qcq() ; 
00260     for (int i=0; i<3; i++) {
00261     w_shift.set(i) = 0 ; 
00262     }
00263 
00264     khi_shift.set_etat_qcq() ; 
00265     khi_shift.set() = 0 ; 
00266 
00267     tkij_auto.set_etat_zero() ; 
00268     tkij_comp.set_etat_zero() ; 
00269     akcar_auto = 0 ;
00270     akcar_comp = 0 ; 
00271     bsn = 0 ; 
00272     pot_centri = 0 ;
00273     ssjm1_logn = 0 ; 
00274     ssjm1_beta = 0 ; 
00275     ssjm1_khi = 0 ; 
00276     ssjm1_psi = 0 ; 
00277     
00278     ssjm1_wshift.set_etat_qcq() ; 
00279     for (int i=0; i<3; i++) {
00280     ssjm1_wshift.set(i) = 0 ; 
00281     }
00282     
00283 }
00284 
00285 // Copy constructor
00286 // ----------------
00287 Etoile_bin::Etoile_bin(const Etoile_bin& et)
00288                : Etoile(et), 
00289              irrotational(et.irrotational), 
00290              ref_triad(et.ref_triad), 
00291              psi0(et.psi0), 
00292              d_psi(et.d_psi), 
00293              wit_w(et.wit_w), 
00294              loggam(et.loggam), 
00295              logn_comp(et.logn_comp), 
00296              d_logn_auto(et.d_logn_auto), 
00297              d_logn_auto_regu(et.d_logn_auto_regu), 
00298              d_logn_comp(et.d_logn_comp), 
00299              beta_comp(et.beta_comp), 
00300              d_beta_auto(et.d_beta_auto), 
00301              d_beta_comp(et.d_beta_comp), 
00302              shift_auto(et.shift_auto), 
00303              shift_comp(et.shift_comp), 
00304              w_shift(et.w_shift), 
00305              khi_shift(et.khi_shift), 
00306              tkij_auto(et.tkij_auto), 
00307              tkij_comp(et.tkij_comp), 
00308              akcar_auto(et.akcar_auto), 
00309              akcar_comp(et.akcar_comp), 
00310              bsn(et.bsn), 
00311              pot_centri(et.pot_centri), 
00312              ssjm1_logn(et.ssjm1_logn), 
00313              ssjm1_beta(et.ssjm1_beta), 
00314              ssjm1_khi(et.ssjm1_khi), 
00315                          ssjm1_wshift(et.ssjm1_wshift),
00316              ssjm1_psi(et.ssjm1_khi), 
00317                          decouple(et.decouple)
00318 {
00319     set_der_0x0() ;    
00320 
00321 }    
00322 
00323 // Constructor from a file
00324 // -----------------------
00325 Etoile_bin::Etoile_bin(Map& mpi, const Eos& eos_i, const Base_vect& ref_triad_i,
00326                FILE* fich)
00327                : Etoile(mpi, eos_i, fich), 
00328              ref_triad(ref_triad_i), 
00329              psi0(mpi), 
00330              d_psi(mpi, 1, COV, ref_triad), 
00331              wit_w(mpi, 1, CON, ref_triad), 
00332              loggam(mpi), 
00333              logn_comp(mpi), 
00334              d_logn_auto(mpi, 1, COV, ref_triad), 
00335              d_logn_auto_regu(mpi, 1, COV, ref_triad), 
00336              d_logn_comp(mpi, 1, COV, ref_triad), 
00337              beta_comp(mpi), 
00338              d_beta_auto(mpi, 1, COV, ref_triad), 
00339              d_beta_comp(mpi, 1, COV, ref_triad), 
00340              shift_auto(mpi, 1, CON, ref_triad), 
00341              shift_comp(mpi, 1, CON, ref_triad), 
00342              w_shift(mpi, 1, CON, mp.get_bvect_cart()), 
00343              khi_shift(mpi), 
00344              tkij_auto(mpi, 2, CON, ref_triad), 
00345              tkij_comp(mpi, 2, CON, ref_triad), 
00346              akcar_auto(mpi), 
00347              akcar_comp(mpi), 
00348              bsn(mpi, 1, CON, ref_triad), 
00349              pot_centri(mpi), 
00350              ssjm1_logn(mpi), 
00351              ssjm1_beta(mpi), 
00352              ssjm1_khi(mpi), 
00353                          ssjm1_wshift(mpi, 1, CON, mp.get_bvect_cart()),
00354              ssjm1_psi(mpi), 
00355                          decouple(mpi)
00356 {
00357 
00358     // The reference triad is assigned to the vectors u_euler and shift :
00359     u_euler.set_triad(ref_triad) ; 
00360     shift.set_triad(ref_triad) ;
00361 
00362     // Etoile parameters
00363     // -----------------
00364 
00365     // irrotational is read in the file:     
00366     fread(&irrotational, sizeof(bool), 1, fich) ;       
00367           
00368    
00369     // Read of the saved fields:
00370     // ------------------------
00371 
00372     if (irrotational) {
00373     Tenseur gam_euler_file(mp, fich) ; 
00374     gam_euler = gam_euler_file ;    
00375 
00376     Tenseur psi0_file(mp, fich) ; 
00377     psi0 = psi0_file ; 
00378     }
00379 
00380     
00381     Tenseur w_shift_file(mp, mp.get_bvect_cart(), fich) ; 
00382     w_shift = w_shift_file ;
00383     
00384     Tenseur khi_shift_file(mp, fich) ; 
00385     khi_shift = khi_shift_file ;
00386     
00387     fait_shift_auto() ;     // constructs shift_auto from w_shift and khi_shift
00388     
00389     Cmp ssjm1_logn_file(mp, *(mp.get_mg()), fich) ; 
00390     ssjm1_logn = ssjm1_logn_file ; 
00391 
00392     Cmp ssjm1_beta_file(mp, *(mp.get_mg()), fich) ; 
00393     ssjm1_beta = ssjm1_beta_file ; 
00394 
00395     Cmp ssjm1_khi_file(mp, *(mp.get_mg()), fich) ; 
00396     ssjm1_khi = ssjm1_khi_file ; 
00397 
00398     Tenseur ssjm1_wshift_file(mp, mp.get_bvect_cart(), fich) ; 
00399     ssjm1_wshift = ssjm1_wshift_file ; 
00400 
00401     ssjm1_psi = 0 ;
00402 
00403     // All other fields are initialized to zero : 
00404     // ----------------------------------------
00405     d_psi = 0 ; 
00406     wit_w = 0 ; 
00407     loggam = 0 ; 
00408     logn_comp = 0 ; 
00409     d_logn_auto = 0 ; 
00410     d_logn_auto_regu = 0 ; 
00411     d_logn_comp = 0 ; 
00412     beta_comp = 0 ; 
00413     d_beta_auto = 0 ; 
00414     d_beta_comp = 0 ; 
00415     shift_comp = 0 ; 
00416     tkij_auto.set_etat_zero() ; 
00417     tkij_comp.set_etat_zero() ; 
00418     akcar_auto = 0 ;
00419     akcar_comp = 0 ; 
00420     bsn = 0 ; 
00421     pot_centri = 0 ;
00422 
00423     // Pointers of derived quantities initialized to zero 
00424     // --------------------------------------------------
00425     set_der_0x0() ;
00426     
00427 }
00428 
00429                 //------------//
00430                 // Destructor //
00431                 //------------//
00432 
00433 Etoile_bin::~Etoile_bin(){
00434 
00435     del_deriv() ; 
00436 
00437 }
00438 
00439             //----------------------------------//
00440             // Management of derived quantities //
00441             //----------------------------------//
00442 
00443 void Etoile_bin::del_deriv() const {
00444 
00445     Etoile::del_deriv() ; 
00446 
00447     if (p_xa_barycenter != 0x0) delete p_xa_barycenter ; 
00448     
00449     set_der_0x0() ; 
00450 }               
00451 
00452 
00453 
00454 
00455 void Etoile_bin::set_der_0x0() const {
00456 
00457     Etoile::set_der_0x0() ;
00458 
00459     p_xa_barycenter = 0x0 ; 
00460 
00461 }               
00462 
00463 void Etoile_bin::del_hydro_euler() {
00464 
00465     Etoile::del_hydro_euler() ; 
00466 
00467     del_deriv() ; 
00468 
00469 }               
00470 
00471 
00472                 //--------------//
00473                 //  Assignment  //
00474                 //--------------//
00475 
00476 // Assignment to another Etoile_bin
00477 // --------------------------------
00478 void Etoile_bin::operator=(const Etoile_bin& et) {
00479 
00480     // Assignment of quantities common to the derived classes of Etoile
00481     Etoile::operator=(et) ;     
00482 
00483     // Assignement of proper quantities of class Etoile_bin
00484     irrotational = et.irrotational ; 
00485 
00486     assert(et.ref_triad == ref_triad) ; 
00487 
00488     psi0 = et.psi0 ; 
00489     d_psi = et.d_psi ;
00490     wit_w = et.wit_w ; 
00491     loggam = et.loggam ;
00492     logn_comp = et.logn_comp ;
00493     d_logn_auto = et.d_logn_auto ;
00494     d_logn_auto_regu = et.d_logn_auto_regu ;
00495     d_logn_comp = et.d_logn_comp ;
00496     beta_comp = et.beta_comp ;
00497     d_beta_auto = et.d_beta_auto ;
00498     d_beta_comp = et.d_beta_comp ;
00499     shift_auto = et.shift_auto ;
00500     shift_comp = et.shift_comp ;
00501     w_shift = et.w_shift ;
00502     khi_shift = et.khi_shift ;
00503     tkij_auto = et.tkij_auto ;
00504     tkij_comp = et.tkij_comp ;
00505     akcar_auto = et.akcar_auto ;
00506     akcar_comp = et.akcar_comp ;
00507     bsn = et.bsn ;
00508     pot_centri = et.pot_centri ;
00509     ssjm1_logn = et.ssjm1_logn ;
00510     ssjm1_beta = et.ssjm1_beta ; 
00511     ssjm1_khi = et.ssjm1_khi ;
00512     ssjm1_wshift = et.ssjm1_wshift ; 
00513     ssjm1_psi = et.ssjm1_psi ;
00514     decouple = et.decouple ;
00515     
00516     del_deriv() ;  // Deletes all derived quantities
00517 
00518 }   
00519 
00520 Tenseur& Etoile_bin::set_logn_comp() {
00521 
00522     del_deriv() ;   // sets to 0x0 all the derived quantities
00523     return logn_comp ;
00524     
00525 } 
00526 
00527 Tenseur& Etoile_bin::set_pot_centri() {
00528 
00529     del_deriv() ;   // sets to 0x0 all the derived quantities
00530     return pot_centri ;
00531     
00532 } 
00533 
00534 Tenseur& Etoile_bin::set_w_shift() {
00535 
00536     del_deriv() ;   // sets to 0x0 all the derived quantities
00537     return w_shift ;
00538     
00539 } 
00540 
00541 Tenseur& Etoile_bin::set_khi_shift() {
00542 
00543     del_deriv() ;   // sets to 0x0 all the derived quantities
00544     return khi_shift ;
00545     
00546 } 
00547 
00548 
00549                 //--------------//
00550                 //    Outputs   //
00551                 //--------------//
00552 
00553 // Save in a file
00554 // --------------
00555 void Etoile_bin::sauve(FILE* fich) const {
00556     
00557     Etoile::sauve(fich) ; 
00558     
00559     fwrite(&irrotational, sizeof(bool), 1, fich) ;      
00560     
00561     if (irrotational) {
00562     gam_euler.sauve(fich) ; // required to construct d_psi from psi0
00563     psi0.sauve(fich) ; 
00564     }
00565     
00566     w_shift.sauve(fich) ; 
00567     khi_shift.sauve(fich) ; 
00568     
00569     ssjm1_logn.sauve(fich) ; 
00570     ssjm1_beta.sauve(fich) ; 
00571     ssjm1_khi.sauve(fich) ; 
00572     ssjm1_wshift.sauve(fich) ;
00573 }
00574 
00575 // Printing
00576 // --------
00577 
00578 ostream& Etoile_bin::operator>>(ostream& ost) const {
00579     
00580   using namespace Unites ;
00581 
00582     Etoile::operator>>(ost) ; 
00583     
00584     ost << endl ; 
00585     ost << "Star in a binary system" << endl ; 
00586     ost << "-----------------------" << endl ; 
00587     
00588     if (irrotational) {
00589     ost << "irrotational configuration" << endl ; 
00590     }
00591     else {
00592     ost << "corotating configuration" << endl ; 
00593     }
00594        
00595     ost << "Absolute abscidia of the stellar center: " <<
00596     mp.get_ori_x() / km << " km" << endl ; 
00597     
00598     ost << "Absolute abscidia of the barycenter of the baryon density : " <<
00599     xa_barycenter() / km << " km" << endl ; 
00600     
00601     double r_0 = 0.5 * ( ray_eq() + ray_eq_pi() ) ; 
00602     double d_ns = fabs( mp.get_ori_x() ) + ray_eq_pi() - r_0 ;
00603     double d_tilde = 2 * d_ns / r_0 ;  
00604     
00605     ost << "d_tilde : " << d_tilde << endl ; 
00606 
00607     ost << "Orientation with respect to the absolute frame : " <<
00608     mp.get_rot_phi() << " rad" << endl ; 
00609 
00610     ost << "Central value of gam_euler : " 
00611         << gam_euler()(0, 0, 0, 0)  << endl ; 
00612 
00613     ost << "Central u_euler (U^X, U^Y, U^Z) [c] : " 
00614     << u_euler(0)(0, 0, 0, 0) << "  " 
00615     << u_euler(1)(0, 0, 0, 0) << "  " 
00616     << u_euler(2)(0, 0, 0, 0) << endl ; 
00617 
00618     if (irrotational) {
00619     ost << "Central d_psi (X, Y, Z) [c] :         " 
00620         << d_psi(0)(0, 0, 0, 0) << "  " 
00621         << d_psi(1)(0, 0, 0, 0) << "  " 
00622         << d_psi(2)(0, 0, 0, 0) << endl ; 
00623 
00624     ost << "Central vel. / co-orb. (W^X, W^Y, W^Z) [c] : " 
00625         << wit_w(0)(0, 0, 0, 0) << "  " 
00626         << wit_w(1)(0, 0, 0, 0) << "  " 
00627         << wit_w(2)(0, 0, 0, 0) << endl ; 
00628 
00629     ost << "Max vel. / co-orb. (W^X, W^Y, W^Z) [c] : " 
00630         << max(max(wit_w(0))) << "  " 
00631         << max(max(wit_w(1))) << "  " 
00632         << max(max(wit_w(2))) << endl ; 
00633 
00634     ost << "Min vel. / co-orb. (W^X, W^Y, W^Z) [c] : " 
00635         << min(min(wit_w(0))) << "  " 
00636         << min(min(wit_w(1))) << "  " 
00637         << min(min(wit_w(2))) << endl ; 
00638 
00639     double r_surf = mp.val_r(0,1.,M_PI/4,M_PI/4) ;
00640 
00641     ost << "Velocity at (r_surf,pi/4,pi/4) / co-orb. [c] : "
00642         << wit_w(0).val_point(r_surf,M_PI/4,M_PI/4) << "  "
00643         << wit_w(1).val_point(r_surf,M_PI/4,M_PI/4) << "  "
00644         << wit_w(2).val_point(r_surf,M_PI/4,M_PI/4) << endl ;
00645 
00646     ost << "Central value of loggam : " 
00647         << loggam()(0, 0, 0, 0)  << endl ;  
00648     }
00649 
00650 
00651     ost << "Central value of log(N) auto, comp :         " 
00652     << logn_auto()(0, 0, 0, 0) << "  " 
00653     << logn_comp()(0, 0, 0, 0) << endl ; 
00654 
00655     ost << "Central value of beta=log(AN) auto, comp :   " 
00656     << beta_auto()(0, 0, 0, 0) << "  " 
00657     << beta_comp()(0, 0, 0, 0) << endl ; 
00658 
00659     ost << "Central value of shift (N^X, N^Y, N^Z) [c] : " 
00660     << shift(0)(0, 0, 0, 0) << "  " 
00661     << shift(1)(0, 0, 0, 0) << "  " 
00662     << shift(2)(0, 0, 0, 0) << endl ; 
00663 
00664     ost << "  ... shift_auto part of it [c] :            " 
00665     << shift_auto(0)(0, 0, 0, 0) << "  " 
00666     << shift_auto(1)(0, 0, 0, 0) << "  " 
00667     << shift_auto(2)(0, 0, 0, 0) << endl ; 
00668 
00669     ost << "  ... shift_comp part of it [c] :            " 
00670     << shift_comp(0)(0, 0, 0, 0) << "  " 
00671     << shift_comp(1)(0, 0, 0, 0) << "  " 
00672     << shift_comp(2)(0, 0, 0, 0) << endl ; 
00673 
00674     ost << "  ... w_shift (NB: components in the star Cartesian frame) [c] :  "
00675     << endl  
00676     << w_shift(0)(0, 0, 0, 0) << "  " 
00677     << w_shift(1)(0, 0, 0, 0) << "  " 
00678     << w_shift(2)(0, 0, 0, 0) << endl ; 
00679 
00680     ost << "Central value of khi_shift [km c] : " 
00681         << khi_shift()(0, 0, 0, 0) / km << endl ; 
00682 
00683     ost << endl << "Central value of (B^X, B^Y, B^Z)/N [c] : " 
00684     << bsn(0)(0, 0, 0, 0) << "  " 
00685     << bsn(1)(0, 0, 0, 0) << "  " 
00686     << bsn(2)(0, 0, 0, 0) << endl ; 
00687 
00688     ost << endl << 
00689     "Central (d/dX,d/dY,d/dZ)(logn_auto) [km^{-1}] : " 
00690     << d_logn_auto(0)(0, 0, 0, 0) * km << "  " 
00691     << d_logn_auto(1)(0, 0, 0, 0) * km  << "  " 
00692     << d_logn_auto(2)(0, 0, 0, 0) * km  << endl ; 
00693 
00694     ost << "Central (d/dX,d/dY,d/dZ)(logn_comp) [km^{-1}] : " 
00695     << d_logn_comp(0)(0, 0, 0, 0) * km  << "  " 
00696     << d_logn_comp(1)(0, 0, 0, 0) * km  << "  " 
00697     << d_logn_comp(2)(0, 0, 0, 0) * km  << endl ; 
00698 
00699     ost << endl << 
00700     "Central (d/dX,d/dY,d/dZ)(beta_auto) [km^{-1}] : " 
00701     << d_beta_auto(0)(0, 0, 0, 0) * km << "  " 
00702     << d_beta_auto(1)(0, 0, 0, 0) * km  << "  " 
00703     << d_beta_auto(2)(0, 0, 0, 0) * km  << endl ; 
00704 
00705     ost << "Central (d/dX,d/dY,d/dZ)(beta_comp) [km^{-1}] : " 
00706     << d_beta_comp(0)(0, 0, 0, 0) * km  << "  " 
00707     << d_beta_comp(1)(0, 0, 0, 0) * km  << "  " 
00708     << d_beta_comp(2)(0, 0, 0, 0) * km  << endl ; 
00709 
00710 
00711     ost << endl << "Central A^2 K^{ij} [c/km] : " << endl ; 
00712     ost << "  A^2 K^{xx} auto, comp : " 
00713     << tkij_auto(0, 0)(0, 0, 0, 0) * km  << "  "
00714     << tkij_comp(0, 0)(0, 0, 0, 0) * km << endl ; 
00715     ost << "  A^2 K^{xy} auto, comp : " 
00716     << tkij_auto(0, 1)(0, 0, 0, 0) * km  << "  "
00717     << tkij_comp(0, 1)(0, 0, 0, 0) * km << endl ; 
00718     ost << "  A^2 K^{xz} auto, comp : " 
00719     << tkij_auto(0, 2)(0, 0, 0, 0) * km  << "  "
00720     << tkij_comp(0, 2)(0, 0, 0, 0) * km << endl ; 
00721     ost << "  A^2 K^{yy} auto, comp : " 
00722     << tkij_auto(1, 1)(0, 0, 0, 0) * km  << "  "
00723     << tkij_comp(1, 1)(0, 0, 0, 0) * km << endl ; 
00724     ost << "  A^2 K^{yz} auto, comp : " 
00725     << tkij_auto(1, 2)(0, 0, 0, 0) * km  << "  "
00726     << tkij_comp(1, 2)(0, 0, 0, 0) * km << endl ; 
00727     ost << "  A^2 K^{zz} auto, comp : " 
00728     << tkij_auto(2, 2)(0, 0, 0, 0) * km  << "  "
00729     << tkij_comp(2, 2)(0, 0, 0, 0) * km << endl ; 
00730 
00731     ost << endl << "Central A^2 K_{ij} K^{ij} [c^2/km^2] : " << endl ; 
00732     ost << "   A^2 K_{ij} K^{ij}  auto, comp : " 
00733     << akcar_auto()(0, 0, 0, 0) * km*km  << "  "
00734     << akcar_comp()(0, 0, 0, 0) * km*km << endl ; 
00735 
00736     
00737     return ost ; 
00738 }
00739 
00740                 //-------------------------//
00741                 //  Computational routines //
00742                 //-------------------------//
00743                 
00744 Tenseur Etoile_bin::sprod(const Tenseur& t1, const Tenseur& t2) const {
00745 
00746   int val1 = t1.get_valence() ; 
00747 
00748     // Both indices should be contravariant or both covariant : 
00749     if (t1.get_type_indice(val1-1) == CON) {
00750       assert( t2.get_type_indice(0) == CON ) ;
00751       return a_car * flat_scalar_prod(t1, t2) ; 
00752     }
00753     else{
00754       assert(t1.get_type_indice(val1-1) == COV) ;
00755       assert( t2.get_type_indice(0) == COV ) ;
00756       return  flat_scalar_prod(t1, t2)/a_car ;   
00757     }
00758 } 
00759 
00760 void Etoile_bin::fait_d_psi() {
00761 
00762     if (!irrotational) {
00763     d_psi.set_etat_nondef() ; 
00764     return ; 
00765     }
00766 
00767     // Specific relativistic enthalpy           ---> hhh
00768     //----------------------------------
00769     
00770     Tenseur hhh = exp(unsurc2 * ent) ;  // = 1 at the Newtonian limit
00771  
00772     //  Computation of W^i = - A^2 h Gamma_n B^i/N
00773     //----------------------------------------------
00774 
00775     Tenseur www = - a_car * hhh * gam_euler * bsn ; 
00776     
00777     
00778     // Constant value of W^i at the center of the star
00779     //-------------------------------------------------
00780     
00781     Tenseur v_orb(mp, 1, COV, ref_triad) ; 
00782     
00783     v_orb.set_etat_qcq() ; 
00784     for (int i=0; i<3; i++) {
00785     v_orb.set(i) = www(i)(0, 0, 0, 0) ; 
00786     }
00787     
00788     v_orb.set_triad( *(www.get_triad()) ) ;     
00789     int nzm1 = mp.get_mg()->get_nzone() - 1 ;    
00790     for (int l=nzet; l<=nzm1; l++)
00791     for (int i=0; i<=2; i++)
00792         v_orb.set(i).annule(l) ;
00793         
00794     
00795      // Gradient of psi 
00796      //----------------
00797 
00798      Tenseur d_psi0 = psi0.gradient() ; 
00799 
00800      d_psi0.change_triad( ref_triad ) ; 
00801 
00802      d_psi = d_psi0 + v_orb ; 
00803 
00804 
00805      // C^1 continuation of d_psi outside the star
00806      //  (to ensure a smooth enthalpy field accross the stellar surface)
00807      // ----------------------------------------------------------------
00808 
00809      if (d_psi0.get_etat() == ETATQCQ ) {
00810         d_psi.annule(nzet, nzm1) ;   
00811     for (int i=0; i<3; i++) {
00812         d_psi.set(i).va.set_base( d_psi0(i).va.base ) ; 
00813         d_psi.set(i) = raccord_c1(d_psi(i), nzet) ; 
00814     }
00815     }
00816     else{ 
00817     d_psi.annule(nzm1) ;     
00818     }  
00819 } 
00820 
00821 
00822 void Etoile_bin::fait_shift_auto() {
00823 
00824     Tenseur d_khi = khi_shift.gradient() ; 
00825     
00826     if (d_khi.get_etat() == ETATQCQ) { 
00827     d_khi.dec2_dzpuis() ;   // divide by r^2 in the external compactified
00828                 // domain
00829     }
00830  
00831     // x_k dW^k/dx_i
00832     
00833     Tenseur x_d_w = skxk( w_shift.gradient() ) ;
00834     x_d_w.dec_dzpuis() ;
00835     
00836     double lambda = double(1) / double(3) ; 
00837 
00838     // The final computation is done component by component because
00839     // d_khi and x_d_w are covariant comp. whereas w_shift is
00840     // contravariant
00841     
00842     shift_auto.set_etat_qcq() ; 
00843     
00844     for (int i=0; i<3; i++) {
00845     shift_auto.set(i) = (lambda+2)/2./(lambda+1) * w_shift(i)
00846         - (lambda/2./(lambda+1))  * (d_khi(i) + x_d_w(i)) ;      
00847     }
00848     
00849     shift_auto.set_triad( *(w_shift.get_triad()) ) ; 
00850     
00851     // The final components of shift_auto should be those with respect
00852     // to the absolute frame (X,Y,Z) :
00853     
00854     shift_auto.change_triad( ref_triad ) ;  
00855     
00856 } 
00857 
00858 
00859 void Etoile_bin::relaxation(const Etoile_bin& star_jm1, double relax_ent, 
00860                 double relax_met, int mer, int fmer_met) {
00861                 
00862     double relax_ent_jm1 = 1. - relax_ent ; 
00863     double relax_met_jm1 = 1. - relax_met ; 
00864 
00865     ent = relax_ent * ent + relax_ent_jm1 * star_jm1.ent ; 
00866 
00867     if ( (mer != 0) && (mer % fmer_met == 0)) {
00868 
00869     logn_auto = relax_met * logn_auto + relax_met_jm1 * star_jm1.logn_auto ;
00870 
00871     logn_auto_regu = relax_met * logn_auto_regu
00872       + relax_met_jm1 * star_jm1.logn_auto_regu ;
00873 
00874     logn_auto_div = relax_met * logn_auto_div
00875       + relax_met_jm1 * star_jm1.logn_auto_div ;
00876 
00877     d_logn_auto_div = relax_met * d_logn_auto_div
00878       + relax_met_jm1 * star_jm1.d_logn_auto_div ;
00879 
00880     beta_auto = relax_met * beta_auto + relax_met_jm1 * star_jm1.beta_auto ;
00881     
00882     shift_auto = relax_met * shift_auto 
00883                     + relax_met_jm1 * star_jm1.shift_auto ;
00884     
00885     }
00886 
00887     del_deriv() ; 
00888     
00889     equation_of_state() ; 
00890 
00891 }

Generated on Tue Feb 7 01:35:17 2012 for LORENE by  doxygen 1.4.6