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
00032
00033 #include "math.h"
00034
00035
00036 #include "excised_slice.h"
00037 #include "spheroid.h"
00038 #include "excision_surf.h"
00039 #include "excision_hor.h"
00040 #include "utilitaires.h"
00041 #include "param.h"
00042 #include "unites.h"
00043 #include "proto.h"
00044 #include "map.h"
00045 #include "scalar.h"
00046
00047
00048
00049 using namespace Unites ;
00050
00051
00052
00053
00054
00055
00056
00057
00058 Excised_slice::Excised_slice (const Map& mpi, int hor_type, int scheme_type)
00059 : mp(mpi),
00060 type_hor(hor_type),
00061 field_set(scheme_type),
00062 lapse(mpi),
00063 conf_fact(mpi),
00064 shift(mpi, CON, mpi.get_bvect_spher()),
00065 hij(mpi, CON, mpi.get_bvect_spher()),
00066 hatA(mpi, CON, mpi.get_bvect_spher()),
00067 Xx(mpi, CON, mpi.get_bvect_spher()){
00068
00069
00070 set_der_0x0() ;
00071
00072
00073
00074 lapse = 1. ;
00075 conf_fact = 1. ;
00076 shift.set_etat_zero() ;
00077 hij.set_etat_zero();
00078 hatA.set_etat_zero();
00079 Xx.set_etat_zero();
00080 }
00081
00082
00083
00084 Excised_slice::Excised_slice(const Excised_slice& ih)
00085 : mp(ih.mp),
00086 type_hor(ih.type_hor),
00087 field_set(ih.field_set),
00088 lapse(ih.lapse),
00089 conf_fact(ih.conf_fact),
00090 shift(ih.shift),
00091 hij(ih.hij),
00092 hatA(ih.hatA),
00093 Xx(ih.Xx){
00094
00095 set_der_0x0() ;
00096
00097 }
00098
00099
00100
00101 Excised_slice::Excised_slice(const Map& mpi, int hor_type, int scheme_type, FILE* fich)
00102 : mp(mpi),
00103 type_hor(hor_type),
00104 field_set(scheme_type),
00105 lapse(mpi,*(mpi.get_mg()), fich),
00106 conf_fact(mpi,*(mpi.get_mg()), fich),
00107 shift(mpi, mpi.get_bvect_spher(), fich),
00108 hij(mpi, mpi.get_bvect_spher(), fich),
00109 hatA(mpi, mpi.get_bvect_spher(), fich),
00110 Xx(mpi, mpi.get_bvect_spher(), fich){
00111
00112
00113
00114
00115
00116 set_der_0x0() ;
00117
00118 }
00119
00120
00121
00122
00123
00124 Excised_slice::~Excised_slice(){
00125
00126 del_deriv() ;
00127
00128 }
00129
00130
00131
00132
00133
00134
00135 void Excised_slice::del_deriv() const {
00136 if (p_hor != 0x0) delete p_hor ;
00137 if (p_adm_mass != 0x0) delete p_adm_mass ;
00138 if (p_komar_angmom != 0x0) delete p_komar_angmom ;
00139 if (p_virial_residue != 0x0) delete p_virial_residue ;
00140 Excised_slice::set_der_0x0() ;
00141 }
00142
00143
00144 void Excised_slice::set_der_0x0() const {
00145 p_hor = 0x0;
00146 p_adm_mass = 0x0 ;
00147 p_komar_angmom = 0x0 ;
00148 p_virial_residue = 0x0 ;
00149 }
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 void Excised_slice::operator=(const Excised_slice& ih) {
00160
00161 assert( &(ih.mp) == &mp ) ;
00162 type_hor = ih.type_hor ;
00163 field_set = ih.field_set ;
00164 lapse = ih.lapse ;
00165 conf_fact = ih.conf_fact ;
00166 shift = ih.shift ;
00167 hij = ih.hij ;
00168 hatA = ih.hatA ;
00169 Xx = ih.Xx;
00170
00171 del_deriv() ;
00172
00173 }
00174
00175
00176
00177
00178
00179
00180
00181 void Excised_slice::sauve(FILE* fich) const {
00182
00183 lapse.sauve(fich) ;
00184 conf_fact.sauve(fich) ;
00185 shift.sauve(fich);
00186 hij.sauve(fich);
00187 hatA.sauve(fich);
00188 Xx.sauve(fich);}
00189
00190
00191
00192
00193 void Excised_slice::Einstein_errors() {
00194
00195 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00196 const Metric_flat& mets = (*map).flat_met_spher() ;
00197
00198 Sym_tensor gamtcon = mets.con() + hij;
00199 Metric gamt(gamtcon);
00200 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00201 gamcon.std_spectral_base();
00202 Metric gam(gamcon);
00203 Sym_tensor k_uu = hatA/(pow(conf_fact,10)) ;
00204 k_uu.std_spectral_base();
00205 k_uu.dec_dzpuis(k_uu(1,1).get_dzpuis());
00206 Sym_tensor k_dd = k_uu.up_down(gam);
00207
00208 Scalar TrK3 = k_uu.trace(gam);
00209
00210
00211
00212 Scalar ham_constr = gam.ricci_scal() ;
00213 ham_constr.dec_dzpuis(3) ;
00214 ham_constr += TrK3*TrK3 - contract(k_uu, 0, 1, k_dd, 0, 1) ;
00215 maxabs(ham_constr, "Hamiltonian constraint: ") ;
00216
00217
00218
00219 Vector mom_constr = k_uu.divergence(gam) - TrK3.derive_con(gam) ;
00220 mom_constr.dec_dzpuis(2) ;
00221 maxabs(mom_constr, "Momentum constraint: ") ;
00222
00223
00224
00225 Sym_tensor evol_eq = lapse*gam.ricci()
00226 - lapse.derive_cov(gam).derive_cov(gam);
00227 evol_eq.dec_dzpuis() ;
00228 evol_eq += k_dd.derive_lie(shift) ;
00229 evol_eq.dec_dzpuis(2) ;
00230 evol_eq += lapse*(TrK3*k_dd - 2*contract(k_dd, 1, k_dd.up(0, gam), 0) ) ;
00231 maxabs(evol_eq, "Evolution equations: ") ;
00232
00233 return;
00234 }
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246 Spheroid Excised_slice::hor() {
00247 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00248 const Mg3d* mgrid = (*map).get_mg();
00249
00250
00251 const Mg3d* g_angu = (*mgrid).get_angu_1dom() ;
00252
00253 const Coord& rr = (*map).r;
00254 Scalar rrr (*map) ;
00255 rrr = rr ;
00256 rrr.std_spectral_base();
00257 assert((rrr.val_grid_point(1,0,0,0) - 1.) <= 1.e-9);
00258
00259
00260
00261
00262 double r_limits2[] = {rrr.val_grid_point(1,0,0,0), rrr.val_grid_point(2,0,0,0)} ;
00263 const Map_af map_2(*g_angu, r_limits2);
00264
00265
00266 const Metric_flat& mets = (*map).flat_met_spher() ;
00267
00268 Sym_tensor gamtcon = mets.con() + hij;
00269 Metric gamt(gamtcon);
00270 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00271 Metric gam(gamcon);
00272
00273
00274 Sym_tensor kuu = hatA/pow(conf_fact,10) ;
00275 kuu.std_spectral_base();
00276 Sym_tensor kdd = kuu.up_down(gam);
00277
00278
00279
00280
00281 double hor_posd = rrr.val_grid_point(1,0,0,0);
00282 Scalar hor_pos(map_2); hor_pos = hor_posd; hor_pos.std_spectral_base();
00283 Spheroid hor_loc(hor_pos, gam, kdd);
00284 return hor_loc;
00285 }
00286
00287
00288 double Excised_slice::adm_mass() {
00289 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00290 const Metric_flat& mets = (*map).flat_met_spher() ;
00291
00292 Sym_tensor gamtcon = mets.con() + hij;
00293 Metric gamt(gamtcon);
00294 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00295 Metric gam(gamcon);
00296
00297 Scalar detgam = sqrt((gam.cov())(2,2)*(gam.cov())(3,3) - (gam.cov())(2,3)*(gam.cov())(3,2));
00298 detgam.std_spectral_base();
00299 Vector corr_adm = - (0.125*contract(gamt.cov().derive_con(mets),1,2));
00300 Scalar admintegr = conf_fact.dsdr() + corr_adm(1);
00301
00302 double M_ADM = - (1/(2.*3.1415927*ggrav))*(*map).integrale_surface_infini(admintegr*detgam);
00303 return M_ADM;
00304 }
00305
00306
00307
00308 double Excised_slice:: komar_angmom() {
00309 const Map_af* map = dynamic_cast<const Map_af*>(&mp) ;
00310 const Metric_flat& mets = (*map).flat_met_spher() ;
00311
00312 Sym_tensor gamtcon = mets.con() + hij;
00313 Sym_tensor gamcon = gamtcon/(conf_fact*conf_fact*conf_fact*conf_fact);
00314 gamcon.std_spectral_base();
00315 Metric gam(gamcon);
00316 Sym_tensor k_uu = hatA/(pow(conf_fact,10));
00317 k_uu.std_spectral_base();
00318 k_uu.dec_dzpuis(k_uu(1,1).get_dzpuis());
00319 Sym_tensor k_dd = k_uu.up_down(gam);
00320
00321 Scalar detgam = sqrt((gam.cov())(2,2)*(gam.cov())(3,3) - (gam.cov())(2,3)*(gam.cov())(3,2));
00322 detgam.std_spectral_base();
00323 Scalar contraction = k_dd(1,3); contraction.mult_r_dzpuis(2); contraction.mult_sint();
00324 double angu_komar = - (1/(8.*3.1415927*ggrav))*(*map).integrale_surface_infini(detgam*contraction);
00325
00326 return angu_komar;
00327 }
00328
00329
00330
00331
00332
00333 double Excised_slice::virial_residue() {
00334 const Mg3d* mgrid = mp.get_mg();
00335 const int nz = (*mgrid).get_nzone();
00336 Valeur** devel_psi (conf_fact.asymptot(1)) ;
00337 Valeur** devel_n (lapse.asymptot(1)) ;
00338
00339
00340 double erreur = (2*(*devel_psi[1])(nz-1, 0, 0, 0)
00341 + (*devel_n[1])(nz-1, 0, 0, 0))/fabs ((*devel_n[1])(nz-1, 0, 0, 0)) ;
00342
00343 return erreur;
00344 }
00345
00346
00347
00348
00349