Debian Codegraph @

C++/Include/sym_tensor.h

raw symbols SCIP
1 /*
2 * Definition of Lorene class Sym_tensor,
3 * as well as derived classes Sym_tensor_trans and Sym_tensor_tt
4 *
5 */
6
7 /*
8 * Copyright (c) 2003-2004 Eric Gourgoulhon & Jerome Novak
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27 #ifndef __SYM_TENSOR_H_
28 #define __SYM_TENSOR_H_
29
30 /*
31 * $Id: sym_tensor.h,v 1.49 2014/10/13 08:52:36 j_novak Exp $
32 * $Log: sym_tensor.h,v $
33 * Revision 1.49 2014/10/13 08:52:36 j_novak
34 * Lorene classes and functions now belong to the namespace Lorene.
35 *
36 * Revision 1.48 2010/10/11 10:23:03 j_novak
37 * Removed methods Sym_tensor_trans::solve_hrr() and Sym_tensor_trans::set_WX_det_one(), as they are no longer relevant.
38 *
39 * Revision 1.47 2008/12/05 08:46:19 j_novak
40 * New method Sym_tensor_trans_aux::set_tt_part_det_one.
41 *
42 * Revision 1.46 2008/12/03 10:18:56 j_novak
43 * Method 6 is now the default for calls to vector Poisson solver.
44 *
45 * Revision 1.45 2008/08/20 14:39:53 n_vasset
46 * New Dirac solvers handling degenerate elliptic operators on excised spacetimes.
47 *
48 * Revision 1.44 2007/12/21 16:06:16 j_novak
49 * Methods to filter Tensor, Vector and Sym_tensor objects.
50 *
51 * Revision 1.43 2007/11/27 15:48:52 n_vasset
52 * New member p_tilde_c for class Sym_tensor
53 *
54 * Revision 1.42 2007/05/04 16:43:50 n_vasset
55 * adding of functions sol_Dirac_BC2 and sol_Dirac_A2
56 *
57 * Revision 1.41 2006/10/24 13:03:17 j_novak
58 * New methods for the solution of the tensor wave equation. Perhaps, first
59 * operational version...
60 *
61 * Revision 1.40 2006/08/31 12:13:21 j_novak
62 * Added an argument of type Param to Sym_tensor_trans::sol_ rac_A().
63 *
64 * Revision 1.39 2006/06/20 12:07:13 j_novak
65 * Improved execution speed for sol_Dirac_tildeB...
66 *
67 * Revision 1.38 2006/06/14 10:04:19 j_novak
68 * New methods sol_Dirac_l01, set_AtB_det_one and set_AtB_trace_zero.
69 *
70 * Revision 1.37 2006/06/13 13:30:12 j_novak
71 * New members sol_Dirac_A and sol_Dirac_tildeB (see documentation).
72 *
73 * Revision 1.36 2006/06/12 13:37:23 j_novak
74 * Added bounds in l (multipolar momentum) for Sym_tensor_trans::solve_hrr.
75 *
76 * Revision 1.35 2006/06/12 07:42:28 j_novak
77 * Fields A and tilde{B} are defined only for l>1.
78 *
79 * Revision 1.34 2006/06/12 07:27:18 j_novak
80 * New members concerning A and tilde{B}, dealing with the transverse part of the
81 * Sym_tensor.
82 *
83 * Revision 1.33 2005/11/28 14:45:14 j_novak
84 * Improved solution of the Poisson tensor equation in the case of a transverse
85 * tensor.
86 *
87 * Revision 1.32 2005/09/16 13:58:10 j_novak
88 * New Poisson solver for a Sym_tensor_trans.
89 *
90 * Revision 1.31 2005/09/07 16:47:42 j_novak
91 * Removed method Sym_tensor_trans::T_from_det_one
92 * Modified Sym_tensor::set_auxiliary, so that it takes eta/r and mu/r as
93 * arguments.
94 * Modified Sym_tensor_trans::set_hrr_mu.
95 * Added new protected method Sym_tensor_trans::solve_hrr
96 *
97 * Revision 1.30 2005/04/08 08:22:04 j_novak
98 * New methods set_hrr_mu_det_one() and set_WX_det_one(). Not tested yet...
99 *
100 * Revision 1.29 2005/04/06 15:43:58 j_novak
101 * New method Sym_tensor_trans::T_from_det_one(...).
102 *
103 * Revision 1.28 2005/04/04 15:25:22 j_novak
104 * Added new members www, xxx, ttt and the associated methods.
105 *
106 * Revision 1.27 2005/04/01 14:28:31 j_novak
107 * Members p_eta and p_mu are now defined in class Sym_tensor.
108 *
109 * Revision 1.26 2005/01/03 08:34:58 f_limousin
110 * Come back to the previous version.
111 *
112 * Revision 1.25 2005/01/03 08:15:39 f_limousin
113 * The first argument of the function trace_from_det_one(...) is now
114 * a Sym_tensor_trans instead of a Sym_tensor_tt (because of a
115 * compilation error with some compilators).
116 *
117 * Revision 1.24 2004/12/28 14:21:46 j_novak
118 * Added the method Sym_tensor_trans::trace_from_det_one
119 *
120 * Revision 1.23 2004/12/28 10:37:22 j_novak
121 * Better way of enforcing zero divergence.
122 *
123 * Revision 1.22 2004/06/14 20:44:44 e_gourgoulhon
124 * Added argument method_poisson to Sym_tensor::longit_pot and
125 * Sym_tensor::transverse.
126 *
127 * Revision 1.21 2004/05/25 14:57:20 f_limousin
128 * Add parameters in argument of functions transverse, longit_pot,
129 * set_tt_trace, tt_part and set_khi_mu for the case of a Map_et.
130 *
131 * Revision 1.20 2004/05/24 13:44:54 e_gourgoulhon
132 * Added parameter dzp to method Sym_tensor_tt::update.
133 *
134 * Revision 1.19 2004/04/08 16:37:54 e_gourgoulhon
135 * Sym_tensor_tt::set_khi_mu: added argument dzp (dzpuis of resulting h^{ij}).
136 *
137 * Revision 1.18 2004/03/30 14:01:19 j_novak
138 * Copy constructors and operator= now copy the "derived" members.
139 *
140 * Revision 1.17 2004/03/29 16:13:06 j_novak
141 * New methods set_longit_trans and set_tt_trace .
142 *
143 * Revision 1.16 2004/03/22 13:12:43 j_novak
144 * Modification of comments to use doxygen instead of doc++
145 *
146 * Revision 1.15 2004/03/03 13:54:16 j_novak
147 * Error in comments corrected.
148 *
149 * Revision 1.14 2004/03/03 13:16:20 j_novak
150 * New potential khi (p_khi) and the functions manipulating it.
151 *
152 * Revision 1.13 2004/02/26 22:45:13 e_gourgoulhon
153 * Added method derive_lie.
154 *
155 * Revision 1.12 2004/02/18 18:43:22 e_gourgoulhon
156 * Method trace() renamed the_trace() in order to avoid
157 * any confusion with new method Tensor::trace().
158 *
159 * Revision 1.11 2004/01/04 20:49:06 e_gourgoulhon
160 * Sym_tensor is now a derived class of Tensor_sym.
161 * Suppressed methods Sym_tensor::indices and Sym_tensor::position:
162 * they are now implemented at the Tensor_sym level.
163 *
164 * Revision 1.10 2003/11/27 16:05:11 e_gourgoulhon
165 * Changed return value of methods transverse( ) and longit_pot( ).
166 *
167 * Revision 1.9 2003/11/26 21:56:21 e_gourgoulhon
168 * Class Sym_tensor: added the members p_transverse and p_longit_pot,
169 * and the associated methods transverse( ), longit_pot( ),
170 * del_deriv_met( ) and set_der_met_0x0( ).
171 *
172 * Revision 1.8 2003/11/07 16:54:23 e_gourgoulhon
173 * Added method Sym_tensor_tt::poisson().
174 *
175 * Revision 1.7 2003/11/06 14:43:37 e_gourgoulhon
176 * Gave a name to const arguments in certain method prototypes (e.g.
177 * constructors) to correct a bug of DOC++.
178 *
179 * Revision 1.6 2003/11/05 15:26:31 e_gourgoulhon
180 * Modif documentation.
181 *
182 * Revision 1.5 2003/11/04 22:57:26 e_gourgoulhon
183 * Class Sym_tensor_tt: method set_eta_mu renamed set_rr_eta_mu
184 * method update_tp() renamed update()
185 * added method set_rr_mu.
186 *
187 * Revision 1.4 2003/11/03 22:29:54 e_gourgoulhon
188 * Class Sym_tensor_tt: added functions set_eta_mu and update_tp.
189 *
190 * Revision 1.3 2003/11/03 17:09:30 e_gourgoulhon
191 * Class Sym_tensor_tt: added the methods eta() and mu().
192 *
193 * Revision 1.2 2003/10/28 21:22:51 e_gourgoulhon
194 * Class Sym_tensor_trans: added methods trace() and tt_part().
195 *
196 * Revision 1.1 2003/10/27 10:45:19 e_gourgoulhon
197 * New derived classes Sym_tensor_trans and Sym_tensor_tt.
198 *
199 *
200 * $Header: /cvsroot/Lorene/C++/Include/sym_tensor.h,v 1.49 2014/10/13 08:52:36 j_novak Exp $
201 *
202 */
203
204 namespace Lorene {
205 class Sym_tensor_trans ;
206 class Sym_tensor_tt ;
207
208
209
210
211 //---------------------------------//
212 // class Sym_tensor //
213 //---------------------------------//
214
215 /**
216 * Class intended to describe valence-2 symmetric tensors.
217 * The storage and the calculations are different and quicker than with an
218 * usual \c Tensor .
219 *
220 * The valence must be 2. \ingroup (tensor)
221 *
222 */
223 class Sym_tensor : public Tensor_sym {
224
225 // Derived data :
226 // ------------
227 protected:
228 /** Array of the transverse part \f${}^t T^{ij}\f$ of the tensor with respect
229 * to various metrics, transverse meaning divergence-free with respect
230 * to a metric. Denoting \c *this by \f$T^{ij}\f$, we then have
231 * \f[
232 * T^{ij} = {}^t T^{ij} + \nabla^i W^j + \nabla^j W^i
233 * \qquad\mbox{with}\quad \nabla_j {}^t T^{ij} = 0
234 *\f]
235 * where \f$\nabla_i\f$ denotes the covariant derivative with respect
236 * to the given metric and \f$W^i\f$ is the vector potential of the
237 * longitudinal part of \f$T^{ij}\f$ (member \c p_longit_pot below)
238 */
239 mutable Sym_tensor_trans* p_transverse[N_MET_MAX] ;
240
241 /** Array of the vector potential of the
242 * longitudinal part of the tensor with respect
243 * to various metrics (see documentation of member
244 * \c p_transverse
245 */
246 mutable Vector* p_longit_pot[N_MET_MAX] ;
247
248 /** Field \f$\eta\f$ such that the components \f$(T^{r\theta}, T^{r\varphi})\f$
249 * of the tensor are written (has only meaning with spherical components!):
250 * \f[
251 * T^{r\theta} = {1\over r} \left( {\partial \eta \over \partial\theta} -
252 * {1\over\sin\theta} {\partial \mu \over \partial\varphi} \right)
253 *\f]
254 * \f[
255 * T^{r\varphi} = {1\over r} \left( {1\over\sin\theta}
256 * {\partial \eta \over \partial\varphi}
257 * + {\partial \mu \over \partial\theta} \right)
258 *\f]
259 */
260 mutable Scalar* p_eta ;
261
262 /** Field \f$\mu\f$ such that the components \f$(T^{r\theta}, T^{r\varphi})\f$
263 * of the tensor are written (has only meaning with spherical components!):
264 * \f[
265 * T^{r\theta} = {1\over r} \left( {\partial \eta \over \partial\theta} -
266 * {1\over\sin\theta} {\partial \mu \over \partial\varphi} \right)
267 *\f]
268 * \f[
269 * T^{r\varphi} = {1\over r} \left( {1\over\sin\theta}
270 * {\partial \eta \over \partial\varphi}
271 * + {\partial \mu \over \partial\theta} \right)
272 *\f]
273 */
274 mutable Scalar* p_mu ;
275
276 /** Field \e W such that the components \f$T^{\theta\theta},
277 * T^{\varphi\varphi}\f$ and \f$T^{\theta\varphi}\f$
278 * of the tensor are written (has only meaning with spherical components!):
279 * \f[
280 * \frac{1}{2}\left(T^{\theta\theta} - T^{\varphi\varphi} \right)
281 * = \frac{\partial^2 W}{\partial\theta^2} - \frac{1}{\tan
282 * \theta} \frac{\partial W}{\partial \theta} - \frac{1}{\sin^2 \theta}
283 * \frac{\partial^2 W}{\partial \varphi^2} - 2\frac{\partial}{\partial \theta}
284 * \left( \frac{1}{\sin \theta} \frac{\partial X}{\partial \varphi} \right) ,
285 *\f]
286 * \f[
287 * T^{\theta\varphi} = \frac{\partial^2 X}{\partial\theta^2} - \frac{1}{\tan
288 * \theta} \frac{\partial X}{\partial \theta} - \frac{1}{\sin^2 \theta}
289 * \frac{\partial^2 X}{\partial \varphi^2} + 2\frac{\partial}{\partial \theta}
290 * \left( \frac{1}{\sin \theta} \frac{\partial W}{\partial \varphi} \right) .
291 *\f]
292 */
293 mutable Scalar* p_www ;
294
295 /** Field \e X such that the components \f$T^{\theta\theta},
296 * T^{\varphi\varphi}\f$ and \f$T^{\theta\varphi}\f$
297 * of the tensor are written (has only meaning with spherical components!):
298 * \f[
299 * \frac{1}{2}\left(T^{\theta\theta} - T^{\varphi\varphi} \right)
300 * = \frac{\partial^2 W}{\partial\theta^2} - \frac{1}{\tan
301 * \theta} \frac{\partial W}{\partial \theta} - \frac{1}{\sin^2 \theta}
302 * \frac{\partial^2 W}{\partial \varphi^2} - 2\frac{\partial}{\partial \theta}
303 * \left( \frac{1}{\sin \theta} \frac{\partial X}{\partial \varphi} \right) ,
304 *\f]
305 * \f[
306 * T^{\theta\varphi} = \frac{\partial^2 X}{\partial\theta^2} - \frac{1}{\tan
307 * \theta} \frac{\partial X}{\partial \theta} - \frac{1}{\sin^2 \theta}
308 * \frac{\partial^2 X}{\partial \varphi^2} + 2\frac{\partial}{\partial \theta}
309 * \left( \frac{1}{\sin \theta} \frac{\partial W}{\partial \varphi} \right) .
310 *\f]
311 */
312 mutable Scalar* p_xxx ;
313
314 /// Field \e T defined as \f$ T = T^{\theta\theta} + T^{\varphi\varphi} \f$.
315 mutable Scalar* p_ttt ;
316
317 /** Field \e A defined from \e X and \f$\mu\f$ insensitive to the
318 * longitudinal part of the \c Sym_tensor (only for \f$\ell \geq 2\f$).
319 * Its definition reads \f[
320 * A = \frac{\partial X}{\partial r} - \frac{\mu}{r^2}.
321 * \f] */
322 mutable Scalar* p_aaa ;
323
324 /** Field \f$ \tilde{B}\f$ defined from \f$ h^{rr}, \eta, W\f$ and \e h
325 * insensitive to the longitudinal part of the \c Sym_tensor.
326 * It is defined for each multipolar momentum \f$\ell \geq 2\f$ by
327 * \f[
328 * \tilde{B} = (\ell + 2) \frac{\partial W}{\partial r} + \ell(\ell + 2)
329 * \frac{W}{r} - \frac{2\eta}{r^2} + \frac{(\ell +2)T}{2r(\ell + 1)}
330 * + \frac{1}{2(\ell + 1)} \frac{\partial T}{\partial r} - \frac{h^{rr}}
331 * {(\ell + 1)r}.
332 * \f]
333 */
334 mutable Scalar* p_tilde_b ;
335
336 /** Field \f$ \tilde{C}\f$ defined from \f$ h^{rr}, \eta, W\f$ and \e h
337 * insensitive to the longitudinal part of the \c Sym_tensor.
338 * It is defined for each multipolar momentum \f$\ell \geq 2\f$ by
339 * \f[
340 * \tilde{C} = - (\ell - 1) \frac{\partial W}{\partial r} + (\ell + 1)(\ell - 1)
341 * \frac{W}{r} - \frac{2\eta}{r^2} + \frac{(\ell - 1)T}{2r\ell}
342 * - \frac{1}{2 \ell } \frac{\partial T}{\partial r} - \frac{h^{rr}}
343 * {\ell r}.
344 * \f]
345 */
346 mutable Scalar* p_tilde_c ;
347
348
349
350
351
352
353 // Constructors - Destructor :
354 // -------------------------
355
356 public:
357 /** Standard constructor.
358 *
359 * @param map the mapping
360 * @param tipe 1-D array of integers (class \c Itbl ) of size 2
361 * containing the type
362 * of each index, \c COV for a covariant one
363 * and \c CON for a contravariant one, with the
364 * following storage convention:
365 * \li \c tipe(0) : type of the first index
366 * \li \c tipe(1) : type of the second index
367 * @param triad_i vectorial basis (triad) with respect to which
368 * the tensor components are defined
369 */
370 Sym_tensor(const Map& map, const Itbl& tipe, const Base_vect& triad_i) ;
371
372 /** Standard constructor when both indices are of the same type.
373 *
374 * @param map the mapping
375 * @param tipe the type of the indices.
376 * @param triad_i vectorial basis (triad) with respect to which
377 * the tensor components are defined
378 *
379 */
380 Sym_tensor(const Map& map, int tipe, const Base_vect& triad_i) ;
381
382 Sym_tensor(const Sym_tensor& a) ; ///< Copy constructor
383
384 /** Constructor from a \c Tensor .
385 * The symmetry of the input tensor is assumed but is not checked.
386 */
387 Sym_tensor(const Tensor& a) ;
388
389 /** Constructor from a file (see \c sauve(FILE*) ).
390 *
391 * @param map the mapping
392 * @param triad_i vectorial basis (triad) with respect to which
393 * the tensor components are defined. It will
394 * be checked that it coincides with the basis
395 * saved in the file.
396 * @param fich file which has been used by
397 * the function \c sauve(FILE*) .
398 */
399 Sym_tensor(const Map& map, const Base_vect& triad_i, FILE* fich) ;
400
401 virtual ~Sym_tensor() ; ///< Destructor
402
403
404
405 // Memory management
406 // -----------------
407 protected:
408 virtual void del_deriv() const; ///< Deletes the derived quantities
409
410 /// Sets the pointers on derived quantities to 0x0
411 void set_der_0x0() const ;
412
413 /** Logical destructor of the derivatives depending on the i-th
414 * element of \c met_depend specific to the
415 * class \c Sym_tensor (\c p_transverse , etc...).
416 */
417 virtual void del_derive_met(int i) const ;
418
419 /** Sets all the i-th components of \c met_depend specific to the
420 * class \c Sym_tensor (\c p_transverse , etc...) to 0x0.
421 */
422 void set_der_met_0x0(int i) const ;
423
424
425 // Mutators / assignment
426 // ---------------------
427 public:
428 /// Assignment to another \c Sym_tensor
429 virtual void operator=(const Sym_tensor& a) ;
430
431 /// Assignment to a \c Tensor_sym
432 virtual void operator=(const Tensor_sym& a) ;
433
434 /**
435 * Assignment to a \c Tensor .
436 *
437 * The symmetry is assumed but not checked.
438 */
439 virtual void operator=(const Tensor& a) ;
440
441 /**
442 * Assigns the derived members \c p_longit_pot and \c p_transverse
443 * and updates the components accordingly.
444 * (see the documentation of these derived members for details)
445 */
446 void set_longit_trans( const Vector& v, const Sym_tensor_trans& a) ;
447
448 /**
449 * Assigns the component \f$ T^{rr} \f$ and the derived members
450 * \c p_eta , \c p_mu , \c p_www, \c p_xxx and \c p_ttt ,
451 * fro, their values and \f$ \eta / r\f$, \f$\mu / r \f$.
452 * It updates the other components accordingly.
453 */
454 void set_auxiliary( const Scalar& trr, const Scalar& eta_over_r, const
455 Scalar& mu_over_r, const Scalar& www, const Scalar&
456 xxx, const Scalar& ttt ) ;
457
458 /** Applies exponential filters to all components
459 * (see \c Scalar::exponential_filter_r ). Does a loop for Cartesian
460 * components, and works in terms of the rr-component, \f$\eta\f$,
461 * \f$\mu\f$, \c W, \c X, \c T for spherical components.
462 */
463 virtual void exponential_filter_r(int lzmin, int lzmax, int p,
464 double alpha= -16.) ;
465
466 /** Applies exponential filters to all components
467 * (see \c Scalar::exponential_filter_ylm ). Does a loop for Cartesian
468 * components, and works in terms of the r-component, \f$\eta\f$,
469 * \f$\mu\f$, \c W, \c X, \c T for spherical components.
470 */
471 virtual void exponential_filter_ylm(int lzmin, int lzmax, int p,
472 double alpha= -16.) ;
473
474 // Computation of derived members
475 // ------------------------------
476 public:
477
478
479 /**Returns the divergence of \c this with respect to a \c Metric .
480 * The indices are assumed to be contravariant.
481 */
482 const Vector& divergence(const Metric&) const ;
483
484 /** Computes the Lie derivative of \c this with respect to some
485 * vector field \c v
486 */
487 Sym_tensor derive_lie(const Vector& v) const ;
488
489 /** Computes the transverse part \f${}^t T^{ij}\f$ of the tensor with respect
490 * to a given metric, transverse meaning divergence-free with respect
491 * to that metric. Denoting \c *this by \f$T^{ij}\f$, we then have
492 * \f[
493 * T^{ij} = {}^t T^{ij} + \nabla^i W^j + \nabla^j W^i
494 * \qquad\mbox{with}\quad \nabla_j {}^t T^{ij} = 0
495 *\f]
496 * where \f$\nabla_i\f$ denotes the covariant derivative with respect
497 * to the given metric and \f$W^i\f$ is the vector potential of the
498 * longitudinal part of \f$T^{ij}\f$ (function \c longit_pot() below)
499 * @param gam metric with respect to the transverse decomposition
500 * is performed
501 * @param par parameters for the vector Poisson equation
502 * @param method_poisson type of method for solving the vector
503 * Poisson equation to get the longitudinal part (see
504 * method \c Vector::poisson)
505 */
506 const Sym_tensor_trans& transverse(const Metric& gam, Param* par = 0x0,
507 int method_poisson = 6) const ;
508
509 /** Computes the vector potential \f$W^i\f$ of
510 * longitudinal part of the tensor (see documentation of
511 * method \c transverse() above).
512 * @param gam metric with respect to the transverse decomposition
513 * is performed
514 * @param par parameters for the vector Poisson equation
515 * @param method_poisson type of method for solving the vector
516 * Poisson equation to get the longitudinal part (see
517 * method \c Vector::poisson)
518 */
519 const Vector& longit_pot(const Metric& gam, Param* par = 0x0,
520 int method_poisson = 6) const ;
521
522 /// Gives the field \f$\eta\f$ (see member \c p_eta ).
523 virtual const Scalar& eta(Param* par = 0x0) const ;
524
525 /// Gives the field \f$\mu\f$ (see member \c p_mu ).
526 const Scalar& mu(Param* par = 0x0) const ;
527
528 /// Gives the field \e W (see member \c p_www ).
529 const Scalar& www() const ;
530
531 /// Gives the field \e X (see member \c p_xxx ).
532 const Scalar& xxx() const ;
533
534 /// Gives the field \e T (see member \c p_ttt ).
535 const Scalar& ttt() const ;
536
537 /** Gives the field \e A (see member \c p_aaa ).
538 * @param output_ylm a flag to control the spectral decomposition
539 * base of the result: if true (default) the spherical harmonics base
540 * is used.
541 */
542 const Scalar& compute_A(bool output_ylm = true, Param* par = 0x0) const ;
543
544 /** Gives the field \f$\tilde{B}\f$ (see member \c p_tilde_b ).
545 * @param output_ylm a flag to control the spectral decomposition
546 * base of the result: if true (default) the spherical harmonics base
547 * is used.
548 */
549 const Scalar& compute_tilde_B(bool output_ylm = true, Param* par = 0x0) const ;
550
551 /** Gives the field \f$\tilde{B}\f$ (see member \c p_tilde_b )
552 * associated with the TT-part of the \c Sym_tensor .
553 * @param output_ylm a flag to control the spectral decomposition
554 * base of the result: if true (default) the spherical harmonics base
555 * is used.
556 */
557 Scalar compute_tilde_B_tt(bool output_ylm = true, Param* par = 0x0) const ;
558
559 /** Gives the field \f$\tilde{C}\f$ (see member \c p_tilde_c ).
560 * @param output_ylm a flag to control the spectral decomposition
561 * base of the result: if true (default) the spherical harmonics base
562 * is used.
563 */
564 const Scalar& compute_tilde_C(bool output_ylm = true, Param* par = 0x0) const ;
565
566
567
568
569
570 protected:
571 /** Computes \f$\tilde{B}\f$ (see \c Sym_tensor::p_tilde_b ) from its
572 * transverse-traceless part and the trace.
573 */
574 Scalar get_tilde_B_from_TT_trace(const Scalar& tilde_B_tt_in, const Scalar&
575 trace) const ;
576
577 // Mathematical operators
578 // ----------------------
579 protected:
580 /**
581 * Returns a pointer on the inverse of the \c Sym_tensor
582 * (seen as a matrix).
583 */
584 Sym_tensor* inverse() const ;
585
586 // Friend classes
587 //-----------------
588 friend class Metric ;
589
590 } ;
591
592
593 //---------------------------------//
594 // class Sym_tensor_trans //
595 //---------------------------------//
596
597
598 /**
599 * Transverse symmetric tensors of rank 2. \ingroup (tensor)
600 *
601 * This class is designed to store transverse (divergence-free)
602 * symmetric contravariant tensors of rank 2,
603 * with the component expressed in an orthonormal spherical basis
604 * \f$(e_r,e_\theta,e_\varphi)\f$.
605 *
606 *
607 */
608 class Sym_tensor_trans: public Sym_tensor {
609
610 // Data :
611 // -----
612 protected:
613 /// Metric with respect to which the divergence and the trace are defined
614 const Metric* const met_div ;
615
616 /// Trace with respect to the metric \c *met_div
617 mutable Scalar* p_trace ;
618
619 /// Traceless part with respect to the metric \c *met_div
620 mutable Sym_tensor_tt* p_tt ;
621
622 // Constructors - Destructor
623 // -------------------------
624 public:
625 /** Standard constructor.
626 *
627 * @param map the mapping
628 * @param triad_i vectorial basis (triad) with respect to which
629 * the tensor components are defined
630 * @param met the metric with respect to which the divergence is defined
631 */
632 Sym_tensor_trans(const Map& map, const Base_vect& triad_i,
633 const Metric& met) ;
634
635 Sym_tensor_trans(const Sym_tensor_trans& ) ; ///< Copy constructor
636
637 /** Constructor from a file (see \c Tensor::sauve(FILE*) ).
638 *
639 * @param map the mapping
640 * @param triad_i vectorial basis (triad) with respect to which
641 * the tensor components are defined. It will
642 * be checked that it coincides with the basis
643 * saved in the file.
644 * @param met the metric with respect to which the divergence is defined
645 * @param fich file which has been used by
646 * the function \c sauve(FILE*) .
647 */
648 Sym_tensor_trans(const Map& map, const Base_vect& triad_i,
649 const Metric& met, FILE* fich) ;
650
651 virtual ~Sym_tensor_trans() ; ///< Destructor
652
653
654 // Memory management
655 // -----------------
656 protected:
657 virtual void del_deriv() const; ///< Deletes the derived quantities
658
659 /// Sets the pointers on derived quantities to 0x0
660 void set_der_0x0() const ;
661
662
663 // Accessors
664 // ---------
665 public:
666 /** Returns the metric with respect to which the divergence
667 * and the trace are defined.
668 */
669 const Metric& get_met_div() const {return *met_div ; } ;
670
671 // Mutators / assignment
672 // ---------------------
673
674 public:
675 /// Assignment to another \c Sym_tensor_trans
676 virtual void operator=(const Sym_tensor_trans& a) ;
677
678 /// Assignment to a \c Sym_tensor
679 virtual void operator=(const Sym_tensor& a) ;
680
681 /// Assignment to a \c Tensor_sym
682 virtual void operator=(const Tensor_sym& a) ;
683
684 /// Assignment to a \c Tensor
685 virtual void operator=(const Tensor& a) ;
686
687 /**
688 * Assigns the derived members \c p_tt and \c p_trace
689 * and updates the components accordingly.
690 * (see the documentation of these derived members for details)
691 */
692 void set_tt_trace(const Sym_tensor_tt& a, const Scalar& h,
693 Param* par = 0x0) ;
694
695 // Computational methods
696 // ---------------------
697 /// Returns the trace of the tensor with respect to metric \c *met_div
698 const Scalar& the_trace() const ;
699
700 /** Returns the transverse traceless part of the tensor,
701 * the trace being defined
702 * with respect to metric \c *met_div
703 */
704 const Sym_tensor_tt& tt_part(Param* par = 0x0) const ;
705
706 protected:
707 /** Solves a system of two coupled first-order PDEs obtained from
708 * the divergence-free condition (Dirac gauge) and the requirement that
709 * the potential \e A (see \c Sym_tensor::p_aaa ) has a given value.
710 * The system reads: \f{eqnarray*}
711 * \frac{\partial \tilde{\mu}}{\partial r} + \frac{3\tilde{\mu}}{r} + \left(
712 * \Delta_{\theta\varphi } + 2\right) X &=& 0;\\
713 * \frac{\partial X}{\partial r} - \frac{\tilde{\mu}}{r} &=& A. \f}
714 * Note that this is solved only for \f$\ell \geq 2\f$ and that
715 * \f$\tilde{\mu} = \mu / r\f$ (see \c Sym_tensor::p_mu ).
716 *
717 * @param aaa [input] the source \e A
718 * @param tilde_mu [output] the solution \f$\tilde{\mu}\f$
719 * @param xxx [output] the solution \e X
720 * @param par_bc [input] \c Param to control the boundary conditions
721 */
722 void sol_Dirac_A(const Scalar& aaa, Scalar& tilde_mu, Scalar& xxx,
723 const Param* par_bc = 0x0) const ;
724
725
726 /** Solves a system of three coupled first-order PDEs obtained from
727 * divergence-free conditions (Dirac gauge) and the requirement that
728 * the potential \f$\tilde{B}\f$ (see \c Sym_tensor::p_tilde_b ) has
729 * a given value. The system reads: \f{eqnarray*}
730 * \frac{\partial T^{rr}}{r} + \frac{3T^{rr}}{r} +\frac{1}{r}
731 * \Delta_{\theta\varphi } \tilde{\eta} &=& \frac{h}{r};\\
732 * \frac{\partial \tilde{\eta}}{\partial r} + \frac{3\tilde{\eta}}{r} -
733 * \frac{T^{rr}}{2r} + \left( \Delta_{\theta\varphi } + 2\right)
734 * \frac{W}{r} &=& -\frac{h}{2r};\\
735 * (\ell + 2) \frac{\partial W}{\partial r} + \ell(\ell + 2)
736 * \frac{W}{r} - \frac{2\tilde{\eta}}{r} + \frac{(\ell +2)T}{2r(\ell + 1)}
737 * + \frac{1}{2(\ell + 1)} \frac{\partial T}{\partial r} - \frac{T^{rr}}
738 * {(\ell + 1)r} &=& \tilde{B} - \frac{1}{2(\ell +1)} \frac{\partial h}
739 * {\partial r} - \frac{\ell +2}{\ell +1} \frac{h}{2r}.\f}
740 * Note that \f$\tilde{\eta} = \eta / r\f$ (for definitions, see derived
741 * members of \c Sym_tensor).
742 *
743 * @param tilde_b [input] the source \f$\tilde{B}\f$
744 * @param hh [input] the trace of the tensor
745 * @param hrr [output] the \e rr component of the result
746 * @param tilde_eta [output] the solution \f$\tilde{\eta}\f$
747 * @param www [output] the solution \e W
748 * @param par_bc [input] \c Param to control the boundary conditions
749 * @param par_mat [input/output] \c Param in which the operator matrix is
750 * stored.
751 */
752 void sol_Dirac_tilde_B(const Scalar& tilde_b, const Scalar& hh, Scalar& hrr,
753 Scalar& tilde_eta, Scalar& www, Param* par_bc=0x0,
754 Param* par_mat=0x0) const ;
755
756 /** Solves the same system as \c Sym_tensor_trans::sol_Dirac_tilde_B
757 * but only for \f$\ell=0,1\f$. In these particular cases, \e W =0
758 * the system is simpler and homogeneous solutions are different.
759 */
760 void sol_Dirac_l01(const Scalar& hh, Scalar& hrr, Scalar& tilde_eta,
761 Param* par_mat) const ;
762
763
764
765 public:
766
767
768
769 /** Same resolution as sol_Dirac_A, but with inner boundary conditions added.
770 *For now, only Robyn-type boundary conditions on \f$\frac {\mu} {r} \f$ can be imposed.
771 */
772
773
774 void sol_Dirac_Abound(const Scalar& aaa, Scalar& tilde_mu, Scalar& x_new,
775 Scalar bound_mu, const Param* par_bc);
776
777
778 /** Same resolution as sol_Dirac_Abound, but here the boundary conditions
779 * are the degenerate elliptic conditions encontered when solving the
780 * Kerr problem.
781 */
782
783
784 void sol_Dirac_A2(const Scalar& aaa, Scalar& tilde_mu, Scalar& x_new,
785 Scalar bound_mu, const Param* par_bc);
786
787 /** Same resolution as sol_Dirac_tilde_B, but with inner boundary conditions added.
788 * The difference is here, one has to put B and C values in (and not only \f$\tilde{B}\f$).
789 * For now, only Robyn-type boundary conditions on \f$ h^{rr} \f$ can be imposed.
790 */
791
792 void sol_Dirac_BC2(const Scalar& bb, const Scalar& cc, const Scalar& hh,
793 Scalar& hrr, Scalar& tilde_eta, Scalar& ww, Scalar bound_eta,double dir, double neum, double rhor, Param* par_bc, Param* par_mat);
794
795
796 /** Same resolution as sol_Dirac_Abound, but here the boundary conditions
797 * are the degenerate elliptic conditions encontered when solving the
798 * Kerr problem.
799 */
800
801 void sol_Dirac_BC3(const Scalar& bb, const Scalar& hh,
802 Scalar& hrr, Scalar& tilde_eta, Scalar& ww, Scalar bound_hrr, Scalar bound_eta, Param* par_bc, Param* par_mat);
803
804
805
806 // Solving the electric system for l=0 and l=1 only (simpler case), with boundary conditions imposed by the degenerate elliptic system.
807
808 void sol_Dirac_l01_bound(const Scalar& hh, Scalar& hrr, Scalar& tilde_eta, Scalar& bound_hrr, Scalar& bound_eta, Param* par_mat) ;
809
810 // Provisory: just for compilation, to be removed
811 void sol_Dirac_l01_2(const Scalar& hh, Scalar& hrr, Scalar& tilde_eta, Param* par_mat) ;
812
813
814 /** Finds spectral potentials A, B, C of solution of an tensorial TT elliptic equation,
815 * given the source.
816 **/
817
818 void sol_elliptic_ABC(Sym_tensor& source, Scalar aaa, Scalar bbb, Scalar ccc) ;
819
820
821
822 /** Assigns the derived member \c p_tt and computes the trace so that
823 * \c *this + the flat metric has a determinant equal to 1. It then
824 * updates the components accordingly, with a \c dzpuis = 2.
825 * This function makes an
826 * iteration until the relative difference in the trace between
827 * two steps is lower than \c precis .
828 *
829 * @param htt the transverse traceless part; all components must have
830 * dzpuis = 2.
831 * @param precis relative difference in the trace computation to end
832 * the iteration.
833 * @param it_max maximal number of iterations.
834 */
835 void trace_from_det_one(const Sym_tensor_tt& htt,
836 double precis = 1.e-14, int it_max = 100) ;
837
838 /** Assigns the \e rr component and the derived member \f$\mu\f$.
839 * Other derived members are deduced from the divergence-free
840 * condition. Finally, it computes \c T (\c Sym_tensor::p_ttt ) so that
841 * \c *this + the flat metric has a determinant equal to 1. It then
842 * updates the components accordingly. This function makes an
843 * iteration until the relative difference in \c T between
844 * two steps is lower than \c precis .
845 *
846 * @param hrr the \e rr component of the tensor,
847 * @param mu_in the \f$\mu\f$ potential,
848 * @param precis relative difference in the trace computation to end
849 * the iteration.
850 * @param it_max maximal number of iterations.
851 */
852 void set_hrr_mu_det_one(const Scalar& hrr, const Scalar& mu_in,
853 double precis = 1.e-14, int it_max = 100) ;
854
855 /** Assignes the TT-part of the tensor.
856 * The trace is deduced from the divergence-free condition, through the
857 * Dirac system on \f$ \tilde{B} \f$, so that
858 * \c *this + the flat metric has a determinant equal to 1. It then
859 * updates the components accordingly. This function makes an
860 * iteration until the relative difference in the trace between
861 * two steps is lower than \c precis .
862 * @param hijtt the TT part for \c this.
863 * @param h_prev a pointer on a guess for the trace of \c *this; if
864 * null, then the iteration starts from 0.
865 * @param precis relative difference in the trace computation to end
866 * the iteration.
867 * @param it_max maximal number of iterations.
868 */
869 void set_tt_part_det_one(const Sym_tensor_tt& hijtt, const
870 Scalar* h_prev = 0x0, Param* par_mat = 0x0,
871 double precis = 1.e-14, int it_max = 100) ;
872
873 /** Assigns the derived member \c A and computes \f$\tilde{B}\f$
874 * from its TT-part (see \c Sym_tensor::compute_tilde_B_tt() ).
875 * Other derived members are deduced from the divergence-free
876 * condition. Finally, it computes the trace so that
877 * \c *this + the flat metric has a determinant equal to 1. It then
878 * updates the components accordingly. This function makes an
879 * iteration until the relative difference in the trace between
880 * two steps is lower than \c precis .
881 *
882 * @param a_in the \c A potential (see \c Sym_tensor::p_aaa )
883 * @param tbtt_in the TT-part of \f$\tilde{B}\f$ potential
884 * (see \c Sym_tensor::p_tilde_b and \c Sym_tensor::compute_tilde_B_tt() )
885 * @param h_prev a pointer on a guess for the trace of \c *this; if
886 * null, then the iteration starts from 0.
887 * @param precis relative difference in the trace computation to end
888 * the iteration.
889 * @param it_max maximal number of iterations.
890 */
891 void set_AtBtt_det_one(const Scalar& a_in, const Scalar& tbtt_in,
892 const Scalar* h_prev = 0x0, Param* par_bc = 0x0,
893 Param* par_mat = 0x0, double precis = 1.e-14,
894 int it_max = 100) ;
895
896 /** Assigns the derived members \c A , \f$\tilde{B}\f$ and the trace.
897 * Other derived members are deduced from the divergence-free condition.
898 *
899 * @param a_in the \c A potential (see \c Sym_tensor::p_aaa )
900 * @param tb_in the \f$\tilde{B}\f$ potential (see \c Sym_tensor::p_tilde_b )
901 * @param trace the trace of the \c Sym_tensor.
902 */
903 void set_AtB_trace(const Scalar& a_in, const Scalar& tb_in, const
904 Scalar& trace, Param* par_bc = 0x0, Param* par_mat = 0x0) ;
905
906 /** Computes the solution of a tensorial transverse Poisson equation
907 * with \c *this \f$= S^{ij}\f$ as a source:
908 * \f[
909 * \Delta h^{ij} = S^{ij}.
910 *\f]
911 * In particular, it makes an iteration on the trace of the result, using
912 * \c Sym_tensor::set_WX_det_one.
913 *
914 * @param h_guess a pointer on a guess for the trace of the result; it is
915 * passed to \c Sym_tensor::set_WX_det_one.
916 * @return solution \f$h^{ij}\f$ of the above equation with the boundary
917 * condition \f$h^{ij}=0\f$ at spatial infinity.
918 */
919 Sym_tensor_trans poisson(const Scalar* h_guess = 0x0) const ;
920 } ;
921
922
923 //------------------------------//
924 // class Sym_tensor_tt //
925 //------------------------------//
926
927
928 /**
929 * Transverse and traceless symmetric tensors of rank 2.
930 *
931 * This class is designed to store transverse (divergence-free)
932 * and transverse symmetric contravariant tensors of rank 2,
933 * with the component expressed in an orthonormal spherical basis
934 * \f$(e_r,e_\theta,e_\varphi)\f$.\ingroup (tensor)
935 *
936 *
937 */
938 class Sym_tensor_tt: public Sym_tensor_trans {
939
940 // Data :
941 // -----
942
943 protected:
944 /** Field \f$\chi\f$ such that the component \f$h^{rr} = \frac{\chi}{r^2}\f$.
945 */
946 mutable Scalar* p_khi ;
947
948
949 // Constructors - Destructor
950 // -------------------------
951 public:
952 /** Standard constructor.
953 *
954 * @param map the mapping
955 * @param triad_i vectorial basis (triad) with respect to which
956 * the tensor components are defined
957 * @param met the metric with respect to which the divergence is defined
958 */
959 Sym_tensor_tt(const Map& map, const Base_vect& triad_i,
960 const Metric& met) ;
961
962 Sym_tensor_tt(const Sym_tensor_tt& ) ; ///< Copy constructor
963
964 /** Constructor from a file (see \c Tensor::sauve(FILE*) ).
965 *
966 * @param map the mapping
967 * @param triad_i vectorial basis (triad) with respect to which
968 * the tensor components are defined. It will
969 * be checked that it coincides with the basis
970 * saved in the file.
971 * @param met the metric with respect to which the divergence is defined
972 * @param fich file which has been used by
973 * the function \c sauve(FILE*) .
974 */
975 Sym_tensor_tt(const Map& map, const Base_vect& triad_i,
976 const Metric& met, FILE* fich) ;
977
978 virtual ~Sym_tensor_tt() ; ///< Destructor
979
980
981 // Memory management
982 // -----------------
983 protected:
984 virtual void del_deriv() const; ///< Deletes the derived quantities
985
986 /// Sets the pointers on derived quantities to 0x0
987 void set_der_0x0() const ;
988
989
990 // Mutators / assignment
991 // ---------------------
992
993 public:
994 /// Assignment to another \c Sym_tensor_tt
995 virtual void operator=(const Sym_tensor_tt& a) ;
996
997 /// Assignment to a \c Sym_tensor_trans
998 virtual void operator=(const Sym_tensor_trans& a) ;
999
1000 /// Assignment to a \c Sym_tensor
1001 virtual void operator=(const Sym_tensor& a) ;
1002
1003 /// Assignment to a \c Tensor_sym
1004 virtual void operator=(const Tensor_sym& a) ;
1005
1006 /// Assignment to a \c Tensor
1007 virtual void operator=(const Tensor& a) ;
1008
1009 /** Sets the component \f$h^{rr}\f$, as well as the angular potentials
1010 * \f$\eta\f$ and \f$\mu\f$ (see members
1011 * \c p_eta and \c p_mu ).
1012 * The other components are updated consistently
1013 * by a call to the method \c update() .
1014 *
1015 * @param hrr [input] value of \f$h^{rr}\f$
1016 * @param eta_i [input] angular potential \f$\eta\f$
1017 * @param mu_i [input] angular potential \f$\mu\f$
1018 *
1019 */
1020 void set_rr_eta_mu(const Scalar& hrr, const Scalar& eta_i,
1021 const Scalar& mu_i) ;
1022
1023 /** Sets the component \f$h^{rr}\f$, as well as the angular potential
1024 * \f$\mu\f$ (see member \c p_mu ).
1025 * The angular potential \f$\eta\f$ (member \c p_eta ) is deduced from
1026 * the divergence free condition.
1027 * The other tensor components are updated consistently
1028 * by a call to the method \c update() .
1029 *
1030 * @param hrr [input] value of \f$h^{rr}\f$
1031 * @param mu_i [input] angular potential \f$\mu\f$
1032 *
1033 */
1034 void set_rr_mu(const Scalar& hrr, const Scalar& mu_i) ;
1035
1036
1037 /** Sets the component \f$\chi\f$, as well as the angular potentials
1038 * \f$\eta\f$ and \f$\mu\f$ (see members \c p_khi ,
1039 * \c p_eta and \c p_mu ).
1040 * The components are updated consistently
1041 * by a call to the method \c update() .
1042 *
1043 * @param khi_i [input] value of \f$\chi\f$
1044 * @param eta_i [input] angular potential \f$\eta\f$
1045 * @param mu_i [input] angular potential \f$\mu\f$
1046 *
1047 */
1048 void set_khi_eta_mu(const Scalar& khi_i, const Scalar& eta_i,
1049 const Scalar& mu_i) ;
1050
1051 /** Sets the component \f$\chi\f$, as well as the angular potential
1052 * \f$\mu\f$ (see member \c p_khi and \c p_mu ).
1053 * The angular potential \f$\eta\f$ (member \c p_eta ) is deduced from
1054 * the divergence free condition.
1055 * The tensor components are updated consistently
1056 * by a call to the method \c update() .
1057 *
1058 * @param khi_i [input] value of \f$\chi\f$
1059 * @param mu_i [input] angular potential \f$\mu\f$
1060 * @param dzp [input] \c dzpuis parameter of the resulting
1061 * tensor components
1062 *
1063 */
1064 void set_khi_mu(const Scalar& khi_i, const Scalar& mu_i, int dzp = 0,
1065 Param* par1 = 0x0, Param* par2 = 0x0,
1066 Param* par3 = 0x0) ;
1067
1068 /** Assigns the derived members \c A and \f$\tilde{B}\f$.
1069 * Other derived members are deduced from the divergence-and trace-free
1070 * conditions.
1071 *
1072 * @param a_in the \c A potential (see \c Sym_tensor::p_aaa )
1073 * @param tb_in the \f$\tilde{B}\f$ potential (see \c Sym_tensor::p_tilde_b )
1074 */
1075 void set_A_tildeB(const Scalar& a_in, const Scalar& tb_in, Param* par_bc = 0x0,
1076 Param* par_mat = 0x0) ;
1077
1078 // Computational methods
1079 // ---------------------
1080
1081 public:
1082 /** Gives the field \f$\chi\f$ such that the component
1083 * \f$h^{rr} = \frac{\chi}{r^2}\f$.
1084 */
1085 const Scalar& khi() const ;
1086
1087 /// Gives the field \f$\eta\f$ (see member \c p_eta ).
1088 virtual const Scalar& eta(Param* par = 0x0) const ;
1089
1090 protected:
1091 /** Computes the components \f$h^{r\theta}\f$, \f$h^{r\varphi}\f$,
1092 * \f$h^{\theta\theta}\f$, \f$h^{\theta\varphi}\f$ and \f$h^{\varphi\varphi}\f$,
1093 * from \f$h^{rr}\f$ and the potentials \f$\eta\f$ and \f$\mu\f$.
1094 * @param dzp \c dzpuis parameter of the result, i.e. of the
1095 * components \f$ h^{ij} \f$.
1096 */
1097 void update(int dzp, Param* par1 = 0x0, Param* par2 = 0x0) ;
1098
1099 public:
1100 /** Computes the solution of a tensorial TT Poisson equation
1101 * with \c *this \f$= S^{ij}\f$ as a source:
1102 * \f[
1103 * \Delta h^{ij} = S^{ij}
1104 *\f]
1105 *
1106 * @param dzfin [input] the \c dzpuis for all the components of the result
1107 * (see the documentation for \c Scalar ).
1108 * @return solution \f$h^{ij}\f$ of the above equation with the boundary
1109 * condition \f$h^{ij}=0\f$ at spatial infinity.
1110 */
1111 Sym_tensor_tt poisson(int dzfin = 2) const ;
1112
1113
1114
1115 } ;
1116
1117
1118
1119
1120 }
1121 #endif