LORENE
star_rot_upmetr.C
1 /*
2  * Methods Star_rot::update_metric and Star_rot::extrinsic_curvature
3  *
4  * (see file star_rot.h for documentation)
5  *
6  */
7 
8 /*
9  * Copyright (c) 2010 Eric Gourgoulhon
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 as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
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 char star_rot_upmetr_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/star_rot_upmetr.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $" ;
31 
32 /*
33  * $Id: star_rot_upmetr.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $
34  * $Log: star_rot_upmetr.C,v $
35  * Revision 1.2 2014/10/13 08:53:39 j_novak
36  * Lorene classes and functions now belong to the namespace Lorene.
37  *
38  * Revision 1.1 2010/01/25 18:15:52 e_gourgoulhon
39  * First version.
40  *
41  *
42  * $Header: /cvsroot/Lorene/C++/Source/Star/star_rot_upmetr.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $
43  *
44  */
45 
46 // Headers Lorene
47 #include "star_rot.h"
48 
49 
50 namespace Lorene {
52 
53  // Lapse function N
54  // ----------------
55 
56  nn = exp( unsurc2 * logn ) ;
57 
58  nn.std_spectral_base() ; // set the bases for spectral expansions
59 
60 
61  // Metric factor A^2
62  // -----------------
63 
64  a_car = exp( 2*unsurc2*( dzeta - logn ) ) ;
65 
66  a_car.std_spectral_base() ; // set the bases for spectral expansions
67 
68  // Metric factor B
69  // ---------------
70 
71  Scalar tmp = tggg ;
72  tmp.div_rsint() ; //... Division of tG by r sin(theta)
73 
74  bbb = (1 + tmp) / nn ;
75 
76  bbb.std_spectral_base() ; // set the bases for spectral expansions
77 
78  b_car = bbb * bbb ;
79 
80  // Full 3-metric
81  // -------------
82 
83  Sym_tensor gam(mp, COV, mp.get_bvect_spher()) ;
84  gam.set(1,1) = a_car ;
85  gam.set(1,2) = 0 ;
86  gam.set(1,3) = 0 ;
87  gam.set(2,2) = a_car ;
88  gam.set(2,3) = 0 ;
89  gam.set(3,3) = b_car ;
90 
91  gamma = gam ;
92 
93  // Tensor B^{-2} K_{ij} and Scalar A^2 K_{ij} K^{ij}
94  // -------------------------------------------------
95 
97 
98 
99  // The derived quantities are no longer up to date :
100  // -----------------------------------------------
101 
102  del_deriv() ;
103 
104 }
105 
106 
107 /*************************************************************************************/
108 
109 
111 
112 
113  // ---------------------------------------
114  // Special treatment for axisymmetric case
115  // ---------------------------------------
116 
117  if ( (mp.get_mg())->get_np(0) == 1) {
118 
119  tkij.set_etat_zero() ; // initialisation
120 
121  // Computation of K_xy
122  // -------------------
123 
124  Scalar dnpdr = nphi.dsdr() ; // d/dr (N^phi)
125  Scalar dnpdt = nphi.srdsdt() ; // 1/r d/dtheta (N^phi)
126 
127  // What follows is valid only for a mapping of class Map_radial :
128  assert( dynamic_cast<const Map_radial*>(&mp) != 0x0 ) ;
129 
130  if (dnpdr.get_etat() == ETATQCQ) {
131  // multiplication by sin(theta)
132  dnpdr.set_spectral_va() = (dnpdr.get_spectral_va()).mult_st() ;
133  }
134 
135  if (dnpdt.get_etat() == ETATQCQ) {
136  // multiplication by cos(theta)
137  dnpdt.set_spectral_va() = (dnpdt.get_spectral_va()).mult_ct() ;
138  }
139 
140  Scalar tmp = dnpdr + dnpdt ;
141 
142  tmp.mult_rsint() ; // multiplication by r sin(theta)
143 
144  tkij.set(1,2) = - 0.5 * tmp / nn ; // component (x,y)
145 
146 
147  // Computation of K_yz
148  // -------------------
149 
150  dnpdr = nphi.dsdr() ; // d/dr (N^phi)
151  dnpdt = nphi.srdsdt() ; // 1/r d/dtheta (N^phi)
152 
153  if (dnpdr.get_etat() == ETATQCQ) {
154  // multiplication by cos(theta)
155  dnpdr.set_spectral_va() = (dnpdr.get_spectral_va()).mult_ct() ;
156  }
157 
158  if (dnpdt.get_etat() == ETATQCQ) {
159  // multiplication by sin(theta)
160  dnpdt.set_spectral_va() = (dnpdt.get_spectral_va()).mult_st() ;
161  }
162 
163  tmp = dnpdr - dnpdt ;
164 
165  tmp.mult_rsint() ; // multiplication by r sin(theta)
166 
167  tkij.set(2,3) = - 0.5 * tmp / nn ; // component (y,z)
168 
169  // The other components are set to zero
170  // ------------------------------------
171  tkij.set(1,1) = 0 ; // component (x,x)
172  tkij.set(1,3) = 0 ; // component (x,z)
173  tkij.set(2,2) = 0 ; // component (y,y)
174  tkij.set(3,3) = 0 ; // component (z,z)
175 
176  }
177  else {
178 
179  // ------------
180  // General case
181  // ------------
182 
183  // Gradient (Cartesian components) of the shift
184  // D_j N^i
185 
186  Tensor dn = - beta.derive_cov( mp.flat_met_cart() ) ;
187 
188  // Trace of D_j N^i = divergence of N^i :
189  Scalar divn = contract(dn, 0, 1) ;
190 
191  if (divn.get_etat() == ETATQCQ) {
192 
193  // Computation of B^{-2} K_{ij}
194  // ----------------------------
195  tkij.set_etat_qcq() ;
196  for (int i=1; i<=3; i++) {
197  for (int j=i; j<=3; j++) {
198  tkij.set(i, j) = dn(i, j) + dn(j, i) ;
199  }
200  tkij.set(i, i) -= double(2) /double(3) * divn ;
201  }
202 
203  tkij = - 0.5 * tkij / nn ;
204 
205  }
206  else{
207  assert( divn.get_etat() == ETATZERO ) ;
208  tkij.set_etat_zero() ;
209  }
210  }
211 
212  // Computation of A^2 K_{ij} K^{ij}
213  // --------------------------------
214 
215  ak_car = 0 ;
216 
217  for (int i=1; i<=3; i++) {
218  for (int j=1; j<=3; j++) {
219 
220  ak_car += tkij(i, j) * tkij(i, j) ;
221 
222  }
223  }
224 
225  ak_car = b_car * ak_car ;
226 
227 }
228 
229 }
Base class for pure radial mappings.
Definition: map.h:1536
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Definition: map.h:783
const Metric_flat & flat_met_cart() const
Returns the flat metric associated with the Cartesian coordinates and with components expressed in th...
Definition: map.C:331
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:387
const Scalar & srdsdt() const
Returns of *this .
Definition: scalar_deriv.C:145
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
Definition: scalar.C:784
const Scalar & dsdr() const
Returns of *this .
Definition: scalar_deriv.C:113
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition: scalar.h:554
void mult_rsint()
Multiplication by everywhere; dzpuis is not changed.
const Valeur & get_spectral_va() const
Returns va (read only version)
Definition: scalar.h:601
Valeur & set_spectral_va()
Returns va (read/write version)
Definition: scalar.h:604
void div_rsint()
Division by everywhere; dzpuis is not changed.
Sym_tensor tkij
Tensor related to the extrinsic curvature tensor by .
Definition: star_rot.h:167
Scalar tggg
Metric potential .
Definition: star_rot.h:137
double unsurc2
: unsurc2=1 for a relativistic star, 0 for a Newtonian one.
Definition: star_rot.h:99
void extrinsic_curvature()
Computes tkij and ak_car from shift , nnn and b_car .
Scalar b_car
Square of the metric factor B.
Definition: star_rot.h:110
Scalar bbb
Metric factor B.
Definition: star_rot.h:107
Scalar ak_car
Scalar .
Definition: star_rot.h:186
Scalar nphi
Metric coefficient .
Definition: star_rot.h:113
void update_metric()
Computes metric coefficients from known potentials.
Scalar dzeta
Metric potential .
Definition: star_rot.h:134
Scalar a_car
Square of the metric factor A.
Definition: star_rot.h:104
virtual void del_deriv() const
Deletes all the derived quantities.
Definition: star_rot.C:297
Scalar logn
Logarithm of the lapse N .
Definition: star.h:222
Scalar nn
Lapse function N .
Definition: star.h:225
Metric gamma
3-metric
Definition: star.h:235
Map & mp
Mapping associated with the star.
Definition: star.h:180
Vector beta
Shift vector.
Definition: star.h:228
Class intended to describe valence-2 symmetric tensors.
Definition: sym_tensor.h:223
Tensor handling.
Definition: tensor.h:288
Cmp exp(const Cmp &)
Exponential.
Definition: cmp_math.C:270
virtual void set_etat_qcq()
Sets the logical state of all components to ETATQCQ (ordinary state).
Definition: tensor.C:481
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Definition: tensor.C:1002
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
Definition: tensor.C:497
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Definition: tensor.C:654
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Lorene prototypes.
Definition: app_hor.h:64