module xstraln_2d

  SAVE

  ! Module to support straight line tracking in axisymmetric geometry

  integer :: lunmsgs = 6   ! unit for warning and error messages

  ! straight line tracker adaptive grid -- current size limits

  integer :: maxpts = 1000
  integer :: maxvac = 10

  ! reference step length (Raxis/50); minimum step length (Raxis/1000)

  real*8 :: dsref,dsmin

  ! axis location

  real*8 :: Raxis,Zaxis

  ! intercept target: radial grid:

  integer :: nzones,nrho_target
  real*8, dimension(:), allocatable :: rho_target

  ! theta boundary locations at outer surface of innermost beam zone row
  ! in (R,Z) space, rel. to mag. axis (Raxis,Zaxis)

  real*8, dimension(:), allocatable :: rdel1,zdel1

  ! description of 2d grid
  logical :: ilsym_grid ! .true. if up down symmetric

  integer :: inbr       ! number of beam zone rows
  real*8, dimension(:), allocatable :: rhobr   ! beam zone rows: rho bdys
  integer, dimension(:), allocatable :: inthbr ! no. of theta boundaries / row
  integer, dimension(:), allocatable :: inthzsm ! total no. of zones inside...
  real*8, dimension(:,:), allocatable :: thbr  ! theta boundaries each row
  integer, dimension(:,:), allocatable :: ibzns ! beam zone indices

  integer, dimension(:), allocatable :: izonrb  ! mapping: rho zones ->
                                               ! beam zone rows

end module xstraln_2d
