FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | rhostar | |||
integer, | intent(in) | :: | report_unit |
subroutine check_kt_grids_range(rhostar, report_unit)
use constants, only: twopi
use theta_grid, only: shat
use warning_helpers, only: is_not_zero
implicit none
real, intent(in) :: rhostar
integer, intent(in) :: report_unit
real :: dtheta0
integer :: i, j
integer :: naky, ntheta0, nx, ny ! Shadow module level vars
real, dimension(:), allocatable:: aky, akx
real, dimension(:,:), allocatable:: theta0
integer, dimension(:), allocatable :: ikx
write (report_unit, *)
write (report_unit, fmt="('A range of k_perps will be evolved.')")
if (n0_min >0) write (report_unit, fmt="('ky set using toroidal mode numbers with n0_min=',i8/T34,'rhostar=',1pe12.4)") n0_min,rhostar
write (report_unit, *)
write (report_unit, fmt="('There are ',i3,' values of ky rho and ',i3,' values of theta_0/kx rho:')") naky, ntheta0
write (report_unit, *)
call get_sizes_and_grids_range(aky, theta0, akx, ikx, naky, ntheta0, nx, ny)
!Report grid values
do j = 1, naky
do i = 1, ntheta0
write (report_unit, fmt="('ky rho = ',e11.4,' theta0 = ',e11.4,' kx rho = ',e11.4)") &
aky(j),theta0(i,j),akx(i)
end do
end do
deallocate(aky,theta0,akx)
! CMR, add some !!!error checking!!! for ballooning space runs for shat /= 0
! using flow shear: check that the constraints on theta0 grid are satisfied!
if (is_not_zero(shat)) then
!It would be nice to only write this information if g_exb*gexbfac/=0 but currently
!dependencies prevent this.
dtheta0 = 0.0 ; if (ntheta0 > 1) dtheta0 = (theta0_max - theta0_min)/real(ntheta0 - 1)
if (abs(mod(twopi-theta0_max+theta0_min,twopi)-dtheta0) > 1.0e-3*dtheta0) then
write (report_unit, *)
write (report_unit, fmt="('IF using perp ExB flow shear in BALLOONING SPACE there is an ERROR that will corrupt results.')")
write (report_unit, fmt="('check_kt_grids_range: inappropriate theta0 grid')")
write (report_unit, fmt="('In ballooning space with sheared flow, 2pi-theta0_max+theta0_min =',e11.4,' must be set equal to dtheta = ',e11.4)") twopi-theta0_max+theta0_min, dtheta0
endif
endif
end subroutine check_kt_grids_range