| Path: | main/sst_data.F90 | 
| Last Update: | Sat Jan 24 14:33:59 +0900 2009 | 
| Authors: | Yasuhiro MORIKAWA | 
| Version: | $Id: sst_data.F90,v 1.3 2009-01-24 05:33:59 morikawa Exp $ | 
| Tag Name: | $Name: dcpam5-20090225-2 $ | 
| Copyright: | Copyright (C) GFD Dennou Club, 2008. All rights reserved. | 
| License: | See COPYRIGHT | 
| Main Program : | 
Note that Japanese and English are described in parallel.
地表面データファイルを生成します.
Surface data file is created.
program sst_data
  !
  ! <b>Note that Japanese and English are described in parallel.</b>
  !
  ! 地表面データファイルを生成します. 
  !
  ! Surface data file is created. 
  !
  ! モジュール引用 ; USE statements
  !
  ! 地表面データ提供
  ! Prepare surface data
  !
  use surface_data, only: SurfDataGet
  ! 地表面温度リスタートデータ入出力
  ! Restart data of surface temperature input/output
  !
  use restart_surftemp_io, only: RestartSurfTempOutput
  ! 種別型パラメタ
  ! Kind type parameter
  !
  use dc_types, only: DP, STRING, TOKEN      ! キーワード.   Keywords. 
  ! 宣言文 ; Declaration statements
  !
  implicit none
#ifdef LIB_MPI
  ! MPI ライブラリ
  ! MPI library
  !
  include 'mpif.h'
#endif
  ! 変数
  ! Variables
  !
  real(DP), allocatable:: xy_SurfTemp (:,:)
                              ! 地表面温度. 
                              ! Surface temperature
  ! 作業変数
  ! Work variables
  !
  ! 実行文 ; Executable statement
  !
  ! 主プログラムの初期化 (内部サブルーチン)
  ! Initialization for the main program (Internal subroutine)
  !
  call MainInit
  ! 地表面データの作成
  ! Generate surface data
  !
  call SurfDataGet( xy_SurfTemp = xy_SurfTemp )  ! (out) optional
  ! 地表面温度リスタートデータ出力
  ! Restart data of surface temperature output
  !
  call RestartSurfTempOutput( xy_SurfTemp  )             ! (in)
  ! 主プログラムの終了処理 (内部サブルーチン)
  ! Termination for the main program (Internal subroutine)
  !
  call MainTerminate
contains
  !-------------------------------------------------------------------
  subroutine MainInit
    !
    ! 主プログラムの初期化手続き. 
    !
    ! Initialization procedure for the main program. 
    !
#ifdef LIB_MPI
    ! メッセージ出力
    ! Message output
    !
    use dc_message, only: MessageSuppressMPI
#endif
    use dc_message, only: MessageNotify
    ! コマンドライン引数処理
    ! Command line option parser
    !
    use option_parser, only: OptParseInit
    ! NAMELIST ファイル入力に関するユーティリティ
    ! Utilities for NAMELIST file input
    !
    use namelist_util, only: NmlutilInit
    ! 時刻管理
    ! Time control
    !
    use timeset, only: TimesetInit
                              ! ステップ $ t $ の時刻. Time of step $ t $. 
    ! 出力ファイルの基本情報管理
    ! Management basic information for output files
    ! 
    use fileset, only: FilesetInit
    ! 格子点設定
    ! Grid points settings
    !
    use gridset, only: GridsetInit, imax, jmax    ! 緯度格子点数. 
                               ! Number of grid points in latitude
    ! 物理定数設定
    ! Physical constants settings
    !
    use constants, only: ConstantsInit
    ! 座標データ設定
    ! Axes data settings
    !
    use axesset, only: AxessetInit
    ! 地表面温度リスタートデータ入出力
    ! Restart data of surface temperature input/output
    !
    use restart_surftemp_io, only: RestartSurfTempOpen, RestartSurfTempGet
    ! 宣言文 ; Declaration statements
    !
    implicit none
    character(*), parameter:: prog_name = 'sst_data'
                              ! 主プログラム名. 
                              ! Main program name
    character(*), parameter:: version = '$Name: dcpam5-20090225-2 $' // '$Id: sst_data.F90,v 1.3 2009-01-24 05:33:59 morikawa Exp $'
                              ! 主プログラムのバージョン
                              ! Main program version
    character(STRING):: brief
                              ! 実行ファイルの簡潔な説明
                              ! Brief account of executable file
