C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.9072  
C                                                                                  RAD_ALL.9073  
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.9074  
C restrictions as set forth in the contract.                                       RAD_ALL.9075  
C                                                                                  RAD_ALL.9076  
C                Meteorological Office                                             RAD_ALL.9077  
C                London Road                                                       RAD_ALL.9078  
C                BRACKNELL                                                         RAD_ALL.9079  
C                Berkshire UK                                                      RAD_ALL.9080  
C                RG12 2SZ                                                          RAD_ALL.9081  
C                                                                                  RAD_ALL.9082  
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.9083  
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.9084  
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.9085  
C Modelling at the above address.                                                  RAD_ALL.9086  
C ******************************COPYRIGHT******************************            RAD_ALL.9087  
C                                                                                  RAD_ALL.9088  
!+ Function to determine whether densities are required for clouds.                RAD_ALL.9089  
!                                                                                  RAD_ALL.9090  
! Method:                                                                          RAD_ALL.9091  
!                                                                                  RAD_ALL.9092  
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.9093  
!                                                                                  RAD_ALL.9094  
! History:                                                                         RAD_ALL.9095  
!       Version         Date                    Comment                            RAD_ALL.9096  
!       4.0             27-07-95                Original Code                      RAD_ALL.9097  
!                                               (J. M. Edwards)                    RAD_ALL.9098  
!       4.1             10-06-96                L_CLOUD_DENSITY set                RAD_ALL.9099  
!                                               as .FALSE. initially               RAD_ALL.9100  
!                                               to provide a default.              RAD_ALL.9101  
!                                               (J. M. Edwards)                    RAD_ALL.9102  
!                                                                                  RAD_ALL.9103  
! Description of Code:                                                             RAD_ALL.9104  
!   FORTRAN 77 with extensions listed in documentation.                            RAD_ALL.9105  
!                                                                                  RAD_ALL.9106  
!- ---------------------------------------------------------------------           RAD_ALL.9107  
      FUNCTION L_CLOUD_DENSITY(N_CONDENSED, I_PHASE_CMP, L_CLOUD_CMP               RAD_ALL.9108  
     &   , I_CONDENSED_PARAM                                                       RAD_ALL.9109  
     &   )                                                                         RAD_ALL.9110  
!                                                                                  RAD_ALL.9111  
!                                                                                  RAD_ALL.9112  
!                                                                                  RAD_ALL.9113  
      IMPLICIT NONE                                                                RAD_ALL.9114  
!                                                                                  RAD_ALL.9115  
!                                                                                  RAD_ALL.9116  
!     INCLUDE COMDECKS                                                             RAD_ALL.9117  
!     ------------------------------------------------------------------           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    
!     ------------------------------------------------------------------           ICLPRM3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       ICLPRM3A.3     
!                                                                                  ICLPRM3A.4     
!     MODULE TO SET NUMBERS FOR ICE CLOUD SCHEMES.                                 ICLPRM3A.5     
!                                                                                  ICLPRM3A.6     
      INTEGER                                                                      ICLPRM3A.7     
     &     NPD_ICE_CLOUD_FIT                                                       ICLPRM3A.8     
!             NUMBER OF CLOUD FITTING SCHEMES                                      ICLPRM3A.9     
     &   , IP_SLINGO_SCHRECKER_ICE                                                 ICLPRM3A.10    
!             PARAMETRIZATION OF SLINGO AND SCHRECKER.                             ICLPRM3A.11    
     &   , IP_ICE_UNPARAMETRIZED                                                   ICLPRM3A.12    
!             UNPARAMETRIZED ICE CRYSTAL DATA                                      ICLPRM3A.13    
     &   , IP_SUN_SHINE_VN2_VIS                                                    ICLPRM3A.14    
!             SUN AND SHINE'S PARAMETRIZATION IN THE VISIBLE (VERSION 2)           ICLPRM3A.15    
     &   , IP_SUN_SHINE_VN2_IR                                                     ICLPRM3A.16    
!             SUN AND SHINE'S PARAMETRIZATION IN THE IR (VERSION 2)                ICLPRM3A.17    
     &   , IP_ICE_ADT                                                              ICLPRM3A.18    
!             SCHEME BASED ON ANOMALOUS DIFFRACTION THEORY                         ICLPRM3A.19    
!             FOR ICE CRYSTALS                                                     ICLPRM3A.20    
                                                                                   ICLPRM3A.21    
