cheb_node Subroutine

public subroutine cheb_node(tag, a, b, n, xcol, is_descending)

This subroutine returns coordinates of the Chebyshev nodes in [a,b].

References

  1. R. Baltensperger and M. R. Trummer, "Spectral differencing with a twist", SIAM J. Sci. Comput., Vol. 24, No. 5, pp. 1465–1487, 2003. Page 1471, first paragraph.

  2. J. A. C. Weideman and S. C. Reddy, "A MATLAB Differentiation Matrix Suite", ACM Transactions on Mathematical Software, Vol. 26, No. 4, December 2000, Pages 465–519.

Note

From Ref 2. An additional complication is the fact that sin(theta) can be computed to high relative accuracy when theta is almost equal to zero, but sin(pi-theta) cannot.

Implementation notes. In view of the above, the formulas are rearranged using the identity cos(theta) = sin(pi/2 - theta), such that we need to calculate the sines of angles in [0,pi/2]. Moreover, the CG and CGL nodes are symmetric about the origin; so, for enhanced accuracy and symmetry, we only calculate values which are less than zero and change their signs the positive part to preserve symmetry. The CGR points are not symmetric, so no such reflection is possible. However, we still evaluate the sines for angles in [0,pi/2].

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: tag

{'CGL', 'CG', 'CGR'}
Type of nodes, where 'CGL': Chebyshev-Gauss-Lobatto, 'CG': Chebyshev-Gauss, and 'CGR': Chebyshev-Gauss-Radau.

real(kind=rp), intent(in) :: a

Domain bounds [a, b]

real(kind=rp), intent(in) :: b

Domain bounds [a, b]

integer, intent(in) :: n

Degree of polynomial.

real(kind=rp), intent(out), dimension(0:n) :: xcol

(n+1,). Vector of nodal coordinates.

logical, intent(in), optional :: is_descending

{T,F} Coordinates in ascending (default) or descending order.