subroutine constants_Init()
!暗黙の型宣言禁止
implicit none
!変数定義
integer :: SpcDryNum !乾燥成分の化学種の数
character(20) :: SpcDrySymbol(5) !乾燥成分の化学種名
real(DP) :: SpcDryMolFr(5) !乾燥成分の化学種の存在度
integer, allocatable :: SpcDryID(:) !乾燥成分の化学種のID
real(DP), allocatable :: PropertyDry(:) !作業配列
integer :: s !作業変数
integer :: unit !装置番号
logical :: flag = .false.
!NAMELIST の定義
NAMELIST /constants_nml/ Grav, PressBasis, TempSfc, PressSfc, SpcDrySymbol, SpcDryMolFr, DayTime, CpDry, MolWtDry
SpcDrySymbol = ''
SpcDryMolFr = 0.0d0
!ファイルオープン. 情報取得.
call FileOpen(unit, file=namelist_filename, mode='r')
read(unit, NML=constants_nml)
close(unit)
if (CpDry /= 0.0d0 .AND. MolWtDry /= 0.0d0) then
! namelist から CpDry の値が入力された場合
!定圧モル比熱
CpDryMol = CpDry * MolWtDry
!気体定数
GasRDry = GasRUniv / MolWtDry
!定積比熱
CvDry = CpDry - GasRDry
elseif (SpcDryMolFr(1) /= 0.0d0) then
! namelist から モル比が入力された場合
flag = .true.
!----------------------------------------------------------
! 乾燥成分の物性値の初期化
!
!乾燥成分の個数を数える
SpcDryNum = count(SpcDrySymbol /= "")
!化学種の ID を取得
allocate(SpcDryID(SpcDryNum))
do s = 1, SpcDryNum
SpcDryID(s) = ChemData_OneSpcID( SpcDrySymbol(s) )
end do
!作業配列の準備
allocate(PropertyDry(SpcDryNum))
!分子量
do s = 1, SpcDryNum
PropertyDry(s) = ChemData_MolWt(SpcDryID(s))
end do
MolWtDry = dot_product(PropertyDry, SpcDryMolFr(1:SpcDryNum))
!定圧比熱(モル当量)
do s = 1, SpcDryNum
PropertyDry(s) = ChemData_CpPerMolRef(SpcDryID(s))
end do
CpDryMol = dot_product(PropertyDry, SpcDryMolFr(1:SpcDryNum))
!定圧比熱
CpDry = CpDryMol / MolWtDry
!気体定数
GasRDry = GasRUniv / MolWtDry
!定積比熱
CvDry = CpDry - GasRDry
end if
!----------------------------------------------------------
! 確認
!----------------------------------------------------------
if (myrank == 0) then
call MessageNotify( "M", "constants_init", "Grav = %f", d=(/Grav/) )
call MessageNotify( "M", "constants_init", "PressBasis = %f", d=(/PressBasis/))
call MessageNotify( "M", "constants_init", "TempSfc = %f", d=(/TempSfc/) )
call MessageNotify( "M", "constants_init", "PressSfc = %f", d=(/PressSfc/) )
if (flag) then
do s = 1, SpcDryNum
call MessageNotify( "M", "constants_init", "SpcDryID = %d", i=(/SpcDryID(s)/))
call MessageNotify( "M", "constants_init", "SpcDrySymbol = %c", c1=trim(SpcDrySymbol(s)))
call MessageNotify( "M", "constants_init", "SpcDryMolFr = %f", d=(/SpcDryMolFr(s)/))
end do
end if
call MessageNotify( "M", "constants_init", "CpDry = %f", d=(/CpDry/) )
call MessageNotify( "M", "constants_init", "CpDryMol = %f", d=(/CpDryMol/) )
call MessageNotify( "M", "constants_init", "CvDry = %f", d=(/CvDry/) )
call MessageNotify( "M", "constants_init", "GasRDry = %f", d=(/GasRDry/) )
call MessageNotify( "M", "constants_init", "MolWtDry = %f", d=(/MolWtDry/) )
call MessageNotify( "M", "constants_init", "DayTime = %f", d=(/DayTime/) )
end if
end subroutine Constants_Init