C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.1641  
C                                                                                  RAD_ALL.1642  
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.1643  
C restrictions as set forth in the contract.                                       RAD_ALL.1644  
C                                                                                  RAD_ALL.1645  
C                Meteorological Office                                             RAD_ALL.1646  
C                London Road                                                       RAD_ALL.1647  
C                BRACKNELL                                                         RAD_ALL.1648  
C                Berkshire UK                                                      RAD_ALL.1649  
C                RG12 2SZ                                                          RAD_ALL.1650  
C                                                                                  RAD_ALL.1651  
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.1652  
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.1653  
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.1654  
C Modelling at the above address.                                                  RAD_ALL.1655  
C ******************************COPYRIGHT******************************            RAD_ALL.1656  
C                                                                                  RAD_ALL.1657  
!+ Subroutine to calculate clear-sky fluxes.                                       RAD_ALL.1658  
!                                                                                  RAD_ALL.1659  
! Method:                                                                          RAD_ALL.1660  
!       This subroutine is called after fluxes including clouds have               RAD_ALL.1661  
!       been calculated to find the corresponding clear-sky fluxes.                RAD_ALL.1662  
!       The optical properties of the column are already known.                    RAD_ALL.1663  
!                                                                                  RAD_ALL.1664  
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.1665  
!                                                                                  RAD_ALL.1666  
! History:                                                                         RAD_ALL.1667  
!       Version         Date                    Comment                            RAD_ALL.1668  
!       4.0             27-07-95                Original Code                      RAD_ALL.1669  
!                                               (J. M. Edwards)                    RAD_ALL.1670  
!       4.1             10-04-96                New solver added                   RAD_ALL.1671  
!                                               (J. M. Edwards)                    RAD_ALL.1672  
!                                                                                  RAD_ALL.1673  
! Description of Code:                                                             RAD_ALL.1674  
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.1675  
!                                                                                  RAD_ALL.1676  
!- ---------------------------------------------------------------------           RAD_ALL.1677  
      SUBROUTINE CLEAR_SUPPLEMENT(IERR, N_PROFILE, N_LAYER                         RAD_ALL.1678  
     &   , I_SOLVER_CLEAR                                                          RAD_ALL.1679  
     &   , TRANS_FREE, REFLECT_FREE, TRANS_0_FREE, SOURCE_COEFF_FREE               RAD_ALL.1680  
     &   , ISOLIR, FLUX_INC_DIRECT, FLUX_INC_DOWN                                  RAD_ALL.1681  
     &   , S_DOWN_FREE, S_UP_FREE                                                  RAD_ALL.1682  
     &   , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR                                 RAD_ALL.1683  
     &   , SOURCE_GROUND                                                           RAD_ALL.1684  
     &   , L_SCALE_SOLAR, ADJUST_SOLAR_KE                                          RAD_ALL.1685  
     &   , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR                                     RAD_ALL.1686  
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.1687  
     &   )                                                                         RAD_ALL.1688  
!                                                                                  RAD_ALL.1689  
!                                                                                  RAD_ALL.1690  
      IMPLICIT NONE                                                                RAD_ALL.1691  
!                                                                                  RAD_ALL.1692  
!                                                                                  RAD_ALL.1693  
!     SIZES OF DUMMY ARRAYS.                                                       RAD_ALL.1694  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.1695  
     &     NPD_PROFILE                                                             RAD_ALL.1696  
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.1697  
     &   , NPD_LAYER                                                               RAD_ALL.1698  
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.1699  
!                                                                                  RAD_ALL.1700  
!     INCLUDE COMDECKS.                                                            RAD_ALL.1701  
!     ------------------------------------------------------------------           STDIO3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       STDIO3A.3     
!                                                                                  STDIO3A.4     
!     MODULE TO SET UNIT NUMBERS FOR STANDARD I/O.                                 STDIO3A.5     
!                                                                                  STDIO3A.6     
      INTEGER                                                                      STDIO3A.7     
     &     IU_STDIN                                                                STDIO3A.8     
