LORENE
tslice_adm_mass.C
1 /*
2  * Virtual methods of class Time_slice and derived classes to
3  * compute the ADM mass
4  *
5  * (see file time_slice.h for documentation).
6  *
7  */
8 
9 /*
10  * Copyright (c) 2004 Eric Gourgoulhon & Jerome Novak
11  *
12  * This file is part of LORENE.
13  *
14  * LORENE is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2
16  * as published by the Free Software Foundation.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 
30 
31 /*
32  * $Id: tslice_adm_mass.C,v 1.8 2016/12/05 16:18:19 j_novak Exp $
33  * $Log: tslice_adm_mass.C,v $
34  * Revision 1.8 2016/12/05 16:18:19 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.7 2014/10/13 08:53:47 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.6 2014/10/06 15:13:21 j_novak
41  * Modified #include directives to use c++ syntax.
42  *
43  * Revision 1.5 2010/10/20 07:58:09 j_novak
44  * Better implementation of the explicit time-integration. Not fully-tested yet.
45  *
46  * Revision 1.4 2008/12/04 19:36:40 j_novak
47  * Removed old tests.
48  *
49  * Revision 1.3 2004/05/12 15:24:20 e_gourgoulhon
50  * Reorganized the #include 's, taking into account that
51  * time_slice.h contains now an #include "metric.h".
52  *
53  * Revision 1.2 2004/05/10 09:11:20 e_gourgoulhon
54  * Corrected bug in Time_slice::adm_mass().
55  * Reorganized outputs.
56  *
57  * Revision 1.1 2004/05/09 20:56:29 e_gourgoulhon
58  * First version.
59  *
60  *
61  * $Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_adm_mass.C,v 1.8 2016/12/05 16:18:19 j_novak Exp $
62  *
63  */
64 
65 
66 // C headers
67 #include <cmath>
68 
69 // Lorene headers
70 #include "time_slice.h"
71 
72 //--------------------
73 // Time_slice version
74 //--------------------
75 
76 namespace Lorene {
77 double Time_slice::adm_mass() const {
78 
79  if ( !(adm_mass_evol).is_known(jtime) ) { // a new computation is necessary
80 
81  const Map& mp = gam_dd().get_mp() ;
82  Metric_flat ff(mp, *(gam_dd().get_triad())) ;
83  int nz = mp.get_mg()->get_nzone() ;
84  Tbl* tmass = new Tbl(nz) ;
85  tmass->set_etat_qcq() ;
86 
87  Vector ww = gam_dd().derive_con(ff).trace(1,2).up(0,ff)
88  - gam_dd().trace(ff).derive_con(ff) ;
89 
90  for (int l=0; l<nz; l++) {
91  double radius = mp.val_r(l, 1., 0., 0.) ;
92  tmass->set(l) = ww.flux(radius, ff) / (16.* M_PI) ;
93  }
94 
95  adm_mass_evol.update(*tmass, jtime, the_time[jtime]) ;
96 
97  delete tmass ;
98 
99  cout << "Time_slice::adm_mass : " << adm_mass_evol[jtime] << endl ;
100  }
101 
102  const Tbl& tadm = adm_mass_evol[jtime] ;
103  return tadm(tadm.get_taille()-1) ;
104 }
105 
106 
107 //--------------------------
108 // Time_slice_conf version
109 //--------------------------
110 
112 
113  if ( !(adm_mass_evol).is_known(jtime) ) { // a new computation is necessary
114 
115  const Map& mp = psi().get_mp() ;
116  int nz = mp.get_mg()->get_nzone() ;
117  Tbl* tmass = new Tbl(nz) ;
118  tmass->set_etat_qcq() ;
119 
120  Vector ww = psi().derive_con(ff)
121  + 0.125* ( hdirac() - (hh().trace(ff)).derive_con(ff) ) ;
122 
123  for (int l=0; l<nz; l++) {
124  double radius = mp.val_r(l, 1., 0., 0.) ;
125  tmass->set(l) = - ww.flux(radius, ff) / (2.* M_PI) ;
126  }
127 
128  adm_mass_evol.update(*tmass, jtime, the_time[jtime]) ;
129 
130  delete tmass ;
131 
132 #ifndef NDEBUG
133  cout << "Time_slice_conf::adm_mass : " << adm_mass_evol[jtime] << endl ;
134 #endif
135  }
136 
137  const Tbl& tadm = adm_mass_evol[jtime] ;
138  return tadm(tadm.get_taille()-1) ;
139 }
140 
141 
142 //--------------------------
143 // Tslice_dirac_max version
144 //--------------------------
145 
147 
148  if ( !(adm_mass_evol).is_known(jtime) ) { // a new computation is necessary
149 
150  const Map& mp = psi().get_mp() ;
151  int nz = mp.get_mg()->get_nzone() ;
152  Tbl* tmass = new Tbl(nz) ;
153  tmass->set_etat_qcq() ;
154 
155  Vector ww = psi().derive_con(ff)
156  - 0.125* (hh().trace(ff)).derive_con(ff) ;
157  // trh() is not used since it has dzpuis = 4
158 
159  for (int l=0; l<nz; l++) {
160  double radius = mp.val_r(l, 1., 0., 0.) ;
161  tmass->set(l) = - ww.flux(radius, ff) / (2.* M_PI) ;
162  }
163 
164  adm_mass_evol.update(*tmass, jtime, the_time[jtime]) ;
165 
166  delete tmass ;
167 #ifndef NDEBUG
168  cout << "Tslice_dirac_max::adm_mass : " << adm_mass_evol[jtime]
169  << endl ;
170 #endif
171 
172  }
173 
174  const Tbl& tadm = adm_mass_evol[jtime] ;
175  return tadm(tadm.get_taille()-1) ;
176 }
177 
178 
179 
180 
181 }
virtual const Scalar & psi() const
Conformal factor relating the physical metric to the conformal one: .
double flux(double radius, const Metric &met) const
Computes the flux of the vector accross a sphere r = const.
Definition: vector.C:813
virtual double adm_mass() const
Returns the ADM mass at (geometrical units) the current step.
virtual const Vector & hdirac() const
Vector which vanishes in Dirac gauge.
Lorene prototypes.
Definition: app_hor.h:67
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
Definition: time_slice.h:236
Tensor up(int ind, const Metric &gam) const
Computes a new tensor by raising an index of *this.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:777
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
Flat metric for tensor calculation.
Definition: metric.h:261
Base class for coordinate mappings.
Definition: map.h:682
const Tensor_sym & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
int jtime
Time step index of the latest slice.
Definition: time_slice.h:193
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Definition: scalar_deriv.C:402
Tensor field of valence 1.
Definition: vector.h:188
virtual const Sym_tensor & gam_dd() const
Induced metric (covariant components ) at the current time step (jtime )
virtual const Sym_tensor & hh(Param *=0x0, Param *=0x0) const
Deviation of the conformal metric from the flat metric : .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
virtual double val_r(int l, double xi, double theta, double pphi) const =0
Returns the value of the radial coordinate r for a given in a given domain.
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
virtual double adm_mass() const
Returns the ADM mass (geometrical units) at the current step.
Evolution_std< double > the_time
Time label of each slice.
Definition: time_slice.h:196
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
Definition: tensor.C:1023
const Metric_flat & ff
Pointer on the flat metric with respect to which the conformal decomposition is performed.
Definition: time_slice.h:510
int get_taille() const
Gives the total size (ie dim.taille)
Definition: tbl.h:417
virtual double adm_mass() const
Returns the ADM mass (geometrical units) at the current step.
Basic array class.
Definition: tbl.h:164
virtual const Sym_tensor & hh(Param *par_bc=0x0, Param *par_mat=0x0) const
Deviation of the conformal metric from the flat metric : .
const Map & get_mp() const
Returns the mapping.
Definition: tensor.h:874
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.