Class phy_neg_moist
In: physics/phy_neg_moist.f90

負の水蒸気除去

Remove negative moisture

Note that Japanese and English are described in parallel.

負の水蒸気を除去します.

Remove negative moisture

Procedures List

Create :PHYNEGMST 型変数の初期設定
RemoveNegQVap :負の水蒸気の除去
Close :PHYNEGMST 型変数の終了処理
PutLine :PHYNEGMST 型変数に格納されている情報の印字
initialized :PHYNEGMST 型変数が初期設定されているか否か
———— :————
Create :Constructor of "PHYNEGMST"
RemoveNegQVap :Remove negative moisture
Close :Deconstructor of "PHYNEGMST"
PutLine :Print information of "PHYNEGMST"
initialized :Check initialization of "PHYNEGMST"

Usage

始めに, PHYNEGMST 型の変数を定義し, Create で初期設定を行います. 負の水蒸気を除去する場合には RemoveNegQVap を用いてください. PHYNEGMST 型の変数の終了処理には Close を用いてください.

First, initialize "PHYNEGMST" by "Create". In order to remove negative moisture, use "RemoveNegQVap". In order to terminate "PHYNEGMST", use "Close".

Methods

Included Modules

dc_types intavr_operate dc_trace dc_string dc_present dc_message dc_error dc_iounit

Attributes

Derived_Types  []  PHYNEGMST

Public Instance methods

Close( phy_neg_mst, [err] )
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(inout)
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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.

PHYNEGMST 型の変数の終了処理を行います. なお, 与えられた phy_neg_mstCreate によって初期設定 されていない場合, プログラムはエラーを発生させます.

Deconstructor of "PHYNEGMST". Note that if phy_neg_mst is not initialized by "Create" yet, error is occurred.

Alias for PhyNegMoistClose

Create( phy_neg_mst, imax, jmax, kmax, PI, DelTime, [x_Lon_Weight], [y_Lat_Weight], [nmlfile], [err] )
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(inout)
imax :integer, intent(in)
: 経度格子点数. Number of grid points in longitude
jmax :integer, intent(in)
: 緯度格子点数. Number of grid points in latitude
kmax :integer, intent(in)
: 鉛直層数. Number of vertical level
PI :real(DP), intent(in)
: $ \pi $ . 円周率. Circular constant
DelTime :real(DP), intent(in)
: $ \Delta t $ . タイムステップ. Time step
x_Lon_Weight(0:imax-1) :real(DP), intent(in), optional
: 経度座標重み. Weight of longitude
y_Lat_Weight(0:jmax-1) :real(DP), intent(in), optional
: 緯度座標重み. Weight of latitude
nmlfile :character(*), intent(in), optional
: NAMELIST ファイルの名称. この引数に空文字以外を与えた場合, 指定されたファイルから NAMELIST 変数群を読み込みます. ファイルを読み込めない場合にはエラーを 生じます.

NAMELIST 変数群の詳細に関しては NAMELIST#phy_neg_moist_nml を参照してください.

NAMELIST file name. If nonnull character is specified to this argument, NAMELIST group name is loaded from the file. If the file can not be read, an error occurs.

See "NAMELIST#phy_neg_moist_nml" for details about a NAMELIST group.

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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.

PHYNEGMST 型の変数の初期設定を行います. 他のサブルーチンを使用する前に必ずこのサブルーチンによって PHYNEGMST 型の変数を初期設定してください.

なお, 与えられた phy_neg_mst が既に初期設定されている場合, プログラムはエラーを発生させます.

NAMELIST を利用する場合には引数 nmlfileNAMELIST ファイル名 を与えてください. NAMELIST 変数群の詳細に関しては NAMELIST#phy_neg_moist_nml を参照してください.

Constructor of "PHYNEGMST". Initialize phy_neg_mst by this subroutine, before other procedures are used,

Note that if phy_neg_mst is already initialized by this procedure, error is occurred.

In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile. See "NAMELIST#phy_neg_moist_nml" for details about a NAMELIST group.

Alias for PhyNegMoistCreate

PHYNEGMST
Derived Type :
initialized = .false. :logical
: 初期設定フラグ. Initialization flag
imax :integer
: 経度格子点数. Number of grid points in longitude
jmax :integer
: 緯度格子点数. Number of grid points in latitude
kmax :integer
: 鉛直層数. Number of vertical level
DelTime :real(DP)
: $ \Delta t $ . タイムステップ. Time step
intavr_opr :type(INTAVROPR)

まず, Create で "PHYNEGMST" 型の変数を初期設定して下さい. 初期設定された "PHYNEGMST" 型の変数を再度利用する際には, Close によって終了処理を行ってください.

