C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.4     
C                                                                                  RAD_ALL.5     
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.6     
C restrictions as set forth in the contract.                                       RAD_ALL.7     
C                                                                                  RAD_ALL.8     
C                Meteorological Office                                             RAD_ALL.9     
C                London Road                                                       RAD_ALL.10    
C                BRACKNELL                                                         RAD_ALL.11    
C                Berkshire UK                                                      RAD_ALL.12    
C                RG12 2SZ                                                          RAD_ALL.13    
C                                                                                  RAD_ALL.14    
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.15    
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.16    
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.17    
C Modelling at the above address.                                                  RAD_ALL.18    
C ******************************COPYRIGHT******************************            RAD_ALL.19    
C                                                                                  RAD_ALL.20    
!+ Subroutine to increment a sum of fluxes.                                        RAD_ALL.21    
!                                                                                  RAD_ALL.22    
! Method:                                                                          RAD_ALL.23    
!       The arrays holding the summed fluxes are incremented                       RAD_ALL.24    
!       by a weighted sum of the variables suffixed with _INCR.                    RAD_ALL.25    
!       Arguments specify which arrays are to be incremented.                      RAD_ALL.26    
!                                                                                  RAD_ALL.27    
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.28    
!                                                                                  RAD_ALL.29    
! History:                                                                         RAD_ALL.30    
!       Version         Date                    Comment                            RAD_ALL.31    
!       4.0             27-07-95                Original Code                      RAD_ALL.32    
!                                               (J. M. Edwards)                    RAD_ALL.33    
!                                                                                  RAD_ALL.34    
! Description of Code:                                                             RAD_ALL.35    
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.36    
!                                                                                  RAD_ALL.37    
!- ---------------------------------------------------------------------           RAD_ALL.38    
      SUBROUTINE AUGMENT_FLUX(N_PROFILE, N_LAYER, N_AUGMENT                        RAD_ALL.39    
     &   , ISOLIR, L_CLEAR                                                         RAD_ALL.40    
     &   , WEIGHT_INCR                                                             RAD_ALL.41    
     &   , FLUX_DIRECT, FLUX_TOTAL                                                 RAD_ALL.42    
     &   , FLUX_DIRECT_INCR, FLUX_TOTAL_INCR                                       RAD_ALL.43    
     &   , FLUX_DIRECT_CLEAR, FLUX_TOTAL_CLEAR                                     RAD_ALL.44    
     &   , FLUX_DIRECT_INCR_CLEAR, FLUX_TOTAL_INCR_CLEAR                           RAD_ALL.45    
     &   , NPD_PROFILE, NPD_LAYER                                                  RAD_ALL.46    
     &   )                                                                         RAD_ALL.47    
!                                                                                  RAD_ALL.48    
!                                                                                  RAD_ALL.49    
      IMPLICIT NONE                                                                RAD_ALL.50    
!                                                                                  RAD_ALL.51    
!                                                                                  RAD_ALL.52    
!     SIZES OF DUMMY ARRAYS.                                                       RAD_ALL.53    
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.54    
     &     NPD_PROFILE                                                             RAD_ALL.55    
!             MAXIMUM NUMBER OF PROFILES                                           RAD_ALL.56    
     &   , NPD_LAYER                                                               RAD_ALL.57    
!             MAXIMUM NUMBER OF LAYERS                                             RAD_ALL.58    
!                                                                                  RAD_ALL.59    
!     INCLUDE COMDECKS                                                             RAD_ALL.60    
!     ------------------------------------------------------------------           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.62    
!     DUMMY ARGUMENTS.                                                             RAD_ALL.63    
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.64    
     &     N_PROFILE                                                               RAD_ALL.65    
!             NUMBER OF PROFILES                                                   RAD_ALL.66    
     &   , N_LAYER                                                                 RAD_ALL.67    
!             NUMBER OF LAYERS                                                     RAD_ALL.68    
     &   , N_AUGMENT                                                               RAD_ALL.69    
!             LENGTH OF VECTOR TO AUGMENT                                          RAD_ALL.70    
     &   , ISOLIR                                                                  RAD_ALL.71    
!             SPECTRAL REGION                                                      RAD_ALL.72    
      LOGICAL   !, INTENT(IN)                                                      RAD_ALL.73    
     &     L_CLEAR                                                                 RAD_ALL.74    
!             CLEAR FLUXES CALCULATED                                              RAD_ALL.75    
      REAL  !, INTENT(IN)                                                          RAD_ALL.76    
     &     WEIGHT_INCR                                                             RAD_ALL.77    
!             WEIGHT TO APPLY TO FLUXES                                            RAD_ALL.78    
     &   , FLUX_DIRECT_INCR(NPD_PROFILE, 0: NPD_LAYER)                             RAD_ALL.79    
