map_log_elliptic.C

00001 
00023 char map_log_elliptic_C[] = "$Header $" ;
00024 
00025 /*
00026  * $Id: map_log_elliptic.C,v 1.4 2007/01/16 15:08:07 n_vasset Exp $
00027  * $Log: map_log_elliptic.C,v $
00028  * Revision 1.4  2007/01/16 15:08:07  n_vasset
00029  * New constructor, usn Scalar on mono-domain angular grid for boundary,
00030  * for function sol_elliptic_boundary()
00031  *
00032  * Revision 1.3  2005/06/09 07:57:32  f_limousin
00033  * Implement a new function sol_elliptic_boundary() and
00034  * Vector::poisson_boundary(...) which solve the vectorial poisson
00035  * equation (method 6) with an inner boundary condition.
00036  *
00037  * Revision 1.2  2004/08/24 09:14:42  p_grandclement
00038  * Addition of some new operators, like Poisson in 2d... It now requieres the
00039  * GSL library to work.
00040  *
00041  * Also, the way a variable change is stored by a Param_elliptic is changed and
00042  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
00043  * will requiere some modification. (It should concern only the ones about monopoles)
00044  *
00045  * Revision 1.1  2004/06/22 08:49:58  p_grandclement
00046  * Addition of everything needed for using the logarithmic mapping
00047  *
00048  * Revision 1.4  2004/03/17 15:58:48  p_grandclement
00049  *
00050  * $Header: /cvsroot/Lorene/C++/Source/Map/map_log_elliptic.C,v 1.4 2007/01/16 15:08:07 n_vasset Exp $
00051  *
00052  */
00053 
00054 // Header C : 
00055 #include <stdlib.h>
00056 #include <math.h>
00057 
00058 // Headers Lorene :
00059 #include "tbl.h"
00060 #include "mtbl_cf.h"
00061 #include "map.h"
00062 #include "param_elliptic.h"
00063          
00064             //----------------------------------------------
00065        //       General elliptic solver
00066       //----------------------------------------------
00067 
00068 void Map_log::sol_elliptic(Param_elliptic& ope_var, const Scalar& source, 
00069               Scalar& pot) const {
00070     
00071   assert(source.get_etat() != ETATNONDEF) ; 
00072   assert(source.get_mp().get_mg() == mg) ; 
00073   assert(pot.get_mp().get_mg() == mg) ; 
00074   
00075   assert(source.check_dzpuis(2) || source.check_dzpuis(3) || 
00076      source.check_dzpuis(4)) ; 
00077   // Spherical harmonic expansion of the source
00078   // ------------------------------------------
00079   
00080   const Valeur& sourva = source.get_spectral_va() ; 
00081   
00082   if (sourva.get_etat() == ETATZERO) {
00083     pot.set_etat_zero() ;
00084     return ;  
00085     }
00086   
00087   // Spectral coefficients of the source
00088   assert(sourva.get_etat() == ETATQCQ) ; 
00089   
00090   Valeur rho(sourva.get_mg()) ; 
00091   sourva.coef() ; 
00092   rho = *(sourva.c_cf) ;    // copy of the coefficients of the source
00093   
00094   rho.ylm() ;           // spherical harmonic transforms 
00095     
00096   // On met les bonnes bases dans le changement de variable 
00097   // de ope_var :
00098   ope_var.var_F.set_spectral_va().coef() ;
00099   ope_var.var_F.set_spectral_va().ylm() ;
00100   ope_var.var_G.set_spectral_va().coef() ;
00101   ope_var.var_G.set_spectral_va().ylm() ;
00102 
00103   // Call to the Mtbl_cf version
00104   // ---------------------------
00105   Mtbl_cf resu = elliptic_solver (ope_var, *(rho.c_cf)) ;
00106   // Final result returned as a Scalar
00107   // ---------------------------------
00108   
00109   pot.set_etat_zero() ;  // to call Scalar::del_t().
00110   
00111   pot.set_etat_qcq() ; 
00112   
00113   pot.set_spectral_va() = resu ;
00114   pot.set_spectral_va().ylm_i() ; // On repasse en base standard.       
00115   
00116   pot.set_dzpuis(0) ; 
00117 }
00118 
00119 
00120          //--------------------------------------------------
00121          //     General elliptic solver with boundary as Mtbl_cf
00122          //--------------------------------------------------
00123 
00124 
00125 void Map_log::sol_elliptic_boundary(Param_elliptic& ope_var, const Scalar& source, 
00126                Scalar& pot, const Mtbl_cf& bound, 
00127                double fact_dir, double fact_neu) const {
00128     
00129   assert(source.get_etat() != ETATNONDEF) ; 
00130   assert(source.get_mp().get_mg() == mg) ; 
00131   assert(pot.get_mp().get_mg() == mg) ; 
00132   
00133   assert(source.check_dzpuis(2) || source.check_dzpuis(3) || 
00134      source.check_dzpuis(4)) ; 
00135   // Spherical harmonic expansion of the source
00136   // ------------------------------------------
00137   
00138   const Valeur& sourva = source.get_spectral_va() ; 
00139   
00140   if (sourva.get_etat() == ETATZERO) {
00141     pot.set_etat_zero() ;
00142     return ;  
00143     }
00144   
00145   // Spectral coefficients of the source
00146   assert(sourva.get_etat() == ETATQCQ) ; 
00147   
00148   Valeur rho(sourva.get_mg()) ; 
00149   sourva.coef() ; 
00150   rho = *(sourva.c_cf) ;    // copy of the coefficients of the source
00151   
00152   rho.ylm() ;           // spherical harmonic transforms 
00153     
00154   // On met les bonnes bases dans le changement de variable 
00155   // de ope_var :
00156   ope_var.var_F.set_spectral_va().coef() ;
00157   ope_var.var_F.set_spectral_va().ylm() ;
00158   ope_var.var_G.set_spectral_va().coef() ;
00159   ope_var.var_G.set_spectral_va().ylm() ;
00160 
00161   // Call to the Mtbl_cf version
00162   // ---------------------------
00163   Mtbl_cf resu = elliptic_solver_boundary (ope_var, *(rho.c_cf), bound, 
00164                        fact_dir, fact_neu) ;
00165   // Final result returned as a Scalar
00166   // ---------------------------------
00167   
00168   pot.set_etat_zero() ;  // to call Scalar::del_t().
00169   
00170   pot.set_etat_qcq() ; 
00171   
00172   pot.set_spectral_va() = resu ;
00173   pot.set_spectral_va().ylm_i() ; // On repasse en base standard.       
00174   
00175   pot.set_dzpuis(0) ; 
00176 }
00177 
00178    
00179          //--------------------------------------------------
00180          //     General elliptic solver with boundary as Scalar
00181          //--------------------------------------------------
00182 
00183 
00184 void Map_log::sol_elliptic_boundary(Param_elliptic& ope_var, const Scalar& source, 
00185                Scalar& pot, const Scalar& bound, 
00186                double fact_dir, double fact_neu) const {
00187     
00188   assert(source.get_etat() != ETATNONDEF) ; 
00189   assert(source.get_mp().get_mg() == mg) ; 
00190   assert(pot.get_mp().get_mg() == mg) ; 
00191   
00192   assert(source.check_dzpuis(2) || source.check_dzpuis(3) || 
00193      source.check_dzpuis(4)) ; 
00194   // Spherical harmonic expansion of the source
00195   // ------------------------------------------
00196   
00197   const Valeur& sourva = source.get_spectral_va() ; 
00198   
00199   if (sourva.get_etat() == ETATZERO) {
00200     pot.set_etat_zero() ;
00201     return ;  
00202     }
00203   
00204   // Spectral coefficients of the source
00205   assert(sourva.get_etat() == ETATQCQ) ; 
00206   
00207   Valeur rho(sourva.get_mg()) ; 
00208   sourva.coef() ; 
00209   rho = *(sourva.c_cf) ;    // copy of the coefficients of the source
00210   
00211   rho.ylm() ;           // spherical harmonic transforms 
00212     
00213   // On met les bonnes bases dans le changement de variable 
00214   // de ope_var :
00215   ope_var.var_F.set_spectral_va().coef() ;
00216   ope_var.var_F.set_spectral_va().ylm() ;
00217   ope_var.var_G.set_spectral_va().coef() ;
00218   ope_var.var_G.set_spectral_va().ylm() ;
00219 
00220   // Call to the Mtbl_cf version
00221   // ---------------------------
00222     Scalar bbound = bound;
00223   bbound.set_spectral_va().ylm() ;
00224   const Map& mapp = bbound.get_mp();
00225  
00226   const Mg3d& gri2d = *mapp.get_mg();
00227 
00228   assert(&gri2d == source.get_mp().get_mg()->get_angu_1dom()) ;
00229   
00230   Mtbl_cf bound2 (gri2d , bbound.get_spectral_base()) ;
00231   bound2.annule_hard() ;  
00232 
00233   if (bbound.get_etat() != ETATZERO){ 
00234  
00235       int nr = gri2d.get_nr(0) ;
00236       int nt = gri2d.get_nt(0) ; 
00237       int np = gri2d.get_np(0) ; 
00238        
00239       for(int k=0; k<np+2; k++)
00240           for (int j=0; j<=nt-1; j++)
00241           for(int xi=0; xi<= nr-1; xi++)
00242           {
00243   bound2.set(0, k , j , xi) = (*bbound.get_spectral_va().c_cf)(0, k, j, xi) ;   
00244   }
00245   }  
00246  
00247   
00248   Mtbl_cf resu = elliptic_solver_boundary (ope_var, *(rho.c_cf), bound2, 
00249                        fact_dir, fact_neu) ;
00250   // Final result returned as a Scalar
00251   // ---------------------------------
00252   
00253   pot.set_etat_zero() ;  // to call Scalar::del_t().
00254   
00255   pot.set_etat_qcq() ; 
00256   
00257   pot.set_spectral_va() = resu ;
00258   pot.set_spectral_va().ylm_i() ; // On repasse en base standard.       
00259   
00260   pot.set_dzpuis(0) ; 
00261 }
00262 
00263   
00264             //------------------------------------------------
00265        //       General elliptic solver with no zec
00266       //-------------------------------------------------
00267 
00268 void Map_log::sol_elliptic_no_zec (Param_elliptic& ope_var, const Scalar& source, 
00269               Scalar& pot, double val) const {
00270     
00271   assert(source.get_etat() != ETATNONDEF) ; 
00272   assert(source.get_mp().get_mg() == mg) ; 
00273   assert(pot.get_mp().get_mg() == mg) ; 
00274   
00275   assert(source.check_dzpuis(2) || source.check_dzpuis(3) || 
00276      source.check_dzpuis(4)) ; 
00277   // Spherical harmonic expansion of the source
00278   // ------------------------------------------
00279   
00280   const Valeur& sourva = source.get_spectral_va() ; 
00281   
00282   if (sourva.get_etat() == ETATZERO) {
00283     pot.set_etat_zero() ;
00284     return ;  
00285     }
00286   
00287   // Spectral coefficients of the source
00288   assert(sourva.get_etat() == ETATQCQ) ; 
00289   
00290   Valeur rho(sourva.get_mg()) ; 
00291   sourva.coef() ; 
00292   rho = *(sourva.c_cf) ;    // copy of the coefficients of the source
00293   
00294   rho.ylm() ;           // spherical harmonic transforms 
00295     
00296   // On met les bonnes bases dans le changement de variable 
00297   // de ope_var :
00298   ope_var.var_F.set_spectral_va().coef() ;
00299   ope_var.var_F.set_spectral_va().ylm() ;
00300   ope_var.var_G.set_spectral_va().coef() ;
00301   ope_var.var_G.set_spectral_va().ylm() ;
00302 
00303   // Call to the Mtbl_cf version
00304   // ---------------------------
00305   Mtbl_cf resu = elliptic_solver_no_zec (ope_var, *(rho.c_cf), val) ;
00306   // Final result returned as a Scalar
00307   // ---------------------------------
00308   
00309   pot.set_etat_zero() ;  // to call Scalar::del_t().
00310   
00311   pot.set_etat_qcq() ; 
00312   
00313   pot.set_spectral_va() = resu ;
00314   pot.set_spectral_va().ylm_i() ; // On repasse en base standard.       
00315   
00316   pot.set_dzpuis(0) ; 
00317 }
00318 
00319    

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