Class negative_moist
In: util/negative_moist.f90

負の水蒸気除去

Remove negative moisture

Note that Japanese and English are described in parallel.

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

Remove negative moisture

Procedures List

RemoveNegMoist :負の水蒸気の除去
————— :—————
RemoveNegMoist :Remove negative moisture

Methods

Included Modules

gridset composition dc_types dc_message intavr_operate timeset namelist_util dc_iounit dc_string constants axesset

Public Instance methods

Subroutine :
xyzf_QMix(0:imax-1, 1:jmax, 1:kmax, 1:ncmax) :real(DP), intent(inout)
: $ q $ . 比湿. Specific humidity
xyzf_DNegQMixDt(0:imax-1, 1:jmax, 1:kmax, 1:ncmax) :real(DP), intent(inout)
: $ DP{q}{t} $ . 比湿補正率. Specific humidity correction
xyr_Press(0:imax-1, 1:jmax, 0:kmax) :real(DP), intent(in )
: $ hat{p} $ . 気圧 (半整数レベル). Air pressure (half level)

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

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

[Source]

  subroutine RemoveNegMoist( xyzf_QMix, xyzf_DNegQMixDt, xyr_Press )
    !
    ! *xyz_QMix* の負の値を除去します. 
    ! *xyz_DNegQMixDt* には *xyz_QMix* の変化量が返ります. 
    ! *xyz_DNegQMixDt* は入出力引数なので, 変化量は入力値に
    ! 上乗せされて返ります. 入力された値は *xyz_QMix* の変化量に
    ! 影響を及ぼしません. 
    !
    ! Remove negative values in *xyz_QMix*. 
    ! Variation of *xyz_QMix* is returned to *xyz_DNegQMixDt*. 
    ! So *xyz_DNegQMixDt* is input/output argument, variation is 
    ! added on input values. Input values do not have influence on
    ! variation of *xyz_QMix*. 
    !

    ! モジュール引用 ; USE statements
    !

    ! 積分と平均の操作
    ! Operation for integral and average
    !
    use intavr_operate, only: AvrLonLat_xy

    ! 時刻管理
    ! Time control
    !
    use timeset, only: DelTime, TimesetClockStart, TimesetClockStop

    ! 宣言文 ; Declaration statements
    !
    implicit none
    real(DP), intent(inout):: xyzf_QMix      (0:imax-1, 1:jmax, 1:kmax, 1:ncmax)
                              ! $ q $ .     比湿. Specific humidity
    real(DP), intent(inout):: xyzf_DNegQMixDt(0:imax-1, 1:jmax, 1:kmax, 1:ncmax)
                              ! $ \DP{q}{t} $ .  比湿補正率. 
                              ! Specific humidity correction
    real(DP), intent(in   ):: xyr_Press      (0:imax-1, 1:jmax, 0:kmax)
                              ! $ \hat{p} $ . 気圧 (半整数レベル). 
                              ! Air pressure (half level)

    ! 作業変数
    ! Work variables
    !
    real(DP):: xyz_QMixBefCor (0:imax-1, 1:jmax, 1:kmax)
                              ! 修正前の比湿. 
                              ! Specific humidity before correction. 
    real(DP):: xy_QMixW (0:imax-1, 1:jmax)
                              ! 比湿 (作業変数). 
                              ! Specific humidity (work variable). 

    real(DP):: xyz_DelPress(0:imax-1, 1:jmax, 1:kmax)
                              ! $ \Delta p $
                              ! 
    real(DP):: xyz_QMixDelPress(0:imax-1, 1:jmax, 1:kmax)
                              ! $ q \Delta p $
                              ! 
    real(DP):: xyz_DelQMixDelPress (0:imax-1, 1:jmax, 1:kmax)
                              ! $ \Delta q \Delta p $
                              ! 
    real(DP):: QMixDelPressAvrXYZ
                              ! $ \int<q \Delta p>dz $
                              ! 
    real(DP):: DelQMixDelPressAvrXYZ
                              ! $ \int<\Delta q \Delta p>dz $
                              ! 

    integer:: k               ! 鉛直方向に回る DO ループ用作業変数
                              ! Work variables for DO loop in vertical direction
    integer:: n               ! 組成方向に回る DO ループ用作業変数
                              ! Work variables for DO loop in dimension of constituents

    ! 実行文 ; Executable statement
    !

    ! 計算時間計測開始
    ! Start measurement of computation time
    !
    call TimesetClockStart( module_name )

    ! 初期化
    ! Initialization
    !
    if ( .not. negative_moist_inited ) call NegMoistInit

    ! $ \Delta p $ の計算
    ! Calculate $ \Delta p $
    !
    do k = 1, kmax
      xyz_DelPress(:,:,k) = xyr_Press(:,:,k-1) - xyr_Press(:,:,k)
    end do

    do n = 1, ncmax

      if ( all( xyzf_QMix(:,:,:,n) < 0.0_DP ) ) then
        call MessageNotify( 'E', module_name, 'Masses of constituents at all grid points are negative. They cannot be fixed.' )
      end if

      ! 修正前の比湿の保存
      ! Save specific humidity before correction
      !
      xyz_QMixBefCor = xyzf_QMix(:,:,:,n)

      ! 局所での補正 (負の値を最下層へ)
      ! Correction at local (Negative values moved to bottom layer)
      !
      xy_QMixW = 0.0_DP
      do k = kmax, 2, -1
        where ( xyzf_QMix(:,:,k,n) < 0.0_DP )
          xy_QMixW = - xyzf_QMix(:,:,k,n) * xyz_DelPress(:,:,k) / xyz_DelPress(:,:,k-1)
          xyzf_QMix(:,:,k,  n) = 0.0_DP
          xyzf_QMix(:,:,k-1,n) = xyzf_QMix(:,:,k-1,n) - xy_QMixW
        end where
      end do

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

      ! 各層における補正量の算出
      ! Calculate amount of correction in each layer
      !
      xyz_QMixDelPress = xyzf_QMix(:,:,:,n) * xyz_DelPress
      where ( xyz_QMixDelPress < 0.0_DP )
        xyz_DelQMixDelPress = - xyz_QMixDelPress
      elsewhere
        xyz_DelQMixDelPress = 0.0_DP
      end where

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

      do k = 1, kmax
        QMixDelPressAvrXYZ = QMixDelPressAvrXYZ + AvrLonLat_xy( xyz_QMixDelPress(:,:,k) )

        DelQMixDelPressAvrXYZ = DelQMixDelPressAvrXYZ + AvrLonLat_xy( xyz_DelQMixDelPress(:,:,k) )
      end do

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

      if ( any( xyzf_QMix(:,:,:,n) < 0.0_DP ) ) then
        call MessageNotify( 'E', module_name, 'Unexpected error. Negative massese of constituents cannot be fixed.' )
      end if

      ! 比湿変化の算出
      ! Calculate specific humidity variance
      !
      xyzf_DNegQMixDt(:,:,:,n) = xyzf_DNegQMixDt(:,:,:,n) + ( xyzf_QMix(:,:,:,n) - xyz_QMixBefCor ) / ( 2.0_DP * DelTime )

    end do

    ! 計算時間計測一時停止
    ! Pause measurement of computation time
    !
    call TimesetClockStop( module_name )

  end subroutine RemoveNegMoist
