poisson_interne.C

00001 
00002 /*
00003  *   Copyright (c) 2004 Francois Limousin
00004  *
00005  *   This file is part of LORENE.
00006  *
00007  *   LORENE is free software; you can redistribute it and/or modify
00008  *   it under the terms of the GNU General Public License as published by
00009  *   the Free Software Foundation; either version 2 of the License, or
00010  *   (at your option) any later version.
00011  *
00012  *   LORENE is distributed in the hope that it will be useful,
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *   GNU General Public License for more details.
00016  *
00017  *   You should have received a copy of the GNU General Public License
00018  *   along with LORENE; if not, write to the Free Software
00019  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 
00024 char poisson_interne_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/poisson_interne.C,v 1.2 2004/11/23 12:51:42 f_limousin Exp $" ;
00025 
00026 /*
00027  * $Id: poisson_interne.C,v 1.2 2004/11/23 12:51:42 f_limousin Exp $
00028  * $Log: poisson_interne.C,v $
00029  * Revision 1.2  2004/11/23 12:51:42  f_limousin
00030  * Minor changes.
00031  *
00032  * Revision 1.1  2004/03/31 11:36:15  f_limousin
00033  * First version
00034  *
00035  *
00036  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/poisson_interne.C,v 1.2 2004/11/23 12:51:42 f_limousin Exp $
00037  *
00038  */
00039 
00040 
00041 // Header C : 
00042 #include <stdlib.h>
00043 #include <math.h>
00044 
00045 // Headers Lorene :
00046 #include "matrice.h"
00047 #include "tbl.h"
00048 #include "mtbl_cf.h"
00049 #include "map.h"
00050 #include "base_val.h"
00051 #include "proto.h"
00052 #include "type_parite.h"
00053 #include "utilitaires.h"
00054 
00055 
00056 
00057 
00058             //----------------------------------------------
00059        //       Version Mtbl_cf
00060       //----------------------------------------------
00061 
00062 Mtbl_cf sol_poisson_interne (const Map_af& mapping, 
00063     const Mtbl_cf& source, const Mtbl_cf& lim_der){
00064 
00065     int nz = source.get_mg()->get_nzone() ;
00066 
00067     assert(source.get_mg()->get_type_r(0) == RARE) ;
00068     assert (lim_der.get_mg() == source.get_mg()->get_angu()) ;
00069     assert (source.get_etat() != ETATNONDEF) ;
00070     assert (lim_der.get_etat() != ETATNONDEF) ;
00071      
00072     // Bases spectrales
00073     const Base_val& base = source.base ;
00074     
00075     // donnees sur la zone
00076     int nr = source.get_mg()->get_nr(0) ;
00077     int nt = source.get_mg()->get_nt(0) ;
00078     int np = source.get_mg()->get_np(0) ;;
00079     int base_r ;
00080     int l_quant, m_quant;
00081     
00082     double alpha = mapping.get_alpha()[0] ;
00083     double beta = mapping.get_beta()[0] ;
00084     double facteur ;
00085     
00086     //Rangement des valeurs intermediaires 
00087     Tbl *so ;
00088     Tbl *sol_hom ;
00089     Tbl *sol_part ;
00090     Matrice *operateur ;
00091     Matrice *nondege ;
00092     
00093     
00094     Mtbl_cf resultat(source.get_mg(), base) ;
00095     resultat.annule_hard() ;
00096     
00097     for (int k=0 ; k<np+1 ; k++)
00098     for (int j=0 ; j<nt ; j++) 
00099         if (nullite_plm(j, nt, k, np, base) == 1)
00100         {
00101         // calcul des nombres quantiques :
00102         donne_lm(nz, 0, j, k, base, m_quant, l_quant, base_r) ;
00103         
00104         // Construction de l'operateur
00105         operateur = new Matrice(laplacien_mat
00106                     (nr, l_quant, 0., 0, base_r)) ;
00107         
00108         (*operateur) = combinaison(*operateur, l_quant, 0.,0, base_r) ;
00109         
00110          // Operateur inversible
00111         nondege = new Matrice(prepa_nondege(*operateur, l_quant, 
00112                             0., 0, base_r)) ;  
00113         
00114         // Calcul DE LA SH
00115         sol_hom = new Tbl(solh(nr, l_quant, 0., base_r)) ;
00116         
00117         // Calcul de la SP
00118         so = new Tbl(nr) ;
00119         so->set_etat_qcq() ;
00120         for (int i=0 ; i<nr ; i++)
00121             so->set(i) = source(0, k, j, i) ;
00122         
00123         sol_part = new Tbl (solp(*operateur, *nondege, alpha,
00124                      beta, *so, 0, base_r)) ;
00125 
00126         //-------------------------------------------
00127         // On est parti pour imposer la boundary
00128         //-------------------------------------------    
00129 
00130         // Condition de raccord de type Neumann :
00131         double val_der_solp = 0 ;
00132         for (int i=0 ; i<nr ; i++)
00133             if (m_quant%2 == 0)
00134             val_der_solp += (2*i)*(2*i)*(*sol_part)(i)/alpha ;
00135             else
00136             val_der_solp += (2*i+1)*(2*i+1)*(*sol_part)(i)/alpha ;
00137 
00138         double val_der_solh = 0 ;
00139         for (int i=0 ; i<nr ; i++)
00140             if (m_quant%2 == 0)
00141             val_der_solh += (2*i)*(2*i)*(*sol_hom)(i)/alpha ;
00142             else
00143             val_der_solh += (2*i+1)*(2*i+1)*(*sol_hom)(i)/alpha ;
00144 
00145         if (l_quant != 0){
00146             assert (val_der_solh != 0) ;
00147 
00148             facteur = (lim_der(0, k, j, 0)-val_der_solp) /
00149             val_der_solh ;
00150             
00151             for (int i=0 ; i<nr ; i++)
00152             sol_part->set(i) += facteur*(*sol_hom)(i) ;
00153         }
00154         else {
00155             for (int i=0 ; i<nr ; i++)
00156             sol_part->set(i) = 0. ;
00157         }
00158             
00159 
00160         // solp contient le bon truc (normalement ...)
00161         for (int i=0 ; i<nr ; i++)
00162             resultat.set(0, k, j, i) = (*sol_part)(i) ;
00163         
00164         delete operateur ;
00165         delete nondege ;
00166         delete so ;
00167         delete sol_hom ;
00168         delete sol_part ;
00169         }
00170     
00171     return resultat ;
00172 }

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