map_af_poisson_regu.C

00001 /*
00002  * Method of the class Map_af for the resolution of the scalar Poisson
00003  *  equation by using regularized source.
00004  */
00005 
00006 /*
00007  *   Copyright (c) 2000-2001 Keisuke Taniguchi
00008  *
00009  *   This file is part of LORENE.
00010  *
00011  *   LORENE is free software; you can redistribute it and/or modify
00012  *   it under the terms of the GNU General Public License as published by
00013  *   the Free Software Foundation; either version 2 of the License, or
00014  *   (at your option) any later version.
00015  *
00016  *   LORENE is distributed in the hope that it will be useful,
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *   GNU General Public License for more details.
00020  *
00021  *   You should have received a copy of the GNU General Public License
00022  *   along with LORENE; if not, write to the Free Software
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  */
00026 
00027 
00028 char map_af_poisson_regu_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson_regu.C,v 1.3 2003/12/19 16:21:43 j_novak Exp $" ;
00029 
00030 /*
00031  * $Id: map_af_poisson_regu.C,v 1.3 2003/12/19 16:21:43 j_novak Exp $
00032  * $Log: map_af_poisson_regu.C,v $
00033  * Revision 1.3  2003/12/19 16:21:43  j_novak
00034  * Shadow hunt
00035  *
00036  * Revision 1.2  2003/10/03 15:58:48  j_novak
00037  * Cleaning of some headers
00038  *
00039  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00040  * LORENE
00041  *
00042  * Revision 2.13  2000/10/25  16:05:11  keisuke
00043  * Remake for the arbitrary regularization degree (k_div).
00044  *
00045  * Revision 2.12  2000/10/06  15:31:41  keisuke
00046  * Suppress assertions for nilm_cos and nilm_sin.
00047  * Add warnings for nilm_cos and nilm_sin.
00048  *
00049  * Revision 2.11  2000/09/25  15:02:48  keisuke
00050  * modify the derivative duu_div.
00051  *
00052  * Revision 2.10  2000/09/11  13:50:57  keisuke
00053  * Set the basis of duu_div to the spherical one.
00054  *
00055  * Revision 2.9  2000/09/11  10:15:06  keisuke
00056  * Change the method to reconstruct source_regu.
00057  *
00058  * Revision 2.8  2000/09/09  14:51:20  keisuke
00059  * Suppress uu_regu.set_dzpuis(0).
00060  *
00061  * Revision 2.7  2000/09/07  15:29:50  keisuke
00062  * Add a new argument Cmp& uu.
00063  *
00064  * Revision 2.6  2000/09/06  10:28:42  keisuke
00065  * Modify the scaling for derivatives.
00066  *
00067  * Revision 2.5  2000/09/04  15:55:38  keisuke
00068  * Include the polar and azimuthal parts of duu_div.
00069  *
00070  * Revision 2.4  2000/09/04  13:08:39  keisuke
00071  * Change alpha[0] into mp_radial->dxdr.
00072  *
00073  * Revision 2.3  2000/09/01  08:55:55  keisuke
00074  * Change val_r into alpha[0].
00075  *
00076  * Revision 2.2  2000/08/31  15:59:51  keisuke
00077  * Modify the arguments.
00078  *
00079  * Revision 2.1  2000/08/28  16:11:44  keisuke
00080  * Add "int nzet" in the argumant.
00081  *
00082  * Revision 2.0  2000/08/25  08:48:36  keisuke
00083  * *** empty log message ***
00084  *
00085  *
00086  * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson_regu.C,v 1.3 2003/12/19 16:21:43 j_novak Exp $
00087  *
00088  */
00089 
00090 // headers C
00091 #include <math.h>
00092 
00093 // Header Lorene
00094 #include "tenseur.h"
00095 #include "matrice.h"
00096 #include "param.h"
00097 #include "proto.h"
00098 
00099 //******************************************************************
00100 
00101 void Map_af::poisson_regular(const Cmp& source, int k_div, int nzet,
00102                  double unsgam1, Param& par, Cmp& uu,
00103                  Cmp& uu_regu, Cmp& uu_div, Tenseur& duu_div,
00104                  Cmp& source_regu, Cmp& source_div) const {
00105 
00106 
00107     assert(source.get_etat() != ETATNONDEF) ;
00108     assert(source.get_mp()->get_mg() == mg) ;
00109     assert(k_div > 0) ;
00110 
00111     double aa = unsgam1 ;  // exponent of the specific enthalpy
00112 
00113     int nzm1 = mg->get_nzone() - 1; 
00114     int nr = mg->get_nr(0) ;
00115     int nt = mg->get_nt(0) ;
00116     int np = mg->get_np(0) ;
00117 
00118     assert(nr-k_div > 0) ;
00119 
00120     // --------------------------------------------
00121     //      Expansion of "source" by T_i Y_l^m
00122     // --------------------------------------------
00123 
00124     // Expansion by cos(j \theta) and sin(j \theta) for theta direction
00125     // ----------------------------------------------------------------
00126 
00127     const Valeur& sourva = source.va ;
00128     assert(sourva.get_etat() == ETATQCQ) ;
00129 
00130     Valeur rho(sourva.get_mg()) ;
00131     sourva.coef() ;
00132     rho = *(sourva.c_cf) ;
00133 
00134     // Expansion by Legendre function for theta direction
00135     // --------------------------------------------------
00136 
00137     rho.ylm() ;
00138 
00139     // Obtaining the coefficients of the given source
00140     // ----------------------------------------------
00141 
00142     Tbl& ccf = *((rho.c_cf)->t[0]) ;
00143 
00144     Tbl nilm_cos(np/2+1, 2*nt, nr) ;
00145     Tbl nilm_sin(np/2+1, 2*nt, nr) ;
00146 
00147     nilm_cos.set_etat_qcq() ;
00148     nilm_sin.set_etat_qcq() ;
00149 
00150     for (int k=0; k<=np; k+=2) {
00151 
00152       int m = k / 2 ;
00153 
00154       for (int j=0; j<nt; j++) {
00155 
00156     int l ;
00157     if(m%2 == 0) {
00158       l = 2 * j ;
00159     }
00160     else
00161       l = 2 * j + 1 ;
00162 
00163     for (int i=0; i<nr; i++) {
00164 
00165       nilm_cos.set(m, l, i) = ccf(k, j, i) ;
00166       nilm_sin.set(m, l, i) = ccf(k+1, j, i) ;
00167 
00168     }
00169       }
00170     }
00171 
00172     // -----------------------------------------------------
00173     //      Expansion of "analytic source" by T_i Y_l^m
00174     // -----------------------------------------------------
00175 
00176     const Grille3d& grid = *(mg->get_grille3d(0)) ;
00177 
00178     Tbl cf_cil(2*nt, nr, k_div) ;
00179     cf_cil.set_etat_qcq() ;
00180 
00181     int deg[3] ;
00182     int dim[3] ;
00183 
00184     deg[0] = 1 ;
00185     deg[1] = 1 ;
00186     deg[2] = nr ;
00187     dim[0] = 1 ;
00188     dim[1] = 1 ;
00189     dim[2] = nr ;
00190 
00191     double* tmp1 = new double[nr] ;
00192 
00193     for (int k_deg=1; k_deg<=k_div; k_deg++) {
00194 
00195       for (int l=0; l<2*nt; l++) {
00196 
00197     for (int i=0; i<nr; i++) {
00198 
00199       double xi = grid.x[i] ;
00200 
00201       tmp1[i] = (aa + k_deg + 1.) *
00202         ( -(4. * l + 6.) * pow(1. - xi * xi, aa + k_deg) * pow(xi, l)
00203           + 4. * (aa + k_deg) * pow(1. - xi * xi, aa + k_deg - 1.) *
00204           pow(xi, l + 2.) ) ;
00205 
00206     }
00207 
00208     if (l%2 == 0) {
00209       cfrchebp(deg, dim, tmp1, dim, tmp1) ;
00210     }
00211     else
00212       cfrchebi(deg, dim, tmp1, dim, tmp1) ;
00213 
00214     for (int i=0; i<nr; i++) {
00215 
00216         cf_cil.set(l, i, k_deg-1) = tmp1[i] ;
00217 
00218     }
00219       }
00220     }
00221 
00222     // Calculation of the coefficients : Solve the simultaneous equations
00223     // -------------------------------
00224 
00225     Tbl alm_cos(np/2+1, 2*nt, k_div) ;
00226     Tbl alm_sin(np/2+1, 2*nt, k_div) ;
00227 
00228     alm_cos.set_etat_qcq() ;
00229     alm_sin.set_etat_qcq() ;
00230 
00231     Matrice matrix(k_div, k_div) ;
00232     matrix.set_etat_qcq() ;
00233 
00234     Tbl rhs_cos(k_div) ;
00235     Tbl rhs_sin(k_div) ;
00236 
00237     rhs_cos.set_etat_qcq() ;
00238     rhs_sin.set_etat_qcq() ;
00239 
00240     for (int k=0; k<=np; k+=2) {
00241 
00242       int m = k / 2 ;
00243 
00244       for (int j=0; j<nt; j++) {
00245 
00246     int l ;
00247     if(m%2 == 0) {
00248       l = 2 * j ;
00249     }
00250     else
00251       l = 2 * j + 1 ;
00252 
00253     for (int i=0; i<k_div; i++) {
00254       for (int j2=0; j2<k_div; j2++) {
00255         matrix.set(i, j2) = cf_cil(l, nr-1-i, j2) ;
00256       }
00257     }
00258 
00259     matrix.set_band(k_div, k_div) ;
00260 
00261     matrix.set_lu() ;
00262 
00263     for (int i=0; i<k_div; i++) {
00264       rhs_cos.set(i) = nilm_cos(m, l, nr-1-i) ;
00265       rhs_sin.set(i) = nilm_sin(m, l, nr-1-i) ;
00266     }
00267 
00268     Tbl sol_cos = matrix.inverse(rhs_cos) ;
00269     Tbl sol_sin = matrix.inverse(rhs_sin) ;
00270 
00271     for (int i=0; i<k_div; i++) {
00272       alm_cos.set(m, l, i) = sol_cos(i) ;
00273       alm_sin.set(m, l, i) = sol_sin(i) ;
00274     }
00275       }
00276     }
00277 
00278     // -------------------------------------------------------
00279     //      Construction of the diverging analytic source
00280     // -------------------------------------------------------
00281 
00282     source_div.set_etat_qcq() ;
00283     (source_div.va).set_etat_cf_qcq() ;
00284     (source_div.va).c_cf->set_etat_qcq() ;
00285     (source_div.va).c_cf->t[0]->set_etat_qcq() ;
00286 
00287     Valeur& sdva = source_div.va ;
00288     Mtbl_cf& sdva_cf = *(sdva.c_cf) ;
00289 
00290     // Initialization
00291     for (int k=0; k<=np; k+=2) {
00292       for (int j=0; j<nt; j++) {
00293     for (int i=0; i<nr; i++) {
00294       sdva_cf.set(0, k, j, i) = 0 ;
00295       sdva_cf.set(0, k+1, j, i) = 0 ;
00296     }
00297       }
00298     }
00299 
00300     for (int k=0; k<=np; k+=2) {
00301 
00302       int m = k / 2  ;
00303 
00304       for (int j=0; j<nt; j++) {
00305 
00306     int l ;
00307 
00308     if (m%2 == 0) {
00309       l = 2 * j ;
00310     }
00311     else
00312       l = 2 * j + 1 ;
00313 
00314     for (int i=0; i<nr; i++) {
00315 
00316       for (int k_deg=1; k_deg<=k_div; k_deg++) {
00317 
00318         sdva_cf.set(0, k, j, i) = sdva_cf(0, k, j, i)
00319           + alm_cos(m, l, k_deg-1) * cf_cil(l, i, k_deg-1) ;
00320         sdva_cf.set(0, k+1, j, i) = sdva_cf(0, k+1, j, i)
00321           + alm_sin(m, l, k_deg-1) * cf_cil(l, i, k_deg-1) ;
00322 
00323       }
00324     }
00325       }
00326     }
00327 
00328     source_div.annule(nzet, nzm1) ;
00329 
00330     Base_val base_std = mg->std_base_scal() ; 
00331 
00332     Base_val& base_s_div = sdva.base ;
00333     for (int l=0; l<=nzm1; l++) {
00334       int base_s_div_r = base_std.b[l] & MSQ_R ; 
00335       int base_s_div_p = base_std.b[l] & MSQ_P ; 
00336 
00337       base_s_div.b[l] = base_s_div_r | T_LEG_P | base_s_div_p ;     
00338     }
00339 
00340     sdva_cf.base = base_s_div ;  // copy of the base in the Mtbl_cf
00341 
00342     sdva.ylm_i() ;
00343 
00344     // ------------------------------------------------
00345     //      Construction of the regularized source
00346     // ------------------------------------------------
00347 
00348     source_regu.set_etat_qcq() ;
00349     source_regu = source - source_div ;
00350 
00351     // -------------------------------------------------------------
00352     //      Solving the Poisson equation for regularized source
00353     // -------------------------------------------------------------
00354 
00355     source_regu.set_dzpuis(4) ;
00356 
00357     assert(uu_regu.get_mp()->get_mg() == mg) ;
00358 
00359     (*this).poisson(source_regu, par, uu_regu) ;
00360 
00361     // ----------------------------------------------------------
00362     //      Construction of the diverging analytic potential
00363     // ----------------------------------------------------------
00364 
00365     Tbl cf_pil(2*nt, nr, k_div) ;
00366     cf_pil.set_etat_qcq() ;
00367 
00368     double* tmp2 = new double[nr] ;
00369 
00370     for (int k_deg=1; k_deg<=k_div; k_deg++) {
00371 
00372       for (int l=0; l<2*nt; l++) {
00373 
00374     for (int i=0; i<nr; i++) {
00375 
00376       double xi = grid.x[i] ;
00377       tmp2[i] = pow(xi, l) * pow(1. - xi * xi, aa + 1. + k_deg) ;
00378 
00379     }
00380 
00381     if (l%2 == 0) {
00382       cfrchebp(deg, dim, tmp2, dim, tmp2) ;
00383     }
00384     else
00385       cfrchebi(deg, dim, tmp2, dim, tmp2) ;
00386 
00387     for (int i=0; i<nr; i++) {
00388 
00389       cf_pil.set(l, i, k_deg-1) = tmp2[i] ;
00390 
00391     }
00392       }
00393     }
00394 
00395     uu_div.set_etat_qcq() ;
00396     (uu_div.va).set_etat_cf_qcq() ;
00397     ((uu_div.va).c_cf)->set_etat_qcq() ;
00398     ((uu_div.va).c_cf)->t[0]->set_etat_qcq() ;
00399 
00400     Valeur& udva = uu_div.va ;
00401     Mtbl_cf& udva_cf = *(udva.c_cf) ;
00402 
00403     // Initialization
00404     for (int k=0; k<=np; k+=2) {
00405       for (int j=0; j<nt; j++) {
00406     for (int i=0; i<nr; i++) {
00407       udva_cf.set(0, k, j, i) = 0 ;
00408       udva_cf.set(0, k+1, j, i) = 0 ;
00409     }
00410       }
00411     }
00412 
00413     for (int k=0; k<=np; k+=2) {
00414 
00415       int m = k / 2  ;
00416 
00417       for (int j=0; j<nt; j++) {
00418 
00419     int l ;
00420 
00421     if (m%2 == 0) {
00422       l = 2 * j ;
00423     }
00424     else
00425       l = 2 * j + 1 ;
00426 
00427     for (int i=0; i<nr; i++) {
00428 
00429       for (int k_deg=1; k_deg<=k_div; k_deg++) {
00430 
00431         udva_cf.set(0, k, j, i) = udva_cf(0, k, j, i)
00432           + alm_cos(m, l, k_deg-1) * cf_pil(l, i, k_deg-1) ;
00433         udva_cf.set(0, k+1, j, i) = udva_cf(0, k+1, j, i)
00434           + alm_sin(m, l, k_deg-1) * cf_pil(l, i, k_deg-1) ;
00435 
00436       }
00437     }
00438       }
00439     }
00440 
00441     uu_div.annule(nzet, nzm1) ;
00442 
00443     Base_val& base_uu_div = (uu_div.va).base ;
00444     for (int l=0; l<=nzm1; l++) {
00445       int base_uu_r = base_std.b[l] & MSQ_R ; 
00446       int base_uu_p = base_std.b[l] & MSQ_P ; 
00447 
00448       base_uu_div.b[l] = base_uu_r | T_LEG_P | base_uu_p ;  
00449     }
00450 
00451     udva_cf.base = base_uu_div ;  // copy of the base in the Mtbl_cf
00452 
00453     udva.ylm_i() ;
00454 
00455     // Changing the radial coordinate from "xi" to "r"
00456     // -----------------------------------------------
00457 
00458     udva = udva * alpha[0] * alpha[0] ;
00459 
00460     // ---------------------------------------------
00461     //      Construction of the total potential
00462     // ---------------------------------------------
00463 
00464     uu.set_etat_qcq() ;
00465     uu = uu_regu + uu_div ;
00466 
00467     // -------------------------------------------------------------------
00468     //      Construction of the derivative of the diverging potential
00469     // -------------------------------------------------------------------
00470 
00471     duu_div.set_etat_qcq() ; 
00472 
00473     duu_div.set(0).set_etat_qcq() ; 
00474     (duu_div.set(0).va).set_etat_cf_qcq() ;
00475     ((duu_div.set(0).va).c_cf)->set_etat_qcq() ;
00476     ((duu_div.set(0).va).c_cf)->t[0]->set_etat_qcq() ;
00477 
00478     duu_div.set(1).set_etat_qcq() ;
00479     (duu_div.set(1).va).set_etat_cf_qcq() ;
00480     ((duu_div.set(1).va).c_cf)->set_etat_qcq() ;
00481     ((duu_div.set(1).va).c_cf)->t[0]->set_etat_qcq() ;
00482 
00483     duu_div.set(2).set_etat_qcq() ;
00484     (duu_div.set(2).va).set_etat_cf_qcq() ;
00485     ((duu_div.set(2).va).c_cf)->set_etat_qcq() ;
00486     ((duu_div.set(2).va).c_cf)->t[0]->set_etat_qcq() ;
00487 
00488     Valeur& vr = duu_div.set(0).va ;
00489     Valeur& vt = duu_div.set(1).va ;
00490     Valeur& vp = duu_div.set(2).va ;
00491 
00492     Mtbl_cf& vr_cf = *(vr.c_cf) ;
00493     Mtbl_cf& vt_cf = *(vt.c_cf) ;
00494     Mtbl_cf& vp_cf = *(vp.c_cf) ;
00495 
00496     // -----------
00497     // Radial part
00498     // -----------
00499 
00500     Tbl cf_dril(2*nt, nr, k_div) ;
00501     cf_dril.set_etat_qcq() ;
00502 
00503     double* tmp3 = new double[nr] ;
00504 
00505     for (int k_deg=1; k_deg<=k_div; k_deg++) {
00506 
00507       for (int i=0; i<nr; i++) {
00508 
00509     double xi = grid.x[i] ;
00510     tmp3[i] = -2. * (aa + 1. + k_deg) * xi
00511                   * pow(1. - xi * xi, aa + k_deg) ;
00512 
00513       }
00514 
00515       cfrchebi(deg, dim, tmp3, dim, tmp3) ;
00516 
00517       for (int i=0; i<nr; i++) {
00518 
00519     cf_dril.set(0, i, k_deg-1) = tmp3[i] ;
00520 
00521       }
00522 
00523       for (int l=1; l<2*nt; l++) {
00524 
00525     for (int i=0; i<nr; i++) {
00526 
00527       double xi = grid.x[i] ;
00528       tmp3[i] = l * pow(xi, l - 1.) * pow(1. - xi * xi, aa + 1. + k_deg)
00529         -2. * (aa + 1. + k_deg) * pow(xi, l + 1.)
00530             * pow(1. - xi * xi, aa + k_deg) ;
00531 
00532     }
00533 
00534     if (l%2 == 0) {
00535       cfrchebi(deg, dim, tmp3, dim, tmp3) ;
00536     }
00537     else
00538       cfrchebp(deg, dim, tmp3, dim, tmp3) ;
00539 
00540     for (int i=0; i<nr; i++) {
00541 
00542       cf_dril.set(l, i, k_deg-1) = tmp3[i] ;
00543 
00544     }
00545       }
00546     }
00547 
00548     // Initialization
00549     for (int k=0; k<=np; k+=2) {
00550       for (int j=0; j<nt; j++) {
00551     for (int i=0; i<nr; i++) {
00552       vr_cf.set(0, k, j, i) = 0 ;
00553       vr_cf.set(0, k+1, j, i) = 0 ;
00554     }
00555       }
00556     }
00557 
00558     for (int k=0; k<=np; k+=2) {
00559 
00560       int m = k / 2  ;
00561 
00562       for (int j=0; j<nt; j++) {
00563 
00564     int l ;
00565 
00566     if (m%2 == 0) {
00567       l = 2 * j ;
00568     }
00569     else
00570       l = 2 * j + 1 ;
00571 
00572     for (int i=0; i<nr; i++) {
00573 
00574       for (int k_deg=1; k_deg<=k_div; k_deg++) {
00575 
00576         vr_cf.set(0, k, j, i) = vr_cf(0, k, j, i)
00577           + alm_cos(m, l, k_deg-1) * cf_dril(l, i, k_deg-1) ;
00578         vr_cf.set(0, k+1, j, i) = vr_cf(0, k+1, j, i)
00579           + alm_sin(m, l, k_deg-1) * cf_dril(l, i, k_deg-1) ;
00580 
00581       }
00582     }
00583       }
00584     }
00585 
00586     (duu_div.set(0)).annule(nzet, nzm1) ;
00587 
00588     // Reconstruction of the basis of the radial part
00589     // ----------------------------------------------
00590 
00591     Base_val& base_duu_div_r = vr.base ;
00592     for (int l=0; l<=nzm1; l++) {
00593       int base_duu_r_p = base_std.b[l] & MSQ_P ; 
00594 
00595       base_duu_div_r.b[l] = R_CHEBPIM_I | T_LEG_P | base_duu_r_p ;  
00596     }
00597 
00598     vr_cf.base = base_duu_div_r ;
00599     vr.ylm_i() ;
00600  
00601     const Coord& RR = dxdr ;
00602 
00603     // Changing the radial coordinate from "xi" to "r"
00604     // -----------------------------------------------
00605 
00606     Base_val sauve_base( vr.base ) ;
00607     vr = duu_div(0).va * alpha[0] * alpha[0] * RR ;
00608     vr.base = sauve_base ;
00609 
00610     // -------------------------
00611     // Polar and azimuthal parts
00612     // -------------------------
00613 
00614     Tbl cf_dpil(2*nt, nr, k_div) ;
00615     cf_dpil.set_etat_qcq() ;
00616 
00617     double* tmp4 = new double[nr] ;
00618 
00619     for (int k_deg=1; k_deg<=k_div; k_deg++) {
00620 
00621       for (int i=0; i<nr; i++) {
00622     tmp4[i] = 0 ;
00623       }
00624 
00625       cfrchebi(deg, dim, tmp4, dim, tmp4) ;
00626 
00627       for (int i=0; i<nr; i++) {
00628 
00629     cf_dpil.set(0, i, k_deg-1) = tmp4[i] ;
00630 
00631       }
00632 
00633       for (int l=1; l<2*nt; l++) {
00634 
00635     for (int i=0; i<nr; i++) {
00636 
00637       double xi = grid.x[i] ;
00638       tmp4[i] = pow(xi, l - 1.) * pow(1. - xi * xi, aa + 1. + k_deg) ;
00639 
00640     }
00641 
00642     if (l%2 == 0) {
00643       cfrchebi(deg, dim, tmp4, dim, tmp4) ;
00644     }
00645     else
00646       cfrchebp(deg, dim, tmp4, dim, tmp4) ;
00647 
00648     for (int i=0; i<nr; i++) {
00649 
00650       cf_dpil.set(l, i, k_deg-1) = tmp4[i] ;
00651 
00652     }
00653       }
00654     }
00655 
00656     // Initialization
00657     for (int k=0; k<=np; k+=2) {
00658       for (int j=0; j<nt; j++) {
00659     for (int i=0; i<nr; i++) {
00660       vt_cf.set(0, k, j, i) = 0 ;
00661       vt_cf.set(0, k+1, j, i) = 0 ;
00662       vp_cf.set(0, k, j, i) = 0 ;
00663       vp_cf.set(0, k+1, j, i) = 0 ;
00664     }
00665       }
00666     }
00667 
00668     for (int k=0; k<=np; k+=2) {
00669 
00670       int m = k / 2  ;
00671 
00672       for (int j=0; j<nt; j++) {
00673 
00674     int l ;
00675 
00676     if (m%2 == 0) {
00677       l = 2 * j ;
00678     }
00679     else
00680       l = 2 * j + 1 ;
00681 
00682     for (int i=0; i<nr; i++) {
00683 
00684       for (int k_deg=1; k_deg<=k_div; k_deg++) {
00685 
00686         vt_cf.set(0, k, j, i) = vt_cf(0, k, j, i)
00687           + alm_cos(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
00688         vt_cf.set(0, k+1, j, i) = vt_cf(0, k+1, j, i)
00689           + alm_sin(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
00690 
00691         vp_cf.set(0, k, j, i) = vp_cf(0, k, j, i)
00692           + alm_cos(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
00693         vp_cf.set(0, k+1, j, i) = vp_cf(0, k+1, j, i)
00694           + alm_sin(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
00695 
00696       }
00697     }
00698       }
00699     }
00700 
00701     (duu_div.set(1)).annule(nzet, nzm1) ;
00702     (duu_div.set(2)).annule(nzet, nzm1) ;
00703 
00704 
00705     // Reconstruction of the basis of the polar part
00706     // ---------------------------------------------
00707 
00708     Base_val& base_duu_div_p = vt.base ;
00709     for (int l=0; l<=nzm1; l++) {
00710       int base_duu_p_p = base_std.b[l] & MSQ_P ;
00711 
00712       base_duu_div_p.b[l] = R_CHEBPIM_I | T_LEG_P | base_duu_p_p ;
00713     }
00714 
00715     vt_cf.base = base_duu_div_p ;
00716     vt.ylm_i() ;
00717 
00718 
00719     // Reconstruction of the basis of the azimuthal part
00720     // -------------------------------------------------
00721 
00722     Base_val& base_duu_div_t = vp.base ;
00723     for (int l=0; l<=nzm1; l++) {
00724       int base_duu_t_p = base_std.b[l] & MSQ_P ;
00725 
00726       base_duu_div_t.b[l] = R_CHEBPIM_I | T_LEG_P | base_duu_t_p ;
00727     }
00728 
00729     vp_cf.base = base_duu_div_t ;
00730     vp.ylm_i() ;
00731 
00732 
00733     // Calculation of the derivatives
00734     // ------------------------------
00735 
00736     vt = (duu_div(1).va).dsdt() ;
00737 
00738     vp = (duu_div(2).va).stdsdp() ;
00739 
00740     // Changing the radial coordinate from "xi" to "r"
00741     // -----------------------------------------------
00742 
00743     vt = duu_div(1).va * alpha[0] ;
00744 
00745     vp = duu_div(2).va * alpha[0] ;
00746 
00747     // Set the basis of duu_div to the spherical one
00748     // ---------------------------------------------
00749 
00750     duu_div.set_triad( (*this).get_bvect_spher() ) ;
00751 
00752     delete [] tmp1 ;
00753     delete [] tmp2 ;
00754     delete [] tmp3 ;
00755     delete [] tmp4 ;
00756 
00757 
00758 }

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