new_fourier_kernel Function

public pure elemental function new_fourier_kernel(term) result(kernel)

Prepare a term once before evaluating it at many wave numbers

Arguments

Type IntentOptional Attributes Name
type(fourier_term), intent(in) :: term

Return Value type(fourier_kernel)


Source Code

pure elemental function new_fourier_kernel(term) result(kernel)

   type(fourier_term), intent(in) :: term
   type(fourier_kernel) :: kernel
   integer :: ipole, nexp

   if (abs(term%prefactor) <= 0.0_wp) return

   nexp = term%m - term%alpha + 2
   kernel%prefactor = 4.0_wp*pi*pi / term%alpha * term%prefactor * term%radius**nexp
   kernel%radius = term%radius
   kernel%zero = kernel%prefactor * term%radius / sin(pi*(term%m + 3)/real(term%alpha, wp))
   ! Reflected poles give equal contributions for even m and alpha. Retain one
   ! pole per pair and the unpaired imaginary pole, if present.
   kernel%npair = term%alpha / 4
   kernel%angle = [(pi * (2*ipole + 1) / real(term%alpha, wp), ipole=0, (term%alpha-2)/4)]
   kernel%cosine = cos(kernel%angle)
   kernel%sine = sin(kernel%angle)
   kernel%phase = 0.5_wp*pi + nexp*kernel%angle

end function new_fourier_kernel