*IF DEF,A03_6A                                                             EXFXTQ6A.2      
C *****************************COPYRIGHT******************************     EXFXTQ6A.3      
C (c) CROWN COPYRIGHT 1997, METEOROLOGICAL OFFICE, All Rights Reserved.    EXFXTQ6A.4      
C                                                                          EXFXTQ6A.5      
C Use, duplication or disclosure of this code is subject to the            EXFXTQ6A.6      
C restrictions as set forth in the contract.                               EXFXTQ6A.7      
C                                                                          EXFXTQ6A.8      
C                Meteorological Office                                     EXFXTQ6A.9      
C                London Road                                               EXFXTQ6A.10     
C                BRACKNELL                                                 EXFXTQ6A.11     
C                Berkshire UK                                              EXFXTQ6A.12     
C                RG12 2SZ                                                  EXFXTQ6A.13     
C                                                                          EXFXTQ6A.14     
C If no contract has been raised with this copy of the code, the use,      EXFXTQ6A.15     
C duplication or disclosure of it is strictly prohibited.  Permission      EXFXTQ6A.16     
C to do so must first be obtained in writing from the Head of Numerical    EXFXTQ6A.17     
C Modelling at the above address.                                          EXFXTQ6A.18     
C ******************************COPYRIGHT******************************    EXFXTQ6A.19     
!!!                                                                        EXFXTQ6A.20     
!!!  Purpose: Calculate explicit fluxes of TL and QT                       EXFXTQ6A.21     
!!!                                                                        EXFXTQ6A.22     
!!!  Suitable for single column use                                        EXFXTQ6A.23     
!!!                                                                        EXFXTQ6A.24     
!!!  Model           Modification history                                  EXFXTQ6A.25     
!!! version  Date                                                          EXFXTQ6A.26     
!!!  4.4    09/09/97   New deck  R.N.B.Smith                               EXFXTQ6A.27     
!!!                                                                        EXFXTQ6A.28     
!!!  RNBS  <- Programmers of some or all of previous code or changes       EXFXTQ6A.29     
!!!                                                                        EXFXTQ6A.30     
!!!                                                                        EXFXTQ6A.31     
!!!  Programming standard: UM Documentation Paper No 4                     EXFXTQ6A.32     
!!!                                                                        EXFXTQ6A.33     
!!!  System component covered: P244                                        EXFXTQ6A.34     
!!!                                                                        EXFXTQ6A.35     
!!!  Project task: P24                                                     EXFXTQ6A.36     
!!!                                                                        EXFXTQ6A.37     
!!!  Documentation: UM Documentation Paper No 24.                          EXFXTQ6A.38     
!!!                                                                        EXFXTQ6A.39     
!!!---------------------------------------------------------------------   EXFXTQ6A.40     
                                                                           EXFXTQ6A.41     
! SUBROUTINE EX_FLUX_TQ                                                    EXFXTQ6A.42     
                                                                           EXFXTQ6A.43     

      SUBROUTINE EX_FLUX_TQ (                                               2,4EXFXTQ6A.44     
     &  P_POINTS                                                           EXFXTQ6A.45     
     &, P_FIELD                                                            EXFXTQ6A.46     
     &, P1                                                                 EXFXTQ6A.47     
     &, BL_LEVELS                                                          EXFXTQ6A.48     
     &, TL                                                                 EXFXTQ6A.49     
     &, QW                                                                 EXFXTQ6A.50     
     &, RDZ                                                                EXFXTQ6A.51     
     &, FTL                                                                EXFXTQ6A.52     
     &, FQW                                                                EXFXTQ6A.53     
     &, RHOKH                                                              EXFXTQ6A.54     
     &, RHOKHZ                                                             ARN0F405.824    
     &, GRAD_T_ADJ,GRAD_Q_ADJ                                              EXFXTQ6A.55     
     &, NTML                                                               EXFXTQ6A.56     
     &, LTIMER                                                             EXFXTQ6A.57     
     &  )                                                                  EXFXTQ6A.58     
                                                                           EXFXTQ6A.59     
                                                                           EXFXTQ6A.60     
      IMPLICIT NONE                                                        EXFXTQ6A.61     
                                                                           EXFXTQ6A.62     