Initialize "PHYNEGMST" variable by "Create" before usage. If you reuse "PHYNEGMST" variable again for another application, terminate by "Close".

PutLine( phy_neg_mst, [unit], [indent], [err] )
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(in)
unit :integer, intent(in), optional
: 出力先の装置番号. デフォルトの出力先は標準出力.

Unit number for output. Default value is standard output.

indent :character(*), intent(in), optional
: 表示されるメッセージの字下げ.

Indent of displayed messages.

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

引数 phy_neg_mst に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.

Print information of phy_neg_mst. By default messages are output to standard output. Unit number for output can be changed by unit argument.

Alias for PhyNegMoistPutLine

RemoveNegQVap( phy_neg_mst, xyz_QVap, xyz_DNegQVapDt, xyr_Press, [err] )
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(inout)
xyz_QVap(0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1) :real(DP), intent(inout)
: $ q $ . 比湿. Specific humidity
xyz_DNegQVapDt(0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1) :real(DP), intent(inout)
: 比湿補正率. Specific humidity correction
xyr_Press(0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax) :real(DP), intent(in)
: $ P_s $ . 地表面気圧 (半整数レベル). Surface pressure (half level)
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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.

xyz_QVap の負の値を除去します. xyz_DNegQVapDt には xyz_QVap の変化量が返ります. xyz_DNegQVapDt は入出力引数なので, 変化量は入力値に 上乗せされて返ります. 入力された値は xyz_QVap の変化量に 影響を及ぼしません.

なお, 与えられた phy_neg_mstCreate によって初期設定 されていない場合, プログラムはエラーを発生させます.

Remove negative values in xyz_QVap. Variation of xyz_QVap is returned to xyz_DNegQVapDt. So xyz_DNegQVapDt is input/output argument, variation is added on input values. Input values do not have influence on variation of xyz_QVap.

If phy_neg_mst is not initialized by "Create" yet, error is occurred.

Alias for PhyNegMoistRemoveNegQVap

initialized( phy_neg_mst ) result(result)
Function :
result :logical
phy_neg_mst :type(PHYNEGMST), intent(in)

phy_neg_mst が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.

If phy_neg_mst is initialized, .true. is returned. If phy_neg_mst is not initialized, .false. is returned.

Alias for PhyNegMoistInitialized

Private Instance methods

NmlRead( nmlfile, [err] )
Subroutine :
nmlfile :character(*), intent(in)
: NAMELIST ファイルの名称. NAMELIST file name
!$ integer, intent(inout):param_i
!$ real(DP), intent(inout):param_r
!$ character(*), intent(inout):param_c_
!$ character(TOKEN):param_c
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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 ファイル 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.

Alias for PhyNegMoistNmlRead

Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(inout)
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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.

PHYNEGMST 型の変数の終了処理を行います. なお, 与えられた phy_neg_mstCreate によって初期設定 されていない場合, プログラムはエラーを発生させます.

Deconstructor of "PHYNEGMST". Note that if phy_neg_mst is not initialized by "Create" yet, error is occurred.

[Source]

  subroutine PhyNegMoistClose( phy_neg_mst, err )
    !
    ! PHYNEGMST 型の変数の終了処理を行います.
    ! なお, 与えられた *phy_neg_mst* が Create によって初期設定
    ! されていない場合, プログラムはエラーを発生させます.
    !
    ! Deconstructor of "PHYNEGMST".
    ! Note that if *phy_neg_mst* is not initialized by "Create" yet,
    ! error is occurred.
    !
    use intavr_operate, only: Close
    use dc_trace, only: BeginSub, EndSub
    use dc_string, only: PutLine, Printf
    use dc_types, only: DP, STRING, TOKEN, STDOUT
    use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT
    implicit none
    type(PHYNEGMST), intent(inout):: phy_neg_mst
    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 = 'PhyNegMoistClose'
  continue
    call BeginSub( subname )
    stat = DC_NOERR
    cause_c = ''

    !-----------------------------------------------------------------
    !  初期設定のチェック
    !  Check initialization
    !-----------------------------------------------------------------
    if ( .not. phy_neg_mst % initialized ) then
      stat = DC_ENOTINIT
      cause_c = 'PHYNEGMST'
      goto 999
    end if

    !-----------------------------------------------------------------
    !  "PHYNEGMST" の設定の消去
    !  Clear the settings for "PHYNEGMST"
    !-----------------------------------------------------------------
    call Close( intavr_opr = phy_neg_mst % intavr_opr, err = err )                                      ! (out)

    !-----------------------------------------------------------------
    !  終了処理, 例外処理
    !  Termination and Exception handling
    !-----------------------------------------------------------------
    phy_neg_mst % initialized = .false.
