C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.8732  
C                                                                                  RAD_ALL.8733  
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.8734  
C restrictions as set forth in the contract.                                       RAD_ALL.8735  
C                                                                                  RAD_ALL.8736  
C                Meteorological Office                                             RAD_ALL.8737  
C                London Road                                                       RAD_ALL.8738  
C                BRACKNELL                                                         RAD_ALL.8739  
C                Berkshire UK                                                      RAD_ALL.8740  
C                RG12 2SZ                                                          RAD_ALL.8741  
C                                                                                  RAD_ALL.8742  
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.8743  
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.8744  
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.8745  
C Modelling at the above address.                                                  RAD_ALL.8746  
C ******************************COPYRIGHT******************************            RAD_ALL.8747  
C                                                                                  RAD_ALL.8748  
!+ Subroutine to initialize array of fluxes.                                       RAD_ALL.8749  
!                                                                                  RAD_ALL.8750  
! Method:                                                                          RAD_ALL.8751  
!       A value is passed to the routine. This is used to initialize               RAD_ALL.8752  
!       arrays of total and direct, overall and clear fluxes as are                RAD_ALL.8753  
!       required for the calculation being performed.                              RAD_ALL.8754  
!                                                                                  RAD_ALL.8755  
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.8756  
!                                                                                  RAD_ALL.8757  
! History:                                                                         RAD_ALL.8758  
!       Version         Date                    Comment                            RAD_ALL.8759  
!       4.0             27-07-95                Original Code                      RAD_ALL.8760  
!                                               (J. M. Edwards)                    RAD_ALL.8761  
!                                                                                  RAD_ALL.8762  
! Description of Code:                                                             RAD_ALL.8763  
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.8764  
!                                                                                  RAD_ALL.8765  
!- ---------------------------------------------------------------------           RAD_ALL.8766  
      SUBROUTINE INITIALIZE_FLUX(N_PROFILE, N_LAYER, N_AUGMENT                     RAD_ALL.8767  
     &   , ISOLIR                                                                  RAD_ALL.8768  
     &   , FLUX_DIRECT, FLUX_TOTAL                                                 RAD_ALL.8769  
     &   , L_CLEAR                                                                 RAD_ALL.8770  
     &   , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR                                     RAD_ALL.8771  
     &   , VALUE                                                                   RAD_ALL.8772  
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.8773  
     &   , L_NET                                                                   RAD_ALL.8774  
     &   )                                                                         RAD_ALL.8775  
!                                                                                  RAD_ALL.8776  
!                                                                                  RAD_ALL.8777  
      IMPLICIT NONE                                                                RAD_ALL.8778  
!                                                                                  RAD_ALL.8779  
!                                                                                  RAD_ALL.8780  
!     SIZES OF DUMMY ARRAYS.                                                       RAD_ALL.8781  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.8782  
     &     NPD_PROFILE                                                             RAD_ALL.8783  
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.8784  
     &   , NPD_LAYER                                                               RAD_ALL.8785  
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.8786  
!                                                                                  RAD_ALL.8787  
!     INCLUDE COMDECKS.                                                            RAD_ALL.8788  
!     ------------------------------------------------------------------           SPCRG3A.2     
!     COMDECK FOR TWO-STREAM RADIATION CODE.                                       SPCRG3A.3     
!                                                                                  SPCRG3A.4     
!     MODULE TO SET FLAGS FOR DIFFERENT PORTIONS                                   SPCRG3A.5     
!     OF THE SPECTRUM.                                                             SPCRG3A.6     
!                                                                                  SPCRG3A.7     
      INTEGER                                                                      SPCRG3A.8     
     &     IP_SOLAR                                                                SPCRG3A.9     
!             SOLAR REGION                                                         SPCRG3A.10    
     &   , IP_INFRA_RED                                                            SPCRG3A.11    
!             INFRA-RED REGION                                                     SPCRG3A.12    
!                                                                                  SPCRG3A.13    
      PARAMETER(                                                                   SPCRG3A.14    
     &     IP_SOLAR=1                                                              SPCRG3A.15    
     &   , IP_INFRA_RED=2                                                          SPCRG3A.16    
     &   )                                                                         SPCRG3A.17    
!                                                                                  SPCRG3A.18    
!     ------------------------------------------------------------------           SPCRG3A.19    
!                                                                                  RAD_ALL.8790  
!     DUMMY ARGUMENTS.                                                             RAD_ALL.8791  
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.8792  
     &     N_PROFILE                                                               RAD_ALL.8793  
!             NUMBER OF PROFILES                                                   RAD_ALL.8794  
     &   , N_LAYER                                                                 RAD_ALL.8795  
!             NUMBER OF LAYERS                                                     RAD_ALL.8796  
     &   , N_AUGMENT                                                               RAD_ALL.8797  
!             LENGTH OF LONG FLUX VECTOR                                           RAD_ALL.8798  
     &   , ISOLIR                                                                  RAD_ALL.8799  
