subroutine GridsetInit
!
! gridset モジュールの初期化を行います.
! NAMELIST#gridset_nml の読み込みはこの手続きで行われます.
!
! "gridset" module is initialized.
! NAMELIST#gridset_nml is loaded in this procedure.
!
! モジュール引用 ; USE statements
!
! NAMELIST ファイル入力に関するユーティリティ
! Utilities for NAMELIST file input
!
use namelist_util, only: namelist_filename, NmlutilMsg
! ファイル入出力補助
! File I/O support
!
use dc_iounit, only: FileOpen
! 種別型パラメタ
! Kind type parameter
!
use dc_types, only: STDOUT ! 標準出力の装置番号. Unit number of standard output
! メッセージ出力
! Message output
!
use dc_message, only: MessageNotify
! 宣言文 ; Declaration statements
!
implicit none
integer:: unit_nml ! NAMELIST ファイルオープン用装置番号.
! Unit number for NAMELIST file open
integer:: iostat_nml ! NAMELIST 読み込み時の IOSTAT.
! IOSTAT of NAMELIST read
! NAMELIST 変数群
! NAMELIST group name
!
namelist /gridset_nml/ nmax, imax, jmax, kmax
!
! デフォルト値については初期化手続 "gridset#GridsetInit"
! のソースコードを参照のこと.
!
! Refer to source codes in the initialization procedure
! "gridset#GridsetInit" for the default values.
!
! 実行文 ; Executable statement
!
if ( gridset_inited ) return
call InitCheck
! デフォルト値の設定
! Default values settings
!
nmax = 10
imax = 32
jmax = 16
kmax = 5
! NAMELIST の読み込み
! NAMELIST is input
!
if ( trim(namelist_filename) /= '' ) then
call FileOpen( unit_nml, namelist_filename, mode = 'r' ) ! (in)
rewind( unit_nml )
read( unit_nml, nml = gridset_nml, iostat = iostat_nml ) ! (out)
close( unit_nml )
call NmlutilMsg( iostat_nml, module_name ) ! (in)
if ( iostat_nml == 0 ) write( STDOUT, nml = gridset_nml )
end if
! 格子点数のチェック
! Check number of grid points
!
if ( nmax < 1 .or. imax < 1 .or. jmax < 1 .or. kmax < 1 ) then
call MessageNotify( 'E', module_name, 'number of grid points and maximum truncated wavenumber must be more than 0. ' // 'nmax=%d, imax=%d, jmax=%d, kmax=%d' , i = (/ nmax, imax, jmax, kmax /) )
end if
! 印字 ; Print
!
call MessageNotify( 'M', module_name, '----- Initialization Messages -----' )
call MessageNotify( 'M', module_name, ' nmax = %d', i = (/ nmax /) )
call MessageNotify( 'M', module_name, ' imax = %d', i = (/ imax /) )
call MessageNotify( 'M', module_name, ' jmax = %d', i = (/ jmax /) )
call MessageNotify( 'M', module_name, ' kmax = %d', i = (/ kmax /) )
call MessageNotify( 'M', module_name, '-- version = %c', c1 = trim(version) )
gridset_inited = .true.
end subroutine GridsetInit