!             UNIT NUMBER FOR STANDARD INPUT                                       STDIO3A.9     
     &   , IU_STDOUT                                                               STDIO3A.10    
!             UNIT NUMBER FOR STANDARD OUTPUT                                      STDIO3A.11    
     *   , IU_ERR                                                                  STDIO3A.12    
!             UNIT NUMBER FOR ERROR MESSAGES                                       STDIO3A.13    
!                                                                                  STDIO3A.14    
      PARAMETER(                                                                   STDIO3A.15    
     &     IU_STDIN=5                                                              STDIO3A.16    
     &   , IU_STDOUT=6                                                             STDIO3A.17    
     *   , IU_ERR=6                                                                STDIO3A.18    
     &   )                                                                         STDIO3A.19    
!                                                                                  STDIO3A.20    
!     ------------------------------------------------------------------           STDIO3A.21    
!     ------------------------------------------------------------------           SPCRG3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SPCRG3A.3     
!                                                                                  SPCRG3A.4     
!     MODULE TO SET FLAGS FOR DIFFERENT PORTIONS                                   SPCRG3A.5     
!     OF THE SPECTRUM.                                                             SPCRG3A.6     
!                                                                                  SPCRG3A.7     
      INTEGER                                                                      SPCRG3A.8     
     &     IP_SOLAR                                                                SPCRG3A.9     
!             SOLAR REGION                                                         SPCRG3A.10    
     &   , IP_INFRA_RED                                                            SPCRG3A.11    
!             INFRA-RED REGION                                                     SPCRG3A.12    
!                                                                                  SPCRG3A.13    
      PARAMETER(                                                                   SPCRG3A.14    
     &     IP_SOLAR=1                                                              SPCRG3A.15    
     &   , IP_INFRA_RED=2                                                          SPCRG3A.16    
     &   )                                                                         SPCRG3A.17    
!                                                                                  SPCRG3A.18    
!     ------------------------------------------------------------------           SPCRG3A.19    
!     ------------------------------------------------------------------           SOLVER3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SOLVER3A.3     
!                                                                                  SOLVER3A.4     
!     MODULE TO DEFINE REFERENCE NUMBERS FOR SOLVERS.                              SOLVER3A.5     
!                                                                                  SOLVER3A.6     
      INTEGER                                                                      SOLVER3A.7     
     &     IP_SOLVER_PENTADIAGONAL                                                 SOLVER3A.8     
!             PENTADIAGONAL SCHEME                                                 SOLVER3A.9     
     &   , IP_SOLVER_TRIDIAG_FULL                                                  SOLVER3A.10    
!             TRIDIAGONAL SOLVER FOR FLUXES                                        SOLVER3A.11    
     &   , IP_SOLVER_TRIDIAG_PRECOND                                               SOLVER3A.12    
!             TRIDIAGONAL SOLVER FOR FLUXES                                        SOLVER3A.13    
!             WITH PRECONDITIONING OF MATRIX                                       SOLVER3A.14    
     &   , IP_SOLVER_TRIDIAG_NET                                                   SOLVER3A.15    
!             TRIDIAGONAL SOLVER FOR NET FLUX                                      SOLVER3A.16    
     &   , IP_SOLVER_SCHMETZ                                                       SOLVER3A.17    
!             SCHMETZ'S SCHEME                                                     SOLVER3A.18    
     &   , IP_SOLVER_MIX_11                                                        SOLVER3A.19    
!             MIXED COLUMN SCHEME USING FULL ENDEKADIAGONAL MATRIX                 SOLVER3A.20    
     &   , IP_SOLVER_MIX_FULL                                                      SOLVER3A.21    
!             MIXED COLUMN SCHEME FOR FULL FLUXES                                  SOLVER3A.22    
     &   , IP_SOLVER_MIX_NET                                                       SOLVER3A.23    
!             MIXED COLUMN SCHEME FOR NET FLUX                                     SOLVER3A.24    
     &   , IP_SOLVER_MIX_APP_SCAT                                                  SOLVER3A.25    