negative_moist_inited
Variable :
negative_moist_inited = .false. :logical, save, public
: 初期設定フラグ. Initialization flag

Private Instance methods

Subroutine :

依存モジュールの初期化チェック

Check initialization of dependency modules

[Source]

  subroutine InitCheck
    !
    ! 依存モジュールの初期化チェック
    !
    ! Check initialization of dependency modules

    ! モジュール引用 ; USE statements
    !

    ! NAMELIST ファイル入力に関するユーティリティ
    ! Utilities for NAMELIST file input
    !
    use namelist_util, only: namelist_util_inited

    ! 格子点設定
    ! Grid points settings
    !
    use gridset, only: gridset_inited

    ! 物理定数設定
    ! Physical constants settings
    !
    use constants, only: constants_inited

    ! 座標データ設定
    ! Axes data settings
    !
    use axesset, only: axesset_inited

    ! 時刻管理
    ! Time control
    !
    use timeset, only: timeset_inited

    ! 実行文 ; Executable statement
    !

    if ( .not. namelist_util_inited ) call MessageNotify( 'E', module_name, '"namelist_util" module is not initialized.' )

    if ( .not. gridset_inited ) call MessageNotify( 'E', module_name, '"gridset" module is not initialized.' )

    if ( .not. constants_inited ) call MessageNotify( 'E', module_name, '"constants" module is not initialized.' )

    if ( .not. axesset_inited ) call MessageNotify( 'E', module_name, '"axesset" module is not initialized.' )

    if ( .not. timeset_inited ) call MessageNotify( 'E', module_name, '"timeset" module is not initialized.' )

  end subroutine InitCheck
