!=================================================================
!  一次元火星大気ダストの放射計算プログラム;
!  ダストによる散光の計算
!
!  2000/10/17  小高正嗣
!  2000/11/09  小高正嗣; 2D モデルへ
!=================================================================
      subroutine CLSCRAD
     I   ( ASR, BSR, CSR, DSR, 
     I     RSR, SSR, 
     I     IXRAD  ,
     O     FXRADU , FXRADD,
     W     FXRADUW, FXRADDW,
     D     NX     , NXB    ,NZ   , NZB      )

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

      dimension
     \   FXRADU (-2:NXB,-2:NZB), FXRADD (-2:NXB,-2:NZB),
     \   FXRADUW(-2:NXB,-2:NZB), FXRADDW(-2:NXB,-2:NZB)
      
      dimension 
     \     ASR(0:NZ,0:NZ), BSR(0:NZ,0:NZ), 
     \     CSR(0:NZ,0:NZ), DSR(0:NZ,0:NZ), 
     \     RSR(0:NZ), SSR(0:NZ)

!-----------------------------------------------------------------      
      
      do iz = -2, NZB
         FXRADU (IXRAD,iz) = 0.0D0
         FXRADD (IXRAD,iz) = 0.0D0
         FXRADUW(IXRAD,iz) = 0.0D0
         FXRADDW(IXRAD,iz) = 0.0D0
      end do

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

      do il =1, 4

         do iz = NZ-1 , 0, -1
            FXRADDW(IXRAD,iz) = 0.0D0
            FXRADDW(IXRAD,iz) = FXRADDW(IXRAD,iz) + SSR(iz)

            do jz = iz-1, iz+1
               FXRADDW(IXRAD,iz) = FXRADDW(IXRAD,iz) + 
     \              CSR(iz,jz) * FXRADU(IXRAD,jz) + 
     \              DSR(iz,jz) * FXRADD(IXRAD,jz)
            end do

            FXRADD(IXRAD,iz) = FXRADDW(IXRAD,iz)

         end do

         do iz = 0, NZ
            FXRADUW(IXRAD,iz) = 0.0D0
            FXRADUW(IXRAD,iz) = FXRADUW(IXRAD,iz) + RSR(iz)

            do jz = iz-1, iz+1
               FXRADUW(IXRAD,iz) = FXRADUW(IXRAD,iz) +
     \              ASR(iz,jz) * FXRADU(IXRAD,jz) + 
     \              BSR(iz,jz) * FXRADD(IXRAD,jz)
            end do

            FXRADU(IXRAD,iz) = FXRADUW(IXRAD,iz)

         end do

      end do

!-----------------------------------------------------------------      
      return
      end
