Changeset 2041 for LMDZ5/trunk/libf/phylmd/cv3_vertmix.F90
- Timestamp:
- May 9, 2014, 2:01:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/cv3_vertmix.F90
r1992 r2041 1 SUBROUTINE cv3_vertmix(len, nd, iflag, plim1, plim2, p, ph, t, q, u, v, w, & 2 wi, nk, tmix, thmix, qmix, qsmix, umix, vmix, plcl) 1 SUBROUTINE cv3_vertmix(len, nd, iflag, plim1, plim2, p, ph, & 2 t, q, u, v, w, & 3 wi, nk, tmix, thmix, qmix, qsmix, umix, vmix, plcl) 3 4 ! ************************************************************** 4 5 ! * … … 13 14 ! ============================================================== 14 15 15 ! vertmix : determine theta et r du melange obtenu en brassant 16 ! adiabatiquement entre plim1 et plim2, avec une ponderation w. 16 ! vertmix : determines theta, t, q, qs, u and v of the mixture generated by 17 ! adiabatic mixing of air between plim1 and plim2 with weighting w. 18 ! If plim1 and plim2 fall within the same model layer, then theta, ... v 19 ! are those of that layer. 20 ! A minimum value (dpmin) is imposed upon plim1-plim2 17 21 18 22 ! =============================================================== … … 22 26 include "YOMCST.h" 23 27 include "FCTTRE.h" 24 ! input : 25 INTEGER nd, len 26 INTEGER nk(len), iflag(len) 27 REAL t(len, nd), q(len, nd), w(nd) 28 REAL u(len, nd), v(len, nd) 29 REAL p(len, nd), ph(len, nd+1) 30 REAL plim1(len), plim2(len) 31 ! output : 32 REAL tmix(len), thmix(len), qmix(len), wi(len, nd) 33 REAL umix(len), vmix(len) 34 REAL qsmix(len) 35 REAL plcl(len) 36 ! internal variables : 37 INTEGER j1(len), j2(len), niflag7 38 REAL a, b 39 REAL ahm(len), dpw(len), coef(len) 40 REAL p1(len, nd), p2(len, nd) 41 REAL rdcp(len), a2(len), b2(len), pnk(len) 42 REAL rh(len), chi(len) 43 REAL cpn 44 REAL x, y, p0, p0m1, zdelta, zcor 45 28 !inputs: 29 INTEGER, INTENT (IN) :: nd, len 30 INTEGER, DIMENSION (len), INTENT (IN) :: nk 31 REAL, DIMENSION (nd), INTENT (IN) :: w 32 REAL, DIMENSION (len), INTENT (IN) :: plim1, plim2 33 REAL, DIMENSION (len,nd), INTENT (IN) :: t, q 34 REAL, DIMENSION (len,nd), INTENT (IN) :: u, v 35 REAL, DIMENSION (len,nd), INTENT (IN) :: p 36 REAL, DIMENSION (len,nd+1), INTENT (IN) :: ph 37 !input/output: 38 INTEGER, DIMENSION (len), INTENT (INOUT) :: iflag 39 !outputs: 40 REAL, DIMENSION (len), INTENT (OUT) :: tmix, thmix, qmix 41 REAL, DIMENSION (len), INTENT (OUT) :: umix, vmix 42 REAL, DIMENSION (len), INTENT (OUT) :: qsmix 43 REAL, DIMENSION (len), INTENT (OUT) :: plcl 44 REAL, DIMENSION (len,nd), INTENT (OUT) :: wi 45 !internal variables : 46 46 INTEGER i, j 47 47 INTEGER niflag7 48 INTEGER, DIMENSION(len) :: j1, j2 49 REAL :: a, b 50 REAL :: cpn 51 REAL :: x, y, p0, p0m1, zdelta, zcor 52 REAL :: dpmin=1. 53 !$OMP THREADPRIVATE(dpmin) 54 REAL, DIMENSION(len) :: plim2p ! = min(plim2(:),plim1(:)-dpmin) 55 REAL, DIMENSION(len) :: ahm, dpw, coef 56 REAL, DIMENSION(len) :: rdcp, a2, b2, pnk 57 REAL, DIMENSION(len) :: rh, chi 58 REAL, DIMENSION(len) :: eqwght 59 REAL, DIMENSION(len,nd) :: p1, p2 60 61 62 !! print *,' ->cv3_vertmix, plim1,plim2 ', plim1,plim2 !jyg 63 plim2p(:) = min(plim2(:),plim1(:)-dpmin) 64 j1(:)=nd 65 j2(:) = 0 48 66 DO j = 1, nd 49 67 DO i = 1, len 50 68 IF (plim1(i)<=ph(i,j)) j1(i) = j 51 IF (plim2(i)>=ph(i,j+1) .AND. plim2(i)<ph(i,j)) j2(i) = j 69 !!! IF (plim2p(i)>=ph(i,j+1) .AND. plim2p(i)<ph(i,j)) j2(i) = j 70 IF (plim2p(i)< ph(i,j)) j2(i) = j 52 71 END DO 53 72 END DO … … 68 87 pnk(i) = p(i, nk(i)) 69 88 END DO 89 eqwght(:) = 0. 70 90 71 91 p0 = 1000. … … 73 93 74 94 DO i = 1, len 75 coef(i) = 1./(plim1(i)-plim2(i)) 76 END DO 95 IF (j2(i) < j1(i)) THEN 96 coef(i) = 1. 97 eqwght(i) = 1. 98 ELSE 99 coef(i) = 1./(plim1(i)-plim2p(i)) 100 ENDIF 101 END DO 102 103 !! print *,'cv3_vertmix, j1,j2,coef ', j1,j2,coef !jyg 77 104 78 105 DO j = 1, nd … … 80 107 IF (j>=j1(i) .AND. j<=j2(i)) THEN 81 108 p1(i, j) = min(ph(i,j), plim1(i)) 82 p2(i, j) = max(ph(i,j+1), plim2 (i))109 p2(i, j) = max(ph(i,j+1), plim2p(i)) 83 110 ! CRtest:couplage thermiques: deja normalise 84 111 ! wi(i,j) = w(j) 85 112 ! print*,'wi',wi(i,j) 86 wi(i, j) = w(j)*(p1(i,j)-p2(i,j))*coef(i) 113 wi(i, j) = w(j)*(p1(i,j)-p2(i,j))*coef(i)+eqwght(i) 87 114 dpw(i) = dpw(i) + wi(i, j) 115 116 !! print *,'cv3_vertmix, j, wi(1,j),dpw ', j, wi(1,j),dpw !jyg 117 88 118 END IF 89 119 END DO 90 120 END DO 121 91 122 ! CR:print 92 123 ! do i=1,len 93 ! print*,'plim',plim1(i),plim2 (i)124 ! print*,'plim',plim1(i),plim2p(i) 94 125 ! enddo 95 126 DO j = 1, nd … … 108 139 rdcp(i) = (rrd*(1.-qmix(i))+qmix(i)*rrv)/(cpd*(1.-qmix(i))+qmix(i)*cpv) 109 140 END DO 141 142 143 !! print *,'cv3_vertmix, rdcp ', rdcp !jyg 110 144 111 145 … … 159 193 rh(i) = max(rh(i), 0.) 160 194 plcl(i) = pnk(i)*(rh(i)**chi(i)) 161 IF (((plcl(i)<200.0) .OR. (plcl(i)>=2000.0)) .AND. (iflag(i)==0)) iflag&162 (i) = 8195 IF (((plcl(i)<200.0) .OR. (plcl(i)>=2000.0)) .AND. (iflag(i)==0)) & 196 iflag(i) = 8 163 197 164 198 ELSE 165 199 166 200 niflag7 = niflag7 + 1 167 plcl(i) = plim2 (i)201 plcl(i) = plim2p(i) 168 202 169 203 END IF ! iflag=7 … … 172 206 173 207 END DO 208 209 !! print *,' cv3_vertmix->' !jyg 210 174 211 175 212 RETURN
Note: See TracChangeset
for help on using the changeset viewer.