!=======================================
! 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,g_sqrt_z,g13x,u,w,omg)

  implicit none

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

  real(8), intent(in) :: g_sqrt_z(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)/g_sqrt_z(i,k)

end subroutine omgw