!             SPECTRAL REGION                                                      RAD_ALL.8800  
      LOGICAL   !,INTENT(IN)                                                       RAD_ALL.8801  
     &     L_CLEAR                                                                 RAD_ALL.8802  
!             CLEAR-SKY FIELD FLAG                                                 RAD_ALL.8803  
      REAL      !, INTENT(IN)                                                      RAD_ALL.8804  
     &     VALUE                                                                   RAD_ALL.8805  
!             VALUE FOR INITIALIZATION                                             RAD_ALL.8806  
      REAL      !, INTENT(OUT)                                                     RAD_ALL.8807  
     &     FLUX_DIRECT(NPD_PROFILE, 0: NPD_LAYER)                                  RAD_ALL.8808  
!             DIRECT FLUX                                                          RAD_ALL.8809  
     &   , FLUX_TOTAL(NPD_PROFILE, 2*NPD_LAYER+2)                                  RAD_ALL.8810  
!             TOTAL FLUX                                                           RAD_ALL.8811  
     &   , FLUX_DIRECT_CLEAR(NPD_PROFILE, 0: NPD_LAYER)                            RAD_ALL.8812  
!             CLEAR DIRECT FLUX                                                    RAD_ALL.8813  
     &   , FLUX_TOTAL_CLEAR(NPD_PROFILE, 2*NPD_LAYER+2)                            RAD_ALL.8814  
!             CLEAR TOTAL FLUX                                                     RAD_ALL.8815  
!     VARIABLES SPECIFICALLY FOR THE UNIFIED MODEL.                                RAD_ALL.8816  
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.8817  
     &     L_NET                                                                   RAD_ALL.8818  
!             CALCULATE NET FLUXES                                                 RAD_ALL.8819  
!                                                                                  RAD_ALL.8820  
!     LOCAL VARIABLES.                                                             RAD_ALL.8821  
      INTEGER                                                                      RAD_ALL.8822  
     &     I                                                                       RAD_ALL.8823  
!             LOOP VARIABLE                                                        RAD_ALL.8824  
     &   , L                                                                       RAD_ALL.8825  
!             LOOP VARIABLE                                                        RAD_ALL.8826  
!                                                                                  RAD_ALL.8827  
!                                                                                  RAD_ALL.8828  
      IF (ISOLIR.EQ.IP_SOLAR) THEN                                                 RAD_ALL.8829  
         DO I=0, N_LAYER                                                           RAD_ALL.8830  
            DO L=1, N_PROFILE                                                      RAD_ALL.8831  
               FLUX_DIRECT(L, I)=VALUE                                             RAD_ALL.8832  
            ENDDO                                                                  RAD_ALL.8833  
         ENDDO                                                                     RAD_ALL.8834  
      ENDIF                                                                        RAD_ALL.8835  
      DO I=1, N_AUGMENT                                                            RAD_ALL.8836  
         DO L=1, N_PROFILE                                                         RAD_ALL.8837  
            FLUX_TOTAL(L, I)=VALUE                                                 RAD_ALL.8838  
         ENDDO                                                                     RAD_ALL.8839  
      ENDDO                                                                        RAD_ALL.8840  
!                                                                                  RAD_ALL.8841  
      IF (L_CLEAR) THEN                                                            RAD_ALL.8842  
         IF (ISOLIR.EQ.IP_SOLAR) THEN                                              RAD_ALL.8843  
            DO I=0, N_LAYER                                                        RAD_ALL.8844  
               DO L=1, N_PROFILE                                                   RAD_ALL.8845  
                  FLUX_DIRECT_CLEAR(L, I)=VALUE                                    RAD_ALL.8846  
               ENDDO                                                               RAD_ALL.8847  
            ENDDO                                                                  RAD_ALL.8848  
         ENDIF                                                                     RAD_ALL.8849  
         DO I=1, N_AUGMENT                                                         RAD_ALL.8850  
            DO L=1, N_PROFILE                                                      RAD_ALL.8851  
               FLUX_TOTAL_CLEAR(L, I)=VALUE                                        RAD_ALL.8852  
            ENDDO                                                                  RAD_ALL.8853  
         ENDDO                                                                     RAD_ALL.8854  
!        INITIALIZE EXTRA AREAS IN THE CLEAR ARRAY FOR DIAGNOSTIC                  RAD_ALL.8855  
!        CALCULATIONS:                                                             RAD_ALL.8856  
         IF (L_NET) THEN                                                           RAD_ALL.8857  
            DO L=1, N_PROFILE                                                      RAD_ALL.8858  
               FLUX_TOTAL_CLEAR(L, 2*N_LAYER+2)=VALUE                              RAD_ALL.8859  
            ENDDO                                                                  RAD_ALL.8860  
         ENDIF                                                                     RAD_ALL.8861  
      ENDIF                                                                        RAD_ALL.8862  
!                                                                                  RAD_ALL.8863  
!                                                                                  RAD_ALL.8864  
      RETURN                                                                       RAD_ALL.8865  
      END 