999 continue
    call StoreError( stat, subname, err, cause_c )
    call EndSub( subname )
  end subroutine PhyNegMoistClose
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(inout)
imax :integer, intent(in)
: 経度格子点数. Number of grid points in longitude
jmax :integer, intent(in)
: 緯度格子点数. Number of grid points in latitude
kmax :integer, intent(in)
: 鉛直層数. Number of vertical level
PI :real(DP), intent(in)
: $ \pi $ . 円周率. Circular constant
DelTime :real(DP), intent(in)
: $ \Delta t $ . タイムステップ. Time step
x_Lon_Weight(0:imax-1) :real(DP), intent(in), optional
: 経度座標重み. Weight of longitude
y_Lat_Weight(0:jmax-1) :real(DP), intent(in), optional
: 緯度座標重み. Weight of latitude
nmlfile :character(*), intent(in), optional
: NAMELIST ファイルの名称. この引数に空文字以外を与えた場合, 指定されたファイルから NAMELIST 変数群を読み込みます. ファイルを読み込めない場合にはエラーを 生じます.

NAMELIST 変数群の詳細に関しては NAMELIST#phy_neg_moist_nml を参照してください.

NAMELIST file name. If nonnull character is specified to this argument, NAMELIST group name is loaded from the file. If the file can not be read, an error occurs.

See "NAMELIST#phy_neg_moist_nml" for details about a NAMELIST group.

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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.

PHYNEGMST 型の変数の初期設定を行います. 他のサブルーチンを使用する前に必ずこのサブルーチンによって PHYNEGMST 型の変数を初期設定してください.

なお, 与えられた phy_neg_mst が既に初期設定されている場合, プログラムはエラーを発生させます.

NAMELIST を利用する場合には引数 nmlfileNAMELIST ファイル名 を与えてください. NAMELIST 変数群の詳細に関しては NAMELIST#phy_neg_moist_nml を参照してください.

Constructor of "PHYNEGMST". Initialize phy_neg_mst by this subroutine, before other procedures are used,

Note that if phy_neg_mst is already initialized by this procedure, error is occurred.

In order to use NAMELIST, specify a NAMELIST filename to argument nmlfile. See "NAMELIST#phy_neg_moist_nml" for details about a NAMELIST group.

