!= Held and Suarez (1994) 縺ｫ繧医ｋ蠑ｷ蛻ｶ縺ｨ謨｣騾ｸ
!
!= Forcing and dissipation suggested by Held and Suarez (1994)
!
! Authors::   Yasuhiro MORIKAWA, Yoshiyuki O. TAKAHASHI
! Version::   $Id: held_suarez_1994.f90,v 1.14 2012/04/27 11:24:45 noda Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2008. All rights reserved.
! License::   See COPYRIGHT[link:../../../COPYRIGHT]
!

module held_suarez_1994
  !
  != Held and Suarez (1994) 縺ｫ繧医ｋ蠑ｷ蛻ｶ縺ｨ謨｣騾ｸ
  !
  != Forcing and dissipation suggested by Held and Suarez (1994)
  !
  ! <b>Note that Japanese and English are described in parallel.</b>
  !
  ! Held and Suarez (1994) 縺ｧ謠先｡医＆繧後ｋ荵ｾ辯･螟ｧ豌� GCM 繝吶Φ繝√�繝ｼ繧ｯ逕ｨ縺ｮ
  ! 蠑ｷ蛻ｶ縺ｨ謨｣騾ｸ繧定ｨ育ｮ励＠縺ｾ縺�.
  ! 荳弱∴繧句ｼｷ蛻ｶ縺ｨ謨｣騾ｸ縺ｨ縺励※, 貂ｩ蠎ｦ蝣ｴ縺ｮ蟶ｯ迥ｶ蟇ｾ遘ｰ蝣ｴ縺ｸ縺ｮ邁｡蜊倥↑繝九Η繝ｼ繝医Φ蜀ｷ蜊ｴ縺ｨ,
  ! 蠅�阜螻､鞫ｩ謫ｦ繧定｡ｨ迴ｾ縺吶ｋ荳句ｱ､鬚ｨ縺ｮ繝ｬ繧､繝ｪ繝ｼ鞫ｩ謫ｦ繧堤畑縺�∪縺�.
  ! 隧ｳ邏ｰ繧剃ｻ･荳九↓險倥＠縺ｾ縺�.
  !
  ! Forcing and dissipation for dry air GCM benchmark
  ! suggested by Held and Suarez (1994) are caluclate.
  ! We use simple Newtonian relaxation of the temperature field to a
  ! zonally symmetric state and Rayleigh damping of low-level winds to
  ! represent boundary-layer friction.
  ! Their specifications are detailed as follows.
  !
  ! \[
  !    \left( \DP{\Dvect{v}}{t} \right)_{\mathrm{HS94}} =
  !        - k_v (\sigma) \Dvect{v}, \] \[
  !    \left( \DP{T}{t} \right)_{\mathrm{HS94}} =
  !        - k_T (\phi, \sigma) [T - T_{eq} (\phi,p)], \] \[
  !    T_{eq} = \mathrm{max}
  !     \left\{
  !        200 \mathrm{K},
  !        \left[
  !          315 \mathrm{K} - (\Delta T)_y \sin^2\phi
  !                         - (\Delta \theta)_z
  !                           \log \left(\frac{p}{p_0}\right) \cos^2\phi
  !        \right] \left(\frac{p}{p_0}\right)^\kappa
  !     \right\}, \] \[
  !    k_T = k_a + (k_s - k_a)
  !          \mathrm{max}
  !          \left(0, \frac{\sigma - \sigma_b}{1 - \sigma_b}\right) \cos^4\phi,
  !     \] \[
  !    k_v = k_f
  !          \mathrm{max}
  !          \left(0, \frac{\sigma - \sigma_b}{1 - \sigma_b}\right),
  !     \] \[
  !    \sigma_b = 0.7, \qquad
  !    k_f = 1 \mathrm{day}^{-1}, \qquad
  !    k_a = \Dinv{40} \mathrm{day}^{-1}, \qquad
  !    k_s = \Dinv{4} \mathrm{day}^{-1}, \] \[
  !    (\Delta T)_y = 60 \mathrm{K}, \qquad
  !    (\Delta \theta)_z = 10 \mathrm{K}, \qquad
  !    p_0 = 1000 \mathrm{hPa}, \qquad
  !    \kappa = \frac{R}{c_p}.
  ! \]
  !
  ! Forcing 縺ｧ縺ｯ, 荳弱∴繧峨ｌ縺滄溷ｺｦ繧�ｸｩ蠎ｦ ( $ t+\Delta t$ 繧呈Φ螳�)
  ! 縺ｫ蟇ｾ縺励※莉･荳九�繧医≧縺ｫ蠑ｷ蛻ｶ縺ｨ謨｣騾ｸ繧帝←逕ｨ縺励∪縺�.
  !
  ! By Forcing, forcing and dissipation are applied to
  ! given wind and temperature ($ t+\Delta t$ is expected) as follows.
  !
  ! \[
  !    \hat{\Dvect{v}}^{t+\Delta t} =
  !      \Dvect{v}^{t+\Delta t}
  !      + 2 \Delta t \left( \DP{\Dvect{v}}{t} \right)_{\mathrm{HS94}} \] \[
  !    \hat{T}^{t+\Delta t} =
  !      T^{t+\Delta t}
  !      + 2 \Delta t \left( \DP{T}{t} \right)_{\mathrm{HS94}}
  ! \]
  !
  !== Procedures List
  !
  ! Hs94Forcing   :: 蠑ｷ蛻ｶ縺ｨ謨｣騾ｸ縺ｮ險育ｮ�
  ! Hs94Finalize  :: 邨ゆｺ��逅� (繝｢繧ｸ繝･繝ｼ繝ｫ蜀�Κ縺ｮ螟画焚縺ｮ蜑ｲ繧贋ｻ倥￠隗｣髯､)
  ! ------------  :: ------------
  ! Hs94Forcing   :: Calculate forcing and dissipation
  ! Hs94Finalize  :: Termination (deallocate variables in this module)
  !
  !--
  !== NAMELIST
  !
  ! NAMELIST#held_suarez_1994_nml
  !++
  !== References
  !
  ! * Held, I. M., Suarez, M. J., 1994:
  !   A proposal for the intercomparison of the dynamical cores of
  !   atmospheric general circuation models.
  !   <i>Bull. Am. Meteor. Soc.</i>, <b>75</b>, 1825--1830.
  !

  ! 繝｢繧ｸ繝･繝ｼ繝ｫ蠑慕畑 ; USE statements
  !

  ! 譬ｼ蟄千せ險ｭ螳�
  ! Grid points settings
  !
  use gridset, only: imax, & ! 邨悟ｺｦ譬ｼ蟄千せ謨ｰ.
                             ! Number of grid points in longitude
    &                jmax, & ! 邱ｯ蠎ｦ譬ｼ蟄千せ謨ｰ.
                             ! Number of grid points in latitude
    &                kmax    ! 驩帷峩螻､謨ｰ.
                             ! Number of vertical level

  ! 遞ｮ蛻･蝙九ヱ繝ｩ繝｡繧ｿ
  ! Kind type parameter
  !
  use dc_types, only: DP, &      ! 蛟咲ｲｾ蠎ｦ螳滓焚蝙�. Double precision.
    &                 STRING     ! 譁�ｭ怜�.       Strings.

  ! 繝｡繝�そ繝ｼ繧ｸ蜃ｺ蜉�
  ! Message output
  !
  use dc_message, only: MessageNotify

  ! 螳｣險譁� ; Declaration statements
  !
  implicit none
  private

  ! 蜈ｬ髢区焔邯壹″
  ! Public procedure
  !
  public :: HS94Forcing
  public :: HS94Init
  public :: HS94Finalize

  ! 蜈ｬ髢句､画焚
  ! Public variables
  !

  ! 髱槫�髢句､画焚
  ! Private variables
  !
  logical, save :: held_suarez_1994_inited = .false.
                              ! 蛻晄悄險ｭ螳壹ヵ繝ｩ繧ｰ.
                              ! Initialization flag

  real(DP):: Kappa            ! $ \kappa = R/C_p $ .
                              ! 豌嶺ｽ灘ｮ壽焚縺ｮ螳壼悸豈皮�縺ｫ蟇ｾ縺吶ｋ豈�. Ratio of gas constant to specific heat
  real(DP):: P0               ! $ p_0 $ .
  real(DP):: DelTempY         ! $ (\Delta T)_y $ .
                              ! 讌ｵ縺ｨ襍､驕薙�貂ｩ蠎ｦ蟾ｮ
  real(DP):: DelPotTempZ      ! $ (\Delta \theta)_z $ .
                              ! 襍､驕薙↓縺翫￠繧矩央逶ｴ譁ｹ蜷代�貂ｩ菴榊ｷｮ
  real(DP), allocatable:: z_kv (:)
                              ! $ k_v $ .
  real(DP), allocatable:: yz_kt (:,:)
                              ! $ k_T $ .

  character(*), parameter:: module_name = 'held_suarez_1994'
                              ! 繝｢繧ｸ繝･繝ｼ繝ｫ縺ｮ蜷咲ｧｰ.
                              ! Module name
  character(*), parameter:: version = &
    & '$Name:  $' // &
    & '$Id: held_suarez_1994.f90,v 1.14 2012/04/27 11:24:45 noda Exp $'
                              ! 繝｢繧ｸ繝･繝ｼ繝ｫ縺ｮ繝舌�繧ｸ繝ｧ繝ｳ
                              ! Module version

