| Class | dyn_as83 |
| In: |
dynamics/dyn_as83.f90
|
Note that Japanese and English are described in parallel.
力学コアモジュールです. 鉛直離散化には以下の手法を用いています.
This is a dynamical core module. Used vertical discretization method is as follows.
| Create : | DYNAS83 型変数の初期設定 |
| Close : | DYNAS83 型変数の終了処理 |
| PutLine : | DYNAS83 型変数に格納されている情報の印字 |
| initialized : | DYNAS83 型変数が初期設定されているか否か |
| GetAxes : | DYNAS83 型変数に格納されている座標値の取得 |
| NonLinearOnGrid : | 非線形項 (非重力波項) の格子点上での計算 |
| TimeIntegration : | 時間積分の実行 |
| ———— : | ———— |
| Create : | Constructor of "DYNAS83" |
| Close : | Deconstructor of "DYNAS83" |
| PutLine : | Print information of "DYNAS83" |
| initialized : | Check initialization of "DYNAS83" |
| GetAxes : | Get data of axes in "DYNAS83" |
| NonLinearOnGrid : | Calculate non-linear terms (non gravitational terms) on grid points |
| TimeIntegration : | Execute time integration |
始めに, DYNAS83 型の変数を定義し, Create で初期設定します. 非線形項 (非重力波項) の格子点上での計算を行う場合には NonLinearOnGrid を使用してください. 時間積分を行う際には TimeIntegration を使用してください. DYNAS83 型の変数の終了処理には Close を用います. 座標値が必要となる場合には, GetAxes を用いて 座標値を取得してください.
First, initialize "DYNAS83" by Create. Use NonLinearOnGrid for calculation of non-linear terms (non gravitational terms) on grid points. Use TimeIntegration for time integration. In order to terminate "DYNAS83", use Close. If you need data of axes, get that by GetAxes.
| Derived_Types | [] | DYNAS83 |
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| err : | logical, intent(out), optional
|
DYNAS83 型の変数の終了処理を行います. なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Deconstructor of "DYNAS83". Note that if dyn_as is not initialized by Create yet, error is occurred.
Alias for DynAS83Close
| Subroutine : | |||
| dyn_as : | type(DYNAS83), 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)
| ||
| Grav : | real(DP), intent(in)
| ||
| Omega : | real(DP), intent(in)
| ||
| Cp : | real(DP), intent(in)
| ||
| RAir : | real(DP), intent(in)
| ||
| EpsVT : | real(DP), intent(in)
| ||
| EFoldTime : | real(DP), intent(in)
| ||
| DelTime : | real(DP), intent(in)
| ||
| xy_Cori(0:imax-1, 0:jmax-1) : | real(DP), intent(in)
| ||
| nmo(1:2, 0:nmax, 0:nmax) : | integer, intent(in)
| ||
| wz_rn((nmax+1)**2, 0:kmax-1) : | real(DP), intent(in)
| ||
| wz_DiffVorDiv((nmax+1)**2, 0:kmax-1) : | real(DP), intent(in)
| ||
| wz_DiffTherm((nmax+1)**2, 0:kmax-1) : | real(DP), intent(in)
| ||
| r_SigmaSet(:) : | real(DP), intent(in), optional
| ||
| w_Phis((nmax+1)**2) : | real(DP), intent(in), optional
| ||
| nmlfile : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 dyn_as に Arakawa and Suarez (1983) を用いた演算の設定を行います. 他のサブルーチンを使用する前に必ずこのサブルーチンによって DYNAS83 型の変数を初期設定してください. NAMELIST を利用する場合には引数 nmlfile に NAMELIST ファイル名 を与えてください.
Configure the settings for Arakawa and Suarez (1983) to dyn_as. Before other subroutines are used, initialize "DYNAS83" variable. In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile.
Alias for DynAS83Create
| Derived Type : | |||
| initialized = .false. : | logical
| ||
| nmax : | integer
| ||
| imax : | integer
| ||
| jmax : | integer
| ||
| kmax : | integer
| ||
| z_Sigma(:) =>null() : | real(DP), pointer
| ||
| r_Sigma(:) =>null() : | real(DP), pointer
| ||
| z_DelSigma(:) =>null() : | real(DP), pointer
| ||
| PI : | real(DP)
| ||
| RPlanet : | real(DP)
| ||
| Omega : | real(DP)
| ||
| Grav : | real(DP)
| ||
| Cp : | real(DP)
| ||
| RAir : | real(DP)
| ||
| EpsVT : | real(DP)
| ||
| EFoldTime : | real(DP)
| ||
| Kappa : | real(DP)
| ||
| DelTime : | real(DP)
| ||
| xy_Cori(:,:) =>null() : | real(DP), pointer
| ||
| nmo(:,:,:) =>null() : | integer, pointer
| ||
| wz_rn(:,:) =>null() : | real(DP), pointer
| ||
| wz_DiffVorDiv(:,:) =>null() : | real(DP), pointer
| ||
| wz_DiffTherm(:,:) =>null() : | real(DP), pointer
| ||
| w_Phis(:) =>null() : | real(DP), pointer
| ||
| z_TempAvrXY(:) =>null() : | real(DP), pointer
| ||
| r_TempAvrXY(:) =>null() : | real(DP), pointer
| ||
| z_HydroAlpha(:) =>null() : | real(DP), pointer
| ||
| z_HydroBeta(:) =>null() : | real(DP), pointer
| ||
| z_TempInpolKappa(:) =>null() : | real(DP), pointer
| ||
| z_TempInpolA(:) =>null() : | real(DP), pointer
| ||
| z_TempInpolB(:) =>null() : | real(DP), pointer
| ||
| z_siMtxG(:) =>null() : | real(DP), pointer
| ||
| zz_siMtxH(:,:) =>null() : | real(DP), pointer
| ||
| zz_siMtxWH(:,:) =>null() : | real(DP), pointer
| ||
| zz_siMtxGCt(:,:) =>null() : | real(DP), pointer
| ||
| dyn_mtx : | type(DYNMTX) |
まず, Create で "DYNAS83" 型の変数を初期設定して下さい. 初期設定された "DYNAS83" 型の変数を再度利用する際には, Close によって終了処理を行ってください.
Initialize "DYNAS83" variable by "Create" before usage. If you reuse "DYNAS83" variable again for another application, terminate by "Close".
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| z_Sigma(0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| r_Sigma(0:dyn_as%kmax) : | real(DP), intent(out)
| ||
| z_DelSigma(0:dyn_as%kmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
dyn_as に格納されている座標値を返します.
なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return data of axes stored in dyn_sp.
If dyn_as is not initialized by Create yet, error is occurred.
Alias for DynAS83GetAxes
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| xyz_U(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_V(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Vor(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Div(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Temp(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_QVap(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xy_GradLonPi(0:dyn_as%imax-1, 0:dyn_as%jmax-1) : | real(DP), intent(in)
| ||
| xy_GradLatPi(0:dyn_as%imax-1, 0:dyn_as%jmax-1) : | real(DP), intent(in)
| ||
| xyz_UAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_VAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_DTempDt(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_DQVapDt(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_KE(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_TempUAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_TempVAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xy_DPiDt(0:dyn_as%imax-1, 0:dyn_as%jmax-1) : | real(DP), intent(out)
| ||
| xyz_QVapUAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_QVapVAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| err : | logical, intent(out), optional
|
非線形項 (非重力波項) を格子点上で計算します.
なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Non-linear terms (non gravitational terms) are calculated on grid points
If dyn_as is not initialized by Create yet, error is occurred.
Alias for DynAS83NonLinearOnGrid
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(in) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 dyn_as 内の情報を印字します. デフォルトでは標準出力に印字します. unit に装置番号を していすることで, 出力先を変更することが可能です.
Print information of dyn_as. By default messages are output to standard output. Unit number for output can be changed by unit argument.
Alias for DynAS83PutLine
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| wz_DVorDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DDivDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DTempDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DQVapDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| w_DPiDtN((dyn_as%nmax+1)**2) : | real(DP), intent(in)
| ||
| wz_VorB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DivB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_TempB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_QVapB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| w_PiB((dyn_as%nmax+1)**2) : | real(DP), intent(in)
| ||
| wz_VorA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| wz_DivA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| wz_TempA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| wz_QVapA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| w_PiA((dyn_as%nmax+1)**2) : | real(DP), intent(out)
| ||
| err : | logical, intent(out), optional
|
時間積分を行い, 時刻 $ t $ の物理量の時間変化と $ t-\Delta t$ の物理量から 時刻 $ t+\Delta t $ の物理量を計算します.
時間積分法にはリープフロッグスキームを用いています. ただし拡散項には前方差分を用いています. さらに $ \Delta t $ を大きくとるために, 重力波項に セミインプリシット法を適用しています.
なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
With time integration, calculate physical values at $ t+\Delta t $ from tendency at $ t $ and physical values at $ t-\Delta t $ .
Leap-frog scheme is used as time integration. And forward difference is used to diffusion terms. In addition, semi-implicit scheme is applied for extension of $ \Delta t $ .
If dyn_as is not initialized by Create yet, error is occurred.
Alias for DynAS83TimeIntegration
| Function : | |
| result : | logical |
| dyn_as : | type(DYNAS83), intent(in) |
dyn_as が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If dyn_as is initialized, .true. is returned. If dyn_as is not initialized, .false. is returned.
Alias for DynAS83Initialized
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| err : | logical, intent(out), optional
|
DYNAS83 型の変数の終了処理を行います. なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Deconstructor of "DYNAS83". Note that if dyn_as is not initialized by Create yet, error is occurred.
subroutine DynAS83Close( dyn_as, err )
!
! DYNAS83 型の変数の終了処理を行います.
! なお, 与えられた *dyn_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Deconstructor of "DYNAS83".
! Note that if *dyn_as* is not initialized by Create yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_matrix, only: Close
implicit none
type(DYNAS83), intent(inout):: dyn_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.
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynAS83Close'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNAS83'
goto 999
end if
!-----------------------------------------------------------------
! "DYNAS83" の設定の消去
! Clear the settings for "DYNAS83"
!-----------------------------------------------------------------
deallocate( dyn_as % z_Sigma )
deallocate( dyn_as % r_Sigma )
deallocate( dyn_as % z_DelSigma )
deallocate( dyn_as % nmo )
deallocate( dyn_as % wz_rn )
deallocate( dyn_as % wz_DiffVorDiv )
deallocate( dyn_as % wz_DiffTherm )
deallocate( dyn_as % z_TempAvrXY )
deallocate( dyn_as % r_TempAvrXY )
deallocate( dyn_as % z_HydroAlpha )
deallocate( dyn_as % z_HydroBeta )
deallocate( dyn_as % z_TempInpolKappa )
deallocate( dyn_as % z_TempInpolA )
deallocate( dyn_as % z_TempInpolB )
deallocate( dyn_as % z_siMtxG )
deallocate( dyn_as % zz_siMtxH )
deallocate( dyn_as % zz_siMtxWH )
deallocate( dyn_as % zz_siMtxGCt )
!-----------------------------------------------------------------
! セミインプリシット時間積分用行列の消去
! Clear matrixes for semi-implicit time integration
!-----------------------------------------------------------------
call Close( dyn_mtx = dyn_as % dyn_mtx ) ! (inout)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
dyn_as % initialized = .false.
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynAS83Close
| Subroutine : | |||
| dyn_as : | type(DYNAS83), 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)
| ||
| Grav : | real(DP), intent(in)
| ||
| Omega : | real(DP), intent(in)
| ||
| Cp : | real(DP), intent(in)
| ||
| RAir : | real(DP), intent(in)
| ||
| EpsVT : | real(DP), intent(in)
| ||
| EFoldTime : | real(DP), intent(in)
| ||
| DelTime : | real(DP), intent(in)
| ||
| xy_Cori(0:imax-1, 0:jmax-1) : | real(DP), intent(in)
| ||
| nmo(1:2, 0:nmax, 0:nmax) : | integer, intent(in)
| ||
| wz_rn((nmax+1)**2, 0:kmax-1) : | real(DP), intent(in)
| ||
| wz_DiffVorDiv((nmax+1)**2, 0:kmax-1) : | real(DP), intent(in)
| ||
| wz_DiffTherm((nmax+1)**2, 0:kmax-1) : | real(DP), intent(in)
| ||
| r_SigmaSet(:) : | real(DP), intent(in), optional
| ||
| w_Phis((nmax+1)**2) : | real(DP), intent(in), optional
| ||
| nmlfile : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 dyn_as に Arakawa and Suarez (1983) を用いた演算の設定を行います. 他のサブルーチンを使用する前に必ずこのサブルーチンによって DYNAS83 型の変数を初期設定してください. NAMELIST を利用する場合には引数 nmlfile に NAMELIST ファイル名 を与えてください.
Configure the settings for Arakawa and Suarez (1983) to dyn_as. Before other subroutines are used, initialize "DYNAS83" variable. In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile.
subroutine DynAS83Create( dyn_as, nmax, imax, jmax, kmax, PI, RPlanet, Grav, Omega, Cp, RAir, EpsVT, EFoldTime, DelTime, xy_Cori, nmo, wz_rn, wz_DiffVorDiv, wz_DiffTherm, r_SigmaSet, w_Phis, nmlfile, err )
!
! 引数 *dyn_as* に Arakawa and Suarez (1983) を用いた演算の設定を行います.
! 他のサブルーチンを使用する前に必ずこのサブルーチンによって
! DYNAS83 型の変数を初期設定してください.
! NAMELIST を利用する場合には引数 *nmlfile* に NAMELIST ファイル名
! を与えてください.
!
! Configure the settings for Arakawa and Suarez (1983) to *dyn_as*.
! Before other subroutines are used, initialize "DYNAS83"
! variable.
! In order to use NAMELIST, specify a NAMELIST filename to
! argument *nmlfile*.
!
use dc_types, only: DP, STRING
use dc_message, only: MessageNotify
use dc_trace, only: BeginSub, EndSub, DbgMessage
use dc_present, only: present_and_not_empty, present_and_true
use dc_error, only: DC_ENOFILEREAD
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_EALREADYINIT, DCPAM_ENEGATIVE, DCPAM_ENOVARDEF, DCPAM_EARGSIZEMISMATCH
use dyn_matrix, only: Create
implicit none
type(DYNAS83), intent(inout):: dyn_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 $ .
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):: xy_Cori (0:imax-1, 0:jmax-1)
! $ f\equiv 2\Omega\sin\varphi $ .
! コリオリパラメータ. Coriolis parameter
integer, intent(in):: nmo (1:2, 0:nmax, 0:nmax)
! スペクトルの添字順番.
! Spectral subscript expression
real(DP), intent(in):: wz_rn ((nmax+1)**2, 0:kmax-1)
! $ -n \times (n+1) $ . ラプラシアンの係数.
! Laplacian coefficient
real(DP), intent(in):: 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), intent(in):: 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), 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.
real(DP), intent(in), optional:: w_Phis ((nmax+1)**2)
! $ \Phi_s $ . 地表ジオポテンシャル.
! Surface geo-potential
character(*), intent(in), optional :: nmlfile
! NAMELIST ファイルの名称.
! この引数に空文字以外を与えた場合,
! 指定されたファイルから
! NAMELIST 変数群を読み込みます.
! ファイルを読み込めない場合にはエラーを
! 生じます.
!
! 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.
!
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):: Kappa ! $ \kappa = R/C_p $ .
! 気体定数の定圧比熱に対する比. Ratio of gas constant to specific heat
real(DP):: z_Sigma (0:kmax-1)
! $ \sigma $ レベル (整数).
! Full $ \sigma $ level
real(DP):: r_Sigma (0:kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
real(DP):: z_DelSigma (0:kmax-1)
! $ \Delta \sigma $ (整数).
! $ \Delta \sigma $ (Full)
real(DP):: z_TempAvrXY (0:kmax-1)
! 平均温度 (整数レベル).
! Average temperature on full sigma level
real(DP):: r_TempAvrXY (0:kmax)
! 平均温度 (半整数レベル).
! Average temperature on half sigma level
real(DP):: z_HydroAlpha (0:kmax-1)
! $ \alpha $ . 静水圧の式の係数.
! Coefficient in hydrostatic equation.
real(DP):: z_HydroBeta (0:kmax-1)
! $ \beta $ . 静水圧の式の係数.
! Coefficient in hydrostatic equation.
real(DP):: z_TempInpolKappa (0:kmax-1)
! $ \kappa $ . 温度鉛直補間の係数.
! Coefficient for vertical interpolation of temperature
real(DP):: z_TempInpolA (0:kmax-1)
! $ a $ . 温度鉛直補間の係数.
! Coefficient for vertical interpolation of temperature
real(DP):: z_TempInpolB (0:kmax-1)
! $ b $ . 温度鉛直補間の係数.
! Coefficient for vertical interpolation of temperature
real(DP):: z_siMtxG (0:kmax-1)
! $ G = C_p \kappa T $
real(DP):: zz_siMtxH (0:kmax-1, 0:kmax-1)
! $ h = QS - R $
real(DP):: zz_siMtxWH (0:kmax-1, 0:kmax-1)
! $ W h $
real(DP):: zz_siMtxGCt (0:kmax-1, 0:kmax-1)
! $ G C^{T} $ ( $ C = \Delta \sigma $ )
real(DP):: zz_siMtxW (0:kmax-1, 0:kmax-1)
! $ W $ .
! 発散の式での線形重力波項の効果による温度補正の係数.
! Coefficient for correction of temperature
! by effort of linear gravitational terms
real(DP):: zz_siMtxQ (0:kmax-1, 0:kmax-1)
! $ Q = \DD{T}{\sigma} $
real(DP):: zz_siMtxS (0:kmax-1, 0:kmax-1)
! $ S = \DD{\sigma}{t} $
real(DP):: zz_siMtxQS (0:kmax-1, 0:kmax-1)
! $ QS $ .
! この変数は $ \sigma $ 移流の効果に相当.
! This variable corresponds to effort of $ \sigma $ advection
real(DP):: zz_siMtxR (0:kmax-1, 0:kmax-1)
! $ R $ .
! 発散と掛け合わせることで気圧変化の効果となる.
! Product R and divergence become effort of
! surface pressure tendency.
! $ RD = \kappa T
! (\DD{\pi}{t} + \Dinv{\sigma}\DD{\sigma}{t}) $ .
integer:: mmax ! 最大東西波数.
! Maximum truncated zonal wavenumber
integer:: lmax ! 最大南北波数.
! Maximum truncated meridional wavenumber
integer:: k, l ! DO ループ用作業変数
! Work variables for DO loop
integer:: size_r_SigmaSet
real(DP), parameter:: invalid_value_r_Sigma = -999.0_DP
! 無効な r_Sigma の値.
! Invalid value of 'r_Sigma'
integer:: insufficient_num_r_Sigma
! NAMELIST ファイルから得られた r_Sigma の
! 不足分データの数.
! Number of insufficient data of 'r_Sigma'
! loaded from NAMELIST file
logical:: nmlfile_valid ! NAMELIST ファイルからの値の妥当性.
! Validity of values from NAMELIST file
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynAS83Create'
continue
call BeginSub(subname, version)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (dyn_as % initialized) then
stat = DCPAM_EALREADYINIT
cause_c = 'DYNAS83'
goto 999
end if
!-----------------------------------------------------------------
! 引数の正当性のチェック
! Validation of arguments
!-----------------------------------------------------------------
if (nmax < 1) then
stat = DCPAM_ENEGATIVE
cause_c = 'nmax'
goto 999
end if
if (imax < 1) then
stat = DCPAM_ENEGATIVE
cause_c = 'imax'
goto 999
end if
if (jmax < 1) then
stat = DCPAM_ENEGATIVE
cause_c = 'jmax'
goto 999
end if
if (kmax < 1) then
stat = DCPAM_ENEGATIVE
cause_c = 'kmax'
goto 999
end if
!-----------------------------------------------------------------
! 波数・格子点の設定
! Configure wave number and grid point
!-----------------------------------------------------------------
dyn_as % nmax = nmax
dyn_as % imax = imax
dyn_as % jmax = jmax
dyn_as % kmax = kmax
!-----------------------------------------------------------------
! 物理定数の設定
! Configure physical constants
!-----------------------------------------------------------------
dyn_as % PI = PI
dyn_as % RPlanet = RPlanet
dyn_as % Omega = Omega
dyn_as % Grav = Grav
dyn_as % Cp = Cp
dyn_as % RAir = RAir
dyn_as % EpsVT = EpsVT
dyn_as % EFoldTime = EFoldTime
dyn_as % DelTime = DelTime
Kappa = RAir / Cp
dyn_as % Kappa = Kappa
!-----------------------------------------------------------------
! コリオリパラメータの設定
! Configure Coriolis parameter
!-----------------------------------------------------------------
allocate( dyn_as % xy_Cori (0:imax-1, 0:jmax-1) )
dyn_as % xy_Cori = xy_Cori
!-----------------------------------------------------------------
! スペクトルの添字順番とラプラシアンの係数の設定
! Configure spectral subscript expression and Laplacian coefficient
!-----------------------------------------------------------------
mmax = dyn_as % nmax
lmax = dyn_as % nmax
allocate( dyn_as % nmo (1:2, 0:mmax, 0:lmax) )
dyn_as % nmo = nmo
allocate( dyn_as % wz_rn ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) )
dyn_as % wz_rn = wz_rn
!-----------------------------------------------------------------
! 運動量水平拡散係数と熱, 水水平拡散係数の設定
! Configure coefficient of horizontal momentum diffusion, and
! coefficient of horizontal thermal and water diffusion
!-----------------------------------------------------------------
allocate( dyn_as % wz_DiffVorDiv ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) )
dyn_as % wz_DiffVorDiv = wz_DiffVorDiv
allocate( dyn_as % wz_DiffTherm ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) )
dyn_as % wz_DiffTherm = wz_DiffTherm
!-------------------------------------------------------------------
! 地形データ (地表 $ \Phi $ ) のスペクトル値の設定
! Configure spectral geography data (surface $ \Phi $ )
!-------------------------------------------------------------------
allocate( dyn_as % w_Phis ((dyn_as%nmax+1)**2) )
if (present(w_Phis)) then
dyn_as % w_Phis = w_Phis
else
dyn_as % w_Phis = 0.0_DP
end if
!-----------------------------------------------------------------
! 鉛直格子点の設定
! Configure values of vertical grid point
!-----------------------------------------------------------------
!-------------------------
! デフォルト値
! Default values
r_Sigma(0:kmax) = invalid_value_r_Sigma
!-------------------------
! NAMELIST からの値
! Values from NAMELIST
nmlfile_valid = .false.
if ( present_and_not_empty(nmlfile) ) then
call MessageNotify( 'M', subname, 'Loading NAMELIST file "%c" ...', c1=trim(nmlfile) )
call NmlRead ( nmlfile = nmlfile, r_Sigma_ = r_Sigma, 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
if ( any( r_Sigma < 0.0_DP ) ) then
insufficient_num_r_Sigma = count( r_Sigma < 0.0_DP )
call MessageNotify( 'W', subname, 'Number of data "%c" from "%c" is "%d" (insufficient). ' // 'Number of grids must be "%d".', c1='r_Sigma', c2=trim(nmlfile), i=(/kmax + 1 - insufficient_num_r_Sigma, kmax + 1/) )
else
nmlfile_valid = .true.
call MessageNotify( 'M', subname, '"%c" is loaded from "%c".', c1='r_Sigma', c2=trim(nmlfile) )
call MessageNotify( 'M', subname, '%c(%d:%d) = %*f', c1='r_Sigma', i=(/0, kmax/), d=r_Sigma, n=(/kmax+1/) )
end if
end if
if ( nmlfile_valid ) then
!-------------------------
! オプショナル引数からの値
! Values from optional arguments
elseif (present(r_SigmaSet)) then
size_r_SigmaSet = size(r_SigmaSet)
if (.not. size_r_SigmaSet == kmax + 1) then
call MessageNotify('W', subname, 'Size of argument r_SigmaSet (%d) is mismatch to kmax + 1 (%d). ' // 'Modify the size of r_SigmaSet to kmax + 1 (%d).', i=(/size_r_SigmaSet, kmax + 1, kmax + 1/))
stat = DCPAM_EARGSIZEMISMATCH
cause_c = 'r_SigmaSet'
goto 999
end if
r_Sigma(0:kmax) = r_SigmaSet
!-------------------------
! 自動設定
! Automatic setting
else
select case (kmax)
case (2)
r_Sigma(0:kmax) = (/ 1.0_DP, 0.63_DP, 0.0_DP /)
case (12)
r_Sigma(0:kmax) = (/ 1.00_DP, 0.99_DP, 0.97_DP, 0.93_DP, 0.85_DP, 0.75_DP, 0.63_DP, 0.50_DP, 0.36_DP, 0.22_DP, 0.10_DP, 0.05_DP, 0.00_DP /)
case (16)
r_Sigma(0:kmax) = (/ 1.00_DP, 0.99_DP, 0.97_DP, 0.93_DP, 0.87_DP, 0.79_DP, 0.70_DP, 0.60_DP, 0.50_DP, 0.41_DP, 0.33_DP, 0.26_DP, 0.20_DP, 0.15_DP, 0.10_DP, 0.05_DP, 0.00_DP /)
case (20)
r_Sigma(0:kmax) = (/ 1.00_DP, 0.95_DP, 0.90_DP, 0.85_DP, 0.80_DP, 0.75_DP, 0.70_DP, 0.65_DP, 0.60_DP, 0.55_DP, 0.50_DP, 0.45_DP, 0.40_DP, 0.35_DP, 0.30_DP, 0.25_DP, 0.20_DP, 0.15_DP, 0.10_DP, 0.05_DP, 0.0_DP /)
case default
call MessageNotify('W', subname, 'Dimensional variable (%c) is auto set when only kmax = %*d. ' // 'Specify the variable explicitly with argument (%c).', i=(/2,12,16,20/), n=(/4/), c1='r_Sigma', c2='r_SigmaSet' )
stat = DCPAM_ENOVARDEF
cause_c = 'r_Sigma'
goto 999
end select
end if
allocate( dyn_as % r_Sigma(0:kmax) )
dyn_as % r_Sigma(0:kmax) = r_Sigma(0:kmax)
do k = 0, kmax - 1
z_DelSigma(k) = r_Sigma(k) - r_Sigma(k+1)
enddo
allocate( dyn_as % z_DelSigma(0:kmax-1) )
dyn_as % z_DelSigma = z_DelSigma
do k = 0, kmax - 1
z_Sigma(k) = ( ( r_Sigma(k) ** ( 1.0_DP + Kappa ) - r_Sigma(k+1) ** ( 1.0_DP + Kappa ) ) / ( z_DelSigma(k) * ( 1.0_DP + Kappa ) ) ) ** ( 1.0_DP / Kappa )
enddo
allocate( dyn_as % z_Sigma(0:kmax - 1) )
dyn_as % z_Sigma = z_Sigma
!-----------------------------------------------------------------
! 静水圧の式の係数 $ \alpha $ , $ \beta $ の計算
! Calculate coefficients $ \alpha $ and $ \beta $ in
! hydrostatic equation.
!-----------------------------------------------------------------
do k = 0, kmax - 1
z_HydroAlpha(k) = ( r_Sigma(k) / z_Sigma(k) ) ** Kappa - 1.0_DP
z_HydroBeta(k) = 1.0_DP - ( r_Sigma(k+1) / z_Sigma(k) ) ** Kappa
enddo
allocate( dyn_as % z_HydroAlpha(0:kmax - 1) )
allocate( dyn_as % z_HydroBeta(0:kmax - 1) )
dyn_as % z_HydroAlpha = z_HydroAlpha
dyn_as % z_HydroBeta = z_HydroBeta
!-----------------------------------------------------------------
! 温度鉛直補間の係数 $ \kappa $, $ a $ , $ b $ の計算
! Calculate coefficients $ \kappa $, $ a $ , $ b $
! for interpolation of temperature
!-----------------------------------------------------------------
do k = 0, kmax - 1
z_TempInpolKappa(k) = ( r_Sigma(k) * z_HydroAlpha(k) + r_Sigma(k+1) * z_HydroBeta(k) ) / z_DelSigma(k)
enddo
z_TempInpolA = 0.0_DP
do k = 1, kmax - 1
z_TempInpolA(k) = z_HydroAlpha(k) / ( 1.0_DP - (z_Sigma(k) / z_Sigma(k-1)) ** Kappa )
end do
z_TempInpolB = 0.0_DP
do k = 0, kmax - 2
z_TempInpolB(k) = z_HydroBeta(k) / ( (z_Sigma(k) / z_Sigma(k+1) ) ** Kappa - 1.0_DP )
end do
allocate( dyn_as % z_TempInpolKappa(0:kmax - 1) )
allocate( dyn_as % z_TempInpolA(0:kmax - 1) )
allocate( dyn_as % z_TempInpolB(0:kmax - 1) )
dyn_as % z_TempInpolKappa = z_TempInpolKappa
dyn_as % z_TempInpolA = z_TempInpolA
dyn_as % z_TempInpolB = z_TempInpolB
!-----------------------------------------------------------------
! 平均温度 (整数レベル、半整数レベル) の計算
! Calculate average temperature about level and half level.
!-----------------------------------------------------------------
z_TempAvrXY = 300.0_DP
r_TempAvrXY = 0.0_DP
do k = 1, kmax - 1
r_TempAvrXY(k) = z_TempInpolA(k) * z_TempAvrXY(k) + z_TempInpolB(k-1) * z_TempAvrXY(k-1)
enddo
allocate( dyn_as % z_TempAvrXY(0:kmax - 1) )
allocate( dyn_as % r_TempAvrXY(0:kmax) )
dyn_as % z_TempAvrXY = z_TempAvrXY
dyn_as % r_TempAvrXY = r_TempAvrXY
!-----------------------------------------------------------------
! セミインプリシット法のための行列の計算
! Calculate matrices for semi-implicit method
!-----------------------------------------------------------------
z_siMtxG = Cp * z_TempInpolKappa * z_TempAvrXY
do k = 0, kmax - 1
do l = 0, kmax - 1
zz_siMtxGCt(k, l) = z_siMtxG(k) * z_DelSigma(l)
end do
end do
zz_siMtxW = 0.0_DP
do k = 0, kmax - 1
do l = 0, k
zz_siMtxW(k, l) = Cp * z_HydroAlpha(l)
enddo
do l = 0, k - 1
zz_siMtxW(k, l) = zz_siMtxW(k, l) + Cp * z_HydroBeta(l)
enddo
enddo
zz_siMtxS = 0.0_DP
do k = 0, kmax - 1
do l = 0, kmax - 1
zz_siMtxS(k,l) = r_Sigma(k) * z_DelSigma(l)
enddo
do l = k, kmax - 1
zz_siMtxS(k,l) = zz_siMtxS(k,l) - z_DelSigma(l)
enddo
enddo
zz_siMtxQ = 0.0_DP
do k = 0, kmax - 1
zz_siMtxQ(k,k) = ( r_TempAvrXY(k) - z_TempAvrXY(k) ) / z_DelSigma(k)
enddo
do k = 0, kmax - 2
zz_siMtxQ(k,k+1) = ( z_TempAvrXY(k) - r_TempAvrXY(k+1) ) / z_DelSigma(k)
enddo
zz_siMtxQS = 0.0_DP
zz_siMtxQS = matmul(zz_siMtxQ, zz_siMtxS)
zz_siMtxR = 0.0_DP
do k = 0, kmax
do l = k, kmax - 1
zz_siMtxR(k,l) = - z_HydroAlpha(k) / z_DelSigma(k) * z_DelSigma(l) * z_TempAvrXY(k)
enddo
do l = k + 1, kmax - 1
zz_siMtxR(k,l) = zz_siMtxR(k,l) - z_HydroBeta(k) / z_DelSigma(k) * z_DelSigma(l) * z_TempAvrXY(k)
enddo
enddo
zz_siMtxH = 0.0_DP
zz_siMtxH = zz_siMtxQS - zz_siMtxR
zz_siMtxWH = 0.0_DP
zz_siMtxWH = matmul(zz_siMtxW, zz_siMtxH)
allocate( dyn_as % z_siMtxG(0: kmax - 1) )
allocate( dyn_as % zz_siMtxH(0: kmax - 1, 0: kmax - 1) )
allocate( dyn_as % zz_siMtxWH(0: kmax - 1, 0: kmax - 1) )
allocate( dyn_as % zz_siMtxGCt(0: kmax - 1, 0: kmax - 1) )
dyn_as % z_siMtxG = z_siMtxG
dyn_as % zz_siMtxH = zz_siMtxH
dyn_as % zz_siMtxWH = zz_siMtxWH
dyn_as % zz_siMtxGCt = zz_siMtxGCt
!-----------------------------------------------------------------
! セミインプリシット時間積分用行列の計算
! Calculate matrixes for semi-implicit time integration
!-----------------------------------------------------------------
call Create( dyn_mtx = dyn_as % dyn_mtx, nmax = dyn_as % nmax, kmax = dyn_as % kmax, nmo = dyn_as % nmo, RPlanet = dyn_as % RPlanet, DelTime = dyn_as % DelTime, zz_siMtxWH = dyn_as % zz_siMtxWH, zz_siMtxGCt = dyn_as % zz_siMtxGCt, w_DiffVorDiv = dyn_as % wz_DiffVorDiv(:,0), w_DiffTherm = dyn_as % wz_DiffTherm(:,0) ) ! (in)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
dyn_as % initialized = .true.
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynAS83Create
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| z_Sigma(0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| r_Sigma(0:dyn_as%kmax) : | real(DP), intent(out)
| ||
| z_DelSigma(0:dyn_as%kmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
dyn_as に格納されている座標値を返します.
なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return data of axes stored in dyn_sp.
If dyn_as is not initialized by Create yet, error is occurred.
subroutine DynAS83GetAxes( dyn_as, z_Sigma, r_Sigma, z_DelSigma, err )
!
! *dyn_as* に格納されている座標値を返します.
!
! なお, 与えられた *dyn_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Return data of axes stored in *dyn_sp*.
!
! If *dyn_as* is not initialized by Create yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
implicit none
type(DYNAS83), intent(inout):: dyn_as
real(DP), intent(out):: z_Sigma (0:dyn_as%kmax-1)
! $ \sigma $ レベル (整数).
! Full $ \sigma $ level
real(DP), intent(out):: r_Sigma (0:dyn_as%kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
real(DP), intent(out), optional:: z_DelSigma (0:dyn_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 = 'DynAS83GetAxes'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNAS83'
goto 999
end if
!-----------------------------------------------------------------
! $ \sigma $ (整数, 半整数) レベルの設定
! Configure full and half $ \sigma $ level data
!-----------------------------------------------------------------
z_Sigma = dyn_as % z_Sigma
r_Sigma = dyn_as % r_Sigma
!-----------------------------------------------------------------
! $ \Delta \sigma $ (整数) の設定
! Configure $ \Delta \sigma $ (Full)
!-----------------------------------------------------------------
if (present(z_DelSigma)) z_DelSigma = dyn_as % z_DelSigma
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynAS83GetAxes
| Function : | |
| result : | logical |
| dyn_as : | type(DYNAS83), intent(in) |
dyn_as が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If dyn_as is initialized, .true. is returned. If dyn_as is not initialized, .false. is returned.
logical function DynAS83Initialized( dyn_as ) result(result)
!
! *dyn_as* が初期設定されている場合には .true. が,
! 初期設定されていない場合には .false. が返ります.
!
! If *dyn_as* is initialized, .true. is returned.
! If *dyn_as* is not initialized, .false. is returned.
!
implicit none
type(DYNAS83), intent(in):: dyn_as
continue
result = dyn_as % initialized
end function DynAS83Initialized
| Subroutine : | |||
| nmlfile : | character(*), intent(in)
| ||
| r_Sigma_(:) : | real(DP), intent(inout) | ||
| 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_as83_nml .
subroutine DynAS83NmlRead( nmlfile, r_Sigma_, 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_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_error, only: DC_NOERR, DC_ENOFILEREAD
use dcpam_error, only: StoreError, DCPAM_ENMLARRAYINSUFF
implicit none
character(*), intent(in):: nmlfile
! NAMELIST ファイルの名称.
! NAMELIST file name
real(DP), intent(inout):: r_Sigma_ (:)
integer, parameter:: size_r_Sigma = 256
real(DP):: r_Sigma (1:size_r_Sigma)
! $ \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.
namelist /dyn_as83_nml/ r_Sigma
! dyn_as83 モジュール用
! NAMELIST 変数群名.
!
! NAMELIST group name for
! 'dyn_as83' module.
!-----------------------------------
! 作業変数
! Work variables
integer:: size_r_Sigma_
real(DP), parameter:: invalid_value_r_Sigma = -999.0_DP
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(*), parameter:: subname = 'DynAS83NmlRead'
continue
call BeginSub( subname )
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 文字型引数を NAMELIST 変数群へ代入
! Substitute character arguments to NAMELIST group
!-----------------------------------------------------------------
!-----------------------------------------------------------------
! 無効なデフォルト値を NAMELIST 変数群へ代入
! Substitute invalid default values to NAMELIST group
!-----------------------------------------------------------------
r_Sigma = invalid_value_r_Sigma
!----------------------------------------------------------------
! 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
!-----------------------------------------------------------------
read( unit = unit_nml, nml = dyn_as83_nml, iostat = iostat_nml ) ! (out)
if ( iostat_nml == 0 ) then
call MessageNotify( 'M', subname, 'NAMELIST group "%c" is loaded from "%c".', c1='dyn_as83_nml', c2=trim(nmlfile) )
! write(STDOUT, nml = dyn_as83_nml) ! Size of r_Sigma is too large.
else
call MessageNotify( 'W', subname, 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', c1='dyn_as83_nml', c2=trim(nmlfile), i=(/iostat_nml/) )
end if
close( unit_nml )
if ( all( r_Sigma > - 1.0_DP ) ) then
call MessageNotify( 'W', subname, 'Array size of "%c" from "%c" exceeds prepared size "%d". ' // 'Edit "%c" manually.', c1='r_Sigma', c2=trim(nmlfile), c3='size_r_Sigma', i=(/size_r_Sigma/) )
stat = DCPAM_ENMLARRAYINSUFF
cause_c = 'r_Sigma'
goto 999
end if
!-----------------------------------------------------------------
! NAMELIST 変数群を文字型引数へ代入
! Substitute NAMELIST group to character arguments
!-----------------------------------------------------------------
!-----------------------------------------------------------------
! NAMELIST 変数群を引数へ代入
! Substitute NAMELIST group to arguments
!-----------------------------------------------------------------
size_r_Sigma_ = size( r_Sigma_ )
r_Sigma_ = r_Sigma(1:size_r_Sigma_)
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError( stat, subname, err, cause_c )
call EndSub( subname )
end subroutine DynAS83NmlRead
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| xyz_U(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_V(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Vor(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Div(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_Temp(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xyz_QVap(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| xy_GradLonPi(0:dyn_as%imax-1, 0:dyn_as%jmax-1) : | real(DP), intent(in)
| ||
| xy_GradLatPi(0:dyn_as%imax-1, 0:dyn_as%jmax-1) : | real(DP), intent(in)
| ||
| xyz_UAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_VAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_DTempDt(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_DQVapDt(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_KE(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_TempUAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_TempVAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xy_DPiDt(0:dyn_as%imax-1, 0:dyn_as%jmax-1) : | real(DP), intent(out)
| ||
| xyz_QVapUAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| xyz_QVapVAdv(0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| err : | logical, intent(out), optional
|
非線形項 (非重力波項) を格子点上で計算します.
なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Non-linear terms (non gravitational terms) are calculated on grid points
If dyn_as is not initialized by Create yet, error is occurred.
subroutine DynAS83NonLinearOnGrid( dyn_as, xyz_U, xyz_V, xyz_Vor, xyz_Div, xyz_Temp, xyz_QVap, xy_GradLonPi, xy_GradLatPi, xyz_UAdv, xyz_VAdv, xyz_DTempDt, xyz_DQVapDt, xyz_KE, xyz_TempUAdv, xyz_TempVAdv, xy_DPiDt, xyz_QVapUAdv, xyz_QVapVAdv, err )
!
! 非線形項 (非重力波項) を格子点上で計算します.
!
! なお, 与えられた *dyn_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Non-linear terms (non gravitational terms) are calculated on
! grid points
!
! If *dyn_as* is not initialized by Create yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
implicit none
type(DYNAS83), intent(inout):: dyn_as
real(DP), intent(in):: xyz_U (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ U $ . 東西風速. Zonal wind
real(DP), intent(in):: xyz_V (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ V $ . 南北風速. Meridional wind
real(DP), intent(in):: xyz_Vor (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ \zeta $ . 渦度. Vorticity
real(DP), intent(in):: xyz_Div (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ D $ . 発散. Divergence
real(DP), intent(in):: xyz_Temp (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ T $ . 温度. Temperature
real(DP), intent(in):: xyz_QVap (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ q $ . 比湿. Specific humidity
real(DP), intent(in):: xy_GradLonPi (0:dyn_as%imax-1, 0:dyn_as%jmax-1)
! $ \DD{\pi}{x} $
real(DP), intent(in):: xy_GradLatPi (0:dyn_as%imax-1, 0:dyn_as%jmax-1)
! $ \DD{\pi}{y} $
real(DP), intent(out):: xyz_UAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ UA $ . 東西運動量移流項.
! Zonal advection of momentum
real(DP), intent(out):: xyz_VAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ VA $ . 南北運動量移流項.
! Meridional advection of momentum
real(DP), intent(out):: xyz_DTempDt (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ H $ . 温度時間変化項.
! Temperature tendency
real(DP), intent(out):: xyz_DQVapDt (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ R $ . 比湿時間変化項.
! Specific humidity tendency
real(DP), intent(out):: xyz_KE (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ E $ . 運動エネルギー項.
! Kinematic energy
real(DP), intent(out):: xyz_TempUAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ UT $ . 温度東西移流項.
! Zonal advection of temperature
real(DP), intent(out):: xyz_TempVAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ VT $ . 温度南北移流項.
! Meridional advection of temperature
real(DP), intent(out):: xy_DPiDt (0:dyn_as%imax-1, 0:dyn_as%jmax-1)
! $ Z $ . 地表面気圧時間変化項.
! Surface pressure tendency
real(DP), intent(out):: xyz_QVapUAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ Uq $ . 比湿東西移流項.
! Zonal advection of specific humidity
real(DP), intent(out):: xyz_QVapVAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ Vq $ . 比湿南北移流項.
! Meridional advection of specific humidity
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:: kmax ! 鉛直層数.
! Number of vertical level
real(DP):: r_Sigma (0:dyn_as%kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
real(DP):: z_DelSigma (0:dyn_as%kmax-1)
! $ \Delta \sigma $ (整数).
! $ \Delta \sigma $ (Full)
real(DP):: RPlanet ! $ a $ . 惑星半径. Radius of planet
real(DP):: EpsVT ! $ 1/\epsilon_v - 1 $ .
real(DP):: Cp ! $ C_p $ . 大気定圧比熱. Specific heat of air at constant pressure
real(DP):: xy_Cori (0:dyn_as%imax-1, 0:dyn_as%jmax-1)
! $ f\equiv 2\Omega\sin\varphi $ .
! コリオリパラメータ. Coriolis parameter
real(DP):: z_TempAvrXY (0:dyn_as%kmax-1)
! 平均温度 (整数レベル).
! Average temperature on full sigma level
real(DP):: r_TempAvrXY (0:dyn_as%kmax)
! 平均温度 (半整数レベル).
! Average temperature on half sigma level
real(DP):: z_TempInpolA (0:dyn_as%kmax-1)
! $ a $ . 温度鉛直補間の係数.
! Coefficient for vertical interpolation of temperature
real(DP):: z_TempInpolB (0:dyn_as%kmax-1)
! $ b $ . 温度鉛直補間の係数.
! Coefficient for vertical interpolation of temperature
real(DP):: z_TempInpolKappa (0:dyn_as%kmax-1)
! $ \kappa $ . 温度鉛直補間の係数.
! Coefficient for vertical interpolation of temperature
real(DP):: z_HydroAlpha (0:dyn_as%kmax-1)
! $ \alpha $ . 静水圧の式の係数.
! Coefficient in hydrostatic equation.
real(DP):: z_HydroBeta (0:dyn_as%kmax-1)
! $ \beta $ . 静水圧の式の係数.
! Coefficient in hydrostatic equation.
real(DP):: xyz_PiAdv (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ \Dvect{v} \cdot \nabla \pi $ .
! $ \pi $ の移流. Advection of $ \pi $
real(DP):: xyz_PiAdvSum (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ \sum_k^K(\Dvect{v}\cdot\nabla\pi)\Delta\sigma $ .
! $ \pi $ 移流の積下げ. Integral downward of advection of $ \pi $
real(DP):: xyz_DivSum (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ \sum_k^K D\Delta\sigma $ .
! 発散の積下げ. Integral downward of divergence
real(DP):: xyr_SigmaDot (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax)
! $ \dot{\sigma} $ .
! 鉛直流. Vertical flow
real(DP):: xyr_SigmaDotNonGrav (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax)
! $ \dot{\sigma} $ .
! 鉛直流 (非重力波). Vertical flow (non gravitational)
real(DP):: xyz_TempEdd (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ T' = T - \bar{T} $ .
! 温度の擾乱 (整数レベル). Temperature eddy (full level)
real(DP):: xyr_TempEdd (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax)
! $ \hat{T}' $ .
! 温度の擾乱 (半整数レベル). Temperature eddy (half level)
real(DP):: xyz_TempVir (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ T_v $ .
! 仮温度. Virtual temperature
real(DP):: xyz_TempVirEdd (0:dyn_as%imax-1, 0:dyn_as%jmax-1, 0:dyn_as%kmax-1)
! $ {T_v}' = T_v - \bar{T} $ .
! 仮温度の擾乱. Virtual temperature eddy
integer:: k ! DO ループ用作業変数
! Work variables for DO loop
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynAS83NonLinearOnGrid'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNAS83'
goto 999
end if
!-----------------------------------------------------------------
! *dyn_as* に格納される座標情報, 物理定数の取り出し
! Fetch coordinate information and physical constants from *dyn_as*
!-----------------------------------------------------------------
kmax = dyn_as % kmax
r_Sigma = dyn_as % r_Sigma
z_DelSigma = dyn_as % z_DelSigma
RPlanet = dyn_as % RPlanet
EpsVT = dyn_as % EpsVT
Cp = dyn_as % Cp
xy_Cori = dyn_as % xy_Cori
z_TempAvrXY = dyn_as % z_TempAvrXY
r_TempAvrXY = dyn_as % r_TempAvrXY
z_TempInpolA = dyn_as % z_TempInpolA
z_TempInpolB = dyn_as % z_TempInpolB
z_TempInpolKappa = dyn_as % z_TempInpolKappa
z_HydroAlpha = dyn_as % z_HydroAlpha
z_HydroBeta = dyn_as % z_HydroBeta
!-----------------------------------------------------------------
! $ \pi $ の移流, $ \pi $ 移流の積下げ, 発散の積下げの計算
! Calculate advection of $ \pi $, integral downward of advection
! of $ \pi $, integral downward of divergence
!-----------------------------------------------------------------
do k = 0, kmax-1
xyz_PiAdv(:,:,k) = ( xyz_U(:,:,k) * xy_GradLonPi + xyz_V(:,:,k) * xy_GradLatPi ) / RPlanet
enddo
xyz_PiAdvSum(:,:,kmax-1) = xyz_PiAdv(:,:,kmax-1) * z_DelSigma(kmax-1)
do k = kmax-2, 0, -1
xyz_PiAdvSum(:,:,k) = xyz_PiAdvSum(:,:,k+1) + xyz_PiAdv(:,:,k) * z_DelSigma(k)
enddo
xyz_DivSum(:,:,kmax-1) = xyz_Div(:,:,kmax-1) * z_DelSigma(kmax-1)
do k = kmax-2, 0, -1
xyz_DivSum(:,:,k) = xyz_DivSum(:,:,k+1) + xyz_Div(:,:,k) * z_DelSigma(k)
enddo
!-----------------------------------------------------------------
! 地表面気圧時間変化項 $ Z $ の計算
! Calculate surface pressure tendency $ Z $
!-----------------------------------------------------------------
xy_DPiDt = - xyz_PiAdvSum(:,:,0)
!-------------------------------------------------------------------
! $ \dot{\sigma} $ の計算
! Calculate $ \dot{\sigma} $
!-------------------------------------------------------------------
do k = 1, kmax-1
xyr_SigmaDot(:,:,k) = r_Sigma(k) * ( xyz_PiAdvSum(:,:,0) + xyz_DivSum(:,:,0) ) - ( xyz_PiAdvSum(:,:,k) + xyz_DivSum(:,:,k) )
xyr_SigmaDotNonGrav(:,:,k) = r_Sigma(k) * xyz_PiAdvSum(:,:,0) - xyz_PiAdvSum(:,:,k)
enddo
! 上下境界値
! On upper and lower boundary
xyr_SigmaDot(:,:,0) = 0.0_DP
xyr_SigmaDot(:,:,kmax) = 0.0_DP
xyr_SigmaDotNonGrav(:,:,0) = 0.0_DP
xyr_SigmaDotNonGrav(:,:,kmax) = 0.0_DP
!-------------------------------------------------------------------
! 温度の擾乱 (整数レベル), 仮温度, 仮温度の擾乱の計算
! Calculate temperature eddy (full level), virtual temperature,
! virtual temperature eddy
!-------------------------------------------------------------------
do k = 0, kmax-1
xyz_TempVir(:,:,k) = xyz_Temp(:,:,k) * ( 1.0_DP + ( EpsVT * xyz_QVap(:,:,k) ) )
xyz_TempEdd(:,:,k) = xyz_Temp(:,:,k) - z_TempAvrXY(k)
xyz_TempVirEdd(:,:,k) = xyz_TempVir(:,:,k) - z_TempAvrXY(k)
enddo
!-------------------------------------------------------------------
! 温度の擾乱 (半整数レベル) の計算
! Calculate temperature eddy (half level)
!-------------------------------------------------------------------
xyr_TempEdd(:,:,0) = 0.0_DP
xyr_TempEdd(:,:,kmax) = 0.0_DP
do k = 1, kmax-1
xyr_TempEdd(:,:,k) = z_TempInpolA(k) * xyz_Temp(:,:,k) + z_TempInpolB(k-1) * xyz_Temp(:,:,k-1) - r_TempAvrXY(k)
enddo
!-----------------------------------------------------------------
! 東西運動量移流項, 南北運動量移流項の計算
! Calculate advection of zonal momentum and meridional momentum
!-----------------------------------------------------------------
do k = 0, kmax-1
xyz_UAdv(:,:,k) = ( xyz_Vor(:,:,k) + xy_Cori ) * xyz_V(:,:,k) - Cp * z_TempInpolKappa(k) * xyz_TempVirEdd(:,:,k) * xy_GradLonPi / RPlanet
xyz_VAdv(:,:,k) = - ( xyz_Vor(:,:,k) + xy_Cori ) * xyz_U(:,:,k) - Cp * z_TempInpolKappa(k) * xyz_TempVirEdd(:,:,k) * xy_GradLatPi / RPlanet
end do
do k = 1, kmax-1
xyz_UAdv(:,:,k) = xyz_UAdv(:,:,k) - 1.0_DP / ( 2.0_DP * z_DelSigma(k) ) * xyr_SigmaDot(:,:,k) * ( xyz_U(:,:,k-1) - xyz_U(:,:,k) )
xyz_VAdv(:,:,k) = xyz_VAdv(:,:,k) - 1.0_DP / ( 2.0_DP * z_DelSigma(k) ) * xyr_SigmaDot(:,:,k) * ( xyz_V(:,:,k-1) - xyz_V(:,:,k) )
end do
do k = 0, kmax-2
xyz_UAdv(:,:,k) = xyz_UAdv(:,:,k) - 1.0_DP / ( 2.0_DP * z_DelSigma(k) ) * xyr_SigmaDot(:,:,k+1) * ( xyz_U(:,:,k) - xyz_U(:,:,k+1) )
xyz_VAdv(:,:,k) = xyz_VAdv(:,:,k) - 1.0_DP / ( 2.0_DP * z_DelSigma(k) ) * xyr_SigmaDot(:,:,k+1) * ( xyz_V(:,:,k) - xyz_V(:,:,k+1) )
end do
!-------------------------------------------------------------------
! 運動エネルギー項 (仮温度補正含む) の計算
! Calculate kinematic energy term
! (including virtual temperature correction)
!-------------------------------------------------------------------
xyz_KE = 0.0_DP
xyz_KE(:,:,0) = Cp * z_HydroAlpha(0) * ( xyz_TempVir(:,:,0) - xyz_Temp(:,:,0) )
do k = 1, kmax-1
xyz_KE(:,:,k) = xyz_KE(:,:,k-1) + Cp * z_HydroAlpha(k) * ( xyz_TempVir(:,:,k) - xyz_Temp(:,:,k) ) + Cp * z_HydroBeta(k-1) * ( xyz_TempVir(:,:,k-1) - xyz_Temp(:,:,k-1) )
enddo
xyz_KE = xyz_KE + ( xyz_U**2 + xyz_V**2 ) / 2.0_DP
!-------------------------------------------------------------------
! 温度東西移流項, 温度南北移流項の計算
! Calculate zonal and meridional advection of temperature
!-------------------------------------------------------------------
do k = 0, kmax-1
xyz_TempUAdv(:,:,k) = xyz_U(:,:,k) * xyz_TempEdd(:,:,k)
xyz_TempVAdv(:,:,k) = xyz_V(:,:,k) * xyz_TempEdd(:,:,k)
end do
!-------------------------------------------------------------------
! 温度の時間変化項 $ H $ の計算
! Calculate temperature tendency term $ H $
!-------------------------------------------------------------------
do k = 0, kmax-1
xyz_DTempDt(:,:,k) = xyz_TempEdd(:,:,k) * xyz_Div(:,:,k) + z_TempInpolKappa(k) * xyz_TempVir(:,:,k) * xyz_PiAdv(:,:,k) - z_HydroAlpha(k) / z_DelSigma(k) * ( xyz_TempVir(:,:,k) * xyz_PiAdvSum(:,:,k) + xyz_TempVirEdd(:,:,k) * xyz_DivSum(:,:,k) )
enddo
do k = 1, kmax-1
xyz_DTempDt(:,:,k) = xyz_DTempDt(:,:,k) - xyr_SigmaDot(:,:,k) / z_DelSigma(k) * ( xyr_TempEdd(:,:,k) - xyz_TempEdd(:,:,k) ) - xyr_SigmaDotNonGrav(:,:,k) / z_DelSigma(k) * ( r_TempAvrXY(k) - z_TempAvrXY(k) )
enddo
do k = 0, kmax-2
xyz_DTempDt(:,:,k) = xyz_DTempDt(:,:,k) - xyr_SigmaDot(:,:,k+1) / z_DelSigma(k) * ( xyz_TempEdd(:,:,k) - xyr_TempEdd(:,:,k+1) ) - xyr_SigmaDotNonGrav(:,:,k+1) / z_DelSigma(k) * ( z_TempAvrXY(k) - r_TempAvrXY(k+1) ) - z_HydroBeta(k) / z_DelSigma(k) * ( xyz_TempVir(:,:,k) * xyz_PiAdvSum(:,:,k+1) + xyz_TempVirEdd(:,:,k) * xyz_DivSum(:,:,k+1) )
enddo
!-------------------------------------------------------------------
! 比湿東西移流項, 比湿南北移流項の計算
! Calculate zonal and meridional advection of specific humidity
!-------------------------------------------------------------------
do k = 0, kmax-1
xyz_QVapUAdv(:,:,k) = xyz_U(:,:,k) * xyz_QVap(:,:,k)
xyz_QVapVAdv(:,:,k) = xyz_V(:,:,k) * xyz_QVap(:,:,k)
end do
!-------------------------------------------------------------------
! 比湿時間変化項 $ R $ の計算
! Calculate specific humidity tendency $ R $
!-------------------------------------------------------------------
xyz_DQVapDt = xyz_QVap * xyz_Div
do k = 1, kmax-1
xyz_DQVapDt(:,:,k) = xyz_DQVapDt(:,:,k) - xyr_SigmaDot(:,:,k) / ( 2.0_DP * z_DelSigma(k) ) * ( xyz_QVap(:,:,k-1) - xyz_QVap(:,:,k) )
enddo
do k = 0, kmax-2
xyz_DQVapDt(:,:,k) = xyz_DQVapDt(:,:,k) - xyr_SigmaDot(:,:,k+1) / ( 2.0_DP * z_DelSigma(k) ) * ( xyz_QVap(:,:,k) - xyz_QVap(:,:,k+1) )
enddo
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynAS83NonLinearOnGrid
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(in) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 dyn_as 内の情報を印字します. デフォルトでは標準出力に印字します. unit に装置番号を していすることで, 出力先を変更することが可能です.
Print information of dyn_as. By default messages are output to standard output. Unit number for output can be changed by unit argument.
subroutine DynAS83PutLine( dyn_as, unit, indent, err )
!
! 引数 *dyn_as* 内の情報を印字します.
! デフォルトでは標準出力に印字します. *unit* に装置番号を
! していすることで, 出力先を変更することが可能です.
!
! Print information of *dyn_as*.
! By default messages are output to standard output.
! Unit number for output can be changed by *unit* argument.
!
use dc_types, only: STRING, STDOUT
use dc_date, only: toChar
use dc_trace, only: BeginSub, EndSub
use dc_string, only: Printf
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_matrix, only: PutLine
implicit none
type(DYNAS83), intent(in):: dyn_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.
integer:: stat
integer:: out_unit
character(STRING):: cause_c
integer:: indent_len
character(STRING):: indent_str
!!$ integer:: xy_minpos(1:2), xy_maxpos(1:2)
!!$ integer:: xy_lbound(1:2), xy_ubound(1:2)
!!$ integer:: wz_minpos(1:2), wz_maxpos(1:2)
!!$ integer:: wz_lbound(1:2), wz_ubound(1:2)
character(len = *), parameter:: subname = 'DynAS83PutLine'
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
!-----------------------------------------------------------------
! "DYNAS83" の設定の印字
! Print the settings for "DYNAS83"
!-----------------------------------------------------------------
if (dyn_as % initialized) then
call Printf(out_unit, indent_str(1:indent_len) // '#<DYNAS83:: @initialized=%y @nmax=%d @imax=%d @jmax=%d @kmax=%d', i=(/dyn_as % nmax, dyn_as % imax, dyn_as % jmax, dyn_as % kmax/), l=(/dyn_as % initialized/))
call Printf(out_unit, indent_str(1:indent_len) // ' @PI=%f @RPlanet=%f @Omega=%f @Grav=%f', d=(/dyn_as % PI, dyn_as % RPlanet, dyn_as % Omega, dyn_as % Grav/))
call Printf(out_unit, indent_str(1:indent_len) // ' @Cp=%f @RAir=%f @EpsVT=%f @Kappa=%f', d=(/dyn_as % Cp, dyn_as % RAir, dyn_as % EpsVT, dyn_as % Kappa/))
call Printf(out_unit, indent_str(1:indent_len) // ' @EFoldTime=%f @DelTime=%f', d=(/dyn_as % EFoldTime, dyn_as % DelTime/))
call PutLine(dyn_as % dyn_mtx, out_unit, indent_str(1:indent_len) // ' ', err)
!!$ xy_lbound = lbound(dyn_as % xy_Cori)
!!$ xy_ubound = ubound(dyn_as % xy_Cori)
!!$ xy_minpos = minloc(dyn_as % xy_Cori)
!!$ xy_maxpos = maxloc(dyn_as % xy_Cori)
!!$
!!$ xy_minpos(1) = xy_minpos(1) + xy_lbound(1) - 1
!!$ xy_minpos(2) = xy_minpos(2) + xy_lbound(2) - 1
!!$ xy_maxpos(1) = xy_maxpos(1) + xy_lbound(1) - 1
!!$ xy_maxpos(2) = xy_maxpos(2) + xy_lbound(2) - 1
!!$
!!$ call Printf(out_unit, &
!!$ & ' @xy_Cori(%d,%d)=%f .. xy_Cori(%d,%d)=%f, ' // &
!!$ & '[min:xy_Cori(%d,%d)=%f, max:xy_Cori(%d,%d)=%f]', &
!!$ & i=(/xy_lbound(1), xy_lbound(2), xy_ubound(1), xy_ubound(2), &
!!$ & xy_minpos(1), xy_minpos(2), xy_maxpos(1), xy_maxpos(2)/), &
!!$ & d=(/dyn_as % xy_Cori(xy_lbound(1), xy_lbound(2)), &
!!$ & dyn_as % xy_Cori(xy_ubound(1), xy_ubound(2)), &
!!$ & dyn_as % xy_Cori(xy_minpos(1), xy_minpos(2)), &
!!$ & dyn_as % xy_Cori(xy_maxpos(1), xy_maxpos(2))/))
!!$
!!$ xy_lbound = lbound(dyn_as % xy_UVFact)
!!$ xy_ubound = ubound(dyn_as % xy_UVFact)
!!$ xy_minpos = minloc(dyn_as % xy_UVFact)
!!$ xy_maxpos = maxloc(dyn_as % xy_UVFact)
!!$
!!$ xy_minpos(1) = xy_minpos(1) + xy_lbound(1) - 1
!!$ xy_minpos(2) = xy_minpos(2) + xy_lbound(2) - 1
!!$ xy_maxpos(1) = xy_maxpos(1) + xy_lbound(1) - 1
!!$ xy_maxpos(2) = xy_maxpos(2) + xy_lbound(2) - 1
!!$
!!$ call Printf(out_unit, &
!!$ & ' @xy_UVFact(%d,%d)=%f .. xy_UVFact(%d,%d)=%f, ' // &
!!$ & '[min:xy_UVFact(%d,%d)=%f, max:xy_UVFact(%d,%d)=%f]', &
!!$ & i=(/xy_lbound(1), xy_lbound(2), xy_ubound(1), xy_ubound(2), &
!!$ & xy_minpos(1), xy_minpos(2), xy_maxpos(1), xy_maxpos(2)/), &
!!$ & d=(/dyn_as % xy_UVFact(xy_lbound(1), xy_lbound(2)), &
!!$ & dyn_as % xy_UVFact(xy_ubound(1), xy_ubound(2)), &
!!$ & dyn_as % xy_UVFact(xy_minpos(1), xy_minpos(2)), &
!!$ & dyn_as % xy_UVFact(xy_maxpos(1), xy_maxpos(2))/))
!!$
!!$
!!$ wz_lbound = lbound(dyn_as % wz_DiffVorDiv)
!!$ wz_ubound = ubound(dyn_as % wz_DiffVorDiv)
!!$ wz_minpos = minloc(dyn_as % wz_DiffVorDiv)
!!$ wz_maxpos = maxloc(dyn_as % wz_DiffVorDiv)
!!$
!!$ wz_minpos(1) = wz_minpos(1) + wz_lbound(1) - 1
!!$ wz_minpos(2) = wz_minpos(2) + wz_lbound(2) - 1
!!$ wz_maxpos(1) = wz_maxpos(1) + wz_lbound(1) - 1
!!$ wz_maxpos(2) = wz_maxpos(2) + wz_lbound(2) - 1
!!$
!!$ call Printf(out_unit, &
!!$ & ' @wz_DiffVorDiv(%d,%d)=%f .. wz_DiffVorDiv(%d,%d)=%f, ' // &
!!$ & '[min:wz_DiffVorDiv(%d,%d)=%f, max:wz_DiffVorDiv(%d,%d)=%f]', &
!!$ & i=(/wz_lbound(1), wz_lbound(2), wz_ubound(1), wz_ubound(2), &
!!$ & wz_minpos(1), wz_minpos(2), wz_maxpos(1), wz_maxpos(2)/), &
!!$ & d=(/dyn_as % wz_DiffVorDiv(wz_lbound(1), wz_lbound(2)), &
!!$ & dyn_as % wz_DiffVorDiv(wz_ubound(1), wz_ubound(2)), &
!!$ & dyn_as % wz_DiffVorDiv(wz_minpos(1), wz_minpos(2)), &
!!$ & dyn_as % wz_DiffVorDiv(wz_maxpos(1), wz_maxpos(2))/))
!!$
!!$
!!$ wz_lbound = lbound(dyn_as % wz_DiffTherm)
!!$ wz_ubound = ubound(dyn_as % wz_DiffTherm)
!!$ wz_minpos = minloc(dyn_as % wz_DiffTherm)
!!$ wz_maxpos = maxloc(dyn_as % wz_DiffTherm)
!!$
!!$ wz_minpos(1) = wz_minpos(1) + wz_lbound(1) - 1
!!$ wz_minpos(2) = wz_minpos(2) + wz_lbound(2) - 1
!!$ wz_maxpos(1) = wz_maxpos(1) + wz_lbound(1) - 1
!!$ wz_maxpos(2) = wz_maxpos(2) + wz_lbound(2) - 1
!!$
!!$ call Printf(out_unit, &
!!$ & ' @wz_DiffTherm(%d,%d)=%f .. wz_DiffTherm(%d,%d)=%f, ' // &
!!$ & '[min:wz_DiffTherm(%d,%d)=%f, max:wz_DiffTherm(%d,%d)=%f]', &
!!$ & i=(/wz_lbound(1), wz_lbound(2), wz_ubound(1), wz_ubound(2), &
!!$ & wz_minpos(1), wz_minpos(2), wz_maxpos(1), wz_maxpos(2)/), &
!!$ & d=(/dyn_as % wz_DiffTherm(wz_lbound(1), wz_lbound(2)), &
!!$ & dyn_as % wz_DiffTherm(wz_ubound(1), wz_ubound(2)), &
!!$ & dyn_as % wz_DiffTherm(wz_minpos(1), wz_minpos(2)), &
!!$ & dyn_as % wz_DiffTherm(wz_maxpos(1), wz_maxpos(2))/))
!!$
call Printf(out_unit, indent_str(1:indent_len) // '>')
else
call Printf(out_unit, indent_str(1:indent_len) // '#<DYNAS83:: @initialized=%y>', l=(/dyn_as % initialized/))
end if
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynAS83PutLine
| Subroutine : | |||
| dyn_as : | type(DYNAS83), intent(inout) | ||
| wz_DVorDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DDivDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DTempDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DQVapDtN((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| w_DPiDtN((dyn_as%nmax+1)**2) : | real(DP), intent(in)
| ||
| wz_VorB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_DivB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_TempB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| wz_QVapB((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(in)
| ||
| w_PiB((dyn_as%nmax+1)**2) : | real(DP), intent(in)
| ||
| wz_VorA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| wz_DivA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| wz_TempA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| wz_QVapA((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1) : | real(DP), intent(out)
| ||
| w_PiA((dyn_as%nmax+1)**2) : | real(DP), intent(out)
| ||
| err : | logical, intent(out), optional
|
時間積分を行い, 時刻 $ t $ の物理量の時間変化と $ t-\Delta t$ の物理量から 時刻 $ t+\Delta t $ の物理量を計算します.
時間積分法にはリープフロッグスキームを用いています. ただし拡散項には前方差分を用いています. さらに $ \Delta t $ を大きくとるために, 重力波項に セミインプリシット法を適用しています.
なお, 与えられた dyn_as が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
With time integration, calculate physical values at $ t+\Delta t $ from tendency at $ t $ and physical values at $ t-\Delta t $ .
Leap-frog scheme is used as time integration. And forward difference is used to diffusion terms. In addition, semi-implicit scheme is applied for extension of $ \Delta t $ .
If dyn_as is not initialized by Create yet, error is occurred.
subroutine DynAS83TimeIntegration( dyn_as, wz_DVorDtN, wz_DDivDtN, wz_DTempDtN, wz_DQVapDtN, w_DPiDtN, wz_VorB, wz_DivB, wz_TempB, wz_QVapB, w_PiB, wz_VorA, wz_DivA, wz_TempA, wz_QVapA, w_PiA, err )
!
! 時間積分を行い,
! 時刻 $ t $ の物理量の時間変化と $ t-\Delta t$ の物理量から
! 時刻 $ t+\Delta t $ の物理量を計算します.
!
! 時間積分法にはリープフロッグスキームを用いています.
! ただし拡散項には前方差分を用いています.
! さらに $ \Delta t $ を大きくとるために, 重力波項に
! セミインプリシット法を適用しています.
!
! なお, 与えられた *dyn_as* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! With time integration, calculate physical values at $ t+\Delta t $
! from tendency at $ t $ and physical values at $ t-\Delta t $ .
!
! Leap-frog scheme is used as time integration.
! And forward difference is used to diffusion terms.
! In addition, semi-implicit scheme is applied
! for extension of $ \Delta t $ .
!
! If *dyn_as* is not initialized by Create yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dcpam_error, only: StoreError, DC_NOERR, DCPAM_ENOTINIT
use dyn_matrix, only: Solve
implicit none
type(DYNAS83), intent(inout):: dyn_as
real(DP), intent(in):: wz_DVorDtN ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \DD{\zeta}{t} (t) $ . 渦度変化 (スペクトル).
! Vorticity tendency (spectral)
real(DP), intent(in):: wz_DDivDtN ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \DD{D}{t} (t) $ . 発散変化 (スペクトル).
! Divergence tendency (spectral)
real(DP), intent(in):: wz_DTempDtN ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \DD{T}{t} (t) $ . 温度変化 (スペクトル).
! Temperature tendency (spectral)
real(DP), intent(in):: wz_DQVapDtN ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \DD{q}{t} (t) $ . 比湿変化 (スペクトル).
! Specific humidity tendency (spectral)
real(DP), intent(in):: w_DPiDtN ((dyn_as%nmax+1)**2)
! $ \DD{Ps}{t} (t) $ . 地表面気圧変化 (スペクトル).
! Surface pressure tendency (spectral)
real(DP), intent(in):: wz_VorB ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \zeta (t-\Delta t) $ . 渦度 (スペクトル).
! Vorticity (spectral)
real(DP), intent(in):: wz_DivB ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ D (t-\Delta t) $ . 発散 (スペクトル).
! Divergence (spectral)
real(DP), intent(in):: wz_TempB ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ T (t-\Delta t) $ . 温度 (スペクトル).
! Temperature (spectral)
real(DP), intent(in):: w_PiB ((dyn_as%nmax+1)**2)
! $ \pi = \ln P_s (t-\Delta t) $ . 地表面気圧 (スペクトル).
! Surface pressure (spectral)
real(DP), intent(in):: wz_QVapB ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ q (t-\Delta t) $ . 比湿 (スペクトル).
! Specific humidity (spectral)
real(DP), intent(out):: wz_VorA ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \zeta (t+\Delta t) $ . 渦度 (スペクトル).
! Vorticity (spectral)
real(DP), intent(out):: wz_DivA ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ D (t+\Delta t) $ . 発散 (スペクトル).
! Divergence (spectral)
real(DP), intent(out):: wz_TempA ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ T (t+\Delta t) $ . 温度 (スペクトル).
! Temperature (spectral)
real(DP), intent(out):: w_PiA ((dyn_as%nmax+1)**2)
! $ \pi = \ln P_s (t+\Delta t) $ . 地表面気圧 (スペクトル).
! Surface pressure (spectral)
real(DP), intent(out):: wz_QVapA ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ q (t+\Delta t) $ . 比湿 (スペクトル).
! Specific humidity (spectral)
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:: kmax ! 鉛直層数.
! Number of vertical level
real(DP):: RPlanet ! $ a $ . 惑星半径. Radius of planet
real(DP):: Cp ! $ C_p $ . 大気定圧比熱. Specific heat of air at constant pressure
real(DP):: DelTime ! $ \Delta t $ . タイムステップ. Time step
real(DP):: z_HydroAlpha (0:dyn_as%kmax-1)
! $ \alpha $ . 静水圧の式の係数.
! Coefficient in hydrostatic equation.
real(DP):: z_HydroBeta (0:dyn_as%kmax-1)
! $ \beta $ . 静水圧の式の係数.
! Coefficient in hydrostatic equation.
real(DP):: wz_DiffVorDiv ((dyn_as%nmax+1)**2, 0:dyn_as%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 ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ -(-1)^{N_D/2}K_{HD}\nabla^{N_D} $ .
! 熱, 水水平拡散係数.
! Coefficient of horizontal thermal and water diffusion
real(DP):: wz_rn ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ -n \times (n+1) $ . ラプラシアンの係数.
! Laplacian coefficient
!
real(DP):: w_Phis ((dyn_as%nmax+1)**2)
! $ \Phi_s $ . 地表ジオポテンシャル.
! Surface geo-potential
real(DP):: z_siMtxG (0:dyn_as%kmax-1)
! $ G = C_p \kappa T $
real(DP):: zz_siMtxH (0:dyn_as%kmax-1, 0:dyn_as%kmax-1)
! $ h = QS - R $
real(DP):: z_DelSigma (0:dyn_as%kmax-1)
! $ \Delta \sigma $ (整数).
! $ \Delta \sigma $ (Full)
real(DP):: wz_siTempW ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! 温度 (セミインプリシット法のための作業変数).
! Temperature (work variable for semi-implicit scheme)
real(DP):: wz_siDTempDtW ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \DD{T}{t} (t) $ . 温度変化 (スペクトル) の作業変数.
! Temperature tendency (spectral) work variable
!!$ real(DP):: wz_siPiW ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
real(DP):: w_siPiW ((dyn_as%nmax+1)**2)
! $ \pi $ (セミインプリシット法のための作業変数).
! $ \pi $ (work variable for semi-implicit scheme)
real(DP):: w_siDPiDtW ((dyn_as%nmax+1)**2)
! $ \DD{Ps}{t} (t) $ . 地表面気圧変化 (スペクトル).
! Surface pressure tendency (spectral)
real(DP):: wz_siPhiW ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! $ \Phi $ (セミインプリシット法のための作業変数).
! $ \Phi $ (work variable for semi-implicit scheme)
real(DP):: wz_siDivAvrTime ((dyn_as%nmax+1)**2, 0:dyn_as%kmax-1)
! 時間平均の $ \Dvect{D} $ (セミインプリシット法のための作業変数).
! Time average $ \Dvect{D} $ (work variable for semi-implicit scheme)
integer:: k, kk ! DO ループ用作業変数
! Work variables for DO loop
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'DynAS83TimeIntegration'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. dyn_as % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'DYNAS83'
goto 999
end if
!-----------------------------------------------------------------
! *dyn_as* に格納される物理定数, $ \Delta t $ の取り出し
! Fetch physical constant, $ \Delta t $ from *dyn_as*
!-----------------------------------------------------------------
kmax = dyn_as % kmax
RPlanet = dyn_as % RPlanet
Cp = dyn_as % Cp
DelTime = dyn_as % DelTime
z_DelSigma = dyn_as % z_DelSigma
z_HydroAlpha = dyn_as % z_HydroAlpha
z_HydroBeta = dyn_as % z_HydroBeta
wz_rn = dyn_as % wz_rn
wz_DiffVorDiv = dyn_as % wz_DiffVorDiv
wz_DiffTherm = dyn_as % wz_DiffTherm
w_Phis = dyn_as % w_Phis
z_siMtxG = dyn_as % z_siMtxG
zz_siMtxH = dyn_as % zz_siMtxH
!-----------------------------------------------------------------
! 非重力波項の仮積分
! Integration non gravitational terms temporarily
!-----------------------------------------------------------------
wz_siTempW = wz_TempB * ( 1.0_DP - DelTime * wz_DiffTherm ) + wz_DTempDtN * DelTime
w_siPiW = w_PiB + w_DPiDtN * DelTime
!-----------------------------------------------------------------
! ジオポテンシャルの計算
! Calculate geopotential
!-----------------------------------------------------------------
wz_siPhiW (:,0) = Cp * z_HydroAlpha(0) * wz_siTempW (:,0)
do k = 1, kmax-1
wz_siPhiW (:,k) = wz_siPhiW(:,k-1) + Cp * z_HydroAlpha(k) * wz_siTempW (:,k) + Cp * z_HydroBeta (k-1) * wz_siTempW (:,k-1)
end do
!-----------------------------------------------------------------
! 発散方程式の右辺の計算
! Calculate right side of divergence equation
!-----------------------------------------------------------------
do k = 0, kmax-1
wz_siDivAvrTime(:,k) = wz_DivB(:,k) * ( 1.0_DP + DelTime * wz_DiffVorDiv(:,k) ) * ( 1.0_DP + DelTime * 2.0_DP * wz_DiffTherm(:,k) ) + DelTime * ( wz_DDivDtN(:,k) - wz_rn(:,k) / RPlanet**2 * ( wz_siPhiW(:,k) + ( 1.0_DP + DelTime * 2.0_DP * wz_DiffTherm(:,k) ) * ( w_Phis + w_siPiW * z_siMtxG(k) ) ) )
end do
!-----------------------------------------------------------------
! 時間平均の $ \Dvect{D} $ を LU 行列で解く
! Solve time average $ \Dvect{D} $ with LU matrix
!-----------------------------------------------------------------
call Solve( dyn_mtx = dyn_as % dyn_mtx, wz_RSVector2Solution = wz_siDivAvrTime ) ! (inout)
!-----------------------------------------------------------------
! 温度, 地表気圧の時間変化項の計算
! Calculate tendency of temperature and surface pressure
!-----------------------------------------------------------------
wz_siDTempDtW = wz_DTempDtN
do k = 0, kmax-1
do kk = 0, kmax-1
wz_siDTempDtW(:,k) = wz_siDTempDtW(:,k) - zz_siMtxH(k,kk) * wz_siDivAvrTime(:,kk)
end do
end do
w_siDPiDtW = w_DPiDtN
do kk = 0, kmax-1
w_siDPiDtW = w_siDPiDtW - z_DelSigma(kk) * wz_siDivAvrTime(:,kk)
end do
!-----------------------------------------------------------------
! 時間積分. 拡散は前方差分
! Time integration. Forward difference is applied to diffusion
!-----------------------------------------------------------------
!-------------------------------
! 渦度. Vorticity
wz_VorA = ( wz_VorB + wz_DVorDtN * DelTime * 2.0_DP ) / ( 1.0_DP + DelTime * 2.0_DP * wz_DiffVorDiv )
!-------------------------------
! 発散. Divergence
wz_DivA = wz_siDivAvrTime * 2.0_DP - wz_DivB
!-------------------------------
! 温度. Temperature
wz_TempA = ( wz_TempB + wz_siDTempDtW * DelTime * 2.0_DP ) / ( 1.0_DP + DelTime * 2.0_DP * wz_DiffTherm )
!-------------------------------
! 比湿. Specific humidity
wz_QVapA = ( wz_QVapB + wz_DQVapDtN * DelTime * 2.0_DP ) / ( 1.0_DP + DelTime * 2.0_DP * wz_DiffTherm )
!-------------------------------
! 地表面気圧. Surface pressure
w_PiA = w_PiB + w_siDPiDtW * DelTime * 2.0_DP
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine DynAS83TimeIntegration
| Subroutine : | |||
| nmlfile : | character(*), intent(in)
| ||
| r_Sigma_(:) : | real(DP), intent(inout) | ||
| 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_as83_nml .
Alias for DynAS83NmlRead
| Constant : | |
| version = ’$Name: dcpam4-20070730-2 $’ // ’$Id: dyn_as83.f90,v 1.9 2007/07/29 21:37:27 morikawa Exp $’ : | character(*), parameter |