152  use, 
intrinsic :: iso_fortran_env, only : stderr => error_unit
 
  164    integer, 
intent(in) :: NP
 
  165    real(kind=
rp), 
intent(inout) :: z(np), w(np)
 
  166    real(kind=
rp) alpha, beta
 
  169    call zwgj(z, w, np, alpha, beta)
 
 
  179    integer, 
intent(in) :: NP
 
  180    real(kind=
rp), 
intent(inout) :: z(np), w(np)
 
  181    real(kind=
rp) alpha, beta
 
  184    call zwglj(z, w, np, alpha, beta)
 
 
  191  subroutine zwgj(Z, W, NP, ALPHA, BETA)
 
  192    integer, 
intent(in) :: NP
 
  193    real(kind=
rp), 
intent(inout) :: z(np), w(np)
 
  194    real(kind=
rp), 
intent(in) :: alpha, beta
 
  196    integer, 
parameter :: NMAX = 84
 
  197    integer, 
parameter :: NZD = nmax
 
  199    real(kind=
xp) zd(nzd), wd(nzd), alphad, betad
 
  203    if (np .gt. npmax) 
then 
  204       write (stderr, *) 
'Too large polynomial degree in ZWGJ' 
  205       write (stderr, *) 
'Maximum polynomial degree is', nmax
 
  206       write (stderr, *) 
'Here NP=', np
 
  210    alphad = 
real(alpha, kind=
xp)
 
  211    betad = 
real(beta, kind=
xp)
 
  212    call zwgjd(zd, wd, np, alphad, betad)
 
  214       z(i) = 
real(zd(i), kind=
rp)
 
  215       w(i) = 
real(wd(i), kind=
rp)
 
 
  223  subroutine zwgjd(Z, W, NP, ALPHA, BETA)
 
  224    integer, 
intent(in) :: NP
 
  225    real(kind=
xp), 
intent(inout) :: z(np), w(np)
 
  226    real(kind=
xp), 
intent(in) :: alpha, beta
 
  228    real(kind=
xp) :: dn, apb
 
  229    real(kind=
xp) :: fac1, fac2, fac3, fnorm
 
  230    real(kind=
xp) :: rcoef, p, pd, pm1, pdm1, pm2, pdm2
 
  231    real(kind=
xp) :: dnp1, dnp2
 
  232    integer :: N, NP1, NP2, I
 
  240       write (stderr, *) 
'ZWGJD: Minimum number of Gauss points is 1', np
 
  242    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
  243       call neko_error(
'ZWGJD: Alpha and Beta must be greater than -1')
 
  247       z(1) = (beta - alpha) / (apb + 2.0_xp)
 
  248       w(1) = 
gammaf(alpha + 1.0_xp) * 
gammaf(beta + 1.0_xp) / &
 
  249            gammaf(apb + 2.0_xp) * 2.0_xp**(apb + 1.0_xp)
 
  253    call jacg(z, np, alpha, beta)
 
  259    fac1 = dnp1 + alpha + beta + 1.0_xp
 
  262    fnorm = 
pnormj(np1, alpha, beta)
 
  263    rcoef = (fnorm*fac2*fac3) / (2.0_xp*fac1*dnp2)
 
  265       call jacobf(p, pd, pm1, pdm1, pm2, pdm2, np2, alpha, beta, z(i))
 
  266       w(i) = -rcoef/(p*pdm1)
 
 
  274  subroutine zwglj(Z, W, NP, ALPHA, BETA)
 
  275    integer, 
intent(in) :: NP
 
  276    real(kind=
rp), 
intent(inout) :: z(np), w(np)
 
  277    real(kind=
rp), 
intent(in) :: alpha, beta
 
  279    integer, 
parameter :: NMAX = 84
 
  280    integer, 
parameter :: NZD = nmax
 
  282    real(kind=
xp) zd(nzd), wd(nzd), alphad, betad
 
  286    if (np .gt. npmax) 
then 
  287       write (stderr, *) 
'Too large polynomial degree in ZWGLJ' 
  288       write (stderr, *) 
'Maximum polynomial degree is', nmax
 
  289       write (stderr, *) 
'Here NP=', np
 
  292    alphad = 
real(alpha, kind=
xp)
 
  293    betad = 
real(beta, kind=
xp)
 
  294    call zwgljd(zd, wd, np, alphad, betad)
 
  296       z(i) = 
real(zd(i), kind=
rp)
 
  297       w(i) = 
real(wd(i), kind=
rp)
 
 
  308    integer, 
intent(in) :: NP
 
  309    real(kind=
xp), 
intent(inout) :: z(np), w(np)
 
  310    real(kind=
xp), 
intent(in) :: alpha, beta
 
  312    real(kind=
xp) :: alpg, betg
 
  313    real(kind=
xp) :: p, pd, pm1, pdm1, pm2, pdm2
 
  320       write (stderr, *) 
