LORENE
single_bound.C
1 /*
2  * Method of class single_hor to compute boundary conditions
3  *
4  * (see file isol_hor.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2004 Jose Luis Jaramillo
10  * Francois Limousin
11  *
12  * This file is part of LORENE.
13  *
14  * LORENE is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2
16  * as published by the Free Software Foundation.
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  * $Id: single_bound.C,v 1.4 2016/12/05 16:17:56 j_novak Exp $
33  * $Log: single_bound.C,v $
34  * Revision 1.4 2016/12/05 16:17:56 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.3 2014/10/13 08:53:01 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.2 2014/10/06 15:13:11 j_novak
41  * Modified #include directives to use c++ syntax.
42  *
43  * Revision 1.1 2007/04/13 15:28:35 f_limousin
44  * Lots of improvements, generalisation to an arbitrary state of
45  * rotation, implementation of the spatial metric given by Samaya.
46  *
47  *
48  * $Header: /cvsroot/Lorene/C++/Source/Isol_hor/single_bound.C,v 1.4 2016/12/05 16:17:56 j_novak Exp $
49  *
50  */
51 
52 // C++ headers
53 #include "headcpp.h"
54 
55 // C headers
56 #include <cstdlib>
57 #include <cassert>
58 
59 // Lorene headers
60 #include "time_slice.h"
61 #include "isol_hor.h"
62 #include "metric.h"
63 #include "evolution.h"
64 #include "unites.h"
65 #include "graphique.h"
66 #include "utilitaires.h"
67 #include "param.h"
68 
69 
70 
71 namespace Lorene {
73 
74  Metric flat (mp.flat_met_spher()) ;
75  Vector temp (mp, CON, mp.get_bvect_spher()) ;
76  temp.set(1) = 1.;
77  temp.set(2) = 0.;
78  temp.set(3) = 0.;
79  temp.std_spectral_base() ;
80 
81  Scalar tmp = psi * psi * psi * trK
82  - contract(get_k_dd(),0, 1, tgam.radial_vect() * tgam.radial_vect(), 0, 1)
83  / psi
85  - 4 * ( tgam.radial_vect()(2) * psi.derive_cov(ff)(2)
86  + tgam.radial_vect()(3) * psi.derive_cov(ff)(3) ) ;
87 
88  tmp = tmp / (4 * tgam.radial_vect()(1)) ;
89 
90  // in this case you don't have to substract any value
91 
92  Valeur psi_bound (mp.get_mg()->get_angu() ) ;
93 
94  int nnp = mp.get_mg()->get_np(1) ;
95  int nnt = mp.get_mg()->get_nt(1) ;
96 
97  psi_bound = 1 ;
98 
99  for (int k=0 ; k<nnp ; k++)
100  for (int j=0 ; j<nnt ; j++)
101  psi_bound.set(0, k, j, 0) = tmp.val_grid_point(1, k, j, 0) ;
102 
103  psi_bound.std_base_scal() ;
104 
105  return psi_bound ;
106 
107 }
108 
109 const Valeur Single_hor::boundary_nn_Neu(double cc)const {
110 
111  double rho = 1. ; // 1 is the standart case;
112 
113  Scalar tmp = - cc * nn ;
114  // Scalar tmp = - nn()/psi()*psi().dsdr() ;
115 
116  // in this case you don't have to substract any value
117  tmp += (rho - 1) * tgam.radial_vect()(1) * dn(1) ;
118  tmp = tmp / (rho * tgam.radial_vect()(1)) ;
119 
120  int nnp = mp.get_mg()->get_np(1) ;
121  int nnt = mp.get_mg()->get_nt(1) ;
122 
123  Valeur nn_bound (mp.get_mg()->get_angu()) ;
124 
125  nn_bound = 1 ; // Juste pour affecter dans espace des configs ;
126 
127  for (int k=0 ; k<nnp ; k++)
128  for (int j=0 ; j<nnt ; j++)
129  nn_bound.set(0, k, j, 0) = tmp.val_grid_point(1, k, j, 0) ;
130 
131  nn_bound.std_base_scal() ;
132 
133  return nn_bound ;
134 
135 }
136 
137 
138 const Valeur Single_hor::boundary_nn_Dir(double cc)const {
139 
140  Scalar rho(mp);
141  rho = 0. ; // 0 is the standard case
142 
143  Scalar tmp(mp) ;
144  tmp = cc ;
145 
146 
147  //tmp = 1./(2*psi()) ;
148  // tmp = - psi() * nn().dsdr() / (psi().dsdr()) ;
149 
150  // We have substracted 1, since we solve for zero condition at infinity
151  //and then we add 1 to the solution
152 
153  tmp = (tmp + rho * nn)/(1 + rho) ;
154 
155  tmp = tmp - 1 ;
156 
157  int nnp = mp.get_mg()->get_np(1) ;
158  int nnt = mp.get_mg()->get_nt(1) ;
159 
160  Valeur nn_bound (mp.get_mg()->get_angu()) ;
161 
162  nn_bound = 1 ; // Juste pour affecter dans espace des configs ;
163 
164  for (int k=0 ; k<nnp ; k++)
165  for (int j=0 ; j<nnt ; j++)
166  nn_bound.set(0, k, j, 0) = tmp.val_grid_point(1, k, j, 0) ;
167 
168  nn_bound.std_base_scal() ;
169 
170  return nn_bound ;
171 
172 }
173 
174 // Component x of boundary value of beta
175 //--------------------------------------
176 
177 const Valeur Single_hor:: boundary_beta_x(double om_orb,
178  double om_loc)const {
179 
180  // Les alignemenents pour le signe des CL.
181  double orientation = mp.get_rot_phi() ;
182  assert ((orientation == 0) || (orientation == M_PI)) ;
183  int aligne = (orientation == 0) ? 1 : -1 ;
184 
185  int nnp = mp.get_mg()->get_np(1) ;
186  int nnt = mp.get_mg()->get_nt(1) ;
187 
188  Vector tmp_vect = nn * get_gam().radial_vect() ;
189  tmp_vect.change_triad(mp.get_bvect_cart() ) ;
190 
191  //Isol_hor boundary conditions
192 
193  Valeur lim_x (mp.get_mg()->get_angu()) ;
194 
195  lim_x = 1 ; // Juste pour affecter dans espace des configs ;
196 
197  Mtbl ya_mtbl (mp.get_mg()) ;
198  ya_mtbl.set_etat_qcq() ;
199  ya_mtbl = mp.ya ;
200 
201  Mtbl yy_mtbl (mp.get_mg()) ;
202  yy_mtbl.set_etat_qcq() ;
203  yy_mtbl = mp.y ;
204 
205  for (int k=0 ; k<nnp ; k++)
206  for (int j=0 ; j<nnt ; j++)
207  lim_x.set(0, k, j, 0) = aligne * om_orb * ya_mtbl(1, k, j, 0)
208  + (om_loc-om_orb)* yy_mtbl(1, k, j, 0)
209  + tmp_vect(1).val_grid_point(1, k, j, 0) ;
210 
211  lim_x.set_base(*(mp.get_mg()->std_base_vect_cart()[0])) ;
212 
213  return lim_x ;
214 }
215 
216 
217 // Component y of boundary value of beta
218 //--------------------------------------
219 
220 const Valeur Single_hor:: boundary_beta_y(double om_orb,
221  double om_loc)const {
222 
223  // Les alignemenents pour le signe des CL.
224  double orientation = mp.get_rot_phi() ;
225  assert ((orientation == 0) || (orientation == M_PI)) ;
226  int aligne = (orientation == 0) ? 1 : -1 ;
227 
228 
229  int nnp = mp.get_mg()->get_np(1) ;
230  int nnt = mp.get_mg()->get_nt(1) ;
231 
232  Vector tmp_vect = nn * get_gam().radial_vect() ;
233  tmp_vect.change_triad(mp.get_bvect_cart() ) ;
234 
235  //Isol_hor boundary conditions
236 
237  Valeur lim_y (mp.get_mg()->get_angu()) ;
238 
239  lim_y = 1 ; // Juste pour affecter dans espace des configs ;
240 
241  Mtbl xa_mtbl (mp.get_mg()) ;
242  xa_mtbl.set_etat_qcq() ;
243  xa_mtbl = mp.xa ;
244 
245  Mtbl xx_mtbl (mp.get_mg()) ;
246  xx_mtbl.set_etat_qcq() ;
247  xx_mtbl = mp.x ;
248 
249  for (int k=0 ; k<nnp ; k++)
250  for (int j=0 ; j<nnt ; j++)
251  lim_y.set(0, k, j, 0) = - aligne *om_orb * xa_mtbl(1, k, j, 0) -
252  (om_loc-om_orb)*xx_mtbl(1, k, j, 0)
253  + tmp_vect(2).val_grid_point(1, k, j, 0) ;
254 
255  lim_y.set_base(*(mp.get_mg()->std_base_vect_cart()[1])) ;
256 
257  return lim_y ;
258 }
259 
260 // Component z of boundary value of beta
261 //--------------------------------------
262 
263 const Valeur Single_hor:: boundary_beta_z()const {
264 
265  int nnp = mp.get_mg()->get_np(1) ;
266  int nnt = mp.get_mg()->get_nt(1) ;
267 
268  Vector tmp_vect = nn * get_gam().radial_vect() ;
269  tmp_vect.change_triad(mp.get_bvect_cart() ) ;
270 
271  //Isol_hor boundary conditions
272 
273  Valeur lim_z (mp.get_mg()->get_angu()) ;
274 
275  lim_z = 1 ; // Juste pour affecter dans espace des configs ;
276 
277  for (int k=0 ; k<nnp ; k++)
278  for (int j=0 ; j<nnt ; j++)
279  lim_z.set(0, k, j, 0) = tmp_vect(3).val_grid_point(1, k, j, 0) ;
280 
281  lim_z.set_base(*(mp.get_mg()->std_base_vect_cart()[2])) ;
282 
283  return lim_z ;
284 }
285 
286 }
Coord xa
Absolute x coordinate.
Definition: map.h:748
Base_val ** std_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a vector.
Metric for tensor calculation.
Definition: metric.h:90
const Metric & get_gam() const
metric
Definition: single_hor.C:342
Vector dn
Covariant derivative of the lapse with respect to the flat metric .
Definition: isol_hor.h:937
Metric tgam
3 metric tilde
Definition: isol_hor.h:977
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:479
const Sym_tensor & get_k_dd() const
k_dd
Definition: single_hor.C:351
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Definition: map.h:801
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
virtual const Vector & radial_vect() const
Returns the radial vector normal to a spherical slicing and pointing toward spatial infinity...
Definition: metric.C:365
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
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
virtual void change_triad(const Base_vect &)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
double get_rot_phi() const
Returns the angle between the x –axis and X –axis.
Definition: map.h:793
void set(const Map *mp, Mtbl *(*construct)(const Map *))
Semi-constructor from a mapping and a method.
Definition: coord.C:137
Tensor field of valence 1.
Definition: vector.h:188
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Definition: scalar.h:643
const Valeur boundary_psi_app_hor() const
Neumann boundary condition for.
Definition: single_bound.C:72
Scalar psi
Conformal factor .
Definition: isol_hor.h:930
Scalar trK
Trace of the extrinsic curvature.
Definition: isol_hor.h:989
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition: mg3d.C:604
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Definition: vector.C:387
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Coord ya
Absolute y coordinate.
Definition: map.h:749
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:809
Map_af & mp
Affine mapping.
Definition: isol_hor.h:900
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Definition: tensor.C:663
Coord y
y coordinate centered on the grid
Definition: map.h:745
Coord x
x coordinate centered on the grid
Definition: map.h:744
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
Scalar & set(int)
Read/write access to a component.
Definition: vector.C:302
Metric_flat ff
3 metric flat
Definition: isol_hor.h:980
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
Definition: scalar_deriv.C:390
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
Definition: map.C:324
Scalar nn
Lapse function .
Definition: isol_hor.h:921
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).
Definition: valeur.h:373