!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Subroutine SubGridDisp
!
!   * Developer: SUGIYAMA Ko-ichiro (sugiyama@gfd-dennou.org)
!   * Version: $Id: subgriddisp.f90,v 1.1 2005/02/07 10:31:21 sugiyama Exp $ 
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview 
!
!CReSS, Klemp and Wilhelmson (1978) で用いられている 1.5 次の
!クロージャーによって, サブグリッドスケールの
!乱流エネルギーの消散を評価する. 
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!
                                                                 !=end


subroutine SubGridDisp( ss_Km_n, ss_DispKm_n )
                                                                 !=begin  
  !== Dependency 
  use dc_trace,       only: BeginSub, EndSub
  use gridset,        only: DimXMin, DimXMax, DimZMin, DimZMax, DelXZ
                                                                 !=end  
  !--- 暗黙の型宣言禁止
  implicit none
                                                                 !=begin    
  !== Input 
  real(8), intent(in) :: ss_Km_n(DimXMin:DimXMax, DimZMin:DimZMax) !渦粘性係数
  
  !== Output
  real(8), intent(out) :: ss_DispKm_n(DimXMin:DimXMax, DimZMin:DimZMax) !乱流エネルギーの消散
                                                                 !=end
  call BeginSub("SubGridDisp", &
&              fmt="%c",       &
&              c1="Calculate subgrid diffusion (ss_DiffKm).")


  !-- 乱流エネルギーの消散
  ss_DispKm_n = ( ss_Km_n ** 2.0d0 ) / ( 2.0d0 * ( DelXZ ** 2.0d0 ) )
  
  call EndSub("SubGridDisp")
  
end subroutine SubGridDisp
