C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.11574 
C                                                                                  RAD_ALL.11575 
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.11576 
C restrictions as set forth in the contract.                                       RAD_ALL.11577 
C                                                                                  RAD_ALL.11578 
C                Meteorological Office                                             RAD_ALL.11579 
C                London Road                                                       RAD_ALL.11580 
C                BRACKNELL                                                         RAD_ALL.11581 
C                Berkshire UK                                                      RAD_ALL.11582 
C                RG12 2SZ                                                          RAD_ALL.11583 
C                                                                                  RAD_ALL.11584 
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.11585 
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.11586 
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.11587 
C Modelling at the above address.                                                  RAD_ALL.11588 
C ******************************COPYRIGHT******************************            RAD_ALL.11589 
C                                                                                  RAD_ALL.11590 
!+ Subroutine to set the solar source terms in a mixed column.                     RAD_ALL.11591 
!                                                                                  RAD_ALL.11592 
! Method:                                                                          RAD_ALL.11593 
!       The Direct beam is calculated by propagating down through                  RAD_ALL.11594 
!       the column. These direct fluxes are used to define the                     RAD_ALL.11595 
!       source terms in each layer.                                                RAD_ALL.11596 
!                                                                                  RAD_ALL.11597 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.11598 
!                                                                                  RAD_ALL.11599 
! History:                                                                         RAD_ALL.11600 
!       Version         Date                    Comment                            RAD_ALL.11601 
!       4.0             27-07-95                Original Code                      RAD_ALL.11602 
!                                               (J. M. Edwards)                    RAD_ALL.11603 
!       4.1             14-05-96                Cloudy direct flux                 RAD_ALL.11604 
!                                               at ground returned                 RAD_ALL.11605 
!                                               for new solver.                    RAD_ALL.11606 
!                                               (J. M. Edwards)                    RAD_ALL.11607 
!                                                                                  RAD_ALL.11608 
! Description of Code:                                                             RAD_ALL.11609 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.11610 
!                                                                                  RAD_ALL.11611 
!- ---------------------------------------------------------------------           RAD_ALL.11612 
      SUBROUTINE MIXED_SOLAR_SOURCE(N_PROFILE, N_LAYER, N_CLOUD_TOP                RAD_ALL.11613 
     &   , FLUX_INC_DIRECT                                                         RAD_ALL.11614 
     &   , L_SCALE_SOLAR, ADJUST_SOLAR_KE                                          RAD_ALL.11615 
     &   , TRANS_0_FREE, SOURCE_COEFF_FREE                                         RAD_ALL.11616 
     &   , G_FF, G_FC, G_CF, G_CC                                                  RAD_ALL.11617 
     &   , TRANS_0_CLOUD, SOURCE_COEFF_CLOUD                                       RAD_ALL.11618 
     &   , FLUX_DIRECT                                                             RAD_ALL.11619 
     &   , FLUX_DIRECT_GROUND_CLOUD                                                RAD_ALL.11620 
     &   , S_UP_FREE, S_DOWN_FREE                                                  RAD_ALL.11621 
     &   , S_UP_CLOUD, S_DOWN_CLOUD                                                RAD_ALL.11622 
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.11623 
     &   )                                                                         RAD_ALL.11624 
!                                                                                  RAD_ALL.11625 
!                                                                                  RAD_ALL.11626 
!                                                                                  RAD_ALL.11627 
      IMPLICIT NONE                                                                RAD_ALL.11628 
!                                                                                  RAD_ALL.11629 
!                                                                                  RAD_ALL.11630 
!     SIZES OF DUMMY ARRAYS                                                        RAD_ALL.11631 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.11632 
     &     NPD_PROFILE                                                             RAD_ALL.11633 
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.11634 
     &   , NPD_LAYER                                                               RAD_ALL.11635 
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.11636 
!                                                                                  RAD_ALL.11637 
!     COMDECKS INCLUDED                                                            RAD_ALL.11638 
!     ------------------------------------------------------------------           DIMFIX3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       DIMFIX3A.3     
!                                                                                  DIMFIX3A.4     
!     MODULE TO SET INTERNAL DIMENSIONS TIED TO ALGORITHMS,                        DIMFIX3A.5     
!     MOSTLY FOR CLOUDS.                                                           DIMFIX3A.6     
!                                                                                  DIMFIX3A.7     
      INTEGER                                                                      DIMFIX3A.8     
     &     NPD_CLOUD_COMPONENT                                                     DIMFIX3A.9     
