!= Module CloudSet
!
! Authors::   SUGIYAMA Ko-ichiro, Tatsuya Yamashita
! Version::   $Id: cloudset.f90,v 1.1 2011-04-26 04:08:10 sugiyama Exp $ 
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2006. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
!== Overview 
!
!雲物理に関係する定数設定用モジュール(火星湿潤対流計算用)
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!

module cloudset

  use dc_types,   only: DP, STRING
  use dc_iounit,  only: FileOpen
  use dc_message, only: MessageNotify

  implicit none

  private

  real(DP), save, public :: DensIce     = 0.0d0  ! 固相の密度 [kg/m^3]
  real(DP), save, public :: NumAerosol  = 0.0d0  ! エアロゾルの数密度 [1/kg]
  real(DP), save, public :: RadiAerosol = 0.0d0  ! エアロゾルの数密度 [1/kg]
  real(DP), save, public :: Kd          = 0.0d0  ! 大気の熱伝導係数 [W/K m]
  real(DP), save, public :: SatRatioCr  = 0.0d0  ! 臨界飽和比 []
  real(DP), save, public :: SatRtWetAdia = 0.0d0 ! 湿潤断熱線の飽和比 []

  public cloudset_init

contains
  
  !
  !NAMELIST から物理定数を読み込む
  !
  subroutine cloudset_init(cfgfile)
    
    character(STRING), intent(in) :: cfgfile
    integer                       :: unit

    ! NAMELIST
    NAMELIST /constants_marscond_nml/ DensIce, NumAerosol, RadiAerosol, Kd, & 
      & SatRatioCr, SatRtWetAdia

    call FileOpen(unit, file=cfgfile, mode='r')
    read(unit, NML=constants_marscond_nml)
    close(unit)    

    call MessageNotify( "M", &
      & "cloudset_init", "DensIce = %f",  d=(/DensIce/) )
    call MessageNotify( "M", &
      & "cloudset_init", "NumAerosol = %f",  d=(/NumAerosol/) )
    call MessageNotify( "M", &
      & "cloudset_init", "RadiAerosol = %f",  d=(/RadiAerosol/) )
    call MessageNotify( "M", &
      & "cloudset_init", "Kd = %f",  d=(/Kd/) )
    call MessageNotify( "M", &
      & "cloudset_init", "SatRatioCr = %f",  d=(/SatRatioCr/) )
    call MessageNotify( "M", &
      & "cloudset_init", "SatRtWetAdia = %f",  d=(/SatRtWetAdia/) )

  end subroutine cloudset_init

end module cloudset
