Linux  R2.6.5-7.282-sn2 FORTRAN90/SX         Rev.360        Tue Oct 11 12:33:25 2011
FILE NAME: timeset.f90
PROGRAM NAME: timeset
TRANSFORMATION LIST

  LINE                   FORTRAN STATEMENT

     1  != Module TimeSet
     2  !
     3  ! Authors::   SUGIYAMA Ko-ichiro, ODAKA Masatsugu
     4  ! Version::   $Id: timeset.f90,v 1.7 2011-07-15 08:43:29 sugiyama Exp $
     5  ! Tag Name::  $Name: arare5-20111010 $
     6  ! Copyright:: Copyright (C) GFD Dennou Club, 2006. All rights reserved.
     7  ! License::   See COPYRIGHT[link:../../COPYRIGHT]
     8  !
     9  !== Overview
    10  !
    11  !引数に与えられた NAMELIST ファイルから, 時刻に関する情報を取得し,
    12  !保管するための変数型モジュール
    13  !
    14  !== Error Handling
    15  !
    16  !== Known Bugs
    17  !
    18  !== Note
    19  !
    20  !== Future Plans
    21  !
    22  !
    23  
    24  module timeset
    25    !
    26    !引数に与えられた NAMELIST ファイルから, 時刻に関する情報を取得し,
    27    !保管するための変数型モジュール
    28    !
    29  
    30    !モジュール読み込み
    31    use dc_types,   only: DP, STRING
    32    use dc_iounit,  only: FileOpen
    33    use dc_message, only: MessageNotify
    34    use mpi_wrapper, only: myrank
    35    use namelist_util, only: namelist_filename
    36  
    37    !暗黙の型宣言禁止
    38    implicit none
    39  
    40    !属性
    41    private
    42  
    43    ! Public Interface
    44    real(DP), save, public  :: TimeA                   !時刻 t + \del t
    45    real(DP), save, public  :: TimeN                   !時刻 t
    46    real(DP), save, public  :: TimeB                   !時刻 t - \del t
    47    real(DP), save, public  :: DelTimeLong  = 2.0d0    !長いタイムステップ
    48    real(DP), save, public  :: DelTimeLongSave  = 2.0d0 !長いタイムステップ
    49    real(DP), save, public  :: DelTimeShort = 2.0d-1   !短いタイムステップ
    50    real(DP), save, public  :: RestartTime  = 0.0d0    !計算開始時刻
    51    real(DP), save, public  :: IntegPeriod  = 3600.0d0 !積分時間
    52    real(DP), save, public  :: EndTime      = 3600.0d0 !計算終了時刻
    53    real(DP), save, public  :: DelTimeOutput= 2.0d0    !出力タイムステップ
    54    integer,  save, public  :: NstepShort = 20         !短いタイムステップのステップ数
    55    integer,  save, public  :: NstepShortSave = 20     !短いタイムステップのステップ数
    56    integer,  save, public  :: NstepOutput    = 20     !リスタートファイルへの出力
    57  
    58    ! 公開要素
    59    public timeset_init, TimesetProgress
    60  
    61  contains
    62  
    63    subroutine timeset_init()
    64      !
    65      !NAMELIST から必要な情報を読み取り, 時間関連の変数の設定を行う.
    66      !
    67  
    68      !暗黙の型宣言禁止
    69      implicit none
    70  
    71      !内部変数
    72      integer    :: unit
    73  
    74      !---------------------------------------------------------------
    75      ! NAMELIST から情報を取得
    76      !
    77      NAMELIST /timeset_nml/ &
    78        & DelTimeLong, DelTimeShort, IntegPeriod, RestartTime, DelTimeOutput
    79  
    80      call FileOpen(unit, file=namelist_filename, mode='r')
    81      read(unit, NML=timeset_nml)
    82      close(unit)
    83  
    84      ! 計算終了時刻
    85      !
    86      EndTime = RestartTime + IntegPeriod
    87  
    88      ! 時刻・タイムステップの設定
    89      !   t=0 の時は, 最初の 1 ループだけオイラー法で解くので細工する.
    90      !
    91      NstepShort = 2 * nint( DelTimeLong / DelTimeShort )
    92  
    93      DelTimeLongSave = DelTimeLong
    94      NstepShortSave  = NstepShort
    95  
    96      NstepOutput = nint( DelTimeOutput / DelTimeLong )
    97  
    98      if (RestartTime /= 0.0d0) then
    99        TimeB = RestartTime - DelTimeLong
   100        TimeN = RestartTime
   101        TimeA = RestartTime + DelTimeLong
   102      else
   103        TimeB = RestartTime
   104        TimeN = RestartTime
   105        TimeA = RestartTime + DelTimeLong
   106        DelTimeLong = DelTimeLong * 5.0d-1
   107        NstepShort = NstepShort / 2
   108      end if
   109  
   110      !---------------------------------------------------------------
   111      ! 確認
   112      !
   113      if (myrank == 0) then
   114  
   115        !長い時間ステップが短い時間ステップで割り切れない場合には警告を出す
   116        if(mod(DelTimeLong, DelTimeShort) /= 0) then
   117          call MessageNotify( "W", &
   118            & "timeset_init", "mod(DelTimeLong, DelTimeShort) is not zero")
   119        end if
   120  
   121        !長い時間ステップが短い時間ステップで割り切れない場合には警告を出す
   122        if(mod(DelTimeOutput, DelTimeLong) /= 0) then
   123          call MessageNotify( "W", &
   124            & "timeset_init", "mod(DelTimeOutput, DelTimeLong) is not zero")
   125        end if
   126  
   127        call MessageNotify( "M", &
   128          & "timeset_init", "DelTimeLong  = %f", d=(/DelTimeLongSave/) )
   129        call MessageNotify( "M", &
   130          & "timeset_init", "DelTimeShort = %f", d=(/DelTimeShort/) )
   131        call MessageNotify( "M", &
   132          & "timeset_init", "Restarttime  = %f", d=(/Restarttime/)  )
   133        call MessageNotify( "M", &
   134          & "timeset_init", "IntegPeriod  = %f", d=(/IntegPeriod/) )
   135        call MessageNotify( "M", &
   136          & "timeset_init", "EndTime      = %f", d=(/EndTime/) )
   137        call MessageNotify( "M", &
   138          & "timeset_init", "DelTimeOutput= %f", d=(/DelTimeOutput/) )
   139        call MessageNotify( "M", &
   140          & "timeset_init", "NstepShort   = %d", i=(/NstepShort/) )
   141        call MessageNotify( "M", &
   142          & "timeset_init", "NstepOutput  = %d", i=(/NstepOutput/) )
   143      end if
   144  
   145    end subroutine timeset_init
   146  
   147  
   148    subroutine TimesetProgress
   149  
   150      implicit none
   151  
   152      ! 時刻刻み幅を直す
   153      !
   154      DelTimeLong = DelTimeLongSave
   155      NstepShort  = NstepShortSave
   156  
   157      ! 時刻を進める
   158      !
   159      TimeB = TimeN
   160      TimeN = TimeA
   161      TimeA = TimeA + DelTimeLong
   162  
   163    end subroutine TimesetProgress
   164  
   165  end module timeset
