C *****************************COPYRIGHT******************************             RAD_ALL.12931 
C (c) CROWN COPYRIGHT 1996, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.12932 
C                                                                                  RAD_ALL.12933 
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.12934 
C restrictions as set forth in the contract.                                       RAD_ALL.12935 
C                                                                                  RAD_ALL.12936 
C                Meteorological Office                                             RAD_ALL.12937 
C                London Road                                                       RAD_ALL.12938 
C                BRACKNELL                                                         RAD_ALL.12939 
C                Berkshire UK                                                      RAD_ALL.12940 
C                RG12 2SZ                                                          RAD_ALL.12941 
C                                                                                  RAD_ALL.12942 
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.12943 
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.12944 
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.12945 
C Modelling at the above address.                                                  RAD_ALL.12946 
C ******************************COPYRIGHT******************************            RAD_ALL.12947 
C                                                                                  RAD_ALL.12948 
!+ Subroutine to find energy transfer coefficients for triple overlap.             RAD_ALL.12949 
!                                                                                  RAD_ALL.12950 
! Method:                                                                          RAD_ALL.12951 
!       Energy transfer coefficients for upward and downward radiation             RAD_ALL.12952 
!       at the edges of the layers are calculated assuming maximal                 RAD_ALL.12953 
!       overlap of regions of the same nature and random overlap of                RAD_ALL.12954 
!       regions of a different nature.                                             RAD_ALL.12955 
!                                                                                  RAD_ALL.12956 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.12957 
!                                                                                  RAD_ALL.12958 
! History:                                                                         RAD_ALL.12959 
!       Version         Date                    Comment                            RAD_ALL.12960 
!       4.2             24-05-96                Original Code                      RAD_ALL.12961 
!	4.3		20-02-97		Vector searching                                                  RAD_ALL.12962 
!                                               routine WHENFGT                    RAD_ALL.12963 
!                                               replaced by IF-tests.              RAD_ALL.12964 
!						(J. M. Edwards)                                                             RAD_ALL.12965 
!                                                                                  RAD_ALL.12966 
! Description of Code:                                                             RAD_ALL.12967 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.12968 
!                                                                                  RAD_ALL.12969 
!- ---------------------------------------------------------------------           RAD_ALL.12970 
      SUBROUTINE OVERLAP_TRIPLE(N_PROFILE, N_LAYER, N_CLOUD_TOP                    RAD_ALL.12971 
     &   , W_CLOUD, W_FREE, FRAC_REGION                                            RAD_ALL.12972 
     &   , CLOUD_OVERLAP                                                           RAD_ALL.12973 
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.12974 
     &   )                                                                         RAD_ALL.12975 
!                                                                                  RAD_ALL.12976 
!                                                                                  RAD_ALL.12977 
!                                                                                  RAD_ALL.12978 
      IMPLICIT NONE                                                                RAD_ALL.12979 
!                                                                                  RAD_ALL.12980 
!                                                                                  RAD_ALL.12981 
!     SIZES OF DUMMY ARRAYS.                                                       RAD_ALL.12982 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.12983 
     &     NPD_PROFILE                                                             RAD_ALL.12984 
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.12985 
     &   , NPD_LAYER                                                               RAD_ALL.12986 
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.12987 
!                                                                                  RAD_ALL.12988 
!     INCLUDE COMDECKS.                                                            RAD_ALL.12989 
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           CLDTYP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLDTYP3A.3     
!                                                                                  CLDTYP3A.4     
!     MODULE TO SET TYPES OF CLOUDS.                                               CLDTYP3A.5     
!                                                                                  CLDTYP3A.6     
      INTEGER                                                                      CLDTYP3A.7     
     &     IP_CLOUD_TYPE_HOMOGEN                                                   CLDTYP3A.8     
!             CLOUD COMPOSED OF MIXED WATER AND ICE                                CLDTYP3A.9     
     &   , IP_CLOUD_TYPE_WATER                                                     CLDTYP3A.10    
!             CLOUD COMPOSED ONLY OF WATER                                         CLDTYP3A.11    
     &   , IP_CLOUD_TYPE_ICE                                                       CLDTYP3A.12    
!             CLOUD COMPOSED ONLY OF ICE                                           CLDTYP3A.13    
     &   , IP_CLOUD_TYPE_STRAT                                                     CLDTYP3A.14    
!             MIXED-PHASE STRATIFORM CLOUD                                         CLDTYP3A.15    
     &   , IP_CLOUD_TYPE_CONV                                                      CLDTYP3A.16    
!             MIXED-PHASE CONVECTIVE CLOUD                                         CLDTYP3A.17    
     &   , IP_CLOUD_TYPE_SW                                                        CLDTYP3A.18    
!             STRATIFORM WATER CLOUD                                               CLDTYP3A.19    
     &   , IP_CLOUD_TYPE_SI                                                        CLDTYP3A.20    
!             STRATIFORM ICE CLOUD                                                 CLDTYP3A.21    
     &   , IP_CLOUD_TYPE_CW                                                        CLDTYP3A.22    
!             CONVECTIVE WATER CLOUD                                               CLDTYP3A.23    
     &   , IP_CLOUD_TYPE_CI                                                        CLDTYP3A.24    