!             NUMBER OF COMPONENTS OF CLOUDS                                       DIMFIX3A.10    
     &   , NPD_CLOUD_TYPE                                                          DIMFIX3A.11    
!             NUMBER OF PERMITTED TYPES OF CLOUDS.                                 DIMFIX3A.12    
     &   , NPD_CLOUD_REPRESENTATION                                                DIMFIX3A.13    
!             NUMBER OF PERMITTED REPRESENTATIONS OF CLOUDS.                       DIMFIX3A.14    
     &   , NPD_OVERLAP_COEFF                                                       DIMFIX3A.15    
!             NUMBER OF OVERLAP COEFFICIENTS FOR CLOUDS                            DIMFIX3A.16    
     &   , NPD_SOURCE_COEFF                                                        DIMFIX3A.17    
!             NUMBER OF COEFFICIENTS FOR TWO-STREAM SOURCES                        DIMFIX3A.18    
     &   , NPD_REGION                                                              DIMFIX3A.19    
!             NUMBER OF REGIONS IN A LAYER                                         DIMFIX3A.20    
!                                                                                  DIMFIX3A.21    
      PARAMETER(                                                                   DIMFIX3A.22    
     &     NPD_CLOUD_COMPONENT=4                                                   DIMFIX3A.23    
     &   , NPD_CLOUD_TYPE=4                                                        DIMFIX3A.24    
     &   , NPD_CLOUD_REPRESENTATION=4                                              DIMFIX3A.25    
     &   , NPD_OVERLAP_COEFF=18                                                    DIMFIX3A.26    
     &   , NPD_SOURCE_COEFF=2                                                      DIMFIX3A.27    
     &   , NPD_REGION=3                                                            DIMFIX3A.28    
     &   )                                                                         DIMFIX3A.29    
!                                                                                  DIMFIX3A.30    
!     ------------------------------------------------------------------           DIMFIX3A.31    
!     ------------------------------------------------------------------           SCFPT3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SCFPT3A.3     
!                                                                                  SCFPT3A.4     
!     MODULE TO SET POINTERS TO SOURCE COEFFICIENTS.                               SCFPT3A.5     
!                                                                                  SCFPT3A.6     
      INTEGER                                                                      SCFPT3A.7     
     &     IP_SCF_SOLAR_UP                                                         SCFPT3A.8     
!             POINTER TO SOURCE COEFICIENT FOR UPWARD SOLAR BEAM                   SCFPT3A.9     
     &   , IP_SCF_SOLAR_DOWN                                                       SCFPT3A.10    
!             POINTER TO SOURCE COEFICIENT FOR DOWNWARD SOLAR BEAM                 SCFPT3A.11    
     &   , IP_SCF_IR_1D                                                            SCFPT3A.12    
!             POINTER TO SOURCE COEFICIENT                                         SCFPT3A.13    
!             FOR 1ST DIFFERENCE OF PLANCKIAN                                      SCFPT3A.14    
     &   , IP_SCF_IR_2D                                                            SCFPT3A.15    
!             POINTER TO SOURCE COEFICIENT                                         SCFPT3A.16    
!             FOR 2ND DIFFERENCE OF PLANCKIAN                                      SCFPT3A.17    
!                                                                                  SCFPT3A.18    
      PARAMETER(                                                                   SCFPT3A.19    
     &     IP_SCF_SOLAR_UP=1                                                       SCFPT3A.20    
     &   , IP_SCF_SOLAR_DOWN=2                                                     SCFPT3A.21    
     &   , IP_SCF_IR_1D=1                                                          SCFPT3A.22    
     &   , IP_SCF_IR_2D=2                                                          SCFPT3A.23    
     &   )                                                                         SCFPT3A.24    
!                                                                                  SCFPT3A.25    
!     ------------------------------------------------------------------           SCFPT3A.26    
!                                                                                  RAD_ALL.11641 
!                                                                                  RAD_ALL.11642 
!                                                                                  RAD_ALL.11643 
!     DUMMY ARGUMENTS.                                                             RAD_ALL.11644 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.11645 
     &     N_PROFILE                                                               RAD_ALL.11646 
!             NUMBER OF PROFILES                                                   RAD_ALL.11647 
     &   , N_LAYER                                                                 RAD_ALL.11648 