! ARGUMENTS WITH INTENT IN. IE: INPUT VARIABLES.                           EXFXTQ6A.63     
                                                                           EXFXTQ6A.64     
      LOGICAL                                                              EXFXTQ6A.65     
     &  LTIMER          ! IN Flag for TIMER diagnostics                    EXFXTQ6A.66     
                                                                           EXFXTQ6A.67     
      INTEGER                                                              EXFXTQ6A.68     
     & P_FIELD                ! IN No. of P-grid points in whole field     EXFXTQ6A.69     
     &,P1                     ! IN First P-grid point to be processed      EXFXTQ6A.70     
     &,P_POINTS               ! IN No. of P-grid points to be processed    EXFXTQ6A.71     
     &,BL_LEVELS              ! IN No. of atmospheric levels for which     EXFXTQ6A.72     
!                                boundary layer fluxes are calculated.     EXFXTQ6A.73     
!                                Assumed ! <=30 for dimensioning GAMMA()   EXFXTQ6A.74     
!                                in common deck C_GAMMA                    EXFXTQ6A.75     
     &,NTML(P_FIELD)          ! IN Number of model layers in turbulent     EXFXTQ6A.76     
!                                  mixing layer.                           EXFXTQ6A.77     
                                                                           EXFXTQ6A.78     
      REAL                                                                 EXFXTQ6A.79     
     &  TL(P_FIELD, BL_LEVELS)   ! IN Liquid/frozen water temperature      EXFXTQ6A.80     
!                                     (K).                                 EXFXTQ6A.81     
     &, QW(P_FIELD, BL_LEVELS)   ! IN Total water content (kg/kg air)      EXFXTQ6A.82     
     &, RHOKH(P_FIELD, BL_LEVELS)! IN Exchange coeffs for moisture.        EXFXTQ6A.83     
     &, RHOKHZ(P_FIELD,2:BL_LEVELS)                                        ARN0F405.825    
!                                ! IN Non-local turbulent mixing           ARN0F405.826    
!                                     coefficient for heat and moisture.   ARN0F405.827    
     &, RDZ(P_FIELD, BL_LEVELS)  ! IN RDZ(,1) is the reciprocal of the     EXFXTQ6A.84     
!                                     height of level 1, i.e. of the       EXFXTQ6A.85     
!                                     middle of layer 1.  For K > 1,       EXFXTQ6A.86     
!                                     RDZ(,K) is the reciprocal of the     EXFXTQ6A.87     
!                                     vertical distance from level         EXFXTQ6A.88     
!                                     K-1 to level K.                      EXFXTQ6A.89     
     &, GRAD_T_ADJ(P_FIELD)      ! IN Temperature gradient adjustment      EXFXTQ6A.90     
!                                     for non-local mixing in unstable     EXFXTQ6A.91     
!                                     turbulent boundary layer.            EXFXTQ6A.92     
     &, GRAD_Q_ADJ(P_FIELD)      ! IN Humidity gradient adjustment         EXFXTQ6A.93     
!                                     for non-local mixing in unstable     EXFXTQ6A.94     
!                                     turbulent boundary layer.            EXFXTQ6A.95     
                                                                           EXFXTQ6A.96     
                                                                           EXFXTQ6A.97     
                                                                           EXFXTQ6A.98     
                                                                           EXFXTQ6A.99     
! ARGUMENTS WITH INTENT OUT. IE: OUTPUT VARIABLES.                         EXFXTQ6A.100    
                                                                           EXFXTQ6A.101    
      REAL                                                                 EXFXTQ6A.102    
     &  FTL(P_FIELD, BL_LEVELS)  ! OUT FTL(,K) contains net turbulent      EXFXTQ6A.103    
!                                   sensible heat flux into layer K        EXFXTQ6A.104    
!                                   from below; so FTL(,1) is the          EXFXTQ6A.105    
!                                   surface sensible heat, H. (W/m2)       EXFXTQ6A.106    
     &, FQW(P_FIELD, BL_LEVELS)  ! OUT Moisture flux between layers        EXFXTQ6A.107    
