Set initial condition to gaussian in
Controlled by: - Amplitude: phiinit - Width in : width0 - Parity: even about unless chop_side is true
subroutine ginit_default
use species, only: spec
use theta_grid, only: ntgrid, theta
use kt_grids, only: naky, ntheta0, theta0, aky, reality
use le_grids, only: forbid
use dist_fn_arrays, only: g, gnew
use gs2_layouts, only: g_lo, ik_idx, it_idx, il_idx, is_idx
use array_utils, only: copy
implicit none
complex, dimension (-ntgrid:ntgrid,ntheta0,naky) :: phi
logical :: right
integer :: iglo
integer :: ig, ik, it, il, is
right = .not. left
do ig = -ntgrid, ntgrid
phi(ig,:,:) = exp(-((theta(ig)-theta0(:,:))/width0)**2)*cmplx(1.0,1.0)
end do
if (chop_side .and. left) phi(:-1,:,:) = 0.0
if (chop_side .and. right) phi(1:,:,:) = 0.0
if (reality) then
phi(:,1,1) = 0.0
if (naky > 1 .and. aky(1) == 0.0) then
phi(:,:,1) = 0.0
end if
! not used:
! reality condition for k_theta = 0 component:
do it = 1, ntheta0/2
phi(:,it+(ntheta0+1)/2,1) = conjg(phi(:,(ntheta0+1)/2+1-it,1))
enddo
end if
do iglo = g_lo%llim_proc, g_lo%ulim_proc
ik = ik_idx(g_lo,iglo)
it = it_idx(g_lo,iglo)
il = il_idx(g_lo,iglo)
is = is_idx(g_lo,iglo)
g(:,1,iglo) = phi(:,it,ik)*spec(is)%z*phiinit
where (forbid(:,il)) g(:,1,iglo) = 0.0
g(:,2,iglo) = g(:,1,iglo)
end do
call copy(g, gnew)
end subroutine ginit_default