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
00030
00031 char star_bin_vel_pot_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_bin_vel_pot.C,v 1.6 2005/09/13 19:38:31 f_limousin Exp $" ;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #include "star.h"
00062 #include "eos.h"
00063 #include "param.h"
00064 #include "cmp.h"
00065 #include "tenseur.h"
00066 #include "graphique.h"
00067 #include "utilitaires.h"
00068
00069
00070 Cmp raccord_c1(const Cmp& uu, int l1) ;
00071
00072 double Star_bin::velocity_potential(int mermax, double precis, double relax) {
00073
00074 int nzm1 = mp.get_mg()->get_nzone() - 1 ;
00075
00076
00077
00078
00079
00080 Scalar hhh = exp(ent) ;
00081 hhh.std_spectral_base() ;
00082
00083
00084
00085
00086
00087
00088 Vector www = hhh * gam_euler * bsn * psi4 ;
00089
00090 www.change_triad( mp.get_bvect_cart() ) ;
00091
00092
00093
00094
00095
00096
00097 Vector v_orb(mp, CON, mp.get_bvect_cart()) ;
00098
00099 v_orb.set_etat_qcq() ;
00100 for (int i=1; i<=3; i++) {
00101 v_orb.set(i) = www(i).val_grid_point(0, 0, 0, 0) ;
00102 }
00103
00104 v_orb.set_triad( *(www.get_triad()) ) ;
00105 v_orb.std_spectral_base() ;
00106
00107
00108
00109
00110
00111 Scalar dndh_log = eos.der_nbar_ent(ent, nzet) ;
00112
00113
00114
00115 for (int l=nzet; l <= nzm1; l++) {
00116 dndh_log.set_domain(l) = 1 ;
00117 }
00118
00119 Scalar zeta_h( ent / dndh_log ) ;
00120 zeta_h.std_spectral_base() ;
00121
00122 Metric_flat flat_spher (mp.flat_met_spher()) ;
00123 Vector bb = (1 - zeta_h) * ent.derive_con(flat_spher) +
00124 zeta_h * lnq.derive_con(flat_spher) ;
00125
00126 Scalar entmb = ent - lnq ;
00127
00128 www.change_triad(mp.get_bvect_cart()) ;
00129 v_orb.change_triad(mp.get_bvect_cart()) ;
00130
00131 Tensor dcovdcov_psi0 = psi0.derive_cov(flat).derive_cov(flat) ;
00132 dcovdcov_psi0.inc_dzpuis() ;
00133
00134
00135 Scalar source = contract(www - v_orb, 0, ent.derive_cov(flat), 0)
00136 + zeta_h * ( contract(v_orb, 0, entmb.derive_cov(flat), 0) +
00137 contract(www/gam_euler, 0, gam_euler.derive_cov(flat), 0)
00138 + contract(hij, 0, 1, (psi0.derive_cov(flat)
00139 + v_orb.down(0, flat))*entmb.derive_cov(flat),
00140 0, 1)
00141 - contract(hij, 0, 1, dcovdcov_psi0, 0, 1))
00142 - contract(hij, 0, 1, ent.derive_cov(flat) * (psi0.derive_cov(flat)
00143 + v_orb.down(0, flat)),
00144 0, 1) ;
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 www.change_triad(mp.get_bvect_cart()) ;
00163 v_orb.change_triad(mp.get_bvect_cart()) ;
00164
00165 source.annule(nzet, nzm1) ;
00166
00167
00168
00169
00170
00171 Param par ;
00172 int niter ;
00173 par.add_int(mermax) ;
00174 par.add_double(precis, 0) ;
00175 par.add_double(relax, 1) ;
00176 par.add_int_mod(niter) ;
00177
00178
00179 if (psi0.get_etat() == ETATZERO) {
00180 psi0 = 0 ;
00181 }
00182
00183 Cmp source_cmp (source) ;
00184 Cmp zeta_h_cmp (zeta_h) ;
00185 Cmp psi0_cmp (psi0) ;
00186
00187 Tenseur bb_cmp(mp, 1, CON, mp.get_bvect_spher()) ;
00188 bb_cmp.set_etat_qcq() ;
00189 Cmp bb_cmp1 (bb(1)) ;
00190 Cmp bb_cmp2 (bb(2)) ;
00191 Cmp bb_cmp3 (bb(3)) ;
00192 bb_cmp.set(0) = bb_cmp1 ;
00193 bb_cmp.set(1) = bb_cmp2 ;
00194 bb_cmp.set(2) = bb_cmp3 ;
00195
00196 source_cmp.va.ylm() ;
00197
00198 cout << "source" << endl << norme(source_cmp)<< endl ;
00199 cout << "zeta_h " << endl << norme(zeta_h_cmp) << endl ;
00200 cout << "bb(1)" << endl << norme(bb_cmp(0)) << endl ;
00201 cout << "bb(2)" << endl << norme(bb_cmp(1)) << endl ;
00202 cout << "bb(3)" << endl << norme(bb_cmp(2)) << endl ;
00203 cout << "psiO" << endl << norme(psi0_cmp) << endl ;
00204
00205 mp.poisson_compact(source_cmp, zeta_h_cmp, bb_cmp, par, psi0_cmp ) ;
00206
00207 psi0 = psi0_cmp ;
00208
00209 cout << "psiO apres" << endl << norme(psi0) << endl ;
00210
00211
00212
00213
00214
00215 Scalar bb_dpsi0 = contract(bb, 0, psi0.derive_cov(flat_spher), 0) ;
00216
00217 Scalar oper = zeta_h * psi0.laplacian() + bb_dpsi0 ;
00218
00219 source.set_spectral_va().ylm_i() ;
00220
00221 double erreur = diffrel(oper, source)(0) ;
00222
00223 cout << "Check of the resolution of the continuity equation : "
00224 << endl ;
00225 cout << " norme(source) : " << norme(source)(0)
00226 << " diff oper/source : " << erreur << endl ;
00227
00228
00229
00230
00231
00232
00233 v_orb.change_triad(mp.get_bvect_cart()) ;
00234 d_psi.change_triad(mp.get_bvect_cart()) ;
00235
00236 for (int i=1; i<=3; i++)
00237 d_psi.set(i) = (psi0.derive_cov(flat))(i) + v_orb(i) ;
00238
00239 v_orb.change_triad(mp.get_bvect_cart()) ;
00240 d_psi.change_triad(mp.get_bvect_cart()) ;
00241
00242
00243
00244
00245
00246 d_psi.annule(nzet, nzm1) ;
00247
00248 for (int i=1; i<=3; i++) {
00249 Cmp d_psi_i (d_psi(i)) ;
00250 d_psi_i = raccord_c1(d_psi_i, nzet) ;
00251 d_psi.set(i) = d_psi_i ;
00252 }
00253
00254 return erreur ;
00255
00256 }