!c Description: 
!c   境界条件設定用モジュール
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2004, All rights reserved

module bcset
  !--- 暗黙の型宣言禁止
  implicit none

  !--- save 属性
  save

  !--- 変数定義
  character(3)          :: ss_Bc        !境界(スカラー量)
  character(3)          :: fs_Bc        !境界(ベクトル u)
  character(3)          :: sf_Bc        !境界(ベクトル w)
  
contains
  subroutine bcset_init
    !--- モジュール読み込み
    use fileset, only: cfgfile
    
    !--- 内部変数の定義
    character(1)       :: BcX
    character(1)       :: BcZ
    
    !--- NAMELIST の定義
    NAMELIST /bcset/ BcX, BcZ
    
    !---変数の取り出し
    open (10, FILE=cfgfile)
    read(10, NML=bcset)
    close(10)

    !--- 境界のタイプを指定 (boundary.f90 参照)
    if (trim(BcX) == "C" .AND. trim(BcZ) == "R") then        
       ss_Bc = "CsS"   
       fs_Bc = "CsA"
       sf_Bc = "CfA"
    elseif (trim(BcX) == "C" .AND. trim(BcZ) == "F") then        
       ss_Bc = "CsS"   
       fs_Bc = "CsS"
       sf_Bc = "CfA"
    else 
       write(*,*) "gridset.f90, unknown boundary condition" 
    end if
    
  end subroutine bcset_init
  
end module bcset