'ZWGLJD: Minimum number of Gauss-Lobatto points is 2' 
  321       write (stderr, *) 
'ZWGLJD: alpha, beta:', alpha, beta, np
 
  323    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
  324       call neko_error(
'ZWGLJD: Alpha and Beta must be greater than -1')
 
  328       alpg = alpha + 1.0_xp
 
  330       call zwgjd(z(2), w(2), nm1, alpg, betg)
 
  336       w(i) = w(i) / (1.0_xp-z(i)**2)
 
  338    call jacobf(p, pd, pm1, pdm1, pm2, pdm2, n, alpha, beta, z(1))
 
  339    w(1) = 
endw1(n, alpha, beta) / (2.0_xp*pd)
 
  340    call jacobf(p, pd, pm1, pdm1, pm2, pdm2, n, alpha, beta, z(np))
 
  341    w(np) = 
endw2(n, alpha, beta) / (2.0_xp*pd)
 
 
  348    real(kind=
xp), 
intent(in) :: alpha, beta
 
  349    integer, 
intent(in) :: n
 
  352    real(kind=
xp) :: f1, f2, f3, fint1, fint2
 
  353    real(kind=
xp) :: a1, a2, a3, di, abn, abnn
 
  363    f1 = f1*(apb + 2.0_xp)*2.0_xp**(apb + 2.0_xp)/2.0_xp
 
  370    fint1 = fint1*2.0_xp**(apb + 2.0_xp)
 
  372    fint2 = fint2*2.0_xp**(apb + 3.0_xp)
 
  373    f2 = (-2.0_xp*(beta + 2.0_xp)*fint1 + (apb + 4.0_xp)*fint2) * &
 
  374         (apb + 3.0_xp) / 4.0_xp
 
  382       abn = alpha + beta + di
 
  384       a1 = -(2.0_xp*(di + alpha) * (di + beta)) / (abn*abnn*(abnn + 1.0_xp))
 
  385       a2 = (2.0_xp*(alpha - beta)) / (abnn*(abnn + 2.0_xp))
 
  386       a3 = (2.0_xp*(abn + 1.0_xp)) / ((abnn + 2.0_xp) * (abnn + 1.0_xp))
 
  387       f3 = -(a2*f2 + a1*f1) / a3
 
 
  397    real(kind=
xp), 
intent(in) :: alpha, beta
 
  398    integer, 
intent(in) :: n
 
  401    real(kind=
xp) :: f1, f2, f3, fint1, fint2
 
  402    real(kind=
xp) :: a1, a2, a3, di, abn, abnn
 
  413    f1 = f1*(apb + 2.0_xp)*2.0_xp**(apb + 2.0_xp)/2.0_xp
 
  420    fint1 = fint1*2.0_xp**(apb + 2.0_xp)
 
  422    fint2 = fint2*2.0_xp**(apb + 3.0_xp)
 
  423    f2 = (2.0_xp*(alpha + 2.0_xp)*fint1 - (apb + 4.0_xp)*fint2) * &
 
  424         (apb + 3.0_xp) / 4.0_xp
 
  432       abn = alpha + beta + di
 
  434       a1 = -(2.0_xp*(di + alpha) * (di + beta)) / (abn*abnn*(abnn + 1.0_xp))
 
  435       a2 = (2.0_xp*(alpha - beta)) / (abnn*(abnn + 2.0_xp))
 
  436       a3 = (2.0_xp*(abn + 1.0_xp)) / ((abnn + 2.0_xp) * (abnn + 1.0_xp))
 
  437       f3 = -(a2*f2 + a1*f1)/a3
 
 
  446    real(kind=
xp), 
intent(in) :: x
 
  447    real(kind=
xp), 
parameter :: 
pi = 4.0_xp*atan(1.0_xp)
 
  456    if (
abscmp(x, 3.5_xp)) 
gammaf = 0.5_xp * (2.5_xp * (1.5_xp * sqrt(
pi)))
 
 
  465    real(kind=
xp), 
intent(in) :: alpha, beta
 
  466    integer, 
intent(in) :: n
 
  468    real(kind=
xp) :: dn, dindx
 
  469    real(kind=
xp) :: const, prod, frac
 
  473    const = alpha + beta + 1.0_xp
 
  477       pnormj = prod * 2.0_xp**const / (2.0_xp*dn + const)
 
  482    prod = prod/(2.0_xp*(1.0_xp + const)*
gammaf(const + 1.0_xp))
 
  483    prod = prod*(1.0_xp + alpha) * (2.0_xp + alpha)
 
  484    prod = prod*(1.0_xp + beta) * (2.0_xp + beta)
 
  487       frac = (dindx + alpha) * (dindx + beta) / (dindx*(dindx + alpha + beta))
 
  490    pnormj = prod*2.0_xp**const / (2.0_xp*dn + const)
 
 
  499  subroutine jacg(XJAC, NP, ALPHA, BETA)
 
  500    integer, 
