FIXME : Add documentation
subroutine ginit_nl6
use mp, only: proc0
use gs2_save, only: gs2_restore
! use theta_grid, only: ntgrid
use kt_grids, only: ntheta0
! use kt_grids, only: naky
use dist_fn_arrays, only: g, gnew
use fields_arrays, only: phi, apar, bpar
use fields_arrays, only: phinew, aparnew, bparnew
use gs2_layouts, only: g_lo, ik_idx, it_idx, is_idx, il_idx
use file_utils, only: error_unit
use run_parameters, only: has_phi, has_apar, has_bpar
use array_utils, only: copy, zero_array
implicit none
integer :: iglo, istatus
integer :: ik, it, ierr
call gs2_restore (g, scale, istatus, has_phi, has_apar, has_bpar)
if (istatus /= 0) then
ierr = error_unit()
if (proc0) write(ierr,*) "Error reading file: ", trim(restart_file)
call zero_array(g)
end if
call zero_array(gnew)
do iglo = g_lo%llim_proc, g_lo%ulim_proc
ik = ik_idx(g_lo,iglo)
it = it_idx(g_lo,iglo)
if (ik == 1 .and. it == 2) cycle
if (ik == 1 .and. it == ntheta0) cycle
g (:,:,iglo) = gnew(:,:,iglo)
end do
phinew(:,2,1) = 0.
aparnew(:,2,1) = 0.
bparnew(:,2,1) = 0.
phi(:,2,1) = 0.
apar(:,2,1) = 0.
bpar(:,2,1) = 0.
phinew(:,ntheta0,1) = 0.
aparnew(:,ntheta0,1) = 0.
bparnew(:,ntheta0,1) = 0.
phi(:,ntheta0,1) = 0.
apar(:,ntheta0,1) = 0.
bpar(:,ntheta0,1) = 0.
call copy(g, gnew)
end subroutine ginit_nl6