!             CONVECTIVE ICE CLOUD                                                 CLDTYP3A.25    
!                                                                                  CLDTYP3A.26    
      PARAMETER(                                                                   CLDTYP3A.27    
     &     IP_CLOUD_TYPE_HOMOGEN=1                                                 CLDTYP3A.28    
     &   , IP_CLOUD_TYPE_WATER=1                                                   CLDTYP3A.29    
     &   , IP_CLOUD_TYPE_ICE=2                                                     CLDTYP3A.30    
     &   , IP_CLOUD_TYPE_STRAT=1                                                   CLDTYP3A.31    
     &   , IP_CLOUD_TYPE_CONV=2                                                    CLDTYP3A.32    
     &   , IP_CLOUD_TYPE_SW=1                                                      CLDTYP3A.33    
     &   , IP_CLOUD_TYPE_SI=2                                                      CLDTYP3A.34    
     &   , IP_CLOUD_TYPE_CW=3                                                      CLDTYP3A.35    
     &   , IP_CLOUD_TYPE_CI=4                                                      CLDTYP3A.36    
     &   )                                                                         CLDTYP3A.37    
!                                                                                  CLDTYP3A.38    
!     ------------------------------------------------------------------           CLDTYP3A.39    
!     ------------------------------------------------------------------           CLCFPT3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLCFPT3A.3     
!                                                                                  CLCFPT3A.4     
!     MODULE TO SET POINTERS IN CLOUD_OVERLAP.                                     CLCFPT3A.5     
!                                                                                  CLCFPT3A.6     
!     NOTE THAT SEVERAL POINTERS ARE IDENTICAL SINCE ONLY CERTAIN                  CLCFPT3A.7     
!     GROUPS OF COEFFICIENTS ARE RELEVANT TO A PARTICULAR SCHEME.                  CLCFPT3A.8     
!                                                                                  CLCFPT3A.9     
      INTEGER                                                                      CLCFPT3A.10    
     &     IP_CLOVLP_GFF                                                           CLCFPT3A.11    
!             POINTER TO GAMMA-FREE-FREE                                           CLCFPT3A.12    
     &   , IP_CLOVLP_GFC                                                           CLCFPT3A.13    
!             POINTER TO GAMMA-FREE-CLOUD                                          CLCFPT3A.14    
     &   , IP_CLOVLP_GCF                                                           CLCFPT3A.15    
!             POINTER TO GAMMA-CLOUD-FREE                                          CLCFPT3A.16    
     &   , IP_CLOVLP_GCC                                                           CLCFPT3A.17    
!             POINTER TO GAMMA-CLOUD-CLOUD                                         CLCFPT3A.18    
     &   , IP_CLOVLP_BFF                                                           CLCFPT3A.19    
!             POINTER TO BETA-FREE-FREE                                            CLCFPT3A.20    
     &   , IP_CLOVLP_BFC                                                           CLCFPT3A.21    
!             POINTER TO BETA-FREE-CLOUD                                           CLCFPT3A.22    
     &   , IP_CLOVLP_BCF                                                           CLCFPT3A.23    
!             POINTER TO BETA-CLOUD-FREE                                           CLCFPT3A.24    
     &   , IP_CLOVLP_BCC                                                           CLCFPT3A.25    
!             POINTER TO BETA-CLOUD-CLOUD                                          CLCFPT3A.26    
     &   , IP_CLOVLP_GFM                                                           CLCFPT3A.27    
!             POINTER TO GAMMA_F-                                                  CLCFPT3A.28    
     &   , IP_CLOVLP_GFP                                                           CLCFPT3A.29    
!             POINTER TO GAMMA_F+                                                  CLCFPT3A.30    
     &   , IP_CLOVLP_BFM                                                           CLCFPT3A.31    
!             POINTER TO BETA_F-                                                   CLCFPT3A.32    
     &   , IP_CLOVLP_BFP                                                           CLCFPT3A.33    
!             POINTER TO BETA_F+                                                   CLCFPT3A.34    
     &   , IP_CLOVLP_GM                                                            CLCFPT3A.35    
!             POINTER TO GAMMA_-                                                   CLCFPT3A.36    
     &   , IP_CLOVLP_GP                                                            CLCFPT3A.37    
!             POINTER TO GAMMA_+                                                   CLCFPT3A.38    
     &   , IP_CLOVLP_BM                                                            CLCFPT3A.39    
!             POINTER TO BETA_-                                                    CLCFPT3A.40    
     &   , IP_CLOVLP_BP                                                            CLCFPT3A.41    
!             POINTER TO BETA_+                                                    CLCFPT3A.42    
!                                                                                  CLCFPT3A.43    
!     POINTERS FOR TRIPLE OVERLAPS:                                                CLCFPT3A.44    
      INTEGER                                                                      CLCFPT3A.45    
     &     IP_CLOVLP_V11                                                           CLCFPT3A.46    
     &   , IP_CLOVLP_V12                                                           CLCFPT3A.47    
     &   , IP_CLOVLP_V13                                                           CLCFPT3A.48    
     &   , IP_CLOVLP_V21                                                           CLCFPT3A.49    
     &   , IP_CLOVLP_V22                                                           CLCFPT3A.50    
     &   , IP_CLOVLP_V23                                                           CLCFPT3A.51    
     &   , IP_CLOVLP_V31                                                           CLCFPT3A.52    
     &   , IP_CLOVLP_V32                                                           CLCFPT3A.53    
     &   , IP_CLOVLP_V33                                                           CLCFPT3A.54    
     &   , IP_CLOVLP_U11                                                           CLCFPT3A.55    
     &   , IP_CLOVLP_U12                                                           CLCFPT3A.56    
     &   , IP_CLOVLP_U13                                                           CLCFPT3A.57    
     &   , IP_CLOVLP_U21                                                           CLCFPT3A.58    
     &   , IP_CLOVLP_U22                                                           CLCFPT3A.59    
     &   , IP_CLOVLP_U23                                                           CLCFPT3A.60    
     &   , IP_CLOVLP_U31                                                           CLCFPT3A.61    
     &   , IP_CLOVLP_U32                                                           CLCFPT3A.62    
     &   , IP_CLOVLP_U33                                                           CLCFPT3A.63    
