anchor.diff:      call VINTRPL_zstar_level( tem_bs, tem_bs_pl, .false. )
       call VINTRPL_zstar_level( qv_bs,  qv_bs_pl,  .false. )
   
  -    !--- Setting of mass concentration [Note] The basic state is "dry" and TKE=0
  -    q_bs(:,:,:,:)    = 0.0_RP
  -    q_bs(:,:,:,I_QV) = qv_bs(:,:,:)
  -
  -    call THRMDYN_qd( ADM_gall,       & ! [IN]
  -                     ADM_kall,       & ! [IN]
  -                     ADM_lall,       & ! [IN]
  -                     q_bs (:,:,:,:), & ! [IN]
  -                     qd_bs(:,:,:)    ) ! [OUT]
  -
  -    call THRMDYN_rho( ADM_gall,        & ! [IN]
  -                      ADM_kall,        & ! [IN]
  -                      ADM_lall,        & ! [IN]
  -                      tem_bs(:,:,:),   & ! [IN]
  -                      pre_bs(:,:,:),   & ! [IN]
  -                      qd_bs (:,:,:),   & ! [IN]
  -                      q_bs  (:,:,:,:), & ! [IN]
  -                      rho_bs(:,:,:)    ) ! [OUT]
  -
  -    !--- set boundary conditions of basic state
       do l = 1, ADM_lall
  +       !--- Setting of mass concentration
  +       !--- Note :: The basic state is "dry" and TKE=0
  +       q(:,:,l,:)    = 0.0_RP
  +       q(:,:,l,I_QV) = qv_bs(:,:,l)
  +
  +       call thrmdyn_qd( ADM_gall,    & ! [IN]
  +                        ADM_kall,    & ! [IN]
  +                        q (:,:,l,:), & ! [IN]
  +                        qd(:,:,l)    ) ! [OUT]
  +
  +       !--- calculation of density
  +       call thrmdyn_rho( ADM_gall,        & ! [IN]
  +                         ADM_kall,        & ! [IN]
  +                         pre_bs(:,:,l),   & ! [IN]
  +                         tem_bs(:,:,l),   & ! [IN]
  +                         qd    (:,:,l),   & ! [IN]
  +                         q     (:,:,l,:), & ! [IN]
  +                         rho_bs(:,:,l)    )! [OUT]
  +
  +       !--- set boundary conditions of basic state
          call bndcnd_thermo( ADM_gall,      & ! [IN]
                              tem_bs(:,:,l), & ! [INOUT]
                              rho_bs(:,:,l), & ! [INOUT]
                              pre_bs(:,:,l), & ! [INOUT]
                              phi   (:,:,l)  ) ! [IN]
  -    enddo
  -
  -    call THRMDYN_th( ADM_gall,      & ! [IN]
  -                     ADM_kall,      & ! [IN]
  -                     ADM_lall,      & ! [IN]
  -                     tem_bs(:,:,:), & ! [IN]
  -                     pre_bs(:,:,:), & ! [IN]
  -                     th_bs (:,:,:)  ) ! [OUT]
  -
  -    if ( ADM_have_pl ) then
  -       q_bs_pl(:,:,:,:)    = 0.0_RP
  -       q_bs_pl(:,:,:,I_QV) = qv_bs_pl(:,:,:)
  -
  -       call THRMDYN_qd( ADM_gall_pl,       & ! [IN]
  -                        ADM_kall,          & ! [IN]
  -                        ADM_lall_pl,       & ! [IN]
  -                        q_bs_pl (:,:,:,:), & ! [IN]
  -                        qd_bs_pl(:,:,:)    ) ! [OUT]
  -
  -       call THRMDYN_rho( ADM_gall_pl,        & ! [IN]
  -                         ADM_kall,           & ! [IN]
  -                         ADM_lall_pl,        & ! [IN]
  -                         tem_bs_pl(:,:,:),   & ! [IN]
  -                         pre_bs_pl(:,:,:),   & ! [IN]
  -                         qd_bs_pl (:,:,:),   & ! [IN]
  -                         q_bs_pl  (:,:,:,:), & ! [IN]
  -                         rho_bs_pl(:,:,:)    ) ! [OUT]
  -
  -
  +
  +       call thrmdyn_th( ADM_gall,      & ! [IN]
  +                        ADM_kall,      & ! [IN]
  +                        tem_bs(:,:,l), & ! [IN]
  +                        pre_bs(:,:,l), & ! [IN]
  +                        th_bs (:,:,l)  ) ! [OUT]
  +    enddo
  +
  +    if ( ADM_prc_me == ADM_prc_pl ) then
          do l = 1, ADM_lall_pl
  +          q_pl(:,:,l,:)    = 0.0_RP
  +          q_pl(:,:,l,I_QV) = qv_bs_pl(:,:,l)
  +
  +          call thrmdyn_qd( ADM_gall_pl,    & ! [IN]
  +                           ADM_kall,       & ! [IN]
  +                           q_pl (:,:,l,:), & ! [IN]
  +                           qd_pl(:,:,l)    ) ! [OUT]
  +
  +          call thrmdyn_rho( ADM_gall_pl,        & ! [IN]
  +                            ADM_kall,           & ! [IN]
  +                            tem_bs_pl(:,:,l),   & ! [IN]
  +                            pre_bs_pl(:,:,l),   & ! [IN]
  +                            qd_pl    (:,:,l),   & ! [IN]
  +                            q_pl     (:,:,l,:), & ! [IN]
  +                            rho_bs_pl(:,:,l)    ) ! [OUT]
  +
             call bndcnd_thermo( ADM_gall_pl,      & ! [IN]
                                 tem_bs_pl(:,:,l), & ! [INOUT]
                                 rho_bs_pl(:,:,l), & ! [INOUT]
                                 pre_bs_pl(:,:,l), & ! [INOUT]
                                 phi_pl   (:,:,l)  ) ! [IN]
  +
  +          call thrmdyn_th( ADM_gall_pl,      & ! [IN]
  +                           ADM_kall,         & ! [IN]
  +                           tem_bs_pl(:,:,l), & ! [IN]
  +                           pre_bs_pl(:,:,l), & ! [IN]
  +                           th_bs_pl (:,:,l)  ) ! [OUT]
          enddo
  -
  -       call THRMDYN_th( ADM_gall_pl,      & ! [IN]
  -                        ADM_kall,         & ! [IN]
  -                        ADM_lall_pl,      & ! [IN]
  -                        tem_bs_pl(:,:,:), & ! [IN]
  -                        pre_bs_pl(:,:,:), & ! [IN]
  -                        th_bs_pl (:,:,:)  ) ! [OUT]
       endif
   
       return
     end subroutine set_basicstate
   
     !-----------------------------------------------------------------------------
  -  subroutine bsstate_output_ref( basename )
  -    use mod_misc, only: &
  -       MISC_get_available_fid
  +  subroutine output_info
       use mod_adm, only: &
  -       ADM_prc_me,     &
  -       ADM_prc_run_master
  +       ADM_LOG_FID, &
  +       ADM_kall,    &
  +       ADM_kmin,    &
  +       ADM_kmax
       implicit none
   
  -    Character(*), Intent(in) :: basename
  -    integer :: fid
  -
  -    !--- output
  -    if ( ADM_prc_me==ADM_prc_run_master) then
  -       fid = MISC_get_available_fid()
  -       Open(fid,file=Trim(basename),form='unformatted')
  -       Write(fid) pre_ref(:)
  -       Write(fid) tem_ref(:)
  -       Write(fid) qv_ref(:)
  -       Close(fid)
  -       !
  -    endif
  -    !
  -  end subroutine bsstate_output_ref
  -  !-----------------------------------------------------------------------------
  -  subroutine bsstate_input_ref( basename )
  -    !
  -    use mod_misc, only : &
  -         MISC_get_available_fid
  -    use mod_cnst, only : &
  -         CNST_EGRAV,     &
  -         CNST_RAIR,      &
  -         CNST_RVAP,      &
  -         CNST_KAPPA,     &
  -         CNST_PRE00
  -    use mod_adm, only :  &
  -         ADM_kall
  -    use mod_grd, only :  &
  -         GRD_gz
  -    !
  -    implicit none
  -    Character(*), Intent(in) :: basename
  -    integer :: fid
  -    !
       integer :: k
  -    !
  -    !--- input
  -    fid = MISC_get_available_fid()
  -    Open(fid,file=Trim(basename),status='old',form='unformatted')
  -    read(fid) pre_ref(:)
  -    read(fid) tem_ref(:)
  -    read(fid) qv_ref(:)
  -    Close(fid)
  -    !
  -    !--- additional reference state.
  +    !---------------------------------------------------------------------------
  +
  +    write(ADM_LOG_FID,*) '*** Basic state information ***'
  +    write(ADM_LOG_FID,*) '--- Basic state type         : ', trim(ref_type)
  +
  +    write(ADM_LOG_FID,*) '-------------------------------------------------------'
  +    write(ADM_LOG_FID,*) 'Level   Density  Pressure     Temp. Pot. Tem.        qv'
       do k = 1, ADM_kall
  -       th_ref(k)                                        &
  -            = tem_ref(k)                                &
  -            * ( CNST_PRE00 / pre_ref(k) ) ** CNST_KAPPA
  -       phi_ref(k) = CNST_EGRAV * GRD_gz(k)
  -       rho_ref(k) = pre_ref(k)/ ( (1.0_RP-qv_ref(k))*CNST_RAIR+qv_ref(k)*CNST_RVAP )/ tem_ref(k)
  -    enddo
  -    !
  -  end subroutine bsstate_input_ref
  -  !-----------------------------------------------------------------------------
  +       write(ADM_LOG_FID,'(I4,F12.4,F10.2,F10.2,F10.2,F10.7)') k, rho_ref(k), pre_ref(k), tem_ref(k),th_ref(k), qv_ref(k)
  +       if (  k == ADM_kmin-1 ) write(ADM_LOG_FID,*) '-------------------------------------------------------'
  +       if (  k == ADM_kmax   ) write(ADM_LOG_FID,*) '-------------------------------------------------------'
  +    enddo
  +
  +    return
  +  end subroutine output_info
  +
   end module mod_bsstate
  -!-------------------------------------------------------------------------------
  
