LORENE
map_af_poisson_regu.C
1 /*
2  * Method of the class Map_af for the resolution of the scalar Poisson
3  * equation by using regularized source.
4  */
5 
6 /*
7  * Copyright (c) 2000-2001 Keisuke Taniguchi
8  *
9  * This file is part of LORENE.
10  *
11  * LORENE is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * LORENE is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with LORENE; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  *
25  */
26 
27 
28 
29 
30 /*
31  * $Id: map_af_poisson_regu.C,v 1.6 2016/12/05 16:17:57 j_novak Exp $
32  * $Log: map_af_poisson_regu.C,v $
33  * Revision 1.6 2016/12/05 16:17:57 j_novak
34  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
35  *
36  * Revision 1.5 2014/10/13 08:53:03 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.4 2014/10/06 15:13:12 j_novak
40  * Modified #include directives to use c++ syntax.
41  *
42  * Revision 1.3 2003/12/19 16:21:43 j_novak
43  * Shadow hunt
44  *
45  * Revision 1.2 2003/10/03 15:58:48 j_novak
46  * Cleaning of some headers
47  *
48  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
49  * LORENE
50  *
51  * Revision 2.13 2000/10/25 16:05:11 keisuke
52  * Remake for the arbitrary regularization degree (k_div).
53  *
54  * Revision 2.12 2000/10/06 15:31:41 keisuke
55  * Suppress assertions for nilm_cos and nilm_sin.
56  * Add warnings for nilm_cos and nilm_sin.
57  *
58  * Revision 2.11 2000/09/25 15:02:48 keisuke
59  * modify the derivative duu_div.
60  *
61  * Revision 2.10 2000/09/11 13:50:57 keisuke
62  * Set the basis of duu_div to the spherical one.
63  *
64  * Revision 2.9 2000/09/11 10:15:06 keisuke
65  * Change the method to reconstruct source_regu.
66  *
67  * Revision 2.8 2000/09/09 14:51:20 keisuke
68  * Suppress uu_regu.set_dzpuis(0).
69  *
70  * Revision 2.7 2000/09/07 15:29:50 keisuke
71  * Add a new argument Cmp& uu.
72  *
73  * Revision 2.6 2000/09/06 10:28:42 keisuke
74  * Modify the scaling for derivatives.
75  *
76  * Revision 2.5 2000/09/04 15:55:38 keisuke
77  * Include the polar and azimuthal parts of duu_div.
78  *
79  * Revision 2.4 2000/09/04 13:08:39 keisuke
80  * Change alpha[0] into mp_radial->dxdr.
81  *
82  * Revision 2.3 2000/09/01 08:55:55 keisuke
83  * Change val_r into alpha[0].
84  *
85  * Revision 2.2 2000/08/31 15:59:51 keisuke
86  * Modify the arguments.
87  *
88  * Revision 2.1 2000/08/28 16:11:44 keisuke
89  * Add "int nzet" in the argumant.
90  *
91  * Revision 2.0 2000/08/25 08:48:36 keisuke
92  * *** empty log message ***
93  *
94  *
95  * $Header: /cvsroot/Lorene/C++/Source/Map/map_af_poisson_regu.C,v 1.6 2016/12/05 16:17:57 j_novak Exp $
96  *
97  */
98 
99 // headers C
100 #include <cmath>
101 
102 // Header Lorene
103 #include "tenseur.h"
104 #include "matrice.h"
105 #include "param.h"
106 #include "proto.h"
107 
108 //******************************************************************
109 
110 namespace Lorene {
111 
112 void Map_af::poisson_regular(const Cmp& source, int k_div, int nzet,
113  double unsgam1, Param& par, Cmp& uu,
114  Cmp& uu_regu, Cmp& uu_div, Tenseur& duu_div,
115  Cmp& source_regu, Cmp& source_div) const {
116 
117 
118  assert(source.get_etat() != ETATNONDEF) ;
119  assert(source.get_mp()->get_mg() == mg) ;
120  assert(k_div > 0) ;
121 
122  double aa = unsgam1 ; // exponent of the specific enthalpy
123 
124  int nzm1 = mg->get_nzone() - 1;
125  int nr = mg->get_nr(0) ;
126  int nt = mg->get_nt(0) ;
127  int np = mg->get_np(0) ;
128 
129  assert(nr-k_div > 0) ;
130 
131  // --------------------------------------------
132  // Expansion of "source" by T_i Y_l^m
133  // --------------------------------------------
134 
135  // Expansion by cos(j \theta) and sin(j \theta) for theta direction
136  // ----------------------------------------------------------------
137 
138  const Valeur& sourva = source.va ;
139  assert(sourva.get_etat() == ETATQCQ) ;
140 
141  Valeur rho(sourva.get_mg()) ;
142  sourva.coef() ;
143  rho = *(sourva.c_cf) ;
144 
145  // Expansion by Legendre function for theta direction
146  // --------------------------------------------------
147 
148  rho.ylm() ;
149 
150  // Obtaining the coefficients of the given source
151  // ----------------------------------------------
152 
153  Tbl& ccf = *((rho.c_cf)->t[0]) ;
154 
155  Tbl nilm_cos(np/2+1, 2*nt, nr) ;
156  Tbl nilm_sin(np/2+1, 2*nt, nr) ;
157 
158  nilm_cos.set_etat_qcq() ;
159  nilm_sin.set_etat_qcq() ;
160 
161  for (int k=0; k<=np; k+=2) {
162 
163  int m = k / 2 ;
164 
165  for (int j=0; j<nt; j++) {
166 
167  int l ;
168  if(m%2 == 0) {
169  l = 2 * j ;
170  }
171  else
172  l = 2 * j + 1 ;
173 
174  for (int i=0; i<nr; i++) {
175 
176  nilm_cos.set(m, l, i) = ccf(k, j, i) ;
177  nilm_sin.set(m, l, i) = ccf(k+1, j, i) ;
178 
179  }
180  }
181  }
182 
183  // -----------------------------------------------------
184  // Expansion of "analytic source" by T_i Y_l^m
185  // -----------------------------------------------------
186 
187  const Grille3d& grid = *(mg->get_grille3d(0)) ;
188 
189  Tbl cf_cil(2*nt, nr, k_div) ;
190  cf_cil.set_etat_qcq() ;
191 
192  int deg[3] ;
193  int dim[3] ;
194 
195  deg[0] = 1 ;
196  deg[1] = 1 ;
197  deg[2] = nr ;
198  dim[0] = 1 ;
199  dim[1] = 1 ;
200  dim[2] = nr ;
201 
202  double* tmp1 = new double[nr] ;
203 
204  for (int k_deg=1; k_deg<=k_div; k_deg++) {
205 
206  for (int l=0; l<2*nt; l++) {
207 
208  for (int i=0; i<nr; i++) {
209 
210  double xi = grid.x[i] ;
211 
212  tmp1[i] = (aa + k_deg + 1.) *
213  ( -(4. * l + 6.) * pow(1. - xi * xi, aa + k_deg) * pow(xi, l)
214  + 4. * (aa + k_deg) * pow(1. - xi * xi, aa + k_deg - 1.) *
215  pow(xi, l + 2.) ) ;
216 
217  }
218 
219  if (l%2 == 0) {
220  cfrchebp(deg, dim, tmp1, dim, tmp1) ;
221  }
222  else
223  cfrchebi(deg, dim, tmp1, dim, tmp1) ;
224 
225  for (int i=0; i<nr; i++) {
226 
227  cf_cil.set(l, i, k_deg-1) = tmp1[i] ;
228 
229  }
230  }
231  }
232 
233  // Calculation of the coefficients : Solve the simultaneous equations
234  // -------------------------------
235 
236  Tbl alm_cos(np/2+1, 2*nt, k_div) ;
237  Tbl alm_sin(np/2+1, 2*nt, k_div) ;
238 
239  alm_cos.set_etat_qcq() ;
240  alm_sin.set_etat_qcq() ;
241 
242  Matrice matrix(k_div, k_div) ;
243  matrix.set_etat_qcq() ;
244 
245  Tbl rhs_cos(k_div) ;
246  Tbl rhs_sin(k_div) ;
247 
248  rhs_cos.set_etat_qcq() ;
249  rhs_sin.set_etat_qcq() ;
250 
251  for (int k=0; k<=np; k+=2) {
252 
253  int m = k / 2 ;
254 
255  for (int j=0; j<nt; j++) {
256 
257  int l ;
258  if(m%2 == 0) {
259  l = 2 * j ;
260  }
261  else
262  l = 2 * j + 1 ;
263 
264  for (int i=0; i<k_div; i++) {
265  for (int j2=0; j2<k_div; j2++) {
266  matrix.set(i, j2) = cf_cil(l, nr-1-i, j2) ;
267  }
268  }
269 
270  matrix.set_band(k_div, k_div) ;
271 
272  matrix.set_lu() ;
273 
274  for (int i=0; i<k_div; i++) {
275  rhs_cos.set(i) = nilm_cos(m, l, nr-1-i) ;
276  rhs_sin.set(i) = nilm_sin(m, l, nr-1-i) ;
277  }
278 
279  Tbl sol_cos = matrix.inverse(rhs_cos) ;
280  Tbl sol_sin = matrix.inverse(rhs_sin) ;
281 
282  for (int i=0; i<k_div; i++) {
283  alm_cos.set(m, l, i) = sol_cos(i) ;
284  alm_sin.set(m, l, i) = sol_sin(i) ;
285  }
286  }
287  }
288 
289  // -------------------------------------------------------
290  // Construction of the diverging analytic source
291  // -------------------------------------------------------
292 
293  source_div.set_etat_qcq() ;
294  (source_div.va).set_etat_cf_qcq() ;
295  (source_div.va).c_cf->set_etat_qcq() ;
296  (source_div.va).c_cf->t[0]->set_etat_qcq() ;
297 
298  Valeur& sdva = source_div.va ;
299  Mtbl_cf& sdva_cf = *(sdva.c_cf) ;
300 
301  // Initialization
302  for (int k=0; k<=np; k+=2) {
303  for (int j=0; j<nt; j++) {
304  for (int i=0; i<nr; i++) {
305  sdva_cf.set(0, k, j, i) = 0 ;
306  sdva_cf.set(0, k+1, j, i) = 0 ;
307  }
308  }
309  }
310 
311  for (int k=0; k<=np; k+=2) {
312 
313  int m = k / 2 ;
314 
315  for (int j=0; j<nt; j++) {
316 
317  int l ;
318 
319  if (m%2 == 0) {
320  l = 2 * j ;
321  }
322  else
323  l = 2 * j + 1 ;
324 
325  for (int i=0; i<nr; i++) {
326 
327  for (int k_deg=1; k_deg<=k_div; k_deg++) {
328 
329  sdva_cf.set(0, k, j, i) = sdva_cf(0, k, j, i)
330  + alm_cos(m, l, k_deg-1) * cf_cil(l, i, k_deg-1) ;
331  sdva_cf.set(0, k+1, j, i) = sdva_cf(0, k+1, j, i)
332  + alm_sin(m, l, k_deg-1) * cf_cil(l, i, k_deg-1) ;
333 
334  }
335  }
336  }
337  }
338 
339  source_div.annule(nzet, nzm1) ;
340 
341  Base_val base_std = mg->std_base_scal() ;
342 
343  Base_val& base_s_div = sdva.base ;
344  for (int l=0; l<=nzm1; l++) {
345  int base_s_div_r = base_std.b[l] & MSQ_R ;
346  int base_s_div_p = base_std.b[l] & MSQ_P ;
347 
348  base_s_div.b[l] = base_s_div_r | T_LEG_P | base_s_div_p ;
349  }
350 
351  sdva_cf.base = base_s_div ; // copy of the base in the Mtbl_cf
352 
353  sdva.ylm_i() ;
354 
355  // ------------------------------------------------
356  // Construction of the regularized source
357  // ------------------------------------------------
358 
359  source_regu.set_etat_qcq() ;
360  source_regu = source - source_div ;
361 
362  // -------------------------------------------------------------
363  // Solving the Poisson equation for regularized source
364  // -------------------------------------------------------------
365 
366  source_regu.set_dzpuis(4) ;
367 
368  assert(uu_regu.get_mp()->get_mg() == mg) ;
369 
370  (*this).poisson(source_regu, par, uu_regu) ;
371 
372  // ----------------------------------------------------------
373  // Construction of the diverging analytic potential
374  // ----------------------------------------------------------
375 
376  Tbl cf_pil(2*nt, nr, k_div) ;
377  cf_pil.set_etat_qcq() ;
378 
379  double* tmp2 = new double[nr] ;
380 
381  for (int k_deg=1; k_deg<=k_div; k_deg++) {
382 
383  for (int l=0; l<2*nt; l++) {
384 
385  for (int i=0; i<nr; i++) {
386 
387  double xi = grid.x[i] ;
388  tmp2[i] = pow(xi, l) * pow(1. - xi * xi, aa + 1. + k_deg) ;
389 
390  }
391 
392  if (l%2 == 0) {
393  cfrchebp(deg, dim, tmp2, dim, tmp2) ;
394  }
395  else
396  cfrchebi(deg, dim, tmp2, dim, tmp2) ;
397 
398  for (int i=0; i<nr; i++) {
399 
400  cf_pil.set(l, i, k_deg-1) = tmp2[i] ;
401 
402  }
403  }
404  }
405 
406  uu_div.set_etat_qcq() ;
407  (uu_div.va).set_etat_cf_qcq() ;
408  ((uu_div.va).c_cf)->set_etat_qcq() ;
409  ((uu_div.va).c_cf)->t[0]->set_etat_qcq() ;
410 
411  Valeur& udva = uu_div.va ;
412  Mtbl_cf& udva_cf = *(udva.c_cf) ;
413 
414  // Initialization
415  for (int k=0; k<=np; k+=2) {
416  for (int j=0; j<nt; j++) {
417  for (int i=0; i<nr; i++) {
418  udva_cf.set(0, k, j, i) = 0 ;
419  udva_cf.set(0, k+1, j, i) = 0 ;
420  }
421  }
422  }
423 
424  for (int k=0; k<=np; k+=2) {
425 
426  int m = k / 2 ;
427 
428  for (int j=0; j<nt; j++) {
429 
430  int l ;
431 
432  if (m%2 == 0) {
433  l = 2 * j ;
434  }
435  else
436  l = 2 * j + 1 ;
437 
438  for (int i=0; i<nr; i++) {
439 
440  for (int k_deg=1; k_deg<=k_div; k_deg++) {
441 
442  udva_cf.set(0, k, j, i) = udva_cf(0, k, j, i)
443  + alm_cos(m, l, k_deg-1) * cf_pil(l, i, k_deg-1) ;
444  udva_cf.set(0, k+1, j, i) = udva_cf(0, k+1, j, i)
445  + alm_sin(m, l, k_deg-1) * cf_pil(l, i, k_deg-1) ;
446 
447  }
448  }
449  }
450  }
451 
452  uu_div.annule(nzet, nzm1) ;
453 
454  Base_val& base_uu_div = (uu_div.va).base ;
455  for (int l=0; l<=nzm1; l++) {
456  int base_uu_r = base_std.b[l] & MSQ_R ;
457  int base_uu_p = base_std.b[l] & MSQ_P ;
458 
459  base_uu_div.b[l] = base_uu_r | T_LEG_P | base_uu_p ;
460  }
461 
462  udva_cf.base = base_uu_div ; // copy of the base in the Mtbl_cf
463 
464  udva.ylm_i() ;
465 
466  // Changing the radial coordinate from "xi" to "r"
467  // -----------------------------------------------
468 
469  udva = udva * alpha[0] * alpha[0] ;
470 
471  // ---------------------------------------------
472  // Construction of the total potential
473  // ---------------------------------------------
474 
475  uu.set_etat_qcq() ;
476  uu = uu_regu + uu_div ;
477 
478  // -------------------------------------------------------------------
479  // Construction of the derivative of the diverging potential
480  // -------------------------------------------------------------------
481 
482  duu_div.set_etat_qcq() ;
483 
484  duu_div.set(0).set_etat_qcq() ;
485  (duu_div.set(0).va).set_etat_cf_qcq() ;
486  ((duu_div.set(0).va).c_cf)->set_etat_qcq() ;
487  ((duu_div.set(0).va).c_cf)->t[0]->set_etat_qcq() ;
488 
489  duu_div.set(1).set_etat_qcq() ;
490  (duu_div.set(1).va).set_etat_cf_qcq() ;
491  ((duu_div.set(1).va).c_cf)->set_etat_qcq() ;
492  ((duu_div.set(1).va).c_cf)->t[0]->set_etat_qcq() ;
493 
494  duu_div.set(2).set_etat_qcq() ;
495  (duu_div.set(2).va).set_etat_cf_qcq() ;
496  ((duu_div.set(2).va).c_cf)->set_etat_qcq() ;
497  ((duu_div.set(2).va).c_cf)->t[0]->set_etat_qcq() ;
498 
499  Valeur& vr = duu_div.set(0).va ;
500  Valeur& vt = duu_div.set(1).va ;
501  Valeur& vp = duu_div.set(2).va ;
502 
503  Mtbl_cf& vr_cf = *(vr.c_cf) ;
504  Mtbl_cf& vt_cf = *(vt.c_cf) ;
505  Mtbl_cf& vp_cf = *(vp.c_cf) ;
506 
507  // -----------
508  // Radial part
509  // -----------
510 
511  Tbl cf_dril(2*nt, nr, k_div) ;
512  cf_dril.set_etat_qcq() ;
513 
514  double* tmp3 = new double[nr] ;
515 
516  for (int k_deg=1; k_deg<=k_div; k_deg++) {
517 
518  for (int i=0; i<nr; i++) {
519 
520  double xi = grid.x[i] ;
521  tmp3[i] = -2. * (aa + 1. + k_deg) * xi
522  * pow(1. - xi * xi, aa + k_deg) ;
523 
524  }
525 
526  cfrchebi(deg, dim, tmp3, dim, tmp3) ;
527 
528  for (int i=0; i<nr; i++) {
529 
530  cf_dril.set(0, i, k_deg-1) = tmp3[i] ;
531 
532  }
533 
534  for (int l=1; l<2*nt; l++) {
535 
536  for (int i=0; i<nr; i++) {
537 
538  double xi = grid.x[i] ;
539  tmp3[i] = l * pow(xi, l - 1.) * pow(1. - xi * xi, aa + 1. + k_deg)
540  -2. * (aa + 1. + k_deg) * pow(xi, l + 1.)
541  * pow(1. - xi * xi, aa + k_deg) ;
542 
543  }
544 
545  if (l%2 == 0) {
546  cfrchebi(deg, dim, tmp3, dim, tmp3) ;
547  }
548  else
549  cfrchebp(deg, dim, tmp3, dim, tmp3) ;
550 
551  for (int i=0; i<nr; i++) {
552 
553  cf_dril.set(l, i, k_deg-1) = tmp3[i] ;
554 
555  }
556  }
557  }
558 
559  // Initialization
560  for (int k=0; k<=np; k+=2) {
561  for (int j=0; j<nt; j++) {
562  for (int i=0; i<nr; i++) {
563  vr_cf.set(0, k, j, i) = 0 ;
564  vr_cf.set(0, k+1, j, i) = 0 ;
565  }
566  }
567  }
568 
569  for (int k=0; k<=np; k+=2) {
570 
571  int m = k / 2 ;
572 
573  for (int j=0; j<nt; j++) {
574 
575  int l ;
576 
577  if (m%2 == 0) {
578  l = 2 * j ;
579  }
580  else
581  l = 2 * j + 1 ;
582 
583  for (int i=0; i<nr; i++) {
584 
585  for (int k_deg=1; k_deg<=k_div; k_deg++) {
586 
587  vr_cf.set(0, k, j, i) = vr_cf(0, k, j, i)
588  + alm_cos(m, l, k_deg-1) * cf_dril(l, i, k_deg-1) ;
589  vr_cf.set(0, k+1, j, i) = vr_cf(0, k+1, j, i)
590  + alm_sin(m, l, k_deg-1) * cf_dril(l, i, k_deg-1) ;
591 
592  }
593  }
594  }
595  }
596 
597  (duu_div.set(0)).annule(nzet, nzm1) ;
598 
599  // Reconstruction of the basis of the radial part
600  // ----------------------------------------------
601 
602  Base_val& base_duu_div_r = vr.base ;
603  for (int l=0; l<=nzm1; l++) {
604  int base_duu_r_p = base_std.b[l] & MSQ_P ;
605 
606  base_duu_div_r.b[l] = R_CHEBPIM_I | T_LEG_P | base_duu_r_p ;
607  }
608 
609  vr_cf.base = base_duu_div_r ;
610  vr.ylm_i() ;
611 
612  const Coord& RR = dxdr ;
613 
614  // Changing the radial coordinate from "xi" to "r"
615  // -----------------------------------------------
616 
617  Base_val sauve_base( vr.base ) ;
618  vr = duu_div(0).va * alpha[0] * alpha[0] * RR ;
619  vr.base = sauve_base ;
620 
621  // -------------------------
622  // Polar and azimuthal parts
623  // -------------------------
624 
625  Tbl cf_dpil(2*nt, nr, k_div) ;
626  cf_dpil.set_etat_qcq() ;
627 
628  double* tmp4 = new double[nr] ;
629 
630  for (int k_deg=1; k_deg<=k_div; k_deg++) {
631 
632  for (int i=0; i<nr; i++) {
633  tmp4[i] = 0 ;
634  }
635 
636  cfrchebi(deg, dim, tmp4, dim, tmp4) ;
637 
638  for (int i=0; i<nr; i++) {
639 
640  cf_dpil.set(0, i, k_deg-1) = tmp4[i] ;
641 
642  }
643 
644  for (int l=1; l<2*nt; l++) {
645 
646  for (int i=0; i<nr; i++) {
647 
648  double xi = grid.x[i] ;
649  tmp4[i] = pow(xi, l - 1.) * pow(1. - xi * xi, aa + 1. + k_deg) ;
650 
651  }
652 
653  if (l%2 == 0) {
654  cfrchebi(deg, dim, tmp4, dim, tmp4) ;
655  }
656  else
657  cfrchebp(deg, dim, tmp4, dim, tmp4) ;
658 
659  for (int i=0; i<nr; i++) {
660 
661  cf_dpil.set(l, i, k_deg-1) = tmp4[i] ;
662 
663  }
664  }
665  }
666 
667  // Initialization
668  for (int k=0; k<=np; k+=2) {
669  for (int j=0; j<nt; j++) {
670  for (int i=0; i<nr; i++) {
671  vt_cf.set(0, k, j, i) = 0 ;
672  vt_cf.set(0, k+1, j, i) = 0 ;
673  vp_cf.set(0, k, j, i) = 0 ;
674  vp_cf.set(0, k+1, j, i) = 0 ;
675  }
676  }
677  }
678 
679  for (int k=0; k<=np; k+=2) {
680 
681  int m = k / 2 ;
682 
683  for (int j=0; j<nt; j++) {
684 
685  int l ;
686 
687  if (m%2 == 0) {
688  l = 2 * j ;
689  }
690  else
691  l = 2 * j + 1 ;
692 
693  for (int i=0; i<nr; i++) {
694 
695  for (int k_deg=1; k_deg<=k_div; k_deg++) {
696 
697  vt_cf.set(0, k, j, i) = vt_cf(0, k, j, i)
698  + alm_cos(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
699  vt_cf.set(0, k+1, j, i) = vt_cf(0, k+1, j, i)
700  + alm_sin(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
701 
702  vp_cf.set(0, k, j, i) = vp_cf(0, k, j, i)
703  + alm_cos(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
704  vp_cf.set(0, k+1, j, i) = vp_cf(0, k+1, j, i)
705  + alm_sin(m, l, k_deg-1) * cf_dpil(l, i, k_deg-1) ;
706 
707  }
708  }
709  }
710  }
711 
712  (duu_div.set(1)).annule(nzet, nzm1) ;
713  (duu_div.set(2)).annule(nzet, nzm1) ;
714 
715 
716  // Reconstruction of the basis of the polar part
717  // ---------------------------------------------
718 
719  Base_val& base_duu_div_p = vt.base ;
720  for (int l=0; l<=nzm1; l++) {
721  int base_duu_p_p = base_std.b[l] & MSQ_P ;
722 
723  base_duu_div_p.b[l] = R_CHEBPIM_I | T_LEG_P | base_duu_p_p ;
724  }
725 
726  vt_cf.base = base_duu_div_p ;
727  vt.ylm_i() ;
728 
729 
730  // Reconstruction of the basis of the azimuthal part
731  // -------------------------------------------------
732 
733  Base_val& base_duu_div_t = vp.base ;
734  for (int l=0; l<=nzm1; l++) {
735  int base_duu_t_p = base_std.b[l] & MSQ_P ;
736 
737  base_duu_div_t.b[l] = R_CHEBPIM_I | T_LEG_P | base_duu_t_p ;
738  }
739 
740  vp_cf.base = base_duu_div_t ;
741  vp.ylm_i() ;
742 
743 
744  // Calculation of the derivatives
745  // ------------------------------
746 
747  vt = (duu_div(1).va).dsdt() ;
748 
749  vp = (duu_div(2).va).stdsdp() ;
750 
751  // Changing the radial coordinate from "xi" to "r"
752  // -----------------------------------------------
753 
754  vt = duu_div(1).va * alpha[0] ;
755 
756  vp = duu_div(2).va * alpha[0] ;
757 
758  // Set the basis of duu_div to the spherical one
759  // ---------------------------------------------
760 
761  duu_div.set_triad( (*this).get_bvect_spher() ) ;
762 
763  delete [] tmp1 ;
764  delete [] tmp2 ;
765  delete [] tmp3 ;
766  delete [] tmp4 ;
767 
768 
769 }
770 }
const Map * get_mp() const
Returns the mapping.
Definition: cmp.h:901
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
Definition: grilles.h:517
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition: valeur.h:312
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
void ylm_i()
Inverse of ylm()
Definition: valeur_ylm_i.C:134
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
Definition: tenseur.C:690
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:479
void coef() const
Computes the coeffcients of *this.
Definition: valeur_coef.C:151
void annule(int l)
Sets the Cmp to zero in a given domain.
Definition: cmp.C:351
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
Definition: map.h:2054
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Definition: matrice.C:395
Lorene prototypes.
Definition: app_hor.h:67
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Definition: mtbl_cf.h:304
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
Definition: matrice.C:427
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
int get_etat() const
Returns the logical state.
Definition: cmp.h:899
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
#define MSQ_P
Extraction de l&#39;info sur Phi.
Definition: type_parite.h:156
virtual void poisson_regular(const Cmp &source, int k_div, int nzet, double unsgam1, Param &par, Cmp &uu, Cmp &uu_regu, Cmp &uu_div, Tenseur &duu_div, Cmp &source_regu, Cmp &source_div) const
Computes the solution of a scalar Poisson equation.
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
double * x
Array of values of at the nr collocation points.
Definition: grilles.h:215
virtual void stdsdp(const Scalar &uu, Scalar &resu) const
Computes of a Scalar.
Definition: map_af_deriv.C:826
const Mg3d * get_mg() const
Returns the Mg3d on which the this is defined.
Definition: valeur.h:763
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
int get_etat() const
Returns the logical state.
Definition: valeur.h:760
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:840
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition: map.h:1581
Matrix handling.
Definition: matrice.h:152
Base_val base
Bases on which the spectral expansion is performed.
Definition: valeur.h:315
int * b
Array (size: nzone ) of the spectral basis in each domain.
Definition: base_val.h:334
#define MSQ_R
Extraction de l&#39;info sur R.
Definition: type_parite.h:152
Parameter storage.
Definition: param.h:125
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: cmp.C:307
double & set(int j, int i)
Read/write of a particuliar element.
Definition: matrice.h:277
Active physical coordinates and mapping derivatives.
Definition: coord.h:90
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
Definition: type_parite.h:178
void set_band(int up, int low) const
Calculate the band storage of *std.
Definition: matrice.C:367
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Definition: map.h:694
Bases of the spectral expansions.
Definition: base_val.h:325
#define T_LEG_P
fct. de Legendre associees paires
Definition: type_parite.h:216
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
Coefficients storage for the multi-domain spectral method.
Definition: mtbl_cf.h:196
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: matrice.C:178
Base_val base
Bases of the spectral expansions.
Definition: mtbl_cf.h:210
void set_dzpuis(int)
Set a value to dzpuis.
Definition: cmp.C:657
Basic array class.
Definition: tbl.h:164
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:652
Valeur va
The numerical value of the Cmp.
Definition: cmp.h:464
virtual void dsdt(const Scalar &uu, Scalar &resu) const
Computes of a Scalar.
Definition: map_af_deriv.C:800
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
3D grid class in one domain.
Definition: grilles.h:200