Changeset 2298 for LMDZ5/branches/testing/libf/phylmd/cv3_routines.F90
- Timestamp:
- Jun 14, 2015, 9:13:32 PM (9 years ago)
- Location:
- LMDZ5/branches/testing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/branches/testing
- Property svn:mergeinfo changed
/LMDZ5/trunk merged: 2238-2257,2259-2271,2273,2277-2282,2284-2288,2290-2291
- Property svn:mergeinfo changed
-
LMDZ5/branches/testing/libf/phylmd/cv3_routines.F90
r2220 r2298 5 5 6 6 7 SUBROUTINE cv3_param(nd, delt)7 SUBROUTINE cv3_param(nd, k_upper, delt) 8 8 9 9 use mod_phys_lmdz_para … … 36 36 include "conema3.h" 37 37 38 INTEGER nd 39 REAL delt ! timestep (seconds) 38 INTEGER, INTENT(IN) :: nd 39 INTEGER, INTENT(IN) :: k_upper 40 REAL, INTENT(IN) :: delt ! timestep (seconds) 40 41 41 42 … … 51 52 ! -- limit levels for convection: 52 53 53 noff = 1 54 !jyg< 55 ! noff is chosen such that nl = k_upper so that upmost loops end at about 22 km 56 ! 57 noff = min(max(nd-k_upper, 1), (nd+1)/2) 58 !! noff = 1 59 !>jyg 54 60 minorig = 1 55 61 nl = nd - noff … … 264 270 265 271 !inputs: 266 INTEGER len, nd 267 LOGICAL ok_conserv_q 268 REAL t(len, nd), q(len, nd), p(len, nd) 269 REAL u(len, nd), v(len, nd) 270 REAL hm(len, nd), gz(len, nd) 271 REAL ph(len, nd+1) 272 REAL p1feed(len) 273 ! , wght(len) 274 REAL wght(nd) 272 INTEGER, INTENT (IN) :: len, nd 273 LOGICAL, INTENT (IN) :: ok_conserv_q 274 REAL, DIMENSION (len, nd), INTENT (IN) :: t, q, p 275 REAL, DIMENSION (len, nd), INTENT (IN) :: u, v 276 REAL, DIMENSION (len, nd), INTENT (IN) :: hm, gz 277 REAL, DIMENSION (len, nd+1), INTENT (IN) :: ph 278 REAL, DIMENSION (len), INTENT (IN) :: p1feed 279 REAL, DIMENSION (nd), INTENT (IN) :: wght 275 280 !input-output 276 REAL p2feed(len)281 REAL, DIMENSION (len), INTENT (INOUT) :: p2feed 277 282 !outputs: 278 INTEGER iflag(len), nk(len), icb(len),icbmax279 ! real wghti(len) 280 REAL wghti(len, nd)281 REAL tnk(len), thnk(len), qnk(len), qsnk(len)282 REAL unk(len), vnk(len)283 REAL cpnk(len), hnk(len), gznk(len)284 REAL plcl(len)283 INTEGER, INTENT (OUT) :: icbmax 284 INTEGER, DIMENSION (len), INTENT (OUT) :: iflag, nk, icb 285 REAL, DIMENSION (len, nd), INTENT (OUT) :: wghti 286 REAL, DIMENSION (len), INTENT (OUT) :: tnk, thnk, qnk, qsnk 287 REAL, DIMENSION (len), INTENT (OUT) :: unk, vnk 288 REAL, DIMENSION (len), INTENT (OUT) :: cpnk, hnk, gznk 289 REAL, DIMENSION (len), INTENT (OUT) :: plcl 285 290 286 291 !local variables: … … 514 519 515 520 ! inputs: 516 INTEGER len, nd517 INTEGER icb(len)518 REAL t(len, nd), qs(len, nd), gz(len, nd)519 REAL tnk(len), qnk(len), gznk(len)520 REAL p(len, nd)521 REAL plcl(len)! convect3521 INTEGER, INTENT (IN) :: len, nd 522 INTEGER, DIMENSION (len), INTENT (IN) :: icb 523 REAL, DIMENSION (len, nd), INTENT (IN) :: t, qs, gz 524 REAL, DIMENSION (len), INTENT (IN) :: tnk, qnk, gznk 525 REAL, DIMENSION (len, nd), INTENT (IN) :: p 526 REAL, DIMENSION (len), INTENT (IN) :: plcl ! convect3 522 527 523 528 ! outputs: 524 REAL tp(len, nd), tvp(len, nd), clw(len, nd) 529 INTEGER, DIMENSION (len), INTENT (OUT) :: icbs 530 REAL, DIMENSION (len, nd), INTENT (OUT) :: tp, tvp, clw 525 531 526 532 ! local variables: 527 533 INTEGER i, k 528 INTEGER icb1(len), icbs (len), icbsmax2! convect3534 INTEGER icb1(len), icbsmax2 ! convect3 529 535 REAL tg, qg, alv, s, ahg, tc, denom, es, rg 530 536 REAL ah0(len), cpp(len) 531 537 REAL ticb(len), gzicb(len) 532 REAL qsicb(len) ! convect3533 REAL cpinv(len) ! convect3538 REAL qsicb(len) ! convect3 539 REAL cpinv(len) ! convect3 534 540 535 541 ! ------------------------------------------------------------------- … … 1051 1057 1052 1058 !inputs: 1053 INTEGER ncum, nd, nloc, j 1054 INTEGER icb(nloc), icbs(nloc), nk(nloc) 1055 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), gz(nloc, nd) 1056 REAL p(nloc, nd) 1057 REAL tnk(nloc), qnk(nloc), gznk(nloc) 1058 REAL hnk(nloc) 1059 REAL lv(nloc, nd), lf(nloc, nd), tv(nloc, nd), h(nloc, nd) 1060 REAL pbase(nloc), buoybase(nloc), plcl(nloc) 1059 INTEGER, INTENT (IN) :: ncum, nd, nloc 1060 INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, icbs, nk 1061 REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, q, qs, gz 1062 REAL, DIMENSION (nloc, nd), INTENT (IN) :: p 1063 REAL, DIMENSION (nloc), INTENT (IN) :: tnk, qnk, gznk 1064 REAL, DIMENSION (nloc), INTENT (IN) :: hnk 1065 REAL, DIMENSION (nloc, nd), INTENT (IN) :: lv, lf, tv, h 1066 REAL, DIMENSION (nloc), INTENT (IN) :: pbase, buoybase, plcl 1067 1068 !input/outputs: 1069 REAL, DIMENSION (nloc, nd), INTENT (INOUT) :: tp, tvp, clw ! Input for k = 1, icb+1 (computed in cv3_undilute1) 1070 ! Output above 1061 1071 1062 1072 !outputs: 1063 INTEGER inb(nloc) 1064 REAL tp(nloc, nd), tvp(nloc, nd), clw(nloc, nd) 1065 REAL ep(nloc, nd), sigp(nloc, nd), hp(nloc, nd) 1066 REAL buoy(nloc, nd) 1073 INTEGER, DIMENSION (nloc), INTENT (OUT) :: inb 1074 REAL, DIMENSION (nloc, nd), INTENT (OUT) :: ep, sigp, hp 1075 REAL, DIMENSION (nloc, nd), INTENT (OUT) :: buoy 1067 1076 1068 1077 !local variables: 1069 INTEGER i, k1078 INTEGER i, j, k 1070 1079 REAL tg, qg, ahg, alv, alf, s, tc, es, esi, denom, rg, tca, elacrit 1071 1080 REAL als … … 1084 1093 DO k = 1, nl 1085 1094 DO i = 1, ncum 1086 ep(i, k) = 0.01087 sigp(i, k) = spfac1088 1095 qi(i, k) = 0. 1089 1096 END DO … … 1187 1194 END IF 1188 1195 END IF 1189 END IF 1196 !jyg< 1197 !! END IF ! Endif moved to the end of the loop 1198 !>jyg 1190 1199 1191 1200 IF (cvflag_ice) THEN … … 1258 1267 END IF 1259 1268 END IF ! (cvflag_ice) 1260 1269 !jyg< 1270 END IF ! (k>=(icbs(i)+1)) 1271 !>jyg 1261 1272 END DO 1262 1273 END DO … … 1267 1278 ! --- THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I) 1268 1279 ! ===================================================================== 1269 1280 ! 1281 !jyg< 1282 DO k = 1, nl 1283 DO i = 1, ncum 1284 ep(i, k) = 0.0 1285 sigp(i, k) = spfac 1286 END DO 1287 END DO 1288 !>jyg 1289 ! 1270 1290 IF (flag_epkeorig/=1) THEN 1271 1291 DO k = 1, nl ! convect3 1272 1292 DO i = 1, ncum 1273 pden = ptcrit - pbcrit 1274 ep(i, k) = (plcl(i)-p(i,k)-pbcrit)/pden*epmax 1275 ep(i, k) = max(ep(i,k), 0.0) 1276 ep(i, k) = min(ep(i,k), epmax) 1277 sigp(i, k) = spfac 1293 !jyg< 1294 IF(k>=icb(i)) THEN 1295 !>jyg 1296 pden = ptcrit - pbcrit 1297 ep(i, k) = (plcl(i)-p(i,k)-pbcrit)/pden*epmax 1298 ep(i, k) = max(ep(i,k), 0.0) 1299 ep(i, k) = min(ep(i,k), epmax) 1300 !! sigp(i, k) = spfac ! jyg 1301 ENDIF ! (k>=icb(i)) 1278 1302 END DO 1279 1303 END DO … … 1281 1305 DO k = 1, nl 1282 1306 DO i = 1, ncum 1283 IF (k>=(nk(i)+1)) THEN 1307 IF(k>=icb(i)) THEN 1308 !! IF (k>=(nk(i)+1)) THEN 1309 !>jyg 1284 1310 tca = tp(i, k) - t0 1285 1311 IF (tca>=0.0) THEN … … 1292 1318 ep(i, k) = max(ep(i,k), 0.0) 1293 1319 ep(i, k) = min(ep(i,k), epmax) 1294 sigp(i, k) = spfac 1295 END IF 1320 !! sigp(i, k) = spfac ! jyg 1321 END IF ! (k>=icb(i)) 1296 1322 END DO 1297 1323 END DO 1298 1324 END IF 1325 ! 1299 1326 ! ===================================================================== 1300 1327 ! --- CALCULATE VIRTUAL TEMPERATURE AND LIFTED PARCEL … … 1331 1358 ! first estimate of buoyancy: 1332 1359 1333 DO i = 1, ncum 1334 DO k = 1, nl 1360 !jyg : k-loop outside i-loop (07042015) 1361 DO k = 1, nl 1362 DO i = 1, ncum 1335 1363 buoy(i, k) = tvp(i, k) - tv(i, k) 1336 1364 END DO … … 1340 1368 ! for safety, set buoy(icb)=buoybase 1341 1369 1342 DO i = 1, ncum 1343 DO k = 1, nl 1370 !jyg : k-loop outside i-loop (07042015) 1371 DO k = 1, nl 1372 DO i = 1, ncum 1344 1373 IF ((k>=icb(i)) .AND. (k<=nl) .AND. (p(i,k)>=pbase(i))) THEN 1345 1374 buoy(i, k) = buoybase(i) 1346 1375 END IF 1347 1376 END DO 1377 END DO 1378 DO i = 1, ncum 1348 1379 ! buoy(icb(i),k)=buoybase(i) 1349 1380 buoy(i, icb(i)) = buoybase(i) … … 1490 1521 END DO 1491 1522 1492 DO k = minorig + 1, nl 1493 DO i = 1, ncum 1494 IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN 1495 1496 IF (cvflag_ice) THEN 1523 !jyg : cvflag_ice test outside the loops (07042015) 1524 ! 1525 IF (cvflag_ice) THEN 1526 ! 1527 DO k = minorig + 1, nl 1528 DO i = 1, ncum 1529 IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN 1497 1530 frac(i, k) = 1. - (t(i,k)-243.15)/(263.15-243.15) 1498 1531 frac(i, k) = min(max(frac(i,k),0.0), 1.0) 1499 1532 hp(i, k) = hnk(i) + (lv(i,k)+(cpd-cpv)*t(i,k)+frac(i,k)*lf(i,k))* & 1500 1533 ep(i, k)*clw(i, k) 1501 1502 ELSE 1534 END IF 1535 END DO 1536 END DO 1537 ! 1538 ELSE 1539 ! 1540 DO k = minorig + 1, nl 1541 DO i = 1, ncum 1542 IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN 1503 1543 hp(i, k) = hnk(i) + (lv(i,k)+(cpd-cpv)*t(i,k))*ep(i, k)*clw(i, k) 1504 1544 END IF 1505 1506 END IF1507 END DO 1508 END DO1545 END DO 1546 END DO 1547 ! 1548 END IF ! (cvflag_ice) 1509 1549 1510 1550 RETURN … … 1768 1808 1769 1809 !inputs: 1770 INTEGER ncum, nd, na, ntra, nloc1771 INTEGER icb(nloc), inb(nloc), nk(nloc)1772 REAL sig(nloc, nd)1773 REAL qnk(nloc), unk(nloc), vnk(nloc)1774 REAL ph(nloc, nd+1)1775 REAL t(nloc, nd), rr(nloc, nd), rs(nloc, nd)1776 REAL u(nloc, nd), v(nloc, nd)1777 REAL tra(nloc, nd, ntra)! input of convect31778 REAL lv(nloc, na), h(nloc, na), hp(nloc, na)1779 REAL lf(nloc, na), frac(nloc, na)1780 REAL tv(nloc, na), tvp(nloc, na), ep(nloc, na), clw(nloc, na)1781 REAL m(nloc, na)! input of convect31810 INTEGER, INTENT (IN) :: ncum, nd, na, ntra, nloc 1811 INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, inb, nk 1812 REAL, DIMENSION (nloc, nd), INTENT (IN) :: sig 1813 REAL, DIMENSION (nloc), INTENT (IN) :: qnk, unk, vnk 1814 REAL, DIMENSION (nloc, nd+1), INTENT (IN) :: ph 1815 REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, rr, rs 1816 REAL, DIMENSION (nloc, nd), INTENT (IN) :: u, v 1817 REAL, DIMENSION (nloc, nd, ntra), INTENT (IN) :: tra ! input of convect3 1818 REAL, DIMENSION (nloc, na), INTENT (IN) :: lv, h, hp 1819 REAL, DIMENSION (nloc, na), INTENT (IN) :: lf, frac 1820 REAL, DIMENSION (nloc, na), INTENT (IN) :: tv, tvp, ep, clw 1821 REAL, DIMENSION (nloc, na), INTENT (IN) :: m ! input of convect3 1782 1822 1783 1823 !outputs: 1784 REAL ment(nloc, na, na), qent(nloc, na, na) 1785 REAL uent(nloc, na, na), vent(nloc, na, na) 1786 REAL sij(nloc, na, na), elij(nloc, na, na) 1787 REAL traent(nloc, nd, nd, ntra) 1788 REAL ments(nloc, nd, nd), qents(nloc, nd, nd) 1789 REAL sigij(nloc, nd, nd) 1790 INTEGER nent(nloc, nd) 1824 REAL, DIMENSION (nloc, na, na), INTENT (OUT) :: ment, qent 1825 REAL, DIMENSION (nloc, na, na), INTENT (OUT) :: uent, vent 1826 REAL, DIMENSION (nloc, na, na), INTENT (OUT) :: sij, elij 1827 REAL, DIMENSION (nloc, nd, nd, ntra), INTENT (OUT) :: traent 1828 REAL, DIMENSION (nloc, nd, nd), INTENT (OUT) :: ments, qents 1829 INTEGER, DIMENSION (nloc, nd), INTENT (OUT) :: nent 1791 1830 1792 1831 !local variables: … … 1797 1836 REAL asij(nloc), smax(nloc), scrit(nloc) 1798 1837 REAL asum(nloc, nd), bsum(nloc, nd), csum(nloc, nd) 1838 REAL sigij(nloc, nd, nd) 1799 1839 REAL wgh 1800 1840 REAL zm(nloc, na) … … 2184 2224 include "cv3param.h" 2185 2225 include "cvflag.h" 2226 include "nuage.h" 2186 2227 2187 2228 !inputs: … … 2363 2404 2364 2405 IF (cvflag_ice) THEN 2365 thaw = (t(il,i)-273.15)/(275.15-273.15) 2406 !CR:tmax_fonte_cv: T for which ice is totally melted (used to be 275.15) 2407 thaw = (t(il,i)-273.15)/(tmax_fonte_cv-273.15) 2366 2408 thaw = min(max(thaw,0.0), 1.0) 2367 2409 frac(il, i) = frac(il, i)*(1.-thaw) … … 2477 2519 f6 = -100.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*evap(il, i) 2478 2520 2479 thaw = (t(il,i)-273.15)/(275.15-273.15) 2521 !CR:tmax_fonte_cv: T for which ice is totally melted (used to be 275.15) 2522 thaw = (t(il,i)-273.15)/(tmax_fonte_cv-273.15) 2480 2523 thaw = min(max(thaw,0.0), 1.0) 2481 2524 water(il, i) = water(il, i+1) + (1-fraci(il,i))*d6 … … 2763 2806 iflag, precip, Vprecip, ft, fr, fu, fv, ftra, & 2764 2807 cbmf, upwd, dnwd, dnwd0, ma, mip, & 2765 tls, tps, qcondc, wd, & 2808 !! tls, tps, ! useless . jyg 2809 qcondc, wd, & 2766 2810 ftd, fqd, qnk, qtc, sigt, tau_cld_cv, coefw_cld_cv) 2767 2811 … … 2811 2855 REAL dnwd0(nloc, nd), mip(nloc, nd) 2812 2856 REAL Vprecip(nloc, nd+1) 2813 REAL tls(nloc, nd), tps(nloc, nd) 2857 !! REAL tls(nloc, nd), tps(nloc, nd) ! useless . jyg 2814 2858 REAL qcondc(nloc, nd) ! cld 2815 2859 REAL qtc(nloc,nd), sigt(nloc,nd) ! cld … … 2823 2867 REAL cpinv, rdcp, dpinv 2824 2868 REAL awat(nloc) 2825 REAL lvcp(nloc, na), lfcp(nloc, na) , mke(nloc, na)2869 REAL lvcp(nloc, na), lfcp(nloc, na) ! , mke(nloc, na) ! unused . jyg 2826 2870 REAL am(nloc), work(nloc), ad(nloc), amp1(nloc) 2827 2871 !! real up1(nloc), dn1(nloc) … … 3588 3632 ! *** reset counter and return *** 3589 3633 3634 ! Reset counter only for points actually convective (jyg) 3635 ! In order take into account the possibility of changing the compression, 3636 ! reset m, sig and w0 to zero for non-convecting points. 3590 3637 DO il = 1, ncum 3591 sig(il, nd) = 2.0 3638 IF (iflag(il) < 3) THEN 3639 sig(il, nd) = 2.0 3640 ENDIF 3592 3641 END DO 3593 3642 … … 3743 3792 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 3744 3793 3745 DO i = 1, nd 3746 DO il = 1, ncum 3747 mke(il, i) = upwd(il, i) + dnwd(il, i) 3748 END DO 3749 END DO 3750 3751 DO i = 1, nd 3752 DO il = 1, ncum 3753 rdcp = (rrd*(1.-rr(il,i))-rr(il,i)*rrv)/(cpd*(1.-rr(il,i))+rr(il,i)*cpv) 3754 tls(il, i) = t(il, i)*(1000.0/p(il,i))**rdcp 3755 tps(il, i) = tp(il, i) 3756 END DO 3757 END DO 3794 !! DO i = 1, nd ! unused . jyg 3795 !! DO il = 1, ncum ! unused . jyg 3796 !! mke(il, i) = upwd(il, i) + dnwd(il, i) ! unused . jyg 3797 !! END DO ! unused . jyg 3798 !! END DO ! unused . jyg 3799 3800 !! DO i = 1, nd ! unused . jyg 3801 !! DO il = 1, ncum ! unused . jyg 3802 !! rdcp = (rrd*(1.-rr(il,i))-rr(il,i)*rrv)/(cpd*(1.-rr(il,i))+rr(il,i)*cpv) ! unused . jyg 3803 !! tls(il, i) = t(il, i)*(1000.0/p(il,i))**rdcp ! unused . jyg 3804 !! tps(il, i) = tp(il, i) ! unused . jyg 3805 !! END DO ! unused . jyg 3806 !! END DO ! unused . jyg 3758 3807 3759 3808
Note: See TracChangeset
for help on using the changeset viewer.