00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 char bhole_glob_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_glob.C,v 1.3 2005/08/29 15:10:14 p_grandclement Exp $" ;
00024
00025
00026
00027
00028
00029
00030
00031
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
00062
00063
00064
00065
00066
00067
00068 #include <stdlib.h>
00069 #include <math.h>
00070
00071
00072 #include "nbr_spx.h"
00073 #include "tenseur.h"
00074 #include "bhole.h"
00075 #include "proto.h"
00076 #include "utilitaires.h"
00077 #include "graphique.h"
00078
00079 double Bhole_binaire::adm_systeme() const {
00080 Cmp der_un (hole1.psi_auto().dsdr()) ;
00081 Cmp der_deux (hole2.psi_auto().dsdr()) ;
00082
00083 double masse = hole1.mp.integrale_surface_infini(der_un) +
00084 hole2.mp.integrale_surface_infini(der_deux) ;
00085
00086 masse /= -2*M_PI ;
00087 return masse ;
00088 }
00089
00090 double Bhole_binaire::komar_systeme() const {
00091 Cmp der_un (hole1.n_auto().dsdr()) ;
00092 Cmp der_deux (hole2.n_auto().dsdr()) ;
00093
00094 double masse = hole1.mp.integrale_surface_infini(der_un) +
00095 hole2.mp.integrale_surface_infini(der_deux) ;
00096
00097 masse /= 4*M_PI ;
00098 return masse ;
00099 }
00100
00101 double Bhole_binaire::moment_systeme_hor() const {
00102
00103 if (omega == 0)
00104 return 0 ;
00105 else {
00106
00107 double orientation_un = hole1.mp.get_rot_phi() ;
00108 assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00109 double orientation_deux = hole2.mp.get_rot_phi() ;
00110 assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00111 int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00112
00113
00114 Cmp xa_un (hole1.mp) ;
00115 xa_un = hole1.mp.xa ;
00116 xa_un.std_base_scal() ;
00117
00118 Cmp ya_un (hole1.mp) ;
00119 ya_un = hole1.mp.ya ;
00120 ya_un.std_base_scal() ;
00121
00122 Tenseur vecteur_un (hole1.mp, 1, CON, hole1.mp.get_bvect_cart()) ;
00123 vecteur_un.set_etat_qcq() ;
00124 for (int i=0 ; i<3 ; i++)
00125 vecteur_un.set(i) = (-ya_un*hole1.tkij_tot(0, i)+
00126 xa_un * hole1.tkij_tot(1, i)) ;
00127 vecteur_un.set_std_base() ;
00128 vecteur_un.annule(hole1.mp.get_mg()->get_nzone()-1) ;
00129 vecteur_un.change_triad (hole1.mp.get_bvect_spher()) ;
00130
00131 Cmp integrant_un (pow(hole1.psi_tot(), 6)*vecteur_un(0)) ;
00132 integrant_un.std_base_scal() ;
00133 double moment_un = hole1.mp.integrale_surface
00134 (integrant_un, hole1.rayon)/8/M_PI ;
00135
00136
00137 Cmp xa_deux (hole2.mp) ;
00138 xa_deux = hole2.mp.xa ;
00139 xa_deux.std_base_scal() ;
00140
00141 Cmp ya_deux (hole2.mp) ;
00142 ya_deux = hole2.mp.ya ;
00143 ya_deux.std_base_scal() ;
00144
00145 Tenseur vecteur_deux (hole2.mp, 1, CON, hole2.mp.get_bvect_cart()) ;
00146 vecteur_deux.set_etat_qcq() ;
00147 for (int i=0 ; i<3 ; i++)
00148 vecteur_deux.set(i) = -ya_deux*hole2.tkij_tot(0, i)+
00149 xa_deux * hole2.tkij_tot(1, i) ;
00150 vecteur_deux.set_std_base() ;
00151 vecteur_deux.annule(hole2.mp.get_mg()->get_nzone()-1) ;
00152 vecteur_deux.change_triad (hole2.mp.get_bvect_spher()) ;
00153
00154 Cmp integrant_deux (pow(hole2.psi_tot(), 6)*vecteur_deux(0)) ;
00155 integrant_deux.std_base_scal() ;
00156 double moment_deux = hole2.mp.integrale_surface
00157 (integrant_deux, hole2.rayon)/8/M_PI ;
00158
00159 return moment_un+same_orient*moment_deux ;
00160 }
00161 }
00162
00163 double Bhole_binaire::moment_systeme_inf() {
00164
00165 if (omega == 0)
00166 return 0 ;
00167 else {
00168
00169 double orientation_un = hole1.mp.get_rot_phi() ;
00170 assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00171 double orientation_deux = hole2.mp.get_rot_phi() ;
00172 assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00173 int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00174
00175
00176 int nzones = hole1.mp.get_mg()->get_nzone() ;
00177 double* bornes = new double [nzones+1] ;
00178 double courant = (hole1.mp.get_ori_x()-hole2.mp.get_ori_x())+1 ;
00179 for (int i=nzones-1 ; i>0 ; i--) {
00180 bornes[i] = courant ;
00181 courant /= 2. ;
00182 }
00183 bornes[0] = 0 ;
00184 bornes[nzones] = __infinity ;
00185
00186 Map_af mapping (*hole1.mp.get_mg(), bornes) ;
00187
00188 delete [] bornes ;
00189
00190
00191 Tenseur_sym k_total (mapping, 2, CON, mapping.get_bvect_cart()) ;
00192 k_total.set_etat_qcq() ;
00193
00194 Tenseur shift_un (mapping, 1, CON, mapping.get_bvect_cart()) ;
00195 shift_un.set_etat_qcq() ;
00196
00197 Tenseur shift_deux (mapping, 1, CON, mapping.get_bvect_cart()) ;
00198 shift_deux.set_etat_qcq() ;
00199
00200 shift_un.set(0).import_asymy(hole1.shift_auto(0)) ;
00201 shift_un.set(1).import_symy(hole1.shift_auto(1)) ;
00202 shift_un.set(2).import_asymy(hole1.shift_auto(2)) ;
00203
00204 shift_deux.set(0).import_asymy(same_orient*hole2.shift_auto(0)) ;
00205 shift_deux.set(1).import_symy(same_orient*hole2.shift_auto(1)) ;
00206 shift_deux.set(2).import_asymy(hole2.shift_auto(2)) ;
00207
00208 Tenseur shift_tot (shift_un+shift_deux) ;
00209 shift_tot.set_std_base() ;
00210 shift_tot.annule(0, nzones-2) ;
00211
00212 shift_tot.inc2_dzpuis() ;
00213 shift_tot.dec2_dzpuis() ;
00214
00215 Tenseur grad (shift_tot.gradient()) ;
00216 Tenseur trace (grad(0, 0)+grad(1, 1)+grad(2, 2)) ;
00217 for (int i=0 ; i<3 ; i++) {
00218 k_total.set(i, i) = grad(i, i)-trace()/3. ;
00219 for (int j=i+1 ; j<3 ; j++)
00220 k_total.set(i, j) = (grad(i, j)+grad(j, i))/2. ;
00221 }
00222
00223 for (int lig=0 ; lig<3 ; lig++)
00224 for (int col=lig ; col<3 ; col++)
00225 k_total.set(lig, col).mult_r_zec() ;
00226
00227 Tenseur vecteur_un (mapping, 1, CON, mapping.get_bvect_cart()) ;
00228 vecteur_un.set_etat_qcq() ;
00229 for (int i=0 ; i<3 ; i++)
00230 vecteur_un.set(i) = k_total(0, i) ;
00231 vecteur_un.change_triad (mapping.get_bvect_spher()) ;
00232 Cmp integrant_un (vecteur_un(0)) ;
00233
00234 Tenseur vecteur_deux (mapping, 1, CON, mapping.get_bvect_cart()) ;
00235 vecteur_deux.set_etat_qcq() ;
00236 for (int i=0 ; i<3 ; i++)
00237 vecteur_deux.set(i) = k_total(1, i) ;
00238 vecteur_deux.change_triad (mapping.get_bvect_spher()) ;
00239 Cmp integrant_deux (vecteur_deux(0)) ;
00240
00241
00242 integrant_un.va = integrant_un.va.mult_st() ;
00243 integrant_un.va = integrant_un.va.mult_sp() ;
00244
00245 integrant_deux.va = integrant_deux.va.mult_st() ;
00246 integrant_deux.va = integrant_deux.va.mult_cp() ;
00247
00248 double moment = mapping.integrale_surface_infini (-integrant_un+integrant_deux) ;
00249
00250 moment /= 8*M_PI ;
00251 return moment ;
00252 }
00253 }
00254
00255 double Bhole_binaire::distance_propre(const int nr) const {
00256
00257
00258 double x_un = hole1.mp.get_ori_x() - hole1.rayon ;
00259 double x_deux = hole2.mp.get_ori_x() + hole2.rayon ;
00260
00261
00262 double pente = 2./(x_un-x_deux) ;
00263 double constante = - (x_un+x_deux)/(x_un-x_deux) ;
00264
00265
00266 double ksi ;
00267 double xabs ;
00268 double air_un, theta_un, phi_un ;
00269 double air_deux, theta_deux, phi_deux ;
00270
00271 double* coloc = new double[nr] ;
00272 double* coef = new double[nr] ;
00273 int* deg = new int[3] ;
00274 deg[0] = 1 ; deg[1] = 1 ; deg[2] = nr ;
00275
00276 for (int i=0 ; i<nr ; i++) {
00277 ksi = -cos (M_PI*i/(nr-1)) ;
00278 xabs = (ksi-constante)/pente ;
00279
00280 hole1.mp.convert_absolute (xabs, 0, 0, air_un, theta_un, phi_un) ;
00281 hole2.mp.convert_absolute (xabs, 0, 0, air_deux, theta_deux, phi_deux) ;
00282
00283 coloc[i] = pow (hole1.psi_auto().val_point (air_un, theta_un, phi_un) +
00284 hole2.psi_auto().val_point (air_deux, theta_deux, phi_deux), 2.) ;
00285 }
00286
00287
00288 cfrcheb(deg, deg, coloc, deg, coef) ;
00289
00290
00291 double* som = new double[nr] ;
00292 som[0] = 2 ;
00293 for (int i=2 ; i<nr ; i+=2)
00294 som[i] = 1./(i+1)-1./(i-1) ;
00295 for (int i=1 ; i<nr ; i+=2)
00296 som[i] = 0 ;
00297
00298 double res = 0 ;
00299 for (int i=0 ; i<nr ; i++)
00300 res += som[i]*coef[i] ;
00301
00302 res /= pente ;
00303
00304 delete [] deg ;
00305 delete [] coef ;
00306 delete [] coloc ;
00307 delete [] som ;
00308
00309 return res ;
00310 }
00311
00312 Tbl Bhole_binaire::linear_momentum_systeme_inf() const {
00313
00314 Tbl res (3) ;
00315 res.set_etat_qcq() ;
00316
00317
00318 double orientation_un = hole1.mp.get_rot_phi() ;
00319 assert ((orientation_un==0) || (orientation_un==M_PI)) ;
00320 double orientation_deux = hole2.mp.get_rot_phi() ;
00321 assert ((orientation_deux==0) || (orientation_deux==M_PI)) ;
00322 int same_orient = (orientation_un == orientation_deux) ? 1 : -1 ;
00323
00324
00325 int nzones = hole1.mp.get_mg()->get_nzone() ;
00326 double* bornes = new double [nzones+1] ;
00327 double courant = (hole1.mp.get_ori_x()-hole2.mp.get_ori_x())+1 ;
00328 for (int i=nzones-1 ; i>0 ; i--) {
00329 bornes[i] = courant ;
00330 courant /= 2. ;
00331 }
00332 bornes[0] = 0 ;
00333 bornes[nzones] = __infinity ;
00334
00335 Map_af mapping (*hole1.mp.get_mg(), bornes) ;
00336
00337 delete [] bornes ;
00338
00339
00340 Tenseur_sym k_total (mapping, 2, CON, mapping.get_bvect_cart()) ;
00341 k_total.set_etat_qcq() ;
00342
00343 Tenseur shift_un (mapping, 1, CON, mapping.get_bvect_cart()) ;
00344 shift_un.set_etat_qcq() ;
00345
00346 Tenseur shift_deux (mapping, 1, CON, mapping.get_bvect_cart()) ;
00347 shift_deux.set_etat_qcq() ;
00348
00349 shift_un.set(0).import_asymy(hole1.shift_auto(0)) ;
00350 shift_un.set(1).import_symy(hole1.shift_auto(1)) ;
00351 shift_un.set(2).import_asymy(hole1.shift_auto(2)) ;
00352
00353 shift_deux.set(0).import_asymy(same_orient*hole2.shift_auto(0)) ;
00354 shift_deux.set(1).import_symy(same_orient*hole2.shift_auto(1)) ;
00355 shift_deux.set(2).import_asymy(hole2.shift_auto(2)) ;
00356
00357 Tenseur shift_tot (shift_un+shift_deux) ;
00358 shift_tot.set_std_base() ;
00359 shift_tot.annule(0, nzones-2) ;
00360
00361
00362 Tenseur shift_old (shift_tot) ;
00363 shift_tot.inc2_dzpuis() ;
00364 shift_tot.dec2_dzpuis() ;
00365 for (int i=0 ; i< 3 ; i++)
00366 cout << max(diffrelmax(shift_tot(i), shift_old(i))) << " " ;
00367 cout << endl ;
00368
00369 Tenseur grad (shift_tot.gradient()) ;
00370 Tenseur trace (grad(0, 0)+grad(1, 1)+grad(2, 2)) ;
00371 for (int i=0 ; i<3 ; i++) {
00372 k_total.set(i, i) = grad(i, i)-trace()/3. ;
00373 for (int j=i+1 ; j<3 ; j++)
00374 k_total.set(i, j) = (grad(i, j)+grad(j, i))/2. ;
00375 }
00376
00377
00378 for (int lig=0 ; lig<3 ; lig++)
00379 for (int col=lig ; col<3 ; col++)
00380 k_total.set(lig, col).mult_r_zec() ;
00381
00382 for (int comp=0 ; comp<3 ; comp++) {
00383 Tenseur vecteur (mapping, 1, CON, mapping.get_bvect_cart()) ;
00384 vecteur.set_etat_qcq() ;
00385 for (int i=0 ; i<3 ; i++)
00386 vecteur.set(i) = k_total(i, comp) ;
00387 vecteur.change_triad (mapping.get_bvect_spher()) ;
00388 Cmp integrant (vecteur(0)) ;
00389
00390 res.set(comp) = mapping.integrale_surface_infini (integrant)/8/M_PI ;
00391 }
00392 return res ;
00393 }