intent(in) :: NP
 
  501    real(kind=
xp), 
intent(inout) :: xjac(np)
 
  502    real(kind=
xp), 
intent(in) :: alpha, beta
 
  504    integer, 
parameter :: KSTOP = 10
 
  505    real(kind=
rp), 
parameter :: eps = 1.0e-12_rp
 
  506    real(kind=
xp), 
parameter :: 
pi = 4.0_xp*atan(1.0_xp)
 
  508    real(kind=
xp) :: dth, x, x1, x2, xlast, delx, xmin
 
  509    real(kind=
xp) :: p, pd, pm1, pdm1, pm2, pdm2
 
  510    real(kind=
xp) :: recsum, 
swap 
  511    integer :: I, J, K, N, JM, JMIN
 
  514    dth = 
pi / (2.0_xp*
real(n, kind=
xp) + 2.0_xp)
 
  517          x = cos((2.0_xp*(
real(j, kind=
xp) - 1.0_xp) + 1.0_xp)*dth)
 
  519          x1 = cos((2.0_xp*(
real(j, kind=
xp) - 1.0_xp) + 1.0_xp)*dth)
 
  521          x = (x1 + x2) / 2.0_xp
 
  525          call jacobf(p, pd, pm1, pdm1, pm2, pdm2, np, alpha, beta, x)
 
  529             recsum = recsum + 1.0_xp / (x-xjac(np - i + 1))
 
  531          delx = -p / (pd - recsum*p)
 
  533          if (abs(delx) .lt. eps) 
exit 
  543          if (xjac(j) .lt. xmin) 
then 
  548       if (jmin .ne. i) 
then 
 
  558  subroutine jacobf(POLY, PDER, POLYM1, PDERM1, POLYM2, PDERM2, N, ALP, BET, X)
 
  560    real(kind=
xp), 
intent(inout) :: poly, pder, polym1, pderm1, polym2, pderm2
 
  561    real(kind=
xp), 
intent(in) :: alp, bet, x
 
  562    integer, 
intent(in) :: N
 
  564    real(kind=
xp) :: apb, polyl, pderl, polyn, pdern
 
  565    real(kind=
xp) :: psave, pdsave
 
  566    real(kind=
xp) :: a1, a2, a3, a4, b3
 
  577    poly = (alp - bet + (apb + 2.0_xp)*x) / 2.0_xp
 
  578    pder = (apb + 2.0_xp) / 2.0_xp
 
  583       a1 = 2.0_xp*dk*(dk + apb) * (2.0_xp*dk + apb - 2.0_xp)
 
  584       a2 = (2.0_xp*dk + apb - 1.0_xp) * (alp**2 - bet**2)
 
  585       b3 = (2.0_xp*dk + apb - 2.0_xp)
 
  586       a3 = b3*(b3 + 1.0_xp) * (b3 + 2.0_xp)
 
  587       a4 = 2.0_xp*(dk + alp - 1.0_xp) * (dk + bet - 1.0_xp) * (2.0_xp*dk + apb)
 
  588       polyn = ((a2 + a3*x)*poly - a4*polyl) / a1
 
  589       pdern = ((a2 + a3*x)*pder - a4*pderl + a3*poly) / a1
 
 
  606  real(kind=
xp) 
function hgj(II, Z, ZGJ, NP, ALPHA, BETA)
 
  607    integer, 
intent(in) :: np, ii
 
  608    real(kind=
xp), 
intent(in) :: z, zgj(np), alpha, beta
 
  610    integer, 
parameter :: nmax = 84
 
  611    integer, 
parameter :: nzd = nmax
 
  613    real(kind=
xp) zd, zgjd(nzd)
 
  617    if (np .gt. npmax) 
then 
  618       write (stderr, *) 
'Too large polynomial degree in HGJ' 
  619       write (stderr, *) 
'Maximum polynomial degree is', nmax
 
  620       write (stderr, *) 
'Here NP=', np
 
  628    hgj = 
hgjd(ii, zd, zgjd, np, alpha, beta)
 
 
  634  real(kind=
xp) 
function hgjd(II, Z, ZGJ, NP, ALPHA, BETA)
 
  635    integer, 
intent(in) :: np, ii
 
  636    real(kind=
xp), 
intent(in) :: z, zgj(np), alpha, beta
 
  638    real(kind=
xp) :: eps, zi, dz
 
  639    real(kind=
xp) :: pz, pdz, pzi, pdzi, pm1, pdm1, pm2, pdm2
 
  644    if (abs(dz) .lt. eps) 