!             NUMBER OF LAYERS                                                     RAD_ALL.11649 
     &   , N_CLOUD_TOP                                                             RAD_ALL.11650 
!             TOP CLOUDY LAYER                                                     RAD_ALL.11651 
!                                                                                  RAD_ALL.11652 
!     SPECIAL ARRAYS FOR EQUIVALENT EXTINCTION:                                    RAD_ALL.11653 
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.11654 
     &     L_SCALE_SOLAR                                                           RAD_ALL.11655 
!             SCALING APPLIED TO SOLAR FLUX                                        RAD_ALL.11656 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11657 
     &     ADJUST_SOLAR_KE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.11658 
!             ADJUSTMENT TO SOLAR FLUXES WITH EQUIVALENT EXTINCTION                RAD_ALL.11659 
!                                                                                  RAD_ALL.11660 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11661 
     &     FLUX_INC_DIRECT(NPD_PROFILE)                                            RAD_ALL.11662 
!             INCIDENT DIRECT SOLAR FLUX                                           RAD_ALL.11663 
!                                                                                  RAD_ALL.11664 
!     CLEAR-SKY OPTICAL PROPERTIES:                                                RAD_ALL.11665 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11666 
     &     TRANS_0_FREE(NPD_PROFILE, NPD_LAYER)                                    RAD_ALL.11667 
!             FREE DIRECT TRANSMISSION                                             RAD_ALL.11668 
     &   , SOURCE_COEFF_FREE(NPD_PROFILE, NPD_LAYER, NPD_SOURCE_COEFF)             RAD_ALL.11669 
!             CLEAR-SKY SOURCE COEFFICIENTS                                        RAD_ALL.11670 
!                                                                                  RAD_ALL.11671 
!     CLOUDY OPTICAL PROPERTIES:                                                   RAD_ALL.11672 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11673 
     &     TRANS_0_CLOUD(NPD_PROFILE, NPD_LAYER)                                   RAD_ALL.11674 
!             CLOUDY TRANSMISSION                                                  RAD_ALL.11675 
     &   , SOURCE_COEFF_CLOUD(NPD_PROFILE, NPD_LAYER, NPD_SOURCE_COEFF)            RAD_ALL.11676 
!             CLOUDY REFLECTANCE                                                   RAD_ALL.11677 
!                                                                                  RAD_ALL.11678 
!     ENERGY TRANSFER COEFFICIENTS:                                                RAD_ALL.11679 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11680 
     &     G_FF(NPD_PROFILE, 0: NPD_LAYER)                                         RAD_ALL.11681 
!             ENERGY TRANSFER COEFFICIENT                                          RAD_ALL.11682 
     &   , G_FC(NPD_PROFILE, 0: NPD_LAYER)                                         RAD_ALL.11683 
!             ENERGY TRANSFER COEFFICIENT                                          RAD_ALL.11684 
     &   , G_CF(NPD_PROFILE, 0: NPD_LAYER)                                         RAD_ALL.11685 
!             ENERGY TRANSFER COEFFICIENT                                          RAD_ALL.11686 
     &   , G_CC(NPD_PROFILE, 0: NPD_LAYER)                                         RAD_ALL.11687 
!             ENERGY TRANSFER COEFFICIENT                                          RAD_ALL.11688 
!                                                                                  RAD_ALL.11689 
!     CALCULATED DIRECT FLUX AND SOURCE TERMS:                                     RAD_ALL.11690 
      REAL      !, INTENT(OUT)                                                     RAD_ALL.11691 
     &     FLUX_DIRECT(NPD_PROFILE, 0: NPD_LAYER)                                  RAD_ALL.11692 
!             DIRECT FLUX                                                          RAD_ALL.11693 
     &   , FLUX_DIRECT_GROUND_CLOUD(NPD_PROFILE)                                   RAD_ALL.11694 
!             DIRECT CLOUDY FLUX AT GROUND                                         RAD_ALL.11695 
     &   , S_UP_FREE(NPD_PROFILE, NPD_LAYER)                                       RAD_ALL.11696 
!             FREE UPWARD SOURCE FUNCTION                                          RAD_ALL.11697 
     &   , S_DOWN_FREE(NPD_PROFILE, NPD_LAYER)                                     RAD_ALL.11698 
!             FREE DOWNWARD SOURCE FUNCTION                                        RAD_ALL.11699 
     &   , S_UP_CLOUD(NPD_PROFILE, NPD_LAYER)                                      RAD_ALL.11700 