!                                                                                  CLCFPT3A.64    
      PARAMETER(                                                                   CLCFPT3A.65    
     &     IP_CLOVLP_GFF=1                                                         CLCFPT3A.66    
     &   , IP_CLOVLP_GFC=2                                                         CLCFPT3A.67    
     &   , IP_CLOVLP_GCF=3                                                         CLCFPT3A.68    
     &   , IP_CLOVLP_GCC=4                                                         CLCFPT3A.69    
     &   , IP_CLOVLP_BFF=5                                                         CLCFPT3A.70    
     &   , IP_CLOVLP_BFC=6                                                         CLCFPT3A.71    
     &   , IP_CLOVLP_BCF=7                                                         CLCFPT3A.72    
     &   , IP_CLOVLP_BCC=8                                                         CLCFPT3A.73    
     &   , IP_CLOVLP_GFM=5                                                         CLCFPT3A.74    
     &   , IP_CLOVLP_GFP=6                                                         CLCFPT3A.75    
     &   , IP_CLOVLP_BFM=7                                                         CLCFPT3A.76    
     &   , IP_CLOVLP_BFP=8                                                         CLCFPT3A.77    
     &   , IP_CLOVLP_GM=5                                                          CLCFPT3A.78    
     &   , IP_CLOVLP_GP=6                                                          CLCFPT3A.79    
     &   , IP_CLOVLP_BM=7                                                          CLCFPT3A.80    
     &   , IP_CLOVLP_BP=8                                                          CLCFPT3A.81    
     &   )                                                                         CLCFPT3A.82    
!                                                                                  CLCFPT3A.83    
      PARAMETER(                                                                   CLCFPT3A.84    
     &     IP_CLOVLP_V11=1                                                         CLCFPT3A.85    
     &   , IP_CLOVLP_V12=2                                                         CLCFPT3A.86    
     &   , IP_CLOVLP_V13=3                                                         CLCFPT3A.87    
     &   , IP_CLOVLP_V21=4                                                         CLCFPT3A.88    
     &   , IP_CLOVLP_V22=5                                                         CLCFPT3A.89    
     &   , IP_CLOVLP_V23=6                                                         CLCFPT3A.90    
     &   , IP_CLOVLP_V31=7                                                         CLCFPT3A.91    
     &   , IP_CLOVLP_V32=8                                                         CLCFPT3A.92    
     &   , IP_CLOVLP_V33=9                                                         CLCFPT3A.93    
     &   , IP_CLOVLP_U11=10                                                        CLCFPT3A.94    
     &   , IP_CLOVLP_U12=11                                                        CLCFPT3A.95    
     &   , IP_CLOVLP_U13=12                                                        CLCFPT3A.96    
     &   , IP_CLOVLP_U21=13                                                        CLCFPT3A.97    
     &   , IP_CLOVLP_U22=14                                                        CLCFPT3A.98    
     &   , IP_CLOVLP_U23=15                                                        CLCFPT3A.99    
     &   , IP_CLOVLP_U31=16                                                        CLCFPT3A.100   
     &   , IP_CLOVLP_U32=17                                                        CLCFPT3A.101   
     &   , IP_CLOVLP_U33=18                                                        CLCFPT3A.102   
     &   )                                                                         CLCFPT3A.103   
!                                                                                  CLCFPT3A.104   
!     ------------------------------------------------------------------           CLCFPT3A.105   
!     ------------------------------------------------------------------           CLREPP3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLREPP3A.3     
!                                                                                  CLREPP3A.4     
!     MODULE TO SET REPRESENTATIONS OF CLOUDS.                                     CLREPP3A.5     
!                                                                                  CLREPP3A.6     
!     REPRESENTATIONS                                                              CLREPP3A.7     
      INTEGER                                                                      CLREPP3A.8     
     &     IP_CLOUD_HOMOGEN                                                        CLREPP3A.9     
!             ALL COMPONENTS ARE MIXED HOMOGENEOUSLY                               CLREPP3A.10    
     &   , IP_CLOUD_ICE_WATER                                                      CLREPP3A.11    
!             ICE AND WATER CLOUDS ARE TREATED SEPARATELY                          CLREPP3A.12    
     &   , IP_CLOUD_CONV_STRAT                                                     CLREPP3A.13    
!             CLOUDS ARE DIVIDED INTO HOMOGENEOUSLY MIXED                          CLREPP3A.14    
!             STRATIFORM AND CONVECTIVE PARTS                                      CLREPP3A.15    
     &   , IP_CLOUD_CSIW                                                           CLREPP3A.16    
