10#include "scaleFElib.h"
17 use scale_const,
only: &
57 private :: gen_jacobigaussquadraturepts
71 integer,
intent(in) :: nord
72 real(rp),
intent(in) :: x_lgl(nord+1)
73 real(rp),
intent(in) :: x(:)
74 real(rp) :: l(size(x), nord+1)
77 real(rp) :: p_lgl(nord+1,nord+1)
78 real(rp) :: p(size(x),nord+1)
79 real(rp) :: pr(size(x),nord+1)
91 if ( abs(x(i)-x_lgl(n)) < 1e-15_rp )
then
95 (x(i) - 1.0_rp)*(x(i) + 1.0_rp)*pr(i,nord+1) &
96 / (dble(nord*(nord+1))*p_lgl(n,nord+1)*(x(i) - x_lgl(n)))
130 integer,
intent(in) :: nord
131 real(rp),
intent(in) :: x_lgl(nord+1)
132 real(rp) :: lr(nord+1, nord+1)
135 real(rp) :: p(nord+1,nord+1)
144 if (k==1 .and. n==1)
then
145 lr(k,n) = - 0.25_rp*dble(nord*(nord+1))
146 else if (k==nord+1 .and. n==nord+1)
then
147 lr(k,n) = + 0.25_rp*dble(nord*(nord+1))
151 lr(k,n) = p(n,nord+1)/(p(k,nord+1)*(x_lgl(n) - x_lgl(k)))
155 lr_nn = lr_nn + lr(k,n)
173 integer,
intent(in) :: nord
174 real(rp),
intent(in) :: x_lgl(nord+1)
175 real(rp),
intent(in) :: x_eval(:)
176 real(rp) :: lr(size(x_eval),nord+1)
178 real(rp) :: p(nord+1,nord+1)
179 real(rp) :: bw(nord+1)
181 real(rp) :: a(nord+1)
191 bw(:) = 1.0_rp / p(:,nord+1)
193 tol = 100.0_rp * epsilon(1.0_rp)
195 do m = 1,
size(x_eval)
200 if ( abs(x_eval(m)-x_lgl(k)) <= tol )
then
206 if ( knode /= 0 )
then
209 if ( k /= knode )
then
210 lr(m,k) = p(knode,nord+1) / ( p(k,nord+1) * ( x_lgl(knode)-x_lgl(k) ) )
217 lr(m,knode) = -sum(lr(m,:))
226 s1 = 0.0_rp; s2 = 0.0_rp
228 dx = x_eval(m) - x_lgl(j)
232 s2 = s2 + bw(j) / ( dx * dx )
237 dx = x_eval(m) - x_lgl(k)
238 lr(m,k) = ( a(k) / s1 ) * ( s2 / s1 - 1.0_rp / dx )
256 integer,
intent(in) :: nord
257 real(rp),
intent(in) :: x(:)
258 real(rp),
intent(out) :: p(size(x), nord+1)
264 log_error(
"Polynomial_GenLegendrePoly",*)
"Nord must be larger than 0."
272 p(:,n+1) = ( dble(2*n-1)*x(:)*p(:,n) - dble(n-1)*p(:,n-1) )/dble(n)
287 integer,
intent(in) :: nord
288 real(rp),
intent(in) :: x(:)
289 real(rp) :: p(size(x), nord+1)
306 integer,
intent(in) :: nord
307 real(rp),
intent(in) :: x(:)
308 real(rp),
intent(in) :: p(:,:)
309 real(rp) :: gradp(size(x), nord+1)
315 log_error(
"Polynomial_GenDLegendrePoly",*)
"Nord must be larger than 0."
319 if (nord == 0)
return
323 gradp(:,n+1) = 2.0_rp*x(:)*gradp(:,n) - gradp(:,n-1) + p(:,n)
337 integer,
intent(in) :: nord
338 real(rp) :: pts(nord+1)
343 pts(1) = -1.0_rp; pts(nord+1) = 1.0_rp
346 call gen_jacobigaussquadraturepts( 1, 1, nord-2, pts(2:nord) )
358 integer,
intent(in) :: nord
359 real(rp) :: int_weight_lgl(nord+1)
361 real(rp) :: lglpts1d(nord+1)
362 real(rp) :: p1d_ori(nord+1, nord+1)
368 int_weight_lgl(:) = 2.0_rp/(dble(nord*(nord+1))*p1d_ori(:,nord+1)**2)
381 integer,
intent(in) :: nord
382 real(rp) :: pts(nord)
385 call gen_jacobigaussquadraturepts( 0, 0, nord-1, pts(:) )
397 integer,
intent(in) :: nord
398 real(rp) :: int_weight_gl(nord)
400 real(rp) :: glpts1d(nord)
401 real(rp) :: p1d_ori(nord, nord+1)
402 real(rp) :: dp1d_ori(nord, nord+1)
409 int_weight_gl(:) = 2.0_rp / ( (1.0_rp - glpts1d(:)**2) * dp1d_ori(:,nord+1)**2 )
418 subroutine gen_jacobigaussquadraturepts( alpha, beta, N, &
422 integer,
intent(in) :: alpha
423 integer,
intent(in) :: beta
424 integer,
intent(in) :: n
425 real(rp),
intent(out) :: x(n+1)
428 real(dp) :: d(n+1), e(n)
429 real(dp) :: work(2*(n+1)-2), z(n+1,n+1)
435 x(1) = - dble(alpha - beta) / dble(alpha + beta + 2)
440 h1(i+1) = dble( 2*i + alpha + beta )
444 d(i) = - dble(alpha**2 - beta**2) / (h1(i) * (h1(i) + 2d0))
447 e(i) = 2d0 / (h1(i) + 2d0) &
448 * sqrt( dble(i * (i + alpha + beta) * (i + alpha) * (i + beta)) &
449 / ((h1(i) + 1d0) * (h1(i) + 3d0)) )
451 if ( dble(alpha + beta) < 1d-16) d(1) = 0.0_rp
453 call dstev(
'Vectors', n+1, d, e, z, n+1, work, info )
457 end subroutine gen_jacobigaussquadraturepts
Module common / Polynomial.
real(rp) function, dimension(nord), public polynomial_gengausslegendreptintweight(nord)
A function to calculate the Gauss-Legendre (GL) weights.
real(rp) function, dimension(size(x), nord+1), public polynomial_gendlegendrepoly(nord, x, p)
A function to obtain differential values of Legendre polynomials which are evaluated at arbitrary poi...
real(rp) function, dimension(size(x), nord+1), public polynomial_genlegendrepoly(nord, x)
A function to obtain the values of Legendre polynomials which are evaluated at arbitrary points.
real(rp) function, dimension(nord+1), public polynomial_gengausslobattopt(nord)
A function to calculate the Legendre-Gauss-Lobatto (LGL) points.
real(rp) function, dimension(size(x), nord+1), public polynomial_genlagrangepoly(nord, x_lgl, x)
A function to obtain the Lagrange basis functions related to the Gauss-Legendre-Lobatto (GLL) points.
real(rp) function, dimension(nord), public polynomial_gengausslegendrept(nord)
A function to calculate the Gauss-Legendre (GL) points.
real(rp) real(rp) function, dimension(n, k), public polynomial_gendlagrangepoly_lglpt(nord, x_lgl)
Differential values of Lagrange basis functions at the GLL points.
real(rp) real(rp) function, dimension(m, k), public polynomial_gendlagrangepoly(nord, x_lgl, x_eval)
Differential values of Lagrange basis functions defined at GLL nodes, evaluated at arbitrary points.
real(rp) function, dimension(nord+1), public polynomial_gengausslobattoptintweight(nord)
A function to calculate the Gauss-Lobbato weights.
subroutine, public polynomial_genlegendrepoly_sub(nord, x, p)
A function to obtain the values of Legendre polynomials which are evaluated at arbitrary points.