LORENE
bhole_solve_phi.C
1 /*
2  * Copyright (c) 2001 Philippe Grandclement
3  *
4  * This file is part of LORENE.
5  *
6  * LORENE is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * LORENE is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with LORENE; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 
23 
24 
25 /*
26  * $Id: bhole_solve_phi.C,v 1.5 2016/12/05 16:17:45 j_novak Exp $
27  * $Log: bhole_solve_phi.C,v $
28  * Revision 1.5 2016/12/05 16:17:45 j_novak
29  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
30  *
31  * Revision 1.4 2014/10/13 08:52:40 j_novak
32  * Lorene classes and functions now belong to the namespace Lorene.
33  *
34  * Revision 1.3 2014/10/06 15:12:58 j_novak
35  * Modified #include directives to use c++ syntax.
36  *
37  * Revision 1.2 2002/10/16 14:36:33 j_novak
38  * Reorganization of #include instructions of standard C++, in order to
39  * use experimental version 3 of gcc.
40  *
41  * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
42  * LORENE
43  *
44  * Revision 2.3 2001/04/26 12:06:44 phil
45  * *** empty log message ***
46  *
47  * Revision 2.2 2001/04/06 08:56:49 phil
48  * *** empty log message ***
49  *
50  * Revision 2.1 2001/04/05 13:42:46 phil
51  * *** empty log message ***
52  *
53  * Revision 2.0 2001/04/05 13:35:14 phil
54  * *** empty log message ***
55  *
56  *
57  * $Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_solve_phi.C,v 1.5 2016/12/05 16:17:45 j_novak Exp $
58  *
59  */
60 
61 
62 
63 //standard
64 #include <cstdlib>
65 #include <cmath>
66 
67 // Lorene
68 #include "nbr_spx.h"
69 #include "tenseur.h"
70 #include "bhole.h"
71 #include "proto.h"
72 #include "utilitaires.h"
73 #include "graphique.h"
74 
75 
76 
77 namespace Lorene {
79 
80  Cmp auxi(mp) ;
81 
82  auxi = 1./2.-2*rayon/mp.r ;
83  auxi.annule(0);
84  auxi.set_dzpuis(0) ;
85  n_auto = auxi;
86  n_comp = 0 ; n_tot = 0;
88  n_auto.set().raccord(1) ;
89 
90  auxi = log (1+rayon/mp.r) ;
91  auxi.annule(0);
92  auxi.set_dzpuis(0) ;
93  psi_auto = auxi;
94  psi_comp = 0 ; psi_tot = 0;
96  psi_auto.set().raccord(1) ;
97 
101 
104 
109 }
110 
111 void Bhole_binaire::solve_phi (double precision, double relax) {
112 
113  assert ((relax>0) && (relax<=1)) ;
114 
115  cout << "-----------------------------------------------" << endl ;
116  cout << "Resolution PSI" << endl ;
117 
118  Tenseur psi_un_old (hole1.psi_auto) ;
119  Tenseur psi_deux_old (hole2.psi_auto) ;
120 
121  // Les sources totales, raccordees dans les zec
122  Cmp source_un (-flat_scalar_prod(hole1.grad_psi_tot,
123  hole1.psi_auto.gradient())()) ;
124  source_un.std_base_scal() ;
125 
126  Cmp source_deux (-flat_scalar_prod(hole2.grad_psi_tot,
127  hole2.psi_auto.gradient())()) ;
128  source_deux.std_base_scal() ;
129 
130  // Les valeurs limites :
131  Valeur lim_un (hole1.mp.get_mg()->get_angu()) ;
132  lim_un = -0.5/hole1.rayon ;
133  lim_un.std_base_scal() ;
134 
135  Valeur lim_deux (hole2.mp.get_mg()->get_angu()) ;
136  lim_deux = -0.5/hole2.rayon ;
137  lim_deux.std_base_scal() ;
138 
139  //On resout
140  neumann_binaire (source_un, source_deux, lim_un, lim_deux,
141  hole1.psi_auto.set(), hole2.psi_auto.set(), 0, precision) ;
142 
143  hole1.psi_auto.set().raccord(1) ;
144  hole2.psi_auto.set().raccord(1) ;
145 
146  //On verifie qu on a bien resolu :
147  cout << diffrelmax (source_un, hole1.psi_auto().laplacien(4)) << endl ;
148  cout << diffrelmax (source_deux, hole2.psi_auto().laplacien(4)) << endl ;
149 
150  // La relaxation :
151  hole1.psi_auto.set() = relax*hole1.psi_auto() + (1-relax)*psi_un_old() ;
152  hole2.psi_auto.set() = relax*hole2.psi_auto() + (1-relax)*psi_deux_old() ;
153 
156 }
157 
159  set_omega (0) ;
162 
165 }
166 
167 
168 }
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:299
void solve_phi(double precision, double relax)
Solve the equation for the logarithm of .
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
Tenseur n_tot
Total N .
Definition: bhole.h:288
Tenseur grad_n_tot
Total gradient of N .
Definition: bhole.h:294
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
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:777
Tenseur flat_scalar_prod(const Tenseur &t1, const Tenseur &t2)
Scalar product of two Tenseur when the metric is : performs the contraction of the last index of t1 w...
Tenseur psi_auto
Part of generated by the hole.
Definition: bhole.h:290
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
Tenseur n_comp
Part of N generated by the companion hole.
Definition: bhole.h:287
Tenseur_sym taij_tot
Total , which must be zero on the horizon of the regularisation on the shift has been done...
Definition: bhole.h:305
Tenseur_sym taij_auto
Part of generated by the hole.
Definition: bhole.h:299
Tenseur shift_auto
Part of generated by the hole.
Definition: bhole.h:297
Tenseur_sym taij_comp
Part of generated by the companion hole.
Definition: bhole.h:300
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: cmp.C:292
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:840
Tenseur psi_comp
Part of generated by the companion hole.
Definition: bhole.h:291
void init_bhole_phi()
Initiates the black hole for a resolution with .
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition: mg3d.C:604
Map_af & mp
Affine mapping.
Definition: bhole.h:273
Bhole hole1
Black hole one.
Definition: bhole.h:762
void init_phi()
Initiates the system for a resolution using the logarithm of .
double rayon
Radius of the horizon in LORENE&#39;s units.
Definition: bhole.h:274
Tenseur_sym tkij_auto
Auto .
Definition: bhole.h:307
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Definition: cmp.C:647
Tenseur_sym tkij_tot
Total .
Definition: bhole.h:308
Tenseur grad_psi_tot
Total gradient of .
Definition: bhole.h:295
void set_omega(double ome)
Sets the orbital velocity to ome.
Definition: bhole.h:791
Cmp decouple
Function used to construct the part of generated by the hole from the total .
Definition: bhole.h:318
void raccord(int n)
Performs the matching of the nucleus with respect to the first shell.
Definition: cmp_raccord.C:173
Tenseur psi_tot
Total .
Definition: bhole.h:292
void set_dzpuis(int)
Set a value to dzpuis.
Definition: cmp.C:657
Tenseur n_auto
Part of N generated by the hole.
Definition: bhole.h:286
void fait_psi_comp(const Bhole &comp)
Imports the part of due to the companion hole comp .
Definition: bhole.C:283
void set_etat_zero()
Sets the logical state to ETATZERO (zero state).
Definition: tenseur.C:661
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Definition: cmp_math.C:542
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)
Definition: tenseur.C:1558
Coord r
r coordinate centered on the grid
Definition: map.h:730
Bhole hole2
Black hole two.
Definition: bhole.h:763