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