00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
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
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
00068
00069 using namespace Unites ;
00070
00071 int nzm1 = mp.get_mg()->get_nzone() - 1 ;
00072
00073
00074
00075
00076
00077 Scalar hhh = exp(ent) ;
00078 hhh.std_spectral_base() ;
00079
00080
00081
00082
00083
00084
00085 Vector www = hhh * gam_euler * bsn * psi4 ;
00086
00087 www.change_triad( mp.get_bvect_cart() ) ;
00088
00089
00090
00091
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
00106
00107
00108 Scalar dndh_log = eos.der_nbar_ent(ent, nzet) ;
00109
00110
00111
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 }
00131 else {
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 }
00157
00158
00159
00160
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
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
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
00219
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 }