vector_divfree_A_tau.C

00001 /*
00002  *   Copyright (c) 2005 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 vector_divfree_A_tau[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_divfree_A_tau.C,v 1.1 2008/08/27 09:01:27 jl_cornou Exp $" ;
00024 
00025 /*
00026  * $Id: vector_divfree_A_tau.C,v 1.1 2008/08/27 09:01:27 jl_cornou Exp $
00027  * $Log: vector_divfree_A_tau.C,v $
00028  * Revision 1.1  2008/08/27 09:01:27  jl_cornou
00029  * Methods for solving Dirac systems for divergence free vectors
00030  *
00031  * Revision 1.6  2007/12/14 10:19:34  jl_cornou
00032  * *** empty log message ***
00033  *
00034  * Revision 1.4  2005/11/24 14:07:54  j_novak
00035  * Use of Matrice::annule_hard()
00036  *
00037  * Revision 1.3  2005/08/26 14:02:41  p_grandclement
00038  * Modification of the elliptic solver that matches with an oscillatory exterior solution
00039  * small correction in Poisson tau also...
00040  *
00041  * Revision 1.2  2005/08/25 12:16:01  p_grandclement
00042  * *** empty log message ***
00043  *
00044  * 
00045  * $Header: /cvsroot/Lorene/C++/Source/Tensor/vector_divfree_A_tau.C,v 1.1 2008/08/27 09:01:27 jl_cornou Exp $
00046  *
00047  */
00048 
00049 // C headers
00050 #include <assert.h>
00051 #include <math.h>
00052 
00053 // Lorene headers
00054 #include "tensor.h"
00055 #include "diff.h"
00056 #include "proto.h"
00057 #include "param.h"
00058 
00059 // Header C : 
00060 #include <stdlib.h>
00061 #include <math.h>
00062 
00063 // Headers Lorene :
00064 #include "matrice.h"
00065 #include "map.h"
00066 #include "proto.h"
00067 #include "type_parite.h"
00068 
00069 
00070 void Vector_divfree::sol_Dirac_A_tau(const Scalar& aaa, Scalar& eta_tilde, Scalar& vr, const Param* par_bc) const {
00071 
00072     const Map_af* mp_aff = dynamic_cast<const Map_af*>(mp) ;
00073     assert(mp_aff != 0x0) ; // Only affine mapping for the moment
00074 
00075     const Mg3d& mgrid = *mp_aff->get_mg();
00076     assert((mgrid.get_type_r(0) == RARE) || (mgrid.get_type_r(0) == FINJAC));
00077     if (aaa.get_etat() == ETATZERO) {
00078         eta_tilde = 0;
00079         vr = 0 ;
00080         return ;
00081     }
00082     assert(aaa.get_etat() != ETATNONDEF) ;
00083     int nz = mgrid.get_nzone();
00084     int nzm1 = nz - 1 ;
00085     bool ced = (mgrid.get_type_r(nzm1) == UNSURR) ;
00086     int n_shell = ced ? nz-2 : nzm1 ;
00087     int nz_bc = nzm1 ;
00088     if (par_bc != 0x0)
00089         if (par_bc->get_n_int() > 0) nz_bc = par_bc->get_int();
00090     n_shell = (nz_bc < n_shell ? nz_bc : n_shell) ;
00091     //bool cedbc (ced && (nz_bc == nzm1));
00092     
00093 //#ifndef NDEBUG
00094 //      if (!cedbc) {
00095 //      assert(par_bc != 0x0) ;
00096 //      assert(par_bc->get_n_tbl_mod() >= 3) ;
00097 //      }
00098 //#endif
00099     int nt = mgrid.get_nt(0) ;
00100         int np = mgrid.get_np(0) ;
00101     int nr ;    
00102 
00103     Scalar source = aaa ;
00104     Scalar source_coq = aaa ;
00105     source_coq.annule_domain(0);
00106     
00107     int dzpuis = source.get_dzpuis();
00108 
00109     if (ced) source_coq.annule_domain(nzm1) ;
00110         source_coq.mult_r() ;
00111         source.set_spectral_va().ylm() ;
00112         source_coq.set_spectral_va().ylm() ;
00113         Base_val base = source.get_spectral_base() ;
00114         base.mult_x() ;
00115 
00116     eta_tilde.annule_hard() ;
00117         eta_tilde.set_spectral_base(base) ;
00118         eta_tilde.set_spectral_va().set_etat_cf_qcq() ;
00119         eta_tilde.set_spectral_va().c_cf->annule_hard() ;
00120         vr.annule_hard() ;
00121         vr.set_spectral_base(base) ;
00122         vr.set_spectral_va().set_etat_cf_qcq() ;
00123         vr.set_spectral_va().c_cf->annule_hard() ;   
00124     Mtbl_cf& meta = *eta_tilde.set_spectral_va().c_cf ;
00125     Mtbl_cf& mvr = *vr.set_spectral_va().c_cf ; 
00126 
00127 
00128     int base_r ;
00129 
00130 
00131         // Determination of the size of the systeme :
00132         int size = 0 ;
00133         int max_nr = 0 ;
00134         for (int l=0 ; l<nz ; l++) { 
00135             nr = mgrid.get_nr(l) ;
00136             size += 2*nr ;
00137         if (nr > max_nr)
00138             max_nr = nr ;
00139         }
00140 
00141     Matrice systeme (size, size) ;
00142         systeme.set_etat_qcq() ;
00143         Tbl sec_membre (size) ;
00144    
00145         np = mgrid.get_np(0) ;
00146         nt = mgrid.get_nt(0) ;
00147         
00148     
00149     double alpha, beta, echelle ; 
00150     int l_quant, m_quant ;    
00151 
00152         // On bosse pour chaque l, m :
00153         for (int k=0 ; k<np+1 ; k++)
00154             for (int j=0 ; j<nt ; j++)
00155                 if (nullite_plm(j, nt, k, np, base) == 1) {
00156 
00157     systeme.annule_hard() ;
00158     sec_membre.annule_hard() ;
00159          
00160     int column_courant = 0 ;
00161     int ligne_courant = 0 ;
00162         
00163             //--------------------------
00164         //       NUCLEUS
00165         //--------------------------
00166         
00167     nr = mgrid.get_nr(0) ; 
00168     alpha = (*mp_aff).get_alpha()[0] ;
00169         base.give_quant_numbers (0, k, j, m_quant, l_quant, base_r) ;
00170     Diff_dsdx odn(base_r, nr) ; const Matrice& mdn = odn.get_matrice() ;
00171     Diff_sx osn(base_r, nr) ; const Matrice& msn = osn.get_matrice() ;  
00172         
00173     
00174 
00175     int nbr_cl = 0 ;
00176     // RARE case    
00177     if (source.get_mp().get_mg()->get_type_r(0) == RARE) {
00178     // regularity conditions for eta :
00179     if (l_quant > 1) {
00180          nbr_cl = 1 ;
00181          if (l_quant%2==0) {
00182             //Even case
00183         for (int col=0 ; col<nr ; col++) {
00184             if (col%2==0) {
00185                 systeme.set(ligne_courant, col+column_courant) = 1 ;
00186             systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00187             else  {
00188                 systeme.set(ligne_courant, col+column_courant) = -1 ;
00189             systeme.set(ligne_courant, col+column_courant+nr) = 0 ; } 
00190         }
00191         }
00192         else {
00193          //Odd case
00194              for (int col=0 ; col<nr ; col++) {
00195             if (col%2==0) {
00196                 systeme.set(ligne_courant, col+column_courant) = 2*col+1 ;
00197             systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00198             else {
00199                 systeme.set(ligne_courant, col+column_courant) = -(2*col+1) ;
00200             systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00201          }
00202         }
00203     }
00204     }
00205 
00206     // FINJAC case
00207     else {
00208     // regularity conditions for eta :
00209     if (l_quant == 0) {
00210         nbr_cl = 1 ;
00211         for (int col=0 ; col<nr ; col++) {
00212             systeme.set(ligne_courant, col+column_courant) =  col*(col+1)*(col+2)*(col+3)/double(12)*(2*(col%2)-1);
00213             systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00214         }
00215         }
00216     else if (l_quant == 1) {
00217         nbr_cl = 1 ;
00218         for (int col=0 ; col<nr ; col++) {
00219             systeme.set(ligne_courant, col+column_courant) = (col+1)*(col+2)/double(2)*(1-2*(col%2)) ;
00220             systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00221         }
00222         }
00223     else {
00224         nbr_cl = 2 ;
00225         for (int col=0 ; col<nr ; col++) {
00226             systeme.set(ligne_courant, col+column_courant) = (col+1)*(col+2)/double(2)*(1-2*(col%2)) ;
00227             systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00228             systeme.set(ligne_courant+1, col+column_courant) = col*(col+1)*(col+2)*(col+3)/double(12)*(2*(col%2)-1) ;
00229             systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ;
00230         }
00231         }
00232     }   
00233     ligne_courant += nbr_cl ;
00234 
00235     // Premiere partie de l'operateur :
00236     for (int lig=0 ; lig<nr-1-nbr_cl ; lig++) {
00237         for (int col=0 ; col<nr ; col++) {
00238             systeme.set(lig+ligne_courant,col+column_courant) = mdn(lig,col) + msn(lig,col) ;
00239             sec_membre.set(lig+ligne_courant) = alpha*alpha*(*source.get_spectral_va().c_cf)(0, k, j, lig) ;
00240         systeme.set(lig+ligne_courant,col+column_courant+nr)= - msn(lig,col) ;
00241     //  systeme.set(lig+ligne_courant+nr) = 0 ;
00242         }
00243     }
00244 
00245 
00246     ligne_courant += nr-1-nbr_cl ;
00247     
00248 
00249     // RARE case    
00250     if (source.get_mp().get_mg()->get_type_r(0) == RARE) {
00251     // regularity conditions for vr :
00252     if (l_quant > 1) {
00253          nbr_cl = 1 ;
00254          if (l_quant%2==0) {
00255             //Even case
00256         for (int col=0 ; col<nr ; col++) {
00257             if (col%2==0) {
00258                 systeme.set(ligne_courant, col+column_courant) = 0 ;
00259             systeme.set(ligne_courant, col+column_courant+nr) = 1 ; }
00260             else {
00261                 systeme.set(ligne_courant, col+column_courant) = 0 ;
00262             systeme.set(ligne_courant, col+column_courant+nr) = -1 ; }
00263         }
00264         }
00265     
00266          else {
00267          //Odd case
00268              for (int col=0 ; col<nr ; col++) {
00269             if (col%2==0) {
00270                 systeme.set(ligne_courant, col+column_courant) = 0 ;
00271             systeme.set(ligne_courant, col+column_courant+nr) = 2*col+1 ; }
00272             else {
00273                 systeme.set(ligne_courant, col+column_courant) = 0 ;
00274             systeme.set(ligne_courant, col+column_courant+nr) = -(2*col+1) ; }
00275         }
00276         }
00277       }
00278     }
00279 
00280     // FINJAC case
00281     else {
00282     // regularity conditions for vr :
00283     if (l_quant == 0) {
00284         nbr_cl = 1 ;
00285         for (int col=0 ; col<nr ; col++) {
00286             systeme.set(ligne_courant, col+column_courant) = 0 ;
00287             systeme.set(ligne_courant, col+column_courant+nr) = col*(col+1)*(col+2)*(col+3)/double(12)*(2*(col%2)-1) ;
00288         }
00289         }
00290     else if (l_quant == 1) {
00291         nbr_cl = 1 ;
00292         for (int col=0 ; col<nr ; col++) {
00293             systeme.set(ligne_courant, col+column_courant) = 0 ;
00294             systeme.set(ligne_courant, col+column_courant+nr) = (col+1)*(col+2)/double(2)*(1-2*(col%2)) ;
00295         }
00296         }
00297     else {
00298         nbr_cl = 2 ;
00299         for (int col=0 ; col<nr ; col++) {
00300             systeme.set(ligne_courant, col+column_courant) = 0 ;
00301             systeme.set(ligne_courant, col+column_courant+nr) = (col+1)*(col+2)/double(2)*(1-2*(col%2)) ;
00302             systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00303             systeme.set(ligne_courant+1, col+column_courant+nr) = col*(col+1)*(col+2)*(col+3)/double(12)*(2*(col%2)-1) ;
00304         }
00305         }
00306     }   
00307     ligne_courant += nbr_cl ;
00308 
00309     // Deuxieme partie de l'operateur
00310     for (int lig=0 ; lig<nr-1-nbr_cl ; lig++) {
00311         for (int col=0 ; col<nr ; col++) {
00312             systeme.set(lig+ligne_courant,col+column_courant) = - l_quant*(l_quant+1)*msn(lig,col) ;
00313             sec_membre.set(lig+ligne_courant) = 0 ;
00314         systeme.set(lig+ligne_courant,col+column_courant+nr)= mdn(lig,col) + 2*msn(lig,col) ;
00315     //  systeme.set(lig+ligne_courant+nr) = 0 ;
00316         }
00317     }
00318     
00319     
00320     ligne_courant += nr-1-nbr_cl ;
00321     
00322       
00323     // Le raccord pour eta
00324     for (int col=0 ; col<nr ; col++) {
00325          if (source.get_mp().get_mg()->get_type_r(0) == RARE) {
00326          // La fonction eta
00327          systeme.set(ligne_courant, col+column_courant) = 1 ;
00328          systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00329          // Sa derivee :
00330          if (l_quant%2==0) {
00331              systeme.set(ligne_courant+1, col+column_courant) = 4*col*col/alpha ;
00332          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ;
00333          }
00334          else { 
00335              systeme.set(ligne_courant+1, col+column_courant) = (2*col+1)*(2*col+1)/alpha ;
00336          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ;
00337         }
00338           }
00339          else { // Cas FINJAC
00340          // La fonction eta
00341          systeme.set(ligne_courant, col+column_courant) = 1 ;
00342          systeme.set(ligne_courant, col+column_courant+nr) = 0 ; 
00343          // Sa derivee :
00344          systeme.set(ligne_courant+1, col+column_courant) = col*(col+3)/double(2)/alpha ;
00345          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ;
00346           }
00347          }
00348 
00349     ligne_courant += 2 ;
00350     // Le raccord pour vr
00351     for (int col=0 ; col<nr ; col++) {
00352          if (source.get_mp().get_mg()->get_type_r(0) == RARE) {
00353          // La fonction vr
00354          systeme.set(ligne_courant, col+column_courant) = 0 ;
00355          systeme.set(ligne_courant, col+column_courant+nr) = 1 ;
00356          // Sa derivee :
00357          if (l_quant%2==0) {
00358              systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00359          systeme.set(ligne_courant+1, col+column_courant+nr) = 4*col*col/alpha ;
00360          }
00361          else { 
00362              systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00363          systeme.set(ligne_courant+1, col+column_courant+nr) = (2*col+1)*(2*col+1)/alpha ;
00364         }
00365           }
00366          else { // Cas FINJAC
00367          // La fonction vr
00368          systeme.set(ligne_courant, col+column_courant) = 0 ;
00369          systeme.set(ligne_courant, col+column_courant+nr) = 1 ; 
00370          // Sa derivee :
00371          systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00372          systeme.set(ligne_courant+1, col+column_courant+nr) = col*(col+3)/double(2)/alpha ;
00373           }
00374          }
00375     
00376     ligne_courant -= 2 ; // On retourne pour le raccord dans la prochaine zone
00377 
00378     column_courant += 2*nr ; // On va changer de zone
00379 
00380         //--------------------------
00381         //       SHELLS
00382         //--------------------------
00383     for (int l=1 ; l<nz-1 ; l++) {
00384     
00385         nr = mgrid.get_nr(l) ; 
00386         alpha = (*mp_aff).get_alpha()[l] ;
00387         beta = (*mp_aff).get_beta()[l] ;
00388         echelle = beta/alpha ;
00389         
00390             base.give_quant_numbers (l, k, j, m_quant, l_quant, base_r) ;  
00391         //  work = new Matrice (laplacien_mat(nr, l_quant, echelle, 0, base_r)) ;
00392     //  Diff_dsdx ods(base_r, nr) ; const Matrice& mds = ods.get_matrice() ;
00393         Diff_id ois(base_r, nr) ; const Matrice& mis = ois.get_matrice() ;
00394         Diff_xdsdx oxds(base_r, nr) ; const Matrice& mxds = oxds.get_matrice() ;
00395     
00396        // matching with previous domain :
00397        for (int col=0 ; col<nr ; col++) {
00398          // La fonction eta
00399          if (col%2==0) {
00400               systeme.set(ligne_courant, col+column_courant) = -1 ; 
00401           systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00402          else  {
00403               systeme.set(ligne_courant, col+column_courant) = 1 ;
00404           systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00405          // Sa derivee :
00406          if (col%2==0) {
00407              systeme.set(ligne_courant+1, col+column_courant) = col*col/alpha ;
00408          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ; }
00409          else  {
00410              systeme.set(ligne_courant+1, col+column_courant) = -col*col/alpha ;
00411          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ; }
00412       }
00413       ligne_courant += 2 ;
00414 
00415       // matching with previous domain :
00416        for (int col=0 ; col<nr ; col++) {
00417          // La fonction vr
00418          if (col%2==0) {
00419               systeme.set(ligne_courant, col+column_courant) = 0 ;  
00420           systeme.set(ligne_courant, col+column_courant+nr) = -1 ; }
00421          else  {
00422               systeme.set(ligne_courant, col+column_courant) = 0 ;
00423           systeme.set(ligne_courant, col+column_courant+nr) = 1 ; }
00424          // Sa derivee :
00425          if (col%2==0) {
00426              systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00427          systeme.set(ligne_courant+1, col+column_courant+nr) = col*col/alpha ; }
00428          else  {
00429              systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00430          systeme.set(ligne_courant+1, col+column_courant+nr) = -col*col/alpha ; }
00431       }
00432       ligne_courant += 2 ;
00433       
00434 
00435       // L'operateur (premiere et deuxieme parties) :
00436       
00437       // source must be multiplied by (x+echelle)^2
00438       Tbl source_aux(nr) ;
00439       source_aux.set_etat_qcq() ;
00440       for (int i=0 ; i<nr ; i++)
00441           source_aux.set(i) = (*source.get_spectral_va().c_cf)(l,k,j,i)*alpha*alpha ;
00442         Tbl xso(source_aux) ;
00443         Tbl xxso(source_aux) ;
00444         multx_1d(nr, &xso.t, R_CHEB) ;
00445         multx_1d(nr, &xxso.t, R_CHEB) ;
00446         multx_1d(nr, &xxso.t, R_CHEB) ;
00447         source_aux = beta*beta/alpha/alpha*source_aux+2*beta/alpha*xso+xxso ;
00448       
00449     for (int lig=0 ; lig<nr-2 ; lig++) {
00450          for (int col=0 ; col<nr ; col++) {
00451              systeme.set(lig+ligne_courant,col+column_courant) = mxds(lig,col) + mis(lig,col) ;
00452          systeme.set(lig+ligne_courant,col+column_courant+nr) = -mis(lig,col) ; 
00453          sec_membre.set(lig+ligne_courant) = source_aux(lig) ;
00454          systeme.set(lig+ligne_courant+nr-2, col+column_courant) = -l_quant*(l_quant+1) ;
00455          systeme.set(lig+ligne_courant+nr-2, col+column_courant+nr) = mxds(lig,col) + 2*mis(lig,col) ;
00456          sec_membre.set(lig+ligne_courant+nr-2) = 0 ; }
00457       }
00458       
00459       
00460       ligne_courant += 2*nr-4 ;
00461       // Matching with the next domain :
00462       for (int col=0 ; col<nr ; col++) {
00463          // La fonction eta
00464          systeme.set(ligne_courant, col+column_courant) = 1 ;
00465          systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00466          // Sa derivee :
00467          systeme.set(ligne_courant+1, col+column_courant) = col*col/alpha ;
00468          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ;
00469          // La fonction vr
00470          systeme.set(ligne_courant+2, col+column_courant) = 0 ;
00471          systeme.set(ligne_courant+2, col+column_courant+nr) = 1 ;
00472          // Sa derivee
00473          systeme.set(ligne_courant+3, col+column_courant) = 0 ; 
00474          systeme.set(ligne_courant+3, col+column_courant+nr) = col*col/alpha ; 
00475          }
00476          
00477       column_courant += 2*nr ;   
00478       }
00479       
00480 
00481         //--------------------------
00482         //       ZEC
00483         //--------------------------
00484     nr = mgrid.get_nr(nz-1) ; 
00485     alpha = (*mp_aff).get_alpha()[nz-1] ;
00486     beta = (*mp_aff).get_beta()[nz-1] ;
00487         
00488     base.give_quant_numbers (nz-1, k, j, m_quant, l_quant, base_r) ;
00489     //work = new Matrice(laplacien_mat(nr, l_quant, 0., dzpuis, base_r)) ;
00490     Diff_dsdx odzec(base_r, nr) ; const Matrice& mdzec = odzec.get_matrice() ;
00491     Diff_sx oszec(base_r, nr) ; const Matrice& mszec = oszec.get_matrice() ;
00492 
00493     
00494     // Matching with the previous domain :
00495      for (int col=0 ; col<nr ; col++) {
00496          // La fonction eta
00497          if (col%2==0) {
00498               systeme.set(ligne_courant, col+column_courant) = -1 ;
00499           systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00500          else {
00501               systeme.set(ligne_courant, col+column_courant) = 1 ;
00502           systeme.set(ligne_courant, col+column_courant+nr) = 0 ; }
00503          // Sa derivee :
00504          if (col%2==0) {
00505              systeme.set(ligne_courant+1, col+column_courant) = -4*alpha*col*col ;
00506          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ; }
00507          else {
00508              systeme.set(ligne_courant+1, col+column_courant) = 4*alpha*col*col ;
00509          systeme.set(ligne_courant+1, col+column_courant+nr) = 0 ; }
00510         // La fonction vr
00511         if (col%2==0) {
00512               systeme.set(ligne_courant+2, col+column_courant) = -1 ;
00513           systeme.set(ligne_courant+2, col+column_courant+nr) = 0 ; }
00514          else {
00515               systeme.set(ligne_courant+2, col+column_courant) = 1 ;
00516           systeme.set(ligne_courant+2, col+column_courant+nr) = 0 ; }
00517          // Sa derivee :
00518          if (col%2==0) {
00519              systeme.set(ligne_courant+3, col+column_courant) = -4*alpha*col*col ;
00520          systeme.set(ligne_courant+3, col+column_courant+nr) = 0 ; }
00521          else {
00522              systeme.set(ligne_courant+3, col+column_courant) = 4*alpha*col*col ;
00523          systeme.set(ligne_courant+3, col+column_courant+nr) = 0 ; }
00524       }
00525       ligne_courant += 4 ;  
00526       
00527       // Regularity and BC at infinity ?
00528       nbr_cl =0 ;
00529       switch (dzpuis) {
00530            case 4 : 
00531                if (l_quant==0) {
00532                nbr_cl = 1 ;
00533                // Only BC at infinity :
00534                for (int col=0 ; col<nr ; col++) {
00535                    systeme.set(ligne_courant, col+column_courant) = 1 ;
00536                systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00537                systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00538                systeme.set(ligne_courant+1, col+column_courant+nr) = 1 ; }
00539                }
00540            else { 
00541                nbr_cl = 2 ;
00542                // BC at infinity :
00543                for (int col=0 ; col<nr ; col++) {
00544                    systeme.set(ligne_courant, col+column_courant) = 1 ;
00545                systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00546                systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00547                systeme.set(ligne_courant+1, col+column_courant+nr) = 1; } 
00548                // Regularity :
00549                for (int col=0 ; col<nr ; col++) {
00550                    systeme.set(ligne_courant+2, col+column_courant) = -4*alpha*col*col ;
00551                systeme.set(ligne_courant+2, col+column_courant+nr) = 0 ;
00552                systeme.set(ligne_courant+3, col+column_courant) = 0 ;
00553                systeme.set(ligne_courant+3, col+column_courant+nr) = -4*alpha*col*col ; }
00554             }
00555             break ;
00556            
00557             case 3 :
00558             nbr_cl = 1 ;
00559             // Only BC at infinity :
00560             for (int col=0 ; col<nr ; col++) {
00561                systeme.set(ligne_courant, col+column_courant) = 1 ;
00562                systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00563                systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00564                systeme.set(ligne_courant+1, col+column_courant+nr) = 1 ; }
00565             break ;
00566         
00567         case 2 :
00568              if (l_quant==0) {
00569                  nbr_cl = 1 ;
00570                 // Only BC at infinity :
00571                 for (int col=0 ; col<nr ; col++) {
00572                    systeme.set(ligne_courant, col+column_courant) = 1 ;
00573                systeme.set(ligne_courant, col+column_courant+nr) = 0 ;
00574                systeme.set(ligne_courant+1, col+column_courant) = 0 ;
00575                systeme.set(ligne_courant+1, col+column_courant+1) = 1 ; }
00576             }
00577              break ;
00578         default : 
00579             cout << "Unknown dzpuis in vector_divfree_A ..." << endl ;
00580             abort() ;
00581     }
00582     
00583     ligne_courant += nbr_cl ;
00584     
00585     // Multiplication of the source :
00586     double indic = 1 ;
00587     switch (dzpuis) {
00588         case 4 : 
00589             indic = alpha*alpha ;
00590         break ;
00591         case 3 :
00592             indic = alpha ;
00593         break ;
00594     default : 
00595          break ;
00596     }
00597     
00598     // L'operateur :
00599     for (int lig=0 ; lig<nr-1-nbr_cl ; lig++) {
00600         for (int col=0 ; col<nr ; col++) {
00601            systeme.set(lig+ligne_courant,col+column_courant) = mdzec(lig,col)+mszec(lig,col) ;
00602            systeme.set(lig+ligne_courant,col+column_courant+nr) = -mszec(lig,col) ;
00603            sec_membre.set(lig+ligne_courant) = indic*(*source.get_spectral_va().c_cf)(nz-1, k, j, lig) ;
00604            systeme.set(lig+ligne_courant+nr-1-nbr_cl,col+column_courant)= - l_quant*(l_quant+1)*mszec(lig,col) ;
00605            systeme.set(lig+ligne_courant+nr-1-nbr_cl,col+column_courant+nr) = mdzec(lig,col)+2*mszec(lig,col) ;
00606            sec_membre.set(lig+ligne_courant+nr-1-nbr_cl) = 0 ; }
00607     }
00608     
00609 
00610     // Solving the system:
00611     systeme.set_band (max_nr, max_nr) ;
00612     systeme.set_lu() ;
00613     Tbl soluce (systeme.inverse(sec_membre)) ;
00614     
00615     // On range :
00616     int conte = 0 ;
00617     for (int l=0 ; l<nz ; l++) {
00618          nr = mgrid.get_nr(l) ;
00619          for (int i=0 ; i<nr ; i++) {
00620              meta.set(l,k,j,i) = soluce(conte) ;
00621          mvr.set(l,k,i,j) = soluce(conte+nr) ;
00622          conte ++ ;
00623         }
00624     }
00625 }
00626 if (eta_tilde.set_spectral_va().c != 0x0) 
00627     delete eta_tilde.set_spectral_va().c ;
00628     eta_tilde.set_spectral_va().c = 0x0 ;
00629     eta_tilde.set_spectral_va().ylm_i() ;
00630 
00631     if (vr.set_spectral_va().c != 0x0) 
00632     delete vr.set_spectral_va().c ;
00633     vr.set_spectral_va().c = 0x0 ;
00634     vr.set_spectral_va().ylm_i() ;
00635 }

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