then 
  648    call jacobf(pzi, pdzi, pm1, pdm1, pm2, pdm2, np, alpha, beta, zi)
 
  649    call jacobf(pz, pdz, pm1, pdm1, pm2, pdm2, np, alpha, beta, z)
 
  650    hgjd = pz / (pdzi*(z-zi))
 
 
  656  real(kind=
xp) 
function hglj(II, Z, ZGLJ, NP, ALPHA, BETA)
 
  657    integer, 
intent(in) :: np, ii
 
  658    real(kind=
xp), 
intent(in) :: z, zglj(np), alpha, beta
 
  660    integer, 
parameter :: nmax = 84
 
  661    integer, 
parameter :: nzd = nmax
 
  663    real(kind=
xp) zd, zgljd(nzd)
 
  667    if (np .gt. npmax) 
then 
  668       write (stderr, *) 
'Too large polynomial degree in HGLJ' 
  669       write (stderr, *) 
'Maximum polynomial degree is', nmax
 
  670       write (stderr, *) 
'Here NP=', np
 
  677    hglj = 
hgljd(ii, zd, zgljd, np, alpha, beta)
 
 
  683  real(kind=
xp) 
function hgljd(I, Z, ZGLJ, NP, ALPHA, BETA)
 
  684    integer, 
intent(in) :: np, i
 
  685    real(kind=
xp), 
intent(in) :: z, zglj(np), alpha, beta
 
  687    real(kind=
xp) :: eps, zi, dz, dn
 
  688    real(kind=
xp) :: p, pd, 
pi, pdi, pm1, pdm1, pm2, pdm2
 
  689    real(kind=
xp) :: eigval, const
 
  695    if (abs(dz) .lt. eps) 
then 
  702    eigval = -dn*(dn + alpha + beta + 1.0_xp)
 
  703    call jacobf(
pi, pdi, pm1, pdm1, pm2, pdm2, n, alpha, beta, zi)
 
  704    const = eigval*
pi + alpha*(1.0_xp + zi)*pdi - beta*(1.0_xp - zi)*pdi
 
  705    call jacobf(p, pd, pm1, pdm1, pm2, pdm2, n, alpha, beta, z)
 
  706    hgljd = (1.0_xp - z**2)*pd / (const*(z - zi))
 
 
  714  subroutine dgj(D, DT, Z, NZ, NZD, ALPHA, BETA)
 
  715    integer, 
intent(in) :: NZ, NZD
 
  716    real(kind=
xp), 
intent(inout) :: d(nzd, nzd), dt(nzd, nzd)
 
  717    real(kind=
xp), 
intent(in) :: z(nz), alpha, beta
 
  719    integer, 
parameter :: NMAX = 84
 
  720    integer, 
parameter :: NZDD = nmax
 
  722    real(kind=
xp) :: dd(nzdd, nzdd), dtd(nzdd, nzdd), zd(nzdd)
 
  726       call neko_error(
'DGJ: Minimum number of Gauss points is 1')
 
  727    else if (nz .gt. nmax) 
then 
  728       write (stderr, *) 
'Too large polynomial degree in DGJ' 
  729       write (stderr, *) 
'Maximum polynomial degree is', nmax
 
  730       write (stderr, *) 
'Here Nz=', nz
 
  732    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
  733       call neko_error(
'DGJ: Alpha and Beta must be greater than -1')
 
  739    call dgjd(dd, dtd, zd, nz, nzdd, alpha, beta)
 
 
  753  subroutine dgjd(D, DT, Z, NZ, NZD, ALPHA, BETA)
 
  754    integer, 
intent(in) :: NZ, NZD
 
  755    real(kind=
xp), 
intent(inout) :: d(nzd, nzd), dt(nzd, nzd)
 
  756    real(kind=
xp), 
intent(in) :: z(nz), alpha, beta
 
  759    real(kind=
xp) :: pdi, pdj, 
pi, pj, pm1, pdm1, pm2, pdm2
 
  767       call neko_error(
'DGJD: Minimum number of Gauss-Lobatto points is 2')
 
  768    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
  769       call neko_error(
'DGJD: Alpha and Beta must be greater than -1')
 
  774          call jacobf(
pi, pdi, pm1, pdm1, pm2, pdm2, nz, alpha, beta, z(i))
 
  775          call jacobf(pj, pdj, pm1, pdm1, pm2, pdm2, nz, alpha, beta, z(j))
 
  777             d(i, j) = pdi / (pdj*(z(i) - z(j)))
 
  779             d(i, j) = ((alpha + beta + 2.0_xp)*z(i) + alpha - beta) / &
 
  780                  (2.0_xp*(1.0_xp - z(i)**2))
 
 
  792  subroutine dglj(D, DT, Z, NZ, NZD, ALPHA, BETA)
 
  793    integer, 
parameter :: NMAX = 84
 
  794    integer, 
parameter :: NZDD = nmax
 
  795    integer, 