#ifdef LIB_MPI
    integer :: myrank_mpi, nprocs_mpi, err_mpi
                              ! MPI の初期化の際に使用される変数. 
                              ! Variables used for initialization of MPI. 
#endif
    ! 実行文 ; Executable statement
    !
#ifdef LIB_MPI
    ! MPI 初期化
    ! Initialization of MPI
    !
    CALL MPI_Init(err_mpi)
    CALL MPI_Comm_Rank(mpi_comm_world, myrank_mpi, err_mpi)
    CALL MPI_Comm_Size(mpi_comm_world, nprocs_mpi, err_mpi)
#endif
#ifdef LIB_MPI
    ! メッセージ出力
    ! Message output
    !
    call MessageSuppressMPI( rank = 0 )
#endif
    brief = 'SST data generation'
    call MessageNotify( 'M', prog_name, 'Run: %c', c1 = trim(brief) )
    call MessageNotify( 'M', prog_name, '-- version = %c', c1 = trim(version) )
    ! コマンドライン引数処理
    ! Command line option parser
    !
    call OptParseInit(prog_name, brief)
    ! NAMELIST ファイル名入力
    ! Input NAMELIST file name
    !
    call NmlutilInit
    ! 時刻管理
    ! Time control
    !
    call TimesetInit
    ! 出力ファイルの基本情報管理
    ! Management basic information for output files
    ! 
    call FilesetInit
    ! 格子点設定
    ! Grid points settings
    !
    call GridsetInit
    ! 物理定数設定
    ! Physical constants settings
    !
    call ConstantsInit
    ! 座標データ設定
    ! Axes data settings
    !
    call AxessetInit
    ! 地表面温度の割付
    ! Allocation of surface temperature
    !
    allocate( xy_SurfTemp (0:imax-1, 1:jmax) )
    ! 地表面温度リスタートデータファイルの初期化
    ! Initialization of restart data file of surface temperature
    !
    call RestartSurfTempOpen( flag_init_data = .true. ) ! (in) optional
  end subroutine MainInit
  !-------------------------------------------------------------------
  subroutine MainTerminate
    !
    ! 主プログラムの終了処理手続き. 
    !
    ! Termination procedure for the main program. 
    !
    ! 時刻管理
    ! Time control
    !
    use timeset, only: TimesetClose
    ! 地表面温度リスタートデータ入出力
    ! Restart data of surface temperature input/output
    !
    use restart_surftemp_io, only: RestartSurfTempClose
    ! ヒストリデータ出力
    ! History data output
    !
    use history_file_io, only: HistoryFileClose
    ! 宣言文 ; Declaration statements
    !
    implicit none
#ifdef LIB_MPI
    integer :: err_mpi
                              ! MPI の終了処理の際に使用される変数. 
                              ! Variable used for termination of MPI. 
#endif
    ! 実行文 ; Executable statement
    !
    ! 地表面温度リスタートデータファイルクローズ
    ! Close restart data file of surface temperature
    !
    call RestartSurfTempClose
    ! 時刻管理終了処理
    ! Termination of time control
    !
    call TimesetClose
#ifdef LIB_MPI
    ! MPI 終了処理
    ! Termination of MPI
    !
    call MPI_Finalize(err_mpi)
#endif
  end subroutine MainTerminate
end program sst_data
          | Subroutine : | 
主プログラムの初期化手続き.
Initialization procedure for the main program.
  subroutine MainInit
    !
    ! 主プログラムの初期化手続き. 
    !
    ! Initialization procedure for the main program. 
    !
#ifdef LIB_MPI
    ! メッセージ出力
    ! Message output
    !
    use dc_message, only: MessageSuppressMPI
