legendre Module

Legendre module written by Son, Sang-Kil in Dec. 2003 rewritten by Son, Sang-Kil in Feb. 2005 - May 2005 author Sang-Kil Son generate_LGL_points is rewritten with Fortran 90 from Appendix C in Canuto, Spectral Methods in Fluid Dynamics (1988).

  • F Legendre_P( n, x ): Legendre polynomial P_n(x)
  • F Legendre_dP( n, x ): 1st derivative of P, P'_n(x)
  • F normalized_Legendre_P( n, x ): sqrt((2n+1)/2)*P_n(x)
  • F associated_Legendre_P( l, m, x ): associated Legendre poly. P_l^m(x)
  • SR calculate_Legendre( n, x, p, dp ): gives P and P'
  • SR generate_LGL_points( x, N ): make grid points using P'_N+1(x)=0

Uses


Functions

public function legendre_p(n, x) result(p)

Function to calculate the Legendre function of x with order n

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real(kind=long), intent(in) :: x

Return Value real(kind=long)

public function associated_legendre_p(l, m, x) result(p)

Function to compute the associated Legendre function of x with order l & m ref) Numerical Recipes in Fortran, pp 246-248

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: l
integer, intent(in) :: m
real(kind=long), intent(in) :: x

Return Value real(kind=long)

public function legendre_dp(n, x) result(dp)

Function to calculate 1st derivative of the Legendre f. of x with order n

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real(kind=long), intent(in) :: x

Return Value real(kind=long)


Subroutines

public subroutine associated_legendre_p_array(lmax, x, p)

this function calculates all associated Legendre polynomials for every l,m < lmax and return them in an array adapted from the numerical recipes implementation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: lmax
real(kind=long), intent(in) :: x
real(kind=long), intent(out), dimension((lmax + 1)*(lmax + 2)/2) :: p

public subroutine calculate_legendre(n, x, p, dp)

Calculate the value of the Legendre polynomial and its derivative input : n = the order of poly., x = the point to be calculated results : p = P_n(x), dp = P'_n(x)

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real(kind=long), intent(in) :: x
real(kind=long), intent(out) :: p
real(kind=long), intent(out) :: dp