Calculate the correlation function on the physical domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex, | intent(out), | dimension (-ntgrid:,:) | :: | cfnc_2pi |
subroutine correlation (cfnc_2pi)
use kt_grids, only: naky, ntheta0
use theta_grid, only: ntgrid
use fields_arrays, only: phinew
implicit none
complex, dimension (-ntgrid:,:), intent (out) :: cfnc_2pi
integer :: ik, it, ig
real :: fac
cfnc_2pi = 0.0
do ik = 1, naky
if (ik==1) then
fac = 1.0
else
fac = 0.5
end if
do it = 1, ntheta0
do ig = -ntgrid, ntgrid
cfnc_2pi(ig,ik) = cfnc_2pi(ig,ik) + phinew(0,it,ik)*conjg(phinew(ig,it,ik))*fac
end do
end do
end do
end subroutine correlation