Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
speclib.F90
Go to the documentation of this file.
1 !==============================================================================
66 
67 module speclib
68  use kinds, only : dp
69 
70  integer, PARAMETER :: nmax = 84
71  public zwgl, zwgll, igllm, dgll, dgllgl, zwglj
72  private
73 
74 contains
75 
76 !--------------------------------------------------------------------
77  SUBROUTINE zwgl (Z,W,NP)
78 !--------------------------------------------------------------------
84 !--------------------------------------------------------------------
85  implicit none
86  integer, intent(in) :: NP
87  REAL(DP), intent(out) :: Z(np), W(np)
88  real(DP) :: alpha, beta
89  alpha = 0._dp
90  beta = 0._dp
91  CALL zwgj(z,w,np,alpha,beta)
92  RETURN
93  END SUBROUTINE zwgl
94 
95  SUBROUTINE zwgll (Z,W,NP)
96 !--------------------------------------------------------------------
97 ! Generate NP Gauss-Lobatto Legendre points (Z) and weights (W)
98 ! associated with Jacobi polynomial P(N)(alpha=0,beta=0).
99 ! The polynomial degree N=NP-1.
100 ! Z and W are in single precision, but all the arithmetic
101 ! operations are done in double precision.
102 !--------------------------------------------------------------------
103  implicit none
104  integer, intent(in) :: NP
105  REAL(DP), intent(out) :: Z(np),W(np)
106  real(DP) :: alpha, beta
107  alpha = 0._dp
108  beta = 0._dp
109  CALL zwglj(z,w,np,alpha,beta)
110  RETURN
111  END SUBROUTINE zwgll
112 
113  SUBROUTINE zwgj (Z,W,NP,ALPHA,BETA)
114 !--------------------------------------------------------------------
115 
116 ! Generate NP GAUSS JACOBI points (Z) and weights (W)
117 ! associated with Jacobi polynomial P(N)(alpha>-1,beta>-1).
118 ! The polynomial degree N=NP-1.
119 ! Single precision version.
120 
121 !--------------------------------------------------------------------
122  implicit none
123  integer, parameter :: NZD = NMAX
124 
125  integer, intent(in) :: NP
126  REAL(DP), intent(out) :: Z(np), W(np)
127  real(DP), intent(in) :: ALPHA, BETA
128  REAL(DP) :: ZD(nzd),WD(nzd),ALPHAD,BETAD
129  integer :: npmax, i
130 
131  npmax = nzd
132  IF (np > npmax) THEN
133  WRITE (6,*) 'Too large polynomial degree in ZWGJ'
134  WRITE (6,*) 'Maximum polynomial degree is',nmax
135  WRITE (6,*) 'Here NP=',np
136  call exitt
137  ENDIF
138  alphad = alpha
139  betad = beta
140  CALL zwgjd(zd,wd,np,alphad,betad)
141  DO 100 i=1,np
142  z(i) = zd(i)
143  w(i) = wd(i)
144  100 END DO
145  RETURN
146  END SUBROUTINE zwgj
147 
148  SUBROUTINE zwgjd (Z,W,NP,ALPHA,BETA)
149 !--------------------------------------------------------------------
150 ! Generate NP GAUSS JACOBI points (Z) and weights (W)
151 ! associated with Jacobi polynomial P(N)(alpha>-1,beta>-1).
152 ! The polynomial degree N=NP-1.
153 ! Double precision version.
154 !--------------------------------------------------------------------
155  implicit none
156  integer, intent(in) :: NP
157  REAL(DP), intent(out) :: Z(np),W(np)
158  real(DP), intent(in) :: ALPHA,BETA
159 
160  integer :: n, np1, np2, i
161  real(DP) :: dn, one, two, apb, dnp1, dnp2, fac1, fac2, fac3, fnorm
162  real(DP) :: rcoef, P, PD, PM1, PDM1, PM2, PDM2
163 
164  n = np-1
165  dn = ((n))
166  one = 1._dp
167  two = 2._dp
168  apb = alpha+beta
169 
170  IF (np <= 0) THEN
171  WRITE (6,*) 'ZWGJD: Minimum number of Gauss points is 1',np
172  call exitt
173  ENDIF
174  IF ((alpha <= -one) .OR. (beta <= -one)) THEN
175  WRITE (6,*) 'ZWGJD: Alpha and Beta must be greater than -1'
176  call exitt
177  ENDIF
178 
179  IF (np == 1) THEN
180  z(1) = (beta-alpha)/(apb+two)
181  w(1) = gammaf(alpha+one)*gammaf(beta+one)/gammaf(apb+two) &
182  * two**(apb+one)
183  RETURN
184  ENDIF
185 
186  CALL jacg(z,np,alpha,beta)
187 
188  np1 = n+1
189  np2 = n+2
190  dnp1 = ((np1))
191  dnp2 = ((np2))
192  fac1 = dnp1+alpha+beta+one
193  fac2 = fac1+dnp1
194  fac3 = fac2+one
195  fnorm = pnormj(np1,alpha,beta)
196  rcoef = (fnorm*fac2*fac3)/(two*fac1*dnp2)
197  DO 100 i=1,np
198  CALL jacobf(p,pd,pm1,pdm1,pm2,pdm2,np2,alpha,beta,z(i))
199  w(i) = -rcoef/(p*pdm1)
200  100 END DO
201  RETURN
202  END SUBROUTINE zwgjd
203 
204  SUBROUTINE zwglj (Z,W,NP,ALPHA,BETA)
205 !--------------------------------------------------------------------
206 
207 ! Generate NP GAUSS LOBATTO JACOBI points (Z) and weights (W)
208 ! associated with Jacobi polynomial P(N)(alpha>-1,beta>-1).
209 ! The polynomial degree N=NP-1.
210 ! Single precision version.
211 
212 !--------------------------------------------------------------------
213  implicit none
214  integer, PARAMETER :: NZD = NMAX
215  integer, intent(in) :: NP
216  REAL(DP), intent(out) :: Z(np),W(np)
217  real(DP), intent(in) :: ALPHA,BETA
218  REAL(DP) :: ZD(nzd),WD(nzd),ALPHAD,BETAD
219 
220  integer :: npmax, i
221 
222  npmax = nzd
223  IF (np > npmax) THEN
224  WRITE (6,*) 'Too large polynomial degree in ZWGLJ'
225  WRITE (6,*) 'Maximum polynomial degree is',nmax
226  WRITE (6,*) 'Here NP=',np
227  call exitt
228  ENDIF
229  alphad = alpha
230  betad = beta
231  CALL zwgljd(zd,wd,np,alphad,betad)
232  DO 100 i=1,np
233  z(i) = zd(i)
234  w(i) = wd(i)
235  100 END DO
236  RETURN
237  END SUBROUTINE zwglj
238 
239  SUBROUTINE zwgljd (Z,W,NP,ALPHA,BETA)
240 !--------------------------------------------------------------------
241 ! Generate NP GAUSS LOBATTO JACOBI points (Z) and weights (W)
242 ! associated with Jacobi polynomial P(N)(alpha>-1,beta>-1).
243 ! The polynomial degree N=NP-1.
244 ! Double precision version.
245 !--------------------------------------------------------------------
246  implicit none
247  integer, intent(in) :: np
248  REAL(DP), intent(out) :: Z(np),W(np)
249  REAL(DP), intent(in) :: ALPHA,BETA
250 
251  integer :: n, nm1, i
252  real(DP) :: one, two, alpg, betg, p, pd, pm1, pdm1, pm2, pdm2
253  n = np-1
254  nm1 = n-1
255  one = 1._dp
256  two = 2._dp
257 
258  IF (np <= 1) THEN
259  WRITE (6,*) 'ZWGLJD: Minimum number of Gauss-Lobatto points is 2'
260  WRITE (6,*) 'ZWGLJD: alpha,beta:',alpha,beta,np
261  call exitt
262  ENDIF
263  IF ((alpha <= -one) .OR. (beta <= -one)) THEN
264  WRITE (6,*) 'ZWGLJD: Alpha and Beta must be greater than -1'
265  call exitt
266  ENDIF
267 
268  IF (nm1 > 0) THEN
269  alpg = alpha+one
270  betg = beta+one
271  CALL zwgjd(z(2),w(2),nm1,alpg,betg)
272  ENDIF
273  z(1) = -one
274  z(np) = one
275  DO 100 i=2,np-1
276  w(i) = w(i)/(one-z(i)**2)
277  100 END DO
278  CALL jacobf(p,pd,pm1,pdm1,pm2,pdm2,n,alpha,beta,z(1))
279  w(1) = endw1(n,alpha,beta)/(two*pd)
280  CALL jacobf(p,pd,pm1,pdm1,pm2,pdm2,n,alpha,beta,z(np))
281  w(np) = endw2(n,alpha,beta)/(two*pd)
282 
283  RETURN
284  END SUBROUTINE zwgljd
285 
286  REAL(DP) FUNCTION endw1 (N,ALPHA,BETA)
287  implicit none
288  integer, intent(in) :: n
289  real(DP), intent(in) :: alpha, beta
290 
291  integer :: i
292  real(DP) :: zero, one, two, three, four, apb
293  real(DP) :: f1, f2, fint1, fint2, f3, a1, a2, a3, abn, abnn, di
294  zero = 0._dp
295  one = 1._dp
296  two = 2._dp
297  three = 3._dp
298  four = 4._dp
299  f3 = -1._dp
300  apb = alpha+beta
301  IF (n == 0) THEN
302  endw1 = zero
303  RETURN
304  ENDIF
305  f1 = gammaf(alpha+two)*gammaf(beta+one)/gammaf(apb+three)
306  f1 = f1*(apb+two)*two**(apb+two)/two
307  IF (n == 1) THEN
308  endw1 = f1
309  RETURN
310  ENDIF
311  fint1 = gammaf(alpha+two)*gammaf(beta+one)/gammaf(apb+three)
312  fint1 = fint1*two**(apb+two)
313  fint2 = gammaf(alpha+two)*gammaf(beta+two)/gammaf(apb+four)
314  fint2 = fint2*two**(apb+three)
315  f2 = (-two*(beta+two)*fint1 + (apb+four)*fint2) &
316  * (apb+three)/four
317  IF (n == 2) THEN
318  endw1 = f2
319  RETURN
320  ENDIF
321  DO 100 i=3,n
322  di = ((i-1))
323  abn = alpha+beta+di
324  abnn = abn+di
325  a1 = -(two*(di+alpha)*(di+beta))/(abn*abnn*(abnn+one))
326  a2 = (two*(alpha-beta))/(abnn*(abnn+two))
327  a3 = (two*(abn+one))/((abnn+two)*(abnn+one))
328  f3 = -(a2*f2+a1*f1)/a3
329  f1 = f2
330  f2 = f3
331  100 END DO
332  endw1 = f3
333  RETURN
334  END FUNCTION
335 
336  REAL(DP) FUNCTION endw2 (N,ALPHA,BETA)
337  implicit none
338  integer, intent(in) :: n
339  real(DP), intent(in) :: alpha, beta
340 
341  integer :: i
342  real(DP) :: zero, one, two, three, four, apb
343  real(DP) :: f1, f2, fint1, fint2, f3, a1, a2, a3, abn, abnn, di
344 
345  zero = 0._dp
346  one = 1._dp
347  two = 2._dp
348  three = 3._dp
349  four = 4._dp
350  apb = alpha+beta
351  f3 = -1._dp
352  IF (n == 0) THEN
353  endw2 = zero
354  RETURN
355  ENDIF
356  f1 = gammaf(alpha+one)*gammaf(beta+two)/gammaf(apb+three)
357  f1 = f1*(apb+two)*two**(apb+two)/two
358  IF (n == 1) THEN
359  endw2 = f1
360  RETURN
361  ENDIF
362  fint1 = gammaf(alpha+one)*gammaf(beta+two)/gammaf(apb+three)
363  fint1 = fint1*two**(apb+two)
364  fint2 = gammaf(alpha+two)*gammaf(beta+two)/gammaf(apb+four)
365  fint2 = fint2*two**(apb+three)
366  f2 = (two*(alpha+two)*fint1 - (apb+four)*fint2) &
367  * (apb+three)/four
368  IF (n == 2) THEN
369  endw2 = f2
370  RETURN
371  ENDIF
372  DO 100 i=3,n
373  di = ((i-1))
374  abn = alpha+beta+di
375  abnn = abn+di
376  a1 = -(two*(di+alpha)*(di+beta))/(abn*abnn*(abnn+one))
377  a2 = (two*(alpha-beta))/(abnn*(abnn+two))
378  a3 = (two*(abn+one))/((abnn+two)*(abnn+one))
379  f3 = -(a2*f2+a1*f1)/a3
380  f1 = f2
381  f2 = f3
382  100 END DO
383  endw2 = f3
384  RETURN
385  END FUNCTION
386 
387  REAL(DP) FUNCTION gammaf (X)
388  implicit none
389  REAL(DP), intent(in) :: X
390 
391  real(DP) :: zero, half, one, two, four, pi
392  zero = 0.0_dp
393  half = 0.5_dp
394  one = 1.0_dp
395  two = 2.0_dp
396  four = 4.0_dp
397  pi = four*atan(one)
398  gammaf = one
399  IF (x == -half) gammaf = -two*sqrt(pi)
400  IF (x == half) gammaf = sqrt(pi)
401  IF (x == one ) gammaf = one
402  IF (x == two ) gammaf = one
403  IF (x == 1.5_dp ) gammaf = sqrt(pi)/2._dp
404  IF (x == 2.5_dp) gammaf = 1.5_dp*sqrt(pi)/2._dp
405  IF (x == 3.5_dp) gammaf = 0.5_dp*(2.5_dp*(1.5_dp*sqrt(pi)))
406  IF (x == 3._dp ) gammaf = 2._dp
407  IF (x == 4._dp ) gammaf = 6._dp
408  IF (x == 5._dp ) gammaf = 24._dp
409  IF (x == 6._dp ) gammaf = 120._dp
410  RETURN
411  END FUNCTION
412 
413  REAL(DP) FUNCTION pnormj (N,ALPHA,BETA)
414  implicit none
415  integer, intent(in) :: n
416  REAL(DP), intent(in) :: ALPHA,BETA
417 
418  real(DP) :: one, two, dn, const, prod, dindx, frac
419  integer :: i
420 
421  one = 1._dp
422  two = 2._dp
423  dn = ((n))
424  const = alpha+beta+one
425  IF (n <= 1) THEN
426  prod = gammaf(dn+alpha)*gammaf(dn+beta)
427  prod = prod/(gammaf(dn)*gammaf(dn+alpha+beta))
428  pnormj = prod * two**const/(two*dn+const)
429  RETURN
430  ENDIF
431  prod = gammaf(alpha+one)*gammaf(beta+one)
432  prod = prod/(two*(one+const)*gammaf(const+one))
433  prod = prod*(one+alpha)*(two+alpha)
434  prod = prod*(one+beta)*(two+beta)
435  DO 100 i=3,n
436  dindx = ((i))
437  frac = (dindx+alpha)*(dindx+beta)/(dindx*(dindx+alpha+beta))
438  prod = prod*frac
439  100 END DO
440  pnormj = prod * two**const/(two*dn+const)
441  RETURN
442  END FUNCTION
443 
444 
445  SUBROUTINE jacg (XJAC,NP,ALPHA,BETA)
446 !--------------------------------------------------------------------
447 ! Compute NP Gauss points XJAC, which are the zeros of the
448 ! Jacobi polynomial J(NP) with parameters ALPHA and BETA.
449 ! ALPHA and BETA determines the specific type of Gauss points.
450 ! Examples:
451 ! ALPHA = BETA = 0.0 -> Legendre points
452 ! ALPHA = BETA = -0.5 -> Chebyshev points
453 !--------------------------------------------------------------------
454  implicit none
455  integer, intent(in) :: np
456  REAL(DP), intent(out) :: XJAC(np)
457  real(DP), intent(in) :: alpha, beta
458 
459  real(DP) :: eps, one, dth, x, xlast, x1, x2, swap, xmin, delx
460  real(DP) :: p, pd, pm1, pdm1, pm2, pdm2, recsum
461  integer :: n, kstop, j, k, i, jmin, jm
462  DATA kstop /10/
463 
464  kstop = 10
465  eps = 1.e-12_dp
466 
467  n = np-1
468  one = 1._dp
469  dth = 4._dp*atan(one)/(2._dp*((n))+2._dp)
470  jmin = -1
471  DO 40 j=1,np
472  IF (j == 1) THEN
473  x = cos((2._dp*(((j))-1._dp)+1._dp)*dth)
474  ELSE
475  x1 = cos((2._dp*(((j))-1._dp)+1._dp)*dth)
476  x2 = xlast
477  x = (x1+x2)/2._dp
478  ENDIF
479  DO 30 k=1,kstop
480  CALL jacobf(p,pd,pm1,pdm1,pm2,pdm2,np,alpha,beta,x)
481  recsum = 0._dp
482  jm = j-1
483  DO 29 i=1,jm
484  recsum = recsum+1./(x-xjac(np-i+1))
485  29 END DO
486  delx = -p/(pd-recsum*p)
487  x = x+delx
488  IF (abs(delx) < eps) goto 31
489  30 END DO
490  31 CONTINUE
491  xjac(np-j+1) = x
492  xlast = x
493  40 END DO
494  DO 200 i=1,np
495  xmin = 2._dp
496  DO 100 j=i,np
497  IF (xjac(j) < xmin) THEN
498  xmin = xjac(j)
499  jmin = j
500  ENDIF
501  100 END DO
502  IF (jmin /= i) THEN
503  swap = xjac(i)
504  xjac(i) = xjac(jmin)
505  xjac(jmin) = swap
506  ENDIF
507  200 END DO
508  RETURN
509  END SUBROUTINE jacg
510 
511  SUBROUTINE jacobf (POLY,PDER,POLYM1,PDERM1,POLYM2,PDERM2, &
512  n,alp,bet,x)
513 !--------------------------------------------------------------------
514 
515 ! Computes the Jacobi polynomial (POLY) and its derivative (PDER)
516 ! of degree N at X.
517 
518 !--------------------------------------------------------------------
519  implicit none
520  real(DP), intent(out) :: poly, pder, polym1, pderm1, polym2, pderm2
521  real(DP), intent(in) :: alp, bet, x
522  integer, intent(in) :: n
523 
524  real(DP) :: apb, polyl, pderl, dk, a1, a2, a3, b3, a4, polyn, pdern
525  real(DP) :: psave, pdsave
526  integer :: k
527 
528  apb = alp+bet
529  poly = 1._dp
530  pder = 0._dp
531  IF (n == 0) RETURN
532  polyl = poly
533  pderl = pder
534  poly = (alp-bet+(apb+2._dp)*x)/2._dp
535  pder = (apb+2._dp)/2._dp
536  psave = 0._dp
537  pdsave = 0._dp
538  IF (n == 1) RETURN
539  DO 20 k=2,n
540  dk = ((k))
541  a1 = 2._dp*dk*(dk+apb)*(2._dp*dk+apb-2._dp)
542  a2 = (2._dp*dk+apb-1._dp)*(alp**2-bet**2)
543  b3 = (2._dp*dk+apb-2._dp)
544  a3 = b3*(b3+1._dp)*(b3+2._dp)
545  a4 = 2._dp*(dk+alp-1._dp)*(dk+bet-1._dp)*(2._dp*dk+apb)
546  polyn = ((a2+a3*x)*poly-a4*polyl)/a1
547  pdern = ((a2+a3*x)*pder-a4*pderl+a3*poly)/a1
548  psave = polyl
549  pdsave = pderl
550  polyl = poly
551  poly = polyn
552  pderl = pder
553  pder = pdern
554  20 END DO
555  polym1 = polyl
556  pderm1 = pderl
557  polym2 = psave
558  pderm2 = pdsave
559  RETURN
560  END SUBROUTINE jacobf
561 
562  REAL(DP) FUNCTION hgj (II,Z,ZGJ,NP,ALPHA,BETA)
563 !---------------------------------------------------------------------
564 ! Compute the value of the Lagrangian interpolant HGJ through
565 ! the NP Gauss Jacobi points ZGJ at the point Z.
566 ! Single precision version.
567 !---------------------------------------------------------------------
568  implicit none
569  integer, PARAMETER :: NZD = NMAX
570  integer, intent(in) :: np, ii
571  REAL(DP), intent(in) :: Z,ZGJ(np),ALPHA,BETA
572 
573  REAL(DP) :: ZD,ZGJD(nzd),ALPHAD,BETAD
574  integer :: i, npmax
575 
576  npmax = nzd
577  IF (np > npmax) THEN
578  WRITE (6,*) 'Too large polynomial degree in HGJ'
579  WRITE (6,*) 'Maximum polynomial degree is',nmax
580  WRITE (6,*) 'Here NP=',np
581  call exitt
582  ENDIF
583  zd = z
584  DO 100 i=1,np
585  zgjd(i) = zgj(i)
586  100 END DO
587  alphad = alpha
588  betad = beta
589  hgj = hgjd(ii,zd,zgjd,np,alphad,betad)
590  RETURN
591  END FUNCTION hgj
592 
593  REAL(DP) FUNCTION hgjd (II,Z,ZGJ,NP,ALPHA,BETA)
594 !---------------------------------------------------------------------
595 ! Compute the value of the Lagrangian interpolant HGJD through
596 ! the NZ Gauss-Lobatto Jacobi points ZGJ at the point Z.
597 ! Double precision version.
598 !---------------------------------------------------------------------
599  implicit none
600  integer, intent(in) :: ii, np
601  REAL(DP), intent(in) :: Z,ZGJ(np),ALPHA,BETA
602 
603  real(DP) :: eps, one, zi, dz
604  real(DP) :: pzi, pdzi, pm1, pdm1, pm2, pdm2, pz, pdz
605 
606  eps = 1.e-5_dp
607  one = 1._dp
608  zi = zgj(ii)
609  dz = z-zi
610  IF (abs(dz) < eps) THEN
611  hgjd = one
612  RETURN
613  ENDIF
614  CALL jacobf(pzi,pdzi,pm1,pdm1,pm2,pdm2,np,alpha,beta,zi)
615  CALL jacobf(pz,pdz,pm1,pdm1,pm2,pdm2,np,alpha,beta,z)
616  hgjd = pz/(pdzi*(z-zi))
617  RETURN
618  END FUNCTION
619 
620  REAL(DP) FUNCTION hglj (II,Z,ZGLJ,NP,ALPHA,BETA)
621 !---------------------------------------------------------------------
622 ! Compute the value of the Lagrangian interpolant HGLJ through
623 ! the NZ Gauss-Lobatto Jacobi points ZGLJ at the point Z.
624 ! Single precision version.
625 !---------------------------------------------------------------------
626  implicit none
627  integer, PARAMETER :: NZD = NMAX
628  integer, intent(in) :: ii, NP
629  REAL(DP), intent(in) :: Z,ZGLJ(np)
630  REAL(DP), intent(in) :: ALPHA,BETA
631 
632  REAL(DP) :: ZD,ZGLJD(nzd),ALPHAD,BETAD
633  integer :: npmax, i
634 
635  npmax = nzd
636  IF (np > npmax) THEN
637  WRITE (6,*) 'Too large polynomial degree in HGLJ'
638  WRITE (6,*) 'Maximum polynomial degree is',nmax
639  WRITE (6,*) 'Here NP=',np
640  call exitt
641  ENDIF
642  zd = z
643  DO 100 i=1,np
644  zgljd(i) = zglj(i)
645  100 END DO
646  alphad = alpha
647  betad = beta
648  hglj = hgljd(ii,zd,zgljd,np,alphad,betad)
649  RETURN
650  END FUNCTION hglj
651 
652  REAL(DP) FUNCTION hgljd (I,Z,ZGLJ,NP,ALPHA,BETA)
653 !---------------------------------------------------------------------
654 ! Compute the value of the Lagrangian interpolant HGLJD through
655 ! the NZ Gauss-Lobatto Jacobi points ZJACL at the point Z.
656 ! Double precision version.
657 !---------------------------------------------------------------------
658  implicit none
659  integer, intent(in) :: i, np
660  REAL(DP), intent(in) :: Z,ZGLJ(np),ALPHA,BETA
661 
662  real(DP) :: eps, one, dz, zi, dn, eigval, const
663  real(DP) :: p, pd, pi, pdi, pm1, pdm1, pm2, pdm2
664  integer :: n
665 
666  eps = 1.e-5_dp
667  one = 1._dp
668  zi = zglj(i)
669  dz = z-zi
670  IF (abs(dz) < eps) THEN
671  hgljd = one
672  RETURN
673  ENDIF
674  n = np-1
675  dn = ((n))
676  eigval = -dn*(dn+alpha+beta+one)
677  CALL jacobf(pi,pdi,pm1,pdm1,pm2,pdm2,n,alpha,beta,zi)
678  const = eigval*pi+alpha*(one+zi)*pdi-beta*(one-zi)*pdi
679  CALL jacobf(p,pd,pm1,pdm1,pm2,pdm2,n,alpha,beta,z)
680  hgljd = (one-z**2)*pd/(const*(z-zi))
681  RETURN
682  END FUNCTION
683 
684  SUBROUTINE dgj (D,DT,Z,NZ,NZD,ALPHA,BETA)
685 !-----------------------------------------------------------------
686 ! Compute the derivative matrix D and its transpose DT
687 ! associated with the Nth order Lagrangian interpolants
688 ! through the NZ Gauss Jacobi points Z.
689 ! Note: D and DT are square matrices.
690 ! Single precision version.
691 !-----------------------------------------------------------------
692  implicit none
693  integer, PARAMETER :: NZDD = NMAX
694  integer :: nz, nzd
695  REAL(DP), intent(out) :: D(nzd,nzd),DT(nzd,nzd)
696  real(DP), intent(in) :: Z(nz),ALPHA,BETA
697 
698  REAL(DP) :: DD(nzdd,nzdd),DTD(nzdd,nzdd),ZD(nzdd),ALPHAD,BETAD
699  integer :: i, j
700 
701  IF (nz <= 0) THEN
702  WRITE (6,*) 'DGJ: Minimum number of Gauss points is 1'
703  call exitt
704  ENDIF
705  IF (nz > nmax) THEN
706  WRITE (6,*) 'Too large polynomial degree in DGJ'
707  WRITE (6,*) 'Maximum polynomial degree is',nmax
708  WRITE (6,*) 'Here Nz=',nz
709  call exitt
710  ENDIF
711  IF ((alpha <= -1.) .OR. (beta <= -1.)) THEN
712  WRITE (6,*) 'DGJ: Alpha and Beta must be greater than -1'
713  call exitt
714  ENDIF
715  alphad = alpha
716  betad = beta
717  DO 100 i=1,nz
718  zd(i) = z(i)
719  100 END DO
720  CALL dgjd(dd,dtd,zd,nz,nzdd,alphad,betad)
721  DO 200 i=1,nz
722  DO 200 j=1,nz
723  d(i,j) = dd(i,j)
724  dt(i,j) = dtd(i,j)
725  200 END DO
726  RETURN
727  END SUBROUTINE dgj
728 
729  SUBROUTINE dgjd (D,DT,Z,NZ,NZD,ALPHA,BETA)
730 !-----------------------------------------------------------------
731 ! Compute the derivative matrix D and its transpose DT
732 ! associated with the Nth order Lagrangian interpolants
733 ! through the NZ Gauss Jacobi points Z.
734 ! Note: D and DT are square matrices.
735 ! Double precision version.
736 !-----------------------------------------------------------------
737  implicit none
738  integer, intent(in) :: nz, nzd
739  REAL(DP), intent(out) :: D(nzd,nzd),DT(nzd,nzd)
740  real(DP), intent(in) :: Z(nz),ALPHA,BETA
741 
742  integer :: n, i, j
743  real(DP) :: dn, one, two
744  real(DP) :: pi, pdi, pm1, pdm1, pm2, pdm2, pj, pdj
745 
746  n = nz-1
747  dn = ((n))
748  one = 1._dp
749  two = 2._dp
750 
751  IF (nz <= 1) THEN
752  WRITE (6,*) 'DGJD: Minimum number of Gauss-Lobatto points is 2'
753  call exitt
754  ENDIF
755  IF ((alpha <= -one) .OR. (beta <= -one)) THEN
756  WRITE (6,*) 'DGJD: Alpha and Beta must be greater than -1'
757  call exitt
758  ENDIF
759 
760  DO 200 i=1,nz
761  DO 200 j=1,nz
762  CALL jacobf(pi,pdi,pm1,pdm1,pm2,pdm2,nz,alpha,beta,z(i))
763  CALL jacobf(pj,pdj,pm1,pdm1,pm2,pdm2,nz,alpha,beta,z(j))
764  IF (i /= j) d(i,j) = pdi/(pdj*(z(i)-z(j)))
765  IF (i == j) d(i,j) = ((alpha+beta+two)*z(i)+alpha-beta)/ &
766  (two*(one-z(i)**2))
767  dt(j,i) = d(i,j)
768  200 END DO
769  RETURN
770  END SUBROUTINE dgjd
771 
772  SUBROUTINE dglj (D,DT,Z,NZ,NZD,ALPHA,BETA)
773 !-----------------------------------------------------------------
774 ! Compute the derivative matrix D and its transpose DT
775 ! associated with the Nth order Lagrangian interpolants
776 ! through the NZ Gauss-Lobatto Jacobi points Z.
777 ! Note: D and DT are square matrices.
778 ! Single precision version.
779 !-----------------------------------------------------------------
780  implicit none
781  integer, PARAMETER :: NZDD = NMAX
782  integer, intent(in) :: nz, nzd
783  REAL(DP), intent(out) :: D(nzd,nzd),DT(nzd,nzd)
784  REAL(DP), intent(in) :: Z(nz),ALPHA,BETA
785 
786  REAL(DP) :: DD(nzdd,nzdd),DTD(nzdd,nzdd),ZD(nzdd),ALPHAD,BETAD
787  integer :: i, j
788 
789  IF (nz <= 1) THEN
790  WRITE (6,*) 'DGLJ: Minimum number of Gauss-Lobatto points is 2'
791  call exitt
792  ENDIF
793  IF (nz > nmax) THEN
794  WRITE (6,*) 'Too large polynomial degree in DGLJ'
795  WRITE (6,*) 'Maximum polynomial degree is',nmax
796  WRITE (6,*) 'Here NZ=',nz
797  call exitt
798  ENDIF
799  IF ((alpha <= -1.) .OR. (beta <= -1.)) THEN
800  WRITE (6,*) 'DGLJ: Alpha and Beta must be greater than -1'
801  call exitt
802  ENDIF
803  alphad = alpha
804  betad = beta
805  DO 100 i=1,nz
806  zd(i) = z(i)
807  100 END DO
808  CALL dgljd(dd,dtd,zd,nz,nzdd,alphad,betad)
809  DO 200 i=1,nz
810  DO 200 j=1,nz
811  d(i,j) = dd(i,j)
812  dt(i,j) = dtd(i,j)
813  200 END DO
814  RETURN
815  END SUBROUTINE dglj
816 
817  SUBROUTINE dgljd (D,DT,Z,NZ,NZD,ALPHA,BETA)
818 !-----------------------------------------------------------------
819 ! Compute the derivative matrix D and its transpose DT
820 ! associated with the Nth order Lagrangian interpolants
821 ! through the NZ Gauss-Lobatto Jacobi points Z.
822 ! Note: D and DT are square matrices.
823 ! Double precision version.
824 !-----------------------------------------------------------------
825  implicit none
826  integer, intent(in) :: nz, nzd
827  REAL(DP), intent(out) :: D(nzd,nzd),DT(nzd,nzd)
828  REAL(DP), intent(in) :: Z(nz),ALPHA,BETA
829 
830  integer :: n, i, j
831  real(DP) :: dn, one, two, eigval
832  real(DP) :: pi, pdi, pm1, pdm1, pm2, pdm2, pj, pdj, ci, cj
833  n = nz-1
834  dn = ((n))
835  one = 1._dp
836  two = 2._dp
837  eigval = -dn*(dn+alpha+beta+one)
838 
839  IF (nz <= 1) THEN
840  WRITE (6,*) 'DGLJD: Minimum number of Gauss-Lobatto points is 2'
841  call exitt
842  ENDIF
843  IF ((alpha <= -one) .OR. (beta <= -one)) THEN
844  WRITE (6,*) 'DGLJD: Alpha and Beta must be greater than -1'
845  call exitt
846  ENDIF
847 
848  DO 200 i=1,nz
849  DO 200 j=1,nz
850  CALL jacobf(pi,pdi,pm1,pdm1,pm2,pdm2,n,alpha,beta,z(i))
851  CALL jacobf(pj,pdj,pm1,pdm1,pm2,pdm2,n,alpha,beta,z(j))
852  ci = eigval*pi-(beta*(one-z(i))-alpha*(one+z(i)))*pdi
853  cj = eigval*pj-(beta*(one-z(j))-alpha*(one+z(j)))*pdj
854  IF (i /= j) d(i,j) = ci/(cj*(z(i)-z(j)))
855  IF ((i == j) .AND. (i /= 1) .AND. (i /= nz)) &
856  d(i,j) = (alpha*(one+z(i))-beta*(one-z(i)))/ &
857  (two*(one-z(i)**2))
858  IF ((i == j) .AND. (i == 1)) &
859  d(i,j) = (eigval+alpha)/(two*(beta+two))
860  IF ((i == j) .AND. (i == nz)) &
861  d(i,j) = -(eigval+beta)/(two*(alpha+two))
862  dt(j,i) = d(i,j)
863  200 END DO
864  RETURN
865  END SUBROUTINE dgljd
866 
867  SUBROUTINE dgll (D,DT,Z,NZ,NZD)
868 !-----------------------------------------------------------------
869 ! Compute the derivative matrix D and its transpose DT
870 ! associated with the Nth order Lagrangian interpolants
871 ! through the NZ Gauss-Lobatto Legendre points Z.
872 ! Note: D and DT are square matrices.
873 !-----------------------------------------------------------------
874  implicit none
875  integer, intent(in) :: nz, nzd
876  REAL(DP), intent(out) :: D(nzd,nzd),DT(nzd,nzd)
877  REAL(DP), intent(in) :: Z(nz)
878 
879  integer :: n, i, j
880  real(DP) :: fn, d0
881  n = nz-1
882  IF (nz > nmax) THEN
883  WRITE (6,*) 'Subroutine DGLL'
884  WRITE (6,*) 'Maximum polynomial degree =',nmax
885  WRITE (6,*) 'Polynomial degree =',nz
886  ENDIF
887  IF (nz == 1) THEN
888  d(1,1) = 0._dp
889  RETURN
890  ENDIF
891  fn = (n)
892  d0 = fn*(fn+1._dp)/4._dp
893  DO 200 i=1,nz
894  DO 200 j=1,nz
895  d(i,j) = 0._dp
896  IF (i /= j) d(i,j) = pnleg(z(i),n)/ &
897  (pnleg(z(j),n)*(z(i)-z(j)))
898  IF ((i == j) .AND. (i == 1)) d(i,j) = -d0
899  IF ((i == j) .AND. (i == nz)) d(i,j) = d0
900  dt(j,i) = d(i,j)
901  200 END DO
902  RETURN
903  END SUBROUTINE dgll
904 
905  REAL(DP) FUNCTION hgll (I,Z,ZGLL,NZ)
906 !---------------------------------------------------------------------
907 ! Compute the value of the Lagrangian interpolant L through
908 ! the NZ Gauss-Lobatto Legendre points ZGLL at the point Z.
909 !---------------------------------------------------------------------
910  implicit none
911  integer, intent(in) :: i, nz
912  REAL(DP), intent(in) :: z, ZGLL(nz)
913 
914  integer :: n
915  real(DP) :: eps, dz, alfan
916 
917  eps = 1.e-5_dp
918  dz = z - zgll(i)
919  IF (abs(dz) < eps) THEN
920  hgll = 1._dp
921  RETURN
922  ENDIF
923  n = nz - 1
924  alfan = (n)*((n)+1._dp)
925  hgll = - (1._dp-z*z)*pndleg(z,n)/ &
926  (alfan*pnleg(zgll(i),n)*(z-zgll(i)))
927  RETURN
928  END FUNCTION hgll
929 
930  REAL(DP) FUNCTION hgl (I,Z,ZGL,NZ)
931 !---------------------------------------------------------------------
932 ! Compute the value of the Lagrangian interpolant HGL through
933 ! the NZ Gauss Legendre points ZGL at the point Z.
934 !---------------------------------------------------------------------
935  implicit none
936  integer, intent(in) :: i, nz
937  REAL(DP), intent(in) :: z, ZGL(nz)
938 
939  real(DP) :: eps, dz
940  integer :: n
941 
942  eps = 1.e-5_dp
943  dz = z - zgl(i)
944  IF (abs(dz) < eps) THEN
945  hgl = 1._dp
946  RETURN
947  ENDIF
948  n = nz-1
949  hgl = pnleg(z,nz)/(pndleg(zgl(i),nz)*(z-zgl(i)))
950  RETURN
951  END FUNCTION hgl
952 
953  REAL(DP) FUNCTION pnleg (Z,N)
954 !---------------------------------------------------------------------
955 ! Compute the value of the Nth order Legendre polynomial at Z.
956 ! (Simpler than JACOBF)
957 ! Based on the recursion formula for the Legendre polynomials.
958 !---------------------------------------------------------------------
959  implicit none
960  real(DP), intent(in) :: z
961  integer, intent(in) :: n
962 
963  real(DP) :: p1, p2, p3, fk
964  integer :: k
965 
966  p1 = 1._dp
967  IF (n == 0) THEN
968  pnleg = p1
969  RETURN
970  ENDIF
971  p2 = z
972  p3 = p2
973  DO 10 k = 1, n-1
974  fk = (k)
975  p3 = ((2._dp*fk+1._dp)*z*p2 - fk*p1)/(fk+1._dp)
976  p1 = p2
977  p2 = p3
978  10 END DO
979  pnleg = p3
980  if (n == 0) pnleg = 1._dp
981  RETURN
982  END FUNCTION pnleg
983 
984  REAL(DP) FUNCTION pndleg (Z,N)
985 !----------------------------------------------------------------------
986 ! Compute the derivative of the Nth order Legendre polynomial at Z.
987 ! (Simpler than JACOBF)
988 ! Based on the recursion formula for the Legendre polynomials.
989 !----------------------------------------------------------------------
990  implicit none
991  real(DP), intent(in) :: z
992  integer, intent(in) :: n
993 
994  real(DP) :: p1, p2, p3, p1d, p2d, p3d
995  integer :: k, fk
996  p1 = 1._dp
997  p2 = z
998  p1d = 0._dp
999  p2d = 1._dp
1000  p3d = 1._dp
1001  DO 10 k = 1, n-1
1002  fk = (k)
1003  p3 = ((2._dp*fk+1._dp)*z*p2 - fk*p1)/(fk+1._dp)
1004  p3d = ((2._dp*fk+1._dp)*p2 + (2._dp*fk+1._dp)*z*p2d - fk*p1d)/(fk+1._dp)
1005  p1 = p2
1006  p2 = p3
1007  p1d = p2d
1008  p2d = p3d
1009  10 END DO
1010  pndleg = p3d
1011  IF (n == 0) pndleg = 0._dp
1012  RETURN
1013  END FUNCTION pndleg
1014 
1015  SUBROUTINE dgllgl (D,DT,ZM1,ZM2,IM12,NZM1,NZM2,ND1,ND2)
1016 !-----------------------------------------------------------------------
1017 ! Compute the (one-dimensional) derivative matrix D and its
1018 ! transpose DT associated with taking the derivative of a variable
1019 ! expanded on a Gauss-Lobatto Legendre mesh (M1), and evaluate its
1020 ! derivative on a Guass Legendre mesh (M2).
1021 ! Need the one-dimensional interpolation operator IM12
1022 ! (see subroutine IGLLGL).
1023 ! Note: D and DT are rectangular matrices.
1024 !-----------------------------------------------------------------------
1025  implicit none
1026  integer, intent(in) :: nd1, nd2, nzm1, nzm2
1027  REAL(DP), intent(out) :: D(nd2,nd1), DT(nd1,nd2)
1028  REAL(DP), intent(in) :: ZM1(nd1), ZM2(nd2), IM12(nd2,nd1)
1029 
1030  integer :: ip, jq, nm1
1031  real(DP) :: zp, zq, eps
1032 
1033  IF (nzm1 == 1) THEN
1034  d(1,1) = 0._dp
1035  dt(1,1) = 0._dp
1036  RETURN
1037  ENDIF
1038  eps = 1.e-6_dp
1039  nm1 = nzm1-1
1040  DO 10 ip = 1, nzm2
1041  DO 10 jq = 1, nzm1
1042  zp = zm2(ip)
1043  zq = zm1(jq)
1044  IF ((abs(zp) < eps) .AND. (abs(zq) < eps)) THEN
1045  d(ip,jq) = 0._dp
1046  ELSE
1047  d(ip,jq) = (pnleg(zp,nm1)/pnleg(zq,nm1) &
1048  -im12(ip,jq))/(zp-zq)
1049  ENDIF
1050  dt(jq,ip) = d(ip,jq)
1051  10 END DO
1052  RETURN
1053  END SUBROUTINE dgllgl
1054 
1055  SUBROUTINE dgljgj (D,DT,ZGL,ZG,IGLG,NPGL,NPG,ND1,ND2,ALPHA,BETA)
1056 !-----------------------------------------------------------------------
1057 ! Compute the (one-dimensional) derivative matrix D and its
1058 ! transpose DT associated with taking the derivative of a variable
1059 ! expanded on a Gauss-Lobatto Jacobi mesh (M1), and evaluate its
1060 ! derivative on a Guass Jacobi mesh (M2).
1061 ! Need the one-dimensional interpolation operator IM12
1062 ! (see subroutine IGLJGJ).
1063 ! Note: D and DT are rectangular matrices.
1064 ! Single precision version.
1065 !-----------------------------------------------------------------------
1066  implicit none
1067  integer, intent(in) :: nd1, nd2, npgl, npg
1068  REAL(DP), intent(out) :: D(nd2,nd1), DT(nd1,nd2)
1069  REAL(DP), intent(in) :: ZGL(nd1), ZG(nd2), IGLG(nd2,nd1)
1070  real(DP), intent(in) :: alpha, beta
1071 
1072  integer, PARAMETER :: NDD = NMAX
1073  REAL(DP) :: DD(ndd,ndd), DTD(ndd,ndd)
1074  REAL(DP) :: ZGD(ndd), ZGLD(ndd), IGLGD(ndd,ndd)
1075  REAL(DP) :: ALPHAD, BETAD
1076  integer :: i, j
1077 
1078  IF (npgl <= 1) THEN
1079  WRITE(6,*) 'DGLJGJ: Minimum number of Gauss-Lobatto points is 2'
1080  call exitt
1081  ENDIF
1082  IF (npgl > nmax) THEN
1083  WRITE(6,*) 'Polynomial degree too high in DGLJGJ'
1084  WRITE(6,*) 'Maximum polynomial degree is',nmax
1085  WRITE(6,*) 'Here NPGL=',npgl
1086  call exitt
1087  ENDIF
1088  IF ((alpha <= -1._dp) .OR. (beta <= -1._dp)) THEN
1089  WRITE(6,*) 'DGLJGJ: Alpha and Beta must be greater than -1'
1090  call exitt
1091  ENDIF
1092 
1093  alphad = alpha
1094  betad = beta
1095  DO 100 i=1,npg
1096  zgd(i) = zg(i)
1097  DO 100 j=1,npgl
1098  iglgd(i,j) = iglg(i,j)
1099  100 END DO
1100  DO 200 i=1,npgl
1101  zgld(i) = zgl(i)
1102  200 END DO
1103  CALL dgljgjd(dd,dtd,zgld,zgd,iglgd,npgl,npg,ndd,ndd,alphad,betad)
1104  DO 300 i=1,npg
1105  DO 300 j=1,npgl
1106  d(i,j) = dd(i,j)
1107  dt(j,i) = dtd(j,i)
1108  300 END DO
1109  RETURN
1110  END SUBROUTINE dgljgj
1111 
1112  SUBROUTINE dgljgjd (D,DT,ZGL,ZG,IGLG,NPGL,NPG,ND1,ND2,ALPHA,BETA)
1113 !-----------------------------------------------------------------------
1114 ! Compute the (one-dimensional) derivative matrix D and its
1115 ! transpose DT associated with taking the derivative of a variable
1116 ! expanded on a Gauss-Lobatto Jacobi mesh (M1), and evaluate its
1117 ! derivative on a Guass Jacobi mesh (M2).
1118 ! Need the one-dimensional interpolation operator IM12
1119 ! (see subroutine IGLJGJ).
1120 ! Note: D and DT are rectangular matrices.
1121 ! Double precision version.
1122 !-----------------------------------------------------------------------
1123  implicit none
1124  integer, intent(in) :: nd1, nd2, npgl, npg
1125  REAL(DP), intent(out) :: D(nd2,nd1), DT(nd1,nd2)
1126  REAL(DP), intent(in) :: ZGL(nd1), ZG(nd2), IGLG(nd2,nd1), ALPHA, BETA
1127 
1128  real(DP) :: eps, one, two, faci, facj, const, dz, dn, eigval
1129  real(DP) :: pj, pdj, pm1, pdm1, pm2, pdm2, pi, pdi
1130  integer :: i, j, ngl
1131  IF (npgl <= 1) THEN
1132  WRITE(6,*) 'DGLJGJD: Minimum number of Gauss-Lobatto points is 2'
1133  call exitt
1134  ENDIF
1135  IF ((alpha <= -1.) .OR. (beta <= -1.)) THEN
1136  WRITE(6,*) 'DGLJGJD: Alpha and Beta must be greater than -1'
1137  call exitt
1138  ENDIF
1139 
1140  eps = 1.e-6_dp
1141  one = 1._dp
1142  two = 2._dp
1143  ngl = npgl-1
1144  dn = ((ngl))
1145  eigval = -dn*(dn+alpha+beta+one)
1146 
1147  DO 100 i=1,npg
1148  DO 100 j=1,npgl
1149  dz = abs(zg(i)-zgl(j))
1150  IF (dz < eps) THEN
1151  d(i,j) = (alpha*(one+zg(i))-beta*(one-zg(i)))/ &
1152  (two*(one-zg(i)**2))
1153  ELSE
1154  CALL jacobf(pi,pdi,pm1,pdm1,pm2,pdm2,ngl,alpha,beta,zg(i))
1155  CALL jacobf(pj,pdj,pm1,pdm1,pm2,pdm2,ngl,alpha,beta,zgl(j))
1156  faci = alpha*(one+zg(i))-beta*(one-zg(i))
1157  facj = alpha*(one+zgl(j))-beta*(one-zgl(j))
1158  const = eigval*pj+facj*pdj
1159  d(i,j) = ((eigval*pi+faci*pdi)*(zg(i)-zgl(j)) &
1160  -(one-zg(i)**2)*pdi)/(const*(zg(i)-zgl(j))**2)
1161  ENDIF
1162  dt(j,i) = d(i,j)
1163  100 END DO
1164  RETURN
1165  END SUBROUTINE dgljgjd
1166 
1167  SUBROUTINE iglm (I12,IT12,Z1,Z2,NZ1,NZ2,ND1,ND2)
1168 !----------------------------------------------------------------------
1169 ! Compute the one-dimensional interpolation operator (matrix) I12
1170 ! ands its transpose IT12 for interpolating a variable from a
1171 ! Gauss Legendre mesh (1) to a another mesh M (2).
1172 ! Z1 : NZ1 Gauss Legendre points.
1173 ! Z2 : NZ2 points on mesh M.
1174 !--------------------------------------------------------------------
1175  implicit none
1176  integer, intent(in) :: nz1, nz2, nd1, nd2
1177  REAL(DP), intent(out) :: I12(nd2,nd1),IT12(nd1,nd2)
1178  REAL(DP), intent(in) :: Z1(nd1),Z2(nd2)
1179 
1180  integer :: i, j
1181  real(DP) :: zi
1182 
1183  IF (nz1 == 1) THEN
1184  i12(1,1) = 1._dp
1185  it12(1,1) = 1._dp
1186  RETURN
1187  ENDIF
1188  DO 10 i=1,nz2
1189  zi = z2(i)
1190  DO 10 j=1,nz1
1191  i12(i,j) = hgl(j,zi,z1,nz1)
1192  it12(j,i) = i12(i,j)
1193  10 END DO
1194  RETURN
1195  END SUBROUTINE iglm
1196 
1197  SUBROUTINE igllm (I12,IT12,Z1,Z2,NZ1,NZ2,ND1,ND2)
1198 !----------------------------------------------------------------------
1199 ! Compute the one-dimensional interpolation operator (matrix) I12
1200 ! ands its transpose IT12 for interpolating a variable from a
1201 ! Gauss-Lobatto Legendre mesh (1) to a another mesh M (2).
1202 ! Z1 : NZ1 Gauss-Lobatto Legendre points.
1203 ! Z2 : NZ2 points on mesh M.
1204 !--------------------------------------------------------------------
1205  implicit none
1206  integer, intent(in) :: nz1, nz2, nd1, nd2
1207  REAL(DP), intent(out) :: I12(nd2,nd1),IT12(nd1,nd2)
1208  REAL(DP), intent(in) :: Z1(nd1),Z2(nd2)
1209 
1210  integer :: i, j
1211  real(DP) :: zi
1212 
1213  IF (nz1 == 1) THEN
1214  i12(1,1) = 1._dp
1215  it12(1,1) = 1._dp
1216  RETURN
1217  ENDIF
1218  DO 10 i=1,nz2
1219  zi = z2(i)
1220  DO 10 j=1,nz1
1221  i12(i,j) = hgll(j,zi,z1,nz1)
1222  it12(j,i) = i12(i,j)
1223  10 END DO
1224  RETURN
1225  END SUBROUTINE igllm
1226 
1227  SUBROUTINE igjm (I12,IT12,Z1,Z2,NZ1,NZ2,ND1,ND2,ALPHA,BETA)
1228 !----------------------------------------------------------------------
1229 ! Compute the one-dimensional interpolation operator (matrix) I12
1230 ! ands its transpose IT12 for interpolating a variable from a
1231 ! Gauss Jacobi mesh (1) to a another mesh M (2).
1232 ! Z1 : NZ1 Gauss Jacobi points.
1233 ! Z2 : NZ2 points on mesh M.
1234 ! Single precision version.
1235 !--------------------------------------------------------------------
1236  implicit none
1237  integer, intent(in) :: nz1, nz2, nd1, nd2
1238  REAL(DP), intent(out) :: I12(nd2,nd1),IT12(nd1,nd2)
1239  REAL(DP), intent(in) :: Z1(nd1),Z2(nd2), ALPHA, BETA
1240 
1241  integer :: i, j
1242  real(DP) :: zi
1243  IF (nz1 == 1) THEN
1244  i12(1,1) = 1._dp
1245  it12(1,1) = 1._dp
1246  RETURN
1247  ENDIF
1248  DO 10 i=1,nz2
1249  zi = z2(i)
1250  DO 10 j=1,nz1
1251  i12(i,j) = hgj(j,zi,z1,nz1,alpha,beta)
1252  it12(j,i) = i12(i,j)
1253  10 END DO
1254  RETURN
1255  END SUBROUTINE igjm
1256 
1257  SUBROUTINE igljm (I12,IT12,Z1,Z2,NZ1,NZ2,ND1,ND2,ALPHA,BETA)
1258 !----------------------------------------------------------------------
1259 ! Compute the one-dimensional interpolation operator (matrix) I12
1260 ! ands its transpose IT12 for interpolating a variable from a
1261 ! Gauss-Lobatto Jacobi mesh (1) to a another mesh M (2).
1262 ! Z1 : NZ1 Gauss-Lobatto Jacobi points.
1263 ! Z2 : NZ2 points on mesh M.
1264 ! Single precision version.
1265 !--------------------------------------------------------------------
1266  implicit none
1267  integer, intent(in) :: nz1, nz2, nd1, nd2
1268  REAL(DP), intent(out) :: I12(nd2,nd1),IT12(nd1,nd2)
1269  REAL(DP), intent(in) :: Z1(nd1),Z2(nd2), alpha, beta
1270 
1271  integer :: i, j
1272  real(DP) :: zi
1273  IF (nz1 == 1) THEN
1274  i12(1,1) = 1._dp
1275  it12(1,1) = 1._dp
1276  RETURN
1277  ENDIF
1278  DO 10 i=1,nz2
1279  zi = z2(i)
1280  DO 10 j=1,nz1
1281  i12(i,j) = hglj(j,zi,z1,nz1,alpha,beta)
1282  it12(j,i) = i12(i,j)
1283  10 END DO
1284  RETURN
1285  END SUBROUTINE igljm
1286 
1287 end module speclib
real(dp) function hgjd(II, Z, ZGJ, NP, ALPHA, BETA)
Definition: speclib.F90:593
real(dp) function endw1(N, ALPHA, BETA)
Definition: speclib.F90:286
subroutine igjm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2, ALPHA, BETA)
Definition: speclib.F90:1227
real(dp) function hgl(I, Z, ZGL, NZ)
Definition: speclib.F90:930
subroutine, public dgllgl(D, DT, ZM1, ZM2, IM12, NZM1, NZM2, ND1, ND2)
Definition: speclib.F90:1015
n
Definition: xxt_test.m:73
real(dp) function hgj(II, Z, ZGJ, NP, ALPHA, BETA)
Definition: speclib.F90:562
real(dp) function endw2(N, ALPHA, BETA)
Definition: speclib.F90:336
real(dp) function hgljd(I, Z, ZGLJ, NP, ALPHA, BETA)
Definition: speclib.F90:652
subroutine jacobf(POLY, PDER, POLYM1, PDERM1, POLYM2, PDERM2, N, ALP, BET, X)
Definition: speclib.F90:511
subroutine igljm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2, ALPHA, BETA)
Definition: speclib.F90:1257
subroutine dgljgj(D, DT, ZGL, ZG, IGLG, NPGL, NPG, ND1, ND2, ALPHA, BETA)
Definition: speclib.F90:1055
real(dp) function hglj(II, Z, ZGLJ, NP, ALPHA, BETA)
Definition: speclib.F90:620
real(dp) function pnormj(N, ALPHA, BETA)
Definition: speclib.F90:413
subroutine iglm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2)
Definition: speclib.F90:1167
void exitt()
Definition: comm_mpi.F90:411
real(dp) function pnleg(Z, N)
Definition: speclib.F90:953
subroutine zwgjd(Z, W, NP, ALPHA, BETA)
Definition: speclib.F90:148
real(dp) function pndleg(Z, N)
Definition: speclib.F90:984
subroutine dgljd(D, DT, Z, NZ, NZD, ALPHA, BETA)
Definition: speclib.F90:817
real(dp) function hgll(I, Z, ZGLL, NZ)
Definition: speclib.F90:905
subroutine zwgj(Z, W, NP, ALPHA, BETA)
Definition: speclib.F90:113
real(dp) function gammaf(X)
Definition: speclib.F90:387
subroutine, public dgll(D, DT, Z, NZ, NZD)
Definition: speclib.F90:867
subroutine dgljgjd(D, DT, ZGL, ZG, IGLG, NPGL, NPG, ND1, ND2, ALPHA, BETA)
Definition: speclib.F90:1112
subroutine, public zwgll(Z, W, NP)
Definition: speclib.F90:95
subroutine zwgljd(Z, W, NP, ALPHA, BETA)
Definition: speclib.F90:239
subroutine, public zwglj(Z, W, NP, ALPHA, BETA)
Definition: speclib.F90:204
subroutine dgj(D, DT, Z, NZ, NZD, ALPHA, BETA)
Definition: speclib.F90:684
subroutine dgjd(D, DT, Z, NZ, NZD, ALPHA, BETA)
Definition: speclib.F90:729
subroutine jacg(XJAC, NP, ALPHA, BETA)
Definition: speclib.F90:445
subroutine, public zwgl(Z, W, NP)
Generate NP Gauss Legendre points (Z) and weights (W) associated with Jacobi polynomial P(N)(alpha=0...
Definition: speclib.F90:77
subroutine, public igllm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2)
Definition: speclib.F90:1197
subroutine dglj(D, DT, Z, NZ, NZD, ALPHA, BETA)
Definition: speclib.F90:772