!             CLOUDY UPWARD SOURCE FUNCTION                                        RAD_ALL.11701 
     &   , S_DOWN_CLOUD(NPD_PROFILE, NPD_LAYER)                                    RAD_ALL.11702 
!             CLOUDY DOWNWARD SOURCE FUNCTION                                      RAD_ALL.11703 
!                                                                                  RAD_ALL.11704 
!                                                                                  RAD_ALL.11705 
!     LOCAL VARIABLES.                                                             RAD_ALL.11706 
      INTEGER                                                                      RAD_ALL.11707 
     &     I                                                                       RAD_ALL.11708 
!             LOOP VARIABLE                                                        RAD_ALL.11709 
     &   , L                                                                       RAD_ALL.11710 
!             LOOP VARIABLE                                                        RAD_ALL.11711 
!                                                                                  RAD_ALL.11712 
      REAL                                                                         RAD_ALL.11713 
     &     SOLAR_TOP_FREE(NPD_PROFILE)                                             RAD_ALL.11714 
!             FREE SOLAR FLUX AT TOP OF LAYER                                      RAD_ALL.11715 
     &   , SOLAR_TOP_CLOUD(NPD_PROFILE)                                            RAD_ALL.11716 
!             CLOUDY SOLAR FLUX AT TOP OF LAYER                                    RAD_ALL.11717 
     &   , SOLAR_BASE_FREE(NPD_PROFILE)                                            RAD_ALL.11718 
!             FREE SOLAR FLUX AT BASE OF LAYER                                     RAD_ALL.11719 
     &   , SOLAR_BASE_CLOUD(NPD_PROFILE)                                           RAD_ALL.11720 
!             CLOUDY SOLAR FLUX AT BASE OF LAYER                                   RAD_ALL.11721 
!                                                                                  RAD_ALL.11722 
!                                                                                  RAD_ALL.11723 
!                                                                                  RAD_ALL.11724 
!     THE CLEAR AND CLOUDY DIRECT FLUXES ARE CALCULATED SEPARATELY                 RAD_ALL.11725 
!     AND ADDED TOGETHER TO FORM THE TOTAL DIRECT FLUX.                            RAD_ALL.11726 
!                                                                                  RAD_ALL.11727 
!     SET INCIDENT FLUXES.                                                         RAD_ALL.11728 
      DO L=1, N_PROFILE                                                            RAD_ALL.11729 
         FLUX_DIRECT(L, 0)=FLUX_INC_DIRECT(L)                                      RAD_ALL.11730 
      ENDDO                                                                        RAD_ALL.11731 
!                                                                                  RAD_ALL.11732 
!     WITH EQUIVALENT EXTINCTION THE DIRECT SOLAR FLUX MUST BE                     RAD_ALL.11733 
!     CORRECTED.                                                                   RAD_ALL.11734 
!                                                                                  RAD_ALL.11735 
      IF (L_SCALE_SOLAR) THEN                                                      RAD_ALL.11736 
!                                                                                  RAD_ALL.11737 
         DO I=1, N_CLOUD_TOP-1                                                     RAD_ALL.11738 
            DO L=1, N_PROFILE                                                      RAD_ALL.11739 
               FLUX_DIRECT(L, I)                                                   RAD_ALL.11740 
     &            =FLUX_DIRECT(L, I-1)*TRANS_0_FREE(L, I)                          RAD_ALL.11741 
     &            *ADJUST_SOLAR_KE(L, I)                                           RAD_ALL.11742 
               S_UP_FREE(L, I)=SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_UP)            RAD_ALL.11743 
     &            *FLUX_DIRECT(L, I-1)                                             RAD_ALL.11744 
               S_DOWN_FREE(L, I)                                                   RAD_ALL.11745 
     &            =(SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_DOWN)                     RAD_ALL.11746 
     &            -TRANS_0_FREE(L, I))*FLUX_DIRECT(L, I-1)                         RAD_ALL.11747 
     &            +FLUX_DIRECT(L, I)                                               RAD_ALL.11748 
            ENDDO                                                                  RAD_ALL.11749 
         ENDDO                                                                     RAD_ALL.11750 
!                                                                                  RAD_ALL.11751 
      ELSE                                                                         RAD_ALL.11752 
