!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Module PhysSet
!
!   * Developer: SUGIYAMA Ko-ichiro (sugiyama@gfd-dennou.org)
!   * Version: $Id: physset.f90,v 1.2.2.2 2005/09/16 14:48:13 kitamo Exp $ 
!   * Tag Name: $Name: arare3m $
!   * Change History: 
!
!== Overview 
!
!物理定数設定用モジュール
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!
                                                                 !=end
module physset

  implicit none
  save
                                                                 !=begin
  !== Public Interface
  real(8)  :: Grav          !重力
  real(8)  :: TempSfc       !標準温度               [K]
  real(8)  :: PressSfc      !標準圧力               [Pa]
  real(8)  :: CpDry         !乾燥成分の平均定圧比熱 [J/K mol]
  real(8)  :: MolWtDry      !乾燥成分の平均分子量   [kg/mol]
  real(8)  :: GasRUniv      !普遍気体定数           [J/K mol]
  real(8)  :: Pi            !円周率                 []
  real(8)  :: TempRef       !標準温度               [K]
  real(8)  :: PressRef      !標準圧力               [Pa]
  real(8)  :: DayTime       !日周期                 [s]

  real(8)  :: GasR          !気体定数  [J/K kg]
                                                                 !=end
contains
                                                                 !=begin
  !== Procedure Interface 
  !
  !=== Initialize module and acquire NAMELIST
  !
  !NAMELIST から物理定数を読み込む
  !
  subroutine physset_init(cfgfile)
    !=== Dependency
    use dc_trace,      only: BeginSub, EndSub 
                                                                 !=end
    character(*), intent(in) :: cfgfile
                                                                 !=begin
    !=== NAMELIST
    NAMELIST /physset/ Grav, TempSfc, PressSfc, CpDry, MolWtDry, &
         &             GasRUniv, Pi, TempRef, PressRef, DayTime
                                                                 !=end
    call BeginSub("physset_init", &
&                 fmt="%c",       &
&                 c1="Initialize parameters of physics. ")

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

    GasR = GasRUniv / MolWtDry

    !==== 確認
!    write(*,*) "Grav", Grav
!    write(*,*) "TempSfc", TempSfc
!    write(*,*) "PressSfc", PressSfc
!    write(*,*) "CpDry", CpDry
!    write(*,*) "MolWtDry", MolWtDry
!    write(*,*) "GasRUniv", GasRUniv
!    write(*,*) "Pi", Pi
!    write(*,*) "TempRef", TempRef
!    write(*,*) "PressRef", PressRef
!    write(*,*) "DayTime", DayTime

    call EndSub("physset_init")

  end subroutine physset_init

end module physset