!             MIXED COLUMN SCHEME WITH APPROXIMATE SCATTERING                      SOLVER3A.26    
     &   , IP_SOLVER_MIX_NET_APP_SCAT                                              SOLVER3A.27    
!             MIXED COLUMN SCHEME FOR NET FLUXES                                   SOLVER3A.28    
!             WITH APPROXIMATE SCATTERING                                          SOLVER3A.29    
     &   , IP_SOLVER_MIX_DIRECT                                                    SOLVER3A.30    
!             DIRECT MIXED COLUMN SCHEME FOR FULL FLUXES                           SOLVER3A.31    
     &   , IP_SOLVER_MIX_DIRECT_NET                                                SOLVER3A.32    
!             DIRECT MIXED COLUMN SCHEME FOR NET FLUXES                            SOLVER3A.33    
     &   , IP_SOLVER_HOMOGEN_DIRECT                                                SOLVER3A.34    
!             DIRECT SOLVER FOR A HOMOGENEOUS COLUMN                               SOLVER3A.35    
     &   , IP_SOLVER_TRIPLE                                                        SOLVER3A.36    
!             DIRECT SOLVER FOR TRIPLE COLUMN                                      SOLVER3A.37    
     &   , IP_SOLVER_TRIPLE_APP_SCAT                                               SOLVER3A.38    
!             DIRECT SOLVER FOR TRIPLE COLUMN APPROXIMATING SCATTERING             SOLVER3A.39    
!                                                                                  SOLVER3A.40    
      PARAMETER(                                                                   SOLVER3A.41    
     &     IP_SOLVER_PENTADIAGONAL=1                                               SOLVER3A.42    
     &   , IP_SOLVER_TRIDIAG_FULL=2                                                SOLVER3A.43    
     &   , IP_SOLVER_TRIDIAG_PRECOND=3                                             SOLVER3A.44    
     &   , IP_SOLVER_TRIDIAG_NET=4                                                 SOLVER3A.45    
     &   , IP_SOLVER_SCHMETZ=5                                                     SOLVER3A.46    
     &   , IP_SOLVER_MIX_11=6                                                      SOLVER3A.47    
     &   , IP_SOLVER_MIX_FULL=7                                                    SOLVER3A.48    
     &   , IP_SOLVER_MIX_NET=8                                                     SOLVER3A.49    
     &   , IP_SOLVER_MIX_APP_SCAT=9                                                SOLVER3A.50    
     &   , IP_SOLVER_MIX_NET_APP_SCAT=10                                           SOLVER3A.51    
     &   , IP_SOLVER_MIX_DIRECT=11                                                 SOLVER3A.52    
     &   , IP_SOLVER_MIX_DIRECT_NET=12                                             SOLVER3A.53    
     &   , IP_SOLVER_HOMOGEN_DIRECT=13                                             SOLVER3A.54    
     &   , IP_SOLVER_TRIPLE=14                                                     SOLVER3A.55    
     &   , IP_SOLVER_TRIPLE_APP_SCAT=15                                            SOLVER3A.56    
     &   )                                                                         SOLVER3A.57    
!                                                                                  SOLVER3A.58    
!     ------------------------------------------------------------------           SOLVER3A.59    
!     ------------------------------------------------------------------           ERROR3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       ERROR3A.3     
!                                                                                  ERROR3A.4     
!     MODULE TO SET ERROR FLAGS IN THE RADIATION CODE.                             ERROR3A.5     
!                                                                                  ERROR3A.6     
      INTEGER                                                                      ERROR3A.7     
     &     I_NORMAL                                                                ERROR3A.8     
!             ERROR FREE CONDITION                                                 ERROR3A.9     
     &   , I_ERR_FATAL                                                             ERROR3A.10    
!             FATAL ERROR: IMMEDIATE RETURN                                        ERROR3A.11    
     &   , I_ABORT_CALCULATION                                                     ERROR3A.12    
!             CALCULATION ABORTED                                                  ERROR3A.13    
     &   , I_MISSING_DATA                                                          ERROR3A.14    