!                                                                                  RAD_ALL.11753 
         DO I=1, N_CLOUD_TOP-1                                                     RAD_ALL.11754 
            DO L=1, N_PROFILE                                                      RAD_ALL.11755 
               FLUX_DIRECT(L, I)                                                   RAD_ALL.11756 
     &            =FLUX_DIRECT(L, I-1)*TRANS_0_FREE(L, I)                          RAD_ALL.11757 
               S_UP_FREE(L, I)=SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_UP)            RAD_ALL.11758 
     &            *FLUX_DIRECT(L, I-1)                                             RAD_ALL.11759 
               S_DOWN_FREE(L, I)                                                   RAD_ALL.11760 
     &            =SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_DOWN)                      RAD_ALL.11761 
     &            *FLUX_DIRECT(L, I-1)                                             RAD_ALL.11762 
            ENDDO                                                                  RAD_ALL.11763 
         ENDDO                                                                     RAD_ALL.11764 
!                                                                                  RAD_ALL.11765 
      ENDIF                                                                        RAD_ALL.11766 
!                                                                                  RAD_ALL.11767 
!                                                                                  RAD_ALL.11768 
!                                                                                  RAD_ALL.11769 
!     CLEAR AND CLOUDY REGION.                                                     RAD_ALL.11770 
!     INITIALIZE PARTIAL FLUXES:                                                   RAD_ALL.11771 
      DO L=1, N_PROFILE                                                            RAD_ALL.11772 
         SOLAR_BASE_FREE(L)=FLUX_DIRECT(L, N_CLOUD_TOP-1)                          RAD_ALL.11773 
         SOLAR_BASE_CLOUD(L)=0.0E+00                                               RAD_ALL.11774 
      ENDDO                                                                        RAD_ALL.11775 
!                                                                                  RAD_ALL.11776 
!                                                                                  RAD_ALL.11777 
      DO I=N_CLOUD_TOP, N_LAYER                                                    RAD_ALL.11778 
!                                                                                  RAD_ALL.11779 
!        TRANSFER FLUXES ACROSS THE INTERFACE. THE USE OF ONLY ONE                 RAD_ALL.11780 
!        CLOUDY FLUX IMPLICITLY FORCES RANDOM OVERLAP OF DIFFERENT                 RAD_ALL.11781 
!        SUBCLOUDS WITHIN THE CLOUDY PARTS OF THE LAYER.                           RAD_ALL.11782 
!                                                                                  RAD_ALL.11783 
         DO L=1, N_PROFILE                                                         RAD_ALL.11784 
            SOLAR_TOP_CLOUD(L)=G_CC(L, I-1)*SOLAR_BASE_CLOUD(L)                    RAD_ALL.11785 
     &         +G_FC(L, I-1)*SOLAR_BASE_FREE(L)                                    RAD_ALL.11786 
            SOLAR_TOP_FREE(L)=G_FF(L, I-1)*SOLAR_BASE_FREE(L)                      RAD_ALL.11787 
     &         +G_CF(L, I-1)*SOLAR_BASE_CLOUD(L)                                   RAD_ALL.11788 
         ENDDO                                                                     RAD_ALL.11789 
!                                                                                  RAD_ALL.11790 
!                                                                                  RAD_ALL.11791 
!        PROPAGATE THE CLEAR AND CLOUDY FLUXES THROUGH THE LAYER:                  RAD_ALL.11792 
!                                                                                  RAD_ALL.11793 
         IF (L_SCALE_SOLAR) THEN                                                   RAD_ALL.11794 
