!=================================================================
!  一次元 CO2 大気放射対流平衡計算プログラム; 
!  上向き放射束密度の計算
!  (Pollack et al., 1981:J. Atmos. Sci., 38, 3--29.)
!
!  1999/05/25  小高正嗣
!  1999/06/04  小高正嗣
!  2000/02/22  小高正嗣
!=================================================================

      subroutine CLFXRDD
     I   ( BBRAD , EQWDTH, TEMP0,
     O     FXRADD,
     D     NZ    , NZB     )

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

      dimension 
     \   FXRADD(-2:NZB), BBRAD(-2:NZB), EQWDTH(0:NZ+1,0:NZ+1),
     \   TEMP0(-2:NZB)

      parameter( pi = 3.14159263D0 )
      parameter( NU = 667.0D0 )

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

      TEMPM = ( TEMP0(0) + TEMP0(-1) ) * 0.5D0
      BBRAD( 0) = ( 1.1911D-8 * NU**3 ) /
     \        ( EXP( 1.439D0 * NU / TEMPM) - 1.0D0 )

      do iz = 0, NZ

         FXRADD( iz ) = 2.0D0 * pi * 0.488D0 * 
     \        ( BBRAD( NZ ) * EQWDTH( iz, NZ+1 ) )

         do jz = iz+1, NZ

            DELBBR = BBRAD( jz ) - BBRAD( jz - 1 )

            FXRADD( iz ) = FXRADD( iz ) - 2.0D0 * pi * 0.488D0 * 
     \           DELBBR * EQWDTH( iz, jz )

         end do
      end do

      FXRADD(-1)   = FXRADD(0) 
      FXRADD(-2)   = FXRADD(1) 
      FXRADD(NZ+1) = FXRADD(NZ) 
      FXRADD(NZ+2) = FXRADD(NZ) 

      return

      end
