et_bin_nsbh.C

00001 /*
00002  *  Methods for the class Et_bin_nsbh
00003  *
00004  *    (see file et_bin_nsbh.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2003 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 version 2
00015  *   as published by the Free Software Foundation.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 char et_bin_nsbh_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_nsbh.C,v 1.10 2006/09/25 10:01:49 p_grandclement Exp $" ;
00029 
00030 /*
00031  * $Id: et_bin_nsbh.C,v 1.10 2006/09/25 10:01:49 p_grandclement Exp $
00032  * $Log: et_bin_nsbh.C,v $
00033  * Revision 1.10  2006/09/25 10:01:49  p_grandclement
00034  * Addition of N-dimensional Tbl
00035  *
00036  * Revision 1.9  2006/06/01 12:47:53  p_grandclement
00037  * update of the Bin_ns_bh project
00038  *
00039  * Revision 1.8  2005/08/29 15:10:16  p_grandclement
00040  * Addition of things needed :
00041  *   1) For BBH with different masses
00042  *   2) Provisory files for the mixted binaries (Bh and NS) : THIS IS NOT
00043  *   WORKING YET !!!
00044  *
00045  * Revision 1.7  2004/06/09 06:39:35  k_taniguchi
00046  * Introduce set_n_auto() and set_confpsi_auto().
00047  *
00048  * Revision 1.6  2004/03/25 10:29:04  j_novak
00049  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
00050  *
00051  * Revision 1.5  2003/12/16 05:30:18  k_taniguchi
00052  * Some changes in the constructor from file and the saving to file.
00053  *
00054  * Revision 1.4  2003/11/28 04:30:22  k_taniguchi
00055  * Add the output operator.
00056  *
00057  * Revision 1.3  2003/10/24 12:30:58  k_taniguchi
00058  * Add some derivative terms
00059  *
00060  * Revision 1.2  2003/10/22 08:12:46  k_taniguchi
00061  * Supress some terms in Et_bin_nsbh::sauve.
00062  *
00063  * Revision 1.1  2003/10/21 11:50:38  k_taniguchi
00064  * Methods for class Et_bin_nsbh
00065  *
00066  *
00067  * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_bin_nsbh.C,v 1.10 2006/09/25 10:01:49 p_grandclement Exp $
00068  *
00069  */
00070 
00071 // C headers
00072 #include <math.h>
00073 
00074 // Lorene headers
00075 #include "et_bin_nsbh.h"
00076 #include "etoile.h"
00077 #include "eos.h"
00078 #include "utilitaires.h"
00079 #include "param.h"
00080 #include "unites.h"
00081 
00082                             //--------------//
00083                             // Constructors //
00084                             //--------------//
00085 
00086 // Standard constructor
00087 // --------------------
00088 Et_bin_nsbh::Et_bin_nsbh(Map& mp_i, int nzet_i, bool relat, const Eos& eos_i,
00089              bool irrot, const Base_vect& ref_triad_i)
00090     : Etoile_bin(mp_i, nzet_i, relat, eos_i, irrot, ref_triad_i),
00091       n_auto(mp_i),
00092       n_comp(mp_i),
00093       d_n_auto(mp_i, 1, COV, ref_triad_i),
00094       d_n_comp(mp_i, 1, COV, ref_triad_i),
00095       confpsi(mp_i),
00096       confpsi_auto(mp_i),
00097       confpsi_comp(mp_i),
00098       d_confpsi_auto(mp_i, 1, COV, ref_triad_i),
00099       d_confpsi_comp(mp_i, 1, COV, ref_triad_i),
00100       taij_auto(mp_i, 2, CON, ref_triad_i) ,
00101       taij_comp(mp_i, 2, CON, ref_triad_i),
00102       taij_tot(mp_i, 2, CON, ref_triad_i) ,
00103       tkij_auto(mp_i, 2, CON, ref_triad_i),
00104       tkij_tot(mp_i, 2, CON, ref_triad_i),
00105       ssjm1_lapse(mp_i),
00106       ssjm1_confpsi(mp_i) {
00107 
00108     // Pointers of derived quantities initialized to zero :
00109     set_der_0x0() ;
00110 
00111     // The metric is initialized to the flat one :
00112     n_auto = 0.5 ;
00113     n_auto.set_std_base() ;
00114     n_comp = 0.5 ;
00115     n_comp.set_std_base() ;
00116     d_n_auto = 0 ;
00117     d_n_comp = 0 ;
00118     confpsi = 1 ;
00119     confpsi.set_std_base() ;
00120     confpsi_auto = 0.5 ;
00121     confpsi_auto.set_std_base() ;
00122     confpsi_comp = 0.5 ;
00123     confpsi_comp.set_std_base() ;
00124     d_confpsi_auto = 0 ;
00125     d_confpsi_comp = 0 ;
00126 
00127     taij_auto.set_etat_zero() ;
00128     taij_comp.set_etat_zero() ;
00129     taij_tot.set_etat_zero() ;
00130     tkij_auto.set_etat_zero() ;
00131     tkij_tot.set_etat_zero() ;
00132 
00133     ssjm1_lapse.set_etat_qcq() ;
00134     ssjm1_lapse = 0. ;
00135     ssjm1_confpsi.set_etat_qcq() ;
00136     ssjm1_confpsi = 0. ;
00137 
00138 }
00139 
00140 // Copy constructor
00141 // ----------------
00142 Et_bin_nsbh::Et_bin_nsbh(const Et_bin_nsbh& et)
00143     : Etoile_bin(et),
00144       n_auto(et.n_auto),
00145       n_comp(et.n_comp),
00146       d_n_auto(et.d_n_auto),
00147       d_n_comp(et.d_n_comp),
00148       confpsi(et.confpsi),
00149       confpsi_auto(et.confpsi_auto),
00150       confpsi_comp(et.confpsi_comp),
00151       d_confpsi_auto(et.d_confpsi_auto),
00152       d_confpsi_comp(et.d_confpsi_comp),
00153       taij_auto(et.taij_auto),
00154       taij_comp(et.taij_comp),
00155       taij_tot(et.taij_tot),
00156       tkij_auto(et.tkij_auto),
00157       tkij_tot(et.tkij_tot),
00158       ssjm1_lapse(et.ssjm1_lapse),
00159       ssjm1_confpsi(et.ssjm1_confpsi) {
00160 
00161     set_der_0x0() ;
00162 }
00163 
00164 // Constructor from a file
00165 // -----------------------
00166 Et_bin_nsbh::Et_bin_nsbh(Map& mp_i, const Eos& eos_i,
00167              const Base_vect& ref_triad_i, FILE* fich, bool old)
00168     : Etoile_bin(mp_i, eos_i, ref_triad_i, fich),
00169       n_auto(mp_i),
00170       n_comp(mp_i),
00171       d_n_auto(mp_i, 1, COV, ref_triad_i),
00172       d_n_comp(mp_i, 1, COV, ref_triad_i ),
00173       confpsi(mp_i),
00174       confpsi_auto(mp_i),
00175       confpsi_comp(mp_i),
00176       d_confpsi_auto(mp_i, 1, COV, ref_triad_i),
00177       d_confpsi_comp(mp_i, 1, COV, ref_triad_i),
00178       taij_auto(mp_i, 2, CON, ref_triad_i),
00179       taij_comp(mp_i, 2, CON, ref_triad_i),
00180       taij_tot(mp_i, 2, CON, ref_triad_i),
00181       tkij_auto(mp_i, 2, CON, ref_triad_i),
00182       tkij_tot(mp_i, 2, CON, ref_triad_i),
00183       ssjm1_lapse(mp_i),
00184       ssjm1_confpsi(mp_i) {
00185     
00186     // Construct from data in Etoile_bin
00187     Cmp n_from_file (mp_i, *(mp_i.get_mg()), fich) ;
00188     n_auto.set_etat_qcq() ;
00189     n_auto.set() = n_from_file ;
00190     
00191     Cmp psi_from_file (mp_i, *(mp_i.get_mg()), fich) ;
00192     confpsi_auto.set_etat_qcq() ;
00193     confpsi_auto.set() = psi_from_file ;
00194     
00195     if (!old) {
00196         Tenseur shift_auto_file (mp, ref_triad_i, fich) ;
00197         shift_auto = shift_auto_file ;
00198     }
00199     
00200     // All other fields are initialized to zero or some constants :
00201     // ----------------------------------------------------------
00202     n_comp = 0.5 ;
00203     n_comp.set_std_base() ;
00204     d_n_auto = 0 ;
00205     d_n_comp = 0 ;
00206     confpsi = 1 ;
00207     confpsi.set_std_base() ;
00208     confpsi_comp = 0.5 ;
00209     confpsi_comp.set_std_base() ;
00210     d_confpsi_auto = 0 ;
00211     d_confpsi_comp = 0 ;
00212     taij_auto.set_etat_zero() ;
00213     taij_comp.set_etat_zero() ;
00214     taij_tot.set_etat_zero() ;
00215     tkij_auto.set_etat_zero() ;
00216     tkij_tot.set_etat_zero() ;
00217  
00218     // Read of the saved fields :
00219     Cmp ssjm1_lapse_file(mp_i, *(mp_i.get_mg()), fich) ;
00220     ssjm1_lapse = ssjm1_lapse_file ;
00221    
00222     Cmp ssjm1_confpsi_file(mp_i, *(mp_i.get_mg()), fich) ;
00223     ssjm1_confpsi = ssjm1_confpsi_file ;
00224     
00225     // Pointers of derived quantities initialized to zero
00226     // --------------------------------------------------
00227     set_der_0x0() ;
00228 }
00229 
00230                             //------------//
00231                             // Destructor //
00232                             //------------//
00233 
00234 Et_bin_nsbh::~Et_bin_nsbh(){
00235 
00236     del_deriv() ;
00237 
00238 }
00239 
00240                             //--------------//
00241                             //  Assignment  //
00242                             //--------------//
00243 
00244 // Assignment to another Et_bin_nsbh
00245 // ---------------------------------
00246 void Et_bin_nsbh::operator=(const Et_bin_nsbh& et) {
00247 
00248     // Assignment of quantities common to the derived classes of Etoile_bin
00249     Etoile_bin::operator=(et) ;
00250 
00251     n_auto = et.n_auto ;
00252     n_comp = et.n_comp ;
00253     d_n_auto = et.d_n_auto ;
00254     d_n_comp = et.d_n_comp ;
00255     confpsi = et.confpsi ;
00256     confpsi_auto = et.confpsi_auto ;
00257     confpsi_comp = et.confpsi_comp ;
00258     d_confpsi_auto = et.d_confpsi_auto ;
00259     d_confpsi_comp = et.d_confpsi_comp ;
00260     taij_auto = et.taij_auto ;
00261     taij_comp = et.taij_comp ;
00262     taij_tot = et.taij_tot ;
00263     tkij_auto = et.tkij_auto ;
00264     tkij_tot = et.tkij_tot ;
00265     ssjm1_lapse = et.ssjm1_lapse ;
00266     ssjm1_confpsi = et.ssjm1_confpsi ;
00267 
00268     del_deriv() ;  // Deletes all derived quantities
00269 }
00270 
00271 Tenseur& Et_bin_nsbh::set_n_auto() {
00272 
00273     del_deriv() ;   // sets to 0x0 all the derived quantities
00274     return n_auto ;
00275 
00276 }
00277 
00278 Tenseur& Et_bin_nsbh::set_n_comp() {
00279 
00280     del_deriv() ;   // sets to 0x0 all the derived quantities
00281     return n_comp ;
00282 
00283 }
00284 
00285 Tenseur& Et_bin_nsbh::set_confpsi_auto() {
00286 
00287     del_deriv() ;   // sets to 0x0 all the derived quantities
00288     return confpsi_auto ;
00289 
00290 }
00291 
00292 Tenseur& Et_bin_nsbh::set_confpsi_comp() {
00293 
00294     del_deriv() ;   // sets to 0x0 all the derived quantities
00295     return confpsi_comp ;
00296 
00297 }
00298 
00299                             //--------------//
00300                             //    Outputs   //
00301                             //--------------//
00302 
00303 // Save in a file
00304 // --------------
00305 void Et_bin_nsbh::sauve(FILE* fich) const {
00306 
00307     Etoile_bin::sauve(fich) ;
00308 
00309     n_auto().sauve(fich) ;
00310     confpsi_auto().sauve(fich) ;
00311     shift_auto.sauve(fich) ;
00312     
00313     ssjm1_lapse.sauve(fich) ;
00314     ssjm1_confpsi.sauve(fich) ;
00315 }
00316 
00317 
00318 // Printing
00319 // --------
00320 
00321 ostream& Et_bin_nsbh::operator>>(ostream& ost) const {
00322 
00323   using namespace Unites ;
00324 
00325     Etoile::operator>>(ost) ;
00326 
00327     ost << endl ;
00328     ost << "Neutron star in a binary system" << endl ;
00329     ost << "-------------------------------" << endl ;
00330 
00331     if (irrotational) {
00332       ost << "irrotational configuration" << endl ;
00333     }
00334     else {
00335       ost << "corotating configuration" << endl ;
00336     }
00337 
00338     ost << "Absolute abscidia of the stellar center: " <<
00339       mp.get_ori_x() / km << " km" << endl ;
00340 
00341     ost << "Absolute abscidia of the barycenter of the baryon density : " <<
00342       xa_barycenter() / km << " km" << endl ;
00343 
00344     double r_0 = 0.5 * ( ray_eq() + ray_eq_pi() ) ;
00345     double d_ns = fabs( mp.get_ori_x() ) + ray_eq_pi() - r_0 ;
00346     double d_tilde = 2 * d_ns / r_0 ;
00347 
00348     ost << "d_tilde : " << d_tilde << endl ;
00349 
00350     ost << "Orientation with respect to the absolute frame : " <<
00351       mp.get_rot_phi() << " rad" << endl ;
00352 
00353     ost << "Central value of gam_euler : "
00354     << gam_euler()(0, 0, 0, 0)  << endl ;
00355 
00356     ost << "Central u_euler (U^X, U^Y, U^Z) [c] : "
00357     << u_euler(0)(0, 0, 0, 0) << "  "
00358     << u_euler(1)(0, 0, 0, 0) << "  "
00359     << u_euler(2)(0, 0, 0, 0) << endl ;
00360 
00361     if (irrotational) {
00362       ost << "Central d_psi (X, Y, Z) [c] :         "
00363       << d_psi(0)(0, 0, 0, 0) << "  "
00364       << d_psi(1)(0, 0, 0, 0) << "  "
00365       << d_psi(2)(0, 0, 0, 0) << endl ;
00366 
00367       ost << "Central vel. / co-orb. (W^X, W^Y, W^Z) [c] : "
00368       << wit_w(0)(0, 0, 0, 0) << "  "
00369       << wit_w(1)(0, 0, 0, 0) << "  "
00370       << wit_w(2)(0, 0, 0, 0) << endl ;
00371 
00372       ost << "Max vel. / co-orb. (W^X, W^Y, W^Z) [c] : "
00373       << max(max(wit_w(0))) << "  "
00374       << max(max(wit_w(1))) << "  "
00375       << max(max(wit_w(2))) << endl ;
00376 
00377       ost << "Min vel. / co-orb. (W^X, W^Y, W^Z) [c] : "
00378       << min(min(wit_w(0))) << "  "
00379       << min(min(wit_w(1))) << "  "
00380       << min(min(wit_w(2))) << endl ;
00381 
00382       double r_surf = mp.val_r(0,1.,M_PI/4,M_PI/4) ;
00383 
00384       ost << "Velocity at (r_surf,pi/4,pi/4) / co-orb. [c] : "
00385       << wit_w(0).val_point(r_surf,M_PI/4,M_PI/4) << "  "
00386       << wit_w(1).val_point(r_surf,M_PI/4,M_PI/4) << "  "
00387       << wit_w(2).val_point(r_surf,M_PI/4,M_PI/4) << endl ;
00388 
00389       ost << "Central value of loggam : "
00390       << loggam()(0, 0, 0, 0)  << endl ;
00391     }
00392 
00393     ost << "Central value of lapse(N) auto :             "
00394     << n_auto()(0, 0, 0, 0) << endl ;
00395 
00396     ost << "Central value of confpsi auto :              "
00397     << confpsi_auto()(0, 0, 0, 0) << endl ;
00398 
00399     ost << "Central value of shift (N^X, N^Y, N^Z) [c] : "
00400     << shift(0)(0, 0, 0, 0) << "  "
00401     << shift(1)(0, 0, 0, 0) << "  "
00402     << shift(2)(0, 0, 0, 0) << endl ;
00403 
00404     ost << "  ... shift_auto part of it [c] :            "
00405     << shift_auto(0)(0, 0, 0, 0) << "  "
00406     << shift_auto(1)(0, 0, 0, 0) << "  "
00407     << shift_auto(2)(0, 0, 0, 0) << endl ;
00408 
00409     ost << "  ... shift_comp part of it [c] :            "
00410     << shift_comp(0)(0, 0, 0, 0) << "  "
00411     << shift_comp(1)(0, 0, 0, 0) << "  "
00412     << shift_comp(2)(0, 0, 0, 0) << endl ;
00413 
00414     ost << "  ... w_shift (NB: components in the star Cartesian frame) [c] :  "
00415     << endl
00416     << w_shift(0)(0, 0, 0, 0) << "  "
00417     << w_shift(1)(0, 0, 0, 0) << "  "
00418     << w_shift(2)(0, 0, 0, 0) << endl ;
00419 
00420     ost << "Central value of khi_shift [km c] : "
00421         << khi_shift()(0, 0, 0, 0) / km << endl ;
00422 
00423     ost << endl << "Central value of (B^X, B^Y, B^Z)/N [c] : "
00424     << bsn(0)(0, 0, 0, 0) << "  "
00425     << bsn(1)(0, 0, 0, 0) << "  "
00426     << bsn(2)(0, 0, 0, 0) << endl ;
00427 
00428     ost << endl <<
00429       "Central (d/dX,d/dY,d/dZ)(logn_auto) [km^{-1}] : "
00430     << d_n_auto(0)(0, 0, 0, 0) * km << "  "
00431     << d_n_auto(1)(0, 0, 0, 0) * km << "  "
00432     << d_n_auto(2)(0, 0, 0, 0) * km << endl ;
00433 
00434     ost << endl <<
00435       "Central (d/dX,d/dY,d/dZ)(beta_auto) [km^{-1}] : "
00436     << d_confpsi_auto(0)(0, 0, 0, 0) * km << "  "
00437     << d_confpsi_auto(1)(0, 0, 0, 0) * km << "  "
00438     << d_confpsi_auto(2)(0, 0, 0, 0) * km << endl ;
00439 
00440     return ost ;
00441 }

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