!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Subroutine NumDiffusionScalar
!
!   * Developer: SUGIYAMA Ko-ichiro (sugiyama@gfd-dennou.org)
!   * Version: $Id: numdiffusionscalar.f90,v 1.2 2005/01/28 12:41:21 sugiyama 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 NumDiffusionScalar(ss_PotTemp_n, ss_NumDiffScalar_n)
                                                                 !=begin  
  !== Dependency 
  use gridset,  only: DimXMin, DimXMax, DimZMin, DimZMax
  use differentiate,  only: ss_dx_fs, fs_dx_ss, ss_dz_sf, sf_dz_ss
  use arareprm, only: Cm, NuH, NuV
                                                                 !=end  
  !--- 暗黙の型宣言禁止
  implicit none
                                                                 !=begin    
  !== Input 
  real(8), intent(in) :: ss_PotTemp_n(DimXMin:DimXMax, DimZMin:DimZMax) !温位
  
  !== Output
  real(8), intent(out) :: ss_NumDiffScalar_n(DimXMin:DimXMax, DimZMin:DimZMax) !数値粘性項
                                                                 !=end

  !--- 拡散項 
  ss_NumDiffScalar_n = &
       &   NuH * ( ss_dx_fs( fs_dx_ss( ss_PotTemp_n) ) ) &
       & + NuV * ( ss_dz_sf( sf_dz_ss( ss_PotTemp_n) ) ) 
  
end subroutine NumDiffusionScalar
