!=======================================
! 2D cumulus model - kaminari
!  - subroutine cal_value
! 
! Author    : TAKAHASHI Koko
! Date      : 2003/12/08 $B?75,:n@.(B
! Note      : $B7W;;NN0h$N$_=PNO$9$k$?$a$N(B
!             $BG[Ns$NF~$l49$((B
! 
!=======================================
subroutine cal_value(im,km,u,omg,prss,pi_all,temp,ptemp_all,&
     &               dens,                                  &
     &               u_cal,omg_cal,prss_cal,pi_all_cal,     &
     &               temp_cal,ptemp_all_cal,dens_cal)

  implicit none

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

  real(8), intent(in) :: u(-2:im+1,-2:km)
  real(8), intent(in) :: omg(-2:im,-2:km+1)

  real(8), intent(in) :: prss(-2:im,-2:km)
  real(8), intent(in) :: pi_all(-2:im,-2:km)
  real(8), intent(in) :: temp(-2:im,-2:km)
  real(8), intent(in) :: ptemp_all(-2:im,-2:km)
  real(8), intent(in) :: dens(-2:im,-2:km)

  real(8), intent(out) :: u_cal(0:im-2,0:km-1)
  real(8), intent(out) :: omg_cal(0:im-1,0:km-2)
  real(8), intent(out) :: prss_cal(0:im-2,0:km-2)
  real(8), intent(out) :: pi_all_cal(0:im-2,0:km-2)
  real(8), intent(out) :: temp_cal(0:im-2,0:km-2)
  real(8), intent(out) :: ptemp_all_cal(0:im-2,0:km-2)
  real(8), intent(out) :: dens_cal(0:im-2,0:km-2)

  integer(8) :: i, k

  do k = 0,km-2
     do i = 0,im-1
        u_cal(i,k) = u(i,k)
     end do
  end do

  do k = 0,km-1
     do i = 0,im-2
        omg_cal(i,k) = omg(i,k)
     end do
  end do

  do k = 0,km-2
     do i = 0,im-2
        pi_all_cal(i,k) = pi_all(i,k)
        prss_cal(i,k) = prss(i,k)
        temp_cal(i,k) = temp(i,k)
        ptemp_all_cal(i,k) = ptemp_all(i,k)
        dens_cal(i,k) = dens(i,k)
     end do
  end do

end subroutine cal_value
