LORENE
binaire_ana_shift.C
1 /*
2  * Method of class Binaire to set some analytical form to the shift vector.
3  *
4  * (see file binaire.h for documentation).
5  */
6 
7 /*
8  * Copyright (c) 2000-2001 Eric Gourgoulhon
9  * Copyright (c) 2000-2001 Keisuke Taniguchi
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: binaire_ana_shift.C,v 1.4 2016/12/05 16:17:47 j_novak Exp $
34  * $Log: binaire_ana_shift.C,v $
35  * Revision 1.4 2016/12/05 16:17:47 j_novak
36  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
37  *
38  * Revision 1.3 2014/10/13 08:52:44 j_novak
39  * Lorene classes and functions now belong to the namespace Lorene.
40  *
41  * Revision 1.2 2004/03/25 10:28:59 j_novak
42  * All LORENE's units are now defined in the namespace Unites (in file unites.h).
43  *
44  * Revision 1.1.1.1 2001/11/20 15:19:30 e_gourgoulhon
45  * LORENE
46  *
47  * Revision 2.3 2000/03/17 15:36:26 eric
48  * Suppression de l'appel a analytical_omega().
49  *
50  * Revision 2.2 2000/03/17 15:27:11 eric
51  * Appel de la fonction analytical_omega() pour fixer la valeur de omega.
52  *
53  * Revision 2.1 2000/03/16 09:37:28 eric
54  * Utilisation du cas incompressible plutot que n=1.
55  *
56  * Revision 2.0 2000/03/15 16:43:35 eric
57  * *** empty log message ***
58  *
59  *
60  * $Header: /cvsroot/Lorene/C++/Source/Binaire/binaire_ana_shift.C,v 1.4 2016/12/05 16:17:47 j_novak Exp $
61  *
62  */
63 
64 // Headers C
65 #include "math.h"
66 
67 // Headers Lorene
68 #include "binaire.h"
69 #include "unites.h"
70 
71 namespace Lorene {
73 
74  // Does nothing for a Newtonian star
75  // ---------------------------------
76  if ( !star1.is_relativistic() ){
77  assert( !star2.is_relativistic() ) ;
78  return ;
79  }
80 
81 
82  using namespace Unites ;
83 
84  for (int i=0; i<2; i++) {
85 
86  // Radius of the star:
87  double a0 = et[i]->ray_eq() ;
88 
89  // Mass ratio
90  double p_mass = et[i]->mass_g() / et[1-i]->mass_g() ;
91 
92  // G M Omega R / (1+p)
93  double www = ggrav * et[i]->mass_g() * omega
94  * separation() / (1. + p_mass) ;
95 
96  const Map& mp = et[i]->get_mp() ;
97  Cmp tmp(mp) ;
98  Cmp tmp_ext(mp) ;
99  int nzet = et[i]->get_nzet() ;
100  int nzm1 = mp.get_mg()->get_nzone() - 1 ;
101 
102  // Computation of w_shift
103  // ----------------------
104  et[i]->set_w_shift().set_etat_qcq() ;
105 
106  // X component
107  // -----------
108  et[i]->set_w_shift().set(0) = 0 ;
109 
110  // Y component
111  // -----------
112 
113 // For the incompressible case :
114  tmp = - 6 * www / a0 * ( 1 - (mp.r)*(mp.r) / (3*a0*a0) ) ;
115 
116 // For the compressible (n=1) case :
117 // Mtbl xi = M_PI * mp.r / a0 ;
118 // Mtbl sinc = sin(xi) / xi ;
119 // The value of sinc is set to 1 at the origin
120 // for (int k=0; k<mp.get_mg()->get_np(0); k++) {
121 // for (int j=0; j<mp.get_mg()->get_nt(0); j++) {
122 // sinc.set(0, k, j, 0) = 1 ;
123 // }
124 // }
125 // tmp = - 4 * www / a0 * ( 1 + sinc ) ;
126 
127  tmp.annule(nzet, nzm1) ;
128  tmp_ext = - 4 * www / mp.r ;
129  tmp_ext.annule(0, nzet-1) ;
130 
131  et[i]->set_w_shift().set(1) = tmp + tmp_ext ;
132 
133  // Z component
134  // -----------
135  et[i]->set_w_shift().set(2) = 0 ;
136 
137  // Sets the standard spectral bases for Cartesian components
138  et[i]->set_w_shift().set_std_base() ;
139 
140  // Computation of khi_shift
141  // ------------------------
142 
143  tmp = 2 * www / a0 * (mp.y) * ( 1 - 3 * (mp.r)*(mp.r) / (5*a0*a0) ) ;
144  tmp.annule(nzet, nzm1) ;
145  tmp_ext = 0.8 * www * a0*a0 * (mp.sint) * (mp.sinp)
146  / (mp.r * mp.r) ;
147  tmp_ext.annule(0, nzet-1) ;
148 
149  et[i]->set_khi_shift() = tmp + tmp_ext ;
150 
151  // Sets the standard spectral bases for a scalar field
152  et[i]->set_khi_shift().set_std_base() ;
153 
154  }
155 
156 }
157 }
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
const Map & get_mp() const
Returns the mapping.
Definition: etoile.h:662
Etoile_bin star1
First star of the system.
Definition: binaire.h:118
void annule(int l)
Sets the Cmp to zero in a given domain.
Definition: cmp.C:351
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Definition: tenseur.C:1186
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:783
double ray_eq() const
Coordinate radius at , [r_unit].
Base class for coordinate mappings.
Definition: map.h:688
int get_nzet() const
Returns the number of domains occupied by the star.
Definition: etoile.h:665
virtual double mass_g() const
Gravitational mass.
void analytical_shift()
Sets some analytical template for the shift vector (via the members { w_shift} and { khi_shift} of th...
Coord sint
Definition: map.h:739
Etoile_bin * et[2]
Array of the two stars (to perform loops on the stars): { et[0]} contains the address of { star1} and...
Definition: binaire.h:127
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:840
double omega
Angular velocity with respect to an asymptotically inertial observer.
Definition: binaire.h:132
double separation() const
Returns the coordinate separation of the two stellar centers [{ r_unit}].
Definition: binaire.C:460
Coord sinp
Definition: map.h:741
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
Tenseur & set_w_shift()
Read/write of w_shift.
Definition: etoile_bin.C:541
Coord y
y coordinate centered on the grid
Definition: map.h:745
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:652
Tenseur & set_khi_shift()
Read/write of khi_shift.
Definition: etoile_bin.C:548
bool is_relativistic() const
Returns true for a relativistic star, false for a Newtonian one.
Definition: etoile.h:670
Etoile_bin star2
Second star of the system.
Definition: binaire.h:121
Coord r
r coordinate centered on the grid
Definition: map.h:736