[Source]

  subroutine PhyNegMoistCreate( phy_neg_mst, imax, jmax, kmax, PI, DelTime, x_Lon_Weight, y_Lat_Weight, nmlfile, err )
    !
    ! PHYNEGMST 型の変数の初期設定を行います.
    ! 他のサブルーチンを使用する前に必ずこのサブルーチンによって
    ! PHYNEGMST 型の変数を初期設定してください.
    !
    ! なお, 与えられた *phy_neg_mst* が既に初期設定されている場合,
    ! プログラムはエラーを発生させます.
    !
    ! NAMELIST を利用する場合には引数 *nmlfile* に NAMELIST ファイル名
    ! を与えてください. NAMELIST 変数群の詳細に関しては 
    ! NAMELIST#phy_neg_moist_nml を参照してください. 
    !
    ! Constructor of "PHYNEGMST".
    ! Initialize *phy_neg_mst* by this subroutine, 
    ! before other procedures are used, 
    !
    ! Note that if *phy_neg_mst* is already initialized 
    ! by this procedure, error is occurred.
    !
    ! In order to use NAMELIST, specify a NAMELIST filename to 
    ! argument *nmlfile*. See "NAMELIST#phy_neg_moist_nml"
    ! for details about a NAMELIST group.
    !
    use intavr_operate, only: Create
    use dc_trace, only: BeginSub, EndSub
    use dc_string, only: PutLine, Printf
    use dc_types, only: DP, STRING, TOKEN, STDOUT
    use dc_present, only: present_and_not_empty, present_and_true
    use dc_message, only: MessageNotify
    use dc_error, only: StoreError, DC_NOERR, DC_EALREADYINIT, DC_EARGLACK, DC_ENEGATIVE, DC_ENOFILEREAD
    implicit none
    type(PHYNEGMST), intent(inout):: phy_neg_mst
    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):: DelTime    ! $ \Delta t $ . タイムステップ. Time step
    real(DP), intent(in), optional:: x_Lon_Weight(0:imax-1)
                   ! 経度座標重み. 
                   ! Weight of longitude
    real(DP), intent(in), optional:: y_Lat_Weight(0:jmax-1)
                   ! 緯度座標重み. 
                   ! Weight of latitude
    character(*), intent(in), optional:: nmlfile
                              ! NAMELIST ファイルの名称. 
                              ! この引数に空文字以外を与えた場合, 
                              ! 指定されたファイルから 
                              ! NAMELIST 変数群を読み込みます. 
                              ! ファイルを読み込めない場合にはエラーを
                              ! 生じます.
                              !
                              ! NAMELIST 変数群の詳細に関しては 
                              ! NAMELIST#phy_neg_moist_nml 
                              ! を参照してください. 
                              !
                              ! NAMELIST file name. 
                              ! If nonnull character is specified to
                              ! this argument, 
                              ! NAMELIST group name is loaded from the 
                              ! file. 
                              ! If the file can not be read, 
                              ! an error occurs.
                              ! 
                              ! See "NAMELIST#phy_neg_moist_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. 

    !-----------------------------------
    !  作業変数
    !  Work variables
    integer:: stat
    character(STRING):: cause_c
    character(*), parameter:: subname = 'PhyNegMoistCreate'
  continue
    call BeginSub( subname, version )
    stat = DC_NOERR
    cause_c = ''

    !-----------------------------------------------------------------
    !  初期設定のチェック
    !  Check initialization
    !-----------------------------------------------------------------
    if ( phy_neg_mst % initialized ) then
      stat = DC_EALREADYINIT
      cause_c = 'PHYNEGMST'
      goto 999
    end if

    !-----------------------------------------------------------------
    !  引数の正当性のチェック
    !  Validation of arguments
    !-----------------------------------------------------------------
    if (imax < 1) then
      stat = DC_ENEGATIVE
      cause_c = 'imax'
      goto 999
    end if
    if (jmax < 1) then
      stat = DC_ENEGATIVE
      cause_c = 'jmax'
      goto 999
    end if
    if (kmax < 1) then
      stat = DC_ENEGATIVE
      cause_c = 'kmax'
      goto 999
    end if
    if (DelTime < 0.0_DP) then
      stat = DC_ENEGATIVE
      cause_c = 'DelTime'
      goto 999
    end if

    !-----------------------------------------------------------------
    !  波数・格子点の設定
    !  Configure wave number and grid point
    !-----------------------------------------------------------------
    phy_neg_mst % imax = imax
    phy_neg_mst % jmax = jmax
    phy_neg_mst % kmax = kmax

    !-----------------------------------------------------------------
    !  $ \Delta t $ の設定
    !  Configure $ \Delta t $
    !-----------------------------------------------------------------
    phy_neg_mst % DelTime = DelTime

    !-----------------------------------------------------------------
    !  平均操作用関数の設定
    !  Configure functions for average operation
    !-----------------------------------------------------------------
    call Create( intavr_opr = phy_neg_mst % intavr_opr, imax = imax, jmax = jmax, PI = PI, x_Lon_Weight = x_Lon_Weight, y_Lat_Weight = y_Lat_Weight, nmlfile = nmlfile, err = err )                                       ! (out)

    !-----------------------------------------------------------------
    !  "PHYNEGMST" の設定
    !  Configure the settings for "PHYNEGMST"
    !-----------------------------------------------------------------

    !-------------------------
    !  デフォルト値
    !  Default values
!!$    phy_neg_mst % param_r = 0.0_DP
!!$    phy_neg_mst % param_c = 'hogehoge'

    !-------------------------
    !  オプショナル引数からの値
    !  Values from optional arguments
!!$    phy_neg_mst % param_i = param_i
!!$    if ( present(param_r) )  phy_neg_mst % param_r = param_r
!!$    if ( present(param_c) )  phy_neg_mst % param_c = param_c

    !-------------------------
    !  NAMELIST からの値
    !  Values from NAMELIST

