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 char tslice_dirax_max_setAB_C[] = "$Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_dirac_max_setAB.C,v 1.9 2012/02/06 12:59:07 j_novak Exp $" ;
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 <assert.h>
00069
00070
00071 #include "time_slice.h"
00072 #include "param.h"
00073 #include "unites.h"
00074 #include "proto.h"
00075 #include "graphique.h"
00076
00077 void Tslice_dirac_max::set_AB_hh(const Scalar& A_in, const Scalar& B_in) {
00078
00079 A_hh_evol.update(A_in, jtime, the_time[jtime]) ;
00080 B_hh_evol.update(B_in, jtime, the_time[jtime]) ;
00081
00082
00083 hh_evol.downdate(jtime) ;
00084 trh_evol.downdate(jtime) ;
00085 if (p_tgamma != 0x0) {
00086 delete p_tgamma ;
00087 p_tgamma = 0x0 ;
00088 }
00089 if (p_hdirac != 0x0) {
00090 delete p_hdirac ;
00091 p_hdirac = 0x0 ;
00092 }
00093 if (p_gamma != 0x0) {
00094 delete p_gamma ;
00095 p_gamma = 0x0 ;
00096 }
00097 gam_dd_evol.downdate(jtime) ;
00098 gam_uu_evol.downdate(jtime) ;
00099 adm_mass_evol.downdate(jtime) ;
00100 }
00101
00102 void Tslice_dirac_max::hh_det_one(int j0, Param* par_bc, Param* par_mat) const {
00103
00104 assert (A_hh_evol.is_known(j0)) ;
00105 assert (B_hh_evol.is_known(j0)) ;
00106
00107 const Map& mp = A_hh_evol[j0].get_mp() ;
00108
00109
00110 Sym_tensor_trans hij(mp, *(ff.get_triad()), ff) ;
00111 const Scalar* ptrace = 0x0 ;
00112 if (trh_evol.is_known(j0-1)) ptrace = &trh_evol[j0-1] ;
00113 hij.set_AtBtt_det_one(A_hh_evol[j0], B_hh_evol[j0], ptrace, par_bc, par_mat) ;
00114
00115
00116
00117 trh_evol.update(hij.the_trace(), j0, the_time[j0]) ;
00118
00119
00120 Vector wzero(mp, CON, *(ff.get_triad())) ;
00121 wzero.set_etat_zero() ;
00122
00123
00124 Sym_tensor hh_new(mp, CON, *(ff.get_triad())) ;
00125 hh_new.set_longit_trans(wzero, hij) ;
00126 hh_evol.update(hh_new, j0, the_time[j0]) ;
00127
00128 if (j0 == jtime) {
00129
00130 if (p_tgamma != 0x0) {
00131 delete p_tgamma ;
00132 p_tgamma = 0x0 ;
00133 }
00134 if (p_hdirac != 0x0) {
00135 delete p_hdirac ;
00136 p_hdirac = 0x0 ;
00137 }
00138 if (p_gamma != 0x0) {
00139 delete p_gamma ;
00140 p_gamma = 0x0 ;
00141 }
00142 }
00143 gam_dd_evol.downdate(j0) ;
00144 gam_uu_evol.downdate(j0) ;
00145 adm_mass_evol.downdate(j0) ;
00146
00147 #ifndef NDEBUG
00148
00149 if (j0 == jtime) {
00150 maxabs(tgam().determinant() - 1,
00151 "Max. of absolute value of deviation from det tgam = 1") ;
00152 }
00153 else {
00154 Metric tgam_j0( ff.con() + hh_evol[j0] ) ;
00155 maxabs(tgam_j0.determinant() - 1,
00156 "Max. of absolute value of deviation from det tgam = 1") ;
00157 }
00158 #endif
00159 }
00160
00161 void Tslice_dirac_max::hh_det_one(const Sym_tensor_tt& hijtt, Param* par_mat)
00162 const {
00163
00164 const Map& mp = hijtt.get_mp() ;
00165
00166
00167 Sym_tensor_trans hij(mp, *(ff.get_triad()), ff) ;
00168 const Scalar* ptrace = 0x0 ;
00169 if ( trh_evol.is_known( jtime - 1 ) ) ptrace = &trh_evol[jtime-1] ;
00170 hij.set_tt_part_det_one(hijtt, ptrace, par_mat) ;
00171
00172
00173
00174 trh_evol.update(hij.the_trace(), jtime, the_time[jtime]) ;
00175
00176
00177 Vector wzero(mp, CON, *(ff.get_triad())) ;
00178 wzero.set_etat_zero() ;
00179
00180
00181 Sym_tensor hh_new(mp, CON, *(ff.get_triad())) ;
00182 hh_new.set_longit_trans(wzero, hij) ;
00183 hh_evol.update(hh_new, jtime, the_time[jtime]) ;
00184
00185
00186 if (p_tgamma != 0x0) {
00187 delete p_tgamma ;
00188 p_tgamma = 0x0 ;
00189 }
00190 if (p_hdirac != 0x0) {
00191 delete p_hdirac ;
00192 p_hdirac = 0x0 ;
00193 }
00194 if (p_gamma != 0x0) {
00195 delete p_gamma ;
00196 p_gamma = 0x0 ;
00197 }
00198 gam_dd_evol.downdate(jtime) ;
00199 gam_uu_evol.downdate(jtime) ;
00200 adm_mass_evol.downdate(jtime) ;
00201
00202 #ifndef NDEBUG
00203
00204 maxabs(tgam().determinant() - 1,
00205 "Max. of absolute value of deviation from det tgam = 1") ;
00206 #endif
00207 }
00208
00209
00210
00211
00212 void Tslice_dirac_max::compute_sources( const Sym_tensor* p_strain_tens) const {
00213
00214 using namespace Unites ;
00215
00216 const Map& map = hh().get_mp() ;
00217 const Base_vect& otriad = *hh().get_triad() ;
00218 int nz = map.get_mg()->get_nzone() ;
00219
00220 Sym_tensor strain_tens(map, CON, otriad) ;
00221 if (p_strain_tens != 0x0)
00222 strain_tens = *(p_strain_tens) ;
00223 else
00224 strain_tens.set_etat_zero() ;
00225
00226 Sym_tensor aij = aa() ;
00227 aij.annule_domain(nz-1) ;
00228
00229 const Sym_tensor& tgam_dd = tgam().cov() ;
00230 const Sym_tensor& tgam_uu = tgam().con() ;
00231 const Tensor_sym& dtgam = tgam_dd.derive_cov(ff) ;
00232 const Tensor_sym& dhh = hh().derive_cov(ff) ;
00233 const Vector& dln_psi = ln_psi().derive_cov(ff) ;
00234 const Vector& tdln_psi_u = ln_psi().derive_con(tgam()) ;
00235 Scalar log_N = log(nn()) ;
00236 log_N.std_spectral_base() ;
00237 const Vector& tdlnn_u = log_N.derive_con(tgam()) ;
00238 const Scalar& div_beta = beta().divergence(ff) ;
00239 Scalar qq = nn()*psi()*psi() ;
00240 qq.annule_domain(nz-1) ;
00241 const Vector& dqq = qq.derive_cov(ff) ;
00242 Sym_tensor a_hat = hata() ;
00243 a_hat.annule_domain(nz-1) ;
00244 Scalar psi6 = psi4()*psi()*psi() ;
00245 Sym_tensor sym_tmp(map, CON, otriad) ;
00246 Scalar tmp(map) ;
00247
00248
00249
00250
00251
00252 Sym_tensor source_hij = hh().derive_lie(beta()) + 2*(nn()/psi6 - 1.)*a_hat
00253 - beta().ope_killing_conf(ff) + 0.6666666666666667*div_beta*hh() ;
00254 source_hij.annule_domain(nz-1) ;
00255 for (int i=1; i<=3; i++)
00256 for (int j=i; j<=3; j++)
00257 source_hij.set( i, j ).set_dzpuis(0) ;
00258
00259 tmp = 2.*A_hata_evol[jtime] + source_hij.compute_A(true) ;
00260 tmp.set_spectral_va().ylm() ;
00261 tmp.annule_domain(nz-1) ;
00262 tmp.set_dzpuis(0) ;
00263 source_A_hh_evol.update( tmp, jtime, the_time[jtime] ) ;
00264
00265 tmp = 2.*B_hata_evol[jtime] + source_hij.compute_tilde_B_tt(true) ;
00266 tmp.set_spectral_va().ylm() ;
00267 tmp.annule_domain(nz-1) ;
00268 tmp.set_dzpuis(0) ;
00269 source_B_hh_evol.update(tmp, jtime, the_time[jtime] ) ;
00270
00271
00272
00273
00274
00275 Sym_tensor source_aij = a_hat.derive_lie(beta())
00276 + 1.666666666666667*a_hat*div_beta ;
00277
00278
00279
00280
00281 Sym_tensor ricci_star(map, CON, otriad) ;
00282
00283 ricci_star = contract(hh(), 0, 1, dhh.derive_cov(ff), 2, 3) ;
00284
00285 ricci_star.inc_dzpuis() ;
00286
00287 for (int i=1; i<=3; i++) {
00288 for (int j=1; j<=i; j++) {
00289 tmp = 0 ;
00290 for (int k=1; k<=3; k++) {
00291 for (int l=1; l<=3; l++) {
00292 tmp += dhh(i,k,l) * dhh(j,l,k) ;
00293 }
00294 }
00295 ricci_star.set(i,j) -= tmp ;
00296 }
00297 }
00298
00299 for (int i=1; i<=3; i++) {
00300 for (int j=1; j<=i; j++) {
00301 tmp = 0 ;
00302 for (int k=1; k<=3; k++) {
00303 for (int l=1; l<=3; l++) {
00304 for (int m=1; m<=3; m++) {
00305 for (int n=1; n<=3; n++) {
00306
00307 tmp += 0.5 * tgam_uu(i,k)* tgam_uu(j,l)
00308 * dhh(m,n,k) * dtgam(m,n,l)
00309 + tgam_dd(n,l) * dhh(m,n,k)
00310 * (tgam_uu(i,k) * dhh(j,l,m) + tgam_uu(j,k) * dhh(i,l,m) )
00311 - tgam_dd(k,l) *tgam_uu(m,n) * dhh(i,k,m) * dhh(j,l,n) ;
00312 }
00313 }
00314 }
00315 }
00316 sym_tmp.set(i,j) = tmp ;
00317 }
00318 }
00319 ricci_star += sym_tmp ;
00320
00321
00322
00323
00324 Scalar tricci_scal =
00325 0.25 * contract(tgam_uu, 0, 1,
00326 contract(dhh, 0, 1, dtgam, 0, 1), 0, 1 )
00327 - 0.5 * contract(tgam_uu, 0, 1,
00328 contract(dhh, 0, 1, dtgam, 0, 2), 0, 1 ) ;
00329
00330 Scalar lap_A = A_hh_evol[jtime].laplacian(2) ;
00331 Scalar tilde_lap_B(map) ;
00332 tilde_laplacian( B_hh_evol[jtime], tilde_lap_B) ;
00333 Sym_tensor_tt laplace_h(map, otriad, ff) ;
00334 laplace_h.set_A_tildeB(lap_A, tilde_lap_B) ;
00335 laplace_h.annule_domain(nz-1) ;
00336
00337
00338
00339 source_aij += (0.5*(qq - 1.))*laplace_h + qq*(0.5*ricci_star + 8.*tdln_psi_u * tdln_psi_u
00340 + 4.*( tdln_psi_u * tdlnn_u + tdlnn_u * tdln_psi_u )
00341 - 0.3333333333333333 * (tricci_scal + 8.*(contract(dln_psi, 0, tdln_psi_u, 0)
00342 + contract(dln_psi, 0, tdlnn_u, 0) )
00343 )*tgam_uu
00344 ) ;
00345
00346 sym_tmp = contract(tgam_uu, 1, contract(tgam_uu, 1, dqq.derive_cov(ff), 0), 1) ;
00347
00348 for (int i=1; i<=3; i++) {
00349 for (int j=1; j<=i; j++) {
00350 tmp = 0 ;
00351 for (int k=1; k<=3; k++) {
00352 for (int l=1; l<=3; l++) {
00353 tmp += ( tgam_uu(i,k)*dhh(l,j,k) + tgam_uu(k,j)*dhh(i,l,k)
00354 - tgam_uu(k,l)*dhh(i,j,k) ) * dqq(l) ;
00355 }
00356 }
00357 sym_tmp.set(i,j) += 0.5 * tmp ;
00358 }
00359 }
00360
00361 source_aij -= sym_tmp
00362 - ( 0.3333333333333333*qq.derive_con(tgam()).divergence(tgam()) ) *tgam_uu ;
00363
00364 for (int i=1; i<=3; i++) {
00365 for (int j=1; j<=i; j++) {
00366 tmp = 0 ;
00367 for (int k=1; k<=3; k++) {
00368 for (int l=1; l<=3; l++) {
00369 tmp += tgam_dd(k,l) * a_hat(i,k) * aij(j,l) ;
00370 }
00371 }
00372 sym_tmp.set(i,j) = tmp ;
00373 }
00374 }
00375
00376 tmp = psi4() * strain_tens.trace(tgam()) ;
00377
00378 source_aij += (2.*nn())
00379 * (
00380 sym_tmp - qpig*psi6*( psi4()* strain_tens - (0.3333333333333333 * tmp) * tgam_uu )
00381 ) ;
00382
00383 source_aij.annule_domain(nz-1) ;
00384 for (int i=1; i<=3; i++)
00385 for (int j=i; j<=3; j++)
00386 source_aij.set(i,j).set_dzpuis(0) ;
00387 #ifndef NDEBUG
00388 maxabs(source_aij, "source_aij tot") ;
00389 #endif
00390
00391 tmp = 0.5*lap_A + source_aij.compute_A(true) ;
00392 tmp.annule_domain(nz-1) ;
00393 tmp.set_dzpuis(0) ;
00394 source_A_hata_evol.update( tmp, jtime, the_time[jtime] ) ;
00395 tmp = 0.5*tilde_lap_B + source_aij.compute_tilde_B_tt(true) ;
00396 tmp.annule_domain(nz-1) ;
00397 tmp.set_dzpuis(0) ;
00398
00399
00400
00401 source_B_hata_evol.update( 0.5*tilde_lap_B, jtime, the_time[jtime] ) ;
00402 }
00403
00404 void Tslice_dirac_max::initialize_sources_copy() const {
00405
00406 assert( source_A_hh_evol.is_known(jtime) ) ;
00407 assert( source_B_hh_evol.is_known(jtime) ) ;
00408 assert( source_A_hata_evol.is_known(jtime) ) ;
00409 assert( source_B_hata_evol.is_known(jtime) ) ;
00410
00411 Scalar tmp_Ah = source_A_hh_evol[jtime] ;
00412 Scalar tmp_Bh = source_B_hh_evol[jtime] ;
00413 Scalar tmp_Aa = source_A_hata_evol[jtime] ;
00414 Scalar tmp_Ba = source_B_hata_evol[jtime] ;
00415
00416 source_A_hh_evol.downdate(jtime) ;
00417 source_B_hh_evol.downdate(jtime) ;
00418 source_A_hata_evol.downdate(jtime) ;
00419 source_B_hata_evol.downdate(jtime) ;
00420
00421 int jtime1 = jtime - depth + 1;
00422 for (int j=jtime1; j <= jtime; j++) {
00423 source_A_hh_evol.update( tmp_Ah, j, the_time[j] ) ;
00424 source_B_hh_evol.update( tmp_Bh, j, the_time[j] ) ;
00425 source_A_hata_evol.update( tmp_Aa, j, the_time[j] ) ;
00426 source_B_hata_evol.update( tmp_Ba, j, the_time[j] ) ;
00427 }
00428 }
00429