bhole_solve_phi.C

00001 /*
00002  *   Copyright (c) 2001 Philippe Grandclement
00003  *
00004  *   This file is part of LORENE.
00005  *
00006  *   LORENE is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   LORENE is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with LORENE; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 
00023 char bhole_solve_phi_C[] = "$Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_solve_phi.C,v 1.2 2002/10/16 14:36:33 j_novak Exp $" ;
00024 
00025 /*
00026  * $Id: bhole_solve_phi.C,v 1.2 2002/10/16 14:36:33 j_novak Exp $
00027  * $Log: bhole_solve_phi.C,v $
00028  * Revision 1.2  2002/10/16 14:36:33  j_novak
00029  * Reorganization of #include instructions of standard C++, in order to
00030  * use experimental version 3 of gcc.
00031  *
00032  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00033  * LORENE
00034  *
00035  * Revision 2.3  2001/04/26  12:06:44  phil
00036  * *** empty log message ***
00037  *
00038  * Revision 2.2  2001/04/06  08:56:49  phil
00039  * *** empty log message ***
00040  *
00041  * Revision 2.1  2001/04/05  13:42:46  phil
00042  * *** empty log message ***
00043  *
00044  * Revision 2.0  2001/04/05  13:35:14  phil
00045  * *** empty log message ***
00046  *
00047  *
00048  * $Header: /cvsroot/Lorene/C++/Source/Bhole_binaire/bhole_solve_phi.C,v 1.2 2002/10/16 14:36:33 j_novak Exp $
00049  *
00050  */
00051 
00052 
00053 
00054 //standard
00055 #include <stdlib.h>
00056 #include <math.h>
00057 
00058 // Lorene
00059 #include "nbr_spx.h"
00060 #include "tenseur.h"
00061 #include "bhole.h"
00062 #include "proto.h"
00063 #include "utilitaires.h"
00064 #include "graphique.h"
00065 
00066 
00067 
00068 void Bhole::init_bhole_phi () {
00069     
00070     Cmp auxi(mp) ;
00071     
00072     auxi = 1./2.-2*rayon/mp.r ;
00073     auxi.annule(0);
00074     auxi.set_dzpuis(0) ;
00075     n_auto = auxi;
00076     n_comp = 0 ; n_tot = 0;
00077     n_auto.set_std_base() ;
00078     n_auto.set().raccord(1) ;
00079     
00080     auxi = log (1+rayon/mp.r) ;
00081     auxi.annule(0);
00082     auxi.set_dzpuis(0) ;
00083     psi_auto = auxi;
00084     psi_comp = 0 ; psi_tot = 0;
00085     psi_auto.set_std_base() ;
00086     psi_auto.set().raccord(1) ;
00087     
00088     grad_n_tot = n_auto.gradient() ;
00089     grad_psi_tot = psi_auto.gradient() ;
00090     shift_auto.set_etat_zero() ;
00091 
00092     taij_auto.set_etat_zero();
00093     taij_comp.set_etat_zero();
00094     
00095     taij_tot.set_etat_zero() ;
00096     tkij_auto.set_etat_zero() ;
00097     tkij_tot.set_etat_zero();
00098     decouple.set_etat_zero() ;
00099 }
00100 
00101 void Bhole_binaire::solve_phi (double precision, double relax) {
00102     
00103     assert ((relax>0) && (relax<=1)) ;
00104     
00105     cout << "-----------------------------------------------" << endl ;
00106     cout << "Resolution PSI" << endl ;
00107     
00108     Tenseur psi_un_old (hole1.psi_auto) ;
00109     Tenseur psi_deux_old (hole2.psi_auto) ;
00110     
00111     // Les sources totales, raccordees dans les zec
00112     Cmp source_un (-flat_scalar_prod(hole1.grad_psi_tot, 
00113                 hole1.psi_auto.gradient())()) ;
00114     source_un.std_base_scal() ;
00115     
00116     Cmp source_deux (-flat_scalar_prod(hole2.grad_psi_tot, 
00117                 hole2.psi_auto.gradient())())  ;
00118     source_deux.std_base_scal() ;
00119     
00120     // Les valeurs limites :
00121     Valeur lim_un (hole1.mp.get_mg()->get_angu()) ;
00122     lim_un = -0.5/hole1.rayon ;
00123     lim_un.std_base_scal() ;
00124     
00125     Valeur lim_deux (hole2.mp.get_mg()->get_angu()) ;
00126     lim_deux = -0.5/hole2.rayon ;
00127     lim_deux.std_base_scal() ;
00128      
00129     //On resout
00130     neumann_binaire (source_un, source_deux, lim_un, lim_deux, 
00131     hole1.psi_auto.set(), hole2.psi_auto.set(), 0, precision) ;
00132      
00133     hole1.psi_auto.set().raccord(1) ;
00134     hole2.psi_auto.set().raccord(1) ;
00135      
00136     //On verifie qu on a bien resolu :
00137     cout << diffrelmax (source_un, hole1.psi_auto().laplacien(4)) << endl ;
00138     cout << diffrelmax (source_deux, hole2.psi_auto().laplacien(4)) << endl ;
00139   
00140     // La relaxation :
00141     hole1.psi_auto.set() = relax*hole1.psi_auto() + (1-relax)*psi_un_old() ;
00142     hole2.psi_auto.set() = relax*hole2.psi_auto() + (1-relax)*psi_deux_old() ;
00143     
00144     hole1.fait_psi_comp (hole2) ;
00145     hole2.fait_psi_comp (hole1) ;
00146 }
00147 
00148 void Bhole_binaire::init_phi() {
00149     set_omega (0) ;
00150     hole1.init_bhole_phi() ;
00151     hole2.init_bhole_phi() ;
00152     
00153     hole1.fait_psi_comp(hole2) ;
00154     hole2.fait_psi_comp(hole1) ;
00155 }
00156 
00157 

Generated on Tue Feb 7 01:35:14 2012 for LORENE by  doxygen 1.4.6