| 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 { |
| 75 |
void Bhole::init_bhole_phi () { |
| 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; |
| 84 |
n_auto.set_std_base() ; |
| 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; |
| 92 |
psi_auto.set_std_base() ; |
| 93 |
psi_auto.set().raccord(1) ; |
| 94 |
|
| 95 |
grad_n_tot = n_auto.gradient() ; |
| 96 |
grad_psi_tot = psi_auto.gradient() ; |
| 97 |
shift_auto.set_etat_zero() ; |
| 98 |
|
| 99 |
taij_auto.set_etat_zero(); |
| 100 |
taij_comp.set_etat_zero(); |
| 101 |
|
| 102 |
taij_tot.set_etat_zero() ; |
| 103 |
tkij_auto.set_etat_zero() ; |
| 104 |
tkij_tot.set_etat_zero(); |
| 105 |
decouple.set_etat_zero() ; |
| 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 |
|
| 151 |
hole1.fait_psi_comp (hole2) ; |
| 152 |
hole2.fait_psi_comp (hole1) ; |
| 153 |
} |
| 154 |
|
| 155 |
void Bhole_binaire::init_phi() { |
| 156 |
set_omega (0) ; |
| 157 |
hole1.init_bhole_phi() ; |
| 158 |
hole2.init_bhole_phi() ; |
| 159 |
|
| 160 |
hole1.fait_psi_comp(hole2) ; |
| 161 |
hole2.fait_psi_comp(hole1) ; |
| 162 |
} |
| 163 |
|
| 164 |
|
| 165 |
} |