113 double unsgam1,
Param& par,
Cmp& uu,
115 Cmp& source_regu,
Cmp& source_div)
const {
118 assert(source.
get_etat() != ETATNONDEF) ;
122 double aa = unsgam1 ;
129 assert(nr-k_div > 0) ;
139 assert(sourva.
get_etat() == ETATQCQ) ;
143 rho = *(sourva.
c_cf) ;
153 Tbl& ccf = *((rho.c_cf)->t[0]) ;
155 Tbl nilm_cos(np/2+1, 2*nt, nr) ;
156 Tbl nilm_sin(np/2+1, 2*nt, nr) ;
161 for (
int k=0; k<=np; k+=2) {
165 for (
int j=0; j<nt; j++) {
174 for (
int i=0; i<nr; i++) {
176 nilm_cos.
set(m, l, i) = ccf(k, j, i) ;
177 nilm_sin.
set(m, l, i) = ccf(k+1, j, i) ;
189 Tbl cf_cil(2*nt, nr, k_div) ;
202 double* tmp1 =
new double[nr] ;
204 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
206 for (
int l=0; l<2*nt; l++) {
208 for (
int i=0; i<nr; i++) {
210 double xi = grid.
x[i] ;
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.) *
220 cfrchebp(deg, dim, tmp1, dim, tmp1) ;
223 cfrchebi(deg, dim, tmp1, dim, tmp1) ;
225 for (
int i=0; i<nr; i++) {
227 cf_cil.
set(l, i, k_deg-1) = tmp1[i] ;
236 Tbl alm_cos(np/2+1, 2*nt, k_div) ;
237 Tbl alm_sin(np/2+1, 2*nt, k_div) ;
251 for (
int k=0; k<=np; k+=2) {
255 for (
int j=0; j<nt; j++) {
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) ;
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) ;
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) ;
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() ;
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 ;
311 for (
int k=0; k<=np; k+=2) {
315 for (
int j=0; j<nt; j++) {
325 for (
int i=0; i<nr; i++) {
327 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
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) ;
339 source_div.
annule(nzet, nzm1) ;
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 ;
348 base_s_div.
b[l] = base_s_div_r |
T_LEG_P | base_s_div_p ;
351 sdva_cf.
base = base_s_div ;
360 source_regu = source - source_div ;
370 (*this).poisson(source_regu, par, uu_regu) ;
376 Tbl cf_pil(2*nt, nr, k_div) ;
379 double* tmp2 =
new double[nr] ;
381 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
383 for (
int l=0; l<2*nt; l++) {
385 for (
int i=0; i<nr; i++) {
387 double xi = grid.
x[i] ;
388 tmp2[i] =
pow(xi, l) *
pow(1. - xi * xi, aa + 1. + k_deg) ;
393 cfrchebp(deg, dim, tmp2, dim, tmp2) ;
396 cfrchebi(deg, dim, tmp2, dim, tmp2) ;
398 for (
int i=0; i<nr; i++) {
400 cf_pil.
set(l, i, k_deg-1) = tmp2[i] ;
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() ;
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 ;
424 for (
int k=0; k<=np; k+=2) {
428 for (
int j=0; j<nt; j++) {
438 for (
int i=0; i<nr; i++) {
440 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
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) ;
452 uu_div.
annule(nzet, nzm1) ;
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 ;
459 base_uu_div.
b[l] = base_uu_r |
T_LEG_P | base_uu_p ;
462 udva_cf.
base = base_uu_div ;
476 uu = uu_regu + uu_div ;
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() ;
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() ;
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() ;
511 Tbl cf_dril(2*nt, nr, k_div) ;
514 double* tmp3 =
new double[nr] ;
516 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
518 for (
int i=0; i<nr; i++) {
520 double xi = grid.
x[i] ;
521 tmp3[i] = -2. * (aa + 1. + k_deg) * xi
522 *
pow(1. - xi * xi, aa + k_deg) ;
526 cfrchebi(deg, dim, tmp3, dim, tmp3) ;
528 for (
int i=0; i<nr; i++) {
530 cf_dril.
set(0, i, k_deg-1) = tmp3[i] ;
534 for (
int l=1; l<2*nt; l++) {
536 for (
int i=0; i<nr; i++) {
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) ;
546 cfrchebi(deg, dim, tmp3, dim, tmp3) ;
549 cfrchebp(deg, dim, tmp3, dim, tmp3) ;
551 for (
int i=0; i<nr; i++) {
553 cf_dril.
set(l, i, k_deg-1) = tmp3[i] ;
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 ;
569 for (
int k=0; k<=np; k+=2) {
573 for (
int j=0; j<nt; j++) {
583 for (
int i=0; i<nr; i++) {
585 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
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) ;
597 (duu_div.
set(0)).annule(nzet, nzm1) ;
603 for (
int l=0; l<=nzm1; l++) {
604 int base_duu_r_p = base_std.
b[l] &
MSQ_P ;
609 vr_cf.
base = base_duu_div_r ;
618 vr = duu_div(0).va *
alpha[0] *
alpha[0] * RR ;
619 vr.
base = sauve_base ;
625 Tbl cf_dpil(2*nt, nr, k_div) ;
628 double* tmp4 =
new double[nr] ;
630 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
632 for (
int i=0; i<nr; i++) {
636 cfrchebi(deg, dim, tmp4, dim, tmp4) ;
638 for (
int i=0; i<nr; i++) {
640 cf_dpil.
set(0, i, k_deg-1) = tmp4[i] ;
644 for (
int l=1; l<2*nt; l++) {
646 for (
int i=0; i<nr; i++) {
648 double xi = grid.
x[i] ;
649 tmp4[i] =
pow(xi, l - 1.) *
pow(1. - xi * xi, aa + 1. + k_deg) ;
654 cfrchebi(deg, dim, tmp4, dim, tmp4) ;
657 cfrchebp(deg, dim, tmp4, dim, tmp4) ;
659 for (
int i=0; i<nr; i++) {
661 cf_dpil.
set(l, i, k_deg-1) = tmp4[i] ;
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 ;
679 for (
int k=0; k<=np; k+=2) {
683 for (
int j=0; j<nt; j++) {
693 for (
int i=0; i<nr; i++) {
695 for (
int k_deg=1; k_deg<=k_div; k_deg++) {
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) ;
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) ;
712 (duu_div.
set(1)).annule(nzet, nzm1) ;
713 (duu_div.
set(2)).annule(nzet, nzm1) ;
720 for (
int l=0; l<=nzm1; l++) {
721 int base_duu_p_p = base_std.
b[l] &
MSQ_P ;
726 vt_cf.
base = base_duu_div_p ;
734 for (
int l=0; l<=nzm1; l++) {
735 int base_duu_t_p = base_std.
b[l] &
MSQ_P ;
740 vp_cf.
base = base_duu_div_t ;
747 vt = (duu_div(1).va).
dsdt() ;
749 vp = (duu_div(2).va).
stdsdp() ;
754 vt = duu_div(1).va *
alpha[0] ;
756 vp = duu_div(2).va *
alpha[0] ;
761 duu_div.
set_triad( (*this).get_bvect_spher() ) ;
const Map * get_mp() const
Returns the mapping.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
void ylm_i()
Inverse of ylm()
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void coef() const
Computes the coeffcients of *this.
void annule(int l)
Sets the Cmp to zero in a given domain.
double * alpha
Array (size: mg->nzone ) of the values of in each domain.
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
int get_etat() const
Returns the logical state.
double & set(int i)
Read/write of a particular element (index i) (1D case)
#define MSQ_P
Extraction de l'info sur Phi.
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.
double * x
Array of values of at the nr collocation points.
virtual void stdsdp(const Scalar &uu, Scalar &resu) const
Computes of a Scalar.
const Mg3d * get_mg() const
Returns the Mg3d on which the this is defined.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_etat() const
Returns the logical state.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Base_val base
Bases on which the spectral expansion is performed.
int * b
Array (size: nzone ) of the spectral basis in each domain.
#define MSQ_R
Extraction de l'info sur R.
int get_nzone() const
Returns the number of domains.
Cmp pow(const Cmp &, int)
Power .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int j, int i)
Read/write of a particuliar element.
Active physical coordinates and mapping derivatives.
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
void set_band(int up, int low) const
Calculate the band storage of *std.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Bases of the spectral expansions.
#define T_LEG_P
fct. de Legendre associees paires
Base_val std_base_scal() const
Returns the standard spectral bases for a scalar.
Coefficients storage for the multi-domain spectral method.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Base_val base
Bases of the spectral expansions.
void set_dzpuis(int)
Set a value to dzpuis.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Valeur va
The numerical value of the Cmp.
virtual void dsdt(const Scalar &uu, Scalar &resu) const
Computes of a Scalar.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
3D grid class in one domain.