!             MISSING DATA ERROR: CONDITIONAL                                      ERROR3A.15    
     &   , I_ERR_IO                                                                ERROR3A.16    
!             I/O ERROR                                                            ERROR3A.17    
     &   , I_ERR_RANGE                                                             ERROR3A.18    
!             INTERPOLATION RANGE ERROR                                            ERROR3A.19    
     &   , I_ERR_EXIST                                                             ERROR3A.20    
!             EXISTENCE ERROR                                                      ERROR3A.21    
!                                                                                  ERROR3A.22    
      PARAMETER(                                                                   ERROR3A.23    
     &     I_NORMAL=0                                                              ERROR3A.24    
     &   , I_ERR_FATAL=1                                                           ERROR3A.25    
     &   , I_ABORT_CALCULATION=2                                                   ERROR3A.26    
     &   , I_MISSING_DATA=3                                                        ERROR3A.27    
     &   , I_ERR_IO=4                                                              ERROR3A.28    
     &   , I_ERR_RANGE=5                                                           ERROR3A.29    
     &   , I_ERR_EXIST=6                                                           ERROR3A.30    
     &   )                                                                         ERROR3A.31    
!                                                                                  ERROR3A.32    
!     ------------------------------------------------------------------           ERROR3A.33    
!                                                                                  RAD_ALL.1706  
!     DUMMY VARIABLES.                                                             RAD_ALL.1707  
      INTEGER   !, INTENT(OUT)                                                     RAD_ALL.1708  
     &     IERR                                                                    RAD_ALL.1709  
!             ERROR FLAG                                                           RAD_ALL.1710  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.1711  
     &     N_PROFILE                                                               RAD_ALL.1712  
!             NUMBER OF PROFILES                                                   RAD_ALL.1713  
     &   , N_LAYER                                                                 RAD_ALL.1714  
!             NUMBER OF LAYERS                                                     RAD_ALL.1715  
     &   , ISOLIR                                                                  RAD_ALL.1716  
!             SPECTRAL REGION                                                      RAD_ALL.1717  
     &   , I_SOLVER_CLEAR                                                          RAD_ALL.1718  
!             SOLVER FOR CLEAR FLUXES                                              RAD_ALL.1719  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.1720  
     &     L_SCALE_SOLAR                                                           RAD_ALL.1721  
!             SCALING APPLIED TO SOLAR BEAM                                        RAD_ALL.1722  
      REAL  !, INTENT(IN)                                                          RAD_ALL.1723  
     &     TRANS_FREE(NPD_PROFILE, NPD_LAYER)                                      RAD_ALL.1724  
!             TRANSMISSION COEFFICIENTS                                            RAD_ALL.1725  
     &   , REFLECT_FREE(NPD_PROFILE, NPD_LAYER)                                    RAD_ALL.1726  
!             REFLECTION COEFFICIENTS                                              RAD_ALL.1727  
     &   , TRANS_0_FREE(NPD_PROFILE, NPD_LAYER)                                    RAD_ALL.1728  
!             DIRECT TRANSMISSION COEFFICIENTS                                     RAD_ALL.1729  
     &   , SOURCE_COEFF_FREE(NPD_PROFILE, NPD_LAYER)                               RAD_ALL.1730  
!             COEFFICIENTS IN SOURCE TERMS                                         RAD_ALL.1731  
     &   , S_DOWN_FREE(NPD_PROFILE, NPD_LAYER)                                     RAD_ALL.1732  
!             DOWNWARD SOURCE                                                      RAD_ALL.1733  
     &   , S_UP_FREE(NPD_PROFILE, NPD_LAYER)                                       RAD_ALL.1734  
!             UPWARD SOURCE                                                        RAD_ALL.1735  
     &   , ALBEDO_SURFACE_DIFF(NPD_PROFILE)                                        RAD_ALL.1736  
!             DIFFUSE ALBEDO                                                       RAD_ALL.1737  
     &   , ALBEDO_SURFACE_DIR(NPD_PROFILE)                                         RAD_ALL.1738  
