LORENE
map_et_poisson.C
1/*
2 * Method of the class Map_et for the (iterative) resolution of the scalar
3 * Poisson equation.
4 *
5 * (see file map.h for the documentation).
6 *
7 */
8
9/*
10 * Copyright (c) 2004 Francois Limousin
11 * Copyright (c) 1999-2003 Eric Gourgoulhon
12 * Copyright (c) 2000-2001 Philippe Grandclement
13 *
14 * This file is part of LORENE.
15 *
16 * LORENE is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * LORENE is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with LORENE; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 */
31
32
33
34
35
36/*
37 * $Id: map_et_poisson.C,v 1.9 2023/05/26 15:42:30 g_servignat Exp $
38 * $Log: map_et_poisson.C,v $
39 * Revision 1.9 2023/05/26 15:42:30 g_servignat
40 * Added c_est_pas_fait() to poisson_angu(Cmp)
41 *
42 * Revision 1.8 2016/12/05 16:17:58 j_novak
43 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
44 *
45 * Revision 1.7 2014/10/13 08:53:05 j_novak
46 * Lorene classes and functions now belong to the namespace Lorene.
47 *
48 * Revision 1.6 2005/08/25 12:14:09 p_grandclement
49 * Addition of a new method to solve the scalar Poisson equation, based on a multi-domain Tau-method
50 *
51 * Revision 1.5 2005/04/04 21:31:31 e_gourgoulhon
52 * Added argument lambda to method poisson_angu
53 * to deal with the generalized angular Poisson equation:
54 * Lap_ang u + lambda u = source.
55 *
56 * Revision 1.4 2004/06/22 12:20:17 j_novak
57 * *** empty log message ***
58 *
59 * Revision 1.3 2004/05/25 14:28:01 f_limousin
60 * First version of method Map_et::poisson_angu().
61 *
62 * Revision 1.2 2003/10/15 21:11:26 e_gourgoulhon
63 * Added method poisson_angu.
64 *
65 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
66 * LORENE
67 *
68 * Revision 1.7 2000/05/22 14:55:30 phil
69 * ajout du cas dzpuis = 3
70 *
71 * Revision 1.6 2000/03/30 09:18:37 eric
72 * Modifs affichage.
73 *
74 * Revision 1.5 2000/03/29 12:01:38 eric
75 * *** empty log message ***
76 *
77 * Revision 1.4 2000/03/29 11:48:09 eric
78 * Modifs affichage.
79 *
80 * Revision 1.3 2000/03/10 15:48:25 eric
81 * MODIFS IMPORTANTES:
82 * ssj est desormais traitee comme un Cmp (et non plus une Valeur) ce qui
83 * permet un traitement automatique du dzpuis associe.
84 * Traitement de dzpuis.
85 *
86 * Revision 1.2 2000/03/07 16:50:57 eric
87 * Possibilite d'avoir une source avec dzpuis = 2.
88 *
89 * Revision 1.1 1999/12/22 17:11:24 eric
90 * Initial revision
91 *
92 *
93 * $Header: /cvsroot/Lorene/C++/Source/Map/map_et_poisson.C,v 1.9 2023/05/26 15:42:30 g_servignat Exp $
94 *
95 */
96
97// Header Lorene:
98#include "map.h"
99#include "cmp.h"
100#include "scalar.h"
101#include "param.h"
102#include "graphique.h"
103
104//*****************************************************************************
105
106namespace Lorene {
107
108void Map_et::poisson(const Cmp& source, Param& par, Cmp& uu) const {
109
110 assert(source.get_etat() != ETATNONDEF) ;
111 assert(source.get_mp() == this) ;
112
113 assert( source.check_dzpuis(2) || source.check_dzpuis(4)
114 || source.check_dzpuis(3)) ;
115
116 assert(uu.get_mp() == this) ;
117 assert(uu.check_dzpuis(0)) ;
118
119 int nz = mg->get_nzone() ;
120 int nzm1 = nz - 1 ;
121
122 // Indicator of existence of a compactified external domain
123 bool zec = false ;
124 if (mg->get_type_r(nzm1) == UNSURR) {
125 zec = true ;
126 }
127
128 //-------------------------------
129 // Computation of the prefactor a ---> Cmp apre
130 //-------------------------------
131
132 Mtbl unjj = 1 + srdrdt*srdrdt + srstdrdp*srstdrdp ;
133
134 Mtbl apre1(*mg) ;
135 apre1.set_etat_qcq() ;
136 for (int l=0; l<nz; l++) {
137 *(apre1.t[l]) = alpha[l]*alpha[l] ;
138 }
139
140 apre1 = apre1 * dxdr * dxdr * unjj ;
141
142 Cmp apre(*this) ;
143 apre = apre1 ;
144
145 Tbl amax0 = max(apre1) ; // maximum values in each domain
146
147 // The maximum values of a in each domain are put in a Mtbl
148 Mtbl amax1(*mg) ;
149 amax1.set_etat_qcq() ;
150 for (int l=0; l<nz; l++) {
151 *(amax1.t[l]) = amax0(l) ;
152 }
153
154 Cmp amax(*this) ;
155 amax = amax1 ;
156
157
158 //-------------------
159 // Initializations
160 //-------------------
161
162 int nitermax = par.get_int() ;
163 int& niter = par.get_int_mod() ;
164 double lambda = par.get_double() ;
165 double unmlambda = 1. - lambda ;
166 double precis = par.get_double(1) ;
167
168 Cmp& ssj = par.get_cmp_mod() ;
169
170 Cmp ssjm1 = ssj ;
171 Cmp ssjm2 = ssjm1 ;
172
173 Valeur& vuu = uu.va ;
174
175 Valeur vuujm1(*mg) ;
176 if (uu.get_etat() == ETATZERO) {
177 vuujm1 = 1 ; // to take relative differences
178 vuujm1.set_base( vuu.base ) ;
179 }
180 else{
181 vuujm1 = vuu ;
182 }
183
184 // Affine mapping for the Laplacian-tilde
185
186 Map_af mpaff(*this) ;
187 Param par_nul ;
188
189 cout << "Map_et::poisson : relat. diff. u^J <-> u^{J-1} : " << endl ;
190
191//==========================================================================
192//==========================================================================
193// Start of iteration
194//==========================================================================
195//==========================================================================
196
197 Tbl tdiff(nz) ;
198 double diff ;
199 niter = 0 ;
200
201 do {
202
203 //====================================================================
204 // Computation of R(u) (the result is put in uu)
205 //====================================================================
206
207
208 //-----------------------
209 // First operations on uu
210 //-----------------------
211
212 Valeur duudx = (uu.va).dsdx() ; // d/dx
213
214 const Valeur& d2uudtdx = duudx.dsdt() ; // d^2/dxdtheta
215
216 const Valeur& std2uudpdx = duudx.stdsdp() ; // 1/sin(theta) d^2/dxdphi
217
218 //------------------
219 // Angular Laplacian
220 //------------------
221
222 Valeur sxlapang = uu.va ;
223
224 sxlapang.ylm() ;
225
226 sxlapang = sxlapang.lapang() ;
227
228 sxlapang = sxlapang.sx() ; // Lap_ang(uu) /x in the nucleus
229 // Lap_ang(uu) in the shells
230 // Lap_ang(uu) /(x-1) in the ZEC
231
232 //---------------------------------------------------------------
233 // Computation of
234 // [ 2 /(dRdx) ( A - 1 ) duu/dx + 1/R (B - 1) Lap_ang(uu) ] / x
235 //
236 // with A = 1/(dRdx) R/(x+beta_l/alpha_l) unjj
237 // B = [1/(dRdx) R/(x+beta_l/alpha_l)]^2 unjj
238 //
239 // The result is put in uu (via vuu)
240 //---------------------------------------------------------------
241
242 Valeur varduudx = duudx ;
243
244 if (zec) {
245 varduudx.annule(nzm1) ; // term in d/dx set to zero in the ZEC
246 }
247
248 uu.set_etat_qcq() ;
249
250 Base_val sauve_base = varduudx.base ;
251
252 vuu = 2. * dxdr * ( rsxdxdr * unjj - 1.) * varduudx
253 + ( rsxdxdr*rsxdxdr * unjj - 1.) * xsr * sxlapang ;
254
255 vuu.set_base(sauve_base) ;
256
257 vuu = vuu.sx() ;
258
259 //---------------------------------------
260 // Computation of R(u)
261 //
262 // The result is put in uu (via vuu)
263 //---------------------------------------
264
265
266 sauve_base = vuu.base ;
267
268 vuu = xsr * vuu
269 + 2. * dxdr * ( sr2drdt * d2uudtdx
270 + sr2stdrdp * std2uudpdx ) ;
271
272 vuu += dxdr * ( lapr_tp + dxdr * (
273 dxdr* unjj * d2rdx2
274 - 2. * ( sr2drdt * d2rdtdx + sr2stdrdp * sstd2rdpdx ) )
275 ) * duudx ;
276
277 vuu.set_base(sauve_base) ;
278
279 // Since the assignment is performed on vuu (uu.va), the treatment
280 // of uu.dzpuis must be performed by hand:
281
282 uu.set_dzpuis(4) ;
283
284 if (source.get_dzpuis() == 2) {
285 uu.dec2_dzpuis() ; // uu.dzpuis: 4 -> 2
286 }
287
288 if (source.get_dzpuis() == 3) {
289 uu.dec_dzpuis() ; //uu.dzpuis 4 -> 3
290 }
291
292 //====================================================================
293 // Computation of the effective source s^J of the ``affine''
294 // Poisson equation
295 //====================================================================
296
297 ssj = lambda * ssjm1 + unmlambda * ssjm2 ;
298
299 ssj = ( source + uu + (amax - apre) * ssj ) / amax ;
300
301 (ssj.va).set_base((source.va).base) ;
302
303 //====================================================================
304 // Resolution of the ``affine'' Poisson equation
305 //====================================================================
306
307 if ( source.get_dzpuis() == 0 ){
308 ssj.set_dzpuis( 4 ) ;
309 }
310 else {
311 ssj.set_dzpuis( source.get_dzpuis() ) ; // Choice of the resolution
312 // dzpuis = 2, 3 or 4
313 }
314
315 assert( uu.check_dzpuis( ssj.get_dzpuis() ) ) ;
316
317 mpaff.poisson(ssj, par_nul, uu) ;
318
319 tdiff = diffrel(vuu, vuujm1) ;
320
321 diff = max(tdiff) ;
322
323
324 cout << " step " << niter << " : " ;
325 for (int l=0; l<nz; l++) {
326 cout << tdiff(l) << " " ;
327 }
328 cout << endl ;
329
330 //=================================
331 // Updates for the next iteration
332 //=================================
333
334 ssjm2 = ssjm1 ;
335 ssjm1 = ssj ;
336 vuujm1 = vuu ;
337
338 niter++ ;
339
340 } // End of iteration
341 while ( (diff > precis) && (niter < nitermax) ) ;
342
343//==========================================================================
344//==========================================================================
345// End of iteration
346//==========================================================================
347//==========================================================================
348
349}
350
351
352
353//*****************************************************************************
354// VERSION WITH A TAU METHOD
355//*****************************************************************************
356
357void Map_et::poisson_tau(const Cmp& source, Param& par, Cmp& uu) const {
358
359 assert(source.get_etat() != ETATNONDEF) ;
360 assert(source.get_mp() == this) ;
361
362 assert( source.check_dzpuis(2) || source.check_dzpuis(4)
363 || source.check_dzpuis(3)) ;
364
365 assert(uu.get_mp() == this) ;
366 assert(uu.check_dzpuis(0)) ;
367
368 int nz = mg->get_nzone() ;
369 int nzm1 = nz - 1 ;
370
371 // Indicator of existence of a compactified external domain
372 bool zec = false ;
373 if (mg->get_type_r(nzm1) == UNSURR) {
374 zec = true ;
375 }
376
377 //-------------------------------
378 // Computation of the prefactor a ---> Cmp apre
379 //-------------------------------
380
381 Mtbl unjj = 1 + srdrdt*srdrdt + srstdrdp*srstdrdp ;
382
383 Mtbl apre1(*mg) ;
384 apre1.set_etat_qcq() ;
385 for (int l=0; l<nz; l++) {
386 *(apre1.t[l]) = alpha[l]*alpha[l] ;
387 }
388
389 apre1 = apre1 * dxdr * dxdr * unjj ;
390
391 Cmp apre(*this) ;
392 apre = apre1 ;
393
394 Tbl amax0 = max(apre1) ; // maximum values in each domain
395
396 // The maximum values of a in each domain are put in a Mtbl
397 Mtbl amax1(*mg) ;
398 amax1.set_etat_qcq() ;
399 for (int l=0; l<nz; l++) {
400 *(amax1.t[l]) = amax0(l) ;
401 }
402
403 Cmp amax(*this) ;
404 amax = amax1 ;
405
406
407 //-------------------
408 // Initializations
409 //-------------------
410
411 int nitermax = par.get_int() ;
412 int& niter = par.get_int_mod() ;
413 double lambda = par.get_double() ;
414 double unmlambda = 1. - lambda ;
415 double precis = par.get_double(1) ;
416
417 Cmp& ssj = par.get_cmp_mod() ;
418
419 Cmp ssjm1 = ssj ;
420 Cmp ssjm2 = ssjm1 ;
421
422 Valeur& vuu = uu.va ;
423
424 Valeur vuujm1(*mg) ;
425 if (uu.get_etat() == ETATZERO) {
426 vuujm1 = 1 ; // to take relative differences
427 vuujm1.set_base( vuu.base ) ;
428 }
429 else{
430 vuujm1 = vuu ;
431 }
432
433 // Affine mapping for the Laplacian-tilde
434
435 Map_af mpaff(*this) ;
436 Param par_nul ;
437
438 cout << "Map_et::poisson_tau : relat. diff. u^J <-> u^{J-1} : " << endl ;
439
440//==========================================================================
441//==========================================================================
442// Start of iteration
443//==========================================================================
444//==========================================================================
445
446 Tbl tdiff(nz) ;
447 double diff ;
448 niter = 0 ;
449
450 do {
451
452 //====================================================================
453 // Computation of R(u) (the result is put in uu)
454 //====================================================================
455
456
457 //-----------------------
458 // First operations on uu
459 //-----------------------
460
461 Valeur duudx = (uu.va).dsdx() ; // d/dx
462
463 const Valeur& d2uudtdx = duudx.dsdt() ; // d^2/dxdtheta
464
465 const Valeur& std2uudpdx = duudx.stdsdp() ; // 1/sin(theta) d^2/dxdphi
466
467 //------------------
468 // Angular Laplacian
469 //------------------
470
471 Valeur sxlapang = uu.va ;
472
473 sxlapang.ylm() ;
474
475 sxlapang = sxlapang.lapang() ;
476
477 sxlapang = sxlapang.sx() ; // Lap_ang(uu) /x in the nucleus
478 // Lap_ang(uu) in the shells
479 // Lap_ang(uu) /(x-1) in the ZEC
480
481 //---------------------------------------------------------------
482 // Computation of
483 // [ 2 /(dRdx) ( A - 1 ) duu/dx + 1/R (B - 1) Lap_ang(uu) ] / x
484 //
485 // with A = 1/(dRdx) R/(x+beta_l/alpha_l) unjj
486 // B = [1/(dRdx) R/(x+beta_l/alpha_l)]^2 unjj
487 //
488 // The result is put in uu (via vuu)
489 //---------------------------------------------------------------
490
491 Valeur varduudx = duudx ;
492
493 if (zec) {
494 varduudx.annule(nzm1) ; // term in d/dx set to zero in the ZEC
495 }
496
497 uu.set_etat_qcq() ;
498
499 Base_val sauve_base = varduudx.base ;
500
501 vuu = 2. * dxdr * ( rsxdxdr * unjj - 1.) * varduudx
502 + ( rsxdxdr*rsxdxdr * unjj - 1.) * xsr * sxlapang ;
503
504 vuu.set_base(sauve_base) ;
505
506 vuu = vuu.sx() ;
507
508 //---------------------------------------
509 // Computation of R(u)
510 //
511 // The result is put in uu (via vuu)
512 //---------------------------------------
513
514
515 sauve_base = vuu.base ;
516
517 vuu = xsr * vuu
518 + 2. * dxdr * ( sr2drdt * d2uudtdx
519 + sr2stdrdp * std2uudpdx ) ;
520
521 vuu += dxdr * ( lapr_tp + dxdr * (
522 dxdr* unjj * d2rdx2
523 - 2. * ( sr2drdt * d2rdtdx + sr2stdrdp * sstd2rdpdx ) )
524 ) * duudx ;
525
526 vuu.set_base(sauve_base) ;
527
528 // Since the assignment is performed on vuu (uu.va), the treatment
529 // of uu.dzpuis must be performed by hand:
530
531 uu.set_dzpuis(4) ;
532
533 if (source.get_dzpuis() == 2) {
534 uu.dec2_dzpuis() ; // uu.dzpuis: 4 -> 2
535 }
536
537 if (source.get_dzpuis() == 3) {
538 uu.dec_dzpuis() ; //uu.dzpuis 4 -> 3
539 }
540
541 //====================================================================
542 // Computation of the effective source s^J of the ``affine''
543 // Poisson equation
544 //====================================================================
545
546 ssj = lambda * ssjm1 + unmlambda * ssjm2 ;
547
548 ssj = ( source + uu + (amax - apre) * ssj ) / amax ;
549
550 (ssj.va).set_base((source.va).base) ;
551
552 //====================================================================
553 // Resolution of the ``affine'' Poisson equation
554 //====================================================================
555
556 if ( source.get_dzpuis() == 0 ){
557 ssj.set_dzpuis( 4 ) ;
558 }
559 else {
560 ssj.set_dzpuis( source.get_dzpuis() ) ; // Choice of the resolution
561 // dzpuis = 2, 3 or 4
562 }
563
564 assert( uu.check_dzpuis( ssj.get_dzpuis() ) ) ;
565
566 mpaff.poisson_tau(ssj, par_nul, uu) ;
567
568 tdiff = diffrel(vuu, vuujm1) ;
569
570 diff = max(tdiff) ;
571
572
573 cout << " step " << niter << " : " ;
574 for (int l=0; l<nz; l++) {
575 cout << tdiff(l) << " " ;
576 }
577 cout << endl ;
578
579 //=================================
580 // Updates for the next iteration
581 //=================================
582
583 ssjm2 = ssjm1 ;
584 ssjm1 = ssj ;
585 vuujm1 = vuu ;
586
587 niter++ ;
588
589 } // End of iteration
590 while ( (diff > precis) && (niter < nitermax) ) ;
591
592//==========================================================================
593//==========================================================================
594// End of iteration
595//==========================================================================
596//==========================================================================
597}
598
599void Map_et::poisson_angu(const Scalar& source, Param& par, Scalar& uu,
600 double lambda) const {
601
602 if (lambda != double(0)) {
603 cout <<
604 "Map_et::poisson_angu : the case lambda != 0 is not treated yet !"
605 << endl ;
606 abort() ;
607 }
608
609 assert(source.get_mp() == *this) ;
610 assert(uu.get_mp() == *this) ;
611
612 int nz = mg->get_nzone() ;
613 int nzm1 = nz - 1 ;
614
615 int* nrm6 = new int[nz];
616 for (int l=0; l<=nzm1; l++)
617 nrm6[l] = mg->get_nr(l) - 6 ;
618
619//## // Indicator of existence of a compactified external domain
620// bool zec = false ;
621// if (mg->get_type_r(nzm1) == UNSURR) {
622// zec = true ;
623// }
624
625 //-------------------------------
626 // Computation of the prefactor a ---> Cmp apre
627 //-------------------------------
628
629 Mtbl unjj = 1 + srdrdt*srdrdt + srstdrdp*srstdrdp ;
630
631 Mtbl apre1(*mg) ;
632 apre1.set_etat_qcq() ;
633 for (int l=0; l<nz; l++) {
634 *(apre1.t[l]) = alpha[l]*alpha[l] ;
635 }
636
637 apre1 = apre1 * dxdr * dxdr * unjj ;
638
639 Cmp apre(*this) ;
640 apre = apre1 ;
641
642 Tbl amax0 = max(apre1) ; // maximum values in each domain
643
644 // The maximum values of a in each domain are put in a Mtbl
645 Mtbl amax1(*mg) ;
646 amax1.set_etat_qcq() ;
647 for (int l=0; l<nz; l++) {
648 *(amax1.t[l]) = amax0(l) ;
649 }
650
651 Cmp amax(*this) ;
652 amax = amax1 ;
653
654 //-------------------
655 // Initializations
656 //-------------------
657
658 int nitermax = 200 ; //par.get_int() ;
659 int niter ; //= par.get_int_mod() ;
660 double relax = 0.5 ; //= par.get_double() ;
661 double unmrelax = 1. - lambda;
662 double precis = 1e-8 ; //par.get_double(1) ;
663
664 // Cmp& ssjcmp = par.get_cmp_mod() ;
665
666 Cmp ssj (source) ;
667 Cmp ssjm1 (ssj) ;
668 Cmp ssjm2 (ssjm1) ;
669
670 int dzpuis = source.get_dzpuis() ;
671 ssj.set_dzpuis(dzpuis) ;
672 uu.set_dzpuis(dzpuis) ;
673 ssjm1.set_dzpuis(dzpuis) ;
674 ssjm2.set_dzpuis(dzpuis) ;
675
676 Valeur& vuu = uu.set_spectral_va() ;
677
678 Valeur vuujm1(*mg) ;
679 if (uu.get_etat() == ETATZERO) {
680 vuujm1 = 1 ; // to take relative differences
681 vuujm1.set_base( vuu.base ) ;
682 }
683 else{
684 vuujm1 = vuu ;
685 }
686
687 // Affine mapping for the Laplacian-tilde
688
689 Map_af mpaff(*this) ;
690 Param par_nul ;
691
692 cout << "Map_et::poisson angu : relat. diff. u^J <-> u^{J-1} : " << endl ;
693
694//==========================================================================
695//==========================================================================
696// Start of iteration
697//==========================================================================
698//==========================================================================
699
700
701 Tbl tdiff(nz) ;
702 double diff ;
703 niter = 0 ;
704
705 do {
706
707 //====================================================================
708 // Computation of R(u) (the result is put in uu)
709 //====================================================================
710
711 //-----------------------
712 // First operations on uu
713 //-----------------------
714
715 Valeur duudx = (uu.set_spectral_va()).dsdx() ; // d/dx
716
717 const Valeur& d2uudxdx = duudx.dsdx() ; // d^2/dxdx
718
719
720 const Valeur& d2uudtdx = duudx.dsdt() ; // d^2/dxdtheta
721
722 const Valeur& std2uudpdx = duudx.stdsdp() ; // 1/sin(theta) d^2/dxdphi
723
724 //---------------------------------------
725 // Computation of R(u)
726 //
727 // The result is put in uu (via vuu)
728 //---------------------------------------
729
730 unjj = srdrdt*srdrdt + srstdrdp*srstdrdp ;
731
732 Base_val sauve_base = vuu.base ;
733
734 vuu = - d2uudxdx * dxdr * dxdr * unjj
735 + 2. * dxdr * ( sr2drdt * d2uudtdx
736 + sr2stdrdp * std2uudpdx ) ;
737
738 vuu.set_base(sauve_base) ;
739
740 vuu += dxdr * ( lapr_tp + dxdr * (
741 dxdr * unjj * d2rdx2
742 - 2. * ( sr2drdt * d2rdtdx + sr2stdrdp * sstd2rdpdx ) )
743 ) * duudx ;
744
745 vuu.set_base(sauve_base) ;
746
747 uu.mult_r() ;
748 uu.mult_r() ;
749
750 //====================================================================
751 // Computation of the effective source s^J of the ``affine''
752 // Poisson equation
753 //====================================================================
754
755// uu.filtre_r(nrm6) ;
756// uu.filtre_phi(1) ;
757// uu.filtre_theta(1) ;
758
759 ssj = relax * ssjm1 + unmrelax * ssjm2 ;
760
761 Cmp sum_tmp = source + uu ;
762 ssj = ( sum_tmp + (amax - apre) * ssj ) / amax ;
763
764 // ssj = source + uu ;
765
766 // ssj = (1-relax) * ssj + relax * ssjm1 ;
767
768 (ssj.va).set_base((source.get_spectral_va()).base) ;
769
770
771 //====================================================================
772 // Resolution of the ``affine'' Poisson equation
773 //====================================================================
774
775 Cmp uu_cmp = uu ;
776
777 mpaff.poisson_angu(ssj, par_nul, uu_cmp) ;
778 uu = uu_cmp ;
779 tdiff = diffrel(vuu, vuujm1) ;
780
781 diff = max(tdiff) ;
782
783
784 cout << " step " << niter << " : " ;
785 for (int l=0; l<nz; l++) {
786 cout << tdiff(l) << " " ;
787 }
788 cout << endl ;
789
790 //=================================
791 // Updates for the next iteration
792 //=================================
793
794 ssjm2 = ssjm1 ;
795 ssjm1 = ssj ;
796 vuujm1 = vuu ;
797
798 niter++ ;
799
800 } // End of iteration
801 while ( (diff > precis) && (niter < nitermax) ) ;
802
803//==========================================================================
804//==========================================================================
805// End of iteration
806//==========================================================================
807//==========================================================================
808
809 uu.set_dzpuis( source.get_dzpuis() ) ; // dzpuis unchanged
810
811}
812
813void Map_et::poisson_angu(const Cmp& source, Param& par, Cmp& uu,
814 double lambda) const {
815 cout << "Map_et::poisson_angu(const Scalar& source, Param& par, Scalar& uu, double lambda) pas fait" << endl; abort() ;
816 }
817
818
819}
Bases of the spectral expansions.
Definition base_val.h:325
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
void dec_dzpuis()
Decreases by 1 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
int get_etat() const
Returns the logical state.
Definition cmp.h:899
Valeur va
The numerical value of the Cmp.
Definition cmp.h:464
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition cmp.C:307
int get_dzpuis() const
Returns dzpuis.
Definition cmp.h:903
void set_dzpuis(int)
Set a value to dzpuis.
Definition cmp.C:657
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
Definition cmp.C:718
const Map * get_mp() const
Returns the mapping.
Definition cmp.h:901
void dec2_dzpuis()
Decreases by 2 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
Affine radial mapping.
Definition map.h:2042
virtual void poisson_angu(const Scalar &source, Param &par, Scalar &uu, double lambda=0) const
Computes the solution of the generalized angular Poisson equation.
virtual void poisson(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation.
virtual void poisson_tau(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation using a Tau method.
virtual void poisson_tau(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation with a Tau method.
virtual void poisson(const Cmp &source, Param &par, Cmp &uu) const
Computes the solution of a scalar Poisson equation.
virtual void poisson_angu(const Scalar &source, Param &par, Scalar &uu, double lambda=0) const
Computes the solution of the generalized angular Poisson equation.
Coord rsxdxdr
in the nucleus; \ in the shells; \ in the outermost compactified domain.
Definition map.h:2852
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
Definition map.h:2776
Coord d2rdx2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1634
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1615
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1607
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1655
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1663
Coord lapr_tp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1646
Coord sr2stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1623
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1599
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1564
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1575
Multi-domain array.
Definition mtbl.h:118
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
Definition mtbl.h:132
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition mtbl.C:302
Parameter storage.
Definition param.h:125
Cmp & get_cmp_mod(int position=0) const
Returns the reference of a modifiable Cmp stored in the list.
Definition param.C:1052
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
Definition param.C:295
const double & get_double(int position=0) const
Returns the reference of a double stored in the list.
Definition param.C:364
int & get_int_mod(int position=0) const
Returns the reference of a modifiable int stored in the list.
Definition param.C:433
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:393
int get_dzpuis() const
Returns dzpuis.
Definition scalar.h:563
Valeur & set_spectral_va()
Returns va (read/write version).
Definition scalar.h:610
const Valeur & get_spectral_va() const
Returns va (read only version).
Definition scalar.h:607
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition scalar.h:560
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition scalar.C:814
void mult_r()
Multiplication by r everywhere; dzpuis is not changed.
Basic array class.
Definition tbl.h:161
Values and coefficients of a (real-value) function.
Definition valeur.h:297
const Valeur & sx() const
Returns (r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR ).
Definition valeur_sx.C:113
const Valeur & stdsdp() const
Returns of *this.
void set_base(const Base_val &)
Sets the bases for spectral expansions (member base ).
Definition valeur.C:813
void ylm()
Computes the coefficients of *this.
Definition valeur_ylm.C:141
const Valeur & dsdt() const
Returns of *this.
void annule(int l)
Sets the Valeur to zero in a given domain.
Definition valeur.C:747
const Valeur & dsdx() const
Returns of *this.
Base_val base
Bases on which the spectral expansion is performed.
Definition valeur.h:315
const Valeur & lapang() const
Returns the angular Laplacian of *this.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Definition cmp_math.C:507
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Definition cmp_math.C:438
const Map & get_mp() const
Returns the mapping.
Definition tensor.h:874
Lorene prototypes.
Definition app_hor.h:67