subroutine advecu_2nd(putin, putout)
use modglobal, only:ih, ib, ie, jb, je, jh, kb, ke, kh, dxi, dxiq, dyiq, dzf, dzfi5, dzhi, libm, imax, jmax, ktot
use modfields, only:u0, v0, w0, pres0, uh, vh, wh, pres0h
use modibm, only:nxwallsnorm, nzwallsnorm, nywallsm, nywallsp, ywallsm, ywallsp, &
xwallsnorm, zwallsnorm
use modmpi, only:myid
use decomp_2d
implicit none
real, dimension(ib - ih:ie + ih, jb - jh:je + jh, kb - kh:ke + kh), intent(in) :: putin !< Input: the u-field
real, dimension(ib - ih:ie + ih, jb - jh:je + jh, kb:ke + kh), 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) - ( &
( &
(putin(i, j, k) + putin(ip, j, k))*(u0(i, j, k) + u0(ip, j, k)) &
- (putin(i, j, k) + putin(im, j, k))*(u0(i, j, k) + u0(im, j, k)) & ! d(uu)/dx
)*dxiq &
+ ( &
(putin(i, j, k) + putin(i, jp, k))*(v0(i, jp, k) + v0(im, jp, k)) &
- (putin(i, j, k) + putin(i, jm, k))*(v0(i, j, k) + v0(im, j, k)) & ! d(vu)/dy
)*dyiq) &
- ((pres0(i, j, k) - pres0(i - 1, j, k))*dxi) ! - dp/dx
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) - ( &
(putin(i, j, kp)*dzf(k) + putin(i, j, k)*dzf(kp))*dzhi(kp) &
* (w0(i, j, kp) + w0(im, j, kp)) &
- (putin(i, j, k)*dzf(km) + putin(i, j, km)*dzf(k))*dzhi(k) &
* (w0(i, j, k) + w0(im, j, k)) &
)*0.5*dzfi5(k)
end do
end do
end do
end subroutine advecu_2nd