FIXME : Add documentation
subroutine remove_zonal_flows
use fields_arrays, only: phinew
use theta_grid, only: ntgrid
use kt_grids, only: ntheta0, naky
implicit none
complex, dimension(:,:,:), allocatable :: phi_avg
allocate(phi_avg(-ntgrid:ntgrid,ntheta0,naky))
! fieldline_average_phi will calculate the field line average of phinew and
! put it into phi_avg, but only for ik = 1 (the last parameter of the call)
call fieldline_average_phi(phinew, phi_avg, 1)
phinew = phinew - phi_avg
deallocate(phi_avg)
end subroutine remove_zonal_flows