star_bhns_vel_pot.C

00001 /*
00002  *  Method of class Star_bhns to compute the velocity scalar potential $\psi$
00003  *  by solving the continuity equation.
00004  *
00005  *    (see file star_bhns.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2005-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_vel_pot_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star_bhns/star_bhns_vel_pot.C,v 1.2 2008/05/15 19:20:29 k_taniguchi Exp $" ;
00030 
00031 /*
00032  * $Id: star_bhns_vel_pot.C,v 1.2 2008/05/15 19:20:29 k_taniguchi Exp $
00033  * $Log: star_bhns_vel_pot.C,v $
00034  * Revision 1.2  2008/05/15 19:20:29  k_taniguchi
00035  * Change of some parameters.
00036  *
00037  * Revision 1.1  2007/06/22 01:33:14  k_taniguchi
00038  * *** empty log message ***
00039  *
00040  *
00041  * $Header: /cvsroot/Lorene/C++/Source/Star_bhns/star_bhns_vel_pot.C,v 1.2 2008/05/15 19:20:29 k_taniguchi Exp $
00042  *
00043  */
00044 
00045 // C++ headers
00046 //#include <>
00047 
00048 // C headers
00049 //#include <>
00050 
00051 // Lorene headers
00052 #include "star_bhns.h"
00053 #include "eos.h"
00054 #include "param.h"
00055 #include "cmp.h"
00056 #include "tenseur.h"
00057 #include "utilitaires.h"
00058 #include "unites.h"
00059 
00060 // Local prototype
00061 Cmp raccord_c1(const Cmp& uu, int l1) ;
00062 
00063 double Star_bhns::velo_pot_bhns(const double& mass_bh, const double& sepa,
00064                 bool kerrschild, int mermax, double precis,
00065                 double relax) {
00066 
00067     // Fundamental constants and units
00068     // -------------------------------
00069     using namespace Unites ;
00070 
00071     int nzm1 = mp.get_mg()->get_nzone() - 1 ;
00072 
00073     //--------------------------------
00074     // Specific relativistic enthalpy      ---> hhh
00075     //--------------------------------
00076 
00077     Scalar hhh = exp(ent) ;
00078     hhh.std_spectral_base() ;
00079 
00080     //---------------------------------------------------
00081     // Computation of W^i = psi4 h Gamma_n B^i/lapse_tot
00082     // See Eq (62) from Gourgoulhon et al. (2001)
00083     //---------------------------------------------------
00084 
00085     Vector www = hhh * gam_euler * bsn * psi4 ;
00086 
00087     www.change_triad( mp.get_bvect_cart() ) ;  // components on the mapping
00088                                                // Cartesian basis
00089 
00090     //-------------------------------------------------
00091     // Constant value of W^i at the center of the star
00092     //-------------------------------------------------
00093 
00094     Vector v_orb(mp, CON, mp.get_bvect_cart()) ;
00095     v_orb.set_etat_qcq() ;
00096 
00097     for (int i=1; i<=3; i++) {
00098         v_orb.set(i) = www(i).val_grid_point(0, 0, 0, 0) ;
00099     }
00100 
00101     v_orb.set_triad( *(www.get_triad()) ) ;
00102     v_orb.std_spectral_base() ;
00103 
00104     //-------------------------------------------------
00105     // Source and coefficients a,b for poisson_compact (independent from psi0)
00106     //-------------------------------------------------
00107 
00108     Scalar dndh_log = eos.der_nbar_ent(ent, nzet) ;
00109 
00110     // In order to avoid any division by zero in the computation of zeta_h
00111     //  the value of dndh_log is set to 1 in the external domains:
00112     for (int l=nzet; l<=nzm1; l++) {
00113         dndh_log.set_domain(l) = 1. ;
00114     }
00115 
00116     Scalar zeta_h( ent / dndh_log ) ;
00117     zeta_h.std_spectral_base() ;
00118 
00119     double erreur ;
00120 
00121     Scalar source(mp) ;
00122     Vector bb(mp, CON, mp.get_bvect_spher()) ;
00123     Metric_flat flat_spher( mp.flat_met_spher() ) ;
00124 
00125     if (kerrschild) {
00126 
00127         cout << "!!!!! WARNING: Not yet available !!!!!" << endl ;
00128     abort() ;
00129 
00130     }  // End of Kerr-Schild
00131     else {  // Isotropic coordinates with the maximal slicing
00132 
00133         Scalar lnlappsi(mp) ;
00134     lnlappsi = log( lapconf_tot * confo_tot ) ;
00135     lnlappsi.std_spectral_base() ;
00136 
00137     bb = (1. - zeta_h) * ent.derive_con(flat_spher)
00138       + zeta_h * lnlappsi.derive_con(flat_spher) ;
00139 
00140     Vector dentmb(mp, COV, mp.get_bvect_cart()) ;
00141     dentmb.set_etat_qcq() ;
00142     for (int i=1; i<=3; i++) {
00143         dentmb.set(i) = ent.deriv(i)
00144           - (d_lapconf_auto(i) + d_lapconf_comp(i)) / lapconf_tot
00145           - (d_confo_auto(i) + d_confo_comp(i)) / confo_tot ;
00146     }
00147     dentmb.std_spectral_base() ;
00148 
00149     source = contract(www - v_orb, 0, ent.derive_cov(flat), 0)
00150       +zeta_h*(contract(v_orb, 0, dentmb, 0)
00151            + contract(www/gam_euler, 0, gam_euler.derive_cov(flat), 0)
00152            ) ;
00153 
00154     source.annule(nzet, nzm1) ;
00155 
00156     }  // End of Isotropic coordinates
00157 
00158 
00159     //----------------------------------------------------
00160     // Resolution by means of Map_radial::poisson_compact
00161     //----------------------------------------------------
00162 
00163     Param par ;
00164     int niter ;
00165     par.add_int(mermax) ;
00166     par.add_double(precis, 0) ;
00167     par.add_double(relax, 1) ;
00168     par.add_int_mod(niter) ;
00169 
00170     if (psi0.get_etat() == ETATZERO) {
00171         psi0 = 0. ;
00172     }
00173 
00174     Cmp source_cmp(source) ;
00175     Cmp zeta_h_cmp(zeta_h) ;
00176     Cmp psi0_cmp(psi0) ;
00177 
00178     Tenseur bb_cmp(mp, 1, CON, mp.get_bvect_spher()) ;
00179     bb_cmp.set_etat_qcq() ;
00180     Cmp bb_cmp1(bb(1)) ;
00181     Cmp bb_cmp2(bb(2)) ;
00182     Cmp bb_cmp3(bb(3)) ;
00183     bb_cmp.set(0) = bb_cmp1 ;
00184     bb_cmp.set(1) = bb_cmp2 ;
00185     bb_cmp.set(2) = bb_cmp3 ;
00186 
00187     source_cmp.va.ylm() ;
00188 
00189     mp.poisson_compact(source_cmp, zeta_h_cmp, bb_cmp, par, psi0_cmp) ;
00190 
00191     psi0 = psi0_cmp ;
00192 
00193     //-----------------------
00194     // Check of the solution
00195     //-----------------------
00196 
00197     Scalar bb_dpsi0 = contract(bb, 0, psi0.derive_cov(flat_spher), 0) ;
00198 
00199     Scalar oper = zeta_h * psi0.laplacian() + bb_dpsi0 ;
00200 
00201     source.set_spectral_va().ylm_i() ;
00202 
00203     erreur = diffrel(oper, source)(0) ;
00204 
00205     cout << "Check of the resolution of the continuity equation : "
00206      << endl ;
00207     cout << "            norme(source) : " << norme(source)(0)
00208      << "    diff oper/source : " << erreur << endl ;
00209 
00210     //--------------------------
00211     // Computation of grad(psi)
00212     //--------------------------
00213 
00214     for (int i=1; i<=3; i++)
00215         d_psi.set(i) = (psi0.derive_cov(flat))(i) + v_orb(i) ;
00216 
00217 
00218     // C^1 continuation of d_psi outside the star
00219     //  (to ensure a smooth enthalpy field accross the stellar surface)
00220     // ----------------------------------------------------------------
00221 
00222     d_psi.annule(nzet, nzm1) ;
00223 
00224     for (int i=1; i<=3; i++) {
00225         Cmp d_psi_i( d_psi(i) ) ;
00226     d_psi_i = raccord_c1(d_psi_i, nzet) ;
00227     d_psi.set(i) = d_psi_i ;
00228     }
00229 
00230     return erreur ;
00231 
00232 }

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