!=================================================================
!  鉛直 1 次元火星大気放射対流平衡モデル: 
!  拡散係数パラメタリゼーション(Priestry, 1959)
!
!  1999/11/06 小高正嗣
!=================================================================

      subroutine CLKDIF 
     I   ( TPOT0 , TSFC , 
     O     CDTURB,
     C     GRAV  ,
     G     ZGRID , FDZ  , DX   ,
     W     STABZ ,
     D     NX    , NXB  , NZ   , NZB )

!-----------------------------------------------------------------      
      implicit real*8 ( a-h,o-z )
!-----------------------------------------------------------------      

      dimension
     \   TPOT0(-2:NZB)

      dimension 
     \   CDTURB(-2:NZB), 
     \   STABZ (-2:NZB)

      dimension
     \   TSFC( -2:NXB )

      dimension 
     \   ZGRID(-2:NZB), FDZ(-2:NZB)

!-----------------------------------------------------------------      

      PCOEF = 1.32D0

      STABZ( 0 )
     \     =  GRAV / DX / FDZ( 0 ) / TPOT0( 0 ) * 2.0D0 
     \     * ( TPOT0( 0 ) - TSFC( 0 ) )


      do IZ = 1, NZ-1
         STABZ(IZ)
     \        =  GRAV / DX / FDZ( IZ ) / TPOT0( IZ ) / 2.0D0 
     \        * ( TPOT0( IZ+1 ) - TPOT0( IZ-1 ) )
      end do
      
      CALL BOUND( STABZ, NZ, NZB )

      do IZ = 0, NZ-1
         CDTURB( IZ ) = 
!     \        PCOEF * ZGRID( IZ )**2.0D0  
     \        PCOEF * ( ZGRID( IZ ) - FDZ(IZ) * DX * 0.5D0 )**2.0D0  
     \        * SQRT( ABS( MIN( 0.0D0, STABZ( IZ ) ) ) )
      end do


      CALL BOUND( CDTURB, NZ, NZB )


      return
      end