!             CLOUDS DIVIDED INTO ICE AND WATER PHASES AND                         CLREPP3A.17    
!             INTO STRATIFORM AND CONVECTIVE COMPONENTS.                           CLREPP3A.18    
!                                                                                  CLREPP3A.19    
      PARAMETER(                                                                   CLREPP3A.20    
     &     IP_CLOUD_HOMOGEN=1                                                      CLREPP3A.21    
     &   , IP_CLOUD_ICE_WATER=2                                                    CLREPP3A.22    
     &   , IP_CLOUD_CONV_STRAT=3                                                   CLREPP3A.23    
     &   , IP_CLOUD_CSIW=4                                                         CLREPP3A.24    
     &   )                                                                         CLREPP3A.25    
!                                                                                  CLREPP3A.26    
!     TYPES OF CLOUDS:                                                             CLREPP3A.27    
      INTEGER                                                                      CLREPP3A.28    
     &     NP_CLOUD_TYPE(NPD_CLOUD_REPRESENTATION)                                 CLREPP3A.29    
!             NUMBER OF TYPE OF CLOUDS IN REPRESENTATION                           CLREPP3A.30    
!                                                                                  CLREPP3A.31    
      INTEGER                                                                      CLREPP3A.32    
     &     IP_CLOUD_TYPE_MAP(NPD_CLOUD_COMPONENT                                   CLREPP3A.33    
     &       , NPD_CLOUD_REPRESENTATION)                                           CLREPP3A.34    
!            MAP OF COMPONENTS CONTRIBUTING TO TYPES OF CLOUDS                     CLREPP3A.35    
!                                                                                  CLREPP3A.36    
!     ------------------------------------------------------------------           CLREPP3A.37    
!     ------------------------------------------------------------------           CLDREG3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       CLDREG3A.3     
!                                                                                  CLDREG3A.4     
!     MODULE TO DEFINE REFERENCE NUMBERS FOR REGIONS OF CLOUDS.                    CLDREG3A.5     
!                                                                                  CLDREG3A.6     
      INTEGER                                                                      CLDREG3A.7     
     &     IP_REGION_CLEAR                                                         CLDREG3A.8     
!             REFERENCE NUMBER FOR CLEAR-SKY REGION                                CLDREG3A.9     
     &   , IP_REGION_STRAT                                                         CLDREG3A.10    
!             REFERENCE NUMBER FOR STRATIFORM CLOUDY REGION                        CLDREG3A.11    
     &   , IP_REGION_CONV                                                          CLDREG3A.12    
!             REFERENCE NUMBER FOR CONVECTIVE CLOUDY REGION                        CLDREG3A.13    
!                                                                                  CLDREG3A.14    
      PARAMETER(                                                                   CLDREG3A.15    
     &     IP_REGION_CLEAR=1                                                       CLDREG3A.16    
     &   , IP_REGION_STRAT=2                                                       CLDREG3A.17    
     &   , IP_REGION_CONV=3                                                        CLDREG3A.18    
     &   )                                                                         CLDREG3A.19    
!                                                                                  CLDREG3A.20    
!     ------------------------------------------------------------------           CLDREG3A.21    
!                                                                                  RAD_ALL.12999 
!     DUMMY ARGUMENTS.                                                             RAD_ALL.13000 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.13001 
     &     N_PROFILE                                                               RAD_ALL.13002 
!             NUMBER OF PROFILES                                                   RAD_ALL.13003 
     &   , N_LAYER                                                                 RAD_ALL.13004 
!             NUMBER OF LAYERS                                                     RAD_ALL.13005 
     &   , N_CLOUD_TOP                                                             RAD_ALL.13006 
!             TOPMOST CLOUDY LAYER                                                 RAD_ALL.13007 
      REAL      !, INTENT(IN)                                                      RAD_ALL.13008 
     &     W_CLOUD(NPD_PROFILE, NPD_LAYER)                                         RAD_ALL.13009 
!             CLOUD AMOUNTS                                                        RAD_ALL.13010 
     &   , FRAC_REGION(NPD_PROFILE, NPD_LAYER, NPD_REGION)                         RAD_ALL.13011 
!             FRACTIONS OF TOTAL CLOUD AMOUNT OCCUPIED BY                          RAD_ALL.13012 
!             DIFFERENT REGIONS                                                    RAD_ALL.13013 
!                                                                                  RAD_ALL.13014 
      REAL      !, INTENT(OUT)                                                     RAD_ALL.13015 
     &     W_FREE(NPD_PROFILE, NPD_LAYER)                                          RAD_ALL.13016 
!             CLOUD-FREE AMOUNTS                                                   RAD_ALL.13017 
     &   , CLOUD_OVERLAP(NPD_PROFILE, 0: NPD_LAYER, NPD_OVERLAP_COEFF)             RAD_ALL.13018 
!             COEFFICIENTS FOR TRANSFER OF ENERGY AT INTERFACE                     RAD_ALL.13019 
!                                                                                  RAD_ALL.13020 
!                                                                                  RAD_ALL.13021 
!     LOCAL ARGUMENTS.                                                             RAD_ALL.13022 
      INTEGER                                                                      RAD_ALL.13023 
     &     I                                                                       RAD_ALL.13024 
