tslice_dirac_max_solve.C

00001 /*
00002  *  Methods of class Tslice_dirac_max for solving Einstein equations
00003  *
00004  *    (see file time_slice.h for documentation).
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2004 Eric Gourgoulhon & 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_dirac_max_solve_C[] = "$Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_dirac_max_solve.C,v 1.16 2010/10/20 07:58:10 j_novak Exp $" ;
00029 
00030 /*
00031  * $Id: tslice_dirac_max_solve.C,v 1.16 2010/10/20 07:58:10 j_novak Exp $
00032  * $Log: tslice_dirac_max_solve.C,v $
00033  * Revision 1.16  2010/10/20 07:58:10  j_novak
00034  * Better implementation of the explicit time-integration. Not fully-tested yet.
00035  *
00036  * Revision 1.15  2008/12/02 15:02:22  j_novak
00037  * Implementation of the new constrained formalism, following Cordero et al. 2009
00038  * paper. The evolution eqs. are solved as a first-order system. Not tested yet!
00039  *
00040  * Revision 1.14  2004/07/08 12:29:01  j_novak
00041  * use of new method Tensor::annule_extern_cn
00042  *
00043  * Revision 1.13  2004/06/30 08:02:40  j_novak
00044  * Added filtering in l of khi_new and mu_new. ki_source is forced to go to
00045  * zero at least as r^2.
00046  *
00047  * Revision 1.12  2004/06/17 07:07:11  e_gourgoulhon
00048  * Method solve_hij:
00049  *   -- replaced the attenuation of khi_source with tempo by a call to
00050  *      the new method Tensor::annule_extern_c2
00051  *   -- suppressed filtre_r on khi_source and khi_new
00052  *   -- added graphs of W^i and LW^{ij} (transverse decomp of S^ij).
00053  *
00054  * Revision 1.11  2004/06/15 09:43:36  j_novak
00055  * Attenuation of the source for khi in the last shell (temporary?).
00056  *
00057  * Revision 1.10  2004/06/14 20:47:31  e_gourgoulhon
00058  * Added argument method_poisson to method solve_hij.
00059  *
00060  * Revision 1.9  2004/06/03 10:02:45  j_novak
00061  * Some filtering is done on source_khi and khi_new.
00062  *
00063  * Revision 1.8  2004/05/24 21:00:44  e_gourgoulhon
00064  * Method solve_hij: khi and mu.smooth_decay(2,2) --> smooth_decay(2,1) ;
00065  *   added exponential_decay(khi) and exponential_decay(mu) after the
00066  *   call to smooth_decay. Method exponential_decay is provisory defined
00067  *   in this file.
00068  *
00069  * Revision 1.7  2004/05/17 19:56:25  e_gourgoulhon
00070  * -- Method solve_beta: added argument method
00071  * -- Method solve_hij: added argument graph_device
00072  *
00073  * Revision 1.6  2004/05/12 15:24:20  e_gourgoulhon
00074  * Reorganized the #include 's, taking into account that
00075  * time_slice.h contains now an #include "metric.h".
00076  *
00077  * Revision 1.5  2004/05/05 14:47:05  e_gourgoulhon
00078  * Modified text and graphical outputs.
00079  *
00080  * Revision 1.4  2004/05/03 15:06:27  e_gourgoulhon
00081  * Added matter source in solve_hij.
00082  *
00083  * Revision 1.3  2004/05/03 14:50:00  e_gourgoulhon
00084  * Finished the implementation of method solve_hij.
00085  *
00086  * Revision 1.2  2004/04/30 14:36:15  j_novak
00087  * Added the method Tslice_dirac_max::solve_hij(...)
00088  * NOT READY YET!!!
00089  *
00090  * Revision 1.1  2004/04/30 10:52:14  e_gourgoulhon
00091  * First version.
00092  *
00093  *
00094  * $Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_dirac_max_solve.C,v 1.16 2010/10/20 07:58:10 j_novak Exp $
00095  *
00096  */
00097 
00098 // C headers
00099 #include <assert.h>
00100 
00101 // Lorene headers
00102 #include "time_slice.h"
00103 #include "unites.h"
00104 #include "graphique.h"
00105 #include "proto.h"
00106 
00107                     //----------------------------//
00108                     //    Equation for N\Psi     //
00109                     //----------------------------//
00110 
00111 Scalar Tslice_dirac_max::solve_npsi(const Scalar* p_ener_dens,
00112                                  const Scalar* p_trace_stress) const {
00113 
00114     using namespace Unites ;
00115 
00116     const Map& map = npsi().get_mp() ;
00117     Scalar ener_dens(map) ; 
00118     if (p_ener_dens != 0x0) ener_dens = *(p_ener_dens) ; 
00119     else ener_dens.set_etat_zero() ; 
00120     
00121     Scalar trace_stress(map) ; 
00122     if (p_trace_stress != 0x0) trace_stress = *(p_trace_stress) ; 
00123     else trace_stress.set_etat_zero() ; 
00124     
00125     // Source for N\Psi 
00126     // ----------------
00127         
00128     const Vector& dnpsi = npsi().derive_cov(ff) ; // D_i N\Psi
00129     const Tensor_sym& dhh = hh().derive_cov(ff) ;       // D_k h^{ij}
00130     const Tensor_sym& dtgam = tgam().cov().derive_cov(ff) ;    
00131                                                     // D_k {\tilde \gamma}_{ij}
00132     Sym_tensor taa = aa().up_down(tgam()) ; 
00133         
00134     Scalar aa_quad = contract(taa, 0, 1, aa(), 0, 1) ; 
00135     Scalar tildeR = 0.25 * contract( dhh, 0, 1, dtgam, 0, 1 ).trace(tgam()) 
00136           - 0.5 * contract( dhh, 0, 1, dtgam, 0, 2 ).trace(tgam()) ; 
00137         
00138     Scalar source_npsi = -  contract( hh(), 0, 1, dnpsi.derive_cov(ff), 0, 1 ) ;
00139     source_npsi.inc_dzpuis() ;
00140     source_npsi += npsi()*( 0.5*qpig*(ener_dens + 2.*trace_stress )/( psi()*psi() ) 
00141                 + 0.875*aa_quad/( psi4()*psi4() ) + 0.125*tildeR ) ;
00142         
00143     // Resolution of the Poisson equation for N\Psi
00144     // --------------------------------------------
00145         
00146     Scalar npsi_new = source_npsi.poisson() + 1. ; 
00147 
00148     if (npsi_new.get_etat() == ETATUN) npsi_new.std_spectral_base() ; 
00149 
00150 #ifndef NDEBUG
00151     // Test:
00152     maxabs(npsi_new.laplacian() - source_npsi,
00153                 "Absolute error in the resolution of the equation for N") ;  
00154 #endif
00155     return npsi_new ; 
00156 
00157 }
00158 
00159                 
00160                     //--------------------------//
00161                     //     Equation for \Psi    //
00162                     //--------------------------//
00163 
00164 
00165 Scalar Tslice_dirac_max::solve_psi(const Scalar* p_ener_dens) const {
00166 
00167     using namespace Unites ;
00168 
00169     const Map& map = psi().get_mp() ;
00170     Scalar ener_dens(map) ; 
00171     if (p_ener_dens != 0x0) ener_dens = *(p_ener_dens) ; 
00172     else ener_dens.set_etat_zero() ; 
00173     
00174     // Source for \Psi
00175     // ---------------
00176         
00177     const Vector& dpsi = psi().derive_cov(ff) ;           // D_i Psi
00178     const Tensor_sym& dhh = hh().derive_cov(ff) ;       // D_k h^{ij}
00179     const Tensor_sym& dtgam = tgam().cov().derive_cov(ff) ;    
00180                                                     // D_k {\tilde \gamma}_{ij}
00181 
00182     Sym_tensor taa = hata().up_down(tgam()) ; 
00183         
00184     Scalar aa_quad = contract(taa, 0, 1, hata(), 0, 1) ; 
00185         
00186     Scalar tildeR = 0.25 * contract( dhh, 0, 1, dtgam, 0, 1 ).trace(tgam()) 
00187           - 0.5 * contract( dhh, 0, 1, dtgam, 0, 2 ).trace(tgam()) ; 
00188 
00189     Scalar source_psi = -contract( hh(), 0, 1, dpsi.derive_cov(ff), 0, 1 ) ;
00190     source_psi.inc_dzpuis() ;
00191     source_psi -= 0.5*qpig*ener_dens/psi()  
00192     + 0.125*( aa_quad*pow(psi(), -7) - tildeR*psi() ) ; 
00193                
00194     // Resolution of the Poisson equation for Psi
00195     // ------------------------------------------
00196         
00197     Scalar psi_new = source_psi.poisson() + 1. ; 
00198 
00199     if (psi_new.get_etat() == ETATUN) psi_new.std_spectral_base() ; 
00200 
00201 #ifndef NDEBUG
00202     // Test:
00203     maxabs(psi_new.laplacian() - source_psi,
00204                 "Absolute error in the resolution of the equation for Psi") ;  
00205 #endif
00206 
00207     return psi_new ; 
00208 }
00209                 
00210 
00211 
00212                     //--------------------------//
00213                     //      Equation for beta   //
00214                     //--------------------------//
00215 
00216 
00217 Vector Tslice_dirac_max::solve_beta(int method) 
00218     const {
00219 
00220     // Source for beta
00221     // ---------------
00222     Vector source_beta = 
00223     - contract(hh(), 0, 1, beta().derive_cov(ff).derive_cov(ff), 1, 2)
00224     - 0.3333333333333333*contract(hh(), 1, beta().divergence(ff).derive_cov(ff), 0) ; 
00225 
00226     Sym_tensor sym_tmp = 2*nn()*aa() ;
00227     source_beta += sym_tmp.divergence(ff) ;
00228     source_beta.inc_dzpuis() ; // dzpuis: 3 -> 4
00229 
00230     // Resolution of the vector Poisson equation 
00231     //------------------------------------------
00232     
00233     Vector beta_new = source_beta.poisson(0.3333333333333333, ff, method) ; 
00234         
00235 #ifndef NDEBUG
00236     // Test:
00237     Vector test_beta = (beta_new.derive_con(ff)).divergence(ff)
00238             +  0.3333333333333333 * (beta_new.divergence(ff)).derive_con(ff) ;
00239     test_beta.inc_dzpuis() ;  
00240     maxabs(test_beta - source_beta,
00241                 "Absolute error in the resolution of the equation for beta") ; 
00242 #endif
00243     return beta_new ; 
00244 
00245 }
00246                 
00247 

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