get_thgrad Subroutine

private subroutine get_thgrad(h, th, dh)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension (:) :: h
real, intent(in), dimension (:) :: th
real, intent(out), dimension (:) :: dh

Contents

Source Code


Source Code

  subroutine get_thgrad (h, th, dh)

    implicit none

    real, dimension (:), intent (in) :: h, th
    real, dimension (:), intent (out) :: dh

    integer :: ig, nth

    nth = size(th)

    do ig = 2, nth-1
       dh(ig) = (h(ig+1)-h(ig-1))/(th(ig+1)-th(ig-1))
    end do
    ! note that H_neo is periodic in theta
    dh(1) = (h(2)-h(nth))/(2.*(th(2)-th(1)))
    dh(nth) = (h(1)-h(nth-1))/(2.*(th(nth)-th(nth-1)))

  end subroutine get_thgrad