LORENE
time_slice_access.C
1 /*
2  * Methods of class Time_slice to access the various fields
3  *
4  * (see file time_slice.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2004 Eric Gourgoulhon, Jose Luis Jaramillo & Jerome Novak
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
16  *
17  * LORENE is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with LORENE; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 
29 
30 /*
31  * $Id: time_slice_access.C,v 1.10 2016/12/05 16:18:19 j_novak Exp $
32  * $Log: time_slice_access.C,v $
33  * Revision 1.10 2016/12/05 16:18:19 j_novak
34  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
35  *
36  * Revision 1.9 2014/10/13 08:53:47 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.8 2014/10/06 15:13:21 j_novak
40  * Modified #include directives to use c++ syntax.
41  *
42  * Revision 1.7 2008/12/02 15:02:22 j_novak
43  * Implementation of the new constrained formalism, following Cordero et al. 2009
44  * paper. The evolution eqs. are solved as a first-order system. Not tested yet!
45  *
46  * Revision 1.6 2004/05/12 15:24:20 e_gourgoulhon
47  * Reorganized the #include 's, taking into account that
48  * time_slice.h contains now an #include "metric.h".
49  *
50  * Revision 1.5 2004/04/05 11:52:36 j_novak
51  * First operational (but not tested!) version of checks of Eintein equation.
52  *
53  * Revision 1.4 2004/04/01 16:09:02 j_novak
54  * Trace of K_ij is now member of Time_slice (it was member of Time_slice_conf).
55  * Added new methods for checking 3+1 Einstein equations (preliminary).
56  *
57  * Revision 1.3 2004/03/29 12:00:16 e_gourgoulhon
58  * Computation of extrinsic curvature now performed via new methods
59  * Vector::ope_killing.
60  *
61  * Revision 1.2 2004/03/28 21:29:45 e_gourgoulhon
62  * Evolution_std's renamed with suffix "_evol"
63  * Method gam() modified
64  * Added special constructor for derived classes.
65  *
66  * Revision 1.1 2004/03/26 13:33:02 j_novak
67  * New methods for accessing/updating members (nn(), beta(), gam_uu(), k_uu(), ...)
68  *
69  *
70  *
71  * $Header: /cvsroot/Lorene/C++/Source/Time_slice/time_slice_access.C,v 1.10 2016/12/05 16:18:19 j_novak Exp $
72  *
73  */
74 
75 // C headers
76 #include <cassert>
77 
78 // Lorene headers
79 #include "time_slice.h"
80 
81 namespace Lorene {
82 const Scalar& Time_slice::nn() const {
83 
84  assert( n_evol.is_known(jtime) ) ;
85  return n_evol[jtime] ;
86 
87 }
88 
89 
90 const Vector& Time_slice::beta() const {
91 
92  assert( beta_evol.is_known(jtime) ) ;
93  return beta_evol[jtime] ;
94 
95 
96 }
97 
98 const Metric& Time_slice::gam() const {
99 
100  if (p_gamma == 0x0) {
101  gam_dd() ; // may force the computation of p_gamma
102  if (p_gamma == 0x0) p_gamma = new Metric( gam_dd() ) ;
103  }
104 
105  return *p_gamma ;
106 
107 }
108 
109 
111 
112  if (!( gam_dd_evol.is_known(jtime)) ) {
113  assert( gam_uu_evol.is_known(jtime) ) ;
114  if (p_gamma == 0x0) {
115  p_gamma = new Metric( gam_uu_evol[jtime] ) ;
116  }
117 
118  gam_dd_evol.update(p_gamma->cov(), jtime, the_time[jtime] ) ;
119  }
120 
121  return gam_dd_evol[jtime] ;
122 
123 }
124 
126 
127  if (!( gam_uu_evol.is_known(jtime)) ) {
128  assert( gam_dd_evol.is_known(jtime) ) ;
129  gam_uu_evol.update(gam().con(), jtime, the_time[jtime] ) ;
130  }
131 
132  return gam_uu_evol[jtime] ;
133 
134 }
135 
136 
137 
138 const Sym_tensor& Time_slice::k_dd() const {
139 
140  if ( ! (k_dd_evol.is_known(jtime)) ) {
141 
142  Vector beta_d = beta().down(0, gam()) ;
143 
144  gam_dd() ; // to make sure that gam_dd is up to date before taking its
145  // time derivative
146 
147  Sym_tensor resu = beta_d.ope_killing(gam())
148  - gam_dd_evol.time_derive(jtime, scheme_order) ;
149 
150  resu = resu / (2*nn()) ;
151 
152  k_dd_evol.update(resu, jtime, the_time[jtime]) ;
153 
154  }
155 
156  return k_dd_evol[jtime] ;
157 
158 }
159 
160 const Sym_tensor& Time_slice::k_uu() const {
161 
162  if ( ! (k_uu_evol.is_known(jtime)) ) {
163 
164  gam_uu() ; // to make sure that gam_uu is up to date before taking its
165  // time derivative
166 
167  Sym_tensor resu = beta().ope_killing(gam())
168  + gam_uu_evol.time_derive(jtime, scheme_order) ;
169 
170  resu = resu / (2*nn()) ;
171 
172  k_uu_evol.update(resu, jtime, the_time[jtime]) ;
173 
174  }
175 
176  return k_uu_evol[jtime] ;
177 
178 }
179 
180 const Scalar& Time_slice::trk() const {
181 
182  if ( ! (trk_evol.is_known(jtime)) ) {
183 
184  if ( k_uu_evol.is_known(jtime) )
185  trk_evol.update( k_uu().trace(gam()), jtime, the_time[jtime] ) ;
186  else
187  trk_evol.update( k_dd().trace(gam()), jtime, the_time[jtime] ) ;
188 
189  }
190 
191  return trk_evol[jtime] ;
192 
193 }
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 }
virtual const Vector & beta() const
shift vector at the current time step (jtime )
Metric for tensor calculation.
Definition: metric.h:90
Sym_tensor ope_killing(const Metric &gam) const
Computes the Killing operator associated with a given metric.
Definition: vector.C:444
Lorene prototypes.
Definition: app_hor.h:67
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
Definition: time_slice.h:190
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
int jtime
Time step index of the latest slice.
Definition: time_slice.h:193
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric ...
Definition: time_slice.h:201
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 )
Evolution_std< Sym_tensor > k_uu_evol
Values at successive time steps of the contravariant components of the extrinsic curvature tensor ...
Definition: time_slice.h:216
virtual const Scalar & trk() const
Trace K of the extrinsic curvature at the current time step (jtime )
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime ) ...
virtual const Sym_tensor & gam_uu() const
Induced metric (contravariant components ) at the current time step (jtime )
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric ...
Definition: time_slice.h:206
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor ...
Definition: time_slice.h:211
const Metric & gam() const
Induced metric at the current time step (jtime )
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime)
Definition: time_slice.h:242
virtual const Sym_tensor & k_dd() const
Extrinsic curvature tensor (covariant components ) at the current time step (jtime ) ...
Evolution_std< double > the_time
Time label of each slice.
Definition: time_slice.h:196
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition: metric.C:283
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
Definition: time_slice.h:227
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
Definition: time_slice.h:219
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
Definition: time_slice.h:222
Class intended to describe valence-2 symmetric tensors.
Definition: sym_tensor.h:226
virtual const Scalar & nn() const
Lapse function N at the current time step (jtime )
Tensor down(int ind, const Metric &gam) const
Computes a new tensor by lowering an index of *this.