!             LOOP VARIABLE                                                        RAD_ALL.13025 
     &   , J                                                                       RAD_ALL.13026 
!             LOOP VARIABLE                                                        RAD_ALL.13027 
     &   , L                                                                       RAD_ALL.13028 
!             LOOP VARIABLE                                                        RAD_ALL.13029 
     &   , K                                                                       RAD_ALL.13030 
!             LOOP VARIABLE                                                        RAD_ALL.13031 
!                                                                                  RAD_ALL.13032 
!                                                                                  RAD_ALL.13033 
!     FIXED LOCAL VALUES:                                                          RAD_ALL.13034 
      INTEGER                                                                      RAD_ALL.13035 
     &     N_REGION                                                                RAD_ALL.13036 
!             NUMBER OF REGIONS                                                    RAD_ALL.13037 
      REAL                                                                         RAD_ALL.13038 
     &     AREA_LOWER(NPD_PROFILE, NPD_REGION)                                     RAD_ALL.13039 
!             AREAS OF REGIONS IN LOWER LAYER                                      RAD_ALL.13040 
     &   , AREA_UPPER(NPD_PROFILE, NPD_REGION)                                     RAD_ALL.13041 
!             AREAS OF REGIONS IN LOWER LAYER                                      RAD_ALL.13042 
     &   , AREA_OVERLAP(NPD_PROFILE, NPD_REGION, NPD_REGION)                       RAD_ALL.13043 
!             AREAS OF REGIONS IN LOWER LAYER                                      RAD_ALL.13044 
     &   , AREA_RANDOM(NPD_PROFILE)                                                RAD_ALL.13045 
!             AREAS OF RANDOM OVERLAP                                              RAD_ALL.13046 
!                                                                                  RAD_ALL.13047 
!                                                                                  RAD_ALL.13048 
!                                                                                  RAD_ALL.13049 
!     SET THE FREE FRACTIONS IN EACH LAYER.                                        RAD_ALL.13050 
      DO I=1, N_CLOUD_TOP-1                                                        RAD_ALL.13051 
         DO L=1, N_PROFILE                                                         RAD_ALL.13052 
            W_FREE(L, I)=1.0E+00                                                   RAD_ALL.13053 
         ENDDO                                                                     RAD_ALL.13054 
      ENDDO                                                                        RAD_ALL.13055 
      DO I=N_CLOUD_TOP, N_LAYER                                                    RAD_ALL.13056 
         DO L=1, N_PROFILE                                                         RAD_ALL.13057 
            W_FREE(L, I)=1.0E+00-W_CLOUD(L, I)                                     RAD_ALL.13058 
         ENDDO                                                                     RAD_ALL.13059 
      ENDDO                                                                        RAD_ALL.13060 
!                                                                                  RAD_ALL.13061 
!                                                                                  RAD_ALL.13062 
!                                                                                  RAD_ALL.13063 
!     SET NUMBER OF REGIONS FOR POSSIBLE FUTURE EXTENSION.                         RAD_ALL.13064 
      N_REGION=3                                                                   RAD_ALL.13065 
!                                                                                  RAD_ALL.13066 
!     WE CONSIDER EACH BOUNDARY IN TURN, COMPARING THE FRACTIONS                   RAD_ALL.13067 
!     OF EACH REGION IN THE LAYERS ABOVE AND BELOW THE BOUNDARY.                   RAD_ALL.13068 
!                                                                                  RAD_ALL.13069 
!     INITIALIZE FOR THE LAYER ABOVE THE CLOUDS.                                   RAD_ALL.13070 
      DO L=1, N_PROFILE                                                            RAD_ALL.13071 
         AREA_UPPER(L, IP_REGION_CLEAR)=1.0E+00                                    RAD_ALL.13072 
         AREA_UPPER(L, IP_REGION_STRAT)=0.0E+00                                    RAD_ALL.13073 
         AREA_UPPER(L, IP_REGION_CONV)=0.0E+00                                     RAD_ALL.13074 
      ENDDO                                                                        RAD_ALL.13075 
                                                                                   RAD_ALL.13076 
      DO I=N_CLOUD_TOP-1, N_LAYER                                                  RAD_ALL.13077 
!                                                                                  RAD_ALL.13078 
!        SET AREAS OF THE REGIONS IN THE LOWER LAYER.                              RAD_ALL.13079 
         IF (I.LT.N_LAYER) THEN                                                    RAD_ALL.13080 
            DO L=1, N_PROFILE                                                      RAD_ALL.13081 
               AREA_LOWER(L, IP_REGION_CLEAR)=W_FREE(L, I+1)                       RAD_ALL.13082 
               AREA_LOWER(L, IP_REGION_STRAT)=W_CLOUD(L, I+1)                      RAD_ALL.13083 
     &            *FRAC_REGION(L, I+1, IP_REGION_STRAT)                            RAD_ALL.13084 
               AREA_LOWER(L, IP_REGION_CONV)=W_CLOUD(L, I+1)                       RAD_ALL.13085 
     &            *FRAC_REGION(L, I+1, IP_REGION_CONV)                             RAD_ALL.13086 
            ENDDO                                                                  RAD_ALL.13087 
         ELSE                                                                      RAD_ALL.13088 
            DO L=1, N_PROFILE                                                      RAD_ALL.13089 
               AREA_LOWER(L, IP_REGION_CLEAR)=1.0E+00                              RAD_ALL.13090 
               AREA_LOWER(L, IP_REGION_STRAT)=0.0E+00                              RAD_ALL.13091 
               AREA_LOWER(L, IP_REGION_CONV)=0.0E+00                               RAD_ALL.13092 
            ENDDO                                                                  RAD_ALL.13093 
         ENDIF                                                                     RAD_ALL.13094 
