tslice_dirac_max_setAB.C

00001 /*
00002  *  Methods of class Tslice_dirac_max dealing with the members potA and tildeB
00003  *
00004  *    (see file time_slice.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2007  Jerome Novak
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License version 2
00015  *   as published by the Free Software Foundation.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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  * $Id: tslice_dirac_max_setAB.C,v 1.9 2012/02/06 12:59:07 j_novak Exp $
00032  * $Log: tslice_dirac_max_setAB.C,v $
00033  * Revision 1.9  2012/02/06 12:59:07  j_novak
00034  * Correction of some errors.
00035  *
00036  * Revision 1.8  2011/07/22 13:21:02  j_novak
00037  * Corrected an error on BC treatment.
00038  *
00039  * Revision 1.7  2010/10/20 07:58:10  j_novak
00040  * Better implementation of the explicit time-integration. Not fully-tested yet.
00041  *
00042  * Revision 1.6  2008/12/04 18:22:49  j_novak
00043  * Enhancement of the dzpuis treatment + various bug fixes.
00044  *
00045  * Revision 1.5  2008/12/02 15:02:22  j_novak
00046  * Implementation of the new constrained formalism, following Cordero et al. 2009
00047  * paper. The evolution eqs. are solved as a first-order system. Not tested yet!
00048  *
00049  * Revision 1.4  2007/06/05 07:38:37  j_novak
00050  * Better treatment of dzpuis for A and tilde(B) potentials. Some errors in the bases manipulation have been also corrected.
00051  *
00052  * Revision 1.3  2007/05/24 12:10:41  j_novak
00053  * Update of khi_evol and mu_evol.
00054  *
00055  * Revision 1.2  2007/04/25 15:21:01  j_novak
00056  * Corrected an error in the initialization of tildeB in
00057  * Tslice_dirac_max::initial_dat_cts. + New method for solve_hij_AB.
00058  *
00059  * Revision 1.1  2007/03/21 14:51:50  j_novak
00060  * Introduction of potentials A and tilde(B) of h^{ij} into Tslice_dirac_max.
00061  *
00062  *
00063  * $Header $
00064  *
00065  */
00066 
00067 // C headers
00068 #include <assert.h>
00069 
00070 // Lorene headers
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     // Reset of quantities depending on h^{ij}:
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)) ;   // The starting point
00105     assert (B_hh_evol.is_known(j0)) ;    // of the computation 
00106 
00107     const Map& mp = A_hh_evol[j0].get_mp() ;
00108 
00109     // The representation of h^{ij} as an object of class Sym_tensor_trans :
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     // Result set to trh_evol and hh_evol
00116     // ----------------------------------
00117     trh_evol.update(hij.the_trace(), j0, the_time[j0]) ;
00118     
00119     // The longitudinal part of h^{ij}, which is zero by virtue of Dirac gauge :
00120     Vector wzero(mp, CON,  *(ff.get_triad())) ; 
00121     wzero.set_etat_zero() ;                   
00122 
00123     // Temporary Sym_tensor with longitudinal part set to zero : 
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         // Reset of quantities depending on h^{ij}:
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     // Test
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     // The representation of h^{ij} as an object of class Sym_tensor_trans :
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     // Result set to trh_evol and hh_evol
00173     // ----------------------------------
00174     trh_evol.update(hij.the_trace(), jtime, the_time[jtime]) ;
00175     
00176     // The longitudinal part of h^{ij}, which is zero by virtue of Dirac gauge :
00177     Vector wzero(mp, CON,  *(ff.get_triad())) ; 
00178     wzero.set_etat_zero() ;                   
00179 
00180     // Temporary Sym_tensor with longitudinal part set to zero : 
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     // Reset of quantities depending on h^{ij}:
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     // Test
00204     maxabs(tgam().determinant() - 1, 
00205        "Max. of absolute value of deviation from det tgam = 1") ; 
00206 #endif
00207 }
00208                  //----------------------------------------------//
00209                  //   Equations for h^{ij} and \hat{A}^{ij}      //
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() ;    // {\tilde \gamma}_{ij}
00230     const Sym_tensor& tgam_uu = tgam().con() ;    // {\tilde \gamma}^{ij}
00231     const Tensor_sym& dtgam = tgam_dd.derive_cov(ff) ;// D_k {\tilde \gamma}_{ij}
00232     const Tensor_sym& dhh = hh().derive_cov(ff) ; // D_k h^{ij}
00233     const Vector& dln_psi = ln_psi().derive_cov(ff) ; // D_i ln(Psi)
00234     const Vector& tdln_psi_u = ln_psi().derive_con(tgam()) ; // tD^i ln(Psi)
00235     Scalar log_N = log(nn()) ;
00236     log_N.std_spectral_base() ;
00237     const Vector& tdlnn_u = log_N.derive_con(tgam()) ;       // tD^i ln(N)
00238     const Scalar& div_beta = beta().divergence(ff) ;  // D_k beta^k
00239     Scalar qq = nn()*psi()*psi() ;
00240     qq.annule_domain(nz-1) ;
00241     const Vector& dqq = qq.derive_cov(ff) ;         // D_i Q
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     // Source for hij
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     // Source for \hat{A}^{ij}
00273     //==================================
00274     
00275     Sym_tensor source_aij = a_hat.derive_lie(beta())  
00276         + 1.666666666666667*a_hat*div_beta ;
00277     
00278     // Quadratic part of the Ricci tensor of gam_tilde 
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() ;   // dzpuis : 3 --> 4
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 ; // a factor 1/2 is still missing, shall be put later
00320     
00321     // Curvature scalar of conformal metric :
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     //   sym_tmp.inc_dzpuis() ; // dzpuis : 3 --> 4
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()) ; // S = S_i^i 
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   // Scalar dess = tmp - tilde_lap_B ;
00399   // dess.set_spectral_va().ylm_i() ;
00400   // des_profile(dess, 0, 8., 1, 1) ;
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 

Generated on Tue Feb 7 01:35:21 2012 for LORENE by  doxygen 1.4.6