intent(in) :: NZ, NZD
 
  796    real(kind=
xp), 
intent(inout) :: d(nzd, nzd), dt(nzd, nzd)
 
  797    real(kind=
xp), 
intent(in) :: z(nz), alpha, beta
 
  799    real(kind=
xp) :: dd(nzdd, nzdd), dtd(nzdd, nzdd), zd(nzdd)
 
  803       call neko_error(
'DGLJ: Minimum number of Gauss-Lobatto points is 2')
 
  804    else if (nz .gt. nmax) 
then 
  805       write (stderr, *) 
'Too large polynomial degree in DGLJ' 
  806       write (stderr, *) 
'Maximum polynomial degree is', nmax
 
  807       write (stderr, *) 
'Here NZ=', nz
 
  809    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
  810       call neko_error(
'DGLJ: Alpha and Beta must be greater than -1')
 
  816    call dgljd(dd, dtd, zd, nz, nzdd, alpha, beta)
 
 
  831  subroutine dgljd(D, DT, Z, NZ, NZD, ALPHA, BETA)
 
  832    integer, 
intent(in) :: NZ, NZD
 
  833    real(kind=
xp), 
intent(inout) :: d(nzd, nzd), dt(nzd, nzd)
 
  834    real(kind=
xp), 
intent(in) :: z(nz), alpha, beta
 
  836    real(kind=
xp) :: dn, eigval
 
  837    real(kind=
xp) :: pdi, pdj, 
pi, pj, pm1, pdm1, pm2, pdm2
 
  838    real(kind=
xp) :: ci, cj
 
  844    eigval = -dn*(dn + alpha + beta + 1.0_xp)
 
  847       call neko_error(
'DGLJD: Minimum number of Gauss-Lobatto points is 2')
 
  848    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
  849       call neko_error(
'DGLJD: Alpha and Beta must be greater than -1')
 
  854          call jacobf(
pi, pdi, pm1, pdm1, pm2, pdm2, n, alpha, beta, z(i))
 
  855          call jacobf(pj, pdj, pm1, pdm1, pm2, pdm2, n, alpha, beta, z(j))
 
  856          ci = eigval*
pi - (beta*(1.0_xp - z(i)) - alpha*(1.0_xp + z(i)))*pdi
 
  857          cj = eigval*pj - (beta*(1.0_xp - z(j)) - alpha*(1.0_xp + z(j)))*pdj
 
  861             d(i, j) = ci / (cj*(z(i) - z(j)))
 
  862          else if (i .eq. 1) 
then 
  863             d(i, j) = (eigval + alpha) / (2.0_xp*(beta + 2.0_xp))
 
  864          else if (i .eq. nz) 
then 
  865             d(i, j) = -(eigval + beta) / (2.0_xp*(alpha + 2.0_xp))
 
  867             d(i, j) = (alpha*(1.0_xp + z(i)) - beta*(1.0_xp - z(i))) / &
 
  868                  (2.0_xp*(1.0_xp - z(i)**2))
 
 
  879  subroutine dgll(D, DT, Z, NZ, NZD)
 
  881    integer, 
intent(in) :: NZ, NZD
 
  882    real(kind=
rp), 
intent(inout) :: d(nzd, nzd), dt(nzd, nzd)
 
  883    real(kind=
rp), 
intent(in) :: z(nz)
 
  885    integer, 
parameter :: NMAX = 84
 
  887    real(kind=
xp) :: d0, fn
 
  891    if (nz .gt. nmax) 
then 
  892       write (stderr, *) 
'Subroutine DGLL' 
  893       write (stderr, *) 
'Maximum polynomial degree =', nmax
 
  894       write (stderr, *) 
'Polynomial degree         =', nz
 
  896    else if (nz .eq. 1) 
then 
  902    d0 = fn*(fn + 1.0_xp)/4.0_xp
 
  908          else if (i .eq. 1) 
then 
  910          else if (i .eq. nz) 
then 
 
  922  real(kind=
xp) 
function hgll(I, Z, ZGLL, NZ)
 
  923    integer, 
intent(in) :: i, nz
 
  924    real(kind=
xp), 
intent(in) :: zgll(nz), z
 
  926    real(kind=
xp) :: eps, dz
 
  927    real(kind=
xp) :: alfan
 
  932    if (abs(dz) .lt. eps) 
then 
 
  945  real(kind=
xp) 
function hgl (I, Z, ZGL, NZ)
 
  946    integer, 
intent(in) :: i, nz
 
  947    real(kind=
xp), 
intent(in) :: zgl(nz), z
 
  948    real(kind=
xp) :: eps, dz
 
  954    if (abs(dz) .lt. eps) 
then 
 
  977    real(kind=
xp), 
intent(in) :: z
 
  978    integer, 
intent(in) :: n
 
  980    real(kind=
xp) :: p1, p2, p3, fk
 
  993       p3 = ((2.0_xp*fk + 1.0_xp)*z*p2 - fk*p1) / (fk + 1.0_xp)
 
 
 1003    integer, 