!             DIRECT FLUX IN BAND                                                  RAD_ALL.80    
     &   , FLUX_TOTAL_INCR(NPD_PROFILE, 2*NPD_LAYER+2)                             RAD_ALL.81    
!             TOTAL FLUX IN BAND                                                   RAD_ALL.82    
     &   , FLUX_DIRECT_INCR_CLEAR(NPD_PROFILE, 0: NPD_LAYER)                       RAD_ALL.83    
!             CLEAR DIRECT FLUX IN BAND                                            RAD_ALL.84    
     &   , FLUX_TOTAL_INCR_CLEAR(NPD_PROFILE, 2*NPD_LAYER+2)                       RAD_ALL.85    
!             CLEAR TOTAL FLUX IN BAND                                             RAD_ALL.86    
      REAL  !, INTENT(INOUT)                                                       RAD_ALL.87    
     &     FLUX_DIRECT(NPD_PROFILE, 0: NPD_LAYER)                                  RAD_ALL.88    
!             DIRECT FLUX                                                          RAD_ALL.89    
     &   , FLUX_TOTAL(NPD_PROFILE, 2*NPD_LAYER+2)                                  RAD_ALL.90    
!             TOTAL FLUX                                                           RAD_ALL.91    
     &   , FLUX_DIRECT_CLEAR(NPD_PROFILE, 0: NPD_LAYER)                            RAD_ALL.92    
!             CLEAR DIRECT FLUX                                                    RAD_ALL.93    
     &   , FLUX_TOTAL_CLEAR(NPD_PROFILE, 2*NPD_LAYER+2)                            RAD_ALL.94    
!             CLEAR TOTAL FLUX                                                     RAD_ALL.95    
!                                                                                  RAD_ALL.96    
!     LOCAL ARGUMENTS.                                                             RAD_ALL.97    
      INTEGER                                                                      RAD_ALL.98    
     &     I                                                                       RAD_ALL.99    
!             LOOP VARIABLE                                                        RAD_ALL.100   
     &   , L                                                                       RAD_ALL.101   
!             LOOP VARIABLE                                                        RAD_ALL.102   
!                                                                                  RAD_ALL.103   
!                                                                                  RAD_ALL.104   
!     INCREMENT THE ACTUAL FLUXES.                                                 RAD_ALL.105   
      IF (ISOLIR.EQ.IP_SOLAR) THEN                                                 RAD_ALL.106   
         DO I=0, N_LAYER                                                           RAD_ALL.107   
            DO L=1, N_PROFILE                                                      RAD_ALL.108   
               FLUX_DIRECT(L, I)=FLUX_DIRECT(L, I)                                 RAD_ALL.109   
     &            +WEIGHT_INCR*FLUX_DIRECT_INCR(L, I)                              RAD_ALL.110   
            ENDDO                                                                  RAD_ALL.111   
         ENDDO                                                                     RAD_ALL.112   
      ENDIF                                                                        RAD_ALL.113   
      DO I=1, N_AUGMENT                                                            RAD_ALL.114   
         DO L=1, N_PROFILE                                                         RAD_ALL.115   
            FLUX_TOTAL(L, I)=FLUX_TOTAL(L, I)                                      RAD_ALL.116   
     &         +WEIGHT_INCR*FLUX_TOTAL_INCR(L, I)                                  RAD_ALL.117   
         ENDDO                                                                     RAD_ALL.118   
      ENDDO                                                                        RAD_ALL.119   
!                                                                                  RAD_ALL.120   
      IF (L_CLEAR) THEN                                                            RAD_ALL.121   
         IF (ISOLIR.EQ.IP_SOLAR) THEN                                              RAD_ALL.122   
            DO I=0, N_LAYER                                                        RAD_ALL.123   
               DO L=1, N_PROFILE                                                   RAD_ALL.124   
                  FLUX_DIRECT_CLEAR(L, I)=FLUX_DIRECT_CLEAR(L, I)                  RAD_ALL.125   
     &               +WEIGHT_INCR*FLUX_DIRECT_INCR_CLEAR(L, I)                     RAD_ALL.126   
               ENDDO                                                               RAD_ALL.127   
            ENDDO                                                                  RAD_ALL.128   
         ENDIF                                                                     RAD_ALL.129   
         DO I=1, N_AUGMENT                                                         RAD_ALL.130   
            DO L=1, N_PROFILE                                                      RAD_ALL.131   
               FLUX_TOTAL_CLEAR(L, I)=FLUX_TOTAL_CLEAR(L, I)                       RAD_ALL.132   
     &            +WEIGHT_INCR*FLUX_TOTAL_INCR_CLEAR(L, I)                         RAD_ALL.133   
            ENDDO                                                                  RAD_ALL.134   
         ENDDO                                                                     RAD_ALL.135   
      ENDIF                                                                        RAD_ALL.136   
!                                                                                  RAD_ALL.137   
!                                                                                  RAD_ALL.138   
      RETURN                                                                       RAD_ALL.139   
      END           
