C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.11860 
C                                                                                  RAD_ALL.11861 
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.11862 
C restrictions as set forth in the contract.                                       RAD_ALL.11863 
C                                                                                  RAD_ALL.11864 
C                Meteorological Office                                             RAD_ALL.11865 
C                London Road                                                       RAD_ALL.11866 
C                BRACKNELL                                                         RAD_ALL.11867 
C                Berkshire UK                                                      RAD_ALL.11868 
C                RG12 2SZ                                                          RAD_ALL.11869 
C                                                                                  RAD_ALL.11870 
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.11871 
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.11872 
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.11873 
C Modelling at the above address.                                                  RAD_ALL.11874 
C ******************************COPYRIGHT******************************            RAD_ALL.11875 
C                                                                                  RAD_ALL.11876 
!+ Subroutine to set the elements of the matrix for the net fluxes.                RAD_ALL.11877 
!                                                                                  RAD_ALL.11878 
! Method:                                                                          RAD_ALL.11879 
!       The method is somewhat involved. It is described in a                      RAD_ALL.11880 
!       separate document.                                                         RAD_ALL.11881 
!                                                                                  RAD_ALL.11882 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.11883 
!                                                                                  RAD_ALL.11884 
! History:                                                                         RAD_ALL.11885 
!       Version         Date                    Comment                            RAD_ALL.11886 
!       4.0             27-07-95                Original Code                      RAD_ALL.11887 
!                                               (J. M. Edwards)                    RAD_ALL.11888 
!       4.2             Nov. 96   T3E migration: CALL WHENFGT replaced             RAD_ALL.11889 
!                                  by portable fortran code.                       RAD_ALL.11890 
!                                                S.J.Swarbrick                     RAD_ALL.11891 
!                                                                                  RAD_ALL.11892 
! Description of Code:                                                             RAD_ALL.11893 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.11894 
!                                                                                  RAD_ALL.11895 
!- ---------------------------------------------------------------------           RAD_ALL.11896 
      SUBROUTINE MIX_NET_MATRIX(N_PROFILE, N_LAYER, N_CLOUD_TOP                    RAD_ALL.11897 
     &   , T_FREE, R_FREE, T_CLOUD, R_CLOUD                                        RAD_ALL.11898 
     &   , S_UP_FREE, S_DOWN_FREE, S_UP_CLOUD, S_DOWN_CLOUD                        RAD_ALL.11899 
     &   , ALBEDO_SURFACE_DIFF, ALBEDO_SURFACE_DIR, SOURCE_GROUND                  RAD_ALL.11900 
     &   , FLUX_DIRECT_GROUND                                                      RAD_ALL.11901 
     &   , FLUX_INC_DOWN                                                           RAD_ALL.11902 
     &   , N_FREE_PROFILE, I_FREE_PROFILE                                          RAD_ALL.11903 
     &   , N_CLOUD_PROFILE, I_CLOUD_PROFILE                                        RAD_ALL.11904 
     &   , G_M, G_P                                                                RAD_ALL.11905 
     &   , B_M, B_P                                                                RAD_ALL.11906 
     &   , TOL_CLOUD                                                               RAD_ALL.11907 
     &   , P, V                                                                    RAD_ALL.11908 
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.11909 
     &   )                                                                         RAD_ALL.11910 
!                                                                                  RAD_ALL.11911 
!                                                                                  RAD_ALL.11912 
      IMPLICIT NONE                                                                RAD_ALL.11913 
!                                                                                  RAD_ALL.11914 
!                                                                                  RAD_ALL.11915 
!     SIZES OF DUMMY ARRAYS.                                                       RAD_ALL.11916 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.11917 
     &     NPD_PROFILE                                                             RAD_ALL.11918 
!             NUMBER OF PROFILES                                                   RAD_ALL.11919 
     &   , NPD_LAYER                                                               RAD_ALL.11920 
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.11921 
!                                                                                  RAD_ALL.11922 
!     INCLUDE COMDECKS                                                             RAD_ALL.11923 
!     ------------------------------------------------------------------           PRMCH3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       PRMCH3A.3     
!                                                                                  PRMCH3A.4     
!     MODULE FOR SETTING MACHINE PRECISION.                                        PRMCH3A.5     
!                                                                                  PRMCH3A.6     
      REAL                                                                         PRMCH3A.7     
     &     TOL_MACHINE                                                             PRMCH3A.8     
!             MACHINE TOLERANCE                                                    PRMCH3A.9     
     &   , SQRT_TOL_MACHINE                                                        PRMCH3A.10    
!             SQRT OF MACHINE TOLERANCE                                            PRMCH3A.11    
!                                                                                  PRMCH3A.12    
!                                                                                  PRMCH3A.13    
!     THE PRECISION SHOULD BE ABOUT 2/2^(SIZE OF SIGNIFICAND)                      PRMCH3A.14    
!                                                                                  PRMCH3A.15    
!     THE IEEE-FORMAT USES 53 BITS FOR THE SIGNIFICAND                             PRMCH3A.16    
!     IN DOUBLE PRECISION                                                          PRMCH3A.17    
!                                                                                  PRMCH3A.18    
!     THE CRAY FORMAT USES 47 BITS IN SINGLE PRECISION.                            PRMCH3A.19    
!                                                                                  PRMCH3A.20    
      PARAMETER(                                                                   PRMCH3A.21    
     &     TOL_MACHINE=1.42E-14                                                    PRMCH3A.22    
     &   , SQRT_TOL_MACHINE=1.19E-7                                                PRMCH3A.23    
     &   )                                                                         PRMCH3A.24    
!                                                                                  PRMCH3A.25    
!     ------------------------------------------------------------------           PRMCH3A.26    
!     ------------------------------------------------------------------           PRECSN3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       PRECSN3A.3     
!                                                                                  PRECSN3A.4     
!     MODULE FOR SETTING MACHINE-DEPENDENT TOLERANCES.                             PRECSN3A.5     
!     (THE COMDECK PRMCH3A MUST ALWAYS BE INCLUDED BEFORE THIS COMDECK.)           PRECSN3A.6     
!                                                                                  PRECSN3A.7     
      REAL                                                                         PRECSN3A.8     
     &     TOL_DIV                                                                 PRECSN3A.9     