!             DIRECT ALBEDO                                                        RAD_ALL.1739  
     &   , FLUX_INC_DOWN(NPD_PROFILE)                                              RAD_ALL.1740  
!             INCIDENT TOTAL FLUX                                                  RAD_ALL.1741  
     &   , FLUX_INC_DIRECT(NPD_PROFILE)                                            RAD_ALL.1742  
!             INCIDENT DIRECT FLUX                                                 RAD_ALL.1743  
     &   , SOURCE_GROUND(NPD_PROFILE)                                              RAD_ALL.1744  
!             GROUND SOURCE FUNCTION                                               RAD_ALL.1745  
     &   , ADJUST_SOLAR_KE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.1746  
!             SCALING OF SOLAR BEAM                                                RAD_ALL.1747  
!                                                                                  RAD_ALL.1748  
!                                                                                  RAD_ALL.1749  
      REAL  !, INTENT(OUT)                                                         RAD_ALL.1750  
     &     FLUX_DIRECT_CLEAR(NPD_PROFILE, 0: NPD_LAYER)                            RAD_ALL.1751  
!             CLEAR DIRECT FLUX                                                    RAD_ALL.1752  
     &   , FLUX_TOTAL_CLEAR(NPD_PROFILE, 2*NPD_LAYER+2)                            RAD_ALL.1753  
!             CLEAR TOTAL FLUXES                                                   RAD_ALL.1754  
!                                                                                  RAD_ALL.1755  
!                                                                                  RAD_ALL.1756  
!     DUMMY VARIABALES.                                                            RAD_ALL.1757  
      INTEGER                                                                      RAD_ALL.1758  
     &     N_EQUATION                                                              RAD_ALL.1759  
!             NUMBER OF EQUATIONS                                                  RAD_ALL.1760  
      REAL                                                                         RAD_ALL.1761  
     &     A3(NPD_PROFILE, 3, 2*NPD_LAYER+2)                                       RAD_ALL.1762  
!             TRIDIAGONAL MATRIX                                                   RAD_ALL.1763  
     &   , A5(NPD_PROFILE, 5, 2*NPD_LAYER+2)                                       RAD_ALL.1764  
!             PENTADIAGONAL MATRIX                                                 RAD_ALL.1765  
     &   , B(NPD_PROFILE, 2*NPD_LAYER+2)                                           RAD_ALL.1766  
!             RHS OF MATRIX EQUATION                                               RAD_ALL.1767  
     &   , WORK_1(NPD_PROFILE, 2*NPD_LAYER+2)                                      RAD_ALL.1768  
!             WORKING ARRAY FOR SOLVER                                             RAD_ALL.1769  
     &   , WORK_2(NPD_PROFILE, 2*NPD_LAYER+2)                                      RAD_ALL.1770  
!             WORKING ARRAY FOR SOLVER                                             RAD_ALL.1771  
!                                                                                  RAD_ALL.1772  
!     SUBROUTINES CALLED:                                                          RAD_ALL.1773  
      EXTERNAL                                                                     RAD_ALL.1774  
     &     SOLAR_SOURCE, SET_MATRIX_NET, TRIDIAG_SOLVER_UP                         RAD_ALL.1775  
     &   , SET_MATRIX_FULL, SET_MATRIX_PENTADIAGONAL                               RAD_ALL.1776  
     &   , BAND_SOLVER, SOLVER_HOMOGEN_DIRECT                                      RAD_ALL.1777  
!                                                                                  RAD_ALL.1778  
!                                                                                  RAD_ALL.1779  
!     THE SOURCE FUNCTIONS ONLY NEED TO BE RECALCULATED IN THE VISIBLE.            RAD_ALL.1780  
      IF (ISOLIR.EQ.IP_SOLAR) THEN                                                 RAD_ALL.1781  
         CALL SOLAR_SOURCE(N_PROFILE, N_LAYER                                      RAD_ALL.1782  
     &      , FLUX_INC_DIRECT                                                      RAD_ALL.1783  
     &      , TRANS_0_FREE, SOURCE_COEFF_FREE                                      RAD_ALL.1784  
     &      , L_SCALE_SOLAR, ADJUST_SOLAR_KE                                       RAD_ALL.1785  
     &      , FLUX_DIRECT_CLEAR                                                    RAD_ALL.1786  
     &      , S_DOWN_FREE, S_UP_FREE                                               RAD_ALL.1787  
     &      , NPD_PROFILE, NPD_LAYER                                               RAD_ALL.1788  
     &      )                                                                      RAD_ALL.1789  
      ENDIF                                                                        RAD_ALL.1790  