!!$    if ( present_and_not_empty(nmlfile) ) then
!!$      call MessageNotify( 'M', subname, &
!!$        & 'Loading NAMELIST file "%c" ...', &
!!$        & c1=trim(nmlfile) )
!!$      call NmlRead ( nmlfile = nmlfile, &      ! (in)
!!$        & param_i = phy_neg_mst % param_i, &   ! (inout)
!!$        & param_r = phy_neg_mst % param_r, &   ! (inout)
!!$        & param_c_ = phy_neg_mst % param_c, &  ! (inout)
!!$        & 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

    !-----------------------------------------------------------------
    !  設定値の正当性のチェック
    !  Validate setting values
    !-----------------------------------------------------------------
!!$    if ( phy_neg_mst % param_i < 0 ) then
!!$      stat = DC_ENEGATIVE
!!$      cause_c = 'param_i'
!!$      goto 999
!!$    end if


    !-----------------------------------------------------------------
    !  終了処理, 例外処理
    !  Termination and Exception handling
    !-----------------------------------------------------------------
    phy_neg_mst % initialized = .true.
999 continue
    call StoreError( stat, subname, err, cause_c )
    call EndSub( subname )
  end subroutine PhyNegMoistCreate
Function :
result :logical
phy_neg_mst :type(PHYNEGMST), intent(in)

phy_neg_mst が初期設定されている場合には .true. が, 初期設定されていない場合には .false. が返ります.

If phy_neg_mst is initialized, .true. is returned. If phy_neg_mst is not initialized, .false. is returned.

[Source]

  logical function PhyNegMoistInitialized( phy_neg_mst ) result(result)
    !
    ! *phy_neg_mst* が初期設定されている場合には .true. が,
    ! 初期設定されていない場合には .false. が返ります.
    !
    ! If *phy_neg_mst* is initialized, .true. is returned.
    ! If *phy_neg_mst* is not initialized, .false. is returned.
    !
    implicit none
    type(PHYNEGMST), intent(in):: phy_neg_mst
  continue
    result = phy_neg_mst % initialized
  end function PhyNegMoistInitialized
Subroutine :
nmlfile :character(*), intent(in)
: NAMELIST ファイルの名称. NAMELIST file name
!$ integer, intent(inout):param_i
!$ real(DP), intent(inout):param_r
!$ character(*), intent(inout):param_c_
!$ character(TOKEN):param_c
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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 ファイル 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.

[Source]

  subroutine PhyNegMoistNmlRead( nmlfile, err )
    !
    ! NAMELIST ファイル *nmlfile* から値を入力するための
    ! 内部サブルーチンです. Create 内で呼び出されることを
    ! 想定しています.
    !
    ! 値が NAMELIST ファイル内で指定されていない場合には,
    ! 入力された値がそのまま返ります.
    !
    ! なお, *nmlfile* に空文字が与えられた場合, または
    ! 与えられた *nmlfile* を読み込むことができない場合, 
    ! プログラムはエラーを発生させます.
    !
    ! This is an internal subroutine to input values from 
    ! NAMELIST file *nmlfile*. This subroutine is expected to be
    ! called by "Create".
    !
    ! A value not specified in NAMELIST file is returned
    ! without change.
    !
    ! If *nmlfile* is empty, or *nmlfile* can not be read, 
    ! error is occurred.
    !
    use dc_trace, only: BeginSub, EndSub
    use dc_string, only: PutLine, Printf
    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):: param_i
!!$    real(DP), intent(inout):: param_r
!!$    character(*), intent(inout):: param_c_
!!$    character(TOKEN):: param_c
    logical, intent(out), optional:: err
                              ! 例外処理用フラグ.
                              ! デフォルトでは, この手続き内でエラーが
                              ! 生じた場合, プログラムは強制終了します.
                              ! 引数 *err* が与えられる場合,
                              ! プログラムは強制終了せず, 代わりに
                              ! *err* に .true. が代入されます.
                              !
                              ! Exception handling flag. 
                              ! By default, when error occur in 
                              ! this procedure, the program aborts. 
                              ! If this *err* argument is given, 
                              ! .true. is substituted to *err* and 
                              ! the program does not abort. 

!!$    namelist /phy_neg_moist_nml/ &
!!$      & param_i, param_r, param_c
                              ! phy_neg_moist モジュール用
                              ! NAMELIST 変数群名.
                              !
                              ! phy_neg_moist#Create を使用する際に, 
                              ! オプショナル引数 *nmlfile* へ NAMELIST 
                              ! ファイル名を指定することで, そのファイルから
                              ! この NAMELIST 変数群を読み込みます.
                              !
                              ! NAMELIST group name for 
                              ! "phy_neg_moist" module.
                              ! 
                              ! If a NAMELIST filename is specified to 
                              ! an optional argument *nmlfile* 
                              ! when "phy_neg_moist#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 = 'PhyNegMoistNmlRead'
  continue
    call BeginSub( subname )
    stat = DC_NOERR
    cause_c = ''



    !-----------------------------------------------------------------
    !  文字型引数を NAMELIST 変数群へ代入
    !  Substitute character arguments to NAMELIST group
    !-----------------------------------------------------------------
!!$    param_c = param_c_

    !----------------------------------------------------------------
    !  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, & ! (in)
!!$      & nml = phy_neg_moist_nml, iostat = iostat_nml ) ! (out)
!!$    if ( iostat_nml == 0 ) then
!!$      call MessageNotify( 'M', subname, &
!!$        & 'NAMELIST group "%c" is loaded from "%c".', &
!!$        & c1 = 'phy_neg_moist_nml', c2 = trim(nmlfile) )
!!$      write(STDOUT, nml = phy_neg_moist_nml)
!!$    else
!!$      call MessageNotify( 'W', subname, &
!!$        & 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', &
!!$        & c1 = 'phy_neg_moist_nml', c2 = trim(nmlfile), &
!!$        & i = (/iostat_nml/) )
!!$    end if

    close( unit_nml )

    !-----------------------------------------------------------------
    !  NAMELIST 変数群を文字型引数へ代入
    !  Substitute NAMELIST group to character arguments
    !-----------------------------------------------------------------
