!=======================================
! 2D cumulus model - kaminari
!  - subroutine ptn_temp_1stp
! 
! Author    : TAKAHASHI Koko
! Date      : 2003/12/25  $B:G=*99?7(B
!             2003/11/05  $B?75,:n@.(B
! Note      : 1 $B%9%F%C%WL\$N290L(B
! 
!=======================================
!--- 1,2$B9TL\F~NOJQ?t(B, 3$B9TL\F~=PNOJQ?t(B
subroutine ptn_temp_1stp(im,km,nuh,nuv,dx,dz,dtb,u,omg,     &
     &                   ptemp)

  implicit none

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

  real(8), intent(in) :: nuh, nuv!,cp, ml
  real(8), intent(in) :: dx, dz
  real(8), intent(in) :: dtb

!  real(8), intent(in) :: prss_bs(-2:im+2,-2:km+2)
!  real(8), intent(in) :: pi_bs(-2:im+2,-2:km+2)
!  real(8), intent(in) :: dens_bs(-2:im+2,-2:km+2)
  real(8), intent(in) :: u(-2:im+2,-2:km+2)
  real(8), intent(in) :: omg(-2:im+2,-2:km+3)
!  real(8), intent(in) :: qv(-2:im+2,-2:km+2)
!  real(8), intent(in) :: qr(-2:im+2,-2:km+2)
!  real(8), intent(in) :: qvs(-2:im+2,-2:km+2)

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

  integer(8)             :: i,k

  real(8)             :: ptemp_dif(-2:im+2,-2:km+2)
  real(8)             :: ptemp_adv(-2:im+2,-2:km+2)

  do k = 0,km
     do i = 0,im
        !--- $B290L$N?tCMG4@-9`(B
        ptemp_dif(i,k) = nuh*(                                    &
             &                ptemp(i+1,k) - 2.0d0*ptemp(i,k)     &
             &                + ptemp(i-1,k)                      &
             &               )/(dx**2.0d0)                        &
             &           + nuv*(                                  &
             &                  ptemp(i,k+1) - 2.0d0*ptemp(i,k)   &
             &                  + ptemp(i,k-1)                    &
             &                  )/(dz**2.0d0)

        !--- $B290L$N0\N.9`(B
        ptemp_adv(i,k) = (u(i+1,k) + u(i,k))/2.0d0                &
             &           *(ptemp(i+1,k) - ptemp(i-1,k))/(2.0d0*dx)&
             &           + (omg(i,k+1) + omg(i,k))/2.0d0          &
             &             *(ptemp(i,k+1) - ptemp(i,k-1))         &
             &             /(2.0d0*dz)                            &
             &           + ptemp_dif(i,k)

        !--- $B290L(B
        ptemp(i,k) = ptemp(i,k) - dtb*ptemp_adv(i,k)
     end do
  end do

end subroutine ptn_temp_1stp
