Initialse geometry to a uniform grid with 2*((2*nperiod - 1)*(nt/2)) + 1
points. Also set nth, geometry and [[geometry::ntgrid]]
consistently; importantly nth is forced to be even. If ntheta
is odd, then
nth == ntheta - 1
.
ntheta
is set equal to geometry on exit
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(inout) | :: | ntheta | |||
real, | intent(inout), | dimension(:), allocatable | :: | theta | ||
integer, | intent(in) | :: | nperiod | |||
integer, | intent(out) | :: | ntgrid | |||
integer, | intent(out) | :: | nth |
subroutine init_uniform_theta_grid(ntheta, theta, nperiod, ntgrid, nth)
use constants, only: pi
implicit none
integer, intent(in out) :: ntheta
real, dimension(:), allocatable, intent(in out) :: theta
integer, intent(in) :: nperiod
integer, intent(out) :: ntgrid, nth
integer :: i
nth = ntheta / 2
! Make sure ntheta is even, update argument and set ntgrid
ntheta = nth * 2 ; ntgrid = (2 * nperiod - 1) * nth
if (verb>3) write(6,*) "init_theta: allocated(theta),ntgrid,ntheta,nperiod=",&
allocated(theta), ntgrid, ntheta, nperiod
if (allocated(theta)) deallocate (theta)
allocate(theta(-ntgrid:ntgrid))
theta = [ (i * pi / real(nth), i=-ntgrid, ntgrid) ]
end subroutine init_uniform_theta_grid