Debian Codegraph @

C++/Source/Bin_ns_ncp/bin_ns_ncp_anashift.C

raw
1 /*
2 * Method of class Bin_ns_ncp to set some analytical form to the shift vector.
3 *
4 * (see file bin_ns_ncp.h for documentation).
5 */
6
7 /*
8 * Copyright (c) 2003 Francois Limousin
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 as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29 char bin_ns_ncp_anashift_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bin_ns_ncp/bin_ns_ncp_anashift.C,v 1.3 2014/10/13 08:52:43 j_novak Exp $" ;
30
31 /*
32 * $Header: /cvsroot/Lorene/C++/Source/Bin_ns_ncp/bin_ns_ncp_anashift.C,v 1.3 2014/10/13 08:52:43 j_novak Exp $
33 *
34 */
35
36 // Headers C
37 #include "math.h"
38
39 // Headers Lorene
40 #include "bin_ns_ncp.h"
41 #include "unites.h"
42
43 namespace Lorene {
44 void Bin_ns_ncp::analytical_shift(){
45
46 using namespace Unites ;
47
48 // Does nothing for a Newtonian star
49 // ---------------------------------
50 if ( !star1.is_relativistic() ){
51 assert( !star2.is_relativistic() ) ;
52 return ;
53 }
54
55 for (int i=0; i<2; i++) {
56
57 // Radius of the star:
58 double a0 = et[i]->ray_eq() ;
59
60 // Mass ratio
61 double p_mass = et[i]->mass_g() / et[1-i]->mass_g() ;
62
63 // G M Omega R / (1+p)
64 double www = ggrav * et[i]->mass_g() * omega
65 * separation() / (1. + p_mass) ;
66
67 const Map& mp = et[i]->get_mp() ;
68 Cmp tmp(mp) ;
69 Cmp tmp_ext(mp) ;
70 int nzet = et[i]->get_nzet() ;
71 int nzm1 = mp.get_mg()->get_nzone() - 1 ;
72
73 // Computation of w_shift
74 // ----------------------
75 et[i]->set_w_shift().set_etat_qcq() ;
76
77 // X component
78 // -----------
79 et[i]->set_w_shift().set(0) = 0 ;
80
81 // Y component
82 // -----------
83
84 // For the incompressible case :
85 tmp = - 6 * www / a0 * ( 1 - (mp.r)*(mp.r) / (3*a0*a0) ) ;
86
87 // For the compressible (n=1) case :
88 // Mtbl xi = M_PI * mp.r / a0 ;
89 // Mtbl sinc = sin(xi) / xi ;
90 // The value of sinc is set to 1 at the origin
91 // for (int k=0; k<mp.get_mg()->get_np(0); k++) {
92 // for (int j=0; j<mp.get_mg()->get_nt(0); j++) {
93 // sinc.set(0, k, j, 0) = 1 ;
94 // }
95 // }
96 // tmp = - 4 * www / a0 * ( 1 + sinc ) ;
97
98 tmp.annule(nzet, nzm1) ;
99 tmp_ext = - 4 * www / mp.r ;
100 tmp_ext.annule(0, nzet-1) ;
101
102 et[i]->set_w_shift().set(1) = tmp + tmp_ext ;
103
104 // Z component
105 // -----------
106 et[i]->set_w_shift().set(2) = 0 ;
107
108 // Sets the standard spectral bases for Cartesian components
109 et[i]->set_w_shift().set_std_base() ;
110
111 // Computation of khi_shift
112 // ------------------------
113
114 tmp = 2 * www / a0 * (mp.y) * ( 1 - 3 * (mp.r)*(mp.r) / (5*a0*a0) ) ;
115 tmp.annule(nzet, nzm1) ;
116 tmp_ext = 0.8 * www * a0*a0 * (mp.sint) * (mp.sinp)
117 / (mp.r * mp.r) ;
118 tmp_ext.annule(0, nzet-1) ;
119
120 et[i]->set_khi_shift() = tmp + tmp_ext ;
121
122 // Sets the standard spectral bases for a scalar field
123 et[i]->set_khi_shift().set_std_base() ;
124
125 }
126
127 }
128 }