Integrate species using gf_lo data format assuming that gf has already been gathered prior to being passed to this routine. Currently this routine isn't being used as the functionality has been directly added to getan_nogath in dist_fn.
AJ
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(in), | dimension(-ntgrid:ntgrid,2,nspec,negrid,nlambda,gf_lo%llim_proc:gf_lo%ulim_alloc) | :: | gf | ||
real, | intent(inout), | dimension (:) | :: | weights | ||
complex, | intent(out), | dimension (-ntgrid:ntgrid,gf_lo%ntheta0,gf_lo%naky) | :: | total |
subroutine integrate_species_gf_nogather (gf, weights, total)
use species, only : nspec
use theta_grid, only: ntgrid
use gs2_layouts, only: gf_lo
use gs2_layouts, only: is_idx, ik_idx, it_idx, ie_idx, il_idx
use mp, only: sum_allreduce_sub, sum_allreduce
use kt_grids, only: kwork_filter
use species, only: spec, tracer_species
use array_utils, only: zero_array
implicit none
complex, dimension(-ntgrid:ntgrid,2,nspec,negrid,nlambda,gf_lo%llim_proc:gf_lo%ulim_alloc), intent(in) :: gf
real, dimension (:), intent (in out) :: weights
complex, dimension (-ntgrid:ntgrid,gf_lo%ntheta0,gf_lo%naky), intent (out) :: total
integer :: is, il, ie, igf, it, ik
call zero_array(total)
where (spec%type == tracer_species) weights = 0
!Performed integral (weighted sum) over local velocity space and species
if(any(kwork_filter)) then
do igf = gf_lo%llim_proc,gf_lo%ulim_proc
it = it_idx(gf_lo,igf)
ik = ik_idx(gf_lo,igf)
total(:,it,ik) = 0.
if(kwork_filter(it,ik)) cycle
do il = 1,gf_lo%nlambda
do ie = 1,gf_lo%negrid
do is = 1,gf_lo%nspec
total(:,it,ik) = total(:,it,ik) + &
(weights(is)*w(ie,is))*wl(:,il)*(gf(:,1,is,ie,il,igf)+gf(:,2,is,ie,il,igf))
end do
end do
end do
end do
else
do igf = gf_lo%llim_proc,gf_lo%ulim_proc
it = it_idx(gf_lo,igf)
ik = ik_idx(gf_lo,igf)
total(:,it,ik) = 0.
do il = 1,gf_lo%nlambda
do ie = 1,gf_lo%negrid
do is = 1,gf_lo%nspec
total(:,it,ik) = total(:,it,ik) + &
(weights(is)*w(ie,is))*wl(:,il)*(gf(:,1,is,ie,il,igf)+gf(:,2,is,ie,il,igf))
end do
end do
end do
end do
end if
end subroutine integrate_species_gf_nogather