!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Subroutine LatentHeat
!
!   * Developer: KITAMORI Taichi 
!   * Version: $Id: latentheat.f90,v 1.1.2.1 2005/12/21 05:46:28 kitamo Exp $
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview 
!
!凝結量から凝結熱を計算する. 
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!
!
!== Future Plans
!
                                                                 !=end
subroutine LatentHeat(ss_MassCond,         & !(in) 凝結量
  &                   ss_LatHeatPerMass,   & !(in) 単位質量あたりの潜熱
  &                   ss_QCond)              !(out) 凝結熱による温度変化率
                                                                 !=begin
  !==Dependency
  use dc_trace, only: BeginSub, EndSub  
  use gridset,  only: DimXMin, DimXMax, DimZMin, DimZMax
  use physset,  only: GasR              ! 気体定数
  use cloudset, only: SatPressB         ! Antoine の式の係数 B
  use basicset, only: ss_DensBasicZ,  & ! 密度基本場 
    &                 ss_ExnerBasicZ, & ! 無次元圧力基本場
    &                 ss_CpBasicZ       ! 定圧比熱
                                                                 !=end
  !==暗黙の型宣言を禁止
  implicit none
  
  !==Input
  real(8)                :: ss_LatHeatPerMass(DimXMin:DimXMax, DimZMin:DimZMax)
                                           ! 単位質量あたりの潜熱 [J/kg]
  real(8)                :: ss_MassCond(DimXMin:DimXMax, DimZMin:DimZMax) 
                                           ! 凝結量 [kg/m^3 s]

  !==Output
  real(8), intent(out)   :: ss_QCond(DimXMin:DimXMax, DimZMin:DimZMax) 
                                           ! 凝結熱による温度変化率 [K/s]
  
  !==Work

  call BeginSub("LatentHeat", &
&           fmt="%c",        &
&           c1="Calculate potential temperature tendency bylatent heating.")

  ss_QCond = ss_LatHeatPerMass * ss_MassCond &
    & / (ss_CpBasicZ * ss_DensBasicZ * ss_ExnerBasicZ)  

  call EndSub("LatentHeat")

end subroutine LatentHeat
