bin_bhns_omega_tp.C

00001 /*
00002  *  Methods of class Bin_bhns to compute an orbital angular velocity
00003  *   from two points at the stellar surface
00004  *
00005  *    (see file bin_bhns.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2006-2007 Keisuke Taniguchi
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License version 2
00016  *   as published by the Free Software Foundation.
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 char star_bhns_omega_tp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_bhns/bin_bhns_omega_tp.C,v 1.2 2008/05/15 19:00:27 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: bin_bhns_omega_tp.C,v 1.2 2008/05/15 19:00:27 k_taniguchi Exp $
00033  * $Log: bin_bhns_omega_tp.C,v $
00034  * Revision 1.2  2008/05/15 19:00:27  k_taniguchi
00035  * Change of some parameters.
00036  *
00037  * Revision 1.1  2007/06/22 01:10:00  k_taniguchi
00038  * *** empty log message ***
00039  *
00040  *
00041  * $Header: /cvsroot/Lorene/C++/Source/Bin_bhns/bin_bhns_omega_tp.C,v 1.2 2008/05/15 19:00:27 k_taniguchi Exp $
00042  *
00043  */
00044 
00045 // C++ headers
00046 //#include <>
00047 
00048 // C headers
00049 #include <math.h>
00050 
00051 // Lorene headers
00052 #include "bin_bhns.h"
00053 #include "unites.h"
00054 #include "utilitaires.h"
00055 
00056           //---------------------------------------------------//
00057           //     Orbaital angular velocity from two points     //
00058           //---------------------------------------------------//
00059 
00060 double Bin_bhns::omega_two_points() const {
00061 
00062     // Fundamental constants and units
00063     // -------------------------------
00064     using namespace Unites ;
00065 
00066     if (p_omega_two_points == 0x0) {   // a new computation is required
00067 
00068         double omega_two ;
00069 
00070     const Scalar& lapconf = star.get_lapconf_tot() ;
00071     const Scalar& confo = star.get_confo_tot() ;
00072     const Scalar& psi4 = star.get_psi4() ;
00073     const Vector& shift = star.get_shift_tot() ;
00074     const Scalar& gam = star.get_gam() ;
00075 
00076     int ii = (star.get_mp()).get_mg()->get_nr(0) - 1 ;
00077     int jj = (star.get_mp()).get_mg()->get_nt(0) - 1 ;
00078     int ka = 0 ;
00079     int kb = (star.get_mp()).get_mg()->get_np(0) / 2 ;
00080 
00081     double psi4_a = psi4.val_grid_point(0,ka,jj,ii) ;
00082     double psi4_b = psi4.val_grid_point(0,kb,jj,ii) ;
00083     double con2_a = confo.val_grid_point(0,ka,jj,ii)
00084       * confo.val_grid_point(0,ka,jj,ii) ;
00085     double con2_b = confo.val_grid_point(0,kb,jj,ii)
00086       * confo.val_grid_point(0,kb,jj,ii) ;
00087     double gam2_a = gam.val_grid_point(0,ka,jj,ii)
00088       * gam.val_grid_point(0,ka,jj,ii) ;
00089     double gam2_b = gam.val_grid_point(0,kb,jj,ii)
00090       * gam.val_grid_point(0,kb,jj,ii) ;
00091     double lap2_a = lapconf.val_grid_point(0,ka,jj,ii)
00092       * lapconf.val_grid_point(0,ka,jj,ii) ;
00093     double lap2_b = lapconf.val_grid_point(0,kb,jj,ii)
00094       * lapconf.val_grid_point(0,kb,jj,ii) ;
00095     double shiftx_a = shift(1).val_grid_point(0,ka,jj,ii) ;
00096     double shiftx_b = shift(1).val_grid_point(0,kb,jj,ii) ;
00097     double shifty_a = shift(2).val_grid_point(0,ka,jj,ii) ;
00098     double shifty_b = shift(2).val_grid_point(0,kb,jj,ii) ;
00099     double shiftz_a = shift(3).val_grid_point(0,ka,jj,ii) ;
00100     double shiftz_b = shift(3).val_grid_point(0,kb,jj,ii) ;
00101 
00102     double xns_rot = (star.get_mp()).get_ori_x() - x_rot ;
00103     double yns_rot = (star.get_mp()).get_ori_y() - y_rot ;
00104 
00105     double ra = star.ray_eq() ;
00106     double rb = star.ray_eq_pi() ;
00107 
00108     if (hole.is_kerrschild()) {
00109 
00110         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00111         abort() ;
00112         /*
00113         double y_separ = (star.get_mp()).get_ori_y() ;
00114         double xbh_rot = (hole.get_mp()).get_ori_x() - x_rot ;
00115         double mass = ggrav * hole.get_mass_bh() ;
00116         double rbh_a = sqrt( (ra+separ)*(ra+separ) + y_separ*y_separ ) ;
00117         double rbh_b = sqrt( (-rb+separ)*(-rb+separ) + y_separ*y_separ ) ;
00118 
00119         double msr_a = 2.*mass / pow(rbh_a, 3.) ;
00120         double msr_b = 2.*mass / pow(rbh_b, 3.) ;
00121 
00122         double sa = shiftx_a*shiftx_a+shifty_a*shifty_a+shiftz_a*shiftz_a
00123           + msr_a * ((ra+separ)*shiftx_a + y_separ*shifty_a)
00124           * ((ra+separ)*shiftx_a + y_separ*shifty_a) ;
00125 
00126         double sb = shiftx_b*shiftx_b+shifty_b*shifty_b+shiftz_b*shiftz_b
00127           + msr_b * ((-rb+separ)*shiftx_b + y_separ*shifty_b)
00128           * ((-rb+separ)*shiftx_b + y_separ*shifty_b) ;
00129 
00130         double ta = -shiftx_a*yns_rot + shifty_a*(ra+xns_rot)
00131           + msr_a * ((ra+separ)*shiftx_a + y_separ*shifty_a)
00132           * y_separ * xbh_rot ;
00133 
00134         double tb = -shiftx_b*yns_rot + shifty_b*(-rb+xns_rot)
00135           + msr_b * ((-rb+separ)*shiftx_b + y_separ*shifty_b)
00136           * y_separ * xbh_rot ;
00137 
00138         double ua = yns_rot*yns_rot + (ra+xns_rot)*(ra+xns_rot)
00139           + msr_a * y_separ * y_separ * xbh_rot * xbh_rot ;
00140 
00141         double ub = yns_rot*yns_rot + (-rb+xns_rot)*(-rb+xns_rot)
00142           + msr_b * y_separ * y_separ * xbh_rot * xbh_rot ;
00143 
00144         // Coefficients : Omega^2 * aaa + 2*Omega * bbb + ccc = 0
00145         // ------------------------------------------------------
00146 
00147         double aaa = psi4_a * gam2_a * ua - psi4_b * gam2_b * ub ;
00148         double bbb = psi4_a * gam2_a * ta - psi4_b * gam2_b * tb ;
00149         double ccc = psi4_a * gam2_a * sa - psi4_b * gam2_b * sb
00150           - lap2_a * gam2_a + lap2_b * gam2_b ;
00151 
00152         // Term inside the square root : ddd = bbb*bbb - aaa*ccc
00153         // -----------------------------------------------------
00154 
00155         double ddd = bbb*bbb - aaa*ccc ;
00156 
00157         if ( ddd < 0 ) {
00158             cout <<
00159           "!!! WARNING : Omega (from two points) does not exist !!!"
00160              << endl ;
00161 
00162         omega_two = 0. ;
00163         }
00164         else {
00165 
00166             double omega_1 = (-bbb + sqrt(ddd)) / aaa ;
00167         double omega_2 = (-bbb - sqrt(ddd)) / aaa ;
00168 
00169         cout << "Bin_bhns::omega_two_points:" << endl ;
00170         cout << "   omega_1 : " << omega_1 * f_unit << " [rad/s]"
00171              << endl ;
00172         cout << "   omega_2 : " << omega_2 * f_unit << " [rad/s]"
00173              << endl ;
00174 
00175         omega_two = omega_1 ;
00176 
00177         }
00178         */
00179     }
00180     else {  // Isotropic coordinates with the maximal slicing
00181 
00182         double sa = shiftx_a*shiftx_a+shifty_a*shifty_a+shiftz_a*shiftz_a ;
00183         double sb = shiftx_b*shiftx_b+shifty_b*shifty_b+shiftz_b*shiftz_b ;
00184 
00185         double ta = -shiftx_a*yns_rot + shifty_a*(ra+xns_rot) ;
00186         double tb = -shiftx_b*yns_rot + shifty_b*(-rb+xns_rot) ;
00187 
00188         double ua = yns_rot*yns_rot + (ra+xns_rot)*(ra+xns_rot) ;
00189         double ub = yns_rot*yns_rot + (-rb+xns_rot)*(-rb+xns_rot) ;
00190 
00191         // Coefficients : Omega^2 * aaa + 2*Omega * bbb + ccc = 0
00192         // ------------------------------------------------------
00193 
00194         double aaa = psi4_a * gam2_a * ua - psi4_b * gam2_b * ub ;
00195         double bbb = psi4_a * gam2_a * ta - psi4_b * gam2_b * tb ;
00196         double ccc = psi4_a * gam2_a * sa - psi4_b * gam2_b * sb
00197           - lap2_a * gam2_a / con2_a + lap2_b * gam2_b / con2_b ;
00198 
00199         // Term inside the square root : ddd = bbb*bbb - aaa*ccc
00200         // -----------------------------------------------------
00201 
00202         double ddd = bbb*bbb - aaa*ccc ;
00203 
00204         if ( ddd < 0 ) {
00205             cout <<
00206           "!!! WARNING : Omega (from two points) does not exist !!!"
00207              << endl ;
00208 
00209         omega_two = 0. ;
00210         }
00211         else {
00212 
00213             double omega_1 = (-bbb + sqrt(ddd)) / aaa ;
00214         double omega_2 = (-bbb - sqrt(ddd)) / aaa ;
00215 
00216         cout << "Bin_bhns::omega_two_points:" << endl ;
00217         cout << "   omega_1 : " << omega_1 * f_unit << " [rad/s]"
00218              << endl ;
00219         cout << "   omega_2 : " << omega_2 * f_unit << " [rad/s]"
00220              << endl ;
00221 
00222         omega_two = omega_1 ;
00223 
00224         }
00225 
00226     }
00227 
00228         p_omega_two_points = new double( omega_two ) ;
00229 
00230     }
00231 
00232     return *p_omega_two_points ;
00233 
00234 }

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