!                                                                                  RAD_ALL.13095 
!        SET THE AREAS OF OVERLAP BETWEEN LIKE REGIONS.                            RAD_ALL.13096 
         DO K=1, N_REGION                                                          RAD_ALL.13097 
            DO L=1, N_PROFILE                                                      RAD_ALL.13098 
               AREA_OVERLAP(L, K, K)=MIN(AREA_LOWER(L, K)                          RAD_ALL.13099 
     &            , AREA_UPPER(L, K))                                              RAD_ALL.13100 
            ENDDO                                                                  RAD_ALL.13101 
         ENDDO                                                                     RAD_ALL.13102 
!                                                                                  RAD_ALL.13103 
!        FIND THE AREAS OF OVERLAP BETWEEN UNLIKE REGIONS. THE OVERLAP             RAD_ALL.13104 
!        BETWEEN UNLIKE REGIONS IS ASSUMED TO BE RANDOM. THESE AREAS               RAD_ALL.13105 
!        ARE SET EQUAL TO 0 FOR THE CASE WHERE THERE IS NO SUCH AREA               RAD_ALL.13106 
!        AND ARE RESET WHEN SUCH AN AREA IS PRESENT.                               RAD_ALL.13107 
         DO K=1, N_REGION                                                          RAD_ALL.13108 
            DO J=1, K-1                                                            RAD_ALL.13109 
               DO L=1, N_PROFILE                                                   RAD_ALL.13110 
                  AREA_OVERLAP(L, K, J)=0.0E+00                                    RAD_ALL.13111 
                  AREA_OVERLAP(L, J, K)=0.0E+00                                    RAD_ALL.13112 
               ENDDO                                                               RAD_ALL.13113 
            ENDDO                                                                  RAD_ALL.13114 
         ENDDO                                                                     RAD_ALL.13115 
         DO L=1, N_PROFILE                                                         RAD_ALL.13116 
            AREA_RANDOM(L)=1.0E+00                                                 RAD_ALL.13117 
         ENDDO                                                                     RAD_ALL.13118 
         DO K=1, N_REGION                                                          RAD_ALL.13119 
            DO L=1, N_PROFILE                                                      RAD_ALL.13120 
               AREA_RANDOM(L)=AREA_RANDOM(L)-AREA_OVERLAP(L, K, K)                 RAD_ALL.13121 
            ENDDO                                                                  RAD_ALL.13122 
         ENDDO                                                                     RAD_ALL.13123 
         DO K=1, N_REGION                                                          RAD_ALL.13124 
            DO J=1, K-1                                                            RAD_ALL.13125 
               DO L=1, N_PROFILE                                                   RAD_ALL.13126 
                  IF (AREA_RANDOM(L).GT.TOL_DIV) THEN                              RAD_ALL.13127 
                     AREA_OVERLAP(L, K, J)                                         RAD_ALL.13128 
     &                  =(AREA_UPPER(L, K)-AREA_OVERLAP(L, K, K))                  RAD_ALL.13129 
     &                  *(AREA_LOWER(L, J)-AREA_OVERLAP(L, J, J))                  RAD_ALL.13130 
     &                  /AREA_RANDOM(L)                                            RAD_ALL.13131 
                     AREA_OVERLAP(L, J, K)                                         RAD_ALL.13132 
     &                  =(AREA_UPPER(L, J)-AREA_OVERLAP(L, J, J))                  RAD_ALL.13133 
     &                  *(AREA_LOWER(L, K)-AREA_OVERLAP(L, K, K))                  RAD_ALL.13134 
     &                  /AREA_RANDOM(L)                                            RAD_ALL.13135 
                  ENDIF                                                            RAD_ALL.13136 
               ENDDO                                                               RAD_ALL.13137 
            ENDDO                                                                  RAD_ALL.13138 
         ENDDO                                                                     RAD_ALL.13139 
!                                                                                  RAD_ALL.13140 
!        NOW PROCEED TO FIND THE ENERGY TRANSFER COEFFICIENTS                      RAD_ALL.13141 
!        BETWEEN THE VARIOUS REGIONS.                                              RAD_ALL.13142 
!                                                                                  RAD_ALL.13143 
!        COEFFICIENTS FOR THE DOWNWARD TRANSFER OF ENERGY:                         RAD_ALL.13144 
!                                                                                  RAD_ALL.13145 
!        TO AVOID DIVISION BY 0 WE INITIALIZE TO DEFAULT VALUES                    RAD_ALL.13146 
!        AND RESET.                                                                RAD_ALL.13147 
         DO L=1, N_PROFILE                                                         RAD_ALL.13148 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V11)=1.0E+00                             RAD_ALL.13149 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V21)=0.0E+00                             RAD_ALL.13150 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V31)=0.0E+00                             RAD_ALL.13151 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V12)=0.0E+00                             RAD_ALL.13152 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V22)=1.0E+00                             RAD_ALL.13153 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V32)=0.0E+00                             RAD_ALL.13154 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V13)=0.0E+00                             RAD_ALL.13155 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V23)=0.0E+00                             RAD_ALL.13156 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_V33)=1.0E+00                             RAD_ALL.13157 
         ENDDO                                                                     RAD_ALL.13158 