!!$    param_c_ = param_c

    !-----------------------------------------------------------------
    !  終了処理, 例外処理
    !  Termination and Exception handling
    !-----------------------------------------------------------------
999 continue
    call StoreError( stat, subname, err, cause_c )
    call EndSub( subname )
  end subroutine PhyNegMoistNmlRead
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(in)
unit :integer, intent(in), optional
: 出力先の装置番号. デフォルトの出力先は標準出力.

Unit number for output. Default value is standard output.

indent :character(*), intent(in), optional
: 表示されるメッセージの字下げ.

Indent of displayed messages.

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

引数 phy_neg_mst に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.

Print information of phy_neg_mst. By default messages are output to standard output. Unit number for output can be changed by unit argument.

[Source]

  subroutine PhyNegMoistPutLine( phy_neg_mst, unit, indent, err )
    !
    ! 引数 *phy_neg_mst* に設定されている情報を印字します.
    ! デフォルトではメッセージは標準出力に出力されます. 
    ! *unit* に装置番号を指定することで, 出力先を変更することが可能です.
    !
    ! Print information of *phy_neg_mst*.
    ! By default messages are output to standard output.
    ! Unit number for output can be changed by *unit* argument.
    !
    use intavr_operate, only: PutLine
    use dc_trace, only: BeginSub, EndSub
    use dc_string, only: PutLine, Printf
    use dc_types, only: DP, STRING, TOKEN, STDOUT
    use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT
    implicit none
    type(PHYNEGMST), intent(in):: phy_neg_mst
    integer, intent(in), optional:: unit
                              ! 出力先の装置番号.
                              ! デフォルトの出力先は標準出力.
                              !
                              ! Unit number for output.
                              ! Default value is standard output.
    character(*), intent(in), optional:: indent
                              ! 表示されるメッセージの字下げ.
                              !
                              ! Indent of displayed messages.
    logical, intent(out), optional:: err
                              ! 例外処理用フラグ.
                              ! デフォルトでは, この手続き内でエラーが
                              ! 生じた場合, プログラムは強制終了します.
                              ! 引数 *err* が与えられる場合,
                              ! プログラムは強制終了せず, 代わりに
                              ! *err* に .true. が代入されます.
                              !
                              ! Exception handling flag. 
                              ! By default, when error occur in 
                              ! this procedure, the program aborts. 
                              ! If this *err* argument is given, 
                              ! .true. is substituted to *err* and 
                              ! the program does not abort. 

    !-----------------------------------
    !  作業変数
    !  Work variables
    integer:: stat
    character(STRING):: cause_c
    integer:: out_unit
    integer:: indent_len
    character(STRING):: indent_str
    character(*), parameter:: subname = 'PhyNegMoistPutLine'
  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


    !-----------------------------------------------------------------
    !  "PHYNEGMST" の設定の印字
    !  Print the settings for "PHYNEGMST"
    !-----------------------------------------------------------------
    if ( phy_neg_mst % initialized ) then
      call Printf( out_unit, indent_str(1:indent_len) // '#<PHYNEGMST:: @initialized=%y', l = (/phy_neg_mst % initialized/) )

      call Printf( out_unit, indent_str(1:indent_len) // ' @imax=%d @jmax=%d @kmax=%d', i = (/phy_neg_mst % imax, phy_neg_mst % jmax, phy_neg_mst % kmax/) )

      call Printf( out_unit, indent_str(1:indent_len) // ' @DelTime=%f', d = (/phy_neg_mst % DelTime/) )

      call PutLine( intavr_opr = phy_neg_mst % intavr_opr, unit = out_unit, indent = indent_str(1:indent_len) // ' ', err = err )

      call Printf( out_unit, indent_str(1:indent_len) // '>' )
    else
      call Printf( out_unit, indent_str(1:indent_len) // '#<PHYNEGMST:: @initialized=%y>', l = (/phy_neg_mst % initialized/) )
    end if

    !-----------------------------------------------------------------
    !  終了処理, 例外処理
    !  Termination and Exception handling
    !-----------------------------------------------------------------
999 continue
    call StoreError( stat, subname, err, cause_c )
    call EndSub( subname )
  end subroutine PhyNegMoistPutLine
Subroutine :
phy_neg_mst :type(PHYNEGMST), intent(inout)
xyz_QVap(0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1) :real(DP), intent(inout)
: $ q $ . 比湿. Specific humidity
xyz_DNegQVapDt(0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1) :real(DP), intent(inout)
: 比湿補正率. Specific humidity correction
xyr_Press(0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax) :real(DP), intent(in)
: $ P_s $ . 地表面気圧 (半整数レベル). Surface pressure (half level)
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 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.

xyz_QVap の負の値を除去します. xyz_DNegQVapDt には xyz_QVap の変化量が返ります. xyz_DNegQVapDt は入出力引数なので, 変化量は入力値に 上乗せされて返ります. 入力された値は xyz_QVap の変化量に 影響を及ぼしません.

なお, 与えられた phy_neg_mstCreate によって初期設定 されていない場合, プログラムはエラーを発生させます.

Remove negative values in xyz_QVap. Variation of xyz_QVap is returned to xyz_DNegQVapDt. So xyz_DNegQVapDt is input/output argument, variation is added on input values. Input values do not have influence on variation of xyz_QVap.

If phy_neg_mst is not initialized by "Create" yet, error is occurred.

[Source]

  subroutine PhyNegMoistRemoveNegQVap( phy_neg_mst, xyz_QVap, xyz_DNegQVapDt, xyr_Press, err )
    !
    ! *xyz_QVap* の負の値を除去します. 
    ! *xyz_DNegQVapDt* には *xyz_QVap* の変化量が返ります. 
    ! *xyz_DNegQVapDt* は入出力引数なので, 変化量は入力値に
    ! 上乗せされて返ります. 入力された値は *xyz_QVap* の変化量に
    ! 影響を及ぼしません. 
    !
    ! なお, 与えられた *phy_neg_mst* が Create によって初期設定
    ! されていない場合, プログラムはエラーを発生させます.
    !
    ! Remove negative values in *xyz_QVap*. 
    ! Variation of *xyz_QVap* is returned to *xyz_DNegQVapDt*. 
    ! So *xyz_DNegQVapDt* is input/output argument, variation is 
    ! added on input values. Input values do not have influence on
    ! variation of *xyz_QVap*. 
    !
    ! If *phy_neg_mst* is not initialized by "Create" yet,
    ! error is occurred.
    !
    use intavr_operate, only: AvrLonLat_xy
    use dc_trace, only: BeginSub, EndSub
    use dc_string, only: PutLine, Printf
    use dc_types, only: DP, STRING, TOKEN, STDOUT
    use dc_error, only: StoreError, DC_NOERR, DC_ENOTINIT
    implicit none
    type(PHYNEGMST), intent(inout):: phy_neg_mst
    real(DP), intent(inout):: xyz_QVap (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1)
                              ! $ q $ .     比湿. Specific humidity

    real(DP), intent(inout):: xyz_DNegQVapDt (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1)
                              ! 比湿補正率. 
                              ! Specific humidity correction
    real(DP), intent(in):: xyr_Press (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax)
                              ! $ P_s $ . 地表面気圧 (半整数レベル). 
                              ! Surface pressure (half 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. 

    !-----------------------------------
    !  作業変数
    !  Work variables
    integer:: imax ! 経度格子点数. 
                               ! Number of grid points in longitude
    integer:: jmax ! 緯度格子点数. 
                               ! Number of grid points in latitude
    integer:: kmax ! 鉛直層数. 
                               ! Number of vertical level
    real(DP):: DelTime    ! $ \Delta t $ . タイムステップ. Time step

    real(DP):: xyz_QVapB (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1)
                              ! 調節前の比湿. 
                              ! Specific humidity before adjust. 
    real(DP):: xy_QVapW (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1)
                              ! 比湿 (作業変数). 
                              ! Specific humidity (work variable). 

    real(DP):: xyz_DPressDz (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1)
                              ! $ \Delta p $
                              ! 
    real(DP):: xyz_QVapDPressDz (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1)
                              ! $ q \Delta p $
                              ! 
    real(DP):: xyz_DelQVapDPressDz (0:phy_neg_mst%imax-1, 0:phy_neg_mst%jmax-1, 0:phy_neg_mst%kmax-1)
                              ! $ \Delta q \Delta p $
                              ! 
    real(DP):: QVapDPressDzAvrLonLatSig
                              ! $ \int<q \Delta p>dz $
                              ! 
    real(DP):: DelQVapDPressDzAvrLonLatSig
                              ! $ \int<\Delta q \Delta p>dz $
                              ! 

    type(INTAVROPR):: intavr_opr

    integer:: i, j, k         ! DO ループ用作業変数
                              ! Work variables for DO loop

    integer:: stat
    character(STRING):: cause_c
    character(*), parameter:: subname = 'PhyNegMoistRemoveNegQVap'
  continue
    call BeginSub( subname )
    stat = DC_NOERR
    cause_c = ''

    !-----------------------------------------------------------------
    !  初期設定のチェック
    !  Check initialization
    !-----------------------------------------------------------------
    if ( .not. phy_neg_mst % initialized ) then
      stat = DC_ENOTINIT
      cause_c = 'PHYNEGMST'
      goto 999
    end if

    !-----------------------------------------------------------------
    !  *phy_neg_mst* に格納されている設定値の取り出し
    !  Fetch setting values stored in *phy_neg_mst*
    !-----------------------------------------------------------------
    imax    = phy_neg_mst % imax
    jmax    = phy_neg_mst % jmax
    kmax    = phy_neg_mst % kmax
    DelTime = phy_neg_mst % DelTime
    intavr_opr = phy_neg_mst % intavr_opr

    !-----------------------------------------------------------------
    !  調節前の比湿の保存
    !  Save specific humidity before adjust
    !-----------------------------------------------------------------
    xyz_QVapB = xyz_QVap

    !-----------------------------------------------------------------
    !  $ \Delta p $ の計算
    !  Calculate $ \Delta p $
    !-----------------------------------------------------------------
    do k = 0, kmax-1
      do i = 0, imax-1
        do j = 0, jmax-1
          xyz_DPressDz(i,j,k) = xyr_Press(i,j,k) - xyr_Press(i,j,k+1)
        end do
      end do
    end do

    !-----------------------------------------------------------------
    !  局所での補正 (負の値を最下層へ)
    !  Correction at local (Negative values moved to botton layer)
    !-----------------------------------------------------------------
    xy_QVapW = 0.0_DP
    do k = kmax - 1, 1, -1
      where ( xyz_QVap(:,:,k) < 0.0_DP )
        xy_QVapW = - xyz_QVap(:,:,k) * xyz_DPressDz(:,:,k) / xyz_DPressDz(:,:,k-1)
        xyz_QVap(:,:,k) = 0.0_DP
        xyz_QVap(:,:,k-1) = xyz_QVap(:,:,k-1) - xy_QVapW
      end where
    end do

    !-----------------------------------------------------------------
    !  全球での補正
    !  Correction in global
    !-----------------------------------------------------------------

    !-----------------------------------
    !  各層における補正量の算出
    !  Calculate amount of correction in each layer
    xyz_QVapDPressDz = xyz_QVap * xyz_DPressDz
    where ( xyz_QVapDPressDz < 0.0_DP )
      xyz_DelQVapDPressDz = - xyz_QVapDPressDz
    elsewhere
      xyz_DelQVapDPressDz = 0.0_DP
    end where

    !-----------------------------------
    !  補正量の東西南北鉛直平均
    !  Zonal and meridional and vertical mean of amount of correction
    QVapDPressDzAvrLonLatSig = 0.0_DP
    DelQVapDPressDzAvrLonLatSig = 0.0_DP

    do k = 0, kmax-1
      QVapDPressDzAvrLonLatSig = QVapDPressDzAvrLonLatSig + AvrLonLat_xy( xyz_QVapDPressDz(:,:,k), intavr_opr )

      DelQVapDPressDzAvrLonLatSig = DelQVapDPressDzAvrLonLatSig + AvrLonLat_xy( xyz_DelQVapDPressDz(:,:,k), intavr_opr )
    end do

    !-----------------------------------
    !  負値をゼロとし, その分全体を引き下げる. 
    !  Minus values are brought back to zero, 
    !  and total is reduced by just that much
    if ( QVapDPressDzAvrLonLatSig /= 0.0_DP ) then 
      xyz_QVap = QVapDPressDzAvrLonLatSig / ( QVapDPressDzAvrLonLatSig + DelQVapDPressDzAvrLonLatSig ) * max( xyz_QVap, 0.0_DP )
    end if

    !-----------------------------------
    !  比湿変化の算出
    !  Calculate specific humidity variance
    xyz_DNegQVapDt = xyz_DNegQVapDt + ( xyz_QVap - xyz_QVapB ) / ( 2.0_DP * DelTime )

    !-----------------------------------------------------------------
    !  終了処理, 例外処理
    !  Termination and Exception handling
    !-----------------------------------------------------------------
999 continue
    call StoreError( stat, subname, err, cause_c )
    call EndSub( subname )
  end subroutine PhyNegMoistRemoveNegQVap
version
Constant :
version = ’$Name: dcpam4-20071012 $’ // ’$Id: phy_neg_moist.f90,v 1.2 2007/10/12 01:01:55 morikawa Exp $’ :character(*), parameter

[Validate]