LORENE
binary_anashift_xcts.C
1 /*
2  * Method of class Binary_xcts to set some analytical form
3  * to the shift vector (see file binary_xcts.h for documentation).
4  */
5 
6 /*
7  * Copyright (c) 2010 Michal Bejger
8  *
9  * This file is part of LORENE.
10  *
11  * LORENE is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2
13  * as published by the Free Software Foundation.
14  *
15  * LORENE is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with LORENE; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */
25 
26 
27 
28 /*
29  * $Id: binary_anashift_xcts.C,v 1.4 2016/12/05 16:17:47 j_novak Exp $
30  * $Log: binary_anashift_xcts.C,v $
31  * Revision 1.4 2016/12/05 16:17:47 j_novak
32  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
33  *
34  * Revision 1.3 2014/10/13 08:52:45 j_novak
35  * Lorene classes and functions now belong to the namespace Lorene.
36  *
37  * Revision 1.2 2010/06/15 07:58:32 m_bejger
38  * Minor corrections
39  *
40  * Revision 1.1 2010/05/04 07:35:54 m_bejger
41  * Initial version
42  *
43  * $Header: /cvsroot/Lorene/C++/Source/Binary_xcts/binary_anashift_xcts.C,v 1.4 2016/12/05 16:17:47 j_novak Exp $
44  *
45  */
46 
47 // Headers C
48 #include "math.h"
49 
50 // Headers Lorene
51 #include "binary_xcts.h"
52 #include "tenseur.h"
53 #include "unites.h"
54 
55 namespace Lorene {
57 
58  using namespace Unites ;
59 
60  for (int i=0; i<2; i++) {
61 
62  // Radius of the star:
63  double a0 = et[i]->ray_eq() ;
64 
65  // Mass ratio
66  double p_mass = et[i]->mass_g() / et[1-i]->mass_g() ;
67 
68  // G M Omega R / (1 + mass_ratio)
69  double www = ggrav * et[i]->mass_g() * omega
70  * separation() / (1. + p_mass) ;
71 
72  const Map& mp = et[i]->get_mp() ;
73  Scalar tmp(mp) ;
74  Scalar tmp_ext(mp) ;
75  int nzet = et[i]->get_nzet() ;
76  int nzm1 = mp.get_mg()->get_nzone() - 1 ;
77 
78  Vector w_beta (mp, CON, mp.get_bvect_cart()) ;
79  Scalar khi_beta (mp) ;
80 
81  // Computation of w_beta
82  // ----------------------
83  // X component
84  // -----------
85 
86  w_beta.set(1) = 0 ;
87 
88  // Y component
89  // -----------
90 
91  // For the incompressible case :
92  tmp = - 6 * www / a0 * ( 1 - (mp.r)*(mp.r) / (3*a0*a0) ) ;
93 
94  tmp.annule(nzet, nzm1) ;
95  tmp_ext = - 4 * www / mp.r ;
96  tmp_ext.annule(0, nzet-1) ;
97 
98  w_beta.set(2) = tmp + tmp_ext ;
99 
100  // Z component
101  // -----------
102  w_beta.set(3) = 0 ;
103 
104  w_beta.std_spectral_base() ;
105 
106  // Computation of khi_beta
107  // ------------------------
108 
109  tmp = 2 * www / a0 * (mp.y) * ( 1 - 3 * (mp.r)*(mp.r) / (5*a0*a0) ) ;
110  tmp.annule(nzet, nzm1) ;
111  tmp_ext = 0.8 * www * a0*a0 * (mp.sint) * (mp.sinp)
112  / (mp.r * mp.r) ;
113  tmp_ext.annule(0, nzet-1) ;
114 
115  khi_beta = tmp + tmp_ext ;
116 
117  // Sets the standard spectral bases for a scalar field
118  khi_beta.std_spectral_base() ;
119 
120  // Computation of beta auto.
121  // --------------------------
122 
123  Tensor xdw_temp (w_beta.derive_con(et[i]->get_flat())) ;
124 
125  Tenseur x_d_w_temp (et[i]->get_mp(),2,CON,et[i]->get_mp().get_bvect_cart()) ;
126  x_d_w_temp.set_etat_qcq() ;
127 
128  for (int j=0; j<3; j++)
129  for (int k=0; k<3; k++)
130  x_d_w_temp.set(j,k) = xdw_temp(k+1, j+1) ;
131 
132  Tenseur x_d_w = skxk (x_d_w_temp) ;
133  x_d_w.dec_dzpuis() ;
134 
135  Vector xdw (et[i]->get_mp(), CON, et[i]->get_mp().get_bvect_cart()) ;
136  for (int j=0; j<3; j++)
137  xdw.set(j+1) = x_d_w(j) ;
138 
139  // See Eq (92) from Gourgoulhon et al.(2001) and with the new
140  // convention for shift = - N^i
141 
142  Vector d_khi = khi_beta.derive_con(et[i]->get_flat()) ;
143  d_khi.dec_dzpuis(2) ;
144 
145  et[i]->set_beta_auto() = - 7./8. * w_beta + 1./8. *
146  (d_khi + xdw) ;
147 
149 
150  }
151 
152 }
153 }
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Definition: scalar.C:397
Star_bin_xcts * et[2]
Array of the two stars (to perform loops on the stars): et[0] contains the address of star1 and et[1]...
Definition: binary_xcts.h:75
Lorene prototypes.
Definition: app_hor.h:67
Standard units of space, time and mass.
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
Base class for coordinate mappings.
Definition: map.h:682
double separation() const
Returns the coordinate separation of the two stellar centers [r_unit].
Definition: binary_xcts.C:437
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
const Map & get_mp() const
Returns the mapping.
Definition: star.h:355
Tensor field of valence 1.
Definition: vector.h:188
virtual void std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
Definition: vector.C:322
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
Definition: tensor.C:817
Vector & set_beta_auto()
Read/write of .
Coord sint
Definition: map.h:733
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:840
Tenseur skxk(const Tenseur &)
Contraction of the last index of (*this) with or , depending on the type of S .
const Metric & get_flat() const
Return the flat metric defined on the mapping (Spherical components with respect to the mapping of th...
Definition: star.h:1400
void analytical_shift()
Sets some analytical template for the shift vector (via the members w_shift and khi_shift of the two ...
virtual double mass_g() const
Gravitational mass.
Coord sinp
Definition: map.h:735
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
double omega
Angular velocity with respect to an asymptotically inertial observer.
Definition: binary_xcts.h:80
Tensor handling.
Definition: tensor.h:294
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 Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
Definition: map.h:803
void dec_dzpuis()
dzpuis -= 1 ;
Definition: tenseur.C:1120
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Definition: tensor.C:663
int get_nzet() const
Returns the number of domains occupied by the star.
Definition: star.h:358
Coord y
y coordinate centered on the grid
Definition: map.h:739
double ray_eq() const
Coordinate radius at , [r_unit].
Definition: star_global.C:111
Scalar & set(int)
Read/write access to a component.
Definition: vector.C:302
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:652
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
Coord r
r coordinate centered on the grid
Definition: map.h:730