intent(in) :: N
 
 1004    real(kind=
rp), 
intent(inout) :: l(0:n)
 
 1005    real(kind=
rp), 
intent(in) :: x
 
 1011    if (n .eq. 0) 
return 
 1016       l(j + 1) = ((2.0_rp*dj + 1.0_rp)*x*l(j) - dj*l(j-1)) / (dj + 1.0_rp)
 
 
 1024    real(kind=
xp), 
intent(in) :: z
 
 1025    integer, 
intent(in) :: n
 
 1027    real(kind=
xp) :: p1, p2, p3, p1d, p2d, p3d, fk
 
 1042       p3 = ((2.0_xp*fk + 1.0_xp)*z*p2 - fk*p1) / (fk + 1.0_xp)
 
 1043       p3d = ((2.0_xp*fk + 1.0_xp)*p2 + (2.0_xp*fk + 1.0_xp)*z*p2d - fk*p1d) / &
 
 
 1060  subroutine dgllgl(D, DT, ZM1, ZM2, IM12, NZM1, NZM2, ND1, ND2)
 
 1061    integer, 
intent(in) :: NZM1, NZM2, ND1, ND2
 
 1062    real(kind=
xp), 
intent(inout) :: d(nd2, nd1), dt(nd1, nd2)
 
 1063    real(kind=
xp), 
intent(in) :: zm1(nd1), zm2(nd2), im12(nd2, nd1)
 
 1065    real(kind=
xp) eps, zp, zq
 
 1066    integer :: IP, JQ, NM1
 
 1068    if (nzm1 .eq. 1) 
then 
 1079          if ((abs(zp) .lt. eps) .and. (abs(zq) .lt. eps)) 
then 
 1082             d(ip, jq) = (
pnleg(zp, nm1) / 
pnleg(zq, nm1) - im12(ip, jq)) / &
 
 1085          dt(jq, ip) = d(ip, jq)
 
 
 1098  subroutine dgljgj(D, DT, ZGL, ZG, IGLG, NPGL, NPG, ND1, ND2, ALPHA, BETA)
 
 1099    integer, 
intent(in) :: NPGL, NPG, ND1, ND2
 
 1100    real(kind=
xp), 
intent(inout) :: d(nd2, nd1), dt(nd1, nd2)
 
 1101    real(kind=
xp), 
intent(in) :: zgl(nd1), zg(nd2), iglg(nd2, nd1), alpha, beta
 
 1103    integer, 
parameter :: NMAX = 84
 
 1104    integer, 
parameter :: NDD = nmax
 
 1106    real(kind=
xp) dd(ndd, ndd), dtd(ndd, ndd)
 
 1107    real(kind=
xp) zgd(ndd), zgld(ndd), iglgd(ndd, ndd)
 
 1110    if (npgl .le. 1) 
then 
 1111       call neko_error(
'DGLJGJ: Minimum number of Gauss-Lobatto points is 2')
 
 1112    else if (npgl .gt. nmax) 
then 
 1113       write(stderr, *) 
'Polynomial degree too high in DGLJGJ' 
 1114       write(stderr, *) 
'Maximum polynomial degree is', nmax
 
 1115       write(stderr, *) 
'Here NPGL=', npgl
 
 1117    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
 1118       call neko_error(
'DGLJGJ: Alpha and Beta must be greater than -1')
 
 1124          iglgd(i, j) = iglg(i, j)
 
 1130    call dgljgjd(dd, dtd, zgld, zgd, iglgd, npgl, npg, ndd, ndd, alpha, beta)
 
 1134          dt(j, i) = dtd(j, i)
 
 
 1147  subroutine dgljgjd(D, DT, ZGL, ZG, IGLG, NPGL, NPG, ND1, ND2, ALPHA, BETA)
 
 1148    integer, 
intent(in) :: NPGL, NPG, ND1, ND2
 
 1149    real(kind=
xp), 
intent(inout) :: d(nd2, nd1), dt(nd1, nd2)
 
 1150    real(kind=
xp), 
intent(in) :: zgl(nd1), zg(nd2), iglg(nd2, nd1), alpha, beta
 
 1152    real(kind=
xp) :: eps, eigval, dn
 
 1153    real(kind=
xp) :: pdi, pdj, 
pi, pj, pm1, pdm1, pm2, pdm2
 
 1154    real(kind=
xp) :: dz, faci, facj, const
 
 1155    integer :: I, J, NGL
 
 1157    if (npgl .le. 1) 
then 
 1158       call neko_error(
'DGLJGJD: Minimum number of Gauss-Lobatto points is 2')
 
 1159    else if ((alpha .le. -1.0_xp) .or. (beta .le. -1.0_xp)) 
