!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Subroutine DissipativeHeating
!
!   * Developer: KITAMORI Taichi 
!   * Version: $Id: dissipativeheating.f90,v 1.1.2.1 2005/09/03 04:28:22 kitamo Exp $
!   * Tag Name: $Name: arare3m $
!   * Change History: 
!
!== Overview 
!
!散逸加熱を計算する. 
! 
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!  
!
!== Future Plans
!
                                                                 !=end
subroutine DissipativeHeating(ss_Km_bl, ss_QDis)
                                                                 !=begin

  !==Dependency
  use dc_trace, only: BeginSub, EndSub  
  use gridset,  only: DimXMin, DimXMax, DimZMin, DimZMax, RegZMin, RegZMax, DelXZ
  use basicset, only: ss_CpBasicZ, ss_PotTempBasicZ, ss_ExnerBasicZ
  use arareset, only: Cm
                                                                 !=end

  !==暗黙の型宣言を禁止
  implicit none
                                                                 !=begin
  !==Input
  real(8), intent(in)  :: ss_Km_bl(DimXMin:DimXMax, DimZMin:DimZMax)

  !==Output
  real(8), intent(out) :: ss_QDis(DimXMin:DimXMax, DimZMin:DimZMax)
                                                                 !=end

  call BeginSub("DissipativeHeating",   &
       & fmt="%c",  & 
       & c1="Calculate dissipative heating (ss_QDis)."   ) 

  ss_QDis = ss_Km_bl ** 3.0d0 / ( ss_ExnerBasicZ * ss_CpBasicZ * Cm**2.0d0 * DelXZ**4.0d0 )

  call EndSub("DissipativeHeating")

end subroutine DissipativeHeating
