!=======================================
! 2D cumulus model - kaminari
!  - subroutine div_diff
! 
! Author    : TAKAHASHI Koko
! Date      : 2003/11/26  $B:G=*99?7(B
!             2003/11/13  $B?75,:n@.(B
! Note      : $B2;GH8:?j9`(B div
! 
!=======================================
!--- 1$B9TL\F~NOJQ?t(B, 2$B9TL\=PNOJQ?t(B
subroutine div_diff(i,k,im,km,dx,dz,u,w,g_sqrt,g13xz,       &
     &              div)

  implicit none

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

  real(8), intent(in) :: dx, dz

  real(8), intent(in) :: u(-2:im+1,-2:km+1)
  real(8), intent(in) :: w(-2:im+1,-2:km+1)
  real(8), intent(in) :: g_sqrt(-2:im+1,-2:km+1)
  real(8), intent(in) :: g13xz(-2:im+1,-2:km+1)

  real(8), intent(out) :: div(-2:im+1,-2:km+1)

  div(i,k) = (u(i+1,k) - u(i,k))/dx                   &
       &     + g13xz(i,k)                             &
       &       *(                                     &
       &         u(i+1,k+1) + u(i,k+1)                &
       &         - u(i+1,k-1) - u(i,k-1)              &
       &         )/(4.0d0*dz)                         &
       &     + 1.0d0/g_sqrt(i,k)*(w(i,k+1) - w(i,k))/dz

end subroutine div_diff
