strot_dirac_global.C

00001 /*
00002  *  Methods for computing global quantities within the class Star_rot_Dirac
00003  *
00004  *    (see file star.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2005 Lap-Ming Lin & Jerome Novak
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 strot_dirac_global_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/strot_dirac_global.C,v 1.11 2010/11/17 11:21:52 j_novak Exp $" ;
00029 
00030 /*
00031  * $Id: strot_dirac_global.C,v 1.11 2010/11/17 11:21:52 j_novak Exp $
00032  * $Log: strot_dirac_global.C,v $
00033  * Revision 1.11  2010/11/17 11:21:52  j_novak
00034  * Corrected minor problems in the case nz=1 and nt=1.
00035  *
00036  * Revision 1.10  2010/10/22 08:08:40  j_novak
00037  * Removal of the method Star_rot_dirac::lambda_grv2() and call to the C++ version of integrale2d.
00038  *
00039  * Revision 1.9  2009/10/26 10:54:33  j_novak
00040  * Added the case of a NONSYM base in theta.
00041  *
00042  * Revision 1.8  2008/05/30 08:27:38  j_novak
00043  * New global quantities rp_circ and ellipt (circumferential polar coordinate and
00044  * ellipticity).
00045  *
00046  * Revision 1.7  2008/02/18 13:51:20  j_novak
00047  * Change of a dzpuis
00048  *
00049  * Revision 1.6  2005/03/25 14:11:49  j_novak
00050  * In the 1D case, GRV2 returns -1 (because of a problem in integral2d).
00051  *
00052  * Revision 1.5  2005/02/17 17:30:42  f_limousin
00053  * Change the name of some quantities to be consistent with other classes
00054  * (for instance nnn is changed to nn, shift to beta, beta to lnq...)
00055  *
00056  * Revision 1.4  2005/02/09 13:36:01  lm_lin
00057  *
00058  * Add the calculations of GRV2, T/W, R_circ, and flattening.
00059  *
00060  * Revision 1.3  2005/02/02 10:11:24  j_novak
00061  * Better calculation of the GRV3 identity.
00062  *
00063  *
00064  *
00065  * $Header: /cvsroot/Lorene/C++/Source/Star/strot_dirac_global.C,v 1.11 2010/11/17 11:21:52 j_novak Exp $
00066  *
00067  */
00068 
00069 
00070 // C headers
00071 #include <math.h>
00072 #include <assert.h>
00073 
00074 // Lorene headers
00075 #include "star_rot_dirac.h"
00076 #include "unites.h"
00077 #include "utilitaires.h" 
00078 #include "proto.h"
00079 
00080         //-------------------------------------------------------//
00081         //                Baryonic mass                          //
00082         //                                                       //
00083         //  Note: In Lorene units, mean particle mass is unity   //
00084         //-------------------------------------------------------//
00085 
00086 
00087 double Star_rot_Dirac::mass_b() const {
00088 
00089   if (p_mass_b == 0x0) {    // a new computation is required
00090 
00091     Scalar dens = sqrt( gamma.determinant() ) * gam_euler * nbar ;
00092 
00093     dens.std_spectral_base() ;
00094 
00095     p_mass_b = new double( dens.integrale() ) ;
00096 
00097   }
00098 
00099   return *p_mass_b ;
00100 
00101 }
00102 
00103           //---------------------------------------------------------//
00104           //            Gravitational mass                           //   
00105           //                                                         //
00106           // Note: This is the Komar mass for stationary and         //
00107           //       asymptotically flat spacetime (see, eg, Wald)     //
00108           //---------------------------------------------------------//
00109 
00110 double Star_rot_Dirac::mass_g() const {
00111 
00112   if (p_mass_g == 0x0) {    // a new computation is required
00113 
00114     Scalar j_source = 2.* contract(contract(gamma.cov(), 0, j_euler, 0), 
00115                    0, beta, 0) ;
00116            
00117     Scalar dens = sqrt( gamma.determinant() ) *  
00118           ( nn * (ener_euler + s_euler) - j_source ) ;
00119 
00120     dens.std_spectral_base() ;
00121 
00122     p_mass_g = new double( dens.integrale() ) ;
00123 
00124   }
00125 
00126   return *p_mass_g ;
00127 
00128 }
00129 
00130                 //--------------------------------------//
00131                 //    Angular momentum                  //
00132                 //                                      // 
00133                 // Komar-type integral (see, eg, Wald)  //
00134                 //--------------------------------------// 
00135 
00136 double Star_rot_Dirac::angu_mom() const {
00137 
00138   if (p_angu_mom == 0x0) {    // a new computation is required
00139 
00140     // phi_kill = axial killing vector 
00141 
00142     Vector phi_kill(mp, CON, mp.get_bvect_spher()) ;
00143 
00144     phi_kill.set(1).set_etat_zero() ;
00145     phi_kill.set(2).set_etat_zero() ;
00146     phi_kill.set(3) = 1. ;
00147     phi_kill.set(3).std_spectral_base() ;
00148     phi_kill.set(3).mult_rsint() ;
00149 
00150     Scalar j_source = contract(contract(gamma.cov(), 0, j_euler, 0),
00151                    0, phi_kill, 0) ;
00152 
00153     Scalar dens = sqrt( gamma.determinant() ) * j_source  ;
00154 
00155     dens.std_spectral_base() ;
00156 
00157     p_angu_mom = new double( dens.integrale() ) ;
00158 
00159 
00160   }
00161 
00162   return *p_angu_mom ;
00163 
00164 }
00165 
00166                      //---------------------//
00167                      //        T/W          //
00168                      //---------------------//
00169 
00170 double Star_rot_Dirac::tsw() const {
00171 
00172   if (p_tsw == 0x0) {    // a new computation is required
00173 
00174     double tcin = 0.5 * omega * angu_mom() ;
00175 
00176     Scalar dens = sqrt( gamma.determinant() ) * gam_euler * ener ;
00177     
00178     dens.std_spectral_base() ;
00179     
00180     double mass_p = dens.integrale() ;
00181 
00182     p_tsw = new double( tcin / ( mass_p + tcin - mass_g() ) ) ;
00183 
00184   }
00185 
00186   return *p_tsw ;
00187 
00188 }
00189 
00190 
00191       //--------------------------------------------------------------//
00192       //                        GRV2                                  //   
00193       // cf. Eq. (28) of Bonazzola & Gourgoulhon CQG, 11, 1775 (1994) // 
00194       //                                                              //
00195       //--------------------------------------------------------------//
00196 
00197 double Star_rot_Dirac::grv2() const {
00198 
00199   using namespace Unites ;
00200 
00201   if (p_grv2 == 0x0) {    // a new computation is required
00202 
00203       // determinant of the 2-metric k_{ab}
00204       
00205       Scalar k_det = gamma.cov()(1,1)*gamma.cov()(2,2) - 
00206       gamma.cov()(1,2)*gamma.cov()(1,2) ;
00207       
00208       
00209       //**
00210       // sou_m = 8\pi T_{\mu\nu} m^{\mu}m^{\nu}
00211       // => sou_m = 8\pi [ (E+P) U^2 + P ], where v^2 = v_i v^i 
00212       //
00213       //**
00214       
00215       Scalar sou_m = 2 * qpig * ( (ener_euler + press)*v2 + press ) ;
00216       
00217       sou_m = sqrt( k_det )*sou_m ;
00218       
00219       sou_m.std_spectral_base() ;
00220       
00221       
00222       // This is the term 3k_a k^a. 
00223       
00224       Scalar sou_q = 3 *( taa(1,3) * aa(1,3) + taa(2,3)*aa(2,3) )  ;
00225       
00226       
00227       // This is the term \nu_{|| a}\nu^{|| a}. 
00228       //
00229       
00230       Scalar sou_tmp = gamma.con()(1,1) * logn.dsdr() * logn.dsdr() ;
00231       
00232       Scalar term_2 = 2 * gamma.con()(1,2) * logn.dsdr() * logn.dsdt() ;
00233       
00234       term_2.div_r_dzpuis(4) ;
00235       
00236       Scalar term_3 = gamma.con()(2,2) * logn.dsdt() * logn.dsdt() ;
00237       
00238       term_3.div_r_dzpuis(2) ;
00239       term_3.div_r_dzpuis(4) ;
00240       
00241       sou_tmp += term_2 + term_3 ;
00242       
00243       
00244       // Source of the gravitational part
00245       
00246       sou_q -= sou_tmp ;
00247       
00248       sou_q = sqrt( k_det )*sou_q ;
00249       
00250       sou_q.std_spectral_base() ;
00251       
00252       p_grv2 = new double( double(1) + integrale2d(sou_m)/integrale2d(sou_q) ) ;
00253 
00254   }
00255 
00256   return *p_grv2 ;
00257 
00258 }
00259 
00260 
00261      //-------------------------------------------------------------//
00262      //                 GRV3                                        //
00263      // cf. Eq. (29) of Gourgoulhon & Bonazzola CQG, 11, 443 (1994) //
00264      //-------------------------------------------------------------//
00265 
00266 double Star_rot_Dirac::grv3() const {
00267 
00268   using namespace Unites ;
00269 
00270   if (p_grv3 == 0x0) {    // a new computation is required
00271 
00272     // Gravitational term 
00273     // -------------------
00274 
00275     Scalar sou_q = 0.75*aa_quad - contract(logn.derive_cov(gamma), 0,
00276                        logn.derive_con(gamma), 0) ;
00277 
00278 
00279     Tensor t_tmp = contract(gamma.connect().get_delta(), 2, 
00280                 gamma.connect().get_delta(), 0) ;
00281 
00282     Scalar tmp_1 = 0.25* contract( gamma.con(), 0, 1, 
00283         contract(t_tmp, 0, 3), 0, 1 ) ;
00284 
00285     Scalar tmp_2 = 0.25* contract( gamma.con(), 0, 1, 
00286           contract( contract( gamma.connect().get_delta(), 0, 1), 
00287                        0, gamma.connect().get_delta(), 0), 0, 1)  ;
00288 
00289     sou_q = sou_q + tmp_1 - tmp_2 ;
00290 
00291     sou_q = sqrt( gamma.determinant() ) * sou_q ; 
00292 
00293     sou_q.std_spectral_base() ;
00294 
00295     double int_grav = sou_q.integrale() ;
00296 
00297 
00298     // Matter term 
00299     // --------------
00300 
00301     Scalar sou_m = qpig*s_euler ;
00302 
00303     sou_m = sqrt( gamma.determinant() ) * sou_m ;
00304 
00305     sou_m.std_spectral_base() ;
00306 
00307     double int_mat = sou_m.integrale() ;
00308 
00309     p_grv3 = new double( (int_grav + int_mat) / int_mat ) ;
00310     
00311 
00312 
00313   }
00314 
00315   return *p_grv3 ;
00316 
00317 }
00318 
00319 
00320                 //--------------------//
00321                 //     R_circ         //
00322                 //--------------------//
00323 
00324 double Star_rot_Dirac::r_circ() const {
00325 
00326   if (p_r_circ ==0x0) {  // a new computation is required
00327 
00328     // Index of the point at phi=0, theta=pi/2 at the surface of the star:
00329     const Mg3d* mg = mp.get_mg() ;
00330     int l_b = nzet - 1 ; 
00331     int i_b = mg->get_nr(l_b) - 1 ; 
00332     int j_b = (mg->get_type_t() == SYM ? mg->get_nt(l_b) - 1 : mg->get_nt(l_b) / 2) ; 
00333     int k_b = 0 ;
00334 
00335     double gamma_phi = gamma.cov()(3,3).val_grid_point(l_b, k_b, j_b, i_b) ;
00336 
00337     p_r_circ = new double( sqrt( gamma_phi ) * ray_eq() ) ;
00338 
00339   }
00340 
00341   return *p_r_circ ;
00342 
00343 }
00344 
00345 
00346                 //--------------------//
00347                 //     R_circ         //
00348                 //--------------------//
00349 
00350 double Star_rot_Dirac::rp_circ() const {
00351 
00352     if (p_rp_circ ==0x0) {  // a new computation is required
00353     const Mg3d& mg = *mp.get_mg() ;
00354     int nz = mg.get_nzone() ;
00355     assert(nz>2) ;
00356     int np = mg.get_np(0) ;
00357     if (np != 1) {
00358         cout << "The polar circumferential radius is only well defined\n"
00359          << "with np = 1!" << endl ;
00360         abort() ;
00361     }
00362     int nt = mg.get_nt(0) ;
00363     Sym_tensor gam = gamma.cov() ;
00364     const Coord& tet = mp.tet ;
00365     Scalar rrr(mp) ;
00366     rrr.annule_hard() ;
00367     rrr.annule(nzet,nz-1) ;
00368     double phi = 0 ;
00369     for (int j=0; j<nt; j++) {
00370         double theta = (+tet)(0, 0, j, 0) ;
00371         double erre = 
00372         mp.val_r(l_surf()(0,j), xi_surf()(0, j), theta, phi) ;
00373         for (int lz=0; lz<nzet; lz++) {
00374         int nrz = mg.get_nr(lz) ;
00375         for (int i=0; i<nrz; i++) {
00376             rrr.set_grid_point(lz, 0, j, i) = erre ; 
00377         }
00378         }
00379     }
00380     rrr.std_spectral_base() ;
00381     Scalar drrr = rrr.dsdt() ;
00382 
00383     Scalar fff(mp) ;
00384     fff.annule_hard() ;
00385     fff.annule(nzet,nz-1) ;
00386     for (int j=0; j<nt; j++) {
00387         double theta = (+tet)(0, 0, j, 0) ;
00388         int ls = l_surf()(0, j) ;
00389         double xs = xi_surf()(0, j) ;
00390         double grr = gam(1,1).get_spectral_va().val_point_jk(ls, xs, j, 0) ;
00391         double grt = gam(1,2).get_spectral_va().val_point_jk(ls, xs, j, 0) ;
00392         double gtt = gam(2,2).get_spectral_va().val_point_jk(ls, xs, j, 0) ;
00393         double rr = mp.val_r(ls, xs, theta, phi) ;
00394         double dr = drrr.get_spectral_va().val_point_jk(ls, xs, j, 0) ;
00395         for (int i=0; i< mg.get_nr(nzet-1); i++) {
00396         fff.set_grid_point(nzet-1, 0, j, i) 
00397             = sqrt(grr*dr*dr + 2*grt*rr*dr + gtt*rr*rr) ;
00398         }
00399     }
00400     fff.std_spectral_base() ;
00401     fff.set_spectral_va().coef() ;
00402     p_rp_circ = new double((*fff.get_spectral_va().c_cf)(nzet-1, 0, 0, 0)) ;      
00403     }
00404     return *p_rp_circ ;
00405 }
00406 
00407                 //--------------------------//
00408                 //       Flattening         //
00409                 //--------------------------//
00410 
00411 double Star_rot_Dirac::aplat() const {
00412 
00413   return ray_pole() / ray_eq() ;
00414 
00415 }
00416 
00417                 //--------------------------//
00418                 //       Ellipticity        //
00419                 //--------------------------//
00420 
00421 double Star_rot_Dirac::ellipt() const {
00422 
00423   return sqrt(1. - (rp_circ()*rp_circ())/(r_circ()*r_circ())) ;
00424 
00425 }

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