!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Module CloudSet
!
!   * Developer: SUGIYAMA Ko-ichiro
!   * Version: $Id: cloudset.f90,v 1.1.2.2 2006/01/17 12:08:39 kitamo Exp $ 
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview 
!
!雲物理に関係する定数設定用モジュール
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!
                                                                 !=end
module cloudset

  implicit none
  save
                                                                 !=begin
  !== Public Interface
  real(8)  :: DensIce     ! 固相の密度 [kg/m^3]
  real(8)  :: NumAerosol  ! エアロゾルの数密度 [1/kg]
  real(8)  :: RadiAerosol ! エアロゾルの数密度 [1/kg]
  real(8)  :: Kd          ! 大気の熱伝導係数 [W/K m]
!  real(8)  :: SatPressA   ! 飽和蒸気圧の式の係数 [Pa]
!  real(8)  :: SatPressB   ! 飽和蒸気圧の式の係数 [K]
  real(8)  :: SatRatioCr  ! 臨界飽和比 []
  real(8)  :: SatRtWetAdia  ! 湿潤断熱線の飽和比 []
                                                                 !=end
contains
                                                                 !=begin
  !== Procedure Interface 
  !
  !=== Initialize module and acquire NAMELIST
  !
  !NAMELIST から物理定数を読み込む
  !
  subroutine cloudset_init(cfgfile)
    !=== Dependency
    use dc_trace,      only: BeginSub, EndSub 
                                                                 !=end
    character(*), intent(in) :: cfgfile
                                                                 !=begin
    !=== NAMELIST
    NAMELIST /cloudset/ DensIce, NumAerosol, RadiAerosol, Kd, & 
      & SatRatioCr, SatRtWetAdia
!      & SatPressA, SatPressB, SatRatioCr, SatRtWetAdia
                                                                 !=end
    call BeginSub("cloudset_init", &
&                 fmt="%c",       &
&                 c1="Initialize parameters of cloud physics. ")

    open (10, FILE=cfgfile)
    read(10, NML=cloudset)
    close(10)

    !==== 確認
    write(*,*) "DensIce", DensIce
    write(*,*) "NumAerosol", NumAerosol
    write(*,*) "RadiAerosol", RadiAerosol
    write(*,*) "Kd", Kd
!    write(*,*) "SatPressA", SatPressA
!    write(*,*) "SatPressB", SatPressB
    write(*,*) "SatRatioCr", SatRatioCr
    write(*,*) "SatRtWetAdia", SatRtWetAdia


    call EndSub("cloudset_init")

  end subroutine cloudset_init

end module cloudset
