Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / wrftladj / module_mp_nconvp.F
blob0c28b84021ba6361fee07ef5e95578f99c2ac0cc
1 !WRF:MODEL_LAYER:PHYSICS
4 MODULE module_mp_nconvp
6 CONTAINS
7 !----------------------------------------------------------------
8    SUBROUTINE lscond( th, p, qv, rho, pii                       &
9                       ,r_v, xlv, cp                             &
10                       ,EP2,SVP1,SVP2,SVP3,SVPT0                 &
11                       ,dz8w                                     &
12                       ,RAINNC, RAINNCV                          &
13                       ,ids,ide, jds,jde, kds,kde                & ! domain dims
14                       ,ims,ime, jms,jme, kms,kme                & ! memory dims
15                       ,its,ite, jts,jte, kts,kte                & ! tile   dims
16                                                                 )
17 !----------------------------------------------------------------
18    IMPLICIT NONE
19 !----------------------------------------------------------------
20    !  based on MM5 code (JD November 2006)
21 !----------------------------------------------------------------
22    INTEGER,      INTENT(IN   )    :: ids,ide, jds,jde, kds,kde, &
23                                      ims,ime, jms,jme, kms,kme, &
24                                      its,ite, jts,jte, kts,kte
25    REAL   ,      INTENT(IN   )    :: r_v, xlv, cp
26    REAL   ,      INTENT(IN   )    :: EP2,SVP1,SVP2,SVP3,SVPT0
28    REAL, DIMENSION( ims:ime , kms:kme , jms:jme ),              &
29          INTENT(INOUT) ::                                       &
30                                                             th, &
31                                                             qv
33    REAL, DIMENSION( ims:ime , kms:kme , jms:jme ),              &
34          INTENT(IN   ) ::                                       &
35                                                            rho, &
36                                                            pii, &
37                                                            p  , &
38                                                           dz8w 
41    REAL, DIMENSION( ims:ime , jms:jme ),                        &
42          INTENT(INOUT) ::                               RAINNC, &
43                                                        RAINNCV
45    ! local variables
47    REAL :: TTEMP, ES1, QS1, DQV, COND, R1
48    INTEGER :: i,j,k
49 !----------------------------------------------------------------
51    DO j = jts, jte
52    DO k = kts, kte
53    DO i = its,ite
54       TTEMP = PII(I,K,J)*TH(I,K,J)
55       ES1 = 1000.*SVP1*EXP(SVP2*(TTEMP-SVPT0)/(TTEMP-SVP3))
56       QS1 = EP2*ES1/(P(I,K,J)-ES1)
57       DQV = QV(I,K,J) - QS1
58       IF(DQV.GT.0.0)THEN
59         R1 = 1. + XLV*XLV/(R_V*CP)*QS1/(TTEMP*TTEMP)
60         COND = DQV/R1
61         QV(I,K,J) = QV(I,K,J) - COND
62         TTEMP = TTEMP + XLV/CP*COND
63         TH(I,K,J) = TTEMP/PII(I,K,J)
64         RAINNCV(I,J) = RHO(I,K,J)*COND*DZ8W(I,K,J)
65         RAINNC(I,J) = RAINNC(I,J) + RHO(I,K,J)*COND*DZ8W(I,K,J)
66       ENDIF
67    ENDDO
68    ENDDO
69    ENDDO
70   RETURN
72   END SUBROUTINE lscond
75 END MODULE module_mp_nconvp