tslice_adm_mass.C

00001 /*
00002  *  Virtual methods of class Time_slice and derived classes to
00003  *  compute the ADM mass
00004  *
00005  *    (see file time_slice.h for documentation).
00006  *
00007  */
00008 
00009 /*
00010  *   Copyright (c) 2004  Eric Gourgoulhon & Jerome Novak
00011  *
00012  *   This file is part of LORENE.
00013  *
00014  *   LORENE is free software; you can redistribute it and/or modify
00015  *   it under the terms of the GNU General Public License version 2
00016  *   as published by the Free Software Foundation.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 char tslice_adm_mass_C[] = "$Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_adm_mass.C,v 1.5 2010/10/20 07:58:09 j_novak Exp $" ;
00030 
00031 /*
00032  * $Id: tslice_adm_mass.C,v 1.5 2010/10/20 07:58:09 j_novak Exp $
00033  * $Log: tslice_adm_mass.C,v $
00034  * Revision 1.5  2010/10/20 07:58:09  j_novak
00035  * Better implementation of the explicit time-integration. Not fully-tested yet.
00036  *
00037  * Revision 1.4  2008/12/04 19:36:40  j_novak
00038  * Removed old tests.
00039  *
00040  * Revision 1.3  2004/05/12 15:24:20  e_gourgoulhon
00041  * Reorganized the #include 's, taking into account that
00042  * time_slice.h contains now an #include "metric.h".
00043  *
00044  * Revision 1.2  2004/05/10 09:11:20  e_gourgoulhon
00045  * Corrected bug in Time_slice::adm_mass().
00046  * Reorganized outputs.
00047  *
00048  * Revision 1.1  2004/05/09 20:56:29  e_gourgoulhon
00049  * First version.
00050  *
00051  *
00052  * $Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_adm_mass.C,v 1.5 2010/10/20 07:58:09 j_novak Exp $
00053  *
00054  */
00055 
00056 
00057 // C headers
00058 #include <math.h>
00059 
00060 // Lorene headers
00061 #include "time_slice.h"
00062 
00063 //--------------------
00064 // Time_slice version 
00065 //--------------------
00066 
00067 double Time_slice::adm_mass() const {
00068 
00069     if ( !(adm_mass_evol).is_known(jtime) ) {  // a new computation is necessary
00070     
00071         const Map& mp = gam_dd().get_mp() ;
00072         Metric_flat ff(mp, *(gam_dd().get_triad())) ;
00073         int nz = mp.get_mg()->get_nzone() ; 
00074         Tbl* tmass = new Tbl(nz) ; 
00075         tmass->set_etat_qcq() ; 
00076     
00077         Vector ww = gam_dd().derive_con(ff).trace(1,2).up(0,ff) 
00078                     - gam_dd().trace(ff).derive_con(ff) ; 
00079 
00080         for (int l=0; l<nz; l++) {
00081             double radius = mp.val_r(l, 1., 0., 0.) ;
00082             tmass->set(l) = ww.flux(radius, ff) / (16.* M_PI) ; 
00083         }
00084         
00085         adm_mass_evol.update(*tmass, jtime, the_time[jtime]) ; 
00086         
00087         delete tmass ;  
00088         
00089         cout << "Time_slice::adm_mass : " << adm_mass_evol[jtime] << endl ; 
00090     }
00091   
00092     const Tbl& tadm = adm_mass_evol[jtime] ; 
00093     return tadm(tadm.get_taille()-1) ; 
00094 }
00095 
00096 
00097 //--------------------------
00098 // Time_slice_conf version 
00099 //--------------------------
00100 
00101 double Time_slice_conf::adm_mass() const {
00102 
00103     if ( !(adm_mass_evol).is_known(jtime) ) {  // a new computation is necessary
00104     
00105         const Map& mp = psi().get_mp() ;
00106         int nz = mp.get_mg()->get_nzone() ; 
00107         Tbl* tmass = new Tbl(nz) ; 
00108         tmass->set_etat_qcq() ; 
00109     
00110         Vector ww = psi().derive_con(ff) 
00111                     + 0.125* ( hdirac() - (hh().trace(ff)).derive_con(ff) )  ; 
00112 
00113         for (int l=0; l<nz; l++) {
00114             double radius = mp.val_r(l, 1., 0., 0.) ;
00115             tmass->set(l) = - ww.flux(radius, ff) / (2.* M_PI) ; 
00116         }
00117         
00118         adm_mass_evol.update(*tmass, jtime, the_time[jtime]) ; 
00119         
00120         delete tmass ;  
00121     
00122 #ifndef NDEBUG
00123         cout << "Time_slice_conf::adm_mass : " << adm_mass_evol[jtime] << endl ; 
00124 #endif    
00125     }
00126   
00127     const Tbl& tadm = adm_mass_evol[jtime] ; 
00128     return tadm(tadm.get_taille()-1) ; 
00129 }
00130 
00131 
00132 //--------------------------
00133 // Tslice_dirac_max version 
00134 //--------------------------
00135 
00136 double Tslice_dirac_max::adm_mass() const {
00137 
00138     if ( !(adm_mass_evol).is_known(jtime) ) {  // a new computation is necessary
00139     
00140         const Map& mp = psi().get_mp() ;
00141         int nz = mp.get_mg()->get_nzone() ; 
00142         Tbl* tmass = new Tbl(nz) ; 
00143         tmass->set_etat_qcq() ; 
00144     
00145         Vector ww = psi().derive_con(ff) 
00146                     - 0.125* (hh().trace(ff)).derive_con(ff) ;
00147                     // trh() is not used since it has dzpuis = 4 
00148 
00149         for (int l=0; l<nz; l++) {
00150             double radius = mp.val_r(l, 1., 0., 0.) ;
00151             tmass->set(l) = - ww.flux(radius, ff) / (2.* M_PI) ; 
00152         }
00153         
00154         adm_mass_evol.update(*tmass, jtime, the_time[jtime]) ; 
00155         
00156         delete tmass ;  
00157 #ifndef NDEBUG
00158         cout << "Tslice_dirac_max::adm_mass : " << adm_mass_evol[jtime] 
00159              << endl ; 
00160 #endif
00161 
00162     }
00163   
00164     const Tbl& tadm = adm_mass_evol[jtime] ; 
00165     return tadm(tadm.get_taille()-1) ; 
00166 }
00167 
00168 
00169 
00170 

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