then 
 1160       call neko_error(
'DGLJGJD: Alpha and Beta must be greater than -1')
 
 1167    eigval = -dn*(dn + alpha + beta + 1.0_xp)
 
 1171          dz = abs(zg(i)-zgl(j))
 
 1172          if (dz .lt. eps) 
then 
 1173             d(i, j) = (alpha*(1.0_xp + zg(i)) - beta*(1.0_xp - zg(i))) / &
 
 1174                  (2.0_xp*(1.0_xp - zg(i)**2))
 
 1176             call jacobf(
pi, pdi, pm1, pdm1, pm2, pdm2, ngl, alpha, beta, zg(i))
 
 1177             call jacobf(pj, pdj, pm1, pdm1, pm2, pdm2, ngl, alpha, beta, zgl(j))
 
 1178             faci = alpha*(1.0_xp + zg(i)) - beta*(1.0_xp - zg(i))
 
 1179             facj = alpha*(1.0_xp + zgl(j)) - beta*(1.0_xp - zgl(j))
 
 1180             const = eigval*pj + facj*pdj
 
 1181             d(i, j) = ((eigval*
pi + faci*pdi) * (zg(i) - zgl(j)) - &
 
 1182                  (1.0_xp - zg(i)**2)*pdi) / (const*(zg(i) - zgl(j))**2)
 
 
 1194  subroutine iglm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2)
 
 1195    integer, 
intent(in) :: NZ1, NZ2, ND1, ND2
 
 1196    real(kind=
xp), 
intent(inout) :: i12(nd2, nd1), it12(nd1, nd2)
 
 1197    real(kind=
xp), 
intent(in) :: z1(nd1), z2(nd2)
 
 1201    if (nz1 .eq. 1) 
then 
 1210          i12(i, j) = 
hgl(j, zi, z1, nz1)
 
 1211          it12(j, i) = i12(i, j)
 
 
 1221  subroutine igllm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2)
 
 1222    integer, 
intent(in) :: NZ1, NZ2, ND1, ND2
 
 1223    real(kind=
xp), 
intent(inout) :: i12(nd2, nd1), it12(nd1, nd2)
 
 1224    real(kind=
xp), 
intent(in) :: z1(nd1), z2(nd2)
 
 1228    if (nz1 .eq. 1) 
then 
 1237          i12(i, j) = 
hgll(j, zi, z1, nz1)
 
 1238          it12(j, i) = i12(i, j)
 
 
 1241  end subroutine igllm 
 1249  subroutine igjm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2, ALPHA, BETA)
 
 1250    integer, 
intent(in) :: NZ1, NZ2, ND1, ND2
 
 1251    real(kind=
xp), 
intent(inout) :: i12(nd2, nd1), it12(nd1, nd2)
 
 1252    real(kind=
xp), 
intent(in) :: z1(nd1), z2(nd2), alpha, beta
 
 1256    if (nz1 .eq. 1) 
then 
 1265          i12(i, j) = 
hgj(j, zi, z1, nz1, alpha, beta)
 
 1266          it12(j, i) = i12(i, j)
 
 
 1277  subroutine igljm(I12, IT12, Z1, Z2, NZ1, NZ2, ND1, ND2, ALPHA, BETA)
 
 1278    integer, 
intent(in) :: NZ1, NZ2, ND1, ND2
 
 1279    real(kind=
xp), 
intent(inout) :: i12(nd2, nd1), it12(nd1, nd2)
 
 1280    real(kind=
xp), 
intent(in) :: z1(nd1), z2(nd2), alpha, beta
 
 1284    if (nz1 .eq. 1) 
then 
 1293          i12(i, j) = 
hglj(j, zi, z1, nz1, alpha, beta)
 
 1294          it12(j, i) = i12(i, j)
 
 
 1297  end subroutine igljm 
real(kind=rp), parameter, public pi
 
integer, parameter, public xp
 
integer, parameter, public rp
Global precision used in computations.
 
LIBRARY ROUTINES FOR SPECTRAL METHODS.
 
subroutine dgj(d, dt, z, nz, nzd, alpha, beta)
Compute the derivative matrix D and its transpose DT associated with the Nth order Lagrangian interpo...
 
real(kind=xp) function pndleg(z, n)
Compute the derivative of the Nth order Legendre polynomial at Z. (Simpler than JACOBF) Based on the ...
 
subroutine dgll(d, dt, z, nz, nzd)
Compute the derivative matrix D and its transpose DT associated with the Nth order Lagrangian interpo...
 
subroutine igjm(i12, it12, z1, z2, nz1, nz2, nd1, nd2, alpha, beta)
Compute the one-dimensional interpolation operator (matrix) I12 ands its transpose IT12 for interpola...
 
real(kind=xp) function hgj(ii, z, zgj, np, alpha, beta)
Compute the value of the Lagrangian interpolant HGJ through the NP Gauss Jacobi points ZGJ at the poi...
 