#endif
    use dc_message, only: MessageNotify
    ! コマンドライン引数処理
    ! Command line option parser
    !
    use option_parser, only: OptParseInit
    ! NAMELIST ファイル入力に関するユーティリティ
    ! Utilities for NAMELIST file input
    !
    use namelist_util, only: NmlutilInit
    ! 時刻管理
    ! Time control
    !
    use timeset, only: TimesetInit
                              ! ステップ $ t $ の時刻. Time of step $ t $. 
    ! 出力ファイルの基本情報管理
    ! Management basic information for output files
    ! 
    use fileset, only: FilesetInit
    ! 格子点設定
    ! Grid points settings
    !
    use gridset, only: GridsetInit, imax, jmax    ! 緯度格子点数. 
                               ! Number of grid points in latitude
    ! 物理定数設定
    ! Physical constants settings
    !
    use constants, only: ConstantsInit
    ! 座標データ設定
    ! Axes data settings
    !
    use axesset, only: AxessetInit
    ! 地表面温度リスタートデータ入出力
    ! Restart data of surface temperature input/output
    !
    use restart_surftemp_io, only: RestartSurfTempOpen, RestartSurfTempGet
    ! 宣言文 ; Declaration statements
    !
    implicit none
    character(*), parameter:: prog_name = 'sst_data'
                              ! 主プログラム名. 
                              ! Main program name
    character(*), parameter:: version = '$Name: dcpam5-20090225-2 $' // '$Id: sst_data.F90,v 1.3 2009-01-24 05:33:59 morikawa Exp $'
                              ! 主プログラムのバージョン
                              ! Main program version
    character(STRING):: brief
                              ! 実行ファイルの簡潔な説明
                              ! Brief account of executable file
#ifdef LIB_MPI
    integer :: myrank_mpi, nprocs_mpi, err_mpi
                              ! MPI の初期化の際に使用される変数. 
                              ! Variables used for initialization of MPI. 
#endif
    ! 実行文 ; Executable statement
    !
#ifdef LIB_MPI
    ! MPI 初期化
    ! Initialization of MPI
    !
    CALL MPI_Init(err_mpi)
    CALL MPI_Comm_Rank(mpi_comm_world, myrank_mpi, err_mpi)
    CALL MPI_Comm_Size(mpi_comm_world, nprocs_mpi, err_mpi)
#endif
#ifdef LIB_MPI
    ! メッセージ出力
    ! Message output
    !
    call MessageSuppressMPI( rank = 0 )
#endif
    brief = 'SST data generation'
    call MessageNotify( 'M', prog_name, 'Run: %c', c1 = trim(brief) )
    call MessageNotify( 'M', prog_name, '-- version = %c', c1 = trim(version) )
    ! コマンドライン引数処理
    ! Command line option parser
    !
    call OptParseInit(prog_name, brief)
    ! NAMELIST ファイル名入力
    ! Input NAMELIST file name
    !
    call NmlutilInit
    ! 時刻管理
    ! Time control
    !
    call TimesetInit
    ! 出力ファイルの基本情報管理
    ! Management basic information for output files
    ! 
    call FilesetInit
    ! 格子点設定
    ! Grid points settings
    !
    call GridsetInit
    ! 物理定数設定
    ! Physical constants settings
    !
    call ConstantsInit
    ! 座標データ設定
    ! Axes data settings
    !
    call AxessetInit
    ! 地表面温度の割付
    ! Allocation of surface temperature
    !
    allocate( xy_SurfTemp (0:imax-1, 1:jmax) )
    ! 地表面温度リスタートデータファイルの初期化
    ! Initialization of restart data file of surface temperature
    !
    call RestartSurfTempOpen( flag_init_data = .true. ) ! (in) optional
  end subroutine MainInit
          | Subroutine : | 
主プログラムの終了処理手続き.
Termination procedure for the main program.
  subroutine MainTerminate
    !
    ! 主プログラムの終了処理手続き. 
    !
    ! Termination procedure for the main program. 
    !
    ! 時刻管理
    ! Time control
    !
    use timeset, only: TimesetClose
    ! 地表面温度リスタートデータ入出力
    ! Restart data of surface temperature input/output
    !
    use restart_surftemp_io, only: RestartSurfTempClose
    ! ヒストリデータ出力
    ! History data output
    !
    use history_file_io, only: HistoryFileClose
    ! 宣言文 ; Declaration statements
    !
    implicit none
#ifdef LIB_MPI
    integer :: err_mpi
                              ! MPI の終了処理の際に使用される変数. 
                              ! Variable used for termination of MPI. 
#endif
    ! 実行文 ; Executable statement
    !
    ! 地表面温度リスタートデータファイルクローズ
    ! Close restart data file of surface temperature
    !
    call RestartSurfTempClose
    ! 時刻管理終了処理
    ! Termination of time control
    !
    call TimesetClose
#ifdef LIB_MPI
    ! MPI 終了処理
    ! Termination of MPI
    !
    call MPI_Finalize(err_mpi)
#endif
  end subroutine MainTerminate