Class | phy_adjust_fixed |
In: |
physics/phy_adjust_fixed.f90
|
Note that Japanese and English are described in parallel.
いくつかの物理量 (現在は温度と比湿のみ) をある値に固定します. その際, 元の値と修正値の差も算出します.
Fix some physical values (now, only temperature and specific humidity) to a certain value. And calculate difference between original values and fixed values.
PhyAdjFixCreate : | PHYADJFIX 型変数の初期設定 |
AdjustFixed : | 演算 |
PhyAdjFixClose : | PHYADJFIX 型変数の終了処理 |
PhyAdjFixPutLine : | PHYADJFIX 型変数に格納されている情報の印字 |
PhyAdjFixinitialized : | PHYADJFIX 型変数が初期設定されているか否か |
PhyAdjFixSetTime : | 時刻の設定 |
———— : | ———— |
PhyAdjFixCreate : | Constructor of "PHYADJFIX" |
AdjustFixed : | Calculation |
PhyAdjFixClose : | Deconstructor of "PHYADJFIX" |
PhyAdjFixPutLine : | Print information of "PHYADJFIX" |
PhyAdjFixinitialized : | Check initialization of "PHYADJFIX" |
PhyAdjFixSetTime : | Configure time |
始めに, PHYADJFIX 型の変数を定義し, PhyAdjFixCreate で初期設定を行います. AdjustFixed に物理量 (現在は温度と比湿のみ) を与えることで, それぞれをある値 (PhyAdjFixCreate にて指定) へ固定します. PhyAdjFixCreate の初期設定で出力設定を行えば, 元の値と修正値との差が出力されます. PHYADJFIX 型の変数の終了処理には PhyAdjFixClose を用いてください.
First, initialize "PHYADJFIX" by "PhyAdjFixCreate". Fix physical values (now, only temperature and specific humidity) by given them to "AdjustFixed". When output settings are done within initialization of "PhyAdjFixCreate", difference between original values and fixed values is output. In order to terminate "PHYADJFIX", use "PhyAdjFixClose".
Subroutine : | |||
phy_adj_fix : | type(PHYADJFIX), intent(inout) | ||
xyz_Temp(0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) : | real(DP), intent(inout), optional
| ||
xyz_QVap(0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) : | real(DP), intent(inout), optional
| ||
xyz_DTempDtFixed(0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) : | real(DP), intent(out), optional
| ||
xyz_DQVapDtFixed(0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) : | real(DP), intent(out), optional
| ||
historyput_flag : | logical, intent(in), optional
| ||
err : | logical, intent(out), optional
|
いくつかの物理量 (現在, 温度 xyz_Temp, 比湿 xyz_QVap) をある値 (PhyAdjFixCreate で指定) に固定します. オプショナル引数 xyz_DTempDtFixed, xyz_DQVapDtFixed を 与えれば, それらの変数に変化量を返します. 計算後, phy_adj_fix 内の時刻を更新します.
なお, 与えられた phy_adj_fix が PhyAdjFixCreate によって初期設定されていない場合, プログラムはエラーを発生させます.
Fix some physical values (now, only temperature xyz_Temp, and specific humidity xyz_QVap) to a certain value (this is configured by "PhyAdjFixCreate"). When optional arguments xyz_DTempDtFixed, xyz_DQVapDtFixed are given, tendencies are returned to them. After the calculation, time stored in phy_adj_fix is updated.
If phy_adj_fix is not initialized by "PhyAdjFixCreate" yet, error is occurred.
subroutine AdjustFixed( phy_adj_fix, xyz_Temp, xyz_QVap, xyz_DTempDtFixed, xyz_DQVapDtFixed, historyput_flag, err ) ! ! いくつかの物理量 (現在, 温度 *xyz_Temp*, 比湿 *xyz_QVap*) ! をある値 (PhyAdjFixCreate で指定) に固定します. ! オプショナル引数 *xyz_DTempDtFixed*, *xyz_DQVapDtFixed* を ! 与えれば, それらの変数に変化量を返します. ! 計算後, *phy_adj_fix* 内の時刻を更新します. ! ! なお, 与えられた *phy_adj_fix* が PhyAdjFixCreate ! によって初期設定されていない場合, プログラムはエラーを発生させます. ! ! Fix some physical values (now, only temperature *xyz_Temp*, ! and specific humidity *xyz_QVap*) to a certain value ! (this is configured by "PhyAdjFixCreate"). ! When optional arguments *xyz_DTempDtFixed*, *xyz_DQVapDtFixed* are ! given, tendencies are returned to them. ! After the calculation, time stored in *phy_adj_fix* is updated. ! ! If *phy_adj_fix* is not initialized ! by "PhyAdjFixCreate" yet, error is occurred. ! use dc_trace, only: BeginSub, EndSub use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar use dc_types, only: DP, STRING, TOKEN, STDOUT use dc_present, only: present_and_true use dc_date, only: mod, operator(+), operator(==), EvalbyUnit, EvalSec use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT, USR_ERRNO use dc_message, only: MessageNotify use gt4_history_nmlinfo, only: HstNmlInfoInquire, HstNmlInfoOutputValid, HstNmlInfoAssocGtHist, HstNmlInfoPutLine use gt4_history, only: GT_HISTORY, HistoryPut, HistoryInitialized implicit none type(PHYADJFIX), intent(inout):: phy_adj_fix real(DP), intent(inout), optional:: xyz_Temp (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ T $ . 温度 ! Temperature real(DP), intent(inout), optional:: xyz_QVap (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ q $ . 比湿 ! Specific humidity real(DP), intent(out), optional:: xyz_DTempDtFixed (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ DP{T}{t} $ . ! 固定値への調節に関する温度の変化率 ! Temperature tendency by adjustment to fixed value real(DP), intent(out), optional:: xyz_DQVapDtFixed (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ q $ . ! 固定値への調節に関する比湿の変化率 ! Specific humidity tendency by adjustment to fixed value logical, intent(in), optional:: historyput_flag ! データ出力のフラグ. ! SetTime によって時刻を明示的に ! 指定した場合には, この引数に ! .true. または .false. を指定する ! ことでデータ出力のオンオフを ! 明示的に指定する必要があります. ! デフォルトは .false. です. ! ! Data output flag. ! When time is specified by "SetTime", ! explicit specification of data output ! on/off by specifying ".true." or ".false." ! to this argument. ! Default value is ".false.". ! logical, intent(out), optional:: err ! 例外処理用フラグ. ! デフォルトでは, この手続き内でエラーが ! 生じた場合, プログラムは強制終了します. ! 引数 *err* が与えられる場合, ! プログラムは強制終了せず, 代わりに ! *err* に .true. が代入されます. ! ! Exception handling flag. ! By default, when error occur in ! this procedure, the program aborts. ! If this *err* argument is given, ! .true. is substituted to *err* and ! the program does not abort. !----------------------------------- ! *phy_adj_fix* から取り出される設定値 ! Setting values fetched from *phy_adj_fix* real(DP):: DelTime ! $ \Delta t $ . タイムステップ. Time step real(DP):: xyz_TempFixed (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ T_0 $ . 温度の固定値. ! Fixed value of temperature real(DP):: xyz_QVapFixed (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ q_0 $ . 比湿の固定値. ! Fixed value of specific humidity !----------------------------------- ! ヒストリファイルへのデータ出力設定 ! Configure the settings for history data output character(STRING):: name = '' ! 変数名. Variable identifier real:: time ! 時刻. Time type(GT_HISTORY), pointer:: gthist =>null() ! gt4_history モジュール用構造体. ! Derived type for "gt4_history" module !----------------------------------- ! 作業変数 ! Work variables real(DP):: xyz_DTempDtFixedWork (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ DP{T}{t} $ . ! 固定値への調節に関する温度の変化率 ! Temperature tendency by adjustment to fixed value real(DP):: xyz_DQVapDtFixedWork (0:phy_adj_fix%imax-1,0:phy_adj_fix%jmax-1,0:phy_adj_fix%kmax-1) ! $ q $ . ! 固定値への調節に関する比湿の変化率 ! Specific humidity tendency by adjustment to fixed value integer:: stat character(STRING):: cause_c character(*), parameter:: subname = 'AdjustFixed' continue call BeginSub( subname ) stat = DC_NOERR cause_c = '' !----------------------------------------------------------------- ! 初期設定のチェック ! Check initialization !----------------------------------------------------------------- if ( .not. phy_adj_fix % initialized ) then stat = DC_ENOTINIT cause_c = 'PHYADJFIX' goto 999 end if !----------------------------------------------------------------- ! *phy_adj_fix* に格納されている設定値の取り出し ! Fetch setting values stored in *phy_adj_fix* !----------------------------------------------------------------- DelTime = EvalSec( phy_adj_fix % delta_time ) if ( associated( phy_adj_fix % xyz_TempFixed ) ) xyz_TempFixed = phy_adj_fix % xyz_TempFixed if ( associated( phy_adj_fix % xyz_QVapFixed ) ) xyz_QVapFixed = phy_adj_fix % xyz_QVapFixed !----------------------------------------------------------------- ! 温度の調節 ! Adjustment of temperature !----------------------------------------------------------------- xyz_DTempDtFixedWork = 0.0_DP if ( present( xyz_Temp ) ) then if ( associated( phy_adj_fix % xyz_TempFixed ) ) then xyz_DTempDtFixedWork = ( xyz_TempFixed - xyz_Temp ) / DelTime xyz_Temp = xyz_TempFixed else call MessageNotify( 'W', subname, 'fixed value of "%c" is not specified.', c1 = 'Temp' ) end if end if if ( present( xyz_DTempDtFixed ) ) then xyz_DTempDtFixed = xyz_DTempDtFixedWork end if !----------------------------------------------------------------- ! 比湿の調節 ! Adjustment of specific humidity !----------------------------------------------------------------- xyz_DQVapDtFixedWork = 0.0_DP if ( present( xyz_QVap ) ) then if ( associated( phy_adj_fix % xyz_QVapFixed ) ) then xyz_DQVapDtFixedWork = ( xyz_QVapFixed - xyz_QVap ) / DelTime xyz_QVap = xyz_QVapFixed else call MessageNotify( 'W', subname, 'fixed value of "%c" is not specified.', c1 = 'QVap' ) end if end if if ( present( xyz_DQVapDtFixed ) ) then xyz_DQVapDtFixed = xyz_DQVapDtFixedWork end if !---------------------------------------------------------------- ! ヒストリファイルへのデータ出力 ! History data output !---------------------------------------------------------------- if ( associated( phy_adj_fix % xyz_TempFixed ) ) then !----------------------------------- ! xyz_DTempDtFixed の出力 ! Output "xyz_DTempDtFixed" name = 'DTempDtFixed' ! 出力のチェック. ! * gthist (gt4_history#GT_HISTORY), time (単精度実数型) が設定される. ! Check for output. ! * "gthist" (gt4_history#GT_HISTORY), time (real) are configured. call output_check ! これは内部サブルーチン. This is an internal subroutine ! 出力データを引数 array に渡す. ! Give output data to argument "array" if ( associated( gthist ) ) then call HistoryPut( history = gthist, varname = name, array = xyz_DTempDtFixedWork, time = time, quiet = .false., err = err ) ! (out) end if end if if ( associated( phy_adj_fix % xyz_QVapFixed ) ) then !----------------------------------- ! xyz_DQVapDtFixed の出力 ! Output "xyz_DQVapDtFixed" name = 'DQVapDtFixed' ! 出力のチェック. ! * gthist (gt4_history#GT_HISTORY), time (単精度実数型) が設定される. ! Check for output. ! * "gthist" (gt4_history#GT_HISTORY), time (real) are configured. call output_check ! これは内部サブルーチン. This is an internal subroutine ! 出力データを引数 array に渡す. ! Give output data to argument "array" if ( associated( gthist ) ) then call HistoryPut( history = gthist, varname = name, array = xyz_DQVapDtFixedWork, time = time, quiet = .false., err = err ) ! (out) end if end if !!$ !----------------------------------- !!$ ! y_Data2 の出力 !!$ ! Output "y_Data2" !!$ name = 'Data2' !!$ !!$ ! 出力のチェック. !!$ ! * gthist (gt4_history#GT_HISTORY), time (単精度実数型) が設定される. !!$ ! Check for output. !!$ ! * "gthist" (gt4_history#GT_HISTORY), time (real) are configured. !!$ call output_check ! これは内部サブルーチン. This is an internal subroutine !!$ !!$ ! 出力データを引数 array に渡す. !!$ ! Give output data to argument "array" !!$ if ( associated( gthist ) ) then !!$ call HistoryPut( & !!$ & history = gthist, & ! (inout) !!$ & varname = name, array = y_Data2, & ! (in) !!$ & time = time, quiet = .false., & ! (in) !!$ & err = err ) ! (out) !!$ end if !----------------------------------------------------------------- ! 時刻の更新 ! Update time !----------------------------------------------------------------- phy_adj_fix % current_time = phy_adj_fix % current_time + phy_adj_fix % delta_time !----------------------------------------------------------------- ! 終了処理, 例外処理 ! Termination and Exception handling !----------------------------------------------------------------- 999 continue call StoreError( stat, subname, err, cause_c ) call EndSub( subname ) contains subroutine output_check ! ! 変数 *name* を出力するかどうかをチェックします. ! 出力に関する情報は dcm_sam_cod % gthstnml から取り出されます. ! ! 変数 *name* に関して出力するよう設定されている場合には, ! *gthist* に出力先ファイルの gt4_history#GT_HISTORY ! 型変数を結合させます. そうでない場合は, *gthist* を空状態にします. ! ! また, 現在時刻を *time* に設定します. ! ! Check whether to output variable *name*. ! Information about output is taken out of "dcm_sam_cod % gthstnml". ! ! When output is done for the variable *name*, *gthist* is ! associated with "gt4_history#GT_HISTORY" variable of ! the output file. Otherwise, *gthist* is nullified. ! ! Moreover, current time is set to *time*. ! character(TOKEN):: interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output continue nullify( gthist ) time = 0.0 if ( HstNmlInfoOutputValid( phy_adj_fix % gthstnml, name ) ) then call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, interval_unit = interval_unit ) ! (out) time = real( EvalbyUnit( phy_adj_fix % current_time, interval_unit ) ) if ( present_and_true( historyput_flag ) ) time = 0.0 call HstNmlInfoAssocGtHist( gthstnml = phy_adj_fix % gthstnml, name = name, history = gthist, err = err ) ! (out) if ( present_and_true( err ) ) then nullify( gthist ) return end if if ( .not. HistoryInitialized( gthist ) ) nullify( gthist ) end if end subroutine output_check end subroutine AdjustFixed
Derived Type : | |||
initialized = .false. : | logical
| ||
imax : | integer
| ||
jmax : | integer
| ||
kmax : | integer
| ||
x_Lon(:) =>null() : | real(DP), pointer
| ||
x_Lon_Weight(:) =>null() : | real(DP), pointer
| ||
y_Lat(:) =>null() : | real(DP), pointer
| ||
y_Lat_Weight(:) =>null() : | real(DP), pointer
| ||
z_Sigma(:) =>null() : | real(DP), pointer
| ||
z_DelSigma(:) =>null() : | real(DP), pointer
| ||
TempFixed = -1.0_DP : | real(DP)
| ||
QVapFixed = -1.0_DP : | real(DP)
| ||
xyz_TempFixed(:,:,:) =>null() : | real(DP), pointer
| ||
xyz_QVapFixed(:,:,:) =>null() : | real(DP), pointer
| ||
current_time : | type(DC_DIFFTIME)
| ||
delta_time : | type(DC_DIFFTIME)
| ||
gthstnml : | type(GTHST_NMLINFO)
|
まず, PhyAdjFixCreate で "PHYADJFIX" 型の 変数を初期設定して下さい. 初期設定された "PHYADJFIX" 型の変数を再度利用する際には, PhyAdjFixClose によって終了処理を行ってください.
Initialize "PHYADJFIX" variable by "PhyAdjFixCreate" before usage. If you reuse "PHYADJFIX" variable again for another application, terminate by "PhyAdjFixClose".
Subroutine : | |||
phy_adj_fix : | type(PHYADJFIX), intent(inout) | ||
err : | logical, intent(out), optional
|
PHYADJFIX 型の変数の終了処理を行います. なお, 与えられた phy_adj_fix が PhyAdjFixCreate によって初期設定されていない場合, プログラムはエラーを発生させます.
Deconstructor of "PHYADJFIX". Note that if phy_adj_fix is not initialized by "PhyAdjFixCreate" yet, error is occurred.
subroutine PhyAdjFixClose( phy_adj_fix, err ) ! ! PHYADJFIX 型の変数の終了処理を行います. ! なお, 与えられた *phy_adj_fix* が PhyAdjFixCreate ! によって初期設定されていない場合, プログラムはエラーを発生させます. ! ! Deconstructor of "PHYADJFIX". ! Note that if *phy_adj_fix* is not initialized ! by "PhyAdjFixCreate" yet, error is occurred. ! use dc_trace, only: BeginSub, EndSub use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar use dc_types, only: DP, STRING, TOKEN, STDOUT use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT use gt4_history_nmlinfo, only: HstNmlInfoClose, HstNmlInfoNames, HstNmlInfoAssocGtHist, HstNmlInfoPutLine use gt4_history, only: GT_HISTORY, HistoryClose, HistoryInitialized implicit none type(PHYADJFIX), intent(inout):: phy_adj_fix logical, intent(out), optional:: err ! 例外処理用フラグ. ! デフォルトでは, この手続き内でエラーが ! 生じた場合, プログラムは強制終了します. ! 引数 *err* が与えられる場合, ! プログラムは強制終了せず, 代わりに ! *err* に .true. が代入されます. ! ! Exception handling flag. ! By default, when error occur in ! this procedure, the program aborts. ! If this *err* argument is given, ! .true. is substituted to *err* and ! the program does not abort. !----------------------------------- ! ヒストリファイルへのデータ出力設定 ! Configure the settings for history data output character(STRING):: name = '' ! 変数名. Variable identifier character(STRING):: varnames ! 変数名リスト. ! List of variables character(TOKEN), pointer:: varnames_array(:) =>null() ! 変数名リスト配列. ! List of variables (array) integer:: i, vnmax type(GT_HISTORY), pointer:: gthist =>null() ! gt4_history モジュール用構造体. ! Derived type for "gt4_history" module !----------------------------------- ! 作業変数 ! Work variables integer:: stat character(STRING):: cause_c character(*), parameter:: subname = 'PhyAdjFixClose' continue call BeginSub( subname ) stat = DC_NOERR cause_c = '' !----------------------------------------------------------------- ! 初期設定のチェック ! Check initialization !----------------------------------------------------------------- if ( .not. phy_adj_fix % initialized ) then stat = DC_ENOTINIT cause_c = 'PHYADJFIX' goto 999 end if !----------------------------------------------------------------- ! "PHYADJFIX" の設定の消去 ! Clear the settings for "PHYADJFIX" !----------------------------------------------------------------- deallocate( phy_adj_fix % x_Lon ) deallocate( phy_adj_fix % x_Lon_Weight ) deallocate( phy_adj_fix % y_Lat ) deallocate( phy_adj_fix % y_Lat_Weight ) deallocate( phy_adj_fix % z_Sigma ) deallocate( phy_adj_fix % z_DelSigma ) phy_adj_fix % TempFixed = -1.0_DP phy_adj_fix % QVapFixed = -1.0_DP if ( associated( phy_adj_fix % xyz_TempFixed ) ) deallocate( phy_adj_fix % xyz_TempFixed ) if ( associated( phy_adj_fix % xyz_QVapFixed ) ) deallocate( phy_adj_fix % xyz_QVapFixed ) !----------------------------------------------------------------- ! ヒストリファイルへのデータ出力の終了処理 ! Terminate the settings for history data output !----------------------------------------------------------------- varnames = HstNmlInfoNames( phy_adj_fix % gthstnml ) call Split( str = varnames, sep = ',', carray = varnames_array ) ! (out) vnmax = size( varnames_array ) do i = 1, vnmax name = varnames_array(i) if ( trim( name ) == '' ) exit nullify( gthist ) call HstNmlInfoAssocGtHist( gthstnml = phy_adj_fix % gthstnml, name = name, history = gthist, err = err ) ! (out) if ( HistoryInitialized( gthist ) ) then call HistoryClose( history = gthist, err = err ) ! (out) end if end do !----------------------------------------------------------------- ! ヒストリファイルへのデータ出力設定の割付解除 ! Deallocate the settings for history data output !----------------------------------------------------------------- call HstNmlInfoClose( phy_adj_fix % gthstnml, err = err ) ! (out) !----------------------------------------------------------------- ! 終了処理, 例外処理 ! Termination and Exception handling !----------------------------------------------------------------- phy_adj_fix % initialized = .false. 999 continue call StoreError( stat, subname, err, cause_c ) call EndSub( subname ) end subroutine PhyAdjFixClose
Subroutine : | |||
phy_adj_fix : | type(PHYADJFIX), intent(inout) | ||
imax : | integer, intent(in)
| ||
jmax : | integer, intent(in)
| ||
kmax : | integer, intent(in)
| ||
x_Lon(0:imax-1) : | real(DP), intent(in)
| ||
y_Lat(0:jmax-1) : | real(DP), intent(in)
| ||
z_Sigma(0:kmax-1) : | real(DP), intent(in)
| ||
DelTime : | real(DP), intent(in)
| ||
x_Lon_Weight(0:imax-1) : | real(DP), intent(in), optional
| ||
y_Lat_Weight(0:jmax-1) : | real(DP), intent(in), optional
| ||
z_DelSigma(0:kmax-1) : | real(DP), intent(in), optional
| ||
TempFixed : | real(DP), intent(in), optional
| ||
QVapFixed : | real(DP), intent(in), optional
| ||
xyz_TempFixed(0:imax-1,0:jmax-1,0:kmax-1) : | real(DP), intent(in), optional
| ||
xyz_QVapFixed(0:imax-1,0:jmax-1,0:kmax-1) : | real(DP), intent(in), optional
| ||
current_time_value : | real, intent(in), optional
| ||
current_time_unit : | character(*), intent(in), optional
| ||
history_varlist : | character(*), intent(in), optional
| ||
history_interval_value : | real, intent(in), optional
| ||
history_interval_unit : | character(*), intent(in), optional
| ||
history_precision : | character(*), intent(in), optional
| ||
history_fileprefix : | character(*), intent(in), optional
| ||
nmlfile : | character(*), intent(in), optional
| ||
err : | logical, intent(out), optional
|
PHYADJFIX 型の変数の初期設定を行います. 他のサブルーチンを使用する前に必ずこのサブルーチンによって PHYADJFIX 型の変数を初期設定してください.
なお, 与えられた phy_adj_fix が既に初期設定されている場合, プログラムはエラーを発生させます.
NAMELIST を利用する場合には引数 nmlfile に NAMELIST ファイル名 を与えてください. NAMELIST 変数群の詳細に関しては NAMELIST#phy_adjust_fixed_nml を参照してください.
Constructor of "PHYADJFIX". Initialize phy_adj_fix by this subroutine, before other procedures are used,
Note that if phy_adj_fix is already initialized by this procedure, error is occurred.
In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile. See "NAMELIST#phy_adjust_fixed_nml" for details about a NAMELIST group.
subroutine PhyAdjFixCreate( phy_adj_fix, imax, jmax, kmax, x_Lon, y_Lat, z_Sigma, DelTime, x_Lon_Weight, y_Lat_Weight, z_DelSigma, TempFixed, QVapFixed, xyz_TempFixed, xyz_QVapFixed, current_time_value, current_time_unit, history_varlist, history_interval_value, history_interval_unit, history_precision, history_fileprefix, nmlfile, err ) ! ! PHYADJFIX 型の変数の初期設定を行います. ! 他のサブルーチンを使用する前に必ずこのサブルーチンによって ! PHYADJFIX 型の変数を初期設定してください. ! ! なお, 与えられた *phy_adj_fix* が既に初期設定されている場合, ! プログラムはエラーを発生させます. ! ! NAMELIST を利用する場合には引数 *nmlfile* に NAMELIST ファイル名 ! を与えてください. NAMELIST 変数群の詳細に関しては ! NAMELIST#phy_adjust_fixed_nml を参照してください. ! ! Constructor of "PHYADJFIX". ! Initialize *phy_adj_fix* by this subroutine, ! before other procedures are used, ! ! Note that if *phy_adj_fix* is already initialized ! by this procedure, error is occurred. ! ! In order to use NAMELIST, specify a NAMELIST filename to ! argument *nmlfile*. See "NAMELIST#phy_adjust_fixed_nml" ! for details about a NAMELIST group. ! use dc_trace, only: BeginSub, EndSub use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar use dc_types, only: DP, STRING, TOKEN, STDOUT use dc_present, only: present_and_not_empty, present_and_true, present_select use dc_message, only: MessageNotify use dcpam_error, only: StoreError, DCPAM_EARGSDUPLICATE use dc_error, only: DC_NOERR, DC_EALREADYINIT, DC_EARGLACK, DC_ENEGATIVE, DC_ENOFILEREAD, USR_ERRNO, HST_EBADVARNAME use dc_date, only: DCDiffTimeCreate use dc_hash, only: HASH, DCHashPut, DCHashRewind, DCHashNext, DCHashDelete use gt4_history_nmlinfo, only: HstNmlInfoCreate, HstNmlInfoAdd, HstNmlInfoEndDefine, HstNmlInfoPutLine, HstNmlInfoAllNameValid use gt4_history, only: GT_HISTORY, HistoryAddVariable, HistoryAddAttr implicit none type(PHYADJFIX), intent(inout):: phy_adj_fix integer, intent(in):: imax ! 経度格子点数. ! Number of grid points in longitude integer, intent(in):: jmax ! 緯度格子点数. ! Number of grid points in latitude integer, intent(in):: kmax ! 鉛直層数. ! Number of vertical level real(DP), intent(in):: x_Lon (0:imax-1) ! 経度. Longitude real(DP), intent(in):: y_Lat (0:jmax-1) ! 緯度. Latitude real(DP), intent(in):: z_Sigma (0:kmax-1) ! $ \sigma $ レベル (整数). ! Full $ \sigma $ level real(DP), intent(in):: DelTime ! $ \Delta t $ . タイムステップ. Time step real(DP), intent(in), optional:: x_Lon_Weight (0:imax-1) ! 経度積分用座標重み. ! Weight for integration in longitude real(DP), intent(in), optional:: y_Lat_Weight (0:jmax-1) ! 緯度積分用座標重み. ! Weight for integration in latitude real(DP), intent(in), optional:: z_DelSigma (0:kmax-1) ! $ \Delta \sigma $ (整数). ! $ \Delta \sigma $ (Full) real(DP), intent(in), optional:: TempFixed ! $ T_0 $ . 温度の固定値 (空間変化無し). ! Fixed value of temperature (spatial variation is nothing) real(DP), intent(in), optional:: QVapFixed ! $ q_0 $ . 比湿の固定値 (空間変化無し). ! Fixed value of specific humidity (spatial variation is nothing) real(DP), intent(in), optional:: xyz_TempFixed (0:imax-1,0:jmax-1,0:kmax-1) ! $ T_0 $ . 温度の固定値. ! Fixed value of temperature real(DP), intent(in), optional:: xyz_QVapFixed (0:imax-1,0:jmax-1,0:kmax-1) ! $ q_0 $ . 比湿の固定値. ! Fixed value of specific humidity real, intent(in), optional:: current_time_value ! 現在時刻の数値. Numerical value of current time character(*), intent(in), optional:: current_time_unit ! 現在時刻の単位. Unit of current time character(*), intent(in), optional:: history_varlist ! ヒストリデータの出力変数リスト. ! カンマで区切って並べる. ! (例: "Data1,Data2" ). ! ! List of variables output to history data. ! Delimiter is comma. ! (exp. "Data1,Data2" ). ! real, intent(in), optional:: history_interval_value ! ヒストリデータの出力間隔の数値. ! Numerical value for interval of history data output character(*), intent(in), optional:: history_interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output character(*), intent(in), optional:: history_precision ! ヒストリデータの精度. ! Precision of history data character(*), intent(in), optional:: history_fileprefix ! ヒストリデータのファイル名の接頭詞. ! Prefix of history data filenames character(*), intent(in), optional:: nmlfile ! NAMELIST ファイルの名称. ! この引数に空文字以外を与えた場合, ! 指定されたファイルから ! NAMELIST 変数群を読み込みます. ! ファイルを読み込めない場合にはエラーを ! 生じます. ! ! NAMELIST 変数群の詳細に関しては ! NAMELIST#phy_adjust_fixed_nml ! を参照してください. ! ! NAMELIST file name. ! If nonnull character is specified to ! this argument, ! NAMELIST group name is loaded from the ! file. ! If the file can not be read, ! an error occurs. ! ! See "NAMELIST#phy_adjust_fixed_nml" ! for details about a NAMELIST group. ! logical, intent(out), optional:: err ! 例外処理用フラグ. ! デフォルトでは, この手続き内でエラーが ! 生じた場合, プログラムは強制終了します. ! 引数 *err* が与えられる場合, ! プログラムは強制終了せず, 代わりに ! *err* に .true. が代入されます. ! ! Exception handling flag. ! By default, when error occur in ! this procedure, the program aborts. ! If this *err* argument is given, ! .true. is substituted to *err* and ! the program does not abort. !----------------------------------- ! ヒストリファイルへのデータ出力設定 ! Configure the settings for history data output character(STRING):: name = '' ! 変数名. Variable identifier character(STRING):: longname = '' ! 変数の記述的名称. Descriptive name of variables character(STRING), allocatable:: dims(:) ! 座標軸の名称. Name of axes character(STRING):: units = '' ! 単位. Units type(GT_HISTORY), pointer:: gthist =>null() ! gt4_history モジュール用構造体. ! Derived type for "gt4_history" module character(TOKEN):: precision ! ヒストリデータの精度. ! Precision of history data logical:: average ! 出力データの平均化フラグ. ! Flag for average of output data type(HASH):: registered_varnames ! このモジュールから出力される変数名のリスト. ! ! List of names of variables output ! from this module. logical:: hash_end ! HASH オブジェクトの終了フラグ. ! ! End flag of "HASH" object logical:: allvar_invalid ! 無効な変数名のチェックフラグ. ! ! Check flag of invalid variable names character(STRING):: names_invalid ! 無効な変数名. ! ! Invalid variable names character(STRING):: nmlfile_msg ! NAMELIST ファイル名に関するメッセージ. ! ! Messages about NAMELIST file name !----------------------------------- ! 作業変数 ! Work variables real(DP), parameter:: PI = 3.1415926535897930_DP ! $ \pi $ . 円周率. Circular constant integer:: stat character(STRING):: cause_c character(*), parameter:: subname = 'PhyAdjFixCreate' continue call BeginSub( subname, version ) stat = DC_NOERR cause_c = '' !----------------------------------------------------------------- ! 初期設定のチェック ! Check initialization !----------------------------------------------------------------- if ( phy_adj_fix % initialized ) then stat = DC_EALREADYINIT cause_c = 'PHYADJFIX' goto 999 end if !----------------------------------------------------------------- ! 引数の正当性のチェック ! Validate arguments !----------------------------------------------------------------- if (imax < 1) then stat = DC_ENEGATIVE cause_c = 'imax' goto 999 end if if (jmax < 1) then stat = DC_ENEGATIVE cause_c = 'jmax' goto 999 end if if (kmax < 1) then stat = DC_ENEGATIVE cause_c = 'kmax' goto 999 end if if (DelTime < 0.0_DP) then stat = DC_ENEGATIVE cause_c = 'DelTime' goto 999 end if if ( present( TempFixed ) .and. present( xyz_TempFixed ) ) then stat = DCPAM_EARGSDUPLICATE cause_c = 'TempFixed,xyz_TempFixed' goto 999 end if if ( present( QVapFixed ) .and. present( xyz_QVapFixed ) ) then stat = DCPAM_EARGSDUPLICATE cause_c = 'QVapFixed,xyz_QVapFixed' goto 999 end if !----------------------------------------------------------------- ! 波数・格子点の設定 ! Configure wave number and grid point !----------------------------------------------------------------- phy_adj_fix % imax = imax phy_adj_fix % jmax = jmax phy_adj_fix % kmax = kmax !----------------------------------------------------------------- ! 座標軸の設定 ! Configure axes !----------------------------------------------------------------- allocate( phy_adj_fix % x_Lon (0:imax-1) ) phy_adj_fix % x_Lon = x_Lon allocate( phy_adj_fix % y_Lat (0:jmax-1) ) phy_adj_fix % y_Lat = y_Lat allocate( phy_adj_fix % z_Sigma (0:kmax-1) ) phy_adj_fix % z_Sigma = z_Sigma allocate( phy_adj_fix % x_Lon_Weight (0:imax-1) ) if ( present(x_Lon_Weight) ) then phy_adj_fix % x_Lon_Weight = x_Lon_Weight else phy_adj_fix % x_Lon_Weight = 2.0_DP * PI / imax end if allocate( phy_adj_fix % y_Lat_Weight (0:jmax-1) ) if ( present(y_Lat_Weight) ) then phy_adj_fix % y_Lat_Weight = y_Lat_Weight else phy_adj_fix % y_Lat_Weight = 2.0_DP / jmax end if allocate( phy_adj_fix % z_DelSigma (0:kmax-1) ) if ( present(z_DelSigma) ) then phy_adj_fix % z_DelSigma = z_DelSigma else phy_adj_fix % z_DelSigma = 1.0_DP / kmax end if !----------------------------------------------------------------- ! 固定値の設定 ! Fixed values are configured !----------------------------------------------------------------- if ( present(TempFixed) ) then allocate( phy_adj_fix % xyz_TempFixed (0:imax-1,0:jmax-1,0:kmax-1) ) phy_adj_fix % xyz_TempFixed = TempFixed elseif ( present(xyz_TempFixed) ) then allocate( phy_adj_fix % xyz_TempFixed (0:imax-1,0:jmax-1,0:kmax-1) ) phy_adj_fix % xyz_TempFixed = xyz_TempFixed end if if ( present(QVapFixed) ) then allocate( phy_adj_fix % xyz_QVapFixed (0:imax-1,0:jmax-1,0:kmax-1) ) phy_adj_fix % xyz_QVapFixed = QVapFixed elseif ( present(xyz_QVapFixed) ) then allocate( phy_adj_fix % xyz_QVapFixed (0:imax-1,0:jmax-1,0:kmax-1) ) phy_adj_fix % xyz_QVapFixed = xyz_QVapFixed end if !----------------------------------------------------------------- ! 時刻管理 ! Time control !----------------------------------------------------------------- if ( present(current_time_value) .and. present(current_time_unit) ) then call DCDiffTimeCreate( diff = phy_adj_fix % current_time, value = real( current_time_value, DP ), unit = current_time_unit ) ! (in) else call DCDiffTimeCreate( diff = phy_adj_fix % current_time, value = 0.0_DP, unit = 'sec' ) ! (in) end if call DCDiffTimeCreate( diff = phy_adj_fix % delta_time, value = DelTime, unit = 'sec' ) ! (in) !----------------------------------------------------------------- ! "PHYADJFIX" の設定 ! Configure the settings for "PHYADJFIX" !----------------------------------------------------------------- !!$ phy_adj_fix % CoefAlpha = CoefAlpha !!$ phy_adj_fix % key00 = '' !----------------------------------------------------------------- ! ヒストリファイルへのデータ出力設定 ! Configure the settings for history data output !----------------------------------------------------------------- !------------------------- ! デフォルト値 ! Default values call HstNmlInfoCreate( gthstnml = phy_adj_fix % gthstnml ) ! (inout) !------------------------- ! オプショナル引数からの値 ! Values from optional arguments call HstNmlInfoAdd( gthstnml = phy_adj_fix % gthstnml, name = '', interval_value = history_interval_value, interval_unit = history_interval_unit, precision = history_precision, average = .false., fileprefix = history_fileprefix ) ! (in) if ( present(history_varlist) ) then call HstNmlInfoAdd( gthstnml = phy_adj_fix % gthstnml, name = history_varlist ) ! (in) end if !----------------------------------------------------------------- ! NAMELIST からの値の読み込み ! Load values from NAMELIST !----------------------------------------------------------------- if ( present_and_not_empty(nmlfile) ) then call MessageNotify( 'M', subname, 'Loading NAMELIST file "%c" ...', c1 = trim(nmlfile) ) call NmlRead ( nmlfile = nmlfile, TempFixed = phy_adj_fix % TempFixed, QVapFixed = phy_adj_fix % QVapFixed, gthstnml = phy_adj_fix % gthstnml, err = err ) ! (out) if ( present_and_true(err) ) then call MessageNotify( 'W', subname, '"%c" can not be read.', c1 = trim(nmlfile) ) stat = DC_ENOFILEREAD cause_c = nmlfile goto 999 end if end if call HstNmlInfoEndDefine( gthstnml = phy_adj_fix % gthstnml, err = err ) ! (out) if ( present_and_true( err ) ) then stat = USR_ERRNO goto 999 end if if ( .not. ( phy_adj_fix % TempFixed < 0.0_DP ) ) then if ( .not. associated( phy_adj_fix % xyz_TempFixed ) ) then allocate( phy_adj_fix % xyz_TempFixed (0:imax-1,0:jmax-1,0:kmax-1) ) end if phy_adj_fix % xyz_TempFixed = phy_adj_fix % TempFixed end if if ( .not. ( phy_adj_fix % QVapFixed < 0.0_DP ) ) then if ( .not. associated( phy_adj_fix % xyz_QVapFixed ) ) then allocate( phy_adj_fix % xyz_QVapFixed (0:imax-1,0:jmax-1,0:kmax-1) ) end if phy_adj_fix % xyz_QVapFixed = phy_adj_fix % QVapFixed end if !----------------------------------------------------------------- ! データ出力の初期設定 ! Initialize data output !----------------------------------------------------------------- if ( associated( phy_adj_fix % xyz_TempFixed ) ) then !------------------------- ! xyz_DTempDtFixed の出力設定 ! Configure the settings for "xyz_DTempDtFixed" output name = 'DTempDtFixed' longname = 'temperature tendency by adjustment to fixed value' units = 'K s-1' allocate( dims(4) ) dims = StoA( 'lon', 'lat', 'sig', 'time' ) ! 出力ファイルの初期設定. ! * gthist (gt4_history#GT_HISTORY) が設定される. ! Initialize output file. ! * "gthist" (gt4_history#GT_HISTORY) is configured. call output_init ! これは内部サブルーチン. This is an internal subroutine deallocate( dims ) end if if ( associated( phy_adj_fix % xyz_QVapFixed ) ) then !------------------------- ! xyz_DQVapDtFixed の出力設定 ! Configure the settings for "xyz_DQVapDtFixed" output name = 'DQVapDtFixed' longname = 'specific humidity tendency by adjustment to fixed value' units = 'kg kg-1 s-1' allocate( dims(4) ) dims = StoA( 'lon', 'lat', 'sig', 'time' ) ! 出力ファイルの初期設定. ! * gthist (gt4_history#GT_HISTORY) が設定される. ! Initialize output file. ! * "gthist" (gt4_history#GT_HISTORY) is configured. call output_init ! これは内部サブルーチン. This is an internal subroutine deallocate( dims ) end if !!$ !------------------------- !!$ ! y_Data2 の出力設定 !!$ ! Configure the settings for "y_Data2" output !!$ name = 'Data2' !!$ longname = 'Sample data (2)' !!$ units = '1' !!$ allocate( dims(2) ) !!$ dims = StoA( 'lat', 'time' ) !!$ !!$ ! 出力ファイルの初期設定. !!$ ! * gthist (gt4_history#GT_HISTORY) が設定される. !!$ ! Initialize output file. !!$ ! * "gthist" (gt4_history#GT_HISTORY) is configured. !!$ call output_init ! これは内部サブルーチン. This is an internal subroutine !!$ ! 属性の付加などを行う場合には以下のようにする. !!$ ! Describe codes as follows in order to add attributes etc. !!$ if ( associated( gthist ) ) then !!$ call HistoryAddAttr( & !!$ & history = gthist, & ! (inout) !!$ & varname = name, attrname = 'missing_value', & ! (in) !!$ & value = 9999.0 ) ! (in) !!$ end if !!$ !!$ deallocate( dims ) !----------------------------------------------------------------- ! このモジュールから出力される変数名のリストを表示 ! Print list of names of variables output from this module !----------------------------------------------------------------- call Printf( STDOUT, ' *** MESSAGE *** +---- "%c" module output varnames list -----', c1 = 'phy_adjust_fixed' ) call DCHashRewind( hashv = registered_varnames ) ! (inout) do call DCHashNext( hashv = registered_varnames, key = name, value = longname, end = hash_end ) ! (out) if ( hash_end ) exit call Printf( STDOUT, ' *** MESSAGE *** | "%c" (%c)', c1 = trim(name), c2 = trim(longname) ) enddo call DCHashDelete( hashv = registered_varnames ) ! (inout) call Printf( STDOUT, ' *** MESSAGE *** `----------------------------------------' ) !----------------------------------------------------------------- ! 無効な変数名のチェック ! Check invalid variable names !----------------------------------------------------------------- call HstNmlInfoAllNameValid( gthstnml = phy_adj_fix % gthstnml, invalid = allvar_invalid, names = names_invalid, err = err ) ! (out) if ( allvar_invalid ) then stat = HST_EBADVARNAME cause_c = names_invalid phy_adj_fix % initialized = .true. call PhyAdjFixClose( phy_adj_fix, err = err ) ! (out) if ( present(nmlfile) ) then nmlfile_msg = ' or NAMELIST "phy_adjust_fixed_history_nml" in "'// trim(nmlfile) // '"' else nmlfile_msg = '' end if call MessageNotify( 'W', subname, 'names "%c" from an optional argument "history_varlist"%c are invalid.', c1 = trim(names_invalid), c2 = trim(nmlfile_msg) ) goto 999 end if !----------------------------------------------------------------- ! 設定値の正当性のチェック ! Validate setting values !----------------------------------------------------------------- !!$ if ( phy_adj_fix % CoefAlpha < 0.0_DP ) then !!$ stat = DC_ENEGATIVE !!$ cause_c = 'CoefAlpha' !!$ goto 999 !!$ end if !----------------------------------------------------------------- ! 終了処理, 例外処理 ! Termination and Exception handling !----------------------------------------------------------------- phy_adj_fix % initialized = .true. 999 continue call StoreError( stat, subname, err, cause_c ) call EndSub( subname ) contains subroutine output_init ! ! 変数 *name* に関して出力ファイルの初期設定を行います. ! 出力ファイル名や出力間隔などの情報は phy_adj_fix % gthstnml ! から取り出されます. ! ! 変数 *name* に関して出力が行われる場合には, ! *gthist* に出力先ファイルの gt4_history#GT_HISTORY ! 型変数を結合させます. そうでない場合は, *gthist* を空状態にします. ! ! また, 出力データの精度を precision に, ! 出力データ平均化の可否を average に設定します. ! ! 標準出力に表示される変数リスト *registered_varnames* に ! *name*, *longname*, *dims*, *units* が登録されます. ! ! An output file is initialized for a variable *name*. ! Information such as the output filename and output intervals ! is taken out of "phy_adj_fix % gthstnml". ! ! When output is done for the variable *name*, *gthist* is ! associated with the "gt4_history#GT_HISTORY" variable of ! the output file. Otherwise, *gthist* is nullified. ! ! Moreover, the accuracy of output data is set to *precision*, and ! right or wrong of averaging the output data is set to *average*. ! ! *name*, *longname*, *dims*, *units* are registered to ! a list of variables *registered_varnames* that is printed to ! standard output. ! use dc_date, only: DCDiffTimeCreate, EvalSec, EvalByUnit use gt4_history_nmlinfo, only: GTHST_NMLINFO, HstNmlInfoInitialized, HstNmlInfoInquire, HstNmlInfoOutputValid, HstNmlInfoAssocGtHist, HstNmlInfoPutLine, HstNmlInfoSetValidName use gt4_history, only: GT_HISTORY, HistoryCreate, HistoryAddVariable, HistoryPut, HistoryAddAttr, HistoryInitialized !----------------------------------- ! 作業変数 ! Work variables character(STRING):: file ! ヒストリデータのファイル名. ! History data filenames character(STRING):: dims_str ! 座標軸のリスト. ! List of axes real:: interval_value ! ヒストリデータの出力間隔の数値. ! Numerical value for interval of history data output character(TOKEN):: interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output real(DP), parameter:: PI = 3.1415926535897930_DP ! $ \pi $ . 円周率. Circular constant continue !----------------------------------------------------------------- ! 標準出力に表示される変数の登録 ! Register a variable name for print to standard output !----------------------------------------------------------------- if ( allocated(dims) ) then dims_str = JoinChar( dims, ',' ) else dims_str = '' end if call DCHashPut( hashv = registered_varnames, key = name, value = trim( longname ) // ' [' // trim( units ) // '] {' // trim( dims_str ) // '}' ) ! (in) !----------------------------------------------------------------- ! 変数の初期化 ! Initialize variable !----------------------------------------------------------------- nullify( gthist ) precision = 'float' average = .false. !----------------------------------------------------------------- ! 変数名の有効性を設定 ! Set validation of the variable name !----------------------------------------------------------------- call HstNmlInfoSetValidName( gthstnml = phy_adj_fix % gthstnml, name = name ) ! (in) !----------------------------------------------------------------- ! 出力が有効かどうかを確認する ! Confirm whether the output is effective !----------------------------------------------------------------- if ( .not. HstNmlInfoOutputValid( phy_adj_fix % gthstnml, name ) ) then return end if !----------------------------------------------------------------- ! GT_HISTORY 変数の取得 ! Get "GT_HISTORY" variable !----------------------------------------------------------------- call HstNmlInfoAssocGtHist( gthstnml = phy_adj_fix % gthstnml, name = name, history = gthist, err = err ) ! (out) if ( present_and_true( err ) ) return call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, precision = precision, average = average, err = err ) ! (out) if ( present_and_true( err ) ) return !----------------------------------------------------------------- ! GT_HISTORY 変数の初期設定の確認 ! Check initialization of "GT_HISTORY" variable !----------------------------------------------------------------- if ( HistoryInitialized( gthist ) ) then !--------------------------------------------------------------- ! HistoryAddVariable による変数作成 ! A variable is created by "HistoryAddVariable" !--------------------------------------------------------------- call HistoryAddVariable( history = gthist, varname = name, dims = dims, longname = longname, units = units, xtype = precision, average = average ) ! (in) return end if !----------------------------------------------------------------- ! HistoryCreate のための設定値の取得 ! Get the settings for "HistoryCreate" !----------------------------------------------------------------- call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, file = file, interval_unit = interval_unit, interval_value = interval_value, err = err ) ! (out) if ( present_and_true( err ) ) return !----------------------------------------------------------------- ! HistoryCreate によるファイル作成 ! Files are created by "HistoryCreate" !----------------------------------------------------------------- call HistoryCreate( history = gthist, file = file, title = 'Adjustment of some physical values to a certain fixed values', source = 'dcpam4 project : ' // trim(version), institution = 'GFD Dennou Club', dims = StoA( 'lon', 'lat', 'sig', 'time' ), dimsizes = (/ phy_adj_fix % imax, phy_adj_fix % jmax, phy_adj_fix % kmax, 0 /), longnames = StoA('longitude', 'latitude', 'sigma at layer midpoints', 'time'), units = StoA( 'degree_east', 'degree_north', '1', interval_unit ), origin = real( EvalbyUnit( phy_adj_fix % current_time, interval_unit) ), interval = interval_value, err = err ) ! (out) if ( present_and_true( err ) ) then nullify( gthist ) return end if call HistoryAddAttr( history = gthist, varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'sig', attrname = 'standard_name', value = 'atmosphere_sigma_coordinate' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'time', attrname = 'standard_name', value = 'time' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'sig', attrname = 'positive', value = 'down' ) ! (in) call HistoryPut( history = gthist, varname = 'lon', array = phy_adj_fix % x_Lon / PI * 180.0_DP ) ! (in) call HistoryPut( history = gthist, varname = 'lat', array = phy_adj_fix % y_Lat / PI * 180.0_DP ) ! (in) call HistoryPut( history = gthist, varname = 'sig', array = phy_adj_fix % z_Sigma ) ! (in) call HistoryAddVariable( history = gthist, varname = 'lon_weight', dims = StoA('lon'), longname = 'weight for integration in longitude', units = 'radian', xtype = 'double' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'lon', attrname = 'gt_calc_weight', value = 'lon_weight' ) ! (in) call HistoryPut( history = gthist, varname = 'lon_weight', array = phy_adj_fix % x_Lon_Weight ) ! (in) call HistoryAddVariable( history = gthist, varname = 'lat_weight', dims = StoA('lat'), longname = 'weight for integration in latitude', units = 'radian', xtype = 'double' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'lat', attrname = 'gt_calc_weight', value = 'lat_weight' ) ! (in) call HistoryPut( history = gthist, varname = 'lat_weight', array = phy_adj_fix % y_Lat_Weight ) ! (in) call HistoryAddVariable( history = gthist, varname = 'sig_weight', dims = StoA('sig'), longname = 'weight for integration in sigma', units = '1', xtype = 'float' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'sig', attrname = 'gt_calc_weight', value = 'sig_weight' ) ! (in) call HistoryPut( history = gthist, varname = 'sig_weight', array = phy_adj_fix % z_DelSigma ) ! (in) !----------------------------------------------------------------- ! HistoryAddVariable による変数作成 ! A variable is created by "HistoryAddVariable" !----------------------------------------------------------------- if ( HistoryInitialized( gthist ) ) then call HistoryAddVariable( history = gthist, varname = name, dims = dims, longname = longname, units = units, xtype = precision, average = average ) ! (in) else nullify( gthist ) end if end subroutine output_init end subroutine PhyAdjFixCreate
Function : | |
result : | logical |
phy_adj_fix : | type(PHYADJFIX), intent(in) |
phy_adj_fix が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If phy_adj_fix is initialized, .true. is returned. If phy_adj_fix is not initialized, .false. is returned.
logical function PhyAdjFixInitialized( phy_adj_fix ) result(result) ! ! *phy_adj_fix* が初期設定されている場合には .true. が, ! 初期設定されていない場合には .false. が返ります. ! ! If *phy_adj_fix* is initialized, .true. is returned. ! If *phy_adj_fix* is not initialized, .false. is returned. ! implicit none type(PHYADJFIX), intent(in):: phy_adj_fix continue result = phy_adj_fix % initialized end function PhyAdjFixInitialized
Subroutine : | |||
phy_adj_fix : | type(PHYADJFIX), intent(in) | ||
unit : | integer, intent(in), optional
| ||
indent : | character(*), intent(in), optional
| ||
err : | logical, intent(out), optional
|
引数 phy_adj_fix に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.
Print information of phy_adj_fix. By default messages are output to standard output. Unit number for output can be changed by unit argument.
subroutine PhyAdjFixPutLine( phy_adj_fix, unit, indent, err ) ! ! 引数 *phy_adj_fix* に設定されている情報を印字します. ! デフォルトではメッセージは標準出力に出力されます. ! *unit* に装置番号を指定することで, 出力先を変更することが可能です. ! ! Print information of *phy_adj_fix*. ! By default messages are output to standard output. ! Unit number for output can be changed by *unit* argument. ! use dc_trace, only: BeginSub, EndSub use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar use dc_types, only: DP, STRING, TOKEN, STDOUT use dc_date, only: EvalSec use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT use gt4_history_nmlinfo, only: GTHST_NMLINFO, HstNmlInfoPutLine implicit none type(PHYADJFIX), intent(in):: phy_adj_fix integer, intent(in), optional:: unit ! 出力先の装置番号. ! デフォルトの出力先は標準出力. ! ! Unit number for output. ! Default value is standard output. character(*), intent(in), optional:: indent ! 表示されるメッセージの字下げ. ! ! Indent of displayed messages. logical, intent(out), optional:: err ! 例外処理用フラグ. ! デフォルトでは, この手続き内でエラーが ! 生じた場合, プログラムは強制終了します. ! 引数 *err* が与えられる場合, ! プログラムは強制終了せず, 代わりに ! *err* に .true. が代入されます. ! ! Exception handling flag. ! By default, when error occur in ! this procedure, the program aborts. ! If this *err* argument is given, ! .true. is substituted to *err* and ! the program does not abort. !----------------------------------- ! 作業変数 ! Work variables integer:: stat character(STRING):: cause_c integer:: out_unit integer:: indent_len character(STRING):: indent_str character(*), parameter:: subname = 'PhyAdjFixPutLine' continue call BeginSub( subname ) stat = DC_NOERR cause_c = '' !----------------------------------------------------------------- ! 出力先装置番号と字下げの設定 ! Configure output unit number and indents !----------------------------------------------------------------- if ( present(unit) ) then out_unit = unit else out_unit = STDOUT end if indent_len = 0 indent_str = '' if ( present(indent) ) then if ( len(indent) /= 0 ) then indent_len = len(indent) indent_str(1:indent_len) = indent end if end if !----------------------------------------------------------------- ! "PHYADJFIX" の設定の印字 ! Print the settings for "PHYADJFIX" !----------------------------------------------------------------- if ( phy_adj_fix % initialized ) then call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // '#<PHYADJFIX:: @initialized=%y', l = (/ phy_adj_fix % initialized /) ) ! (in) call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // ' @imax=%d @jmax=%d @kmax=%d', i = (/ phy_adj_fix % imax, phy_adj_fix % jmax, phy_adj_fix % kmax /) ) ! (in) call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // ' @current_time=%f [sec] @delta_time=%f [sec]', d = (/ EvalSec( phy_adj_fix % current_time ), EvalSec( phy_adj_fix % delta_time ) /) ) ! (in) call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // ' @TempFixed=%f', d = (/phy_adj_fix % TempFixed/) ) ! (in) call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // ' @QVapFixed=%f', d = (/phy_adj_fix % QVapFixed/) ) ! (in) if ( associated( phy_adj_fix % xyz_TempFixed ) ) then call PutLine( array = phy_adj_fix % xyz_TempFixed, unit = out_unit, lbounds = lbound(phy_adj_fix % xyz_TempFixed), ubounds = ubound(phy_adj_fix % xyz_TempFixed), indent = indent_str(1:indent_len) // ' @xyz_TempFixed=' ) ! (in) end if if ( associated( phy_adj_fix % xyz_QVapFixed ) ) then call PutLine( array = phy_adj_fix % xyz_QVapFixed, unit = out_unit, lbounds = lbound(phy_adj_fix % xyz_QVapFixed), ubounds = ubound(phy_adj_fix % xyz_QVapFixed), indent = indent_str(1:indent_len) // ' @xyz_QVapFixed=' ) ! (in) end if call PutLine( array = phy_adj_fix % x_Lon, unit = out_unit, lbounds = lbound(phy_adj_fix % x_Lon), ubounds = ubound(phy_adj_fix % x_Lon), indent = indent_str(1:indent_len) // ' @x_Lon=' ) ! (in) call PutLine( array = phy_adj_fix % y_Lat, unit = out_unit, lbounds = lbound(phy_adj_fix % y_Lat), ubounds = ubound(phy_adj_fix % y_Lat), indent = indent_str(1:indent_len) // ' @y_Lat=' ) ! (in) call PutLine( array = phy_adj_fix % z_Sigma, unit = out_unit, lbounds = lbound(phy_adj_fix % z_Sigma), ubounds = ubound(phy_adj_fix % z_Sigma), indent = indent_str(1:indent_len) // ' @z_Sigma=' ) ! (in) call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // ' @gthstnml=' ) ! (in) call HstNmlInfoPutLine( gthstnml = phy_adj_fix % gthstnml, unit = out_unit, indent = indent_str(1:indent_len) // ' ' ) ! (in) call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // '>' ) ! (in) else call Printf( unit = out_unit, fmt = indent_str(1:indent_len) // '#<PHYADJFIX:: @initialized=%y>', l = (/phy_adj_fix % initialized/) ) ! (in) end if !----------------------------------------------------------------- ! 終了処理, 例外処理 ! Termination and Exception handling !----------------------------------------------------------------- 999 continue call StoreError( stat, subname, err, cause_c ) call EndSub( subname ) end subroutine PhyAdjFixPutLine
Subroutine : | |||
phy_adj_fix : | type(PHYADJFIX), intent(inout) | ||
current_time_value : | real, intent(in)
| ||
current_time_unit : | character(*), intent(in)
| ||
err : | logical, intent(out), optional
|
phy_adj_fix に対して時刻の設定を行います.
ヒストリデータを出力している場合には, ヒストリデータの出力時刻も設定します. 一度でもこのサブルーチンを呼んだ場合には, それ以後のヒストリデータ出力前にこのサブルーチンを呼び出し, 時刻の設定を行ってください. また, データを出力するサブルーチンに対しても オプショナル引数 historyput_flag に .true. を与えてください.
なお, 与えられた phy_adj_fix が PhyAdjFixCreate によって初期設定されていない場合, プログラムはエラーを発生させます.
Set time to phy_adj_fix.
When history data are output, the output time of history data are specified. Once this subroutine is called, the time of history data must be specified by this routine before history data output. In additional, give ".true." to an optional argument "historyput_flag" of a data output subroutine.
If phy_adj_fix is not initialized by "PhyAdjFixCreate" yet, error is occurred.
subroutine PhyAdjFixSetTime( phy_adj_fix, current_time_value, current_time_unit, err ) ! ! *phy_adj_fix* に対して時刻の設定を行います. ! ! ヒストリデータを出力している場合には, ! ヒストリデータの出力時刻も設定します. ! 一度でもこのサブルーチンを呼んだ場合には, ! それ以後のヒストリデータ出力前にこのサブルーチンを呼び出し, ! 時刻の設定を行ってください. ! また, データを出力するサブルーチンに対しても ! オプショナル引数 historyput_flag に .true. を与えてください. ! ! なお, 与えられた *phy_adj_fix* が PhyAdjFixCreate ! によって初期設定されていない場合, プログラムはエラーを発生させます. ! ! Set time to *phy_adj_fix*. ! ! When history data are output, ! the output time of history data are specified. ! Once this subroutine is called, the time of history data must be ! specified by this routine before history data output. ! In additional, give ".true." to an optional argument ! "historyput_flag" of a data output subroutine. ! ! If *phy_adj_fix* is not initialized ! by "PhyAdjFixCreate" yet, error is occurred. ! use dc_trace, only: BeginSub, EndSub use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar use dc_types, only: DP, STRING, TOKEN, STDOUT use dc_date, only: DCDiffTimeCreate, EvalbyUnit use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT use gt4_history_nmlinfo, only: HstNmlInfoAdd, HstNmlInfoInquire, HstNmlInfoNames, HstNmlInfoAssocGtHist, HstNmlInfoOutputStepDisable, HstNmlInfoPutLine use gt4_history, only: GT_HISTORY, HistorySetTime, HistoryInitialized implicit none type(PHYADJFIX), intent(inout):: phy_adj_fix real, intent(in):: current_time_value ! 現在時刻の数値. Numerical value of current time character(*), intent(in):: current_time_unit ! 現在時刻の単位. Unit of current time logical, intent(out), optional:: err ! 例外処理用フラグ. ! デフォルトでは, この手続き内でエラーが ! 生じた場合, プログラムは強制終了します. ! 引数 *err* が与えられる場合, ! プログラムは強制終了せず, 代わりに ! *err* に .true. が代入されます. ! ! Exception handling flag. ! By default, when error occur in ! this procedure, the program aborts. ! If this *err* argument is given, ! .true. is substituted to *err* and ! the program does not abort. !----------------------------------- ! ヒストリファイルへのデータ出力設定 ! Configure the settings for history data output character(STRING):: name = '' ! 変数名. Variable identifier character(TOKEN):: interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output character(STRING):: varnames ! 変数名リスト. ! List of variables character(TOKEN), pointer:: varnames_array(:) =>null() ! 変数名リスト配列. ! List of variables (array) integer:: i, vnmax type(GT_HISTORY), pointer:: gthist =>null() ! gt4_history モジュール用構造体. ! Derived type for "gt4_history" module !----------------------------------- ! 作業変数 ! Work variables integer:: stat character(STRING):: cause_c character(*), parameter:: subname = 'PhyAdjFixSetTime' continue call BeginSub( subname ) stat = DC_NOERR cause_c = '' !----------------------------------------------------------------- ! 初期設定のチェック ! Check initialization !----------------------------------------------------------------- if ( .not. phy_adj_fix % initialized ) then stat = DC_ENOTINIT cause_c = 'PHYADJFIX' goto 999 end if !----------------------------------------------------------------- ! 時刻設定 ! Configure time !----------------------------------------------------------------- call DCDiffTimeCreate( diff = phy_adj_fix % current_time, value = real( current_time_value, DP ), unit = current_time_unit ) ! (in) !----------------------------------------------------------------- ! ヒストリファイルへのデータの時刻設定 ! Configure the time of history data !----------------------------------------------------------------- varnames = HstNmlInfoNames( phy_adj_fix % gthstnml ) call Split( str = varnames, sep = ',', carray = varnames_array ) ! (out) vnmax = size( varnames_array ) do i = 1, vnmax name = varnames_array(i) if ( trim( name ) == '' ) exit call HstNmlInfoOutputStepDisable( gthstnml = phy_adj_fix % gthstnml, name = name, err = err ) ! (out) nullify( gthist ) call HstNmlInfoAssocGtHist( gthstnml = phy_adj_fix % gthstnml, name = name, history = gthist, err = err ) ! (out) if ( HistoryInitialized( gthist ) ) then call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, interval_unit = interval_unit ) ! (out) call HistorySetTime( history = gthist, time = real( EvalbyUnit( phy_adj_fix % current_time, interval_unit) ) ) ! (in) end if end do !----------------------------------------------------------------- ! 終了処理, 例外処理 ! Termination and Exception handling !----------------------------------------------------------------- 999 continue call StoreError( stat, subname, err, cause_c ) call EndSub( subname ) end subroutine PhyAdjFixSetTime
Function : | |
result : | logical |
phy_adj_fix : | type(PHYADJFIX), intent(in) |
phy_adj_fix が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If phy_adj_fix is initialized, .true. is returned. If phy_adj_fix is not initialized, .false. is returned.
Alias for PhyAdjFixInitialized
Subroutine : | |||
nmlfile : | character(*), intent(in)
| ||
TempFixed : | real(DP), intent(inout)
| ||
QVapFixed : | real(DP), intent(inout)
| ||
gthstnml : | type(GTHST_NMLINFO), intent(inout)
| ||
err : | logical, intent(out), optional
|
NAMELIST ファイル nmlfile から値を入力するための サブルーチンです. PhyAdjFixCreate 内で呼び出されることを想定しています.
値が NAMELIST ファイル内で指定されていない場合には, 入力された値がそのまま返ります.
なお, nmlfile に空文字が与えられた場合, または 与えられた nmlfile を読み込むことができない場合, プログラムはエラーを発生させます.
This is a subroutine to input values from NAMELIST file nmlfile. This subroutine is expected to be called by "PhyAdjFixCreate".
A value not specified in NAMELIST file is returned without change.
If nmlfile is empty, or nmlfile can not be read, error is occurred.
This procedure input/output NAMELIST#phy_adjust_fixed_nml, NAMELIST#phy_adjust_fixed_history_nml .
Alias for PhyAdjFixNmlRead
Subroutine : | |||
nmlfile : | character(*), intent(in)
| ||
TempFixed : | real(DP), intent(inout)
| ||
QVapFixed : | real(DP), intent(inout)
| ||
gthstnml : | type(GTHST_NMLINFO), intent(inout)
| ||
err : | logical, intent(out), optional
|
NAMELIST ファイル nmlfile から値を入力するための サブルーチンです. PhyAdjFixCreate 内で呼び出されることを想定しています.
値が NAMELIST ファイル内で指定されていない場合には, 入力された値がそのまま返ります.
なお, nmlfile に空文字が与えられた場合, または 与えられた nmlfile を読み込むことができない場合, プログラムはエラーを発生させます.
This is a subroutine to input values from NAMELIST file nmlfile. This subroutine is expected to be called by "PhyAdjFixCreate".
A value not specified in NAMELIST file is returned without change.
If nmlfile is empty, or nmlfile can not be read, error is occurred.
This procedure input/output NAMELIST#phy_adjust_fixed_nml, NAMELIST#phy_adjust_fixed_history_nml .
subroutine PhyAdjFixNmlRead( nmlfile, TempFixed, QVapFixed, gthstnml, err ) ! ! NAMELIST ファイル *nmlfile* から値を入力するための ! サブルーチンです. PhyAdjFixCreate ! 内で呼び出されることを想定しています. ! ! 値が NAMELIST ファイル内で指定されていない場合には, ! 入力された値がそのまま返ります. ! ! なお, *nmlfile* に空文字が与えられた場合, または ! 与えられた *nmlfile* を読み込むことができない場合, ! プログラムはエラーを発生させます. ! ! This is a subroutine to input values from ! NAMELIST file *nmlfile*. This subroutine is expected to be ! called by "PhyAdjFixCreate". ! ! A value not specified in NAMELIST file is returned ! without change. ! ! If *nmlfile* is empty, or *nmlfile* can not be read, ! error is occurred. ! use dc_trace, only: BeginSub, EndSub use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar use dc_types, only: DP, STRING, TOKEN, STDOUT use dc_iounit, only: FileOpen use dc_message, only: MessageNotify use dc_present, only: present_and_true use dc_date, only: DCDiffTimeCreate use dc_error, only: StoreError, DC_NOERR, DC_ENOFILEREAD, DC_ENOTINIT use gt4_history_nmlinfo, only: GTHST_NMLINFO, HstNmlInfoAdd, HstNmlInfoInquire, HstNmlInfoInitialized, HstNmlInfoPutLine implicit none character(*), intent(in):: nmlfile ! NAMELIST ファイルの名称. ! NAMELIST file name real(DP), intent(inout):: TempFixed ! $ T_0 $ . 温度の固定値 (空間変化無し). ! Fixed value of temperature (spatial variation is nothing) real(DP), intent(inout):: QVapFixed ! $ q_0 $ . 比湿の固定値 (空間変化無し). ! Fixed value of specific humidity (spatial variation is nothing) type(GTHST_NMLINFO), intent(inout):: gthstnml ! NAMELIST#phy_adjust_fixed_history_nml ! から入手される個別のデータ出力情報. ! ! 初期設定やデフォルト値の設定などを ! 行った後に与えること. ! ! Individual data output information from ! "NAMELIST#phy_adjust_fixed_history_nml". ! ! Before this argument is given to ! this procedure, initialize and ! configure the defaut settings. logical, intent(out), optional:: err ! 例外処理用フラグ. ! デフォルトでは, この手続き内でエラーが ! 生じた場合, プログラムは強制終了します. ! 引数 *err* が与えられる場合, ! プログラムは強制終了せず, 代わりに ! *err* に .true. が代入されます. ! ! Exception handling flag. ! By default, when error occur in ! this procedure, the program aborts. ! If this *err* argument is given, ! .true. is substituted to *err* and ! the program does not abort. namelist /phy_adjust_fixed_nml/ TempFixed, QVapFixed ! phy_adjust_fixed モジュール用 ! NAMELIST 変数群名. ! ! phy_adjust_fixed#PhyAdjFixCreate ! を使用する際に, オプショナル引数 *nmlfile* ! へ NAMELIST ファイル名を指定することで, ! そのファイルからこの NAMELIST 変数群を ! 読み込みます. ! ! NAMELIST group name for ! "phy_adjust_fixed" module. ! ! If a NAMELIST filename is specified to ! an optional argument *nmlfile* when ! "phy_adjust_fixed#PhyAdjFixCreate" ! is used, this NAMELIST group is ! loaded from the file. character(STRING):: name ! 変数名. ! 空白の場合には, この他の設定値は ! phy_adjust_fixed モジュールにおいて ! 出力されるデータ全ての ! デフォルト値となります. ! ! "Data1,Data2" のようにカンマで区切って複数 ! の変数を指定することも可能です. ! ! Variable identifier. ! If blank is given, other values are ! used as default values of output data ! in "phy_adjust_fixed". ! ! Multiple variables can be specified ! as "Data1,Data2" too. Delimiter is comma. character(STRING):: file ! 出力ファイル名. ! これはデフォルト値としては使用されません. ! *name* に値が設定されている時のみ有効です. ! ! Output file name. ! This is not used as default value. ! This value is valid only when *name* is ! specified. real:: interval_value ! ヒストリデータの出力間隔の数値. ! 負の値を与えると, 出力を抑止します. ! Numerical value for interval of history data output ! Negative values suppresses output. character(TOKEN):: interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output character(TOKEN):: precision ! ヒストリデータの精度. ! Precision of history data logical:: average ! 出力データの平均化フラグ. ! Flag for average of output data character(STRING):: fileprefix ! ヒストリデータのファイル名の接頭詞. ! Prefixes of history data filenames namelist /phy_adjust_fixed_history_nml/ name, file, interval_value, interval_unit, precision, fileprefix, average ! phy_adjust_fixed モジュールのヒストリデータ用 ! NAMELIST 変数群名. ! ! phy_adjust_fixed#PhyAdjFixCreate ! を使用する際に, オプショナル引数 *nmlfile* ! へ NAMELIST ファイル名を指定することで, ! そのファイルからこの NAMELIST 変数群を ! 読み込みます. ! ! NAMELIST group name for ! history data of "phy_adjust_fixed" module. ! ! If a NAMELIST filename is specified to ! an optional argument *nmlfile* when ! "phy_adjust_fixed#PhyAdjFixCreate" ! is used, this NAMELIST group is ! loaded from the file. !----------------------------------- ! 作業変数 ! Work variables integer:: stat character(STRING):: cause_c integer:: unit_nml ! NAMELIST ファイルオープン用装置番号. ! Unit number for NAMELIST file open integer:: iostat_nml ! NAMELIST 読み込み時の IOSTAT. ! IOSTAT of NAMELIST read character(TOKEN):: pos_nml ! NAMELIST 読み込み時のファイル位置. ! File position of NAMELIST read character(*), parameter:: subname = 'PhyAdjFixNmlRead' continue call BeginSub( subname ) stat = DC_NOERR cause_c = '' !----------------------------------------------------------------- ! 初期設定のチェック ! Check initialization !----------------------------------------------------------------- !----------------------------------------------------------------- ! 文字型引数を NAMELIST 変数群へ代入 ! Substitute character arguments to NAMELIST group !----------------------------------------------------------------- !!$ key00 = key00_ !---------------------------------------------------------------- ! NAMELIST ファイルのオープン ! Open NAMELIST file !---------------------------------------------------------------- call FileOpen( unit = unit_nml, file = nmlfile, mode = 'r', err = err ) ! (out) if ( present_and_true(err) ) then stat = DC_ENOFILEREAD cause_c = nmlfile goto 999 end if !----------------------------------------------------------------- ! NAMELIST 変数群の取得 ! Get NAMELIST group !----------------------------------------------------------------- !------------------------- ! 係数などの取得 ! Get coefficients etc. rewind( unit_nml ) read( unit = unit_nml, nml = phy_adjust_fixed_nml, iostat = iostat_nml ) ! (out) if ( iostat_nml == 0 ) then call MessageNotify( 'M', subname, 'NAMELIST group "%c" is loaded from "%c".', c1 = 'phy_adjust_fixed_nml', c2 = trim(nmlfile) ) write(STDOUT, nml = phy_adjust_fixed_nml) else call MessageNotify( 'W', subname, 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', c1 = 'phy_adjust_fixed_nml', c2 = trim(nmlfile), i = (/iostat_nml/) ) end if !------------------------- ! 出力データの個別情報の取得 ! Get individual information of output data rewind( unit_nml ) iostat_nml = 0 pos_nml = '' do while ( trim(pos_nml) /= 'APPEND' .and. iostat_nml == 0 ) name = '' file = '' call HstNmlInfoInquire( gthstnml = gthstnml, interval_value = interval_value, interval_unit = interval_unit, precision = precision, average = average, fileprefix = fileprefix ) ! (out) read( unit = unit_nml, nml = phy_adjust_fixed_history_nml, iostat = iostat_nml ) ! (out) inquire( unit = unit_nml, position = pos_nml ) ! (out) if ( iostat_nml == 0 ) then call MessageNotify( 'M', subname, 'NAMELIST group "%c" is loaded from "%c".', c1='phy_adjust_fixed_history_nml', c2=trim(nmlfile) ) write(STDOUT, nml = phy_adjust_fixed_history_nml) call HstNmlInfoAdd( gthstnml = gthstnml, name = name, file = file, interval_value = interval_value, interval_unit = interval_unit, precision = precision, average = average, fileprefix = fileprefix ) ! (in) else call MessageNotify( 'W', subname, 'NAMELIST group "%c" is not found in "%c" any more (iostat=%d).', c1='phy_adjust_fixed_history_nml', c2=trim(nmlfile), i = (/iostat_nml/) ) end if end do close( unit_nml ) !----------------------------------------------------------------- ! NAMELIST 変数群を文字型引数へ代入 ! Substitute NAMELIST group to character arguments !----------------------------------------------------------------- !!$ key00_ = key00 !----------------------------------------------------------------- ! 終了処理, 例外処理 ! Termination and Exception handling !----------------------------------------------------------------- 999 continue call StoreError( stat, subname, err, cause_c ) call EndSub( subname ) end subroutine PhyAdjFixNmlRead
Subroutine : |
変数 name を出力するかどうかをチェックします. 出力に関する情報は dcm_sam_cod % gthstnml から取り出されます.
変数 name に関して出力するよう設定されている場合には, gthist に出力先ファイルの gt4_history#GT_HISTORY 型変数を結合させます. そうでない場合は, gthist を空状態にします.
また, 現在時刻を time に設定します.
Check whether to output variable name. Information about output is taken out of "dcm_sam_cod % gthstnml".
When output is done for the variable name, gthist is associated with "gt4_history#GT_HISTORY" variable of the output file. Otherwise, gthist is nullified.
Moreover, current time is set to time.
subroutine output_check ! ! 変数 *name* を出力するかどうかをチェックします. ! 出力に関する情報は dcm_sam_cod % gthstnml から取り出されます. ! ! 変数 *name* に関して出力するよう設定されている場合には, ! *gthist* に出力先ファイルの gt4_history#GT_HISTORY ! 型変数を結合させます. そうでない場合は, *gthist* を空状態にします. ! ! また, 現在時刻を *time* に設定します. ! ! Check whether to output variable *name*. ! Information about output is taken out of "dcm_sam_cod % gthstnml". ! ! When output is done for the variable *name*, *gthist* is ! associated with "gt4_history#GT_HISTORY" variable of ! the output file. Otherwise, *gthist* is nullified. ! ! Moreover, current time is set to *time*. ! character(TOKEN):: interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output continue nullify( gthist ) time = 0.0 if ( HstNmlInfoOutputValid( phy_adj_fix % gthstnml, name ) ) then call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, interval_unit = interval_unit ) ! (out) time = real( EvalbyUnit( phy_adj_fix % current_time, interval_unit ) ) if ( present_and_true( historyput_flag ) ) time = 0.0 call HstNmlInfoAssocGtHist( gthstnml = phy_adj_fix % gthstnml, name = name, history = gthist, err = err ) ! (out) if ( present_and_true( err ) ) then nullify( gthist ) return end if if ( .not. HistoryInitialized( gthist ) ) nullify( gthist ) end if end subroutine output_check
Subroutine : |
変数 name に関して出力ファイルの初期設定を行います. 出力ファイル名や出力間隔などの情報は phy_adj_fix % gthstnml から取り出されます.
変数 name に関して出力が行われる場合には, gthist に出力先ファイルの gt4_history#GT_HISTORY 型変数を結合させます. そうでない場合は, gthist を空状態にします.
また, 出力データの精度を precision に, 出力データ平均化の可否を average に設定します.
標準出力に表示される変数リスト registered_varnames に name, longname, dims, units が登録されます.
An output file is initialized for a variable name. Information such as the output filename and output intervals is taken out of "phy_adj_fix % gthstnml".
When output is done for the variable name, gthist is associated with the "gt4_history#GT_HISTORY" variable of the output file. Otherwise, gthist is nullified.
Moreover, the accuracy of output data is set to precision, and right or wrong of averaging the output data is set to average.
name, longname, dims, units are registered to a list of variables registered_varnames that is printed to standard output.
subroutine output_init ! ! 変数 *name* に関して出力ファイルの初期設定を行います. ! 出力ファイル名や出力間隔などの情報は phy_adj_fix % gthstnml ! から取り出されます. ! ! 変数 *name* に関して出力が行われる場合には, ! *gthist* に出力先ファイルの gt4_history#GT_HISTORY ! 型変数を結合させます. そうでない場合は, *gthist* を空状態にします. ! ! また, 出力データの精度を precision に, ! 出力データ平均化の可否を average に設定します. ! ! 標準出力に表示される変数リスト *registered_varnames* に ! *name*, *longname*, *dims*, *units* が登録されます. ! ! An output file is initialized for a variable *name*. ! Information such as the output filename and output intervals ! is taken out of "phy_adj_fix % gthstnml". ! ! When output is done for the variable *name*, *gthist* is ! associated with the "gt4_history#GT_HISTORY" variable of ! the output file. Otherwise, *gthist* is nullified. ! ! Moreover, the accuracy of output data is set to *precision*, and ! right or wrong of averaging the output data is set to *average*. ! ! *name*, *longname*, *dims*, *units* are registered to ! a list of variables *registered_varnames* that is printed to ! standard output. ! use dc_date, only: DCDiffTimeCreate, EvalSec, EvalByUnit use gt4_history_nmlinfo, only: GTHST_NMLINFO, HstNmlInfoInitialized, HstNmlInfoInquire, HstNmlInfoOutputValid, HstNmlInfoAssocGtHist, HstNmlInfoPutLine, HstNmlInfoSetValidName use gt4_history, only: GT_HISTORY, HistoryCreate, HistoryAddVariable, HistoryPut, HistoryAddAttr, HistoryInitialized !----------------------------------- ! 作業変数 ! Work variables character(STRING):: file ! ヒストリデータのファイル名. ! History data filenames character(STRING):: dims_str ! 座標軸のリスト. ! List of axes real:: interval_value ! ヒストリデータの出力間隔の数値. ! Numerical value for interval of history data output character(TOKEN):: interval_unit ! ヒストリデータの出力間隔の単位. ! Unit for interval of history data output real(DP), parameter:: PI = 3.1415926535897930_DP ! $ \pi $ . 円周率. Circular constant continue !----------------------------------------------------------------- ! 標準出力に表示される変数の登録 ! Register a variable name for print to standard output !----------------------------------------------------------------- if ( allocated(dims) ) then dims_str = JoinChar( dims, ',' ) else dims_str = '' end if call DCHashPut( hashv = registered_varnames, key = name, value = trim( longname ) // ' [' // trim( units ) // '] {' // trim( dims_str ) // '}' ) ! (in) !----------------------------------------------------------------- ! 変数の初期化 ! Initialize variable !----------------------------------------------------------------- nullify( gthist ) precision = 'float' average = .false. !----------------------------------------------------------------- ! 変数名の有効性を設定 ! Set validation of the variable name !----------------------------------------------------------------- call HstNmlInfoSetValidName( gthstnml = phy_adj_fix % gthstnml, name = name ) ! (in) !----------------------------------------------------------------- ! 出力が有効かどうかを確認する ! Confirm whether the output is effective !----------------------------------------------------------------- if ( .not. HstNmlInfoOutputValid( phy_adj_fix % gthstnml, name ) ) then return end if !----------------------------------------------------------------- ! GT_HISTORY 変数の取得 ! Get "GT_HISTORY" variable !----------------------------------------------------------------- call HstNmlInfoAssocGtHist( gthstnml = phy_adj_fix % gthstnml, name = name, history = gthist, err = err ) ! (out) if ( present_and_true( err ) ) return call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, precision = precision, average = average, err = err ) ! (out) if ( present_and_true( err ) ) return !----------------------------------------------------------------- ! GT_HISTORY 変数の初期設定の確認 ! Check initialization of "GT_HISTORY" variable !----------------------------------------------------------------- if ( HistoryInitialized( gthist ) ) then !--------------------------------------------------------------- ! HistoryAddVariable による変数作成 ! A variable is created by "HistoryAddVariable" !--------------------------------------------------------------- call HistoryAddVariable( history = gthist, varname = name, dims = dims, longname = longname, units = units, xtype = precision, average = average ) ! (in) return end if !----------------------------------------------------------------- ! HistoryCreate のための設定値の取得 ! Get the settings for "HistoryCreate" !----------------------------------------------------------------- call HstNmlInfoInquire( gthstnml = phy_adj_fix % gthstnml, name = name, file = file, interval_unit = interval_unit, interval_value = interval_value, err = err ) ! (out) if ( present_and_true( err ) ) return !----------------------------------------------------------------- ! HistoryCreate によるファイル作成 ! Files are created by "HistoryCreate" !----------------------------------------------------------------- call HistoryCreate( history = gthist, file = file, title = 'Adjustment of some physical values to a certain fixed values', source = 'dcpam4 project : ' // trim(version), institution = 'GFD Dennou Club', dims = StoA( 'lon', 'lat', 'sig', 'time' ), dimsizes = (/ phy_adj_fix % imax, phy_adj_fix % jmax, phy_adj_fix % kmax, 0 /), longnames = StoA('longitude', 'latitude', 'sigma at layer midpoints', 'time'), units = StoA( 'degree_east', 'degree_north', '1', interval_unit ), origin = real( EvalbyUnit( phy_adj_fix % current_time, interval_unit) ), interval = interval_value, err = err ) ! (out) if ( present_and_true( err ) ) then nullify( gthist ) return end if call HistoryAddAttr( history = gthist, varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'sig', attrname = 'standard_name', value = 'atmosphere_sigma_coordinate' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'time', attrname = 'standard_name', value = 'time' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'sig', attrname = 'positive', value = 'down' ) ! (in) call HistoryPut( history = gthist, varname = 'lon', array = phy_adj_fix % x_Lon / PI * 180.0_DP ) ! (in) call HistoryPut( history = gthist, varname = 'lat', array = phy_adj_fix % y_Lat / PI * 180.0_DP ) ! (in) call HistoryPut( history = gthist, varname = 'sig', array = phy_adj_fix % z_Sigma ) ! (in) call HistoryAddVariable( history = gthist, varname = 'lon_weight', dims = StoA('lon'), longname = 'weight for integration in longitude', units = 'radian', xtype = 'double' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'lon', attrname = 'gt_calc_weight', value = 'lon_weight' ) ! (in) call HistoryPut( history = gthist, varname = 'lon_weight', array = phy_adj_fix % x_Lon_Weight ) ! (in) call HistoryAddVariable( history = gthist, varname = 'lat_weight', dims = StoA('lat'), longname = 'weight for integration in latitude', units = 'radian', xtype = 'double' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'lat', attrname = 'gt_calc_weight', value = 'lat_weight' ) ! (in) call HistoryPut( history = gthist, varname = 'lat_weight', array = phy_adj_fix % y_Lat_Weight ) ! (in) call HistoryAddVariable( history = gthist, varname = 'sig_weight', dims = StoA('sig'), longname = 'weight for integration in sigma', units = '1', xtype = 'float' ) ! (in) call HistoryAddAttr( history = gthist, varname = 'sig', attrname = 'gt_calc_weight', value = 'sig_weight' ) ! (in) call HistoryPut( history = gthist, varname = 'sig_weight', array = phy_adj_fix % z_DelSigma ) ! (in) !----------------------------------------------------------------- ! HistoryAddVariable による変数作成 ! A variable is created by "HistoryAddVariable" !----------------------------------------------------------------- if ( HistoryInitialized( gthist ) ) then call HistoryAddVariable( history = gthist, varname = name, dims = dims, longname = longname, units = units, xtype = precision, average = average ) ! (in) else nullify( gthist ) end if end subroutine output_init
Constant : | |
version = ’$Name: dcpam4-20080609-1 $’ // ’$Id: phy_adjust_fixed.f90,v 1.2 2008-06-01 16:06:53 morikawa Exp $’ : | character(*), parameter |