!                                                                                  RAD_ALL.11795 
            DO L=1, N_PROFILE                                                      RAD_ALL.11796 
               SOLAR_BASE_FREE(L)=SOLAR_TOP_FREE(L)                                RAD_ALL.11797 
     &            *TRANS_0_FREE(L, I)*ADJUST_SOLAR_KE(L, I)                        RAD_ALL.11798 
               SOLAR_BASE_CLOUD(L)=SOLAR_TOP_CLOUD(L)                              RAD_ALL.11799 
     &            *TRANS_0_CLOUD(L, I)*ADJUST_SOLAR_KE(L, I)                       RAD_ALL.11800 
               S_UP_FREE(L, I)=SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_UP)            RAD_ALL.11801 
     &            *SOLAR_TOP_FREE(L)                                               RAD_ALL.11802 
               S_DOWN_FREE(L, I)                                                   RAD_ALL.11803 
     &            =(SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_DOWN)                     RAD_ALL.11804 
     &            -TRANS_0_FREE(L, I))*SOLAR_TOP_FREE(L)                           RAD_ALL.11805 
     &            +SOLAR_BASE_FREE(L)                                              RAD_ALL.11806 
               S_UP_CLOUD(L, I)                                                    RAD_ALL.11807 
     &            =SOURCE_COEFF_CLOUD(L, I, IP_SCF_SOLAR_UP)                       RAD_ALL.11808 
     &            *SOLAR_TOP_CLOUD(L)                                              RAD_ALL.11809 
               S_DOWN_CLOUD(L, I)                                                  RAD_ALL.11810 
     &            =(SOURCE_COEFF_CLOUD(L, I, IP_SCF_SOLAR_DOWN)                    RAD_ALL.11811 
     &            -TRANS_0_CLOUD(L, I))*SOLAR_TOP_CLOUD(L)                         RAD_ALL.11812 
     &            +SOLAR_BASE_CLOUD(L)                                             RAD_ALL.11813 
            ENDDO                                                                  RAD_ALL.11814 
!                                                                                  RAD_ALL.11815 
         ELSE                                                                      RAD_ALL.11816 
!                                                                                  RAD_ALL.11817 
            DO L=1, N_PROFILE                                                      RAD_ALL.11818 
               SOLAR_BASE_FREE(L)=SOLAR_TOP_FREE(L)                                RAD_ALL.11819 
     &            *TRANS_0_FREE(L, I)                                              RAD_ALL.11820 
               SOLAR_BASE_CLOUD(L)=SOLAR_TOP_CLOUD(L)                              RAD_ALL.11821 
     &            *TRANS_0_CLOUD(L, I)                                             RAD_ALL.11822 
               S_UP_FREE(L, I)=SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_UP)            RAD_ALL.11823 
     &            *SOLAR_TOP_FREE(L)                                               RAD_ALL.11824 
               S_DOWN_FREE(L, I)                                                   RAD_ALL.11825 
     &            =SOURCE_COEFF_FREE(L, I, IP_SCF_SOLAR_DOWN)                      RAD_ALL.11826 
     &            *SOLAR_TOP_FREE(L)                                               RAD_ALL.11827 
               S_UP_CLOUD(L, I)                                                    RAD_ALL.11828 
     &            =SOURCE_COEFF_CLOUD(L, I, IP_SCF_SOLAR_UP)                       RAD_ALL.11829 
     &            *SOLAR_TOP_CLOUD(L)                                              RAD_ALL.11830 
               S_DOWN_CLOUD(L, I)                                                  RAD_ALL.11831 
     &            =SOURCE_COEFF_CLOUD(L, I, IP_SCF_SOLAR_DOWN)                     RAD_ALL.11832 
     &            *SOLAR_TOP_CLOUD(L)                                              RAD_ALL.11833 
            ENDDO                                                                  RAD_ALL.11834 
!                                                                                  RAD_ALL.11835 
         ENDIF                                                                     RAD_ALL.11836 
!                                                                                  RAD_ALL.11837 
!                                                                                  RAD_ALL.11838 
!        CALCULATE THE TOTAL DIRECT FLUX.                                          RAD_ALL.11839 
!                                                                                  RAD_ALL.11840 
         DO L=1, N_PROFILE                                                         RAD_ALL.11841 
            FLUX_DIRECT(L, I)=SOLAR_BASE_FREE(L)+SOLAR_BASE_CLOUD(L)               RAD_ALL.11842 
         ENDDO                                                                     RAD_ALL.11843 
!                                                                                  RAD_ALL.11844 
      ENDDO                                                                        RAD_ALL.11845 
!                                                                                  RAD_ALL.11846 
!     PASS THE LAST VALUE AT THE BASE OF THE CLOUD OUT.                            RAD_ALL.11847 
      DO L=1, N_PROFILE                                                            RAD_ALL.11848 
         FLUX_DIRECT_GROUND_CLOUD(L)=SOLAR_BASE_CLOUD(L)                           RAD_ALL.11849 
      ENDDO                                                                        RAD_ALL.11850 
!                                                                                  RAD_ALL.11851 
!                                                                                  RAD_ALL.11852 
!                                                                                  RAD_ALL.11853 
      RETURN                                                                       RAD_ALL.11854 
      END 
