subroutine diffe(putout)
use modglobal, only : ib,ie,ih,jb,je,jh,kb,ke,kh,dx2i,dzf,dzfi,&
dy2i,dzhi,dzh2i,jmax
use modfields, only : e120
use modmpi, only : myid
implicit none
real, intent(inout) :: putout(ib-ih:ie+ih,jb-jh:je+jh,kb:ke+kh)
integer :: i,j,k,im,ip,jm,jp,km,kp
do k=kb,ke
kp=k+1
km=k-1
do j=jb,je
jp=j+1
jm=j-1
do i=ib,ie
ip=i+1
im=i-1
putout(i,j,k) = putout(i,j,k) &
+ 1.0 * ( &
( &
(ekm(ip,j,k)+ekm(i ,j,k)) * (e120(ip,j,k)-e120(i ,j,k)) &
- (ekm(i ,j,k)+ekm(im,j,k)) * (e120(i ,j,k)-e120(im,j,k)) &
) * dx2i &
+ ( &
(ekm(i,jp,k)+ekm(i,j ,k)) * (e120(i,jp,k)-e120(i,j ,k)) &
- (ekm(i,j ,k)+ekm(i,jm,k)) * (e120(i,j ,k)-e120(i,jm,k)) &
) * dy2i &
+ ( &
(dzf(kp)*ekm(i,j,k) + dzf(k)*ekm(i,j,kp)) * (e120(i,j,kp)-e120(i,j,k)) *dzh2i(kp) &
- (dzf(km)*ekm(i,j,k) + dzf(k)*ekm(i,j,km)) * (e120(i,j,k)-e120(i,j,km)) *dzh2i(k) &
) * dzfi(k) &
)
end do
end do
end do
end subroutine diffe