!                                                                                  RAD_ALL.1791  
      IF (I_SOLVER_CLEAR.EQ.IP_SOLVER_TRIDIAG_NET) THEN                            RAD_ALL.1792  
         CALL SET_MATRIX_NET(N_PROFILE, N_LAYER                                    RAD_ALL.1793  
     &      , TRANS_FREE, REFLECT_FREE                                             RAD_ALL.1794  
     &      , S_DOWN_FREE, S_UP_FREE                                               RAD_ALL.1795  
     &      , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR                              RAD_ALL.1796  
     &      , FLUX_DIRECT_CLEAR(1, N_LAYER), FLUX_INC_DOWN                         RAD_ALL.1797  
     &      , SOURCE_GROUND                                                        RAD_ALL.1798  
     &      , A3, B                                                                RAD_ALL.1799  
     &      , NPD_PROFILE, NPD_LAYER                                               RAD_ALL.1800  
     &      )                                                                      RAD_ALL.1801  
         N_EQUATION=N_LAYER+1                                                      RAD_ALL.1802  
!                                                                                  RAD_ALL.1803  
!        SOLVE THE EQUATIONS WORKING UPWARD IN THE ELIMINATIVE PHASE.              RAD_ALL.1804  
         CALL TRIDIAG_SOLVER_UP(N_PROFILE, N_EQUATION                              RAD_ALL.1805  
     &      , A3, B                                                                RAD_ALL.1806  
     &      , FLUX_TOTAL_CLEAR                                                     RAD_ALL.1807  
     &      , NPD_PROFILE, 2*NPD_LAYER+2                                           RAD_ALL.1808  
     &      , WORK_1, WORK_2                                                       RAD_ALL.1809  
     &      )                                                                      RAD_ALL.1810  
!                                                                                  RAD_ALL.1811  
      ELSE IF (I_SOLVER_CLEAR.EQ.IP_SOLVER_TRIDIAG_FULL) THEN                      RAD_ALL.1812  
         CALL SET_MATRIX_FULL(N_PROFILE, N_LAYER                                   RAD_ALL.1813  
     &      , TRANS_FREE, REFLECT_FREE                                             RAD_ALL.1814  
     &      , S_DOWN_FREE, S_UP_FREE                                               RAD_ALL.1815  
     &      , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR                              RAD_ALL.1816  
     &      , FLUX_DIRECT_CLEAR(1, N_LAYER), FLUX_INC_DOWN                         RAD_ALL.1817  
     &      , SOURCE_GROUND                                                        RAD_ALL.1818  
     &      , A3, B                                                                RAD_ALL.1819  
     &      , NPD_PROFILE, NPD_LAYER                                               RAD_ALL.1820  
     &      )                                                                      RAD_ALL.1821  
         N_EQUATION=2*N_LAYER+2                                                    RAD_ALL.1822  
!                                                                                  RAD_ALL.1823  
!        SOLVE THE EQUATIONS WORKING UPWARD IN THE ELIMINATIVE PHASE.              RAD_ALL.1824  
         CALL TRIDIAG_SOLVER_UP(N_PROFILE, N_EQUATION                              RAD_ALL.1825  
     &      , A3, B                                                                RAD_ALL.1826  
     &      , FLUX_TOTAL_CLEAR                                                     RAD_ALL.1827  
     &      , NPD_PROFILE, 2*NPD_LAYER+2                                           RAD_ALL.1828  
     &      , WORK_1, WORK_2                                                       RAD_ALL.1829  
     &      )                                                                      RAD_ALL.1830  
