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 char bhole_solve_phi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_solve_phi.C,v 1.4 2014/10/13 08:52:40 j_novak Exp $" ;
24 
25 /*
26  * $Id: bhole_solve_phi.C,v 1.4 2014/10/13 08:52:40 j_novak Exp $
27  * $Log: bhole_solve_phi.C,v $
28  * Revision 1.4 2014/10/13 08:52:40 j_novak
29  * Lorene classes and functions now belong to the namespace Lorene.
30  *
31  * Revision 1.3 2014/10/06 15:12:58 j_novak
32  * Modified #include directives to use c++ syntax.
33  *
34  * Revision 1.2 2002/10/16 14:36:33 j_novak
35  * Reorganization of #include instructions of standard C++, in order to
36  * use experimental version 3 of gcc.
37  *
38  * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
39  * LORENE
40  *
41  * Revision 2.3 2001/04/26 12:06:44 phil
42  * *** empty log message ***
43  *
44  * Revision 2.2 2001/04/06 08:56:49 phil
45  * *** empty log message ***
46  *
47  * Revision 2.1 2001/04/05 13:42:46 phil
48  * *** empty log message ***
49  *
50  * Revision 2.0 2001/04/05 13:35:14 phil
51  * *** empty log message ***
52  *
53  *
54  * $Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_solve_phi.C,v 1.4 2014/10/13 08:52:40 j_novak Exp $
55  *
56  */
57 
58 
59 
60 //standard
61 #include <cstdlib>
62 #include <cmath>
63 
64 // Lorene
65 #include "nbr_spx.h"
66 #include "tenseur.h"
67 #include "bhole.h"
68 #include "proto.h"
69 #include "utilitaires.h"
70 #include "graphique.h"
71 
72 
73 
74 namespace Lorene {
76 
77  Cmp auxi(mp) ;
78 
79  auxi = 1./2.-2*rayon/mp.r ;
80  auxi.annule(0);
81  auxi.set_dzpuis(0) ;
82  n_auto = auxi;
83  n_comp = 0 ; n_tot = 0;
85  n_auto.set().raccord(1) ;
86 
87  auxi = log (1+rayon/mp.r) ;
88  auxi.annule(0);
89  auxi.set_dzpuis(0) ;
90  psi_auto = auxi;
91  psi_comp = 0 ; psi_tot = 0;
93  psi_auto.set().raccord(1) ;
94 
98 
101 
106 }
107 
108 void Bhole_binaire::solve_phi (double precision, double relax) {
109 
110  assert ((relax>0) && (relax<=1)) ;
111 
112  cout << "-----------------------------------------------" << endl ;
113  cout << "Resolution PSI" << endl ;
114 
115  Tenseur psi_un_old (hole1.psi_auto) ;
116  Tenseur psi_deux_old (hole2.psi_auto) ;
117 
118  // Les sources totales, raccordees dans les zec
119  Cmp source_un (-flat_scalar_prod(hole1.grad_psi_tot,
120  hole1.psi_auto.gradient())()) ;
121  source_un.std_base_scal() ;
122 
123  Cmp source_deux (-flat_scalar_prod(hole2.grad_psi_tot,
124  hole2.psi_auto.gradient())()) ;
125  source_deux.std_base_scal() ;
126 
127  // Les valeurs limites :
128  Valeur lim_un (hole1.mp.get_mg()->get_angu()) ;
129  lim_un = -0.5/hole1.rayon ;
130  lim_un.std_base_scal() ;
131 
132  Valeur lim_deux (hole2.mp.get_mg()->get_angu()) ;
133  lim_deux = -0.5/hole2.rayon ;
134  lim_deux.std_base_scal() ;
135 
136  //On resout
137  neumann_binaire (source_un, source_deux, lim_un, lim_deux,
138  hole1.psi_auto.set(), hole2.psi_auto.set(), 0, precision) ;
139 
140  hole1.psi_auto.set().raccord(1) ;
141  hole2.psi_auto.set().raccord(1) ;
142 
143  //On verifie qu on a bien resolu :
144  cout << diffrelmax (source_un, hole1.psi_auto().laplacien(4)) << endl ;
145  cout << diffrelmax (source_deux, hole2.psi_auto().laplacien(4)) << endl ;
146 
147  // La relaxation :
148  hole1.psi_auto.set() = relax*hole1.psi_auto() + (1-relax)*psi_un_old() ;
149  hole2.psi_auto.set() = relax*hole2.psi_auto() + (1-relax)*psi_deux_old() ;
150 
153 }
154 
156  set_omega (0) ;
159 
162 }
163 
164 
165 }
Lorene::Bhole_binaire::init_phi
void init_phi()
Initiates the system for a resolution using the logarithm of .
Definition: bhole_solve_phi.C:155
Lorene::Bhole::taij_auto
Tenseur_sym taij_auto
Part of generated by the hole.
Definition: bhole.h:299
Lorene::Bhole::tkij_tot
Tenseur_sym tkij_tot
Total .
Definition: bhole.h:308
Lorene::Bhole::mp
Map_af & mp
Affine mapping.
Definition: bhole.h:273
Lorene::Bhole::grad_psi_tot
Tenseur grad_psi_tot
Total gradient of .
Definition: bhole.h:295
Lorene::Tenseur::set_etat_zero
void set_etat_zero()
Sets the logical state to ETATZERO (zero state).
Definition: tenseur.C:645
Lorene::Tenseur
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:301
Lorene::Valeur
Values and coefficients of a (real-value) function.
Definition: valeur.h:287
Lorene::Bhole::shift_auto
Tenseur shift_auto
Part of generated by the hole.
Definition: bhole.h:297
Lorene::Tenseur::set
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:824
Lorene::Bhole::rayon
double rayon
Radius of the horizon in LORENE's units.
Definition: bhole.h:274
Lorene::log
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:296
Lorene::Bhole::fait_psi_comp
void fait_psi_comp(const Bhole &comp)
Imports the part of due to the companion hole comp .
Definition: bhole.C:280
Lorene
Lorene prototypes.
Definition: app_hor.h:64
Lorene::Mg3d::get_angu
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
Definition: mg3d.C:473
Lorene::Bhole_binaire::hole2
Bhole hole2
Black hole two.
Definition: bhole.h:763
Lorene::Tenseur::gradient
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)
Definition: tenseur.C:1542
Lorene::Map::get_mg
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
Lorene::diffrelmax
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Definition: cmp_math.C:539
Lorene::Map::r
Coord r
r coordinate centered on the grid
Definition: map.h:718
Lorene::Bhole::n_comp
Tenseur n_comp
Part of N generated by the companion hole.
Definition: bhole.h:287
Lorene::Cmp::set_etat_zero
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: cmp.C:289
Lorene::Bhole::n_tot
Tenseur n_tot
Total N .
Definition: bhole.h:288
Lorene::Bhole_binaire::hole1
Bhole hole1
Black hole one.
Definition: bhole.h:762
Lorene::Cmp::annule
void annule(int l)
Sets the Cmp to zero in a given domain.
Definition: cmp.C:348
Lorene::Bhole_binaire::set_omega
void set_omega(double ome)
Sets the orbital velocity to ome.
Definition: bhole.h:791
Lorene::Bhole::psi_tot
Tenseur psi_tot
Total .
Definition: bhole.h:292
Lorene::Bhole_binaire::solve_phi
void solve_phi(double precision, double relax)
Solve the equation for the logarithm of .
Definition: bhole_solve_phi.C:108
Lorene::Bhole::init_bhole_phi
void init_bhole_phi()
Initiates the black hole for a resolution with .
Definition: bhole_solve_phi.C:75
Lorene::Bhole::n_auto
Tenseur n_auto
Part of N generated by the hole.
Definition: bhole.h:286
Lorene::Valeur::std_base_scal
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
Definition: valeur.C:824
Lorene::Cmp
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
Lorene::flat_scalar_prod
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...
Definition: tenseur_operateur.C:653
Lorene::Bhole::tkij_auto
Tenseur_sym tkij_auto
Auto .
Definition: bhole.h:307
Lorene::Bhole::decouple
Cmp decouple
Function used to construct the part of generated by the hole from the total .
Definition: bhole.h:318
Lorene::Bhole::taij_comp
Tenseur_sym taij_comp
Part of generated by the companion hole.
Definition: bhole.h:300
Lorene::Bhole::psi_auto
Tenseur psi_auto
Part of generated by the hole.
Definition: bhole.h:290
Lorene::Cmp::raccord
void raccord(int n)
Performs the matching of the nucleus with respect to the first shell.
Definition: cmp_raccord.C:170
Lorene::Bhole::psi_comp
Tenseur psi_comp
Part of generated by the companion hole.
Definition: bhole.h:291
Lorene::Bhole::taij_tot
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
Lorene::Cmp::std_base_scal
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Definition: cmp.C:644
Lorene::Cmp::set_dzpuis
void set_dzpuis(int)
Set a value to dzpuis.
Definition: cmp.C:654
Lorene::Tenseur::set_std_base
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Definition: tenseur.C:1170
Lorene::Bhole::grad_n_tot
Tenseur grad_n_tot
Total gradient of N .
Definition: bhole.h:294