contains

  !--------------------------------------------------------------------------------------

  subroutine HS94Forcing( &
    & xyz_U,    xyz_V,    xyz_Temp, xy_Ps, & ! (in)
    & xyz_DUDt, xyz_DVDt, xyz_DTempDt &      ! (out)
    & )
    !
    ! 蠑墓焚縺ｨ縺励※荳弱∴繧峨ｌ縺滓擲隘ｿ鬚ｨ騾� xyz_U, 蜊怜圏鬚ｨ騾� xyz_V,
    ! 貂ｩ蠎ｦ xyz_Temp 縺九ｉ,
    ! 貂ｩ蠎ｦ蝣ｴ縺ｮ蟶ｯ迥ｶ蟇ｾ遘ｰ蝣ｴ縺ｸ縺ｮ邁｡蜊倥↑繝九Η繝ｼ繝医Φ蜀ｷ蜊ｴ縺ｨ
    ! 蠅�阜螻､鞫ｩ謫ｦ繧定｡ｨ迴ｾ縺吶ｋ荳句ｱ､鬚ｨ縺ｮ繝ｬ繧､繝ｪ繝ｼ鞫ｩ謫ｦ縺ｫ繧医ｋ
    ! 鬚ｨ騾溘→貂ｩ蠎ｦ縺ｮ螟牙喧邇�ｒ豎ゅａ,
    ! xyz_DUDt, xyz_DVDt, xyz_DTempDt 縺ｫ霑斐＠縺ｾ縺�.
    !
    ! Tendencies by simple Newtonian relaxation of the temperature field to a
    ! zonally symmetric state and Rayleigh damping of low-level winds to
    ! represent boundary-layer friction are calculated
    ! from eastward wind "xyz_U", northward wind "xyz_V",
    ! temperature "xyz_Temp".
    ! And the tencencies are returned as
    ! "xyz_DUDt", "xyz_DVDt", "xyz_DTempDt".
    !
    !

    ! 繝｢繧ｸ繝･繝ｼ繝ｫ蠑慕畑 ; USE statements
    !

    ! 蠎ｧ讓吶ョ繝ｼ繧ｿ險ｭ螳�
    ! Axes data settings
    !
    use axesset, only: &
      & y_Lat, &              ! $ \varphi $ [rad.] . 邱ｯ蠎ｦ. Latitude
      & z_Sigma               ! $ \sigma $ 繝ｬ繝吶Ν (謨ｴ謨ｰ).
                              ! Full $ \sigma $ level

    ! 譎ょ綾邂｡逅�
    ! Time control
    !
    use timeset, only: &
      & DelTime, &            ! $ \Delta t $
      & TimeN, &              ! 繧ｹ繝�ャ繝� $ t $ 縺ｮ譎ょ綾. Time of step $ t $.
      & TimesetClockStart, TimesetClockStop

    ! 繝偵せ繝医Μ繝��繧ｿ蜃ｺ蜉�
    ! History data output
    !
    use gtool_historyauto, only: HistoryAutoPut

    ! 螳｣險譁� ; Declaration statements
    !
    implicit none

    real(DP), intent(in):: xyz_U (0:imax-1, 1:jmax, 1:kmax)
                              ! $ u $ . 譚ｱ隘ｿ鬚ｨ騾�.
                              ! Eastward wind
    real(DP), intent(in):: xyz_V (0:imax-1, 1:jmax, 1:kmax)
                              ! $ v $ . 蜊怜圏鬚ｨ騾�.
                              ! Northward wind
    real(DP), intent(in):: xyz_Temp (0:imax-1, 1:jmax, 1:kmax)
                              ! $ T $ . 貂ｩ蠎ｦ.
                              ! Temperature
    real(DP), intent(in):: xy_Ps (0:imax-1, 1:jmax)
                              ! $ p_s $ . 蝨ｰ陦ｨ髱｢豌怜悸.
                              ! Surface pressure
    real(DP), intent(out):: xyz_DUDt (0:imax-1, 1:jmax, 1:kmax)
                              ! $ \DP{u}{t} $ . 譚ｱ隘ｿ鬚ｨ騾溷､牙喧.
                              ! Eastward wind tendency
    real(DP), intent(out):: xyz_DVDt (0:imax-1, 1:jmax, 1:kmax)
                              ! $ \DP{v}{t} $ . 蜊怜圏鬚ｨ騾溷､牙喧.
                              ! Northward wind tendency
    real(DP), intent(out):: xyz_DTempDt (0:imax-1, 1:jmax, 1:kmax)
                              ! $ \DP{T}{t} $ . 貂ｩ蠎ｦ螟牙喧.
                              ! Temperature tendency

    ! 菴懈･ｭ螟画焚
    ! Work variables
    !
    real(DP):: xyz_TempEQ (0:imax-1, 1:jmax, 1:kmax)
                              ! $ T_{eq} $ . 蟷ｳ陦｡貂ｩ蠎ｦ.
                              ! Equilibrium temperature
    real(DP):: xyz_Press (0:imax-1, 1:jmax, 1:kmax)
                              ! $ T $ . 蝨ｧ蜉�.
                              ! Pressure

    integer:: j               ! 邱ｯ蠎ｦ譁ｹ蜷代↓蝗槭ｋ DO 繝ｫ繝ｼ繝礼畑菴懈･ｭ螟画焚
                              ! Work variables for DO loop in latitude
    integer:: k               ! 驩帷峩譁ｹ蜷代↓蝗槭ｋ DO 繝ｫ繝ｼ繝礼畑菴懈･ｭ螟画焚
                              ! Work variables for DO loop in vertical direction

    ! 螳溯｡梧枚 ; Executable statement
    !

    ! 蛻晄悄蛹也｢ｺ隱�
    ! Initialization check
    !
    if ( .not. held_suarez_1994_inited ) then
      call MessageNotify( 'E', module_name, 'This module has not been initialized.' )
    end if

    ! 險育ｮ玲凾髢楢ｨ域ｸｬ髢句ｧ�
    ! Start measurement of computation time
    !
    call TimesetClockStart( module_name )

    ! 譚ｱ隘ｿ鬚ｨ騾� $ u $ 縺ｨ蜊怜圏鬚ｨ騾� $ v $ 縺ｸ繝ｬ繧､繝ｪ繝ｼ鞫ｩ謫ｦ繧帝←逕ｨ
    ! Apply Rayleigh damping to eastward wind $ u $ and northward wind $ v $
    !
    do k = 1, kmax
      xyz_DUDt (:,:,k) = - z_kv (k) * xyz_U (:,:,k)
      xyz_DVDt (:,:,k) = - z_kv (k) * xyz_V (:,:,k)
    end do

    ! 貂ｩ蠎ｦ $ T $ 縺ｸ繝九Η繝ｼ繝医Φ蜀ｷ蜊ｴ繧帝←逕ｨ
    ! Apply Newtonian relaxation to temperature $ T $
    !
    do k = 1, kmax
       xyz_Press(:,:,k) = z_Sigma(k) * xy_Ps
    enddo

    do j = 1, jmax
      xyz_TempEQ(:,j,:) = &
        & max( 200.0_DP, &
        &      (   315.0_DP &
        &        - DelTempY * sin( y_Lat(j) ) ** 2 &
        &        - DelPotTempZ * log( xyz_Press(:,j,:) / P0 ) &
        &                                 * cos( y_Lat(j) ) ** 2 &
        &      ) &
        &      * ( xyz_Press(:,j,:) / P0 ) ** Kappa &
        &     )
    end do

    do k = 1, kmax
      do j = 1, jmax
        xyz_DTempDt (:,j,k) = &
          & - yz_kt (j,k) * ( xyz_Temp (:,j,k) - xyz_TempEQ (:,j,k) )
      end do
    end do

    ! 繝偵せ繝医Μ繝��繧ｿ蜃ｺ蜉�
    ! History data output
    !
    call HistoryAutoPut( TimeN, 'DUDtHS94',    xyz_DUDt )
    call HistoryAutoPut( TimeN, 'DVDtHS94',    xyz_DVDt )
    call HistoryAutoPut( TimeN, 'DTempDtHS94', xyz_DTempDt )
    call HistoryAutoPut( TimeN, 'TempEQHS94',  xyz_TempEQ )

    ! 險育ｮ玲凾髢楢ｨ域ｸｬ荳譎ょ●豁｢
    ! Pause measurement of computation time
    !
    call TimesetClockStop( module_name )

  end subroutine HS94Forcing

  !--------------------------------------------------------------------------------------

  subroutine HS94Init
    !
    ! held_suarez_1994 繝｢繧ｸ繝･繝ｼ繝ｫ縺ｮ蛻晄悄蛹悶ｒ陦後＞縺ｾ縺�.
    ! NAMELIST#held_suarez_1994_nml 縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ縺ｯ縺薙�謇狗ｶ壹″縺ｧ陦後ｏ繧後∪縺�.
    !
    ! "held_suarez_1994" module is initialized.
    ! "NAMELIST#held_suarez_1994_nml" is loaded in this procedure.
    !

    ! 繝｢繧ｸ繝･繝ｼ繝ｫ蠑慕畑 ; USE statements
    !

    ! 迚ｩ逅�ｮ壽焚險ｭ螳�
    ! Physical constants settings
    !
    use constants, only: &
      & GasRDry, &
                              ! $ R $ [J kg-1 K-1].
                              ! 荵ｾ辯･螟ｧ豌励�豌嶺ｽ灘ｮ壽焚.
                              ! Gas constant of air
      & CpDry
                              ! $ C_p $ [J kg-1 K-1].
                              ! 荵ｾ辯･螟ｧ豌励�螳壼悸豈皮�.
                              ! Specific heat of air at constant pressure

    ! 蠎ｧ讓吶ョ繝ｼ繧ｿ險ｭ螳�
    ! Axes data settings
    !
    use axesset, only: &
      & y_Lat, &              ! $ \varphi $ [rad.] . 邱ｯ蠎ｦ. Latitude
      & z_Sigma               ! $ \sigma $ 繝ｬ繝吶Ν (謨ｴ謨ｰ).
                              ! Full $ \sigma $ level

    ! NAMELIST 繝輔ぃ繧､繝ｫ蜈･蜉帙↓髢｢縺吶ｋ繝ｦ繝ｼ繝�ぅ繝ｪ繝�ぅ
    ! Utilities for NAMELIST file input
    !
    use namelist_util, only: namelist_filename, NmlutilMsg, NmlutilAryValid

    ! 繝輔ぃ繧､繝ｫ蜈･蜃ｺ蜉幄｣懷勧
    ! 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

    ! 繝偵せ繝医Μ繝��繧ｿ蜃ｺ蜉�
    ! History data output
    !
    use gtool_historyauto, only: HistoryAutoAddVariable

    ! 螳｣險譁� ; Declaration statements
    !
    implicit none

    real(DP), parameter :: day_seconds = 86400.0_DP
                              ! 1 譌･縺ｮ遘呈焚.
                              ! Seconds in day.
    real(DP):: SigmaB         ! $ \sigma_b $ .
                              ! 蠅�阜螻､荳顔ｫｯ縺ｮ鬮伜ｺｦ
    real(DP):: kf             ! $ k_f $ .
                              ! 蝨ｰ陦ｨ髱｢縺ｧ縺ｮ Rayleigh 鞫ｩ謫ｦ縺ｮ邱ｩ蜥御ｿよ焚
    real(DP):: ka             ! $ k_a $ .
                              ! 螟ｧ豌嶺ｸ雁ｱ､縺ｫ縺翫￠繧� Newton 蜀ｷ蜊ｴ縺ｮ邱ｩ蜥御ｿよ焚
    real(DP):: ks             ! $ k_s $ .
                              ! 襍､驕灘慍陦ｨ髱｢縺ｫ縺翫￠繧� Newton 蜀ｷ蜊ｴ縺ｮ邱ｩ蜥御ｿよ焚

    real(DP):: kfTimeScaleInDay
    real(DP):: kaTimeScaleInDay
    real(DP):: ksTimeScaleInDay

    integer:: j               ! 邱ｯ蠎ｦ譁ｹ蜷代↓蝗槭ｋ DO 繝ｫ繝ｼ繝礼畑菴懈･ｭ螟画焚
                              ! Work variables for DO loop in latitude
    integer:: k               ! 驩帷峩譁ｹ蜷代↓蝗槭ｋ DO 繝ｫ繝ｼ繝礼畑菴懈･ｭ螟画焚
                              ! Work variables for DO loop in vertical direction

    integer:: unit_nml        ! NAMELIST 繝輔ぃ繧､繝ｫ繧ｪ繝ｼ繝励Φ逕ｨ陬�ｽｮ逡ｪ蜿ｷ.
                              ! Unit number for NAMELIST file open
    integer:: iostat_nml      ! NAMELIST 隱ｭ縺ｿ霎ｼ縺ｿ譎ゅ� IOSTAT.
                              ! IOSTAT of NAMELIST read

    ! NAMELIST 螟画焚鄒､
    ! NAMELIST group name
    !
    namelist /held_suarez_1994_nml/ &
      & SigmaB, &
      & kfTimeScaleInDay, &
      & kaTimeScaleInDay, &
      & ksTimeScaleInDay
          !
          ! 繝�ヵ繧ｩ繝ｫ繝亥､縺ｫ縺､縺�※縺ｯ蛻晄悄蛹匁焔邯� "held_suarez_1994#HS94Init"
          ! 縺ｮ繧ｽ繝ｼ繧ｹ繧ｳ繝ｼ繝峨ｒ蜿ら�縺ｮ縺薙→.
          !
          ! Refer to source codes in the initialization procedure
          ! "held_suarez_1994#HS94Init" for the default values.
          !

    ! 螳溯｡梧枚 ; Executable statement
    !

    if ( held_suarez_1994_inited ) return

    ! 繝�ヵ繧ｩ繝ｫ繝亥､縺ｮ險ｭ螳�
    ! Default values settings
    !
    SigmaB           =  0.7_DP
    kfTimeScaleInDay =  1.0_DP
    kaTimeScaleInDay = 40.0_DP
    ksTimeScaleInDay =  4.0_DP

    ! 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 = held_suarez_1994_nml, &  ! (out)
        & iostat = iostat_nml )        ! (out)
      close( unit_nml )

      call NmlutilMsg( iostat_nml, module_name ) ! (in)
