bin_bhns_extr.C

00001 /*
00002  *  Methods of class Bin_bhns_extr
00003  *
00004  *    (see file bin_bhns_extr.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2004-2005 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 bin_bhns_extr_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_bhns_extr/bin_bhns_extr.C,v 1.8 2005/02/28 23:06:16 k_taniguchi Exp $" ;
00029 
00030 /*
00031  * $Id: bin_bhns_extr.C,v 1.8 2005/02/28 23:06:16 k_taniguchi Exp $
00032  * $Log: bin_bhns_extr.C,v $
00033  * Revision 1.8  2005/02/28 23:06:16  k_taniguchi
00034  * Modification of some arguments to include the case of the conformally
00035  * flat background metric.
00036  *
00037  * Revision 1.7  2004/12/13 21:08:59  k_taniguchi
00038  * Addition of some outputs in display_poly.
00039  *
00040  * Revision 1.6  2004/12/03 20:17:52  k_taniguchi
00041  * Correction of "display_poly">
00042  *
00043  * Revision 1.5  2004/12/02 22:43:35  k_taniguchi
00044  * Modification of "display_poly".
00045  *
00046  * Revision 1.4  2004/12/02 17:36:42  k_taniguchi
00047  * Modification of "display_poly()".
00048  *
00049  * Revision 1.3  2004/12/01 16:37:11  k_taniguchi
00050  * Modification of the output again.
00051  *
00052  * Revision 1.2  2004/12/01 16:27:09  k_taniguchi
00053  * Modification of the output.
00054  *
00055  * Revision 1.1  2004/11/30 20:45:49  k_taniguchi
00056  * *** empty log message ***
00057  *
00058  *
00059  * $Header: /cvsroot/Lorene/C++/Source/Bin_bhns_extr/bin_bhns_extr.C,v 1.8 2005/02/28 23:06:16 k_taniguchi Exp $
00060  *
00061  */
00062 
00063 // C headers
00064 #include <math.h>
00065 
00066 // Lorene headers
00067 #include "bin_bhns_extr.h"
00068 #include "eos.h"
00069 #include "utilitaires.h"
00070 #include "unites.h"
00071 
00072           //--------------------------------//
00073           //          Constructors          //
00074           //--------------------------------//
00075 
00076 // Standard constructor
00077 // --------------------
00078 Bin_bhns_extr::Bin_bhns_extr(Map& mp, int nzet, const Eos& eos, bool irrot,
00079                  bool relat, bool kerrs, bool multi)
00080     : ref_triad(0., "Absolute frame Cartesian basis"),
00081       star(mp, nzet, relat, eos, irrot, ref_triad, kerrs, multi)
00082 {
00083 
00084     omega = 0. ;
00085     separ = 0. ;
00086     mass_bh = 0. ;
00087 
00088     // Pointers of derived quantities initialized to zero :
00089     set_der_0x0() ;
00090 
00091 }
00092 
00093 // Copy constructor
00094 // ----------------
00095 Bin_bhns_extr::Bin_bhns_extr(const Bin_bhns_extr& bibi)
00096     : ref_triad(0., "Absolute frame Cartesian basis"),
00097       star(bibi.star),
00098       omega(bibi.omega),
00099       separ(bibi.separ),
00100       mass_bh(bibi.mass_bh)
00101 {
00102 
00103     // Pointers of derived quantities initialized to zero :
00104     set_der_0x0() ;
00105 
00106 }
00107 
00108 // Constructor from a file
00109 // -----------------------
00110 Bin_bhns_extr::Bin_bhns_extr(Map& mp, const Eos& eos, FILE* fich)
00111     : ref_triad(0., "Absolute frame Cartesian basis"),
00112       star(mp, eos, ref_triad, fich)
00113 {
00114 
00115     // omega and x_axe are read in the file :
00116     fread_be(&omega, sizeof(double), 1, fich) ;
00117     fread_be(&separ, sizeof(double), 1, fich) ;
00118     fread_be(&mass_bh, sizeof(double), 1, fich) ;
00119 
00120     // Pointers of derived quantities initialized to zero :
00121     set_der_0x0() ;
00122 
00123 }
00124 
00125           //------------------------------//
00126           //          Destructor          //
00127           //------------------------------//
00128 
00129 Bin_bhns_extr::~Bin_bhns_extr()
00130 {
00131     del_deriv() ;
00132 }
00133 
00134           //----------------------------------------------------//
00135           //          Management of derived quantities          //
00136           //----------------------------------------------------//
00137 
00138 void Bin_bhns_extr::del_deriv() const {
00139 
00140     if (p_xa_barycenter_extr != 0x0) delete p_xa_barycenter_extr ;
00141     if (p_ya_barycenter_extr != 0x0) delete p_ya_barycenter_extr ;
00142     if (p_mass_b_extr != 0x0) delete p_mass_b_extr ;
00143 
00144     set_der_0x0() ;
00145 
00146 }
00147 
00148 void Bin_bhns_extr::set_der_0x0() const {
00149 
00150     p_xa_barycenter_extr = 0x0 ;
00151     p_ya_barycenter_extr = 0x0 ;
00152     p_mass_b_extr = 0x0 ;
00153 
00154 }
00155 
00156           //------------------------------//
00157           //          Assignment          //
00158           //------------------------------//
00159 
00160 // Assignment to another Bin_bhns_extr
00161 // -----------------------------------
00162 void Bin_bhns_extr::operator=(const Bin_bhns_extr& bibi) {
00163 
00164     assert( bibi.ref_triad == ref_triad ) ;
00165 
00166     star = bibi.star ;
00167 
00168     omega = bibi.omega ;
00169     separ = bibi.separ ;
00170     mass_bh = bibi.mass_bh ;
00171 
00172     // ref_triad remains unchanged
00173 
00174     del_deriv() ;  // Deletes all derived quantities
00175 
00176 }
00177 
00178           //---------------------------//
00179           //          Outputs          //
00180           //---------------------------//
00181 
00182 // Save in a file
00183 // --------------
00184 void Bin_bhns_extr::sauve(FILE* fich) const {
00185 
00186     star.sauve(fich) ;
00187 
00188     fwrite_be(&omega, sizeof(double), 1, fich) ;
00189     fwrite_be(&separ, sizeof(double), 1, fich) ;
00190     fwrite_be(&mass_bh, sizeof(double), 1, fich) ;
00191 
00192 }
00193 
00194 // Printing
00195 // --------
00196 ostream& operator<<(ostream& ost, const Bin_bhns_extr& bibi) {
00197 
00198     bibi >> ost ;
00199     return ost ;
00200 
00201 }
00202 
00203 ostream& Bin_bhns_extr::operator>>(ostream& ost) const {
00204 
00205   using namespace Unites ;
00206 
00207     ost << endl ;
00208     ost << "Binary BH-NS system" << endl ;
00209     ost << "===================" << endl ;
00210     ost << endl ;
00211     if (star.in_kerrschild()) {
00212         ost << "Kerr-Schild background metric" << endl ;
00213     ost << "-----------------------------" << endl ;
00214     }
00215     else {
00216         ost << "Conformally flat background metric" << endl ;
00217     ost << "----------------------------------" << endl ;
00218     }
00219     if (star.with_multipole()) {
00220         ost << "Multipole falloff boundary condition" << endl ;
00221     ost << "------------------------------------" << endl ;
00222     }
00223     else {
00224         ost << "1/r falloff boundary condition" << endl ;
00225     ost << "------------------------------" << endl ;
00226     }
00227     ost << endl
00228     << "Orbital angular velocity :                "
00229     << omega * f_unit << " rad/s" << endl ;
00230     ost << "Coordinate separation between BH and NS : "
00231     << separ / km << " km" << endl ;
00232 
00233     ost << endl << "Neutron star : " ;
00234     ost << endl << "============   " << endl ;
00235     ost << endl ;
00236     if (star.is_relativistic()) {
00237     ost << "Relativistic star" << endl ;
00238     ost << "-----------------" << endl ;
00239     }
00240     else {
00241         ost << "WARNING : BH-NS binary should be relativistic !!!" << endl ;
00242     ost << "-------------------------------------------------" << endl ;
00243     }
00244     ost << "Number of domains occupied by the star : " << star.get_nzet()
00245     << endl ;
00246     ost << "Equation of state : " << endl ;
00247     ost << star.get_eos() << endl ;
00248 
00249     ost << endl
00250     << "Enthalpy at the coordinate origin :              "
00251     << star.get_ent()()(0,0,0,0) << " c^2" << endl ;
00252     ost << "Proper baryon density at the coordinate origin : "
00253     << star.get_nbar()()(0,0,0,0) << " x 0.1 fm^-3" << endl ;
00254     ost << "Proper energy density at the coordinate origin : "
00255     << star.get_ener()()(0,0,0,0) << " rho_nuc c^2" << endl ;
00256     ost << "Pressure at the coordinate origin :              "
00257     << star.get_press()()(0,0,0,0) << " rho_nuc c^2" << endl ;
00258     ost << endl
00259     << "Lapse N at the coordinate origin :              "
00260     << star.get_nnn()()(0,0,0,0) << endl ;
00261     ost << "Conformal factor A^2 at the coordinate origin : "
00262     << star.get_a_car()()(0,0,0,0) << endl ;
00263 
00264     ost << endl
00265     << "Equatorial radius (to BH) a_to :       "
00266     << star.ray_eq_pi()/km << " km" << endl ;
00267     ost << "Equatorial radius (opp. to BH) a_opp : "
00268     << star.ray_eq()/km << " km" << endl ;
00269 
00270     ost << endl
00271     << "Baryon mass in isolation :        " << star.mass_b() / msol
00272     << " Mo" << endl
00273     << "Gravitational mass in isolation : " << star.mass_g() / msol
00274     << " Mo" << endl
00275     << "Baryon mass in a binary system :  " << mass_b_extr() / msol
00276     << " Mo" << endl ;
00277 
00278     ost << endl ;
00279     ost << "Star in a binary system" << endl ; 
00280     ost << "-----------------------" << endl ;
00281 
00282     if (star.is_irrotational()) {
00283         ost << "irrotational configuration" << endl ;
00284     }
00285     else {
00286         ost << "corotating configuration" << endl ;
00287     }
00288 
00289     ost << "Absolute abscidia of the stellar center: "
00290     << star.get_mp().get_ori_x()/km << " km" << endl ;
00291     ost << "Orientation with respect to the absolute frame : "
00292     << star.get_mp().get_rot_phi() << " rad" << endl ;
00293 
00294     double r0 = 0.5 * ( star.ray_eq() + star.ray_eq_pi() ) ;
00295                            // = 1 in Baumgarte et al.
00296     double d_ns = separ + star.ray_eq() - r0 ;
00297                            // Orbital separation of Baumgarte et al.
00298     double d_tilde = d_ns / r0 ; // Normalized separation of Baumgarte et al.
00299 
00300     ost << endl << "Comparison with those by Baumgarte et al. :" << endl ;
00301     ost << "     Radius r0 :              " << r0 / km << " km " << endl ;
00302     ost << "     Separation d :           " << d_ns / km << " km " << endl ;
00303     ost << "     Normalized sep. (d/r0) : " << d_tilde << endl ;
00304 
00305     ost << endl << "Black hole : " ;
00306     ost << endl << "==========   " << endl ;
00307     ost << "Gravitational mass of BH : "
00308     << mass_bh / msol << " M_sol" << endl ;
00309 
00310     return ost ;
00311 
00312 }
00313 
00314 // Display in polytropic units
00315 // ---------------------------
00316 void Bin_bhns_extr::display_poly(ostream& ost) const {
00317 
00318   using namespace Unites ;
00319 
00320     const Eos* p_eos = &( star.get_eos() ) ;
00321     const Eos_poly* p_eos_poly = dynamic_cast<const Eos_poly*>( p_eos ) ;
00322 
00323     if (p_eos_poly != 0x0) {
00324 
00325         double kappa = p_eos_poly->get_kap() ;
00326     double gamma = p_eos_poly->get_gam() ;
00327     double kap_ns2 = pow( kappa,  0.5 /(gamma-1) ) ;
00328 
00329     // Polytropic unit of length in terms of r_unit :
00330     double r_poly = kap_ns2 / sqrt(ggrav) ;
00331 
00332     // Polytropic unit of time in terms of t_unit :
00333     double t_poly = r_poly ;
00334 
00335     // Polytropic unit of mass in terms of m_unit :
00336     double m_poly = r_poly / ggrav ;
00337 
00338     // Polytropic unit of angular momentum in terms of j_unit :
00339     //    double j_poly = r_poly * r_poly / ggrav ;
00340 
00341     double r0 = 0.5 * ( star.ray_eq() + star.ray_eq_pi() ) ;
00342                 // = 1 in Baumgarte et al.
00343     double d_ns = separ + star.ray_eq() - r0 ;
00344                 // Orbital separation of Baumgarte et al.
00345 
00346     ost.precision(16) ;
00347     ost << endl << "Quantities in polytropic units : " ;
00348     ost << endl << "==============================" << endl ;
00349     ost << " ( r_poly = " << r_poly / km << " km )" << endl ;
00350     ost << "  d_e_max   :   " << separ / r_poly << endl ;
00351     ost << "  d_G_x :       " << xa_barycenter_extr() / r_poly << endl
00352         << "  d_G_y :       " << ya_barycenter_extr() / r_poly << endl ;
00353     ost << "  d_bh/M_bh :   " << d_ns/r_poly / (mass_bh/m_poly) << endl ;
00354     ost << "  Omega :       " << omega * t_poly << endl ;
00355     ost << "  Omega M_bh :  " << omega * t_poly * mass_bh / m_poly
00356         << endl ;
00357     ost << "  M_bar(NS) :   " << mass_b_extr() / m_poly << endl ;
00358     ost << "  M_bar(NS_0) : " << star.mass_b() / m_poly << endl ;
00359     ost << "  R_0(NS) :     "
00360         << 0.5 * (star.ray_eq() + star.ray_eq_pi()) / r_poly << endl ;
00361     ost << "  M_grv(BH) :   " << mass_bh / m_poly << endl ;
00362 
00363     }
00364 
00365 }

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