*IF DEF,A03_3A,OR,DEF,A03_5A,OR,DEF,A03_5B,OR,DEF,A03_6A,OR,DEF,A03_7A     BL_LSP1A.2      
C *****************************COPYRIGHT******************************     BL_LSP1A.3      
C (c) CROWN COPYRIGHT 1997, METEOROLOGICAL OFFICE, All Rights Reserved.    BL_LSP1A.4      
C                                                                          BL_LSP1A.5      
C Use, duplication or disclosure of this code is subject to the            BL_LSP1A.6      
C restrictions as set forth in the contract.                               BL_LSP1A.7      
C                                                                          BL_LSP1A.8      
C                Meteorological Office                                     BL_LSP1A.9      
C                London Road                                               BL_LSP1A.10     
C                BRACKNELL                                                 BL_LSP1A.11     
C                Berkshire UK                                              BL_LSP1A.12     
C                RG12 2SZ                                                  BL_LSP1A.13     
C                                                                          BL_LSP1A.14     
C If no contract has been raised with this copy of the code, the use,      BL_LSP1A.15     
C duplication or disclosure of it is strictly prohibited.  Permission      BL_LSP1A.16     
C to do so must first be obtained in writing from the Head of Numerical    BL_LSP1A.17     
C Modelling at the above address.                                          BL_LSP1A.18     
C ******************************COPYRIGHT******************************    BL_LSP1A.19     

      SUBROUTINE BL_LSP( P_FIELD,FIRST_ROW,ROW_LENGTH,ROWS,BL_LEVELS,       2BL_LSP1A.20     
     &                   QCF,Q,T )                                         BL_LSP1A.21     
!                                                                          BL_LSP1A.22     
!  Purpose: Convert temperature from liquid ice to liquid, and convert     BL_LSP1A.23     
!           the vapour+liquid+ice variable (Q) to vapour+liquid. This      BL_LSP1A.24     
!           subroutine is used if the mixed phase precipitation scheme     BL_LSP1A.25     
!           is selected AND a full boundary layer treatment is not         BL_LSP1A.26     
!           performed.                                                     BL_LSP1A.27     
!                                                                          BL_LSP1A.28     
! D Wilson    <- programmer                                                BL_LSP1A.29     
!                                                                          BL_LSP1A.30     
!  Model            Modification history from model version 4.4:           BL_LSP1A.31     
! version  Date                                                            BL_LSP1A.32     
! 4.4      Sept 97  Originally Coded                                       BL_LSP1A.33     
!                                                 Damian Wilson            BL_LSP1A.34     
!                                                                          BL_LSP1A.35     
        IMPLICIT NONE                                                      BL_LSP1A.36     
!                                                                          BL_LSP1A.37     
        INTEGER                                                            BL_LSP1A.38     
     &    P_FIELD               ! IN   Number of points in the field       BL_LSP1A.39     
     &,   FIRST_ROW             ! IN   First row to be processed           BL_LSP1A.40     
     &,   ROW_LENGTH            ! IN   Length of each row                  BL_LSP1A.41     
     &,   ROWS                  ! IN   Number of rows                      BL_LSP1A.42     
     &,   BL_LEVELS             ! IN   Number of boundary layer levels     BL_LSP1A.43     
!                                                                          BL_LSP1A.44     
        REAL                                                               BL_LSP1A.45     
     &    QCF(P_FIELD,BL_LEVELS) ! INOUT Ice water content                 BL_LSP1A.46     
     &,   Q(P_FIELD,BL_LEVELS)   ! INOUT                                   BL_LSP1A.47     
!                                  IN    Vapour+liquid+ice content         BL_LSP1A.48     
!                                  OUT   Vapour+liquid content             BL_LSP1A.49     
     &,   T(P_FIELD,BL_LEVELS)   ! INOUT                                   BL_LSP1A.50     
!                                  IN    Liquid ice temperature            BL_LSP1A.51     
!                                  OUT   Liquid temperature                BL_LSP1A.52     
! Temporary Space                                                          BL_LSP1A.53     
        INTEGER P1               ! First point                             BL_LSP1A.54     
     &,         P2               ! Last point                              BL_LSP1A.55     
     &,         I                ! Counter over points                     BL_LSP1A.56     
     &,         J                ! Counter over boundary layer levels      BL_LSP1A.57     
        REAL NEWQCF              ! Temporary variable for QCF              BL_LSP1A.58     
*CALL C_R_CP                                                               BL_LSP1A.59     
*CALL C_LHEAT                                                              BL_LSP1A.60     
      REAL LSRCP                 ! IN Latent heat of sublimation / Cp      BL_LSP1A.61     
      PARAMETER( LSRCP=((LC+LF)/CP) )                                      BL_LSP1A.62     
!                                                                          BL_LSP1A.63     
      P1=1+(FIRST_ROW-1)*ROW_LENGTH                                        BL_LSP1A.64     
      P2=P1+ROWS*ROW_LENGTH-1                                              BL_LSP1A.65     
!                                                                          BL_LSP1A.66     
      DO J=1,BL_LEVELS                                                     BL_LSP1A.67     
        DO I=P1,P2                                                         BL_LSP1A.68     
! Convert Q (vapour+liquid+ice) to (vapour+liquid)                         BL_LSP1A.69     
          Q(I,J)=Q(I,J)-QCF(I,J)                                           BL_LSP1A.70     
! Check that Q is not negative                                             BL_LSP1A.71     
          IF (Q(I,J) .LT. 0.0) THEN                                        BL_LSP1A.72     
! Evaporate ice to keep Q positive, but don't let ice go negative          BL_LSP1A.73     
! itself                                                                   BL_LSP1A.74     
            NEWQCF=MAX(QCF(I,J)+Q(I,J),0.0)                                BL_LSP1A.75     
            Q(I,J)=Q(I,J)+(QCF(I,J)-NEWQCF)                                BL_LSP1A.76     
            QCF(I,J)=NEWQCF                                                BL_LSP1A.77     
          ENDIF                                                            BL_LSP1A.78     
! Adjust T from T liquid ice to T liquid                                   BL_LSP1A.79     
          T(I,J)=T(I,J)+LSRCP*QCF(I,J)                                     BL_LSP1A.80     
        END DO                                                             BL_LSP1A.81     
      END DO                                                               BL_LSP1A.82     
! End the subroutine                                                       BL_LSP1A.83     
      RETURN                                                               BL_LSP1A.84     
      END                                                                  BL_LSP1A.85     
*ENDIF                                                                     BL_LSP1A.86