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, InitFilePrefix, 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, VelZ, MixRt(SpcNum), Km, Kh
! *BasicZ, *Zprof, SurfaceFlux(2010年12月追加), FallRain(2010年12月追加)
! の合計 10 + SpcNum
FileNum = 10 + 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
DefaultFilePrefix = trim(HistoryFilePrefix)//"-gt5-rank"//trim(rank)//"_"
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)//"_VelZ.nc"
HistoryFile(5) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Km.nc"
HistoryFile(6) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Kh.nc"
HistoryFile(7) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_BasicZ.nc"
HistoryFile(8) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_Zprof.nc"
!地表面フラックスの出力先のファイル名
HistoryFile(8+SpcNum+1) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_SurfaceFlux.nc"
!雨水落下項の出力先のファイル名
HistoryFile(8+SpcNum+2) = trim(HistoryFilePrefix)//"-rank"//trim(rank)//"_FallRain.nc"
do s = 1, SpcNum
HistoryFile(8+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
!確認
if (myrank == 0) then
!確認
call MessageNotify( "M", "fileset_init", "InitFile=%c", c1=trim(InitFile))
call MessageNotify( "M", "fileset_init", "HistoryFilePrefix=%c", c1=trim(HistoryFilePrefix) )
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) )
do s = 1, Filenum
call MessageNotify( "M", "fileset_init", "HistoryFile=%c", c1=trim(HistoryFile(s)) )
end do
end if
end subroutine fileset_init