!                                                                                  RAD_ALL.13159 
!        TRANSFER FROM CLEAR-SKY REGION:                                           RAD_ALL.13160 
         DO L=1, N_PROFILE                                                         RAD_ALL.13161 
            IF (AREA_UPPER(L, IP_REGION_CLEAR).GT.TOL_DIV) THEN                    RAD_ALL.13162 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V11)                                  RAD_ALL.13163 
     &            =AREA_OVERLAP(L, IP_REGION_CLEAR, IP_REGION_CLEAR)               RAD_ALL.13164 
     &            /AREA_UPPER(L, IP_REGION_CLEAR)                                  RAD_ALL.13165 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V21)                                  RAD_ALL.13166 
     &            =AREA_OVERLAP(L, IP_REGION_CLEAR, IP_REGION_STRAT)               RAD_ALL.13167 
     &            /AREA_UPPER(L, IP_REGION_CLEAR)                                  RAD_ALL.13168 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V31)                                  RAD_ALL.13169 
     &            =AREA_OVERLAP(L, IP_REGION_CLEAR, IP_REGION_CONV)                RAD_ALL.13170 
     &            /AREA_UPPER(L, IP_REGION_CLEAR)                                  RAD_ALL.13171 
            ENDIF                                                                  RAD_ALL.13172 
         ENDDO                                                                     RAD_ALL.13173 
!                                                                                  RAD_ALL.13174 
!        TRANSFER FROM STRATIFORM REGION:                                          RAD_ALL.13175 
         DO L=1, N_PROFILE                                                         RAD_ALL.13176 
            IF (AREA_UPPER(L, IP_REGION_STRAT).GT.TOL_DIV) THEN                    RAD_ALL.13177 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V12)                                  RAD_ALL.13178 
     &            =AREA_OVERLAP(L, IP_REGION_STRAT, IP_REGION_CLEAR)               RAD_ALL.13179 
     &            /AREA_UPPER(L, IP_REGION_STRAT)                                  RAD_ALL.13180 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V22)                                  RAD_ALL.13181 
     &            =AREA_OVERLAP(L, IP_REGION_STRAT, IP_REGION_STRAT)               RAD_ALL.13182 
     &            /AREA_UPPER(L, IP_REGION_STRAT)                                  RAD_ALL.13183 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V32)                                  RAD_ALL.13184 
     &            =AREA_OVERLAP(L, IP_REGION_STRAT, IP_REGION_CONV)                RAD_ALL.13185 
     &            /AREA_UPPER(L, IP_REGION_STRAT)                                  RAD_ALL.13186 
            ENDIF                                                                  RAD_ALL.13187 
         ENDDO                                                                     RAD_ALL.13188 
!                                                                                  RAD_ALL.13189 
!        TRANSFER FROM CONVECTIVE REGION:                                          RAD_ALL.13190 
         DO L=1, N_PROFILE                                                         RAD_ALL.13191 
            IF (AREA_UPPER(L, IP_REGION_CONV).GT.TOL_DIV) THEN                     RAD_ALL.13192 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V13)                                  RAD_ALL.13193 
     &            =AREA_OVERLAP(L, IP_REGION_CONV, IP_REGION_CLEAR)                RAD_ALL.13194 
     &            /AREA_UPPER(L, IP_REGION_CONV)                                   RAD_ALL.13195 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V23)                                  RAD_ALL.13196 
     &            =AREA_OVERLAP(L, IP_REGION_CONV, IP_REGION_STRAT)                RAD_ALL.13197 
     &            /AREA_UPPER(L, IP_REGION_CONV)                                   RAD_ALL.13198 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_V33)                                  RAD_ALL.13199 
     &            =AREA_OVERLAP(L, IP_REGION_CONV, IP_REGION_CONV)                 RAD_ALL.13200 
     &            /AREA_UPPER(L, IP_REGION_CONV)                                   RAD_ALL.13201 
            ENDIF                                                                  RAD_ALL.13202 
         ENDDO                                                                     RAD_ALL.13203 
!                                                                                  RAD_ALL.13204 
!                                                                                  RAD_ALL.13205 
!        TRANSFER COEFFICIENTS FOR UPWARD FLOW OF ENERGY:                          RAD_ALL.13206 
!                                                                                  RAD_ALL.13207 
!        TO AVOID DIVISION BY 0 WE INITIALIZE TO DEFAULT VALUES                    RAD_ALL.13208 
!        AND RESET.                                                                RAD_ALL.13209 
         DO L=1, N_PROFILE                                                         RAD_ALL.13210 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U11)=1.0E+00                             RAD_ALL.13211 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U21)=0.0E+00                             RAD_ALL.13212 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U31)=0.0E+00                             RAD_ALL.13213 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U12)=0.0E+00                             RAD_ALL.13214 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U22)=1.0E+00                             RAD_ALL.13215 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U32)=0.0E+00                             RAD_ALL.13216 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U13)=0.0E+00                             RAD_ALL.13217 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U23)=0.0E+00                             RAD_ALL.13218 
            CLOUD_OVERLAP(L, I, IP_CLOVLP_U33)=1.0E+00                             RAD_ALL.13219 
         ENDDO                                                                     RAD_ALL.13220 