subroutine dgllgl(d, dt, zm1, zm2, im12, nzm1, nzm2, nd1, nd2)
Compute the (one-dimensional) derivative matrix D and its transpose DT associated with taking the der...
 
subroutine zwgll(z, w, np)
Generate NP Gauss-Lobatto Legendre points (Z) and weights (W) associated with Jacobi polynomial P(N)(...
 
real(kind=xp) function pnormj(n, alpha, beta)
 
subroutine dgjd(d, dt, z, nz, nzd, alpha, beta)
Compute the derivative matrix D and its transpose DT associated with the Nth order Lagrangian interpo...
 
real(kind=xp) function gammaf(x)
 
subroutine jacg(xjac, np, alpha, beta)
Compute NP Gauss points XJAC, which are the zeros of the Jacobi polynomial J(NP) with parameters ALPH...
 
subroutine zwgljd(z, w, np, alpha, beta)
Generate NP GAUSS LOBATTO JACOBI points (Z) and weights (W) associated with Jacobi polynomial P(N)(al...
 
real(kind=xp) function hglj(ii, z, zglj, np, alpha, beta)
Compute the value of the Lagrangian interpolant HGLJ through the NZ Gauss-Lobatto Jacobi points ZGLJ ...
 
real(kind=xp) function hgljd(i, z, zglj, np, alpha, beta)
Compute the value of the Lagrangian interpolant HGLJD through the NZ Gauss-Lobatto Jacobi points ZJAC...
 
subroutine zwglj(z, w, np, alpha, beta)
Generate NP GAUSS LOBATTO JACOBI points (Z) and weights (W) associated with Jacobi polynomial P(N)(al...
 
subroutine zwgj(z, w, np, alpha, beta)
Generate NP GAUSS JACOBI points (Z) and weights (W) associated with Jacobi polynomial P(N)(alpha>-1,...
 
subroutine iglm(i12, it12, z1, z2, nz1, nz2, nd1, nd2)
Compute the one-dimensional interpolation operator (matrix) I12 ands its transpose IT12 for interpola...
 
subroutine jacobf(poly, pder, polym1, pderm1, polym2, pderm2, n, alp, bet, x)
Computes the Jacobi polynomial (POLY) and its derivative (PDER) of degree N at X.
 
subroutine zwgjd(z, w, np, alpha, beta)
Generate NP GAUSS JACOBI points (Z) and weights (W) associated with Jacobi polynomial P(N)(alpha>-1,...
 
subroutine dglj(d, dt, z, nz, nzd, alpha, beta)
Compute the derivative matrix D and its transpose DT associated with the Nth order Lagrangian interpo...
 
subroutine dgljgj(d, dt, zgl, zg, iglg, npgl, npg, nd1, nd2, alpha, beta)
Compute the (one-dimensional) derivative matrix D and its transpose DT associated with taking the der...
 
real(kind=xp) function pnleg(z, n)
Compute the value of the Nth order Legendre polynomial at Z. (Simpler than JACOBF) Based on the recur...
 
real(kind=xp) function hgl(i, z, zgl, nz)
Compute the value of the Lagrangian interpolant HGL through the NZ Gauss Legendre points ZGL at the p...
 
subroutine dgljd(d, dt, z, nz, nzd, alpha, beta)
Compute the derivative matrix D and its transpose DT associated with the Nth order Lagrangian interpo...
 
subroutine legendre_poly(l, x, n)
Evaluate Legendre polynomials of degrees 0-N at point x and store in array L.
 
real(kind=xp) function endw1(n, alpha, beta)
 
subroutine igllm(i12, it12, z1, z2, nz1, nz2, nd1, nd2)
Compute the one-dimensional interpolation operator (matrix) I12 ands its transpose IT12 for interpola...
 
subroutine dgljgjd(d, dt, zgl, zg, iglg, npgl, npg, nd1, nd2, alpha, beta)
Compute the (one-dimensional) derivative matrix D and its transpose DT associated with taking the der...
 
subroutine zwgl(z, w, np)
Generate NP Gauss Legendre points Z and weights W associated with Jacobi polynomial ....
 
real(kind=xp) function hgll(i, z, zgll, nz)
Compute the value of the Lagrangian interpolant L through the NZ Gauss-Lobatto Legendre points ZGLL a...
 
real(kind=xp) function hgjd(ii, z, zgj, np, alpha, beta)
Compute the value of the Lagrangian interpolant HGJD through the NZ Gauss-Lobatto Jacobi points ZGJ a...
 
real(kind=xp) function endw2(n, alpha, beta)
 
subroutine igljm(i12, it12, z1, z2, nz1, nz2, nd1, nd2, alpha, beta)
Compute the one-dimensional interpolation operator (matrix) I12 ands its transpose IT12 for interpola...