!=======================================
! 2D cumulus model - kaminari
!  - subroutine vel_u
! 
! Author    : TAKAHASHI Koko
! Date      : 2003/11/25  $B:G=*99?7(B
!             2003/11/04  $B?75,:n@.(B
! Note      : $B?eJ?B.EY(B u
! 
!=======================================
!--- 1,2$B9TL\F~NOJQ?t(B, 3$B9TL\F~=PNOJQ?t(B
subroutine vel_u(im,km,cp,alp,dts,g13z,div_x_u,div_z_u,     &
     &           dx,dz,vptemp_bs,pi,u_adv,u_cori,u_trb,     &
     &           u)

  implicit none

  integer(8), intent(in) :: im, km

  real(8), intent(in) :: cp, alp, dts
  real(8), intent(in) :: dx, dz

  real(8), intent(in) :: vptemp_bs(-2:im+2,-2:km+2)

  real(8), intent(in) :: pi(-2:im+2,-2:km+2)
  real(8), intent(in) :: g13z(-2:im+2,-2:km+2)

  real(8), intent(in) :: div_x_u(0:im+1,0:km+1)
  real(8), intent(in) :: div_z_u(0:im+1,0:km+1)

  real(8), intent(in) :: u_adv(-2:im+2,-2:km+2)
  real(8), intent(in) :: u_cori(-2:im+2,-2:km+2)
  real(8), intent(in) :: u_trb(-2:im+2,-2:km+2)

  real(8), intent(inout) :: u(-2:im+2,-2:km+2)

  integer(8)          :: i, k

  do k = 0,km
     do i = 0,im
        !--- $BB.EY(B u
        u(i,k) = u(i,k)                                           &
             & + dts*(                                            &
             &        - cp*(vptemp_bs(i,k) + vptemp_bs(i-1,k))    &
             &          /2.0d0                                    &
             &          *(                                        &
             &            (pi(i,k) - pi(i-1,k))/dx                &
             &            - alp*div_x_u(i,k)                      &
             &            + g13z(i,k)                             &
             &              *(                                    &
             &                (                                   &
             &                 pi(i,k+1) + pi(i-1,k+1)            &
             &                 - pi(i,k-1) - pi(i-1,k-1)          &
             &                )/(4.0d0*dz)                        &
             &                - alp*div_z_u(i,k)                  &
             &                )                                   &
             &           )                                        &
             &        - u_adv(i,k) + u_cori(i,k) + u_trb(i,k)     &
             &       )

     end do
  end do

end subroutine vel_u