!             TOLERANCE FOR DIVISION                                               PRECSN3A.10    
     &   , TOL_TEST                                                                PRECSN3A.11    
!             TOLERANCE FOR TESTING EQUALITY                                       PRECSN3A.12    
!                                                                                  PRECSN3A.13    
      PARAMETER(                                                                   PRECSN3A.14    
     &     TOL_DIV=3.2E+01*TOL_MACHINE                                             PRECSN3A.15    
     &   , TOL_TEST=1.6E+01*TOL_MACHINE                                            PRECSN3A.16    
     &   )                                                                         PRECSN3A.17    
!                                                                                  PRECSN3A.18    
!     ------------------------------------------------------------------           PRECSN3A.19    
!                                                                                  RAD_ALL.11926 
!     DUMMY VARIABLES                                                              RAD_ALL.11927 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.11928 
     &     N_PROFILE                                                               RAD_ALL.11929 
!             NUMBER OF PROFILES                                                   RAD_ALL.11930 
     &   , N_LAYER                                                                 RAD_ALL.11931 
!             NUMBER OF LAYERS                                                     RAD_ALL.11932 
     &   , N_CLOUD_TOP                                                             RAD_ALL.11933 
!             TOPMOST CLOUDY LAYER                                                 RAD_ALL.11934 
     &   , N_FREE_PROFILE(NPD_LAYER)                                               RAD_ALL.11935 
!             NUMBER OF FREE PROFILES                                              RAD_ALL.11936 
     &   , I_FREE_PROFILE(NPD_PROFILE, NPD_LAYER)                                  RAD_ALL.11937 
!             INDICES OF FREE PROFILES                                             RAD_ALL.11938 
     &   , N_CLOUD_PROFILE(NPD_LAYER)                                              RAD_ALL.11939 
!             NUMBER OF CLOUDY PROFILES                                            RAD_ALL.11940 
     &   , I_CLOUD_PROFILE(NPD_PROFILE, NPD_LAYER)                                 RAD_ALL.11941 
!             INDICES OF CLOUDY PROFILES                                           RAD_ALL.11942 
!                                                                                  RAD_ALL.11943 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11944 
     &     T_CLOUD(NPD_PROFILE, NPD_LAYER)                                         RAD_ALL.11945 
!             CLOUDY TRANSMITTANCE                                                 RAD_ALL.11946 
     &   , R_CLOUD(NPD_PROFILE, NPD_LAYER)                                         RAD_ALL.11947 
