!c Description:
!c  物性値のチェック用ルーチン
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Histry: 
!c   Version    Date          Comment
!c   -------    ----------    --------
!c   1.0        2003-02-19    作成
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2003, All rights reserved

program obrcheck
  use prm_common
  use interface_list_print
  use interface_display

  implicit none
  integer       :: s, n
  

  !初期化
  call obrinit


  !何を出力するかの選択
  write(*,*) "何を出力しますか?"
  write(*,*) "  1. 計算の設定"
  write(*,*) "  2. 物性値の確認"
  write(*,*) "  3. 比熱の保管値の確認"
  write(*,*) "  4. 飽和蒸気圧の計算値の確認"
  write(*,*) "  5. 標準状態でのエントロピーの計算値の確認"
  write(*,*) "  6. 標準状態でのギブス自由エネルギーの計算値の確認"
  read(*,*) n


  if (n == 1) then 
     !計算全体の設定
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 計算の設定 ---------------------------------------"
     write(*,*) "---------------------------------------------------------"
     write(*,*) "物性値保管ディレクトリ", PropertyDir
     write(*,*) "計算出力ファイル(Adbt)", AdbtFile
     write(*,*) "計算出力ファイル(Atmos)", AtmosFile
     write(*,*) "計算開始温度", temp_ini
     write(*,*) "計算開始圧力", pres_ini
     write(*,*) "計算終了圧力", pres_end
     write(*,*) "計算ステップ数", step
     write(*,*) "惑星名", planet
     write(*,*) "重力", grav
     write(*,*) "偽断熱過程か否か", pseudosw
     write(*,*) "系に含まれる元素の原子番号", atmnum
     write(*,*) "系に含まれる元素数", emol_ini
     write(*,*) "系に含まれる化学種の個数", smax
     call display(emol_ini, "系に含まれる元素")
     write(*,*) "系に含まれる化学種の構造式の添字"
     do s = 1, size(struct, 1)
        write(*,*) struct(s,:)
     end do
     
     
  elseif (n == 2) then      
     do s = 1, smax
        write(*,*) "---------------------------------------------------------"
        write(*,*) "------ 物性値   ", trim(property(s)%name), " ------------"
        write(*,*) "---------------------------------------------------------"
        write(*,*) "分子量"
        write(*,*) property(s)%molwt
        write(*,*) "エントロピー"
        write(*,*) property(s)%ref%entr
        write(*,*) "エンタルピー"
        write(*,*) property(s)%ref%enth
        write(*,*) "計算法"
        write(*,*) property(s)%method
        write(*,*) "水溶液か否か"
        write(*,*) property(s)%solsw
        write(*,*) "相番号"
        write(*,*) property(s)%phase
        write(*,*) "組成"
        call list_print(property(s)%comps)
        write(*,*) "比熱"
        call list_print(property(s)%cp)
        write(*,*) "飽和蒸気圧"
        call list_print(property(s)%svap)
        write(*,*) "スプライン補間係数"
        call list_print(property(s)%spl)
        write(*,*) "飽和蒸気圧計算式の係数"
        write(*,*) property(s)%svap_cef%low
        write(*,*) property(s)%svap_cef%high
        write(*,*) property(s)%svap_cef%A
        write(*,*) property(s)%svap_cef%B
        write(*,*) property(s)%svap_cef%C
        write(*,*) property(s)%svap_cef%D
        write(*,*) property(s)%svap_cef%E
     end do


  elseif (n == 3) then      
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 比熱の保管値の確認 -------------------------------"
     write(*,*) "---------------------------------------------------------"
     call plot_cp
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 比熱の温度積分の確認 -----------------------------"
     write(*,*) "---------------------------------------------------------"
     call plot_cp_int
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 比熱/温度の温度積分の確認 ------------------------"
     write(*,*) "---------------------------------------------------------"
     call plot_cp_dvt_int
     
     
  elseif (n == 4) then 
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 飽和蒸気圧の計算値の確認 -------------------------"
     write(*,*) "---------------------------------------------------------"
     call plot_svap
     
     
  elseif (n == 5) then 
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 標準状態でのエントロピーの計算値の確認 -----------"
     write(*,*) "---------------------------------------------------------"
     call plot_entr0
     
     
  elseif (n == 6) then 
     write(*,*) "---------------------------------------------------------"
     write(*,*) "------ 標準状態でのギブス自由エネルギーの計算値の確認 ---"
     write(*,*) "---------------------------------------------------------"
     call plot_mu0
     
  end if

end program obrcheck

