loftheta Subroutine

private subroutine loftheta(rgrid, theta, ltheta)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension (-ntgrid:) :: rgrid
real, intent(in), dimension (-ntgrid:) :: theta
real, intent(out), dimension (-ntgrid:) :: ltheta

Contents

Source Code


Source Code

  subroutine loftheta(rgrid, theta, ltheta)
    implicit none
    real, dimension (-ntgrid:), intent(in) :: rgrid, theta
    real, dimension (-ntgrid:), intent(out) :: ltheta
    integer :: i
    real :: rold, told, rpos_old, zpos_old, rpos_new, zpos_new
    real :: r, thet, rpos_orig, zpos_orig
    ltheta(0) = 0.
    rold = rgrid(0) ; told = theta(0)
    rpos_orig = geom%Rpos(rold, told) ; zpos_orig = geom%Zpos(rold, told)
    rpos_new = rpos_orig ; zpos_new = zpos_orig
    do i = 1, nth
       rpos_old = rpos_new ; zpos_old = zpos_new
       r = rgrid(i) ; thet = theta(i)
       rpos_new = geom%Rpos(r, thet) ; zpos_new = geom%Zpos(r, thet)
       ltheta(i) = ltheta(i-1) + hypot((Rpos_new - Rpos_old), (Zpos_new - Zpos_old))
    end do

    rpos_new = rpos_orig ; zpos_new = zpos_orig
    do i = -1, -nth, -1
       rpos_old = rpos_new ; zpos_old = zpos_new
       r = rgrid(i) ; thet = theta(i)
       rpos_new = geom%Rpos(r, thet) ; zpos_new = geom%Zpos(r, thet)
       ltheta(i) = ltheta(i+1) - hypot((Rpos_new - Rpos_old), (Zpos_new - Zpos_old))
    end do
  end subroutine loftheta