!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Subroutine NumDiffusionVelX
!
!   * Developer: SUGIYAMA Ko-ichiro (sugiyama@gfd-dennou.org)
!   * Version: $Id: numdiffusionvelx.f90,v 1.4 2005/02/02 10:07:26 odakker Exp $ 
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview 
!
!数値粘性項を評価する. 
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!粘性係数は arareprm 中で, \nu = \frac{\alpha \DeltaX}{\Delta t} で決める. 
!\alpha < 1/8 である. 
!CReSS マニュアル参照. 
!
!== Future Plans
!
                                                                 !=end

subroutine NumDiffusionVelX(fs_VelX_n, fs_NumDiffVelX_n)
                                                                 !=begin  
  !== Dependency 
  use dc_trace, only: BeginSub, EndSub
  use gridset,  only: DimXMin, DimXMax, DimZMin, DimZMax
  use differentiate_center4,  only: fs_dx_ss, ss_dx_fs, fs_dz_ff, ff_dz_fs
  use arareprm, only: Cm, NuH, NuV
                                                                 !=end  
  !--- 暗黙の型宣言禁止
  implicit none
                                                                 !=begin    
  !== Input 
  real(8), intent(in) :: fs_VelX_n(DimXMin:DimXMax, DimZMin:DimZMax) !速度 u
  
  !== Output
  real(8), intent(out) :: fs_NumDiffVelX_n(DimXMin:DimXMax, DimZMin:DimZMax) !s数値粘性項
                                                                 !=end

  call BeginSub("NumDiffusionVelX", &
&          fmt="%c",       &
&          c1="Calculate numerical diffusion term for VelX (sf_NumDiffVelX).")

  !--- 拡散項 
  fs_NumDiffVelX_n = &
       &   NuH * ( fs_dx_ss( ss_dx_fs( fs_VelX_n) ) ) &
       & + NuV * ( fs_dz_ff( ff_dz_fs( fs_VelX_n) ) ) 

  call EndSub("NumDiffusionVelX")
  
end subroutine NumDiffusionVelX