positive.code:     write(ADM_LOG_FID,nml=BSSTATEPARAM)
  
      !--- allocation of reference variables
      allocate(phi_ref(ADM_kall))
      allocate(rho_ref(ADM_kall))
      allocate(pre_ref(ADM_kall))
      allocate(tem_ref(ADM_kall))
      allocate(th_ref(ADM_kall))
      allocate(qv_ref(ADM_kall))
      !
      ! add by kgoto
      ! initialize
      phi_ref=0.0_RP
      rho_ref=0.0_RP
      pre_ref=0.0_RP
      tem_ref=0.0_RP
      th_ref=0.0_RP
      !--- allocation of the basic variables
      allocate(rho_bs(ADM_gall,ADM_kall,ADM_lall))
      allocate(rho_bs_pl(ADM_gall_pl,ADM_kall,ADM_lall_pl))
      allocate(pre_bs(ADM_gall,ADM_kall,ADM_lall))
      allocate(pre_bs_pl(ADM_gall_pl,ADM_kall,ADM_lall_pl))
      allocate(tem_bs(ADM_gall,ADM_kall,ADM_lall))
      allocate(tem_bs_pl(ADM_gall_pl,ADM_kall,ADM_lall_pl))
      allocate(th_bs(ADM_gall,ADM_kall,ADM_lall))
      allocate(th_bs_pl(ADM_gall_pl,ADM_kall,ADM_lall_pl))
      allocate(qv_bs(ADM_gall,ADM_kall,ADM_lall))
      allocate(qv_bs_pl(ADM_gall_pl,ADM_kall,ADM_lall_pl))
      allocate(phi(ADM_gall,ADM_kall,ADM_lall))
      allocate(phi_pl(ADM_gall_pl,ADM_kall,ADM_lall_pl))
      !
      ! add by kgoto
      ! initialize
      rho_bs    = 0.0_RP
      rho_bs_pl = 0.0_RP
      pre_bs    = 0.0_RP
      pre_bs_pl = 0.0_RP
      tem_bs    = 0.0_RP
      tem_bs_pl = 0.0_RP
      th_bs    = 0.0_RP
      th_bs_pl = 0.0_RP
      qv_bs    = 0.0_RP
      qv_bs_pl = 0.0_RP
      !
      if ( ref_type=='INPUT') then
         !
         !---- input reference state
         call bsstate_input_ref(ref_fname)
         !
         !--- calculation of basic state
         call set_basicstate
      else !--- other type
         !
         !--- calculation of reference state
         call set_referencestate
         !
         !--- calculation of basic state
         call set_basicstate
      endif
      !
      !--- output the information
      call output_info
  
  
negative.code: !-------------------------------------------------------------------------------
  !>
  !! Basic state module
  !!
  !! @par Description
  !!         This module provides the subroutines for basic state.
  !!
  !! @author H.Tomita
  !!
  !! @par History
  !! @li      2004-02-17 (H.Tomita) Imported from igdc-4.33
  !! @li      2011-08-13 (A.Noda)   Add twp-ice exp.
  !!
  !<
  module mod_bsstate
    !-----------------------------------------------------------------------------
    !
    !++ Used modules
  