!$      if ( iostat_nml == 0 ) write( STDOUT, nml = held_suarez_1994_nml )
    end if

    ! 菫よ焚縺ｮ險ｭ螳�
    ! Configure coefficients
    !
    Kappa = GasRDry / CpDry

    P0          = 1000.0e2_DP
    DelTempY    = 60.0_DP
    DelPotTempZ = 10.0_DP

!!$    kf     = 1.0_DP / day_seconds
!!$    ka     = 1.0_DP / ( 40.0_DP * day_seconds )
!!$    ks     = 1.0_DP / (  4.0_DP * day_seconds )
    kf     = 1.0_DP / ( kfTimeScaleInDay * day_seconds )
    ka     = 1.0_DP / ( kaTimeScaleInDay * day_seconds )
    ks     = 1.0_DP / ( ksTimeScaleInDay * day_seconds )

    allocate( z_kv (1:kmax) )
    z_kv = kf * max( 0.0_DP, &
      &              ( z_Sigma - SigmaB ) / ( 1.0_DP - SigmaB ) )

    allocate( yz_kt (1:jmax, 1:kmax) )

    do k = 1, kmax
      do j = 1, jmax
        yz_kt(j,k) = &
          & ka + ( ks - ka ) &
          &  * max( 0.0_DP, &
          &         ( z_Sigma(k) - SigmaB ) / ( 1.0_DP - SigmaB ) &
          &       ) * cos( y_Lat(j) ) ** 4
      end do
    end do

    ! 繝偵せ繝医Μ繝��繧ｿ蜃ｺ蜉帙�縺溘ａ縺ｮ縺ｸ縺ｮ螟画焚逋ｻ骭ｲ
    ! Register of variables for history data output
    !
    call HistoryAutoAddVariable( 'DUDtHS94', &
      & (/ 'lon ', 'lat ', 'sig ', 'time' /), &
      & 'eastward wind tendency', 'm s-2' )
    call HistoryAutoAddVariable( 'DVDtHS94', &
      & (/ 'lon ', 'lat ', 'sig ', 'time' /), &
      & 'northward wind tendency', 'm s-2' )
    call HistoryAutoAddVariable( 'DTempDtHS94', &
      & (/ 'lon ', 'lat ', 'sig ', 'time' /), &
      & 'temperature tendency', 'K s-1' )
    call HistoryAutoAddVariable( 'TempEQHS94', &
      & (/ 'lon ', 'lat ', 'sig ', 'time' /), &
      & 'equilibrium temperature', 'K' )

    ! 蜊ｰ蟄� ; Print
    !
    call MessageNotify( 'M', module_name, '----- Initialization Messages -----' )
    call MessageNotify( 'M', module_name, 'SigmaB           = %f', d = (/ SigmaB /) )
    call MessageNotify( 'M', module_name, 'kfTimeScaleInDay = %f', d = (/ kfTimeScaleInDay /) )
    call MessageNotify( 'M', module_name, 'kaTimeScaleInDay = %f', d = (/ kaTimeScaleInDay /) )
    call MessageNotify( 'M', module_name, 'ksTimeScaleInDay = %f', d = (/ ksTimeScaleInDay /) )

    call MessageNotify( 'M', module_name, '-- version = %c', c1 = trim(version) )

    held_suarez_1994_inited = .true.

  end subroutine HS94Init

  !--------------------------------------------------------------------------------------

  subroutine HS94Finalize
    !
    ! 繝｢繧ｸ繝･繝ｼ繝ｫ蜀�Κ縺ｮ螟画焚縺ｮ蜑ｲ繧贋ｻ倥￠隗｣髯､繧定｡後＞縺ｾ縺�.
    !
    ! Deallocate variables in this module.
    !

    ! 螳｣險譁� ; Declaration statements
    !
    implicit none

    ! 螳溯｡梧枚 ; Executable statement
    !

    if ( .not. held_suarez_1994_inited ) return

    ! 蜑ｲ繧贋ｻ倥￠隗｣髯､
    ! Deallocation
    !
    if ( allocated( z_kv  ) ) deallocate( z_kv  )
    if ( allocated( yz_kt ) ) deallocate( yz_kt )

    held_suarez_1994_inited = .false.

  end subroutine HS94Finalize

  !--------------------------------------------------------------------------------------

end module held_suarez_1994