| Class | initial_data |
| In: |
prepare_data/initial_data.f90
|
Note that Japanese and English are described in parallel.
GCM の初期値となるデータを生成します. ファイルへの出力は主プログラムで行うことを想定しています.
現在は以下のデータを提供します.
Initial data for GCM is generated. File output is expected to done by a main program.
Now, following data are provided.
| IniDataCreate : | INIDAT 型変数の初期設定 |
| IniDataGetAxes : | 軸データの取得 |
| IniDataGet : | 初期値データの取得 |
| IniDataClose : | INIDAT 型変数の終了処理 |
| IniDataPutLine : | INIDAT 型変数に格納されている情報の印字 |
| IniDataInitialized : | INIDAT 型変数が初期設定されているか否か |
| ———— : | ———— |
| IniDataCreate : | Constructor of "INIDAT" |
| IniDataGetAxes : | Get axes data |
| IniDataGet : | Get initial data |
| IniDataClose : | Deconstructor of "INIDAT" |
| IniDataPutLine : | Print information of "INIDAT" |
| IniDataInitialized : | Check initialization of "INIDAT" |
始めに, INIDAT 型の変数を定義し, IniDataCreate で初期設定を行います. 初期設定後, IniDataGet によって初期値を読み込んでください. 軸データを読み込む場合には IniDataGetAxes を用いてください. 最後に, INIDAT 型の変数の終了処理を IniDataClose にて行います.
First, initialize "INIDAT" by "IniDataCreate". Then, get initial data by "IniDataGet". If axes data is needed, get it by "IniDataGetAxes". Finally, terminate "INIDAT" by "IniDataClose".
| Derived Type : | |||||
| initialized = .false. : | logical
| ||||
| pattern : | character(TOKEN)
| ||||
| nmax : | integer
| ||||
| imax : | integer
| ||||
| jmax : | integer
| ||||
| kmax : | integer
| ||||
| Cp : | real(DP)
| ||||
| RAir : | real(DP)
| ||||
| EpsV : | real(DP)
| ||||
| x_Lon(:) =>null() : | real(DP), pointer
| ||||
| x_Lon_Weight(:) =>null() : | real(DP), pointer
| ||||
| y_Lat(:) =>null() : | real(DP), pointer
| ||||
| y_Lat_Weight(:) =>null() : | real(DP), pointer
| ||||
| z_Sigma(:) =>null() : | real(DP), pointer
| ||||
| r_Sigma(:) =>null() : | real(DP), pointer
| ||||
| z_DelSigma(:) =>null() : | real(DP), pointer
| ||||
| TempAvr : | real(DP)
| ||||
| TempMin : | real(DP)
| ||||
| QVapAvr : | real(DP)
| ||||
| PsAvr : | real(DP)
| ||||
| xyz_U(:,:,:) : | real(DP), pointer
| ||||
| xyz_V(:,:,:) : | real(DP), pointer
| ||||
| xyz_Vor(:,:,:) =>null() : | real(DP), pointer
| ||||
| xyz_Div(:,:,:) =>null() : | real(DP), pointer
| ||||
| xyz_Temp(:,:,:) =>null() : | real(DP), pointer
| ||||
| xyz_QVap(:,:,:) =>null() : | real(DP), pointer
| ||||
| xy_Ps(:,:) =>null() : | real(DP), pointer
| ||||
| phy_sat : | type(PHYSATNHA) |
まず, IniDataCreate で "INIDAT" 型の変数を初期設定して下さい. 初期化された "INIDAT" 型の変数を再度利用する際には, IniDataClose によって終了処理を行ってください.
Initialize "INIDAT" variable by "IniDataCreate" before usage. If you reuse "INIDAT" variable again for another application, terminate by "IniDataClose".
| Subroutine : | |||
| ini_dat : | type(INIDAT), intent(inout) | ||
| err : | logical, intent(out), optional
|
INIDAT 型の変数の終了処理を行います. なお, 与えられた ini_dat が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Deconstructor of "INIDAT". Note that if ini_dat is not initialized by "Create" yet, error is occurred.
subroutine IniDataClose( ini_dat, err )
!
! INIDAT 型の変数の終了処理を行います.
! なお, 与えられた *ini_dat* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Deconstructor of "INIDAT".
! Note that if *ini_dat* 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 phy_saturate_nha92, only: PhySatNhaClose, PhySatNhaInitialized
implicit none
type(INIDAT), intent(inout):: ini_dat
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 = 'IniDataClose'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. ini_dat % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'INIDAT'
goto 999
end if
!-----------------------------------------------------------------
! "INIDAT" の設定の消去
! Clear the settings for "INIDAT"
!-----------------------------------------------------------------
deallocate( ini_dat % x_Lon )
deallocate( ini_dat % x_Lon_Weight )
deallocate( ini_dat % y_Lat )
deallocate( ini_dat % y_Lat_Weight )
deallocate( ini_dat % r_Sigma )
deallocate( ini_dat % z_Sigma )
deallocate( ini_dat % xyz_Vor )
deallocate( ini_dat % xyz_Div )
deallocate( ini_dat % xyz_Temp )
deallocate( ini_dat % xyz_QVap )
deallocate( ini_dat % xy_Ps )
!-----------------------------------------------------------------
! 飽和比湿計算用オブジェクトの終了処理
! Terminate object for calculation of saturation specific humidity
!-----------------------------------------------------------------
if ( PhySatNhaInitialized(ini_dat % phy_sat) ) then
call PhySatNhaClose( phy_sat_nha = ini_dat % phy_sat, err = err ) ! (out)
end if
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
ini_dat % initialized = .false.
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine IniDataClose
| Subroutine : | |||||||||||
| ini_dat : | type(INIDAT), intent(inout) | ||||||||||
| nmax : | integer, intent(in)
| ||||||||||
| imax : | integer, intent(in)
| ||||||||||
| jmax : | integer, intent(in)
| ||||||||||
| kmax : | integer, intent(in)
| ||||||||||
| Cp : | real(DP), intent(in), optional
| ||||||||||
| RAir : | real(DP), intent(in), optional
| ||||||||||
| EpsV : | real(DP), intent(in), optional
| ||||||||||
| r_SigmaSet(:) : | real(DP), intent(in), optional
| ||||||||||
| TempAvr : | real(DP), intent(in), optional
| ||||||||||
| TempMin : | real(DP), intent(in), optional
| ||||||||||
| PsAvr : | real(DP), intent(in), optional
| ||||||||||
| QVapAvr : | real(DP), intent(in), optional
| ||||||||||
| pattern : | character(*), intent(in), optional
| ||||||||||
| wa_module_initialized : | logical, intent(in), optional
| ||||||||||
| nmlfile : | character(*), intent(in), optional
| ||||||||||
| err : | logical, intent(out), optional
|
INIDAT 型の変数の初期設定を行います. 他のサブルーチンを使用する前に必ずこのサブルーチンによって INIDAT 型の変数を初期設定してください.
オプショナル引数 Cp および RAir は半整数 $ sigma $ レベルから整数 $ sigma $ レベルを作成する際に使用されます. これらの引数を与えない場合, 地球上での標準値 (constants モジュールから得られるデフォルト値) が使用されます.
なお, 与えられた ini_dat が既に初期設定されている場合, プログラムはエラーを発生させます.
NAMELIST を利用する場合には引数 nmlfile に NAMELIST ファイル名 を与えてください. NAMELIST 変数群の詳細に関しては NAMELIST#initial_data_nml を参照してください.
Constructor of "INIDAT". Initialize ini_dat by this subroutine, before other procedures are used,
Optinal arguments Cp and RAir are used when full $ sigma $ level is created from half $ sigma $ level. If these arguments are not given, standard values on Earth (default valuses provided by "constants" module) are used instead.
Note that if ini_dat is already initialized by this procedure, error is occurred.
In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile. See "NAMELIST#initial_data_nml" for details about a NAMELIST group.
subroutine IniDataCreate( ini_dat, nmax, imax, jmax, kmax, Cp, RAir, EpsV, r_SigmaSet, TempAvr, TempMin, PsAvr, QVapAvr, pattern, wa_module_initialized, nmlfile, err )
!
! INIDAT 型の変数の初期設定を行います.
! 他のサブルーチンを使用する前に必ずこのサブルーチンによって
! INIDAT 型の変数を初期設定してください.
!
! オプショナル引数 *Cp* および *RAir* は半整数 $ \sigma $
! レベルから整数 $ \sigma $ レベルを作成する際に使用されます.
! これらの引数を与えない場合, 地球上での標準値
! (constants モジュールから得られるデフォルト値) が使用されます.
!
! なお, 与えられた *ini_dat* が既に初期設定されている場合,
! プログラムはエラーを発生させます.
!
! NAMELIST を利用する場合には引数 *nmlfile* に NAMELIST ファイル名
! を与えてください. NAMELIST 変数群の詳細に関しては
! NAMELIST#initial_data_nml を参照してください.
!
! Constructor of "INIDAT".
! Initialize *ini_dat* by this subroutine,
! before other procedures are used,
!
! Optinal arguments *Cp* and *RAir* are used when
! full $ \sigma $ level is created from half $ \sigma $ level.
! If these arguments are not given, standard values on Earth
! (default valuses provided by "constants" module) are used instead.
!
! Note that if *ini_dat* is already initialized
! by this procedure, error is occurred.
!
! In order to use NAMELIST, specify a NAMELIST filename to
! argument *nmlfile*. See "NAMELIST#initial_data_nml"
! for details about a NAMELIST group.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT
use dc_present, only: present_and_not_empty, present_and_true
use dc_error, only: DC_NOERR, DC_EALREADYINIT, DC_ENEGATIVE, DC_ENOFILEREAD, DC_ENOTINIT
use dc_string, only: LChar
use dcpam_error, only: StoreError, DCPAM_EBADPATTERN
use dc_message, only: MessageNotify
use constants, only: CONST, Create, Get
use wa_module, only: wa_Initial, x_Lon_spml => x_Lon, y_Lat_spml => y_Lat, x_Lon_Weight_spml => x_Lon_Weight, y_Lat_Weight_spml => y_Lat_Weight
use sigma_data, only: SIGDAT, Create, Close, PutLine, initialized, Get
use phy_saturate_nha92, only: PhySatNhaCreate, CalcQVapSat
implicit none
type(INIDAT), intent(inout):: ini_dat
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), optional:: Cp ! $ C_p $ . 大気定圧比熱. Specific heat of air at constant pressure
real(DP), intent(in), optional:: RAir ! $ R $ . 大気気体定数. Gas constant of air
real(DP), intent(in), optional:: EpsV ! $ \epsilon_v $ . 水蒸気分子量比. Molecular weight of water vapor
!!$ real(DP), intent(in), optional:: Grav ! $ g $ . 重力加速度. Gravitational acceleration
!!$ real(DP), intent(in), optional:: EL ! $ L $ . 水の凝結の潜熱. Latent heat of condensation of water vapor
!!$ real(DP), intent(in), optional:: RVap ! $ R_v $ . 水蒸気気体定数. Gas constant of water vapor
!!$ real(DP), intent(in), optional:: ES0 ! $ e^{*} $ (273K) . 0 ℃での飽和蒸気圧. Saturated vapor pressure at 0 degrees C
real(DP), intent(in), optional:: TempAvr
! $ \bar{T} $ . 温度平均値. Mean temperature
real(DP), intent(in), optional:: TempMin
! $ T_{min} $ . 温度最小値. Minimum temperature
real(DP), intent(in), optional:: PsAvr
! $ \bar{p_s} $ . 地表面気圧平均値. Mean surface pressure
real(DP), intent(in), optional:: QVapAvr
! $ \bar{q} $ . 比湿平均値. Mean specific humidity
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.
character(*), intent(in), optional:: pattern
! 初期値データのパターン.
! 以下のパターンを選択可能.
!
! Initial data pattern
! Available patterns are as follows.
!
! * "AGCM 5.3 Default"
! * "Sugiyama et al. (2008)"
!
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 :: nmlfile
! NAMELIST ファイルの名称.
! この引数に空文字以外を与えた場合,
! 指定されたファイルから
! NAMELIST 変数群を読み込みます.
! ファイルを読み込めない場合にはエラーを
! 生じます.
!
! NAMELIST 変数群の詳細に関しては
! NAMELIST#initial_data_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#initial_data_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.
real(DP):: xyz_PotTemp (0:imax-1, 0:jmax-1, 0:kmax-1)
! 温位
real(DP):: xyz_Press (0:imax-1, 0:jmax-1, 0:kmax-1)
! 気圧
real(DP):: xy_TempMin (0:imax-1, 0:jmax-1)
! 温度の最小値
real(DP):: xyz_QVapSatPress (0:imax-1, 0:jmax-1, 0:kmax-1)
! 飽和水蒸気圧
real(DP):: xyz_QVapSat (0:imax-1, 0:jmax-1, 0:kmax-1)
! 飽和比湿
!-----------------------------------
! 作業変数
! Work variables
type(CONST):: const_earth
type(SIGDAT):: sig_dat
integer:: i, j, k ! DO ループ用作業変数
! Work variables for DO loop
integer:: stat
character(STRING):: cause_c
character(*), parameter:: subname = 'IniDataCreate'
continue
call BeginSub(subname, version)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (ini_dat % initialized) then
stat = DC_EALREADYINIT
cause_c = 'INIDAT'
goto 999
end if
!-----------------------------------------------------------------
! 格子点の設定
! Configure grid point
!-----------------------------------------------------------------
ini_dat % nmax = nmax
ini_dat % imax = imax
ini_dat % jmax = jmax
ini_dat % kmax = kmax
!-----------------------------------------------------------------
! 初期値データのパターンを引数から取得
! Get initial data pattern from argument
!-----------------------------------------------------------------
if ( present(pattern) ) then
ini_dat % pattern = pattern
else
ini_dat % pattern = ''
end if
!---------------------------------------------------------
! 物理定数の準備
! Prepare physical constants
!---------------------------------------------------------
call Create( const_earth ) ! (inout)
call Get( constant = const_earth, Cp = ini_dat % Cp, RAir = ini_dat % RAir, EpsV = ini_dat % EpsV ) ! (out)
!!$ & Grav = ini_dat % Grav, EL = ini_dat % EL, & ! (out)
!!$ & RVap = ini_dat % RVap, & ! (out)
!!$ & ES0 = ini_dat % ES0 ) ! (out)
if ( present(Cp) ) ini_dat % Cp = Cp
if ( present(RAir) ) ini_dat % RAir = RAir
if ( present(EpsV) ) ini_dat % EpsV = EpsV
!!$ if ( present(Grav) ) ini_dat % Grav = Grav
!!$ if ( present(EL) ) ini_dat % EL = EL
!!$ if ( present(RVap) ) ini_dat % RVap = RVap
!!$ if ( present(ES0) ) ini_dat % ES0 = ES0
!---------------------------------------------------------
! 平均値の設定
! Configure mean value
!---------------------------------------------------------
!-------------------------
! デフォルト値
! Default values
select case ( LChar( trim(ini_dat % pattern) ) )
case ('sugiyama et al. (2008)')
ini_dat % TempAvr = 490.0_DP
ini_dat % TempMin = -1.0_DP
ini_dat % PsAvr = 3.0e+6_DP
ini_dat % QVapAvr = 6.11641e-3_DP
case default
ini_dat % TempAvr = 250.0_DP
ini_dat % TempMin = -1.0_DP
ini_dat % PsAvr = 1.0e+5_DP
ini_dat % QVapAvr = 1.0e-10_DP
end select
!-------------------------
! オプショナル引数からの値
! Values from optional arguments
if ( present(TempAvr) ) ini_dat % TempAvr = TempAvr
if ( present(TempMin) ) ini_dat % TempMin = TempMin
if ( present(PsAvr ) ) ini_dat % PsAvr = PsAvr
if ( present(QVapAvr) ) ini_dat % QVapAvr = QVapAvr
!-----------------------------------------------------------------
! NAMELIST からの値を取得
! Get values from NAMELIST
!-----------------------------------------------------------------
!-----------------------------------
! pattern だけ先に取得
! "pattern" is gotten in first
if ( present_and_not_empty(nmlfile) ) then
call MessageNotify( 'M', subname, 'Loading NAMELIST file "%c" ...', c1=trim(nmlfile) )
call NmlRead ( nmlfile = nmlfile, Cp = ini_dat % Cp, RAir = ini_dat % RAir, EpsV = ini_dat % EpsV, TempAvr = ini_dat % TempAvr, TempMin = ini_dat % TempMin, PsAvr = ini_dat % PsAvr, QVapAvr = ini_dat % QVapAvr, pattern_ = ini_dat % pattern, 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
!-----------------------------------
! デフォルト値を再設定
! Default values are reconfigured
select case ( LChar( trim(ini_dat % pattern) ) )
case ('sugiyama et al. (2008)')
ini_dat % TempAvr = 490.0_DP
ini_dat % TempMin = -1.0_DP
ini_dat % PsAvr = 3.0e+6_DP
ini_dat % QVapAvr = 6.11641e-3_DP
end select
!-----------------------------------
! pattern 以外を取得
! Values excluding "pattern" are gotten
if ( present_and_not_empty(nmlfile) ) then
call MessageNotify( 'M', subname, 'Loading NAMELIST file "%c" ...', c1=trim(nmlfile) )
call NmlRead ( nmlfile = nmlfile, Cp = ini_dat % Cp, RAir = ini_dat % RAir, EpsV = ini_dat % EpsV, TempAvr = ini_dat % TempAvr, TempMin = ini_dat % TempMin, PsAvr = ini_dat % PsAvr, QVapAvr = ini_dat % QVapAvr, pattern_ = ini_dat % pattern, 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
!-----------------------------------------------------------------
! 引数の正当性のチェック
! Validation of arguments
!-----------------------------------------------------------------
if (ini_dat % nmax < 1) then
stat = DC_ENEGATIVE
cause_c = 'nmax'
goto 999
end if
if (ini_dat % imax < 1) then
stat = DC_ENEGATIVE
cause_c = 'imax'
goto 999
end if
if (ini_dat % jmax < 1) then
stat = DC_ENEGATIVE
cause_c = 'jmax'
goto 999
end if
if (ini_dat % kmax < 1) then
stat = DC_ENEGATIVE
cause_c = 'kmax'
goto 999
end if
!-----------------------------------------------------------------
! 初期値データのパターン
! Initial data pattern
!-----------------------------------------------------------------
if ( trim(ini_dat % pattern) == '' ) then
ini_dat % pattern = 'AGCM 5.3 Default'
else
select case ( LChar( trim(ini_dat % pattern) ) )
case ('agcm 5.3 default')
case ('sugiyama et al. (2008)')
case default
stat = DCPAM_EBADPATTERN
cause_c = trim(ini_dat % pattern)
goto 999
end select
end if
!-----------------------------------------------------------------
! 緯度経度軸データ作成
! Create longitude and latitude axes data
!-----------------------------------------------------------------
if ( .not. present_and_true(wa_module_initialized) ) then
if (wa_module_initialized_stored) then
call MessageNotify('W', subname, 'spml library wa_module can not be initialized more than once.' // ' Object (DYNSP) was not initialized.')
stat = DC_ENOTINIT
cause_c = 'DYNSP'
goto 999
else
call wa_Initial( ini_dat % nmax, ini_dat % imax, ini_dat % jmax, ini_dat % kmax ) ! (in)
wa_module_initialized_stored = .true.
end if
elseif ( present_and_true(wa_module_initialized) ) then
wa_module_initialized_stored = .true.
end if
allocate( ini_dat % x_Lon (0:ini_dat%imax-1) )
ini_dat % x_Lon = x_Lon_spml
allocate( ini_dat % x_Lon_Weight (0:ini_dat%imax-1) )
ini_dat % x_Lon_Weight = x_Lon_Weight_spml
allocate( ini_dat % y_Lat (0:ini_dat%jmax-1) )
ini_dat % y_Lat = y_Lat_spml
allocate( ini_dat % y_Lat_Weight (0:ini_dat%jmax-1) )
ini_dat % y_Lat_Weight = y_Lat_Weight_spml
!-----------------------------------------------------------------
! σレベル軸データ作成
! Create sigma level axis data
!-----------------------------------------------------------------
call Create( sig_dat = sig_dat, kmax = ini_dat % kmax, Cp = ini_dat % Cp, RAir = ini_dat % RAir, r_SigmaSet = r_SigmaSet, nmlfile = nmlfile ) ! (in)
allocate( ini_dat % r_Sigma (0:ini_dat%kmax) )
allocate( ini_dat % z_Sigma (0:ini_dat%kmax-1) )
allocate( ini_dat % z_DelSigma (0:ini_dat%kmax-1) )
call Get( sig_dat = sig_dat, z_Sigma = ini_dat % z_Sigma, r_Sigma = ini_dat % r_Sigma, z_DelSigma = ini_dat % z_DelSigma ) ! (out)
!-----------------------------------------------------------------
! 初期値データの作成
! Generate initial data
!-----------------------------------------------------------------
allocate( ini_dat % xyz_U (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) )
allocate( ini_dat % xyz_V (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) )
allocate( ini_dat % xyz_Vor (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) )
allocate( ini_dat % xyz_Div (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) )
allocate( ini_dat % xyz_Temp (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) )
allocate( ini_dat % xyz_QVap (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) )
allocate( ini_dat % xy_Ps (0:ini_dat%imax-1, 0:ini_dat%jmax-1) )
select case ( LChar( trim(ini_dat % pattern) ) )
!-----------------------------------
! AGCM5.3 のデフォルト初期値
! AGCM5.3 default initial values
case ('agcm 5.3 default')
ini_dat % xyz_U = 0.0_DP
ini_dat % xyz_V = 0.0_DP
ini_dat % xyz_Vor = 0.0_DP
ini_dat % xyz_Div = 0.0_DP
ini_dat % xyz_Temp = ini_dat % TempAvr
ini_dat % xy_Ps = ini_dat % PsAvr
ini_dat % xyz_QVap = ini_dat % QVapAvr
do k = 0, ini_dat % kmax - 1
do j = 0, ini_dat % jmax - 1
do i = 0, ini_dat % imax - 1
ini_dat % xyz_Temp(i,j,k) = ini_dat % xyz_Temp(i,j,k) + 0.1_DP * sin ( real( ( i + 1 ) * ( ini_dat % jmax - j ) * ( ini_dat % kmax - 1 - k ), DP ) / real( ini_dat % imax * ini_dat % jmax * ini_dat % kmax, DP ) * 10.0_DP )
end do
end do
end do
!-----------------------------------
! Sugiyama et al. (2008) の初期値
! Initial values of Sugiyama et al. (2008)
case ('sugiyama et al. (2008)')
ini_dat % xyz_U = 0.0_DP
ini_dat % xyz_V = 0.0_DP
ini_dat % xyz_Vor = 0.0_DP
ini_dat % xyz_Div = 0.0_DP
ini_dat % xyz_Temp = ini_dat % TempAvr
ini_dat % xy_Ps = ini_dat % PsAvr
ini_dat % xyz_QVap = ini_dat % QVapAvr
!---------------------------------
! 温度の計算
! Calculate temperature
xyz_PotTemp = ini_dat % TempAvr
xy_TempMin = ini_dat % TempAvr
do k = 0, ini_dat % kmax - 1
ini_dat % xyz_Temp(:,:,k) = xyz_PotTemp(:,:,k) * ( ini_dat % z_Sigma(k) )**( ini_dat % RAir / ini_dat % Cp )
if ( ini_dat % PsAvr * ini_dat % z_Sigma(k) < 1.0e+4_DP ) then
ini_dat % xyz_Temp(:,:,k) = xy_TempMin
else
xy_TempMin = ini_dat % xyz_Temp(:,:,k)
end if
end do
!!$ where ( ini_dat % xyz_Temp < ini_dat % TempMin )
!!$ ini_dat % xyz_Temp = ini_dat % TempMin
!!$ end where
! 擾乱を与える
! Add perturbation
do k = 0, ini_dat % kmax - 1
do j = 0, ini_dat % jmax - 1
do i = 0, ini_dat % imax - 1
ini_dat % xyz_Temp(i,j,k) = ini_dat % xyz_Temp(i,j,k) + 0.1_DP * sin ( real( ( i + 1 ) * ( ini_dat % jmax - j ) * ( ini_dat % kmax - 1 - k ), DP ) / real( ini_dat % imax * ini_dat % jmax * ini_dat % kmax, DP ) * 10.0_DP )
end do
end do
end do
!---------------------------------
! 飽和比湿計算
! Calculate saturation specific humidity
call PhySatNhaCreate( phy_sat_nha = ini_dat % phy_sat, imax = imax, jmax = jmax, kmax = kmax, EpsV = ini_dat % EpsV, err = err ) ! (out)
do k = 0, ini_dat % kmax - 1
xyz_Press(:,:,k) = ini_dat % xy_Ps * ini_dat % z_Sigma(k)
end do
call CalcQVapSat( phy_sat_nha = ini_dat % phy_sat, xyz_Temp = ini_dat % xyz_Temp, xyz_Press = xyz_Press, xyz_QVapSat = xyz_QVapSat, err = err ) ! (out)
!-------------------------------------------
! 比湿の計算
! Calculate specific humidity
where ( ini_dat % xyz_QVap > xyz_QVapSat * 0.75 )
ini_dat % xyz_QVap = xyz_QVapSat * 0.75
end where
end select
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
ini_dat % initialized = .true.
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine IniDataCreate
| Subroutine : | |||
| ini_dat : | type(INIDAT), intent(inout) | ||
| xyz_U(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_V(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_Vor(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_Div(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_Temp(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_QVap(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xy_Ps(0:ini_dat%imax-1, 0:ini_dat%jmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
GCM 用の初期値データを返します. 渦度, 発散, 温度, 比湿, 地表面気圧を返します.
なお, 与えられた ini_dat が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return initial data for GCM. Vorticity, divergence, temperature, specific humidity, surface pressure are returned.
If ini_dat is not initialized by "Create" yet, error is occurred.
Alias for IniDataGetData
| Subroutine : | |||
| ini_dat : | type(INIDAT), intent(inout) | ||
| x_Lon(0:ini_dat%imax-1) : | real(DP), intent(out), optional
| ||
| x_Lon_Weight(0:ini_dat%imax-1) : | real(DP), intent(out), optional
| ||
| y_Lat(0:ini_dat%jmax-1) : | real(DP), intent(out), optional
| ||
| y_Lat_Weight(0:ini_dat%jmax-1) : | real(DP), intent(out), optional
| ||
| z_Sigma(0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| r_Sigma(0:ini_dat%kmax) : | real(DP), intent(out), optional
| ||
| z_DelSigma(0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
座標軸データを返します.
なお, 与えられた ini_dat が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return axes data.
If ini_dat is not initialized by "Create" yet, error is occurred.
subroutine IniDataGetAxes( ini_dat, x_Lon, x_Lon_Weight, y_Lat, y_Lat_Weight, z_Sigma, r_Sigma, z_DelSigma, err )
!
! 座標軸データを返します.
!
! なお, 与えられた *ini_dat* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Return axes data.
!
! If *ini_dat* is not initialized by "Create" yet,
! error is occurred.
!
use dc_trace, only: BeginSub, EndSub
use dc_types, only: STRING, STDOUT, DP
use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT
implicit none
type(INIDAT), intent(inout):: ini_dat
real(DP), intent(out), optional:: x_Lon (0:ini_dat%imax-1)
! 経度. Longitude
real(DP), intent(out), optional:: x_Lon_Weight (0:ini_dat%imax-1)
! 経度積分用座標重み.
! Weight for integration in longitude
real(DP), intent(out), optional:: y_Lat (0:ini_dat%jmax-1)
! 緯度. Latitude
real(DP), intent(out), optional:: y_Lat_Weight (0:ini_dat%jmax-1)
! 緯度積分用座標重み.
! Weight for integration in latitude
real(DP), intent(out), optional:: z_Sigma (0:ini_dat%kmax-1)
! $ \sigma $ レベル (整数).
! Full $ \sigma $ level
real(DP), intent(out), optional:: r_Sigma (0:ini_dat%kmax)
! $ \sigma $ レベル (半整数).
! Half $ \sigma $ level
real(DP), intent(out), optional:: z_DelSigma (0:ini_dat%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 = 'IniDataGetAxes'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. ini_dat % initialized) then
stat = DC_ENOTINIT
cause_c = 'INIDAT'
goto 999
end if
!-----------------------------------------------------------------
! *ini_dat* に格納される座標軸データの取り出し
! Fetch axes data from *ini_dat*
!-----------------------------------------------------------------
if ( present(x_Lon ) ) x_Lon = ini_dat % x_Lon
if ( present(x_Lon_Weight) ) x_Lon_Weight = ini_dat % x_Lon_Weight
if ( present(y_Lat ) ) y_Lat = ini_dat % y_Lat
if ( present(y_Lat_Weight) ) y_Lat_Weight = ini_dat % y_Lat_Weight
if ( present(z_Sigma ) ) z_Sigma = ini_dat % z_Sigma
if ( present(r_Sigma ) ) r_Sigma = ini_dat % r_Sigma
if ( present(z_DelSigma ) ) z_DelSigma = ini_dat % z_DelSigma
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine IniDataGetAxes
| Function : | |
| result : | logical |
| ini_dat : | type(INIDAT), intent(in) |
ini_dat が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.
If ini_dat is initialized, .true. is returned. If ini_dat is not initialized, .false. is returned.
logical function IniDataInitialized( ini_dat ) result(result)
!
! *ini_dat* が初期設定されている場合には .true. が,
! 初期設定されていない場合には .false. が返ります.
!
! If *ini_dat* is initialized, .true. is returned.
! If *ini_dat* is not initialized, .false. is returned.
!
implicit none
type(INIDAT), intent(in):: ini_dat
continue
result = ini_dat % initialized
end function IniDataInitialized
| Subroutine : | |||
| ini_dat : | type(INIDAT), intent(inout) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
| ||
| err : | logical, intent(out), optional
|
引数 ini_dat に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.
Print information of ini_dat. By default messages are output to standard output. Unit number for output can be changed by unit argument.
subroutine IniDataPutLine( ini_dat, unit, indent, err )
!
! 引数 *ini_dat* に設定されている情報を印字します.
! デフォルトではメッセージは標準出力に出力されます.
! *unit* に装置番号を指定することで, 出力先を変更することが可能です.
!
! Print information of *ini_dat*.
! 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: Printf, PutLine
use phy_saturate_nha92, only: PhySatNhaPutLine
implicit none
type(INIDAT), intent(inout):: ini_dat
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
character(STRING):: cause_c
integer:: out_unit
integer:: indent_len
character(STRING):: indent_str
character(*), parameter:: subname = 'IniDataPutLine'
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
!-----------------------------------------------------------------
! "INIDAT" の設定の印字
! Print the settings for "INIDAT"
!-----------------------------------------------------------------
if (ini_dat % initialized) then
call Printf( out_unit, indent_str(1:indent_len) // '#<INIDAT:: @initialized=%y @pattern="%c"', c1 = trim( ini_dat % pattern ), l = (/ini_dat % initialized/))
call Printf( out_unit, indent_str(1:indent_len) // ' @nmax=%d @imax=%d @jmax=%d @kmax=%d', i = (/ini_dat % nmax, ini_dat % imax, ini_dat % jmax, ini_dat % kmax/) )
call Printf( out_unit, indent_str(1:indent_len) // ' @Cp=%f @RAir=%f', d = (/ini_dat % Cp, ini_dat % RAir/) )
call Printf( out_unit, indent_str(1:indent_len) // ' @EpsV=%f', d = (/ini_dat % EpsV/) )
call Printf( out_unit, indent_str(1:indent_len) // ' @phy_sat=' )
call PhySatNhaPutLine( phy_sat_nha = ini_dat % phy_sat, unit = out_unit, indent = indent_str(1:indent_len) // ' ', err = err ) ! (out)
call PutLine( ini_dat % x_Lon, unit = out_unit, lbounds = lbound(ini_dat % x_Lon), ubounds = ubound(ini_dat % x_Lon), indent = indent_str(1:indent_len) // ' @x_Lon=' )
call PutLine( ini_dat % y_Lat, unit = out_unit, lbounds = lbound(ini_dat % y_Lat), ubounds = ubound(ini_dat % y_Lat), indent = indent_str(1:indent_len) // ' @y_Lat=' )
call PutLine( ini_dat % z_Sigma, unit = out_unit, lbounds = lbound(ini_dat % z_Sigma), ubounds = ubound(ini_dat % z_Sigma), indent = indent_str(1:indent_len) // ' @z_Sigma=' )
call PutLine( ini_dat % r_Sigma, unit = out_unit, lbounds = lbound(ini_dat % r_Sigma), ubounds = ubound(ini_dat % r_Sigma), indent = indent_str(1:indent_len) // ' @r_Sigma=' )
call PutLine( ini_dat % z_DelSigma, unit = out_unit, lbounds = lbound(ini_dat % z_DelSigma), ubounds = ubound(ini_dat % z_DelSigma), indent = indent_str(1:indent_len) // ' @z_DelSigma=' )
call PutLine( ini_dat % xyz_Vor, unit = out_unit, lbounds = lbound(ini_dat % xyz_Vor), ubounds = ubound(ini_dat % xyz_Vor), indent = indent_str(1:indent_len) // ' @xyz_Vor=' )
call PutLine( ini_dat % xyz_Div, unit = out_unit, lbounds = lbound(ini_dat % xyz_Div), ubounds = ubound(ini_dat % xyz_Div), indent = indent_str(1:indent_len) // ' @xyz_Div=' )
call PutLine( ini_dat % xyz_Temp, unit = out_unit, lbounds = lbound(ini_dat % xyz_Temp), ubounds = ubound(ini_dat % xyz_Temp), indent = indent_str(1:indent_len) // ' @xyz_Temp=' )
call PutLine( ini_dat % xy_Ps, unit = out_unit, lbounds = lbound(ini_dat % xy_Ps), ubounds = ubound(ini_dat % xy_Ps), indent = indent_str(1:indent_len) // ' @xy_Ps=' )
call PutLine( ini_dat % xyz_QVap, unit = out_unit, lbounds = lbound(ini_dat % xyz_QVap), ubounds = ubound(ini_dat % xyz_QVap), indent = indent_str(1:indent_len) // ' @xyz_QVap=' )
call Printf(out_unit, indent_str(1:indent_len) // '>' )
else
call Printf(out_unit, indent_str(1:indent_len) // '#<INIDAT:: @initialized=%y>', l=(/ini_dat % initialized/))
end if
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine IniDataPutLine
| Subroutine : | |||
| ini_dat : | type(INIDAT), intent(inout) | ||
| xyz_U(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_V(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_Vor(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_Div(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_Temp(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xyz_QVap(0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1) : | real(DP), intent(out), optional
| ||
| xy_Ps(0:ini_dat%imax-1, 0:ini_dat%jmax-1) : | real(DP), intent(out), optional
| ||
| err : | logical, intent(out), optional
|
GCM 用の初期値データを返します. 渦度, 発散, 温度, 比湿, 地表面気圧を返します.
なお, 与えられた ini_dat が Create によって初期設定 されていない場合, プログラムはエラーを発生させます.
Return initial data for GCM. Vorticity, divergence, temperature, specific humidity, surface pressure are returned.
If ini_dat is not initialized by "Create" yet, error is occurred.
subroutine IniDataGetData( ini_dat, xyz_U, xyz_V, xyz_Vor, xyz_Div, xyz_Temp, xyz_QVap, xy_Ps, err )
!
! GCM 用の初期値データを返します.
! 渦度, 発散, 温度, 比湿, 地表面気圧を返します.
!
! なお, 与えられた *ini_dat* が Create によって初期設定
! されていない場合, プログラムはエラーを発生させます.
!
! Return initial data for GCM.
! Vorticity, divergence, temperature, specific humidity, surface pressure
! are returned.
!
! If *ini_dat* 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(INIDAT), intent(inout):: ini_dat
real(DP), intent(out), optional:: xyz_U (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1)
! $ u $ . 東西風速. Zonal wind
real(DP), intent(out), optional:: xyz_V (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1)
! $ v $ . 南北風速. Meridional wind
real(DP), intent(out), optional:: xyz_Vor (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1)
! $ \zeta $ . 渦度. Vorticity
real(DP), intent(out), optional:: xyz_Div (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1)
! $ D $ . 発散. Divergence
real(DP), intent(out), optional:: xyz_Temp (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1)
! $ T $ . 温度. Temperature
real(DP), intent(out), optional:: xyz_QVap (0:ini_dat%imax-1, 0:ini_dat%jmax-1, 0:ini_dat%kmax-1)
! $ q $ . 比湿. Specific humidity
real(DP), intent(out), optional:: xy_Ps (0:ini_dat%imax-1, 0:ini_dat%jmax-1)
! $ p_s $ . 地表面気圧. Surface pressure
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
character(*), parameter:: subname = 'IniDataGet'
continue
call BeginSub(subname)
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 初期設定のチェック
! Check initialization
!-----------------------------------------------------------------
if (.not. ini_dat % initialized) then
stat = DCPAM_ENOTINIT
cause_c = 'INIDAT'
goto 999
end if
!-----------------------------------------------------------------
! *ini_dat* に格納される初期値データの取り出し
! Fetch initial data from *ini_dat*
!-----------------------------------------------------------------
if ( present( xyz_U ) ) xyz_U = ini_dat % xyz_U
if ( present( xyz_V ) ) xyz_V = ini_dat % xyz_V
if ( present( xyz_Vor ) ) xyz_Vor = ini_dat % xyz_Vor
if ( present( xyz_Div ) ) xyz_Div = ini_dat % xyz_Div
if ( present( xyz_Temp ) ) xyz_Temp = ini_dat % xyz_Temp
if ( present( xy_Ps ) ) xy_Ps = ini_dat % xy_Ps
if ( present( xyz_QVap ) ) xyz_QVap = ini_dat % xyz_QVap
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError(stat, subname, err, cause_c)
call EndSub(subname)
end subroutine IniDataGetData
| Subroutine : | |||||||||||
| nmlfile : | character(*), intent(in)
| ||||||||||
| Cp : | real(DP), intent(inout)
| ||||||||||
| RAir : | real(DP), intent(inout)
| ||||||||||
| EpsV : | real(DP), intent(inout)
| ||||||||||
| TempAvr : | real(DP), intent(inout)
| ||||||||||
| TempMin : | real(DP), intent(inout)
| ||||||||||
| PsAvr : | real(DP), intent(inout)
| ||||||||||
| QVapAvr : | real(DP), intent(inout)
| ||||||||||
| pattern_ : | character(*), 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#initial_data_nml .
subroutine IniDataNmlRead( nmlfile, Cp, RAir, EpsV, TempAvr, TempMin, PsAvr, QVapAvr, pattern_, 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: StoreError, DC_NOERR, DC_ENOFILEREAD
implicit none
character(*), intent(in):: nmlfile
! NAMELIST ファイルの名称.
! NAMELIST file name
!!$ integer, intent(inout):: nmax ! 最大全波数.
!!$ ! Maximum truncated wavenumber
!!$ integer, intent(inout):: imax ! 経度格子点数.
!!$ ! Number of grid points in longitude
!!$ integer, intent(inout):: jmax ! 緯度格子点数.
!!$ ! Number of grid points in latitude
!!$ integer, intent(inout):: kmax ! 鉛直層数.
!!$ ! Number of vertical level
real(DP), intent(inout):: Cp ! $ C_p $ . 大気定圧比熱. Specific heat of air at constant pressure
real(DP), intent(inout):: RAir ! $ R $ . 大気気体定数. Gas constant of air
real(DP), intent(inout):: EpsV ! $ \epsilon_v $ . 水蒸気分子量比. Molecular weight of water vapor
!!$ real(DP), intent(inout):: Grav ! $ g $ . 重力加速度. Gravitational acceleration
!!$ real(DP), intent(inout):: EL ! $ L $ . 水の凝結の潜熱. Latent heat of condensation of water vapor
!!$ real(DP), intent(inout):: RVap ! $ R_v $ . 水蒸気気体定数. Gas constant of water vapor
!!$ real(DP), intent(inout):: ES0 ! $ e^{*} $ (273K) . 0 ℃での飽和蒸気圧. Saturated vapor pressure at 0 degrees C
real(DP), intent(inout):: TempAvr
! $ \bar{T} $ . 温度平均値. Mean temperature
real(DP), intent(inout):: TempMin
! $ T_{min} $ . 温度最小値. Minimum temperature
real(DP), intent(inout):: PsAvr
! $ \bar{p_s} $ . 地表面気圧平均値. Mean surface pressure
real(DP), intent(inout):: QVapAvr
! $ \bar{q} $ . 比湿平均値. Mean specific humidity
character(*), intent(inout):: pattern_
character(TOKEN):: pattern
! 初期値データのパターン.
! 以下のパターンを選択可能.
!
! Initial data pattern
! Available patterns are as follows.
!
! * "AGCM 5.3 Default"
! * "Sugiyama et al. (2008)"
!
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 /initial_data_nml/ Cp, RAir, EpsV, TempAvr, TempMin, PsAvr, QVapAvr, pattern
! initial_data モジュール用
! NAMELIST 変数群名.
!
! initial_data#Create を使用する際に,
! オプショナル引数 *nmlfile* へ NAMELIST
! ファイル名を指定することで, そのファイルから
! この NAMELIST 変数群を読み込みます.
!
! NAMELIST group name for
! "initial_data" module.
!
! If a NAMELIST filename is specified to
! an optional argument *nmlfile*
! when "initial_data#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(*), parameter:: subname = 'IniDataNmlRead'
continue
call BeginSub( subname )
stat = DC_NOERR
cause_c = ''
!-----------------------------------------------------------------
! 文字型引数を NAMELIST 変数群へ代入
! Substitute character arguments to NAMELIST group
!-----------------------------------------------------------------
pattern = pattern_
!----------------------------------------------------------------
! 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 = initial_data_nml, iostat = iostat_nml ) ! (out)
if ( iostat_nml == 0 ) then
call MessageNotify( 'M', subname, 'NAMELIST group "%c" is loaded from "%c".', c1='initial_data_nml', c2=trim(nmlfile) )
write(STDOUT, nml = initial_data_nml)
else
call MessageNotify( 'W', subname, 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', c1='initial_data_nml', c2=trim(nmlfile), i=(/iostat_nml/) )
end if
close( unit_nml )
!-----------------------------------------------------------------
! NAMELIST 変数群を文字型引数へ代入
! Substitute NAMELIST group to character arguments
!-----------------------------------------------------------------
pattern_ = pattern
!-----------------------------------------------------------------
! 終了処理, 例外処理
! Termination and Exception handling
!-----------------------------------------------------------------
999 continue
call StoreError( stat, subname, err, cause_c )
call EndSub( subname )
end subroutine IniDataNmlRead
| Subroutine : | |||||||||||
| nmlfile : | character(*), intent(in)
| ||||||||||
| Cp : | real(DP), intent(inout)
| ||||||||||
| RAir : | real(DP), intent(inout)
| ||||||||||
| EpsV : | real(DP), intent(inout)
| ||||||||||
| TempAvr : | real(DP), intent(inout)
| ||||||||||
| TempMin : | real(DP), intent(inout)
| ||||||||||
| PsAvr : | real(DP), intent(inout)
| ||||||||||
| QVapAvr : | real(DP), intent(inout)
| ||||||||||
| pattern_ : | character(*), 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#initial_data_nml .
Alias for IniDataNmlRead
| Constant : | |
| version = ’$Name: dcpam4-20080626 $’ // ’$Id: initial_data.f90,v 1.17 2008-06-14 04:07:41 morikawa Exp $’ : | character(*), parameter |