!=======================================
! 2D cumulus model - kaminari
!  - subroutine omgw
! 
! Author    : TAKAHASHI Koko
! Date      : 2003/11/04
! Note      : $BCO7A$K1h$C$?:BI87O$G$N1tD>B.EY(B omg
! 
!=======================================
subroutine omgw(i,k,im,km,g12z,g13x,u,w,omg)

  implicit none

  integer, intent(in) :: im
  integer, intent(in) :: km
  integer, intent(in) :: i, k

  real(8), intent(in) :: g12z(0:im+1,0:km+1)
  real(8), intent(in) :: g13x(0:im+1,0:km+1)
  real(8), intent(in) :: u(0:im+1,0:km+1)
  real(8), intent(in) :: w(0:im+1,0:km+1)
  real(8), intent(out) :: omg(0:im+1,0:km+1)

  omg(i,k) = g13x(i,k)                             &
       &     *(                                    &
       &       u(i+1,k+1) + u(i-1,k+1)             &
       &       + u(i+1,k-1) + u(i-1,k-1)           &
       &      )/4                                  &
       &     + w(i,k)/g12z(i,k)

end subroutine omgw