!                                                                                  RAD_ALL.13221 
!        TRANSFER FROM CLEAR-SKY REGION:                                           RAD_ALL.13222 
         DO L=1, N_PROFILE                                                         RAD_ALL.13223 
            IF (AREA_LOWER(L, IP_REGION_CLEAR).GT.TOL_DIV) THEN                    RAD_ALL.13224 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U11)                                  RAD_ALL.13225 
     &            =AREA_OVERLAP(L, IP_REGION_CLEAR, IP_REGION_CLEAR)               RAD_ALL.13226 
     &            /AREA_LOWER(L, IP_REGION_CLEAR)                                  RAD_ALL.13227 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U21)                                  RAD_ALL.13228 
     &            =AREA_OVERLAP(L, IP_REGION_STRAT, IP_REGION_CLEAR)               RAD_ALL.13229 
     &            /AREA_LOWER(L, IP_REGION_CLEAR)                                  RAD_ALL.13230 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U31)                                  RAD_ALL.13231 
     &            =AREA_OVERLAP(L, IP_REGION_CONV, IP_REGION_CLEAR)                RAD_ALL.13232 
     &            /AREA_LOWER(L, IP_REGION_CLEAR)                                  RAD_ALL.13233 
            ENDIF                                                                  RAD_ALL.13234 
         ENDDO                                                                     RAD_ALL.13235 
!                                                                                  RAD_ALL.13236 
!        TRANSFER FROM STRATIFORM REGION:                                          RAD_ALL.13237 
         DO L=1, N_PROFILE                                                         RAD_ALL.13238 
            IF (AREA_LOWER(L, IP_REGION_STRAT).GT.TOL_DIV) THEN                    RAD_ALL.13239 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U12)                                  RAD_ALL.13240 
     &            =AREA_OVERLAP(L, IP_REGION_CLEAR, IP_REGION_STRAT)               RAD_ALL.13241 
     &            /AREA_LOWER(L, IP_REGION_STRAT)                                  RAD_ALL.13242 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U22)                                  RAD_ALL.13243 
     &            =AREA_OVERLAP(L, IP_REGION_STRAT, IP_REGION_STRAT)               RAD_ALL.13244 
     &            /AREA_LOWER(L, IP_REGION_STRAT)                                  RAD_ALL.13245 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U32)                                  RAD_ALL.13246 
     &            =AREA_OVERLAP(L, IP_REGION_CONV, IP_REGION_STRAT)                RAD_ALL.13247 
     &            /AREA_LOWER(L, IP_REGION_STRAT)                                  RAD_ALL.13248 
            ENDIF                                                                  RAD_ALL.13249 
         ENDDO                                                                     RAD_ALL.13250 
!                                                                                  RAD_ALL.13251 
!        TRANSFER FROM CONVECTIVE REGION:                                          RAD_ALL.13252 
         DO L=1, N_PROFILE                                                         RAD_ALL.13253 
            IF (AREA_LOWER(L, IP_REGION_CONV).GT.TOL_DIV) THEN                     RAD_ALL.13254 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U13)                                  RAD_ALL.13255 
     &            =AREA_OVERLAP(L, IP_REGION_CLEAR, IP_REGION_CONV)                RAD_ALL.13256 
     &            /AREA_LOWER(L, IP_REGION_CONV)                                   RAD_ALL.13257 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U23)                                  RAD_ALL.13258 
     &            =AREA_OVERLAP(L, IP_REGION_STRAT, IP_REGION_CONV)                RAD_ALL.13259 
     &            /AREA_LOWER(L, IP_REGION_CONV)                                   RAD_ALL.13260 
               CLOUD_OVERLAP(L, I, IP_CLOVLP_U33)                                  RAD_ALL.13261 
     &            =AREA_OVERLAP(L, IP_REGION_CONV, IP_REGION_CONV)                 RAD_ALL.13262 
     &            /AREA_LOWER(L, IP_REGION_CONV)                                   RAD_ALL.13263 
            ENDIF                                                                  RAD_ALL.13264 
         ENDDO                                                                     RAD_ALL.13265 
!                                                                                  RAD_ALL.13266 
!        REASSIGN THE FRACTIONS IN THE UPPER LAYER TO STEP DOWN                    RAD_ALL.13267 
!        THROUGH THE ATMOSPHERE.                                                   RAD_ALL.13268 
         IF (I.LT.N_LAYER) THEN                                                    RAD_ALL.13269 
            DO K=1, N_REGION                                                       RAD_ALL.13270 
               DO L=1, N_PROFILE                                                   RAD_ALL.13271 
                  AREA_UPPER(L, K)=AREA_LOWER(L, K)                                RAD_ALL.13272 
               ENDDO                                                               RAD_ALL.13273 
            ENDDO                                                                  RAD_ALL.13274 
         ENDIF                                                                     RAD_ALL.13275 
!                                                                                  RAD_ALL.13276 
      ENDDO                                                                        RAD_ALL.13277 
!                                                                                  RAD_ALL.13278 
!                                                                                  RAD_ALL.13279 
!                                                                                  RAD_ALL.13280 
      RETURN                                                                       RAD_ALL.13281 
      END   
