subroutine fileset_init(cfgfile, cpurank)
!
!NAMELIST からファイル名に付けるタグを得て, 出力ファイル名を作成する.
!
!暗黙の型宣言禁止
implicit none
!入力変数
character(*), intent(in) :: cfgfile
integer, intent(in), optional :: cpurank
integer :: unit !装置番号
integer :: s !ループ添字
!NAMELIST から情報を取得
NAMELIST /fileset/ InitFile, HistoryFilePrefix, ReStartFile, RandomFile, ExpTitle, ExpSrc , ExpInst
call FileOpen(unit, file=cfgfile, mode='r')
read(unit, NML=fileset)
close(unit)
!ノード番号を用意
if (present(cpurank)) then
myrank = cpurank
end if
call fileset_setnum()
!ファイル名を格納する配列の割り付け
! 次元数は
! PotTemp, Exner, VelX, VelY, VelZ, MixRt(SpcNum), Km, Kh
! VorX, VorY, VorZ
! *BasicZ, *Zprof
! の合計 12 + SpcNum
FileNum = 12 + SpcNum
allocate(HistoryFile(FileNum))
allocate(gt_hist(FileNum))
! InitFile が空だが InitFilePrefix が空でない場合は, InitFilePrefix 利用
if (trim(InitFile) == '' .AND. trim(InitFilePrefix) /= '') then
InitFile = trim(InitFilePrefix)//"-rank"//trim(rank)//"_restart.nc"
end if
HistoryFile(1) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Exner.nc"
HistoryFile(2) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_PotTemp.nc"
HistoryFile(3) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_VelX.nc"
HistoryFile(4) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_VelY.nc"
HistoryFile(5) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_VelZ.nc"
HistoryFile(6) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Km.nc"
HistoryFile(7) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Kh.nc"
HistoryFile(8) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_BasicZ.nc"
HistoryFile(9) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Zprof.nc"
HistoryFile(10) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_VorX.nc"
HistoryFile(11) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_VorY.nc"
HistoryFile(12) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_VorZ.nc"
do s = 1, SpcNum
HistoryFile(12+s) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_"//trim(SpcWetSymbol(s))//".nc"
end do
!リスタートファイル
if (RestartFile == "") then
ReStartFile = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_restart.nc"
end if
!確認
call MessageNotify( "M", "fileset_init", "InitFile=%c", c1=trim(InitFile))
do s = 1, Filenum
call MessageNotify( "M", "fileset_init", "HistoryFile=%c", c1=trim(HistoryFile(s)) )
end do
call MessageNotify( "M", "fileset_init", "ReStartFile=%c", c1=trim(ReStartFile) )
call MessageNotify( "M", "fileset_init", "RandomFile=%c", c1=trim(RandomFile) )
call MessageNotify( "M", "fileset_init", "ExpTitle=%c", c1=trim(ExpTitle) )
call MessageNotify( "M", "fileset_init", "ExpSrc=%c", c1=trim(ExpSrc) )
call MessageNotify( "M", "fileset_init", "ExpInst=%c", c1=trim(ExpInst) )
end subroutine fileset_init