!                                                                                  ICLPRM3A.22    
      PARAMETER(                                                                   ICLPRM3A.23    
     &     NPD_ICE_CLOUD_FIT=6                                                     ICLPRM3A.24    
     &   , IP_SLINGO_SCHRECKER_ICE=1                                               ICLPRM3A.25    
     &   , IP_ICE_UNPARAMETRIZED=3                                                 ICLPRM3A.26    
     &   , IP_SUN_SHINE_VN2_VIS=4                                                  ICLPRM3A.27    
     &   , IP_SUN_SHINE_VN2_IR=5                                                   ICLPRM3A.28    
     &   , IP_ICE_ADT=6                                                            ICLPRM3A.29    
     &   )                                                                         ICLPRM3A.30    
!                                                                                  ICLPRM3A.31    
!     ------------------------------------------------------------------           ICLPRM3A.32    
!     ------------------------------------------------------------------           PHASE3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       PHASE3A.3     
!                                                                                  PHASE3A.4     
!     MODULE TO SET INDICES FOR PHASES.                                            PHASE3A.5     
!                                                                                  PHASE3A.6     
      INTEGER                                                                      PHASE3A.7     
     &     IP_PHASE_WATER                                                          PHASE3A.8     
!             LIQUID PHASE                                                         PHASE3A.9     
     &   , IP_PHASE_ICE                                                            PHASE3A.10    
!             ICE PHASE                                                            PHASE3A.11    
!                                                                                  PHASE3A.12    
      PARAMETER(                                                                   PHASE3A.13    
     &     IP_PHASE_WATER=1                                                        PHASE3A.14    
     &   , IP_PHASE_ICE=2                                                          PHASE3A.15    
     &   )                                                                         PHASE3A.16    
!                                                                                  PHASE3A.17    
!     ------------------------------------------------------------------           PHASE3A.18    
!                                                                                  RAD_ALL.9121  
!     DUMMY ARGUMENTS.                                                             RAD_ALL.9122  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.9123  
     &     N_CONDENSED                                                             RAD_ALL.9124  
!             NUMBER OF TYPES OF CONDENSATE                                        RAD_ALL.9125  
     &   , I_PHASE_CMP(NPD_CLOUD_COMPONENT)                                        RAD_ALL.9126  
!             PHASES OF COMPONENTS                                                 RAD_ALL.9127  
     &   , I_CONDENSED_PARAM(NPD_CLOUD_COMPONENT)                                  RAD_ALL.9128  
!             PARAMETRIZATIONS OF COMPONENTS                                       RAD_ALL.9129  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.9130  
     &     L_CLOUD_CMP(NPD_CLOUD_COMPONENT)                                        RAD_ALL.9131  
!             FLAGS FOR ENABLED COMPONENTS                                         RAD_ALL.9132  
      LOGICAL   !, INTENT(OUT)                                                     RAD_ALL.9133  
     &     L_CLOUD_DENSITY                                                         RAD_ALL.9134  
!             RETURNED FLAG FOR CALCULATING DENSITY                                RAD_ALL.9135  
!                                                                                  RAD_ALL.9136  
!                                                                                  RAD_ALL.9137  
!     LOCAL VARIABLES.                                                             RAD_ALL.9138  
      INTEGER                                                                      RAD_ALL.9139  
     &     K                                                                       RAD_ALL.9140  
!             LOOP VARIABLE                                                        RAD_ALL.9141  
!                                                                                  RAD_ALL.9142  
!                                                                                  RAD_ALL.9143  
      L_CLOUD_DENSITY=.FALSE.                                                      RAD_ALL.9144  
!                                                                                  RAD_ALL.9145  
!     DENSITIES MUST BE CALCULATED IF SUN & SHINE'S PARAMETRIZATIONS               RAD_ALL.9146  
!     ARE USED.                                                                    RAD_ALL.9147  
      DO K=1, N_CONDENSED                                                          RAD_ALL.9148  
         L_CLOUD_DENSITY=L_CLOUD_DENSITY.OR.                                       RAD_ALL.9149  
     &      (L_CLOUD_CMP(K).AND.(I_PHASE_CMP(K).EQ.IP_PHASE_ICE).AND.              RAD_ALL.9150  
     &      ( (I_CONDENSED_PARAM(K).EQ.IP_SUN_SHINE_VN2_VIS).OR.                   RAD_ALL.9151  
     &        (I_CONDENSED_PARAM(K).EQ.IP_SUN_SHINE_VN2_IR) ) )                    RAD_ALL.9152  
      ENDDO                                                                        RAD_ALL.9153  
!                                                                                  RAD_ALL.9154  
!                                                                                  RAD_ALL.9155  
!                                                                                  RAD_ALL.9156  
      RETURN                                                                       RAD_ALL.9157  
      END 
