!c Description: 
!c   X $BJ}8~$N1?F0J}Dx<0$K$*$$$FD9$$;~4V%9%F%C%W$GI>2A$9$k9`$N7W;;(B
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2004, All rights reserved

subroutine AdvectX(fs_VelX_B, sf_VelZ_B, fs_AdvX_B)

  !--- $B%b%8%e!<%k$NFI$_9~$_(B
  use gridset,  only: DimXMin, DimXMax, DimZMin, DimZMax
  use bcset,    only: fs_Bc
  use if_avr,   only: fs_avr_sf
  use if_diff,  only: fs_dx_fs, fs_dz_fs
  use if_boundary
  
  !--- $B0EL[$N7?@k8@6X;_(B
  implicit none
  
  !--- $BF~=PNOJQ?t(B
  real(8), intent(in)     :: fs_VelX_B(DimXMin:DimXMax, DimZMin:DimZMax)
  real(8), intent(in)     :: sf_VelZ_B(DimXMin:DimXMax, DimZMin:DimZMax)
  real(8), intent(out)    :: fs_AdvX_B(DimXMin:DimXMax, DimZMin:DimZMax)
  
  !--- $B0\N.9`(B (X)
  fs_AdvX_B = &
       & fs_VelX_B * fs_dx_fs(fs_VelX_B) &
       & +  fs_avr_sf( sf_VelZ_B ) * fs_dz_fs( fs_VelX_B ) 

  !--- $B6-3&>r7o(B
  call boundary(fs_Bc, fs_AdvX_B)
  
end subroutine AdvectX