!             CLOUDY REFLECTANCE                                                   RAD_ALL.11948 
     &   , T_FREE(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.11949 
!             CLOUD-FREE TRANSMITTANCE                                             RAD_ALL.11950 
     &   , R_FREE(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.11951 
!             CLOUD-FREE REFLEXTANCE                                               RAD_ALL.11952 
     &   , S_UP_CLOUD(NPD_PROFILE, NPD_LAYER)                                      RAD_ALL.11953 
!             CLOUDY UPWARD SOURCE FUNCTION                                        RAD_ALL.11954 
     &   , S_UP_FREE(NPD_PROFILE, NPD_LAYER)                                       RAD_ALL.11955 
!             CLOUD-FREE UPWARD SOURCE FUNCTION                                    RAD_ALL.11956 
     &   , S_DOWN_CLOUD(NPD_PROFILE, NPD_LAYER)                                    RAD_ALL.11957 
!             CLOUDY DOWNWARD SOURCE FUNCTION                                      RAD_ALL.11958 
     &   , S_DOWN_FREE(NPD_PROFILE, NPD_LAYER)                                     RAD_ALL.11959 
!             CLOUD-FREE DOWNWARD SOURCE FUNCTION                                  RAD_ALL.11960 
      REAL      !, INTENT(IN)                                                      RAD_ALL.11961 
     &     ALBEDO_SURFACE_DIR(NPD_PROFILE)                                         RAD_ALL.11962 
!             DIRECT SURFACE RELFECTANCE                                           RAD_ALL.11963 
     &   , ALBEDO_SURFACE_DIFF(NPD_PROFILE)                                        RAD_ALL.11964 
!             DIFFUSE SURFACE REFLECTANCE                                          RAD_ALL.11965 
     &   , SOURCE_GROUND(NPD_PROFILE)                                              RAD_ALL.11966 
!             GROUND SOURCE FUNCTION                                               RAD_ALL.11967 
     &   , B_M(NPD_PROFILE, 0: NPD_LAYER)                                          RAD_ALL.11968 
!             ENERGY TRANSFER FUNCTION                                             RAD_ALL.11969 
     &   , B_P(NPD_PROFILE, 0: NPD_LAYER)                                          RAD_ALL.11970 
!             ENERGY TRANSFER FUNCTION                                             RAD_ALL.11971 
     &   , G_M(NPD_PROFILE, 0: NPD_LAYER)                                          RAD_ALL.11972 
!             ENERGY TRANSFER FUNCTION                                             RAD_ALL.11973 
     &   , G_P(NPD_PROFILE, 0: NPD_LAYER)                                          RAD_ALL.11974 
!             ENERGY TRANSFER FUNCTION                                             RAD_ALL.11975 
     &   , FLUX_DIRECT_GROUND(NPD_PROFILE)                                         RAD_ALL.11976 
!             DIRECT FLUX AT GROUND                                                RAD_ALL.11977 
     &   , FLUX_INC_DOWN(NPD_PROFILE)                                              RAD_ALL.11978 
!             DOWNWARD INCIDENT FLUX                                               RAD_ALL.11979 
     &   , TOL_CLOUD                                                               RAD_ALL.11980 
!             TOLERANCE FOR RESTORING CONDITIONING WITH CLOUDS                     RAD_ALL.11981 
      REAL      !, INTENT(OUT)                                                     RAD_ALL.11982 
     &     P(NPD_PROFILE, 5, 2*NPD_LAYER+2)                                        RAD_ALL.11983 
!             BANDED MATRIX OF EQUATIONS                                           RAD_ALL.11984 
     &   , V(NPD_PROFILE, 2*NPD_LAYER+2)                                           RAD_ALL.11985 
!             RIGHT-HAND SIDES OF EQUATIONS                                        RAD_ALL.11986 
!                                                                                  RAD_ALL.11987 
!     LOCAL VARIABLES.                                                             RAD_ALL.11988 
      INTEGER                                                                      RAD_ALL.11989 
     &     L                                                                       RAD_ALL.11990 
!             LOOP VARIABLE                                                        RAD_ALL.11991 
     &   , I                                                                       RAD_ALL.11992 
!             LOOP VARIABLE                                                        RAD_ALL.11993 
     &   , LL                                                                      RAD_ALL.11994 
!             LOOP VARIABLE                                                        RAD_ALL.11995 
     &   , N_INDEX                                                                 RAD_ALL.11996 
!             NUMBER OF INDICES SATISFYING TEST                                    RAD_ALL.11997 
     &   , INDEX(NPD_PROFILE)                                                      RAD_ALL.11998 
!             INDICES SATISFYING TEST                                              RAD_ALL.11999 
      REAL                                                                         RAD_ALL.12000 
     &     DET                                                                     RAD_ALL.12001 
!             DETERMINANT IN SETS OF EQUATIONS                                     RAD_ALL.12002 
     &   , RATIO_DOWN(NPD_PROFILE, 0: NPD_LAYER)                                   RAD_ALL.12003 
!             RATIO OF TERMS FOR ELIMINATION                                       RAD_ALL.12004 
     &   , RATIO_UP(NPD_PROFILE, 0: NPD_LAYER)                                     RAD_ALL.12005 
!             RATIO OF TERMS FOR ELIMINATION                                       RAD_ALL.12006 
      REAL                                                                         RAD_ALL.12007 
     &     ZETA_TOP_CLOUD                                                          RAD_ALL.12008 
!             J-SOURCE IN CLOUD                                                    RAD_ALL.12009 
     &   , ZETA_BASE_CLOUD                                                         RAD_ALL.12010 
!             J-SOURCE IN CLOUD                                                    RAD_ALL.12011 
      REAL                                                                         RAD_ALL.12012 
     &     SIGMA_FREE(NPD_PROFILE, NPD_LAYER)                                      RAD_ALL.12013 
     &   , DELTA_FREE(NPD_PROFILE, NPD_LAYER)                                      RAD_ALL.12014 
     &   , SIGMA_CLOUD                                                             RAD_ALL.12015 
     &   , DELTA_CLOUD                                                             RAD_ALL.12016 
     &   , D_SIGMA                                                                 RAD_ALL.12017 
     &   , D_DELTA                                                                 RAD_ALL.12018 
     &   , PERTURBATION                                                            RAD_ALL.12019 
     &   , SIGMA_MEAN                                                              RAD_ALL.12020 
     &   , DELTA_MEAN                                                              RAD_ALL.12021 
     &   , SIGMA_H                                                                 RAD_ALL.12022 
     &   , DELTA_K                                                                 RAD_ALL.12023 
     &   , U_PP(NPD_PROFILE, 0: NPD_LAYER+1)                                       RAD_ALL.12024 
     &   , U_MP(NPD_PROFILE, 0: NPD_LAYER+1)                                       RAD_ALL.12025 
     &   , U_PM(NPD_PROFILE, 0: NPD_LAYER+1)                                       RAD_ALL.12026 
     &   , U_MM(NPD_PROFILE, 0: NPD_LAYER+1)                                       RAD_ALL.12027 
     &   , P_0_P(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12028 
     &   , P_0_M(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12029 
     &   , P_1_M(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12030 
     &   , P_1_P(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12031 
     &   , Q_0_P(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12032 
     &   , Q_0_M(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12033 
     &   , Q_1_M(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12034 
     &   , Q_1_P(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12035 
      REAL                                                                         RAD_ALL.12036 
     &     M_M_M1(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12037 
     &   , M_M_0(NPD_PROFILE, 0: NPD_LAYER)                                        RAD_ALL.12038 
     &   , M_M_P1(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12039 
     &   , H_M_M1(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12040 
     &   , H_M_0(NPD_PROFILE, 0: NPD_LAYER)                                        RAD_ALL.12041 
     &   , H_M_P1(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12042 
     &   , M_P_M1(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.12043 
     &   , M_P_0(NPD_PROFILE, NPD_LAYER)                                           RAD_ALL.12044 
     &   , M_P_P1(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.12045 
     &   , H_P_M1(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.12046 
     &   , H_P_0(NPD_PROFILE, NPD_LAYER)                                           RAD_ALL.12047 
     &   , H_P_P1(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.12048 
     &   , W_M(NPD_PROFILE, 0: NPD_LAYER)                                          RAD_ALL.12049 
     &   , W_P(NPD_PROFILE, NPD_LAYER)                                             RAD_ALL.12050 
      REAL                                                                         RAD_ALL.12051 
     &     F_P_M2(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12052 
     &   , F_P_M1(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12053 
     &   , F_P_0(NPD_PROFILE, 0: NPD_LAYER)                                        RAD_ALL.12054 
     &   , F_P_P1(NPD_PROFILE, 0: NPD_LAYER)                                       RAD_ALL.12055 
     &   , Q_P(NPD_PROFILE, 0: NPD_LAYER)                                          RAD_ALL.12056 
     &   , F_M_M2(NPD_PROFILE, 0: NPD_LAYER+1)                                     RAD_ALL.12057 
     &   , F_M_M1(NPD_PROFILE, 0: NPD_LAYER+1)                                     RAD_ALL.12058 
     &   , F_M_0(NPD_PROFILE, 0: NPD_LAYER+1)                                      RAD_ALL.12059 
     &   , F_M_P1(NPD_PROFILE, 0: NPD_LAYER+1)                                     RAD_ALL.12060 
     &   , Q_M(NPD_PROFILE, 0: NPD_LAYER+1)                                        RAD_ALL.12061 
!                                                                                  RAD_ALL.12062 
!     SUBROUTINES CALLED:                                                          RAD_ALL.12063 
!                                                                                  RAD_ALL.12064 
!                                                                                  RAD_ALL.12065 
!     SET UP THE EXPRESSIONS FOR J IN TERMS OF N IN CLOUDLESS LAYERS.              RAD_ALL.12066 
!                                                                                  RAD_ALL.12067 
      DO I=1, N_LAYER                                                              RAD_ALL.12068 
         DO L=1, N_PROFILE                                                         RAD_ALL.12069 
            SIGMA_FREE(L, I)=2.0E+00/(1.0E+00-(T_FREE(L, I)                        RAD_ALL.12070 
     &         +R_FREE(L, I))*(1.0E+00-SQRT_TOL_MACHINE))-1.0E+00                  RAD_ALL.12071 
            DELTA_FREE(L, I)=2.0E+00/(1.0E+00+(T_FREE(L, I)                        RAD_ALL.12072 
     &         -R_FREE(L, I))*(1.0E+00-SQRT_TOL_MACHINE))-1.0E+00                  RAD_ALL.12073 
!                                                                                  RAD_ALL.12074 
!           PERTURB SIGMA AND DELTA TO AVOID LATER ILL-CONDITIONING.               RAD_ALL.12075 
            PERTURBATION=TOL_MACHINE/(SIGMA_FREE(L, I)-DELTA_FREE(L, I)            RAD_ALL.12076 
     &         +SQRT_TOL_MACHINE)                                                  RAD_ALL.12077 
            SIGMA_FREE(L, I)=SIGMA_FREE(L, I)+PERTURBATION                         RAD_ALL.12078 
            DELTA_FREE(L, I)=DELTA_FREE(L, I)-PERTURBATION                         RAD_ALL.12079 
!                                                                                  RAD_ALL.12080 
            F_M_M2(L, I)=0.0E+00                                                   RAD_ALL.12081 
            F_M_M1(L, I)=0.5E+00*(SIGMA_FREE(L, I)+DELTA_FREE(L, I))               RAD_ALL.12082 
            F_M_0(L, I)=-0.5E+00*(SIGMA_FREE(L, I)-DELTA_FREE(L, I))               RAD_ALL.12083 
            F_M_P1(L, I)=0.0E+00                                                   RAD_ALL.12084 
            Q_M(L, I)=0.5E+00*SIGMA_FREE(L, I)*(S_UP_FREE(L, I)                    RAD_ALL.12085 
     &         +S_DOWN_FREE(L, I))-0.5E+00*DELTA_FREE(L, I)                        RAD_ALL.12086 
     &         *(S_DOWN_FREE(L, I)-S_UP_FREE(L, I))+S_UP_FREE(L, I)                RAD_ALL.12087 
            F_P_M2(L, I)=0.0E+00                                                   RAD_ALL.12088 
            F_P_M1(L, I)=0.5E+00*(SIGMA_FREE(L, I)-DELTA_FREE(L, I))               RAD_ALL.12089 
            F_P_0(L, I)=-0.5E+00*(SIGMA_FREE(L, I)+DELTA_FREE(L, I))               RAD_ALL.12090 
            F_P_P1(L, I)=0.0E+00                                                   RAD_ALL.12091 
            Q_P(L, I)=0.5E+00*SIGMA_FREE(L, I)*(S_UP_FREE(L, I)                    RAD_ALL.12092 
     &         +S_DOWN_FREE(L, I))+0.5E+00*DELTA_FREE(L, I)                        RAD_ALL.12093 
     &         *(S_DOWN_FREE(L, I)-S_UP_FREE(L, I))+S_DOWN_FREE(L, I)              RAD_ALL.12094 
         ENDDO                                                                     RAD_ALL.12095 
      ENDDO                                                                        RAD_ALL.12096 
!                                                                                  RAD_ALL.12097 
!     SET UP THE EQUATIONS FOR THE DIFFERENCES IN THE CLEAR AND CLOUDY             RAD_ALL.12098 
!     NET AND SUMMED FLUXES AND SOLVE THEM. THESE SHOULD BE THOUGHT OF             RAD_ALL.12099 
!     AS EQUATIONS IN THE I'TH LAYER.                                              RAD_ALL.12100 
!                                                                                  RAD_ALL.12101 
      DO I=N_CLOUD_TOP, N_LAYER                                                    RAD_ALL.12102 
         DO LL=1, N_CLOUD_PROFILE(I)                                               RAD_ALL.12103 
            L=I_CLOUD_PROFILE(LL, I)                                               RAD_ALL.12104 
            SIGMA_CLOUD=2.0E+00/(1.0E+00-(T_CLOUD(L, I)+R_CLOUD(L, I))             RAD_ALL.12105 
     &         *(1.0E+00-TOL_CLOUD))-1.0E+00                                       RAD_ALL.12106 
            DELTA_CLOUD=2.0E+00/(1.0E+00+(T_CLOUD(L, I)-R_CLOUD(L, I))             RAD_ALL.12107 
     &         *(1.0E+00-TOL_CLOUD))-1.0E+00                                       RAD_ALL.12108 
!                                                                                  RAD_ALL.12109 
            D_SIGMA=SIGMA_FREE(L, I)-SIGMA_CLOUD                                   RAD_ALL.12110 
            D_DELTA=DELTA_FREE(L, I)-DELTA_CLOUD                                   RAD_ALL.12111 
!                                                                                  RAD_ALL.12112 
!           PERTURB AWAY FROM ILL-CONDITIONING:                                    RAD_ALL.12113 
            PERTURBATION=TOL_CLOUD*SIGN(TOL_CLOUD, D_SIGMA)                        RAD_ALL.12114 
     &         /(D_SIGMA+SIGN(TOL_CLOUD, D_SIGMA))                                 RAD_ALL.12115 
            SIGMA_CLOUD=SIGMA_CLOUD-PERTURBATION                                   RAD_ALL.12116 
            D_SIGMA=D_SIGMA+PERTURBATION                                           RAD_ALL.12117 
            PERTURBATION=TOL_CLOUD*SIGN(TOL_CLOUD, D_DELTA)                        RAD_ALL.12118 
     &         /(D_DELTA+SIGN(TOL_CLOUD, D_DELTA))                                 RAD_ALL.12119 
            DELTA_CLOUD=DELTA_CLOUD-PERTURBATION                                   RAD_ALL.12120 
            D_DELTA=D_DELTA+PERTURBATION                                           RAD_ALL.12121 
                                                                                   RAD_ALL.12122 
            SIGMA_MEAN=0.5E+00*(SIGMA_FREE(L, I)+SIGMA_CLOUD)                      RAD_ALL.12123 
            DELTA_MEAN=0.5E+00*(DELTA_FREE(L, I)+DELTA_CLOUD)                      RAD_ALL.12124 
            ZETA_TOP_CLOUD=0.5E+00*SIGMA_CLOUD*(S_UP_CLOUD(L, I)                   RAD_ALL.12125 
     &         +S_DOWN_CLOUD(L, I))-0.5E+00*DELTA_CLOUD                            RAD_ALL.12126 
     &         *(S_DOWN_CLOUD(L, I)-S_UP_CLOUD(L, I))+S_UP_CLOUD(L, I)             RAD_ALL.12127 
            ZETA_BASE_CLOUD=0.5E+00*SIGMA_CLOUD*(S_UP_CLOUD(L, I)                  RAD_ALL.12128 
     &         +S_DOWN_CLOUD(L, I))+0.5E+00*DELTA_CLOUD                            RAD_ALL.12129 
     &         *(S_DOWN_CLOUD(L, I)-S_UP_CLOUD(L, I))+S_DOWN_CLOUD(L, I)           RAD_ALL.12130 
!                                                                                  RAD_ALL.12131 
            SIGMA_H=(Q_M(L, I)+ZETA_TOP_CLOUD+Q_P(L, I)                            RAD_ALL.12132 
     &         +ZETA_BASE_CLOUD)/D_SIGMA                                           RAD_ALL.12133 
            DELTA_K=(Q_P(L, I)+ZETA_BASE_CLOUD-Q_M(L, I)                           RAD_ALL.12134 
     &         -ZETA_TOP_CLOUD)/D_DELTA                                            RAD_ALL.12135 
            U_PP(L, I)=Q_P(L, I)-ZETA_BASE_CLOUD                                   RAD_ALL.12136 
     &         +((1.0E+00-DELTA_MEAN)*DELTA_K                                      RAD_ALL.12137 
     &         +(1.0E+00-SIGMA_MEAN)*SIGMA_H)                                      RAD_ALL.12138 
            U_PM(L, I)=Q_P(L, I)-ZETA_BASE_CLOUD                                   RAD_ALL.12139 
     &         -((1.0E+00+DELTA_MEAN)*DELTA_K                                      RAD_ALL.12140 
     &         +(1.0E+00+SIGMA_MEAN)*SIGMA_H)                                      RAD_ALL.12141 
            U_MP(L, I)=Q_M(L, I)-ZETA_TOP_CLOUD                                    RAD_ALL.12142 
     &         +((1.0E+00+DELTA_MEAN)*DELTA_K                                      RAD_ALL.12143 
     &         -(1.0E+00+SIGMA_MEAN)*SIGMA_H)                                      RAD_ALL.12144 
            U_MM(L, I)=Q_M(L, I)-ZETA_TOP_CLOUD                                    RAD_ALL.12145 
     &         -((1.0E+00-DELTA_MEAN)*DELTA_K                                      RAD_ALL.12146 
     &         -(1.0E+00-SIGMA_MEAN)*SIGMA_H)                                      RAD_ALL.12147 
!                                                                                  RAD_ALL.12148 
            P_0_P(L, I)=SIGMA_FREE(L, I)*(SIGMA_CLOUD-1.0E+00)/D_SIGMA             RAD_ALL.12149 
     &         +DELTA_CLOUD*(DELTA_FREE(L, I)-1.0E+00)/D_DELTA                     RAD_ALL.12150 
            P_0_M(L, I)=-SIGMA_FREE(L, I)*(SIGMA_CLOUD+1.0E+00)/D_SIGMA            RAD_ALL.12151 
     &         -DELTA_CLOUD*(DELTA_FREE(L, I)+1.0E+00)/D_DELTA                     RAD_ALL.12152 
            P_1_P(L, I)=SIGMA_CLOUD*(1.0E+00-SIGMA_FREE(L, I))/D_SIGMA             RAD_ALL.12153 
     &         -DELTA_CLOUD*(1.0E+00-DELTA_FREE(L, I))/D_DELTA                     RAD_ALL.12154 
            P_1_M(L, I)=SIGMA_CLOUD*(SIGMA_FREE(L, I)+1.0E+00)/D_SIGMA             RAD_ALL.12155 
     &         -DELTA_CLOUD*(DELTA_FREE(L, I)+1.0E+00)/D_DELTA                     RAD_ALL.12156 
            Q_0_P(L, I)=(SIGMA_FREE(L, I)-1.0E+00)/D_SIGMA                         RAD_ALL.12157 
     &         +(DELTA_CLOUD-1.0E+00)/D_DELTA                                      RAD_ALL.12158 
            Q_0_M(L, I)=-(SIGMA_FREE(L, I)+1.0E+00)/D_SIGMA                        RAD_ALL.12159 
     &         -(DELTA_CLOUD+1.0E+00)/D_DELTA                                      RAD_ALL.12160 
            Q_1_P(L, I)=(SIGMA_CLOUD-1.0E+00)/D_SIGMA                              RAD_ALL.12161 
     &         -(DELTA_CLOUD-1.0E+00)/D_DELTA                                      RAD_ALL.12162 
            Q_1_M(L, I)=-(SIGMA_CLOUD+1.0E+00)/D_SIGMA                             RAD_ALL.12163 
     &         +(DELTA_CLOUD+1.0E+00)/D_DELTA                                      RAD_ALL.12164 
!                                                                                  RAD_ALL.12165 
         ENDDO                                                                     RAD_ALL.12166 
!                                                                                  RAD_ALL.12167 
         DO LL=1, N_FREE_PROFILE(I)                                                RAD_ALL.12168 
            L=I_FREE_PROFILE(LL, I)                                                RAD_ALL.12169 
            P_0_P(L, I)=1.0E+00                                                    RAD_ALL.12170 
            P_1_P(L, I)=0.0E+00                                                    RAD_ALL.12171 
            Q_0_P(L, I)=1.0E+00                                                    RAD_ALL.12172 
            Q_1_P(L, I)=0.0E+00                                                    RAD_ALL.12173 
            U_PP(L, I)=0.0E+00                                                     RAD_ALL.12174 
            U_MM(L, I)=0.0E+00                                                     RAD_ALL.12175 
         ENDDO                                                                     RAD_ALL.12176 
!                                                                                  RAD_ALL.12177 
      ENDDO                                                                        RAD_ALL.12178 
!                                                                                  RAD_ALL.12179 
!     COMPLETE THE ASSIGNMENT OF COEFFICIENTS IN THE LAYERS ADJACENT TO            RAD_ALL.12180 
!     THE CLOUDY PART OF THE COLUMN.                                               RAD_ALL.12181 
      DO L=1, N_PROFILE                                                            RAD_ALL.12182 
         P_0_P(L, N_CLOUD_TOP-1)=1.0E+00                                           RAD_ALL.12183 
         P_1_P(L, N_CLOUD_TOP-1)=0.0E+00                                           RAD_ALL.12184 
         Q_0_P(L, N_CLOUD_TOP-1)=1.0E+00                                           RAD_ALL.12185 
         Q_1_P(L, N_CLOUD_TOP-1)=0.0E+00                                           RAD_ALL.12186 
         U_PP(L, N_CLOUD_TOP-1)=0.0E+00                                            RAD_ALL.12187 
      ENDDO                                                                        RAD_ALL.12188 
      DO L=1, N_PROFILE                                                            RAD_ALL.12189 
         P_0_P(L, N_LAYER+1)=1.0E+00                                               RAD_ALL.12190 
         P_1_P(L, N_LAYER+1)=0.0E+00                                               RAD_ALL.12191 
         Q_0_P(L, N_LAYER+1)=1.0E+00                                               RAD_ALL.12192 
         Q_1_P(L, N_LAYER+1)=0.0E+00                                               RAD_ALL.12193 
         U_MM(L, N_LAYER+1)=0.0E+00                                                RAD_ALL.12194 
      ENDDO                                                                        RAD_ALL.12195 
!                                                                                  RAD_ALL.12196 
!     FORM THE BASIC EQUATIONS IN N FOR THE TOTAL DIFFERENCE AND SUMMED            RAD_ALL.12197 
!     FLUXES. THESE ARE EQUATIONS AT BOUNDARIES.                                   RAD_ALL.12198 
!                                                                                  RAD_ALL.12199 
!     WE INITIALIZE THE RATIOS TO 0 AND ADJUST THEM                                RAD_ALL.12200 
!     WHEN THERE ARE CLOUDS.                                                       RAD_ALL.12201 
      DO I=N_CLOUD_TOP-1, N_LAYER                                                  RAD_ALL.12202 
         DO L=1, N_PROFILE                                                         RAD_ALL.12203 
            RATIO_UP(L, I)=0.0E+00                                                 RAD_ALL.12204 
            RATIO_DOWN(L, I)=0.0E+00                                               RAD_ALL.12205 
         ENDDO                                                                     RAD_ALL.12206 
      ENDDO                                                                        RAD_ALL.12207 
!                                                                                  RAD_ALL.12208 
      DO I=N_CLOUD_TOP, N_LAYER                                                    RAD_ALL.12209 
!                                                                                  RAD_ALL.12210 
         DO LL=1, N_CLOUD_PROFILE(I)                                               RAD_ALL.12211 
            L=I_CLOUD_PROFILE(LL, I)                                               RAD_ALL.12212 
!                                                                                  RAD_ALL.12213 
!           CONDITION ON UPWARD FLUXES:                                            RAD_ALL.12214 
            M_P_M1(L, I)=2.0E+00*P_1_M(L, I)                                       RAD_ALL.12215 
            M_P_0(L, I)=2.0E+00*P_0_M(L, I)-B_P(L, I)                              RAD_ALL.12216 
     &         -B_M(L, I)*P_0_P(L, I+1)                                            RAD_ALL.12217 
            M_P_P1(L, I)=-B_M(L, I)*P_1_P(L, I+1)                                  RAD_ALL.12218 
            H_P_M1(L, I)=2.0E+00*Q_1_M(L, I)                                       RAD_ALL.12219 
            H_P_0(L, I)=2.0E+00*Q_0_M(L, I)+B_P(L, I)                              RAD_ALL.12220 
     &         +B_M(L, I)*Q_0_P(L, I+1)                                            RAD_ALL.12221 
            H_P_P1(L, I)=B_M(L, I)*Q_1_P(L, I+1)                                   RAD_ALL.12222 
            W_P(L, I)=-2.0E+00*U_PM(L, I)+B_M(L, I)*U_MM(L, I+1)                   RAD_ALL.12223 
            RATIO_UP(L, I)=ABS(H_P_P1(L, I))                                       RAD_ALL.12224 
!                                                                                  RAD_ALL.12225 
         ENDDO                                                                     RAD_ALL.12226 
      ENDDO                                                                        RAD_ALL.12227 
!                                                                                  RAD_ALL.12228 
      DO I=N_CLOUD_TOP-1, N_LAYER-1                                                RAD_ALL.12229 
         DO LL=1, N_CLOUD_PROFILE(I+1)                                             RAD_ALL.12230 
            L=I_CLOUD_PROFILE(LL, I+1)                                             RAD_ALL.12231 
!                                                                                  RAD_ALL.12232 
!           CONDITION ON DOWNWARD FLUXES:                                          RAD_ALL.12233 
            M_M_M1(L, I)=G_M(L, I)*P_1_P(L, I)                                     RAD_ALL.12234 
            M_M_0(L, I)=-2.0E+00*P_0_M(L, I+1)+G_P(L, I)                           RAD_ALL.12235 
     &         +G_M(L, I)*P_0_P(L, I)                                              RAD_ALL.12236 
            M_M_P1(L, I)=-2.0E+00*P_1_M(L, I+1)                                    RAD_ALL.12237 
            H_M_M1(L, I)=G_M(L, I)*Q_1_P(L, I)                                     RAD_ALL.12238 
            H_M_0(L, I)=2.0E+00*Q_0_M(L, I+1)+G_P(L, I)                            RAD_ALL.12239 
     &         +G_M(L, I)*Q_0_P(L, I)                                              RAD_ALL.12240 
            H_M_P1(L, I)=2.0E+00*Q_1_M(L, I+1)                                     RAD_ALL.12241 
            W_M(L, I)=-2.0E+00*U_MP(L, I+1)+G_M(L, I)*U_PP(L, I)                   RAD_ALL.12242 
            RATIO_DOWN(L, I)=ABS(H_M_M1(L, I))                                     RAD_ALL.12243 
!                                                                                  RAD_ALL.12244 
         ENDDO                                                                     RAD_ALL.12245 
      ENDDO                                                                        RAD_ALL.12246 
!                                                                                  RAD_ALL.12247 
!     ELIMINATE THE VALUES OF J AT OTHER LAYERS:                                   RAD_ALL.12248 
!     THESE OPERATIONS ARE NEEDED ONLY WHEN THERE IS CLOUD BOTH ABOVE              RAD_ALL.12249 
!     AND BELOW THE LEVEL. THE ARRAYS FOR TESTING SHOULD BE O(1), SO               RAD_ALL.12250 
!     WE DO NOT NEED TO SCALE THEIR ENTRIES.                                       RAD_ALL.12251 
      DO I=N_CLOUD_TOP, N_LAYER-1                                                  RAD_ALL.12252 
!                                                                                  RAD_ALL.12253 
!        DOWNWARD FLUXES:                                                          RAD_ALL.12254 
         N_INDEX=0                                                                 RAD_ALL.12255 
         DO LL  =1,N_PROFILE                                                       RAD_ALL.12256 
           IF (RATIO_DOWN(LL,I).GT.TOL_DIV) THEN                                   RAD_ALL.12257 
             N_INDEX       =N_INDEX+1                                              RAD_ALL.12258 
             INDEX(N_INDEX)=LL                                                     RAD_ALL.12259 
           END IF                                                                  RAD_ALL.12260 
         END DO                                                                    RAD_ALL.12261 
!                                                                                  RAD_ALL.12262 
!        INDIRECT ADDRESSING CREATES A POTENTIAL DATA DEPENDENCY                   RAD_ALL.12263 
!        SINCE THE COMPILER CANNOT KNOW THAT NO ELEMENT IS REPEATED                RAD_ALL.12264 
!        IN INDEX: WE THEREFORE NEED A DIRECTIVE TO FORCE VECTORIZATION.           RAD_ALL.12265 
CDIR$ IVDEP                                                                        RAD_ALL.12266 
         DO LL=1, N_INDEX                                                          RAD_ALL.12267 
            L=INDEX(LL)                                                            RAD_ALL.12268 
            RATIO_DOWN(L, I)=H_M_M1(L, I)/H_P_M1(L, I)                             RAD_ALL.12269 
!           THIS ASSIGNMENT IS NEEDED LATER.                                       RAD_ALL.12270 
            H_M_M1(L, I)=0.0E+00                                                   RAD_ALL.12271 
            H_M_0(L, I)=H_M_0(L, I)-RATIO_DOWN(L, I)*H_P_0(L, I)                   RAD_ALL.12272 
            H_M_P1(L, I)=H_M_P1(L, I)-RATIO_DOWN(L, I)*H_P_P1(L, I)                RAD_ALL.12273 
            M_M_M1(L, I)=M_M_M1(L, I)-RATIO_DOWN(L, I)*M_P_M1(L, I)                RAD_ALL.12274 
            M_M_0(L, I)=M_M_0(L, I)-RATIO_DOWN(L, I)*M_P_0(L, I)                   RAD_ALL.12275 
            M_M_P1(L, I)=M_M_P1(L, I)-RATIO_DOWN(L, I)*M_P_P1(L, I)                RAD_ALL.12276 
            W_M(L, I)=W_M(L, I)-RATIO_DOWN(L, I)*W_P(L, I)                         RAD_ALL.12277 
         ENDDO                                                                     RAD_ALL.12278 
!                                                                                  RAD_ALL.12279 
!        UPWARD FLUXES:                                                            RAD_ALL.12280 
         N_INDEX=0                                                                 RAD_ALL.12281 
         DO LL  =1,N_PROFILE                                                       RAD_ALL.12282 
           IF (RATIO_UP(LL,I).GT.TOL_DIV) THEN                                     RAD_ALL.12283 
             N_INDEX       =N_INDEX+1                                              RAD_ALL.12284 
             INDEX(N_INDEX)=LL                                                     RAD_ALL.12285 
           END IF                                                                  RAD_ALL.12286 
         END DO                                                                    RAD_ALL.12287 
!                                                                                  RAD_ALL.12288 
!        INDIRECT ADDRESSING CREATES A POTENTIAL DATA DEPENDENCY                   RAD_ALL.12289 
!        SINCE THE COMPILER CANNOT KNOW THAT NO ELEMENT IS REPEATED                RAD_ALL.12290 
!        IN INDEX: WE THEREFORE NEED A DIRECTIVE TO FORCE VECTORIZATION.           RAD_ALL.12291 
CDIR$ IVDEP                                                                        RAD_ALL.12292 
         DO LL=1, N_INDEX                                                          RAD_ALL.12293 
            L=INDEX(LL)                                                            RAD_ALL.12294 
            RATIO_UP(L, I)=H_P_P1(L, I)/H_M_P1(L, I)                               RAD_ALL.12295 
            H_P_M1(L, I)=H_P_M1(L, I)-RATIO_UP(L, I)*H_M_M1(L, I)                  RAD_ALL.12296 
            H_P_0(L, I)=H_P_0(L, I)-RATIO_UP(L, I)*H_M_0(L, I)                     RAD_ALL.12297 
            M_P_M1(L, I)=M_P_M1(L, I)-RATIO_UP(L, I)*M_M_M1(L, I)                  RAD_ALL.12298 
            M_P_0(L, I)=M_P_0(L, I)-RATIO_UP(L, I)*M_M_0(L, I)                     RAD_ALL.12299 
            M_P_P1(L, I)=M_P_P1(L, I)-RATIO_UP(L, I)*M_M_P1(L, I)                  RAD_ALL.12300 
            W_P(L, I)=W_P(L, I)-RATIO_UP(L, I)*W_M(L, I)                           RAD_ALL.12301 
         ENDDO                                                                     RAD_ALL.12302 
      ENDDO                                                                        RAD_ALL.12303 
!                                                                                  RAD_ALL.12304 
!     SOLVE THESE PAIRS OF EQUATIONS TO FIND EXPRESSIONS FOR J AT                  RAD_ALL.12305 
!     THE BOUNDARIES OF THE LAYERS: THESE EXPRESSIONS ARE REQUIRED ONLY            RAD_ALL.12306 
!     WHEN THE LAYER CONTAINS CLOUD.                                               RAD_ALL.12307 
      DO I=N_CLOUD_TOP, N_LAYER                                                    RAD_ALL.12308 
         DO LL=1, N_CLOUD_PROFILE(I)                                               RAD_ALL.12309 
            L=I_CLOUD_PROFILE(LL, I)                                               RAD_ALL.12310 
            DET=H_P_M1(L, I)*H_M_P1(L, I-1)-H_P_0(L, I)*H_M_0(L, I-1)              RAD_ALL.12311 
            F_P_M2(L, I)=-H_P_M1(L, I)*M_M_M1(L, I-1)/DET                          RAD_ALL.12312 
            F_P_M1(L, I)=(H_M_0(L, I-1)*M_P_M1(L, I)                               RAD_ALL.12313 
     &         -H_P_M1(L, I)*M_M_0(L, I-1))/DET                                    RAD_ALL.12314 
            F_P_0(L, I)=(H_M_0(L, I-1)*M_P_0(L, I)                                 RAD_ALL.12315 
     &         -H_P_M1(L, I)*M_M_P1(L, I-1))/DET                                   RAD_ALL.12316 
            F_P_P1(L, I)=H_M_0(L, I-1)*M_P_P1(L, I)/DET                            RAD_ALL.12317 
            Q_P(L, I)=(H_M_0(L, I-1)*W_P(L, I)                                     RAD_ALL.12318 
     &         -H_P_M1(L, I)*W_M(L, I-1))/DET                                      RAD_ALL.12319 
            F_M_M2(L, I)=H_P_0(L, I)*M_M_M1(L, I-1)/DET                            RAD_ALL.12320 
            F_M_M1(L, I)=(H_P_0(L, I)*M_M_0(L, I-1)                                RAD_ALL.12321 
     &         -H_M_P1(L, I-1)*M_P_M1(L, I))/DET                                   RAD_ALL.12322 
            F_M_0(L, I)=(H_P_0(L, I)*M_M_P1(L, I-1)                                RAD_ALL.12323 
     &         -H_M_P1(L, I-1)*M_P_0(L, I))/DET                                    RAD_ALL.12324 
            F_M_P1(L, I)=-H_M_P1(L, I-1)*M_P_P1(L, I)/DET                          RAD_ALL.12325 
            Q_M(L, I)=(H_P_0(L, I)*W_M(L, I-1)                                     RAD_ALL.12326 
     &         -H_M_P1(L, I-1)*W_P(L, I))/DET                                      RAD_ALL.12327 
         ENDDO                                                                     RAD_ALL.12328 
      ENDDO                                                                        RAD_ALL.12329 
!                                                                                  RAD_ALL.12330 
!                                                                                  RAD_ALL.12331 
!     SET THE BOUNDARY CONDITIONS:                                                 RAD_ALL.12332 
      DO L=1, N_PROFILE                                                            RAD_ALL.12333 
         F_P_M2(L, 0)=0.0E+00                                                      RAD_ALL.12334 
         F_P_M1(L, 0)=0.0E+00                                                      RAD_ALL.12335 
         F_P_0(L, 0)=-1.0E+00                                                      RAD_ALL.12336 
         F_P_P1(L, 0)=0.0E+00                                                      RAD_ALL.12337 
         Q_P(L, 0)=2.0*FLUX_INC_DOWN(L)                                            RAD_ALL.12338 
         F_M_M2(L, N_LAYER+1)=0.0E+00                                              RAD_ALL.12339 
         F_M_M1(L, N_LAYER+1)=(1.0E+00+ALBEDO_SURFACE_DIFF(L))                     RAD_ALL.12340 
     &      /(1.0E+00-ALBEDO_SURFACE_DIFF(L))                                      RAD_ALL.12341 
         F_M_0(L, N_LAYER+1)=0.0E+00                                               RAD_ALL.12342 
         F_M_P1(L, N_LAYER+1)=0.0E+00                                              RAD_ALL.12343 
         Q_M(L, N_LAYER+1)=2.0E+00*(SOURCE_GROUND(L)                               RAD_ALL.12344 
     &      +(ALBEDO_SURFACE_DIR(L)-ALBEDO_SURFACE_DIFF(L))                        RAD_ALL.12345 
     &      *FLUX_DIRECT_GROUND(L))                                                RAD_ALL.12346 
     &      /(1.0E+00-ALBEDO_SURFACE_DIFF(L))                                      RAD_ALL.12347 
      ENDDO                                                                        RAD_ALL.12348 
!                                                                                  RAD_ALL.12349 
!     FORMULATE THE FINAL SET OF EQUATIONS AT THE BOUNDARIES                       RAD_ALL.12350 
!     OF THE LAYERS.                                                               RAD_ALL.12351 
      DO I=0, N_LAYER                                                              RAD_ALL.12352 
         DO L=1, N_PROFILE                                                         RAD_ALL.12353 
            P(L, 5, I+1)=F_P_M2(L, I)                                              RAD_ALL.12354 
            P(L, 4, I+1)=F_P_M1(L, I)-F_M_M2(L, I+1)                               RAD_ALL.12355 
            P(L, 3, I+1)=F_P_0(L, I)-F_M_M1(L, I+1)                                RAD_ALL.12356 
            P(L, 2, I+1)=F_P_P1(L, I)-F_M_0(L, I+1)                                RAD_ALL.12357 
            P(L, 1, I+1)=-F_M_P1(L, I+1)                                           RAD_ALL.12358 
            V(L, I+1)=Q_M(L, I+1)-Q_P(L, I)                                        RAD_ALL.12359 
         ENDDO                                                                     RAD_ALL.12360 
      ENDDO                                                                        RAD_ALL.12361 
!                                                                                  RAD_ALL.12362 
!                                                                                  RAD_ALL.12363 
!                                                                                  RAD_ALL.12364 
      RETURN                                                                       RAD_ALL.12365 
      END 
