subroutine advecc_2nd(hi, hj, hk, putin, putout)
use modglobal, only:ih, jh, kh, kb, ke, ib, ie, jb, je, dxi, dxi5, dyi, dyi5, dzf, dzfi, dzhi, dzfi5, libm, jmax
use modfields, only:u0, v0, w0
use modibm, only:nxwallsnorm, nzwallsnorm, nywallsm, nywallsp, ywallsm, ywallsp, &
xwallsnorm, zwallsnorm, iypluswall, iyminwall, nyminwall, nypluswall
use initfac, only:block
use modmpi, only:myid
implicit none
integer, intent(in) :: hi !< size of halo in i
integer, intent(in) :: hj !< size of halo in j
integer, intent(in) :: hk !< size of halo in k
real, dimension(ib - hi:ie + hi, jb - hj:je + hj, kb - hk:ke + hk), intent(in) :: putin !< Input: the cell centered field
real, dimension(ib - hi:ie + hi, jb - hj:je + hj, kb:ke + hk), intent(inout) :: putout !< Output: the tendency
integer :: i, j, k, ip, im, jp, jm, kp, km, il, iu, jl, ju, kl, ku, n
do k = kb, ke
km = k - 1
kp = k + 1
do j = jb, je
jm = j - 1
jp = j + 1
do i = ib, ie
im = i - 1
ip = i + 1
putout(i, j, k) = putout(i, j, k) - ( &
( &
u0(ip, j, k)*(putin(ip, j, k) + putin(i, j, k)) &
- u0(i, j, k)*(putin(im, j, k) + putin(i, j, k)) & ! d(uc)/dx
)*dxi5 &
+ ( & !
v0(i, jp, k)*(putin(i, jp, k) + putin(i, j, k)) &
- v0(i, j, k)*(putin(i, jm, k) + putin(i, j, k)) & ! d(vc)/dy
)*dyi5)
end do
end do
end do
do j = jb, je
jm = j - 1
jp = j + 1
do i = ib, ie
im = i - 1
ip = i + 1
do k = kb, ke
km = k - 1
kp = k + 1
putout(i, j, k) = putout(i, j, k) - ( &
w0(i, j, kp)*(putin(i, j, kp)*dzf(k) + putin(i, j, k)*dzf(kp))*dzhi(kp) &
- w0(i, j, k)*(putin(i, j, km)*dzf(k) + putin(i, j, k)*dzf(km))*dzhi(k) &
)*dzfi5(k)
end do
end do
end do
end subroutine advecc_2nd