| Class | dyn_spectral_as83 |
| In: |
dynamics/dyn_spectral_as83.f90
|
Note that Japanese and English are described in parallel.
力学過程を演算するモジュールです. 水平離散化にスペクトル法を, 鉛直離散化には Arakawa and Suarez (1983) を用いています.
時間積分法にはリープフロッグスキームを用いています. デフォルトでは, $ \Delta t $ を大きくとるために, 重力波項に セミインプリシット法を適用しています. 重力波項をエクスプリシット法によって解くことも可能です. 詳しくは Create および NAMELIST#dyn_as83_nml を参照してください.
This is a dynamical core module. Spectral method (for horizontal) and Arakawa and Suarez (1983) method (for vertical) are used.
Leap-frog scheme is used as time integration. By default, semi-implicit scheme is applied to gravitational terms for extension of $ \Delta t $ . Explicit scheme can be applied to gravitational terms. For details, see "Create" or "NAMELIST#dyn_as83_nml".
| Create : | DYNSPAS83 型変数の初期化 |
| EqualAxes : | DYNSPAS83 型変数に格納されている座標値の確認 |
| GetAxes : | 座標値の取得 |
| Dynamics : | 力学過程の演算 |
| Close : | DYNSPAS83 型変数の終了処理 |
| PutLine : | DYNSPAS83 型変数に格納されている情報の印字 |
| initialized : | DYNSPAS83 型変数が初期設定されているか否か |
| SetTime : | 時刻の設定 |
| ———— : | ———— |
| Create : | Constructor of "DYNSPAS83" |
| EqualAxes : | Confirm data of axes in "DYNSPAS83" |
| GetAxes : | Get data of axes |
| Dynamics : | Calculation of dynamical core |
| Close : | Deconstructor of "DYNSPAS83" |
| PutLine : | Print information of "DYNSPAS83" |
| initialized : | Check initialization of "DYNSPAS83" |
| SetTime : | Configure time |
主プログラムの始めに, DYNSPAS83 型の変数を Create で初期化します. 次に, 時間積分ループ内で渦度, 発散, 温度, 比湿, 地表面気圧 ( $ t $ および $ t-\Delta t $ ) を Dynamics に与えてください. それらの値を用いて力学過程の演算が行われ, $ t+\Delta t $ の東西風速, 南北風速, 渦度, 発散, 温度, 比湿, 地表面気圧が得られます. 最後に, DYNSPAS83 型の変数の終了処理を Close にて行います. 主プログラムで座標値が必要となる場合には, GetAxes を用いて 座標値を取得してください.
In the begging of program, initialize "DYNSPAS83" by "Create". Next, in the time integration loop, provide vorticity, divergence, temperature, specific humidity, surface pressure on $ t $ and $ t-\Delta t $ to Dynamics. Then the physical values at $ t+\Delta t $ is returned. Finally, terminate "DYNSPAS83" by "Close". If you need data of axes, get that by GetAxes.
| Derived_Types | [] | DYNSPAS83, DYNSPAS83_HISTNML |
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| err : | logical, intent(out), optional
|
DYNSPAS83 型の変数の終了処理を行います. なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Deconstructor of "DYNSPAS83". Note that if dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83Close
| Subroutine : | |||||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||||
| nmax : | integer, intent(in)
| ||||
| imax : | integer, intent(in)
| ||||
| jmax : | integer, intent(in)
| ||||
| kmax : | integer, intent(in)
| ||||
| PI : | real(DP), intent(in)
| ||||
| RPlanet : | real(DP), intent(in)
| ||||
| Omega : | real(DP), intent(in)
| ||||
| Cp : | real(DP), intent(in)
| ||||
| RAir : | real(DP), intent(in)
| ||||
| EpsVT : | real(DP), intent(in)
| ||||
| VisOrder : | integer, intent(in)
| ||||
| EFoldTime : | real(DP), intent(in)
| ||||
| DelTime : | real(DP), intent(in)
| ||||
| xy_Phis(0:imax-1, 0:jmax-1) : | real(DP), intent(in), optional
| ||||
| openmp_threads : | integer, intent(in), optional
| ||||
| r_SigmaSet(:) : | real(DP), intent(in), optional
| ||||
| wa_module_initialized : | logical, intent(in), optional
| ||||
| time_integration_scheme : | character(*), intent(in), optional
| ||||
| current_time_value : | real(DP), intent(in), optional
| ||||
| current_time_unit : | character(*), intent(in), optional
| ||||
| history_varlist : | character(*), intent(in), optional
| ||||
| history_interval_value : | real(DP), 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
|
引数 dyn_sp_as に力学過程の設定を行う. 他のサブルーチンを使用する前に必ずこのサブルーチンによって DYNSPAS83 型の変数を初期設定してください.
NAMELIST を利用する場合には引数 nmlfile に NAMELIST ファイル名 を与えてください. NAMELIST 変数群の詳細に関しては NAMELIST#dyn_spectral_as83_nml を参照してください.
Configure the settings for dynamical core to dyn_sp_as. Before other subroutines are used, initialize "DYNSPAS83" variable.
In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile. See "NAMELIST#dyn_spectral_as83_nml" for details about a NAMELIST group.
Alias for DynSpectralAS83Create
| Derived Type : | |||
| initialized = .false. : | logical
| ||
| nmax : | integer
| ||
| imax : | integer
| ||
| jmax : | integer
| ||
| kmax : | integer
| ||
| dyn_sp : | type(DYNSP) | ||
| dyn_as : | type(DYNAS83) | ||
| current_time : | type(DC_DIFFTIME)
| ||
| delta_time : | type(DC_DIFFTIME)
| ||
| history_varlist_array(:) =>null() : | character(TOKEN), pointer
| ||
| history_fileprefix : | character(STRING)
| ||
| hist_nml(:) =>null() : | type(DYNSPAS83_HISTNML),
pointer
| ||
| gthist_sigmadot : | type(GT_HISTORY) | ||
| gthist_dpidt : | type(GT_HISTORY) |
まず, Create で "DYNSPAS83" 型の変数を初期設定して下さい. 初期化された "DYNSPAS83" 型の変数を再度利用する際には, Close によって終了処理を行ってください.
Initialize "DYNSPAS83" variable by "Create" before usage. If you reuse "DYNSPAS83" variable again for another application, terminate by "Close".
| Derived Type : | |||
| name : | character(TOKEN)
| ||
| file : | character(STRING)
| ||
| history_interval_time : | type(DC_DIFFTIME)
| ||
| history_interval_value : | real(DP)
| ||
| history_interval_unit : | character(TOKEN)
| ||
| history_precision : | character(TOKEN)
| ||
| history_average : | logical
| ||
| dummy0 : | logical
|
NAMELIST#dyn_spectral_as83_history_nml からデータの出力情報 を個別に取得するための構造データ型です. 外部からの参照は 行わないでください.
This derived type is worked for input information about data output individually from "NAMELIST#dyn_spectral_as83_history_nml" Do not refer this derived type externally.
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| xyz_VorB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_DivB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_TempB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_QVapB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xy_PsB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1) : | real(DP), intent(in)
| ||
| xyz_VorN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_DivN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_TempN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_QVapN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xy_PsN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1) : | real(DP), intent(in)
| ||
| xyz_VorA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_DivA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_TempA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_QVapA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xy_PsA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1) : | real(DP), intent(out)
| ||
| historyput_flag : | logical, intent(in), optional
| ||
| err : | logical, intent(out), optional
|
力学過程の演算を行い, 与えられた $ t-\Delta t $ および $ t $ の 渦度, 発散, 温度, 比湿, 地表面気圧から, $ t+\Delta t $ の 渦度, 発散, 温度, 比湿, 地表面気圧 を返します.
時間積分法にはリープフロッグスキームを用いています. デフォルトでは, $ \Delta t $ を大きくとるために, 重力波項に セミインプリシット法を適用しています. ただし, Create の time_integration_scheme に "Explicit" を指定した場合には重力波項もエクスプリシット法によって 解きます.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Calculating dynamical core, from vorticity, divergence, temperature, specific humidity, surface pressure at $ t-\Delta t $ and $ t $, the physical values at $ t+\Delta t $ are returned.
Leap-frog scheme is used as time integration. By default, semi-implicit scheme is applied to gravitational terms for extension of $ \Delta t $ . If "Explicit" is specified to time_integration_scheme in "Create", explicit scheme is applied to gravitational terms as well as other terms.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83Dynamics
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| x_Lon(0:dyn_sp_as%imax-1) : | real(DP), intent(in), optional
| ||
| y_Lat(0:dyn_sp_as%jmax-1) : | real(DP), intent(in), optional
| ||
| z_Sigma(0:dyn_sp_as%kmax-1) : | real(DP), intent(in), optional
| ||
| r_Sigma(0:dyn_sp_as%kmax) : | real(DP), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
与えられた座標軸データ と dyn_sp_as 内に 保持される座標データが等しいことを確認します. 異なる場合にはエラーを発生させます.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Confirm equality between given axes data and axes data stored in dyn_sp_as. If the equality is not confirmed, error is occurred.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83EqualAxes
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| x_Lon(0:dyn_sp_as%imax-1) : | real(DP), intent(out)
| ||
| y_Lat(0:dyn_sp_as%jmax-1) : | real(DP), intent(out)
| ||
| z_Sigma(0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| r_Sigma(0:dyn_sp_as%kmax) : | real(DP), intent(out)
| ||
| z_DelSigma(0:dyn_sp_as%kmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
dyn_sp_as に格納されている座標値を返します.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return data of axes stored in dyn_sp_as.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83GetAxes
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 dyn_sp_as に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.
Print information of dyn_sp_as. By default messages are output to standard output. Unit number for output can be changed by unit argument.
Alias for DynSpectralAS83PutLine
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| xyz_Vor(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_Div(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_U(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_V(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| err : | logical, intent(out), optional
|
与えられた東西風速と南北風速から渦度と発散を計算します.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Calculate vorticity and divergence from given zonal and meridional wind.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83UV2VorDiv
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| xyz_Vor(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Div(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_U(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_V(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| err : | logical, intent(out), optional
|
与えられた渦度と発散から東西風速と南北風速を計算します.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Calculate zonal and meridional wind from given vorticity and divergence.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83VorDiv2UV
| Function : | |
| result : | logical |
| dyn_sp_as : | type(DYNSPAS83), intent(in) |
dyn_sp_as が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If dyn_sp_as is initialized, .true. is returned. If dyn_sp_as is not initialized, .false. is returned.
Alias for DynSpectralAS83Initialized
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| err : | logical, intent(out), optional
|
DYNSPAS83 型の変数の終了処理を行います. なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Deconstructor of "DYNSPAS83". Note that if dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83Close( dyn_sp_as, err )
!
! DYNSPAS83 型の変数の終了処理を行います.
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Deconstructor of "DYNSPAS83".
! Note that if *dyn_sp_as* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT
use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_spectral, only: Close
use dyn_as83, only: Close
use gt4_history, only: HistoryClose
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
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(TOKEN):: name
! 変数名. Variable name
type(DYNSPAS83_HISTNML), pointer:: hptr =>null()
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml"
!-----------------------------------
! 作業変数
! Work variables
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83Close'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_sp_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! スペクトル法と Arakawa and Suarez (1983) の設定の消去
! Clear the settings for spectral method and Arakawa and Suarez (1983)
!-----------------------------------------------------------------
call Close(dyn_sp = dyn_sp_as % dyn_sp, err = err) ! (out)
call Close(dyn_as = dyn_sp_as % dyn_as, err = err) ! (out)
!-----------------------------------------------------------------
! ヒストリファイルへのデータ出力の終了処理
! Terminate the settings for history data output
!-----------------------------------------------------------------
!-------------------------
! xyr_SigmaDot の出力の終了処理
! Terminate the settings for "xyr_SigmaDot" output
name = 'SigmaDot'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) .and. hptr % history_interval_value > 0.0_DP ) then
call HistoryClose( history = dyn_sp_as % gthist_sigmadot ) ! (inout)
end if
!-------------------------
! xy_DPiDt の出力の終了処理
! Terminate the settings for "xy_DPiDt" output
name = 'DPiDt'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) .and. hptr % history_interval_value > 0.0_DP ) then
call HistoryClose( history = dyn_sp_as % gthist_dpidt ) ! (inout)
end if
nullify( hptr )
deallocate( dyn_sp_as % hist_nml )
deallocate( dyn_sp_as % history_varlist_array )
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
dyn_sp_as % initialized = .false.
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83Close
| Subroutine : | |||||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||||
| nmax : | integer, intent(in)
| ||||
| imax : | integer, intent(in)
| ||||
| jmax : | integer, intent(in)
| ||||
| kmax : | integer, intent(in)
| ||||
| PI : | real(DP), intent(in)
| ||||
| RPlanet : | real(DP), intent(in)
| ||||
| Omega : | real(DP), intent(in)
| ||||
| Cp : | real(DP), intent(in)
| ||||
| RAir : | real(DP), intent(in)
| ||||
| EpsVT : | real(DP), intent(in)
| ||||
| VisOrder : | integer, intent(in)
| ||||
| EFoldTime : | real(DP), intent(in)
| ||||
| DelTime : | real(DP), intent(in)
| ||||
| xy_Phis(0:imax-1, 0:jmax-1) : | real(DP), intent(in), optional
| ||||
| openmp_threads : | integer, intent(in), optional
| ||||
| r_SigmaSet(:) : | real(DP), intent(in), optional
| ||||
| wa_module_initialized : | logical, intent(in), optional
| ||||
| time_integration_scheme : | character(*), intent(in), optional
| ||||
| current_time_value : | real(DP), intent(in), optional
| ||||
| current_time_unit : | character(*), intent(in), optional
| ||||
| history_varlist : | character(*), intent(in), optional
| ||||
| history_interval_value : | real(DP), 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
|
引数 dyn_sp_as に力学過程の設定を行う. 他のサブルーチンを使用する前に必ずこのサブルーチンによって DYNSPAS83 型の変数を初期設定してください.
NAMELIST を利用する場合には引数 nmlfile に NAMELIST ファイル名 を与えてください. NAMELIST 変数群の詳細に関しては NAMELIST#dyn_spectral_as83_nml を参照してください.
Configure the settings for dynamical core to dyn_sp_as. Before other subroutines are used, initialize "DYNSPAS83" variable.
In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile. See "NAMELIST#dyn_spectral_as83_nml" for details about a NAMELIST group.
subroutine DynSpectralAS83Create( dyn_sp_as, nmax, imax, jmax, kmax, PI, RPlanet, Omega, Cp, RAir, EpsVT, VisOrder, EFoldTime, DelTime, xy_Phis, openmp_threads, r_SigmaSet, wa_module_initialized, time_integration_scheme, current_time_value, current_time_unit, history_varlist, history_interval_value, history_interval_unit, history_precision, history_fileprefix, nmlfile, err)
!
! 引数 *dyn_sp_as* に力学過程の設定を行う.
! 他のサブルーチンを使用する前に必ずこのサブルーチンによって
! DYNSPAS83 型の変数を初期設定してください.
!
! NAMELIST を利用する場合には引数 *nmlfile* に NAMELIST ファイル名
! を与えてください. NAMELIST 変数群の詳細に関しては
! NAMELIST#dyn_spectral_as83_nml を参照してください.
!
! Configure the settings for dynamical core to *dyn_sp_as*.
! Before other subroutines are used, initialize "DYNSPAS83"
! variable.
!
! In order to use NAMELIST, specify a NAMELIST filename to
! argument *nmlfile*. See "NAMELIST#dyn_spectral_as83_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: STRING, DP, STDOUT
use dc_present, only: present_and_not_empty, present_and_true
use dc_message, only: MessageNotify
use dc_date, only: Create, EvalSec, EvalByUnit
use dc_error, only: StoreError, DC_NOERR, DC_EALREADYINIT, DC_EARGLACK, DC_ENEGATIVE, DC_ENOFILEREAD
use dyn_spectral, only: Create, GetCoriolis, GetSpectralCoeff, GetDiffCoeff, GetPhis, GetAxes
use dyn_as83, only: Create, GetAxes
use gt4_history, only: GT_HISTORY, HistoryCreate, HistoryAddVariable, HistoryPut, HistoryAddAttr
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
integer, intent(in):: nmax ! 最大全波数.
! Maximum truncated wavenumber
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):: PI ! $ \pi $ . 円周率. Circular constant
real(DP), intent(in):: RPlanet ! $ a $ . 惑星半径. Radius of planet
real(DP), intent(in):: Omega ! $ \Omega $ . 回転角速度. Angular velocity
!!$ real(DP), intent(in):: Grav ! $ g $ . 重力加速度. Gravitational acceleration
real(DP), intent(in):: Cp ! $ C_p $ . 大気定圧比熱. Specific heat of air at constant pressure
real(DP), intent(in):: RAir ! $ R $ . 大気気体定数. Gas constant of air
real(DP), intent(in):: EpsVT ! $ 1/\epsilon_v - 1 $ .
integer, intent(in):: VisOrder ! 超粘性の次数. Order of hyper-viscosity
real(DP), intent(in):: EFoldTime ! 最大波数に対する e-folding time. E-folding time for maximum wavenumber
real(DP), intent(in):: DelTime ! $ \Delta t $ . タイムステップ. Time step
real(DP), intent(in), optional:: xy_Phis (0:imax-1, 0:jmax-1)
! $ \Phi_s $ . 地表ジオポテンシャル.
! Surface geo-potential
integer, intent(in), optional:: openmp_threads
! OPENMP での最大スレッド数.
! openmp_threads に 1 より大きな値を指定すれば
! ISPACK[http://www.gfd-dennou.org/library/ispack/]
! の球面調和函数変換 OPENMP 並列計算
! ルーチンが用いられる. 並列計算を実行するには,
! 実行時に環境変数 OMP_NUM_THREADS
! を openmp_threads 以下の数字に設定する
! 等のシステムに応じた準備が必要となる.
!
! openmp_threads に 1 より大きな値を
! 指定しなければ並列計算ルーチンは呼ばれない.
!
! Maximum number of threads in OPENMP.
! If integer more than 1 is given,
! spherical harmonics transration subroutines
! with OPENMP parallel computation in
! ISPACK[http://www.gfd-dennou.org/library/ispack/]
! is used. In practice, specify environment
! variable (OMP_NUM_THREADS etc.) for parallel
! computation.
!
! If number less than 2 is given,
! subroutines of parallel computation
! is not called.
real(DP), intent(in), optional:: r_SigmaSet (:)
! デフォルトでは, kmax の値に応じ,
! 自動的に $ \sigma $ レベル (半整数)
! は設定される (kmax がある特定の値のみ).
! $ \sigma $ レベル (半整数).
! を明示的に設定する必要がある場合,
! この引数を与える.
!
! By default, half $ \sigma $ level is
! specified automatically according to
! the value of kmax (only the value is
! same as particular values).
! If the half $ \sigma $ level is specified
! manually, give this argument.
logical, intent(in), optional :: wa_module_initialized
! wa_module (SPMODEL ライブラリ) 初期化フラグ.
! SPMODEL ライブラリの wa_module が
!
! 既にプログラム上で
! wa_Initial によって初期化されている場合,
! 再度 wa_Initial を呼ぶとエラーが生じます.
! この引数に .true. を与えることで,
! wa_Initial を呼ばないようにします.
!
! "wa_module" (SPMODEL library)
! initialization flag.
!
! When "wa_module" (SPMODEL library)
! is initialized by
! "wa_Initial" already, second "wa_Initial"
! causes an error.
! If .true. is specified to this argument,
! "wa_Initial" is not called.
!
character(*), intent(in), optional:: time_integration_scheme
! 時間積分法.
! 以下の方法を選択可能.
!
! Time integration scheme.
! Available schemes are as follows.
!
! * "Semi-implicit"
! * "Explicit"
!
real(DP), 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(DP), 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#dyn_spectral_as83_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#dyn_spectral_as83_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(TOKEN):: name
! 変数名. Variable name
type(DYNSPAS83_HISTNML), pointer:: hptr =>null()
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml"
character(STRING):: history_filename
! ヒストリデータのファイル名.
! History data filenames
character(STRING):: history_varlist_work
real(DP):: x_Lon (0:imax-1)
! 経度. Longitude
real(DP):: y_Lat (0:jmax-1)
! 緯度. Latitude
real(DP):: x_Lon_Weight(0:imax-1)
! 経度座標重み.
! Weight of longitude
real(DP):: y_Lat_Weight(0:jmax-1)
! 緯度座標重み.
! Weight of latitude
real(DP):: z_Sigma (0:kmax-1)
! $ \sigma $ レベル (整数).
! Full $ \sigma $ level
real(DP):: r_Sigma (0:kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
!-----------------------------------
! 作業変数
! Work variables
real(DP):: xy_Cori (0:imax-1, 0:jmax-1)
! $ f\equiv 2\Omega\sin\varphi $ .
! コリオリパラメータ. Coriolis parameter
integer:: nmo (1:2, 0:nmax, 0:nmax)
! スペクトルの添字順番.
! Spectral subscript expression
real(DP):: wz_rn ((nmax+1)**2, 0:kmax-1)
! $ -n \times (n+1) $ . ラプラシアンの係数.
! Laplacian coefficient
real(DP):: wz_DiffVorDiv ((nmax+1)**2, 0:kmax-1)
! $ -K_{HD} [(-1)^{N_D/2}\nabla^{N_D}- (2/a^2)^{N_D/2}] $ .
! 運動量水平拡散係数.
! Coefficient of horizontal momentum diffusion
real(DP):: wz_DiffTherm ((nmax+1)**2, 0:kmax-1)
! $ -(-1)^{N_D/2}K_{HD}\nabla^{N_D} $ .
! 熱, 水水平拡散係数.
! Coefficient of horizontal thermal and water diffusion
real(DP):: w_Phis ((nmax+1)**2)
! $ \Phi_s $ . 地表ジオポテンシャル.
! Surface geo-potential
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83Create'
continue
call BeginSub(subname, version)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (dyn_sp_as % initialized) then
stat = DC_EALREADYINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 引数の正当性のチェック
! Validation of arguments
!-----------------------------------------------------------------
if (nmax < 1) then
stat = DC_ENEGATIVE
cause_c = 'nmax'
goto 999
end if
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
!-----------------------------------------------------------------
! 波数・格子点の設定
! Configure wave number and grid point
!-----------------------------------------------------------------
dyn_sp_as % nmax = nmax
dyn_sp_as % imax = imax
dyn_sp_as % jmax = jmax
dyn_sp_as % kmax = kmax
!-----------------------------------------------------------------
! 時刻管理
! Time control
!-----------------------------------------------------------------
if ( present(current_time_value) .and. present(current_time_unit) ) then
call Create( diff = dyn_sp_as % current_time, value = current_time_value, unit = current_time_unit ) ! (in)
else
call Create( diff = dyn_sp_as % current_time, value = 0.0_DP, unit = 'sec' ) ! (in)
end if
call Create( diff = dyn_sp_as % delta_time, value = DelTime, unit = 'sec' ) ! (in)
!-----------------------------------------------------------------
! スペクトル法の設定
! Configure the settings for spectral method
!-----------------------------------------------------------------
call Create( dyn_sp = dyn_sp_as % dyn_sp, nmax = nmax, imax = imax, jmax = jmax, kmax = kmax, PI = PI, RPlanet = RPlanet, Omega = Omega, Cp = Cp, VisOrder = VisOrder, EFoldTime = EFoldTime, DelTime = DelTime, xy_Phis = xy_Phis, openmp_threads = openmp_threads, wa_module_initialized = wa_module_initialized, nmlfile = nmlfile ) ! (in)
!-----------------------------------------------------------------
! Arakawa and Suarez (1983) の設定
! Configure the settings for Arakawa and Suarez (1983)
!-----------------------------------------------------------------
!---------------------------------------------
! コリオリパラメータの取得
! Get Coriolis parameter
call GetCoriolis( dyn_sp = dyn_sp_as % dyn_sp, xy_Cori = xy_Cori ) ! (out)
!---------------------------------------------
! スペクトル係数の取得
! Get spectral coefficient
call GetSpectralCoeff( dyn_sp = dyn_sp_as % dyn_sp, nmo = nmo, wz_rn = wz_rn ) ! (out)
!---------------------------------------------
! 拡散係数の取得
! Get diffusion coefficient
call GetDiffCoeff( dyn_sp = dyn_sp_as % dyn_sp, wz_DiffVorDiv = wz_DiffVorDiv, wz_DiffTherm = wz_DiffTherm ) ! (out)
!---------------------------------------------
! 地形データ (地表 $ \Phi $ )の取得
! Get geography data (surface $ \Phi $ )
call GetPhis( dyn_sp = dyn_sp_as % dyn_sp, w_Phis = w_Phis ) ! (out)
call Create( dyn_as = dyn_sp_as % dyn_as, nmax = nmax, imax = imax, jmax = jmax, kmax = kmax, PI = PI, RPlanet = RPlanet, Cp = Cp, RAir = RAir, EpsVT = EpsVT, DelTime = DelTime, xy_Cori = xy_Cori, nmo = nmo, wz_rn = wz_rn, wz_DiffVorDiv = wz_DiffVorDiv, wz_DiffTherm = wz_DiffTherm, r_SigmaSet = r_SigmaSet, w_Phis = w_Phis, time_integration_scheme = time_integration_scheme, nmlfile = nmlfile ) ! (in)
!-----------------------------------------------------------------
! 緯度経度座標値の取得
! Get data of latitude and longitude
!-----------------------------------------------------------------
call GetAxes( dyn_sp = dyn_sp_as % dyn_sp, x_Lon = x_Lon, y_Lat = y_Lat, x_Lon_Weight = x_Lon_Weight, y_Lat_Weight = y_Lat_Weight ) ! (out)
!-----------------------------------------------------------------
! 鉛直レベル座標値の取得
! Get data of vertical level
!-----------------------------------------------------------------
call GetAxes( dyn_as = dyn_sp_as % dyn_as, z_Sigma = z_Sigma, r_Sigma = r_Sigma ) ! (out)
!-----------------------------------------------------------------
! ヒストリファイルへのデータ出力設定
! Configure the settings for history data output
!-----------------------------------------------------------------
if ( associated( dyn_sp_as % hist_nml ) ) deallocate( dyn_sp_as % hist_nml )
allocate( dyn_sp_as % hist_nml(1) )
!-------------------------
! デフォルト値
! Default values
history_varlist_work = ''
dyn_sp_as % history_fileprefix = ''
dyn_sp_as % hist_nml(1) % name = ''
dyn_sp_as % hist_nml(1) % file = ''
dyn_sp_as % hist_nml(1) % history_interval_value = -1.0_DP
dyn_sp_as % hist_nml(1) % history_interval_unit = 'sec'
dyn_sp_as % hist_nml(1) % history_precision = 'float'
dyn_sp_as % hist_nml(1) % history_average = .false.
!-------------------------
! オプショナル引数からの値
! Values from optional arguments
if ( present(history_varlist) ) history_varlist_work = history_varlist
if ( present(history_fileprefix) ) dyn_sp_as % history_fileprefix = history_fileprefix
if ( present(history_interval_value) ) dyn_sp_as % hist_nml(1) % history_interval_value = history_interval_value
if ( present(history_interval_unit) ) dyn_sp_as % hist_nml(1) % history_interval_unit = history_interval_unit
if ( present(history_precision) ) dyn_sp_as % hist_nml(1) % history_precision = history_precision
!-----------------------------------------------------------------
! 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, history_varlist_ = history_varlist_work, history_fileprefix_ = dyn_sp_as % history_fileprefix, hist_nml = dyn_sp_as % hist_nml, 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
!-----------------------------------------------------------------
! ヒストリーデータに関する時刻管理
! Time control for history data
!-----------------------------------------------------------------
call Create( diff = dyn_sp_as % hist_nml(1) % history_interval_time, value = dyn_sp_as % hist_nml(1) % history_interval_value, unit = dyn_sp_as % hist_nml(1) % history_interval_unit ) ! (in)
!-----------------------------------------------------------------
! HistoryCreate によるファイル作成
! Files are created by "HistoryCreate"
!-----------------------------------------------------------------
call Split( str = history_varlist_work, sep = ',', carray = dyn_sp_as % history_varlist_array ) ! (out)
!-------------------------
! xyr_SigmaDot の出力設定
! Configure the settings for "xyr_SigmaDot" output
name = 'SigmaDot'
history_filename = trim(dyn_sp_as % history_fileprefix) // 'SigmaDot.nc'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( trim(hptr % file) /= '' ) history_filename = trim(hptr % file)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) .and. hptr % history_interval_value > 0.0_DP ) then
call HistoryCreate( history = dyn_sp_as % gthist_sigmadot, file = history_filename, title = 'Dynamical core calculation', source = 'dcpam4 : ' // trim(version), institution = 'GFD Dennou Club', dims = StoA('lon', 'lat', 'sig', 'sigm', 'time'), dimsizes = (/imax, jmax, kmax, kmax + 1, 0/), longnames = StoA('longitude', 'latitude', 'sigma at layer midpoints', 'sigma at layer end-points (half level)', 'time'), units = StoA('degree_east', 'degree_north', '1', '1', hptr % history_interval_unit), origin = real(EvalbyUnit(dyn_sp_as % current_time, hptr % history_interval_unit)), interval = real(EvalbyUnit(hptr % history_interval_time, hptr % history_interval_unit)) ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'lon', array = x_Lon / PI * 180.0_DP ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'lat', array = y_Lat / PI * 180.0_DP ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'sig', array = z_Sigma ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'sigm', array = r_Sigma ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'sig', attrname = 'standard_name', value = 'atmosphere_sigma_coordinate' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'sigm', attrname = 'standard_name', value = 'atmosphere_sigma_coordinate' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'time', attrname = 'standard_name', value = 'time' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'sig', attrname = 'positive', value = 'down' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'sigm', attrname = 'positive', value = 'down' ) ! (in)
call HistoryAddVariable( history = dyn_sp_as % gthist_sigmadot, varname = 'lon_weight', dims = StoA('lon'), longname = 'weight for integration in longitude', units = 'radian', xtype = 'double' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'lon', attrname = 'gt_calc_weight', value = 'lon_weight' ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'lon_weight', array = x_Lon_Weight ) ! (in)
call HistoryAddVariable( history = dyn_sp_as % gthist_sigmadot, varname = 'lat_weight', dims = StoA('lat'), longname = 'weight for integration in latitude', units = 'radian', xtype = 'double' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_sigmadot, varname = 'lat', attrname = 'gt_calc_weight', value = 'lat_weight' ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'lat_weight', array = y_Lat_Weight ) ! (in)
call HistoryAddVariable( history = dyn_sp_as % gthist_sigmadot, varname = 'SigmaDot', dims = StoA('lon', 'lat', 'sigm', 'time'), longname = 'sigma-vertical velocity', units = '1/s', xtype = hptr % history_precision ) ! (in)
end if
!-------------------------
! xy_DPiDt の出力設定
! Configure the settings for "xy_DPiDt" output
name = 'DPiDt'
history_filename = trim(dyn_sp_as % history_fileprefix) // 'DPiDt.nc'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( trim(hptr % file) /= '' ) history_filename = trim(hptr % file)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) .and. hptr % history_interval_value > 0.0_DP ) then
call HistoryCreate( history = dyn_sp_as % gthist_dpidt, file = history_filename, title = 'Dynamical core calculation', source = 'dcpam4 : ' // trim(version), institution = 'GFD Dennou Club', dims = StoA('lon', 'lat', 'time'), dimsizes = (/imax, jmax, 0/), longnames = StoA('longitude', 'latitude', 'time'), units = StoA('degree_east', 'degree_north', hptr % history_interval_unit), origin = real(EvalbyUnit(dyn_sp_as % current_time, hptr % history_interval_unit)), interval = real(EvalbyUnit(hptr % history_interval_time, hptr % history_interval_unit)) ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_dpidt, varname = 'lon', array = x_Lon / PI * 180.0_DP ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_dpidt, varname = 'lat', array = y_Lat / PI * 180.0_DP ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'lon', attrname = 'standard_name', value = 'longitude' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'lat', attrname = 'standard_name', value = 'latitude' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'time', attrname = 'standard_name', value = 'time' ) ! (in)
call HistoryAddVariable( history = dyn_sp_as % gthist_dpidt, varname = 'lon_weight', dims = StoA('lon'), longname = 'weight for integration in longitude', units = 'radian', xtype = 'double' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'lon', attrname = 'gt_calc_weight', value = 'lon_weight' ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_dpidt, varname = 'lon_weight', array = x_Lon_Weight ) ! (in)
call HistoryAddVariable( history = dyn_sp_as % gthist_dpidt, varname = 'lat_weight', dims = StoA('lat'), longname = 'weight for integration in latitude', units = 'radian', xtype = 'double' ) ! (in)
call HistoryAddAttr( history = dyn_sp_as % gthist_dpidt, varname = 'lat', attrname = 'gt_calc_weight', value = 'lat_weight' ) ! (in)
call HistoryPut( history = dyn_sp_as % gthist_dpidt, varname = 'lat_weight', array = y_Lat_Weight ) ! (in)
call HistoryAddVariable( history = dyn_sp_as % gthist_dpidt, varname = 'DPiDt', dims = StoA('lon', 'lat', 'time'), longname = 'Pi (log Ps) tendency', units = 'Pa/s', xtype = hptr % history_precision ) ! (in)
end if
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
dyn_sp_as % initialized = .true.
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83Create
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| xyz_VorB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_DivB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_TempB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_QVapB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xy_PsB(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1) : | real(DP), intent(in)
| ||
| xyz_VorN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_DivN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_TempN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_QVapN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xy_PsN(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1) : | real(DP), intent(in)
| ||
| xyz_VorA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_DivA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_TempA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_QVapA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xy_PsA(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1) : | real(DP), intent(out)
| ||
| historyput_flag : | logical, intent(in), optional
| ||
| err : | logical, intent(out), optional
|
力学過程の演算を行い, 与えられた $ t-\Delta t $ および $ t $ の 渦度, 発散, 温度, 比湿, 地表面気圧から, $ t+\Delta t $ の 渦度, 発散, 温度, 比湿, 地表面気圧 を返します.
時間積分法にはリープフロッグスキームを用いています. デフォルトでは, $ \Delta t $ を大きくとるために, 重力波項に セミインプリシット法を適用しています. ただし, Create の time_integration_scheme に "Explicit" を指定した場合には重力波項もエクスプリシット法によって 解きます.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Calculating dynamical core, from vorticity, divergence, temperature, specific humidity, surface pressure at $ t-\Delta t $ and $ t $, the physical values at $ t+\Delta t $ are returned.
Leap-frog scheme is used as time integration. By default, semi-implicit scheme is applied to gravitational terms for extension of $ \Delta t $ . If "Explicit" is specified to time_integration_scheme in "Create", explicit scheme is applied to gravitational terms as well as other terms.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83Dynamics( dyn_sp_as, xyz_VorB, xyz_DivB, xyz_TempB, xyz_QVapB, xy_PsB, xyz_VorN, xyz_DivN, xyz_TempN, xyz_QVapN, xy_PsN, xyz_VorA, xyz_DivA, xyz_TempA, xyz_QVapA, xy_PsA, historyput_flag, err )
!
! 力学過程の演算を行い, 与えられた $ t-\Delta t $ および $ t $ の
! 渦度, 発散, 温度, 比湿, 地表面気圧から,
! $ t+\Delta t $ の
! 渦度, 発散, 温度, 比湿, 地表面気圧 を返します.
!
! 時間積分法にはリープフロッグスキームを用いています.
! デフォルトでは, $ \Delta t $ を大きくとるために, 重力波項に
! セミインプリシット法を適用しています.
! ただし, Create の *time_integration_scheme* に
! "Explicit" を指定した場合には重力波項もエクスプリシット法によって
! 解きます.
!
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Calculating dynamical core,
! from vorticity, divergence, temperature, specific humidity,
! surface pressure at $ t-\Delta t $ and $ t $, the
! physical values at $ t+\Delta t $ are returned.
!
! Leap-frog scheme is used as time integration.
! By default, semi-implicit scheme is applied to gravitational terms
! for extension of $ \Delta t $ .
! If "Explicit" is specified to *time_integration_scheme* in "Create",
! explicit scheme is applied to gravitational terms as well as
! other terms.
!
! If *dyn_sp_as* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP, TOKEN
use dc_string, only: LChar, PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dc_present, only: present_and_true
use dc_date, only: mod, operator(+), operator(==), EvalbyUnit
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_spectral, only: GradPi, VorDiv2UV, Tendency, TendencyExplicit, Spectral2Grid, Grid2Spectral, DiffusionCorrectTemp, DiffusionVorDiv
use dyn_as83, only: NonLinearOnGrid, TimeIntegration, Inquire, WTplusGPiOnGrid, HDivOnGrid
use gt4_history, only: HistoryPut
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
real(DP), intent(in):: xyz_VorB (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ \zeta (t-\Delta t) $ . 渦度. Vorticity
real(DP), intent(in):: xyz_DivB (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ D (t-\Delta t) $ . 発散. Divergence
real(DP), intent(in):: xyz_TempB (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ T (t-\Delta t) $ . 温度. Temperature
real(DP), intent(in):: xy_PsB (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1)
! $ P_s (t-\Delta t) $ . 地表面気圧. Surface pressure
real(DP), intent(in):: xyz_QVapB (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ q (t-\Delta t) $ . 比湿. Specific humidity
real(DP), intent(in):: xyz_VorN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ \zeta (t) $ . 渦度. Vorticity
real(DP), intent(in):: xyz_DivN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ D (t) $ . 発散. Divergence
real(DP), intent(in):: xyz_TempN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ T (t) $ . 温度. Temperature
real(DP), intent(in):: xy_PsN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1)
! $ P_s (t) $ . 地表面気圧. Surface pressure
real(DP), intent(in):: xyz_QVapN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ q (t) $ . 比湿. Specific humidity
real(DP), intent(out):: xyz_VorA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ \zeta (t+\Delta t) $ . 渦度. Vorticity
real(DP), intent(out):: xyz_DivA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ D (t+\Delta t) $ . 発散. Divergence
real(DP), intent(out):: xyz_TempA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ T (t+\Delta t) $ . 温度. Temperature
real(DP), intent(out):: xy_PsA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1)
! $ P_s (t+\Delta t) $ . 地表面気圧. Surface pressure
real(DP), intent(out):: xyz_QVapA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ q (t+\Delta t) $ . 比湿. Specific humidity
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.
!-----------------------------------
! 作業変数
! Work variables
real(DP):: xy_GradLonPiN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1)
! $ \DD{\pi}{x} (t) $
real(DP):: xy_GradLatPiN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1)
! $ \DD{\pi}{y} (t) $
real(DP):: xyz_UN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ U (t) $ . 東西風速. Zonal wind.
real(DP):: xyz_VN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ V (t) $ . 南北風速. Meridional wind.
real(DP):: xyz_UA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ U (t+\Delta t) $ . 東西風速. Zonal wind
real(DP):: xyz_VA (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ V (t+\Delta t) $ . 南北風速. Meridional wind
real(DP):: xyz_UAdvN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ UA (t) $ . 東西運動量移流項.
! Zonal advection of momentum
real(DP):: xyz_VAdvN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ VA (t) $ . 南北運動量移流項.
! Meridional advection of momentum
real(DP):: xyz_DTempDtN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ H (t) $ . 温度時間変化項.
! Temperature tendency
real(DP):: xyz_DQVapDtN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ R (t) $ . 比湿時間変化項.
! Specific humidity tendency
real(DP):: xyz_KEN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ E (t) $ . 運動エネルギー項.
! Kinematic energy
real(DP):: xyz_TempUAdvN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ UT (t) $ . 温度東西移流項.
! Zonal advection of temperature
real(DP):: xyz_TempVAdvN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ VT (t) $ . 温度南北移流項.
! Meridional advection of temperature
real(DP):: xyr_SigmaDotN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax)
! $ \dot{\sigma} $ .
! 鉛直流. Vertical flow
real(DP):: xy_DPiDtN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1)
! $ Z $ . 地表面気圧時間変化項.
! Surface pressure tendency
real(DP):: xyz_QVapUAdvN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ Uq (t) $ . 比湿東西移流項.
! Zonal advection of specific humidity
real(DP):: xyz_QVapVAdvN (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ Vq (t) $ . 比湿南北移流項.
! Meridional advection of specific humidity
real(DP):: wz_DVorDtN ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \DD{\zeta}{t} (t) $ . 渦度変化 (スペクトル).
! Vorticity tendency (spectral)
real(DP):: wz_DDivDtN ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \DD{D}{t} (t) $ . 発散変化 (スペクトル).
! Divergence tendency (spectral)
real(DP):: wz_DTempDtN ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \DD{T}{t} (t) $ . 温度変化 (スペクトル).
! Temperature tendency (spectral)
real(DP):: wz_DQVapDtN ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \DD{q}{t} (t) $ . 比湿変化 (スペクトル).
! Specific humidity tendency (spectral)
real(DP):: w_DPiDtN ((dyn_sp_as%nmax+1)**2)
! $ \DD{Ps}{t} (t) $ . 地表面気圧変化 (スペクトル).
! Surface pressure tendency (spectral)
real(DP):: wz_VorB ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \zeta (t-\Delta t) $ . 渦度 (スペクトル).
! Vorticity (spectral)
real(DP):: wz_DivB ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ D (t-\Delta t) $ . 発散 (スペクトル).
! Divergence (spectral)
real(DP):: wz_TempB ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ T (t-\Delta t) $ . 温度 (スペクトル).
! Temperature (spectral)
real(DP):: w_PiB ((dyn_sp_as%nmax+1)**2)
! $ \pi = \ln P_s (t-\Delta t) $ . 地表面気圧 (スペクトル).
! Surface pressure (spectral)
real(DP):: wz_QVapB ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ q (t-\Delta t) $ . 比湿 (スペクトル).
! Specific humidity (spectral)
real(DP):: wz_VorA ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \zeta (t+\Delta t) $ . 渦度 (スペクトル).
! Vorticity (spectral)
real(DP):: wz_DivA ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ D (t+\Delta t) $ . 発散 (スペクトル).
! Divergence (spectral)
real(DP):: wz_TempA ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ T (t+\Delta t) $ . 温度 (スペクトル).
! Temperature (spectral)
real(DP):: w_PiA ((dyn_sp_as%nmax+1)**2)
! $ \pi = \ln P_s (t+\Delta t) $ . 地表面気圧 (スペクトル).
! Surface pressure (spectral)
real(DP):: wz_QVapA ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ q (t+\Delta t) $ . 比湿 (スペクトル).
! Specific humidity (spectral)
real(DP):: wz_VorDiffA ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \mathscr{D}(\zeta) $ .
! 運動量水平拡散による渦度変化 (スペクトル).
! Vorticity tendency by
! horizontal momentum diffusion (spectral)
real(DP):: wz_DivDiffA ((dyn_sp_as%nmax+1)**2, 0:dyn_sp_as%kmax-1)
! $ \mathscr{D}(D) $ .
! 運動量水平拡散による発散変化 (スペクトル).
! Divergence tendency by
! horizontal momentum diffusion (spectral)
!-----------------------------------
! エクスプリシット法のための作業変数
! Work variables for explicit scheme
real(DP):: xyz_exWTGPi (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ \underline{W} \Dvect{T} + \Dvect{G} \pi $ .
real(DP):: xyz_exHDiv (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! $ \underline{h} \Dvect{D} $ .
character(TOKEN):: time_integration_scheme
! 時間積分法.
! 以下の方法を選択可能.
!
! Time integration scheme.
! Available schemes are as follows.
!
! * "Semi-implicit"
! * "Explicit"
!
!-----------------------------------
! ヒストリファイルへのデータ出力設定
! Configure the settings for history data output
character(TOKEN):: name
! 変数名. Variable name
type(DYNSPAS83_HISTNML), pointer:: hptr =>null()
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml"
!-----------------------------------
! 作業変数
! Work variables
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83Dynamics'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_sp_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 時間積分法の問い合わせ
! Inquire time integration scheme
!-----------------------------------------------------------------
call Inquire( dyn_as = dyn_sp_as % dyn_as, time_integration_scheme = time_integration_scheme ) ! (out)
!-----------------------------------------------------------------
! 時間変化項の計算
! Calculate tendency terms
!-----------------------------------------------------------------
!---------------------------------------------
! 地表面気圧の空間変化項の計算
! Calculate spatial surface pressure tendency
!
call GradPi( dyn_sp = dyn_sp_as % dyn_sp, xy_Ps = xy_PsN, xy_GradLonPi = xy_GradLonPiN, xy_GradLatPi = xy_GradLatPiN ) ! (out)
!---------------------------------------------
! 渦度発散から風速の計算
! Calculate wind velocity from vorticity and divergence
!
call VorDiv2UV( dyn_sp = dyn_sp_as % dyn_sp, xyz_Vor = xyz_VorN, xyz_Div = xyz_DivN, xyz_U = xyz_UN, xyz_V = xyz_VN ) ! (out)
!---------------------------------------------
! 格子点上での非線形力学項の計算
! Calculate non-linear dynamical terms on grid points
!
call NonLinearOnGrid( dyn_as = dyn_sp_as % dyn_as, xyz_U = xyz_UN, xyz_V = xyz_VN, xyz_Vor = xyz_VorN, xyz_Div = xyz_DivN, xyz_Temp = xyz_TempN, xyz_QVap = xyz_QVapN, xy_GradLonPi = xy_GradLonPiN, xy_GradLatPi = xy_GradLatPiN, xyz_UAdv = xyz_UAdvN, xyz_VAdv = xyz_VAdvN, xyz_DTempDt = xyz_DTempDtN, xyz_DQVapDt = xyz_DQVapDtN, xyz_KE = xyz_KEN, xyz_TempUAdv = xyz_TempUAdvN, xyz_TempVAdv = xyz_TempVAdvN, xyr_SigmaDot = xyr_SigmaDotN, xy_DPiDt = xy_DPiDtN, xyz_QVapUAdv = xyz_QVapUAdvN, xyz_QVapVAdv = xyz_QVapVAdvN ) ! (out)
!---------------------------------------------
! スペクトル時間変化項の計算
! Calculate spectral tendency terms
!
call Tendency( dyn_sp = dyn_sp_as % dyn_sp, xyz_UAdv = xyz_UAdvN, xyz_VAdv = xyz_VAdvN, xyz_KE = xyz_KEN, xyz_TempUAdv = xyz_TempUAdvN, xyz_TempVAdv = xyz_TempVAdvN, xyz_DTempDt = xyz_DTempDtN, xy_DPiDt = xy_DPiDtN, xyz_QVapUAdv = xyz_QVapUAdvN, xyz_QVapVAdv = xyz_QVapVAdvN, xyz_DQVapDt = xyz_DQVapDtN, wz_DVorDt = wz_DVorDtN, wz_DDivDt = wz_DDivDtN, wz_DTempDt = wz_DTempDtN, w_DPiDt = w_DPiDtN, wz_DQVapDt = wz_DQVapDtN ) ! (out)
!---------------------------------------------
! エクスプリシット法を用いる際の計算
! Calculate for explicit scheme
!
select case ( LChar( trim( time_integration_scheme ) ) )
case ('explicit')
!---------------------------------------------
! $ \underline{W} \Dvect{T} + \Dvect{G} \pi $ の格子点値の計算
! Calculate $ \underline{W} \Dvect{T} + \Dvect{G} \pi $ on grid
!
call WTplusGPiOnGrid( dyn_as = dyn_sp_as % dyn_as, xyz_Temp = xyz_TempN, xy_Ps = xy_PsN, xyz_exWTGPi = xyz_exWTGPi ) ! (out)
!---------------------------------------------
! $ \underline{h} \Dvect{D} $ の格子点値の計算
! Calculate $ \underline{h} \Dvect{D} $ on grid
!
call HDivOnGrid( dyn_as = dyn_sp_as % dyn_as, xyz_Div = xyz_DivN, xyz_exHDiv = xyz_exHDiv ) ! (out)
!---------------------------------------------
! 発散, 温度 (スペクトル) の時間変化項の修正
! Modify divergence and temperature tencency (spectral)
!
call TendencyExplicit( dyn_sp = dyn_sp_as % dyn_sp, xyz_exWTGPi = xyz_exWTGPi, xyz_exHDiv = xyz_exHDiv, wz_DDivDt = wz_DDivDtN, wz_DTempDt = wz_DTempDtN ) ! (inout)
end select
!---------------------------------------------
! 格子点値をスペクトル値へ ( $ t-\Delta t$ )
! Exchange grid values to spectral values ( $ t-\Delta t$ )
!
call Grid2Spectral( dyn_sp = dyn_sp_as % dyn_sp, xyz_Data = xyz_VorB, wz_Data = wz_VorB ) ! (out)
call Grid2Spectral( dyn_sp = dyn_sp_as % dyn_sp, xyz_Data = xyz_DivB, wz_Data = wz_DivB ) ! (out)
call Grid2Spectral( dyn_sp = dyn_sp_as % dyn_sp, xyz_Data = xyz_TempB, wz_Data = wz_TempB ) ! (out)
call Grid2Spectral( dyn_sp = dyn_sp_as % dyn_sp, xy_Data = xy_PsB, math_func = 'log', w_Data = w_PiB ) ! (out)
call Grid2Spectral( dyn_sp = dyn_sp_as % dyn_sp, xyz_Data = xyz_QVapB, wz_Data = wz_QVapB ) ! (out)
!-----------------------------------------------------------------
! 時間積分
! Time integration
!-----------------------------------------------------------------
call TimeIntegration( dyn_as = dyn_sp_as % dyn_as, wz_DVorDtN = wz_DVorDtN, wz_DDivDtN = wz_DDivDtN, wz_DTempDtN = wz_DTempDtN, wz_DQVapDtN = wz_DQVapDtN, w_DPiDtN = w_DPiDtN, wz_VorB = wz_VorB, wz_DivB = wz_DivB, wz_TempB = wz_TempB, wz_QVapB = wz_QVapB, w_PiB = w_PiB, wz_VorA = wz_VorA, wz_DivA = wz_DivA, wz_TempA = wz_TempA, wz_QVapA = wz_QVapA, w_PiA = w_PiA ) ! (out)
!---------------------------------------------
! スペクトル値を格子点値へ ( $ t+\Delta t$ )
! Exchange spectral values to grid values ( $ t+\Delta t$ )
!
call Spectral2Grid( dyn_sp = dyn_sp_as % dyn_sp, wz_Data = wz_VorA, xyz_Data = xyz_VorA ) ! (out)
call Spectral2Grid( dyn_sp = dyn_sp_as % dyn_sp, wz_Data = wz_DivA, xyz_Data = xyz_DivA ) ! (out)
call Spectral2Grid( dyn_sp = dyn_sp_as % dyn_sp, wz_Data = wz_TempA, xyz_Data = xyz_TempA ) ! (out)
call Spectral2Grid( dyn_sp = dyn_sp_as % dyn_sp, w_Data = w_PiA, math_func = 'exp', xy_Data = xy_PsA ) ! (out)
call Spectral2Grid( dyn_sp = dyn_sp_as % dyn_sp, wz_Data = wz_QVapA, xyz_Data = xyz_QVapA ) ! (out)
call VorDiv2UV( dyn_sp = dyn_sp_as % dyn_sp, xyz_Vor = xyz_VorA, xyz_Div = xyz_DivA, xyz_U = xyz_UA, xyz_V = xyz_VA ) ! (out)
!-----------------------------------------------------------------
! 拡散による補正
! Correction by diffusion
!-----------------------------------------------------------------
!---------------------------------------------
! 運動量水平拡散による渦度発散の時間変化
! Vorticity and divergence tendency by
! horizontal diffusion of momentum
!
call DiffusionVorDiv( dyn_sp = dyn_sp_as % dyn_sp, wz_Vor = wz_VorA, wz_Div = wz_DivA, wz_VorDiff = wz_VorDiffA, wz_DivDiff = wz_DivDiffA ) ! (out)
!---------------------------------------------
! 運動量水平拡散による摩擦熱補正
! Frictional thermal correction by horizontal momentum diffusion
!
call DiffusionCorrectTemp( dyn_sp = dyn_sp_as % dyn_sp, wz_VorDiff = wz_VorDiffA, wz_DivDiff = wz_DivDiffA, xyz_U = xyz_UA, xyz_V = xyz_VA, xyz_Temp = xyz_TempA ) ! (inout)
!----------------------------------------------------------------
! ヒストリファイルへのデータ出力
! History data output
!----------------------------------------------------------------
!-------------------------
! xyr_SigmaDot の出力
! Output "xyr_SigmaDot"
name = 'SigmaDot'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) .and. present_and_true( historyput_flag ) .or. hptr % history_interval_value > 0.0_DP .and. mod( dyn_sp_as % current_time, hptr % history_interval_time) == 0 ) then
call HistoryPut( history = dyn_sp_as % gthist_sigmadot, varname = 'SigmaDot', array = xyr_SigmaDotN, quiet = .false. ) ! (in)
end if
!-------------------------
! xy_DPiDt の出力
! Output "xy_DPiDt"
name = 'DPiDt'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) .and. present_and_true( historyput_flag ) .or. hptr % history_interval_value > 0.0_DP .and. mod( dyn_sp_as % current_time, hptr % history_interval_time) == 0 ) then
call HistoryPut( history = dyn_sp_as % gthist_dpidt, varname = 'DPiDt', array = xy_DPiDtN, quiet = .false. ) ! (in)
end if
!-----------------------------------------------------------------
! 時刻の更新
! Update time
!-----------------------------------------------------------------
dyn_sp_as % current_time = dyn_sp_as % current_time + dyn_sp_as % delta_time
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83Dynamics
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| x_Lon(0:dyn_sp_as%imax-1) : | real(DP), intent(in), optional
| ||
| y_Lat(0:dyn_sp_as%jmax-1) : | real(DP), intent(in), optional
| ||
| z_Sigma(0:dyn_sp_as%kmax-1) : | real(DP), intent(in), optional
| ||
| r_Sigma(0:dyn_sp_as%kmax) : | real(DP), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
与えられた座標軸データ と dyn_sp_as 内に 保持される座標データが等しいことを確認します. 異なる場合にはエラーを発生させます.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Confirm equality between given axes data and axes data stored in dyn_sp_as. If the equality is not confirmed, error is occurred.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83EqualAxes( dyn_sp_as, x_Lon, y_Lat, z_Sigma, r_Sigma, err )
!
! 与えられた座標軸データ と *dyn_sp_as* 内に
! 保持される座標データが等しいことを確認します.
! 異なる場合にはエラーを発生させます.
!
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Confirm equality between given axes data and
! axes data stored in *dyn_sp_as*.
! If the equality is not confirmed, error is occurred.
!
! If *dyn_sp_as* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT, DCPAM_EAXISMISMATCH
use dyn_spectral, only: EqualAxes
use dyn_as83, only: EqualAxes
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
real(DP), intent(in), optional:: x_Lon (0:dyn_sp_as%imax-1)
! 経度. Longitude
real(DP), intent(in), optional:: y_Lat (0:dyn_sp_as%jmax-1)
! 緯度. Latitude
real(DP), intent(in), optional:: z_Sigma (0:dyn_sp_as%kmax-1)
! $ \sigma $ レベル (整数).
! Full $ \sigma $ level
real(DP), intent(in), optional:: r_Sigma (0:dyn_sp_as%kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
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.
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83EqualAxes'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_sp_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 軸データの比較
! Compare axes data
!-----------------------------------------------------------------
call EqualAxes( dyn_sp = dyn_sp_as % dyn_sp, x_Lon = x_Lon, y_Lat = y_Lat, err = err ) ! (out)
call EqualAxes( dyn_as = dyn_sp_as % dyn_as, z_Sigma = z_Sigma, r_Sigma = r_Sigma, err = err ) ! (out)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83EqualAxes
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| x_Lon(0:dyn_sp_as%imax-1) : | real(DP), intent(out)
| ||
| y_Lat(0:dyn_sp_as%jmax-1) : | real(DP), intent(out)
| ||
| z_Sigma(0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| r_Sigma(0:dyn_sp_as%kmax) : | real(DP), intent(out)
| ||
| z_DelSigma(0:dyn_sp_as%kmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
dyn_sp_as に格納されている座標値を返します.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return data of axes stored in dyn_sp_as.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83GetAxes( dyn_sp_as, x_Lon, y_Lat, z_Sigma, r_Sigma, z_DelSigma, err )
!
! *dyn_sp_as* に格納されている座標値を返します.
!
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Return data of axes stored in *dyn_sp_as*.
!
! If *dyn_sp_as* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_spectral, only: GetAxes
use dyn_as83, only: GetAxes
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
real(DP), intent(out):: x_Lon (0:dyn_sp_as%imax-1)
! 経度. Longitude
real(DP), intent(out):: y_Lat (0:dyn_sp_as%jmax-1)
! 緯度. Latitude
real(DP), intent(out):: z_Sigma (0:dyn_sp_as%kmax-1)
! $ \sigma $ レベル (整数).
! Full $ \sigma $ level
real(DP), intent(out):: r_Sigma (0:dyn_sp_as%kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
real(DP), intent(out), optional:: z_DelSigma (0:dyn_sp_as%kmax-1)
! $ \Delta \sigma $ (整数).
! $ \Delta \sigma $ (Full)
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.
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83Sample'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_sp_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 緯度経度座標値の取得
! Get data of latitude and longitude
!-----------------------------------------------------------------
call GetAxes( dyn_sp = dyn_sp_as % dyn_sp, x_Lon = x_Lon, y_Lat = y_Lat ) ! (out)
!-----------------------------------------------------------------
! 鉛直レベル座標値の取得
! Get data of vertical level
!-----------------------------------------------------------------
call GetAxes( dyn_as = dyn_sp_as % dyn_as, z_Sigma = z_Sigma, r_Sigma = r_Sigma, z_DelSigma = z_DelSigma ) ! (out)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83GetAxes
| Subroutine : | |||
| name : | character(*), intent(in)
| ||
| hist_nml(:) : | type(DYNSPAS83_HISTNML),
pointer
| ||
| hptr : | type(DYNSPAS83_HISTNML),
pointer
| ||
| err : | logical, intent(out), optional
|
データ出力情報が格納されたポインタ配列 hist_nml 内の name に該当するデータの情報へ hptr を結合して返します.
hist_nml が割り付けられていない場合, エラーを返します.
Associate hptr to information of data correspond to name stored in pointer array hist_nml, and return it.
If hist_nml is not allocated, error is occured.
subroutine DynSpectralAS83HstNmlAssoc( name, hist_nml, hptr, err )
!
! データ出力情報が格納されたポインタ配列 *hist_nml* 内の
! *name* に該当するデータの情報へ *hptr* を結合して返します.
!
! *hist_nml* が割り付けられていない場合, エラーを返します.
!
! Associate *hptr* to information of data correspond to *name*
! stored in pointer array *hist_nml*, and return it.
!
! If *hist_nml* is not allocated, error is occured.
!
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_ENOASSOC
implicit none
character(*), intent(in):: name
! 変数名. Variable name
type(DYNSPAS83_HISTNML), pointer:: hist_nml(:)
! (in)
!
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
! この配列の 1 番目にはデフォルトの設定が格納
! され, 2 番目以降に個別の設定が格納される.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml".
! Default settings are stored in
! the first element of this array,
! and individual settings are stored in
! the second or more.
type(DYNSPAS83_HISTNML), pointer:: hptr
! (out)
!
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml"
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:: hmax ! hist_nml(:) のサイズ.
! Size of "hist_nml(:)"
integer:: i ! DO ループ用作業変数
! Work variables for DO loop
character(*), parameter:: subname = 'DynSpectralAS83HstNmlAssoc'
continue
call BeginSub( subname )
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 割付状態の確認
! Check allocation
!-----------------------------------------------------------------
if ( .not. associated( hist_nml ) ) then
stat = DC_ENOASSOC
cause_c = 'hist_nml'
goto 999
end if
if ( size( hist_nml ) < 1 ) then
stat = DC_ENOASSOC
cause_c = 'hist_nml'
goto 999
end if
!-----------------------------------------------------------------
! *hist_nml* に格納される, *name* に該当するデータへ結合
! Associate information of data correspond to *name*
! stored in pointer array *hist_nml*
!-----------------------------------------------------------------
hmax = size( hist_nml )
if ( associated(hptr) ) nullify( hptr )
do i = 1, hmax
if ( trim(hist_nml(i) % name) == trim(name) ) hptr => hist_nml(i)
end do
if ( .not. associated(hptr) ) hptr => hist_nml(1)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError( stat, subname, err, cause_c )
call EndSub( subname )
end subroutine DynSpectralAS83HstNmlAssoc
| Function : | |
| result : | logical |
| dyn_sp_as : | type(DYNSPAS83), intent(in) |
dyn_sp_as が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If dyn_sp_as is initialized, .true. is returned. If dyn_sp_as is not initialized, .false. is returned.
logical function DynSpectralAS83Initialized( dyn_sp_as ) result(result)
!
! *dyn_sp_as* が初期設定されている場合には .true. が,
! 初期設定されていない場合には .false. が返ります.
!
! If *dyn_sp_as* is initialized, .true. is returned.
! If *dyn_sp_as* is not initialized, .false. is returned.
!
implicit none
type(DYNSPAS83), intent(in):: dyn_sp_as
continue
result = dyn_sp_as % initialized
end function DynSpectralAS83Initialized
| Subroutine : | |||
| nmlfile : | character(*), intent(in)
| ||
| history_varlist_ : | character(*), intent(inout) | ||
| history_fileprefix_ : | character(*), intent(inout) | ||
| hist_nml(:) : | type(DYNSPAS83_HISTNML),
pointer
| ||
| err : | logical, intent(out), optional
|
NAMELIST ファイル nmlfile から値を入力するための 内部サブルーチンです. Create 内で呼び出されることを 想定しています.
値が NAMELIST ファイル内で指定されていない場合には, 入力された値がそのまま返ります.
なお, nmlfile に空文字が与えられた場合, または 与えられた nmlfile を読み込むことができない場合, プログラムはエラーを発生させます.
This is an internal subroutine to input values from NAMELIST file nmlfile. This subroutine is expected to be called by "Create".
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#dyn_spectral_as83_varlist_nml, NAMELIST#dyn_spectral_as83_history_nml .
subroutine DynSpectralAS83NmlRead( nmlfile, history_varlist_, history_fileprefix_, hist_nml, err )
!
! NAMELIST ファイル *nmlfile* から値を入力するための
! 内部サブルーチンです. Create 内で呼び出されることを
! 想定しています.
!
! 値が NAMELIST ファイル内で指定されていない場合には,
! 入力された値がそのまま返ります.
!
! なお, *nmlfile* に空文字が与えられた場合, または
! 与えられた *nmlfile* を読み込むことができない場合,
! プログラムはエラーを発生させます.
!
! This is an internal subroutine to input values from
! NAMELIST file *nmlfile*. This subroutine is expected to be
! called by "Create".
!
! 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: Create
use dc_error, only: StoreError, DC_NOERR, DC_ENOFILEREAD, DC_ENOASSOC
implicit none
character(*), intent(in):: nmlfile
! NAMELIST ファイルの名称.
! NAMELIST file name
character(*), intent(inout):: history_varlist_
character(STRING):: history_varlist
! ヒストリデータの出力変数リスト.
! カンマで区切って並べる.
! (例: "Data1,Data2" ).
!
! List of variables output to history data.
! Delimiter is comma.
! (exp. "Data1,Data2" ).
!
character(*), intent(inout):: history_fileprefix_
character(STRING):: history_fileprefix
! ヒストリデータのファイル名の接頭詞.
! Prefix of history data filenames
type(DYNSPAS83_HISTNML), pointer:: hist_nml(:)
! (inout)
!
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
! この配列の 1 番目にはデフォルトの設定が格納
! され, 2 番目以降に個別の設定が格納される.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml".
! Default settings are stored in
! the first element of this array,
! and individual settings are stored in
! the second or more.
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 /dyn_spectral_as83_nml/ &
!!$ & param_i, param_r, param_c
! dyn_spectral_as83 モジュール用
! NAMELIST 変数群名.
!
! dyn_spectral_as83#Create を使用する際に,
! オプショナル引数 *nmlfile* へ NAMELIST
! ファイル名を指定することで, そのファイルから
! この NAMELIST 変数群を読み込みます.
!
! NAMELIST group name for
! "dyn_spectral_as83" module.
!
! If a NAMELIST filename is specified to
! an optional argument *nmlfile*
! when "dyn_spectral_as83#Create" is used,
! this NAMELIST group is loaded from
! the file.
namelist /dyn_spectral_as83_varlist_nml/ history_varlist
! dyn_spectral_as83 モジュールの
! ヒストリデータ出力リスト用
! NAMELIST 変数群名.
!
! dyn_spectral_as83#Create を使用する際に,
! オプショナル引数 *nmlfile* へ NAMELIST
! ファイル名を指定することで, そのファイルから
! この NAMELIST 変数群を読み込みます.
!
! NAMELIST group name for
! output list of history data of
! "dyn_spectral_as83" module.
!
! If a NAMELIST filename is specified to
! an optional argument *nmlfile*
! when "dyn_spectral_as83#Create" is used,
! this NAMELIST group is loaded from
! the file.
character(TOKEN):: name
! 変数名.
! 空白の場合には, この他の設定値は
! dyn_spectral_as83 モジュールにおいて
! 出力されるデータ全ての
! デフォルト値となります.
!
! Variable name.
! If blank is given, other values are
! used as default values of output data
! in "dyn_spectral_as83"
character(STRING):: file
! 出力ファイル名.
! これはデフォルト値としては使用されません.
! *name* に値が設定されている時のみ有効です.
!
! Output file name.
! This is not used as default value.
! This value is valid only when *name* is
! specified.
real(DP):: history_interval_value
! ヒストリデータの出力間隔の数値.
! Numerical value for interval of history data output
character(TOKEN):: history_interval_unit
! ヒストリデータの出力間隔の単位.
! Unit for interval of history data output
character(TOKEN):: history_precision
! ヒストリデータの精度.
! Precision of history data
logical:: history_average
! 出力データの平均化フラグ.
! Flag for average of output data.
namelist /dyn_spectral_as83_history_nml/ name, file, history_interval_value, history_interval_unit, history_precision, history_fileprefix, history_average
! dyn_spectral_as83 モジュールのヒストリデータ用
! NAMELIST 変数群名.
!
! dyn_spectral_as83#Create を使用する際に,
! オプショナル引数 *nmlfile* へ NAMELIST
! ファイル名を指定することで, そのファイルから
! この NAMELIST 変数群を読み込みます.
!
! NAMELIST group name for
! history data of "dyn_spectral_as83" module.
!
! If a NAMELIST filename is specified to
! an optional argument *nmlfile*
! when "dyn_spectral_as83#Create" 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
integer:: hmax ! hist_nml(:) のサイズ.
! Size of "hist_nml(:)"
type(DYNSPAS83_HISTNML), allocatable:: hist_nml_work(:)
character(*), parameter:: subname = 'DynSpectralAS83NmlRead'
continue
call BeginSub( subname )
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 割付状態の確認
! Check allocation
!-----------------------------------------------------------------
if ( .not. associated( hist_nml ) ) then
stat = DC_ENOASSOC
cause_c = 'hist_nml'
goto 999
end if
if ( size( hist_nml ) < 1 ) then
stat = DC_ENOASSOC
cause_c = 'hist_nml'
goto 999
end if
!-----------------------------------------------------------------
! 文字型引数を NAMELIST 変数群へ代入
! Substitute character arguments to NAMELIST group
!-----------------------------------------------------------------
history_varlist = history_varlist_
history_fileprefix = history_fileprefix_
!----------------------------------------------------------------
! 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, & ! (in)
!!$ & nml = dyn_spectral_as83_nml, iostat = iostat_nml ) ! (out)
!!$ if ( iostat_nml == 0 ) then
!!$ call MessageNotify( 'M', subname, &
!!$ & 'NAMELIST group "%c" is loaded from "%c".', &
!!$ & c1 = 'dyn_spectral_as83_nml', c2 = trim(nmlfile) )
!!$ write(STDOUT, nml = dyn_spectral_as83_nml)
!!$ else
!!$ call MessageNotify( 'W', subname, &
!!$ & 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', &
!!$ & c1 = 'dyn_spectral_as83_nml', c2 = trim(nmlfile), &
!!$ & i = (/iostat_nml/) )
!!$ end if
!-------------------------
! 出力変数リスト取得
! Get list of output variables
rewind( unit_nml )
read( unit = unit_nml, nml = dyn_spectral_as83_varlist_nml, iostat = iostat_nml ) ! (out)
if ( iostat_nml == 0 ) then
call MessageNotify( 'M', subname, 'NAMELIST group "%c" is loaded from "%c".', c1='dyn_spectral_as83_varlist_nml', c2=trim(nmlfile) )
write(STDOUT, nml = dyn_spectral_as83_varlist_nml)
else
call MessageNotify( 'W', subname, 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', c1='dyn_spectral_as83_varlist_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 = ''
history_interval_value = hist_nml(1) % history_interval_value
history_interval_unit = hist_nml(1) % history_interval_unit
history_precision = hist_nml(1) % history_precision
history_average = hist_nml(1) % history_average
read( unit = unit_nml, nml = dyn_spectral_as83_history_nml, iostat = iostat_nml ) ! (out)
inquire( unit_nml, position = pos_nml ) ! (out)
if ( iostat_nml == 0 ) then
call MessageNotify( 'M', subname, 'NAMELIST group "%c" is loaded from "%c".', c1='dyn_spectral_as83_history_nml', c2=trim(nmlfile) )
write(STDOUT, nml = dyn_spectral_as83_history_nml)
if ( name == '' ) then
hist_nml(1) % name = name
hist_nml(1) % file = ''
hist_nml(1) % history_interval_value = history_interval_value
hist_nml(1) % history_interval_unit = history_interval_unit
hist_nml(1) % history_precision = history_precision
hist_nml(1) % history_average = history_average
call Create( diff = hist_nml(1) % history_interval_time, value = history_interval_value, unit = history_interval_unit ) ! (in)
elseif ( file /= '' ) then
hmax = size( hist_nml )
allocate( hist_nml_work(hmax) )
hist_nml_work = hist_nml
deallocate( hist_nml )
allocate( hist_nml(hmax+1) )
hist_nml(1:hmax) = hist_nml_work
deallocate( hist_nml_work )
if ( trim(history_varlist) /= '' ) history_varlist = trim( history_varlist ) // ','
history_varlist = trim( history_varlist ) // trim(name)
hist_nml(hmax+1) % name = name
hist_nml(hmax+1) % file = file
hist_nml(hmax+1) % history_interval_value = history_interval_value
hist_nml(hmax+1) % history_interval_unit = history_interval_unit
hist_nml(hmax+1) % history_precision = history_precision
hist_nml(hmax+1) % history_average = history_average
call Create( diff = hist_nml(hmax+1) % history_interval_time, value = history_interval_value, unit = history_interval_unit ) ! (in)
end if
else
call MessageNotify( 'W', subname, 'NAMELIST group "%c" is not found in "%c" any more (iostat=%d).', c1='dyn_spectral_as83_history_nml', c2=trim(nmlfile), i = (/iostat_nml/) )
end if
end do
close( unit_nml )
!-----------------------------------------------------------------
! NAMELIST 変数群を文字型引数へ代入
! Substitute NAMELIST group to character arguments
!-----------------------------------------------------------------
history_varlist_ = history_varlist
history_fileprefix_ = history_fileprefix
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError( stat, subname, err, cause_c )
call EndSub( subname )
end subroutine DynSpectralAS83NmlRead
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 dyn_sp_as に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.
Print information of dyn_sp_as. By default messages are output to standard output. Unit number for output can be changed by unit argument.
subroutine DynSpectralAS83PutLine( dyn_sp_as, unit, indent, err )
!
! 引数 *dyn_sp_as* に設定されている情報を印字します.
! デフォルトではメッセージは標準出力に出力されます.
! *unit* に装置番号を指定することで, 出力先を変更することが可能です.
!
! Print information of *dyn_sp_as*.
! 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_types, only: STRING, STDOUT
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dyn_spectral, only: PutLine
use dyn_as83, only: PutLine
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
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
integer:: hmax ! hist_nml(:) のサイズ.
! Size of "hist_nml(:)"
integer:: i ! DO ループ用作業変数
! Work variables for DO loop
character(*), parameter:: subname = 'DynSpectralAS83PutLine'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
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
!-----------------------------------------------------------------
! "DYNSPAS83" の設定の印字
! Print the settings for "DYNSPAS83"
!-----------------------------------------------------------------
if (dyn_sp_as % initialized) then
call Printf(out_unit, indent_str(1:indent_len) // '#<DYNSPAS83:: @initialized=%y', l=(/dyn_sp_as % initialized/))
hmax = size( dyn_sp_as % hist_nml )
do i = 1, hmax
call Printf( out_unit, indent_str(1:indent_len) // ' #<DYNSPAS83_HISTNML:: @name=%c @file=%c', c1 = trim(dyn_sp_as % hist_nml(i) % name), c2 = trim(dyn_sp_as % hist_nml(i) % file) )
call Printf( out_unit, indent_str(1:indent_len) // ' @history_interval_value=%f @history_interval_unit=%c', d = (/dyn_sp_as % hist_nml(i) % history_interval_value/), c1 = trim(dyn_sp_as % hist_nml(i) % history_interval_unit) )
call Printf( out_unit, indent_str(1:indent_len) // ' @history_precision=%c @history_average=%c', c1 = trim(dyn_sp_as % hist_nml(i) % history_precision), l = (/ dyn_sp_as % hist_nml(i) % history_average /) )
end do
call Printf( out_unit, indent_str(1:indent_len) // ' >' )
else
call Printf(out_unit, indent_str(1:indent_len) // '#<DYNSPAS83:: @initialized=%y', l=(/dyn_sp_as % initialized/))
end if
call PutLine(dyn_sp_as % dyn_sp, out_unit, indent_str(1:indent_len) // ' ', err)
call PutLine(dyn_sp_as % dyn_as, out_unit, indent_str(1:indent_len) // ' ', err)
call Printf(out_unit, indent_str(1:indent_len) // '>')
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83PutLine
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| current_time_value : | real(DP), intent(in)
| ||
| current_time_unit : | character(*), intent(in)
| ||
| err : | logical, intent(out), optional
|
dyn_sp_as に対して時刻の設定を行います.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Set time to dyn_sp_as.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83SetTime( dyn_sp_as, current_time_value, current_time_unit, err )
!
! *dyn_sp_as* に対して時刻の設定を行います.
!
!
!
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Set time to *dyn_sp_as*.
!
!
!
! If *dyn_sp_as* is not initialized by "Create" 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: Create, EvalbyUnit
use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT
use gt4_history, only: HistorySetTime
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
real(DP), 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(TOKEN):: name
! 変数名. Variable name
type(DYNSPAS83_HISTNML), pointer:: hptr =>null()
! NAMELIST#dyn_spectral_as83_history_nml
! から入手される個別のデータ出力情報.
!
! Individual data output information from
! "NAMELIST#dyn_spectral_as83_history_nml"
!-----------------------------------
! 作業変数
! Work variables
integer:: stat
character(STRING):: cause_c
integer:: hmax ! hist_nml(:) のサイズ.
! Size of "hist_nml(:)"
integer:: i ! DO ループ用作業変数
! Work variables for DO loop
character(*), parameter:: subname = 'DynSpectralAS83SetTime'
continue
call BeginSub( subname )
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if ( .not. dyn_sp_as % initialized ) then
stat = DC_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 時刻設定
! Configure time
!-----------------------------------------------------------------
call Create( diff = dyn_sp_as % current_time, value = current_time_value, unit = current_time_unit ) ! (in)
!-----------------------------------------------------------------
! ヒストリファイルへのデータの時刻設定
! Configure the time of history data
!-----------------------------------------------------------------
hmax = size( dyn_sp_as % hist_nml )
do i = 1, hmax
dyn_sp_as % hist_nml(i) % history_interval_value = - 1.0_DP
call Create( diff = dyn_sp_as % hist_nml(i) % history_interval_time, value = dyn_sp_as % hist_nml(i) % history_interval_value, unit = dyn_sp_as % hist_nml(i) % history_interval_unit ) ! (in)
end do
!-------------------------
! xyr_SigmaDot の時刻設定
! Configure the time of "xyr_SigmaDot"
name = 'SigmaDot'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) ) then
call HistorySetTime( history = dyn_sp_as % gthist_sigmadot, time = real( EvalbyUnit( dyn_sp_as % current_time, hptr % history_interval_unit) ) ) ! (in)
end if
!-------------------------
! xy_DPiDt の時刻設定
! Configure the time of "xy_DPiDt"
name = 'DPiDt'
call HstNmlAssoc( hist_nml = dyn_sp_as % hist_nml, name = name, hptr = hptr ) ! (out)
if ( StrInclude( dyn_sp_as % history_varlist_array, name ) ) then
call HistorySetTime( history = dyn_sp_as % gthist_dpidt, time = real( EvalbyUnit( dyn_sp_as % current_time, hptr % history_interval_unit) ) ) ! (in)
end if
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError( stat, subname, err, cause_c )
call EndSub( subname )
end subroutine DynSpectralAS83SetTime
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| xyz_Vor(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_Div(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_U(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_V(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| err : | logical, intent(out), optional
|
与えられた東西風速と南北風速から渦度と発散を計算します.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Calculate vorticity and divergence from given zonal and meridional wind.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83UV2VorDiv( dyn_sp_as, xyz_Vor, xyz_Div, xyz_U, xyz_V, err )
!
! 与えられた東西風速と南北風速から渦度と発散を計算します.
!
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Calculate vorticity and divergence
! from given zonal and meridional wind.
!
! If *dyn_sp_as* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_spectral, only: UV2VorDiv
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
real(DP), intent(in):: xyz_U (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 東西風速 $ U $
real(DP), intent(in):: xyz_V (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 南北風速 $ V $
real(DP), intent(out):: xyz_Vor (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 渦度 $ \zeta $
real(DP), intent(out):: xyz_Div (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 発散 $ D $
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.
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83UV2VorDiv'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_sp_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 風速から渦度発散の計算
! Calculate vorticity and divergence from wind velocity
!-----------------------------------------------------------------
call UV2VorDiv( dyn_sp = dyn_sp_as % dyn_sp, xyz_U = xyz_U, xyz_V = xyz_V, xyz_Vor = xyz_Vor, xyz_Div = xyz_Div ) ! (out)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83UV2VorDiv
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| xyz_Vor(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Div(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_U(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_V(0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1) : | real(DP), intent(out)
| ||
| err : | logical, intent(out), optional
|
与えられた渦度と発散から東西風速と南北風速を計算します.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Calculate zonal and meridional wind from given vorticity and divergence.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
subroutine DynSpectralAS83VorDiv2UV( dyn_sp_as, xyz_Vor, xyz_Div, xyz_U, xyz_V, err )
!
! 与えられた渦度と発散から東西風速と南北風速を計算します.
!
! なお, 与えられた *dyn_sp_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Calculate zonal and meridional wind from given
! vorticity and divergence.
!
! If *dyn_sp_as* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dc_string, only: PutLine, Printf, Split, StrInclude, StoA, JoinChar
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_spectral, only: VorDiv2UV
implicit none
type(DYNSPAS83), intent(inout):: dyn_sp_as
real(DP), intent(in):: xyz_Vor (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 渦度 $ \zeta $
real(DP), intent(in):: xyz_Div (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 発散 $ D $
real(DP), intent(out):: xyz_U (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 東西風速 $ U $
real(DP), intent(out):: xyz_V (0:dyn_sp_as%imax-1, 0:dyn_sp_as%jmax-1, 0:dyn_sp_as%kmax-1)
! 南北風速 $ V $
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.
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynSpectralAS83VorDiv2UV'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_sp_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNSPAS83'
goto 999
end if
!-----------------------------------------------------------------
! 渦度発散から風速の計算
! Calculate wind velocity from vorticity and divergence
!-----------------------------------------------------------------
call VorDiv2UV( dyn_sp = dyn_sp_as % dyn_sp, xyz_Vor = xyz_Vor, xyz_Div = xyz_Div, xyz_U = xyz_U, xyz_V = xyz_V ) ! (out)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynSpectralAS83VorDiv2UV
| Subroutine : | |||
| name : | character(*), intent(in)
| ||
| hist_nml(:) : | type(DYNSPAS83_HISTNML),
pointer
| ||
| hptr : | type(DYNSPAS83_HISTNML),
pointer
| ||
| err : | logical, intent(out), optional
|
データ出力情報が格納されたポインタ配列 hist_nml 内の name に該当するデータの情報へ hptr を結合して返します.
hist_nml が割り付けられていない場合, エラーを返します.
Associate hptr to information of data correspond to name stored in pointer array hist_nml, and return it.
If hist_nml is not allocated, error is occured.
Alias for DynSpectralAS83HstNmlAssoc
| Subroutine : | |||
| nmlfile : | character(*), intent(in)
| ||
| history_varlist_ : | character(*), intent(inout) | ||
| history_fileprefix_ : | character(*), intent(inout) | ||
| hist_nml(:) : | type(DYNSPAS83_HISTNML),
pointer
| ||
| err : | logical, intent(out), optional
|
NAMELIST ファイル nmlfile から値を入力するための 内部サブルーチンです. Create 内で呼び出されることを 想定しています.
値が NAMELIST ファイル内で指定されていない場合には, 入力された値がそのまま返ります.
なお, nmlfile に空文字が与えられた場合, または 与えられた nmlfile を読み込むことができない場合, プログラムはエラーを発生させます.
This is an internal subroutine to input values from NAMELIST file nmlfile. This subroutine is expected to be called by "Create".
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#dyn_spectral_as83_varlist_nml, NAMELIST#dyn_spectral_as83_history_nml .
Alias for DynSpectralAS83NmlRead
| Subroutine : | |||
| dyn_sp_as : | type(DYNSPAS83), intent(inout) | ||
| current_time_value : | real(DP), intent(in)
| ||
| current_time_unit : | character(*), intent(in)
| ||
| err : | logical, intent(out), optional
|
dyn_sp_as に対して時刻の設定を行います.
なお, 与えられた dyn_sp_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Set time to dyn_sp_as.
If dyn_sp_as is not initialized by "Create" yet, error is occurred.
Alias for DynSpectralAS83SetTime
| Constant : | |
| version = ’$Name: dcpam4-20071012 $’ // ’$Id: dyn_spectral_as83.f90,v 1.22 2007/10/10 19:44:29 morikawa Exp $’ : | character(*), parameter |