subroutine BasicSet_Init(cfgfile)
!
!基本場の情報を Namelist から取得して値を計算
!
!暗黙の型宣言禁止
implicit none
!変数定義
character(*), intent(in) :: cfgfile !NAMELIST ファイル
! real(DP) :: Tropopause !対流圏圏界面高度
! real(DP) :: CpDryMol !乾燥成分の定圧比熱 [J/K mol]
integer :: SpcDryNum !乾燥成分の化学種の数
integer :: SpcWetNum !湿潤成分の化学種の数
character(20) :: SpcDrySymbol(5)!乾燥成分の化学種名
! character(15) :: SpcWetSymbol(10)!湿潤成分の化学種名
real(DP) :: SpcDryMolFr(5) !乾燥成分の化学種の存在度
! real(DP) :: SpcWetMolFr(10) !湿潤成分の化学種の存在度
integer, allocatable :: SpcDryID(:) !乾燥成分の化学種のID
! real(DP) :: Humidity !相対湿度
! character(20) :: EnvType !基本場の温度設定, 'Dry' or 'Moist'
real(DP), allocatable :: PropertyDry(:) !作業配列
character(20), allocatable:: Symbol(:) !作業配列
integer :: s, n1, n2, n3 !作業変数
integer :: unit !装置番号
!NAMELIST の定義
NAMELIST /basicset/ Grav, TempSfc, PressSfc, PressBasis, Tropopause, SpcDrySymbol, SpcDryMolFr, SpcWetSymbol, SpcWetMolFr, EnvType, Humidity, TempStrat, Dhight
SpcDrySymbol = ''
SpcDryMolFr = 0.0d0
SpcWetSymbol = ''
SpcWetMolFr = 0.0d0
!ファイルオープン. 情報取得.
call FileOpen(unit, file=cfgfile, mode='r')
read(unit, NML=basicset)
close(unit)
!----------------------------------------------------------
! 乾燥成分の物性値の初期化
!----------------------------------------------------------
!乾燥成分の個数を数える
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
!----------------------------------------------------------
! 湿潤成分の ID を得る
!----------------------------------------------------------
!湿潤成分の個数を数える
SpcWetNum = count(SpcWetSymbol /= "")
if (SpcWetNum /= SpcNum) then
call MessageNotify( "E", "basicset: ", "SpcWetNum is not equal to SpcNum." )
! write(*,*) "SpcWetNum /= SpcNum"
! stop
end if
!配列の割り当て
allocate(SpcWetID(SpcWetNum), Symbol(SpcWetNum), MolWtWet(SpcWetNum))
!SpcWetSymbol の文字列から, -Rain, -Cloud を除いたものを Symbol として保管
do s = 1, SpcWetNum
n1 = index(SpcWetSymbol(s), '-Cloud' )
n2 = index(SpcWetSymbol(s), '-Rain' )
n3 = max(n1, n2)
if (n3 == 0) then
Symbol(s) = SpcWetSymbol(s)
else
Symbol(s) = SpcWetSymbol(s)(1:n3-1)
end if
end do
!化学種の ID を取得
do s =1, SpcWetNum
SpcWetID(s) = ChemData_OneSpcID( Symbol(s) )
end do
!分子量を保管
do s = 1, SpcWetNum
MolWtWet(s) = ChemData_MolWt(SpcWetID(s))
end do
!----------------------------------------------------------
! 確認
!----------------------------------------------------------
call MessageNotify( "M", "basicset_init", "Grav = %f", d=(/Grav/) )
call MessageNotify( "M", "basicset_init", "TempSfc = %f", d=(/TempSfc/) )
call MessageNotify( "M", "basicset_init", "PressSfc = %f", d=(/PressSfc/) )
call MessageNotify( "M", "basicset_init", "PressBasis = %f", d=(/PressBasis/))
do s = 1, SpcDryNum
call MessageNotify( "M", "basicset_init", "SpcDryID = %d", i=(/SpcDryID(s)/))
call MessageNotify( "M", "basicset_init", "SpcDrySymbol = %c", c1=trim(SpcDrySymbol(s)))
call MessageNotify( "M", "basicset_init", "SpcDryMolFr = %f", d=(/SpcDryMolFr(s)/))
end do
call MessageNotify( "M", "basicset_init", "CpDry = %f", d=(/CpDry/) )
call MessageNotify( "M", "basicset_init", "CpDryMol = %f", d=(/CpDryMol/) )
call MessageNotify( "M", "basicset_init", "CvDry = %f", d=(/CvDry/) )
call MessageNotify( "M", "basicset_init", "GasRDry = %f", d=(/GasRDry/) )
call MessageNotify( "M", "basicset_init", "MolWtDry = %f", d=(/MolWtDry/) )
do s = 1, SpcWetNum
call MessageNotify( "M", "basicset_init", "SpcWetID = %d", i=(/SpcWetID(s)/) )
call MessageNotify( "M", "basicset_init", "SpcWetSymbol = %c", c1=trim(SpcWetSymbol(s)) )
call MessageNotify( "M", "basicset_init", "SpcWetMolFr = %f", d=(/SpcWetMolFr(s)/) )
call MessageNotify( "M", "basicset_init", "MolWtWet = %f", d=(/MolWtWet(s)/) )
end do
call MessageNotify( "M", "basicset_init", "Tropopause = %f ", d=(/Tropopause/) )
call MessageNotify( "M", "basicset_init", "EnvType = %c", c1=trim(EnvType) )
call MessageNotify( "M", "basicset_init", "Humidity = %f", d=(/Humidity/) )
end subroutine BasicSet_Init