Linux  R2.6.5-7.282-sn2 FORTRAN90/SX         Rev.360        Tue Oct 11 12:33:25 2011
FILE NAME: timeset.f90
PROGRAM NAME: timeset
FORMAT LIST

  LINE    LOOP     FORTRAN STATEMENT

     1:            != Module TimeSet
     2:            !
     3:            ! Authors::   SUGIYAMA Ko-ichiro, ODAKA Masatsugu
     4:            ! Version::   $Id: timeset.f90,v 1.7 2011-07-15 08:43:29 sugiyama Exp $ 
     5:            ! Tag Name::  $Name: arare5-20111010 $
     6:            ! Copyright:: Copyright (C) GFD Dennou Club, 2006. All rights reserved.
     7:            ! License::   See COPYRIGHT[link:../../COPYRIGHT]
     8:            !
     9:            !== Overview 
    10:            !
    11:            !引数に与えられた NAMELIST ファイルから, 時刻に関する情報を取得し, 
    12:            !保管するための変数型モジュール
    13:            !
    14:            !== Error Handling
    15:            !
    16:            !== Known Bugs
    17:            !
    18:            !== Note
    19:            !
    20:            !== Future Plans
    21:            !
    22:            !
    23:            
    24:            module timeset
    25:              !
    26:              !引数に与えられた NAMELIST ファイルから, 時刻に関する情報を取得し, 
    27:              !保管するための変数型モジュール
    28:              !
    29:              
    30:              !モジュール読み込み
    31:              use dc_types,   only: DP, STRING
    32:              use dc_iounit,  only: FileOpen
    33:              use dc_message, only: MessageNotify
    34:              use mpi_wrapper, only: myrank
    35:              use namelist_util, only: namelist_filename
    36:              
    37:              !暗黙の型宣言禁止
    38:              implicit none
    39:            
    40:              !属性
    41:              private
    42:              
    43:              ! Public Interface
    44:              real(DP), save, public  :: TimeA                   !時刻 t + \del t
    45:              real(DP), save, public  :: TimeN                   !時刻 t
    46:              real(DP), save, public  :: TimeB                   !時刻 t - \del t
    47:              real(DP), save, public  :: DelTimeLong  = 2.0d0    !長いタイムステップ
    48:              real(DP), save, public  :: DelTimeLongSave  = 2.0d0 !長いタイムステップ
    49:              real(DP), save, public  :: DelTimeShort = 2.0d-1   !短いタイムステップ
    50:              real(DP), save, public  :: RestartTime  = 0.0d0    !計算開始時刻
    51:              real(DP), save, public  :: IntegPeriod  = 3600.0d0 !積分時間
    52:              real(DP), save, public  :: EndTime      = 3600.0d0 !計算終了時刻
    53:              real(DP), save, public  :: DelTimeOutput= 2.0d0    !出力タイムステップ
    54:              integer,  save, public  :: NstepShort = 20         !短いタイムステップのステップ数
    55:              integer,  save, public  :: NstepShortSave = 20     !短いタイムステップのステップ数
    56:              integer,  save, public  :: NstepOutput    = 20     !リスタートファイルへの出力
    57:              
    58:              ! 公開要素
    59:              public timeset_init, TimesetProgress
    60:            
    61:            contains
    62:               
    63:              subroutine timeset_init()
    64:                !
    65:                !NAMELIST から必要な情報を読み取り, 時間関連の変数の設定を行う. 
    66:                !
    67:            
    68:                !暗黙の型宣言禁止
    69:                implicit none
    70:            
    71:                !内部変数
    72:                integer    :: unit
    73:            
    74:                !---------------------------------------------------------------    
    75:                ! NAMELIST から情報を取得
    76:                !
    77:                NAMELIST /timeset_nml/ &
    78:                  & DelTimeLong, DelTimeShort, IntegPeriod, RestartTime, DelTimeOutput
    79:                
    80:                call FileOpen(unit, file=namelist_filename, mode='r')
    81:                read(unit, NML=timeset_nml)
    82:                close(unit)
    83:            
    84:                ! 計算終了時刻
    85:                !
    86:                EndTime = RestartTime + IntegPeriod
    87:                
    88:                ! 時刻・タイムステップの設定
    89:                !   t=0 の時は, 最初の 1 ループだけオイラー法で解くので細工する. 
    90:                !    
    91:                NstepShort = 2 * nint( DelTimeLong / DelTimeShort )
    92:            
    93:                DelTimeLongSave = DelTimeLong
    94:                NstepShortSave  = NstepShort
    95:            
    96:                NstepOutput = nint( DelTimeOutput / DelTimeLong )
    97:            
    98:                if (RestartTime /= 0.0d0) then 
    99:                  TimeB = RestartTime - DelTimeLong
   100:                  TimeN = RestartTime
   101:                  TimeA = RestartTime + DelTimeLong      
   102:                else
   103:                  TimeB = RestartTime
   104:                  TimeN = RestartTime
   105:                  TimeA = RestartTime + DelTimeLong
   106:                  DelTimeLong = DelTimeLong * 5.0d-1
   107:                  NstepShort = NstepShort / 2
   108:                end if
   109:            
   110:                !---------------------------------------------------------------
   111:                ! 確認
   112:                !
   113:                if (myrank == 0) then
   114:                
   115:                  !長い時間ステップが短い時間ステップで割り切れない場合には警告を出す
   116:                  if(mod(DelTimeLong, DelTimeShort) /= 0) then 
   117:                    call MessageNotify( "W", &
   118:                      & "timeset_init", "mod(DelTimeLong, DelTimeShort) is not zero")
   119:                  end if
   120:            
   121:                  !長い時間ステップが短い時間ステップで割り切れない場合には警告を出す
   122:                  if(mod(DelTimeOutput, DelTimeLong) /= 0) then 
   123:                    call MessageNotify( "W", &
   124:                      & "timeset_init", "mod(DelTimeOutput, DelTimeLong) is not zero")
   125:                  end if
   126:                  
   127:                  call MessageNotify( "M", &
   128:                    & "timeset_init", "DelTimeLong  = %f", d=(/DelTimeLongSave/) )
   129:                  call MessageNotify( "M", &
   130:                    & "timeset_init", "DelTimeShort = %f", d=(/DelTimeShort/) )
   131:                  call MessageNotify( "M", &
   132:                    & "timeset_init", "Restarttime  = %f", d=(/Restarttime/)  )
   133:                  call MessageNotify( "M", &
   134:                    & "timeset_init", "IntegPeriod  = %f", d=(/IntegPeriod/) )
   135:                  call MessageNotify( "M", &
   136:                    & "timeset_init", "EndTime      = %f", d=(/EndTime/) )
   137:                  call MessageNotify( "M", &
   138:                    & "timeset_init", "DelTimeOutput= %f", d=(/DelTimeOutput/) )
   139:                  call MessageNotify( "M", &
   140:                    & "timeset_init", "NstepShort   = %d", i=(/NstepShort/) )
   141:                  call MessageNotify( "M", &
   142:                    & "timeset_init", "NstepOutput  = %d", i=(/NstepOutput/) )
   143:                end if
   144:                
   145:              end subroutine timeset_init
   146:            
   147:            
   148:              subroutine TimesetProgress
   149:            
   150:                implicit none
   151:            
   152:                ! 時刻刻み幅を直す 
   153:                !
   154:                DelTimeLong = DelTimeLongSave
   155:                NstepShort  = NstepShortSave
   156:            
   157:                ! 時刻を進める
   158:                !
   159:                TimeB = TimeN
   160:                TimeN = TimeA
   161:                TimeA = TimeA + DelTimeLong
   162:            
   163:              end subroutine TimesetProgress
   164:              
   165:            end module timeset