!                                   (kg per square metre per sec).         EXFXTQ6A.108    
!                                   FQW(,1) is total water flux            EXFXTQ6A.109    
!                                   from surface, 'E'.                     EXFXTQ6A.110    
                                                                           EXFXTQ6A.111    
! LOCAL VARIABLES.                                                         EXFXTQ6A.112    
                                                                           EXFXTQ6A.113    
      INTEGER                                                              EXFXTQ6A.114    
     &  L, K                                                               EXFXTQ6A.115    
                                                                           EXFXTQ6A.116    
*CALL C_G                                                                  EXFXTQ6A.117    
*CALL C_R_CP                                                               EXFXTQ6A.118    
                                                                           EXFXTQ6A.119    
      REAL                                                                 EXFXTQ6A.120    
     & GRCP                                                                EXFXTQ6A.121    
                                                                           EXFXTQ6A.122    
      PARAMETER (                                                          EXFXTQ6A.123    
     & GRCP = G/CP                                                         EXFXTQ6A.124    
     & )                                                                   EXFXTQ6A.125    
                                                                           EXFXTQ6A.126    
      EXTERNAL TIMER                                                       EXFXTQ6A.127    
                                                                           EXFXTQ6A.128    
!-----------------------------------------------------------------------   EXFXTQ6A.129    
                                                                           EXFXTQ6A.130    
      IF (LTIMER) THEN                                                     EXFXTQ6A.131    
        CALL TIMER('EXFLUXTQ',3)                                           EXFXTQ6A.132    
      ENDIF                                                                EXFXTQ6A.133    
                                                                           EXFXTQ6A.134    
      DO K=2,BL_LEVELS                                                     EXFXTQ6A.135    
!-----------------------------------------------------------------------   EXFXTQ6A.136    
!! 1. "Explicit" fluxes of TL and QW, on P-grid.                           EXFXTQ6A.137    
!-----------------------------------------------------------------------   EXFXTQ6A.138    
        DO L=P1,P1+P_POINTS-1                                              EXFXTQ6A.139    
          FTL(L,K) = -RHOKH(L,K) *                                         EXFXTQ6A.140    
     &      ( ( ( TL(L,K) - TL(L,K-1) ) * RDZ(L,K) ) + GRCP )              EXFXTQ6A.141    
          FQW(L,K) = -RHOKH(L,K) * ( QW(L,K) - QW(L,K-1) ) * RDZ(L,K)      EXFXTQ6A.142    
!                                                                          EXFXTQ6A.143    
!         !-------------------------------------------------------------   EXFXTQ6A.144    
!         !  Add gradient adjustment terms to fluxes within the            EXFXTQ6A.145    
!         !  mixing layer.                                                 EXFXTQ6A.146    
!         !-------------------------------------------------------------   EXFXTQ6A.147    
          IF (K .LE. NTML(L) ) THEN                                        EXFXTQ6A.148    
            FTL(L,K) = FTL(L,K)                                            EXFXTQ6A.149    
     &                 + RHOKHZ(L,K) * GRAD_T_ADJ(L)                       ARN0F405.828    
            FQW(L,K) = FQW(L,K)                                            EXFXTQ6A.151    
     &                 + RHOKHZ(L,K) * GRAD_Q_ADJ(L)                       ARN0F405.829    
                                                                           ARN0F405.830    
          ENDIF                                                            EXFXTQ6A.153    
        ENDDO                                                              EXFXTQ6A.154    
      ENDDO                                                                EXFXTQ6A.155    
                                                                           EXFXTQ6A.156    
      IF (LTIMER) THEN                                                     EXFXTQ6A.157    
        CALL TIMER('EXFLUXTQ',4)                                           EXFXTQ6A.158    
      ENDIF                                                                EXFXTQ6A.159    
                                                                           EXFXTQ6A.160    
      RETURN                                                               EXFXTQ6A.161    
      END                                                                  EXFXTQ6A.162    
*ENDIF                                                                     EXFXTQ6A.163