!                                                                                  RAD_ALL.1831  
      ELSE IF (I_SOLVER_CLEAR.EQ.IP_SOLVER_PENTADIAGONAL) THEN                     RAD_ALL.1832  
!                                                                                  RAD_ALL.1833  
!        CALCULATE THE ELEMENTS OF THE MATRIX EQUATIONS.                           RAD_ALL.1834  
         CALL SET_MATRIX_PENTADIAGONAL(N_PROFILE, N_LAYER                          RAD_ALL.1835  
     &      , TRANS_FREE, REFLECT_FREE                                             RAD_ALL.1836  
     &      , S_DOWN_FREE, S_UP_FREE                                               RAD_ALL.1837  
     &      , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR                              RAD_ALL.1838  
     &      , FLUX_DIRECT_CLEAR(1, N_LAYER), FLUX_INC_DOWN                         RAD_ALL.1839  
     &      , SOURCE_GROUND                                                        RAD_ALL.1840  
     &      , A5, B                                                                RAD_ALL.1841  
     &      , NPD_PROFILE, NPD_LAYER                                               RAD_ALL.1842  
     &      )                                                                      RAD_ALL.1843  
         N_EQUATION=2*N_LAYER+2                                                    RAD_ALL.1844  
!                                                                                  RAD_ALL.1845  
         CALL BAND_SOLVER(N_PROFILE, N_EQUATION                                    RAD_ALL.1846  
     &      , 2, 2                                                                 RAD_ALL.1847  
     &      , A5, B                                                                RAD_ALL.1848  
     &      , FLUX_TOTAL_CLEAR                                                     RAD_ALL.1849  
     &      , NPD_PROFILE, 2*NPD_LAYER+2                                           RAD_ALL.1850  
     &      , WORK_1                                                               RAD_ALL.1851  
     &      )                                                                      RAD_ALL.1852  
!                                                                                  RAD_ALL.1853  
      ELSE IF (I_SOLVER_CLEAR.EQ.IP_SOLVER_HOMOGEN_DIRECT) THEN                    RAD_ALL.1854  
!                                                                                  RAD_ALL.1855  
!        SOLVE FOR THE FLUXES IN THE COLUMN DIRECTLY.                              RAD_ALL.1856  
         CALL SOLVER_HOMOGEN_DIRECT(N_PROFILE, N_LAYER                             RAD_ALL.1857  
     &      , TRANS_FREE, REFLECT_FREE                                             RAD_ALL.1858  
     &      , S_DOWN_FREE, S_UP_FREE                                               RAD_ALL.1859  
     &      , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR                              RAD_ALL.1860  
     &      , FLUX_DIRECT_CLEAR(1, N_LAYER), FLUX_INC_DOWN                         RAD_ALL.1861  
     &      , SOURCE_GROUND                                                        RAD_ALL.1862  
     &      , FLUX_TOTAL_CLEAR                                                     RAD_ALL.1863  
     &      , NPD_PROFILE, NPD_LAYER                                               RAD_ALL.1864  
     &      )                                                                      RAD_ALL.1865  
!                                                                                  RAD_ALL.1866  
      ELSE                                                                         RAD_ALL.1867  
!                                                                                  RAD_ALL.1868  
         WRITE(IU_ERR, '(/A)')                                                     RAD_ALL.1869  
     &      '*** ERROR: THE SOLVER SPECIFIED IS NOT VALID '                        RAD_ALL.1870  
     &      //'FOR CLEAR FLUXES.'                                                  RAD_ALL.1871  
         IERR=I_ERR_FATAL                                                          RAD_ALL.1872  
         RETURN                                                                    RAD_ALL.1873  
!                                                                                  RAD_ALL.1874  
      ENDIF                                                                        RAD_ALL.1875  
!                                                                                  RAD_ALL.1876  
!                                                                                  RAD_ALL.1877  
!                                                                                  RAD_ALL.1878  
      RETURN                                                                       RAD_ALL.1879  
      END
