!=================================================================
!  CO2 大気放射計算プログラム; 
!  上向き放射束密度の計算
!  (Savijarvi, 1991:Contr. Atmos. Phys. 64, 103-112.)
!
!  2000/05/03  小高正嗣
!  2000/05/12  小高正嗣; 2D モデルへ
!=================================================================

      subroutine CLFXRDD
     I   ( BBRAD , TAUN , inb ,  
     O     FXRADD,
     D     NZ   , NZB , NX  , NXB , NBND )

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

      dimension
     \   BBRAD ( -2:NXB, -2:NZB ),
     \   FXRADD( -2:NXB, -2:NZB )

      dimension 
     \   TAUN( 0:NZ+1, 0:NZ+1, NBND )

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

      do ix = -2, NXB
      do iz =  0, NZ
         do jz = iz, NZ
            DELTAU = TAUN(jz+1,iz,INB) - TAUN(jz,iz,INB)
            FXRADD(ix,iz) = FXRADD(ix,iz) - DELTAU * BBRAD(ix,jz)
         end do
      end do
      end do


      do ix = -2, NXB 
         FXRADD( ix, -1 )   = FXRADD( ix, 0 )  
         FXRADD( ix, -2 )   = FXRADD( ix, 0 )  
         FXRADD( ix, NZ+1 ) = 0.0D0
         FXRADD( ix, NZ+2 ) = 0.0D0
      end do

      return

      end