Subroutine :

negative_moist モジュールの初期化を行います. NAMELIST#negative_moist_nml の読み込みはこの手続きで行われます.

"negative_moist" module is initialized. "NAMELIST#negative_moist_nml" is loaded in this procedure.

[Source]

  subroutine NegMoistInit
    !
    ! negative_moist モジュールの初期化を行います. 
    ! NAMELIST#negative_moist_nml の読み込みはこの手続きで行われます. 
    !
    ! "negative_moist" module is initialized. 
    ! "NAMELIST#negative_moist_nml" is loaded in this procedure. 
    !

    ! モジュール引用 ; USE statements
    !

    ! NAMELIST ファイル入力に関するユーティリティ
    ! Utilities for NAMELIST file input
    !
    use namelist_util, only: namelist_filename, NmlutilMsg

    ! ファイル入出力補助
    ! File I/O support
    !
    use dc_iounit, only: FileOpen

    ! 種別型パラメタ
    ! Kind type parameter
    !
    use dc_types, only: STDOUT ! 標準出力の装置番号. Unit number of standard output

    ! 文字列操作
    ! Character handling
    !
    use dc_string, only: StoA

    ! 宣言文 ; Declaration statements
    !
    implicit none

!!$    integer:: unit_nml        ! NAMELIST ファイルオープン用装置番号. 
!!$                              ! Unit number for NAMELIST file open
!!$    integer:: iostat_nml      ! NAMELIST 読み込み時の IOSTAT. 
!!$                              ! IOSTAT of NAMELIST read

    ! NAMELIST 変数群
    ! NAMELIST group name
    !
!!$    namelist /negative_moist_nml/
          !
          ! デフォルト値については初期化手続 "negative_moist#NegMoistInit" 
          ! のソースコードを参照のこと. 
          !
          ! Refer to source codes in the initialization procedure
          ! "negative_moist#NegMoistInit" for the default values. 
          !

    ! 実行文 ; Executable statement
    !

    if ( negative_moist_inited ) return
    call InitCheck

    ! デフォルト値の設定
    ! Default values settings
    !

!!$    ! NAMELIST の読み込み
!!$    ! NAMELIST is input
!!$    !
!!$    if ( trim(namelist_filename) /= '' ) then
!!$      call FileOpen( unit_nml, &          ! (out)
!!$        & namelist_filename, mode = 'r' ) ! (in)
!!$
!!$      rewind( unit_nml )
!!$      read( unit_nml, &           ! (in)
!!$        & nml = negative_moist_nml, &  ! (out)
!!$        & iostat = iostat_nml )   ! (out)
!!$      close( unit_nml )
!!$
!!$      call NmlutilMsg( iostat_nml, module_name ) ! (in)
!!$    end if

    ! 印字 ; Print
    !
    call MessageNotify( 'M', module_name, '----- Initialization Messages -----' )
    call MessageNotify( 'M', module_name, '-- version = %c', c1 = trim(version) )

    negative_moist_inited = .true.
  end subroutine NegMoistInit
module_name
Constant :
module_name = ‘negative_moist :character(*), parameter
: モジュールの名称. Module name
version
Constant :
version = ’$Name: dcpam5-20100224 $’ // ’$Id: negative_moist.f90,v 1.5 2009-09-01 15:37:29 yot Exp $’ :character(*), parameter
: モジュールのバージョン Module version

[Validate]