!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Module SatVaper
!
!   * Developer: SUGIYAMA Ko-ichiro
!   * Version: $Id: $
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview
!
!水の飽和水蒸気圧混合比を計算. 
!  * Tetens の式を利用
! 
!== Error Handling
!
!== Bugs
!
!== Note
!
!== Future Plans
!
! * Antoine の式から飽和水蒸気混合比を計算できるようにもする
!
                                                                 !=end

module SatVaper

  interface ss_SatVaper_ss
     function ss_SatVaper_ss( ss_Temp, ss_Press )
       use gridset
       real(8),intent(in):: ss_Temp(DimXMin:DimXMax, DimZMin:DimZMax)
       real(8),intent(in):: ss_Press(DimXMin:DimXMax, DimZMin:DimZMax)
       real(8)           :: ss_SatVaper_ss(DimXMin:DimXMax, DimZMin:DimZMax)
     end function ss_SatVaper_ss
  end interface

end module SatVaper


function ss_SatVaper_ss( ss_Temp, ss_Press ) 

  use gridset, only: DimXMin, DimXMax, DimZMin, DimZMax
  implicit none

  real(8), intent(in) :: ss_Temp(DimXMin:DimXMax, DimZMin:DimZMax)  !温度
  real(8), intent(in) :: ss_Press(DimXMin:DimXMax, DimZMin:DimZMax) !圧力
  real(8)             :: ss_satvaper_ss(DimXMin:DimXMax, DimZMin:DimZMax) !飽和蒸気圧混合比
  real(8), parameter  :: epsilon = 0.622d0 

  ss_satvaper_ss = &
       &   epsilon * 610.78d0 &
       & * dexp( 17.269d0 * ( ss_Temp - 273.16d0 )   &
       &                  / ( ss_Temp - 35.86d0  ) ) &
       & / ss_Press
  
end function ss_SatVaper_ss
