Changeset 5132 for LMDZ6/branches/Amaury_dev/libf/phylmdiso
- Timestamp:
- Jul 26, 2024, 12:23:19 PM (4 months ago)
- Location:
- LMDZ6/branches/Amaury_dev
- Files:
-
- 17 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev
- Property svn:mergeinfo changed
/LMDZ6/trunk (added) merged: 5085,5097,5109,5121,5124-5127
- Property svn:mergeinfo changed
-
LMDZ6/branches/Amaury_dev/libf/phylmdiso/change_srf_frac_mod.F90
r5112 r5132 3 3 4 4 MODULE change_srf_frac_mod 5 5 USE lmdz_abort_physic, ONLY: abort_physic 6 6 IMPLICIT NONE 7 7 -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/cv30_routines.F90
r5117 r5132 946 946 ) 947 947 USE lmdz_print_control, ONLY: lunout 948 USE lmdz_abort_physic, ONLY: abort_physic 948 949 #ifdef ISO 949 950 USE infotrac_phy, ONLY: ntraciso=>ntiso … … 1132 1133 ) 1133 1134 ! epmax_cape: ajout arguments 1135 USE lmdz_abort_physic, ONLY: abort_physic 1134 1136 #ifdef ISO 1135 1137 USE infotrac_phy, ONLY: ntraciso=>ntiso … … 6333 6335 ,cape,ep,hp,icb,inb,clw,nk,t,h,lv & 6334 6336 ,epmax_diag) 6337 USE lmdz_abort_physic, ONLY: abort_physic 6335 6338 IMPLICIT NONE 6336 6339 -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/cv3_routines.F90
r5117 r5132 1266 1266 ) 1267 1267 USE lmdz_print_control, ONLY: lunout 1268 1269 USE lmdz_abort_physic, ONLY: abort_physic 1268 1270 #ifdef ISO 1269 1271 USE infotrac_phy, ONLY: ntraciso=>ntiso … … 1464 1466 ) 1465 1467 USE lmdz_print_control, ONLY: prt_level 1468 USE lmdz_abort_physic, ONLY: abort_physic 1466 1469 #ifdef ISO 1467 1470 USE infotrac_phy, ONLY: ntraciso=>ntiso … … 3584 3587 ) 3585 3588 USE lmdz_print_control, ONLY: prt_level, lunout 3589 USE lmdz_abort_physic, ONLY: abort_physic 3586 3590 #ifdef ISO 3587 3591 USE infotrac_phy, ONLY: ntraciso=>ntiso -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/cv3a_compress.F90
r5117 r5132 40 40 #endif 41 41 #endif 42 42 USE lmdz_abort_physic, ONLY: abort_physic 43 43 IMPLICIT NONE 44 44 -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/cv_routines.F90
r5117 r5132 1 2 1 ! $Id$ 3 2 … … 38 37 include "cvparam.h" 39 38 INTEGER nd 40 CHARACTER (LEN =20) :: modname = 'cv_routines'41 CHARACTER (LEN =80) :: abort_message39 CHARACTER (LEN = 20) :: modname = 'cv_routines' 40 CHARACTER (LEN = 80) :: abort_message 42 41 43 42 ! noff: integer limit for convection (nd-noff) … … 71 70 delta = 0.01 ! cld 72 71 73 74 72 END SUBROUTINE cv_param 75 73 … … 96 94 include "cvparam.h" 97 95 98 99 96 DO k = 1, nlp 100 97 DO i = 1, len 101 lv(i, k) = lv0 - clmcpv *(t(i,k)-t0)102 cpn(i, k) = cpd *(1.0-q(i,k)) + cpv*q(i, k)103 cpx(i, k) = cpd *(1.0-q(i,k)) + cl*q(i, k)104 tv(i, k) = t(i, k) *(1.0+q(i,k)*epsim1)98 lv(i, k) = lv0 - clmcpv * (t(i, k) - t0) 99 cpn(i, k) = cpd * (1.0 - q(i, k)) + cpv * q(i, k) 100 cpx(i, k) = cpd * (1.0 - q(i, k)) + cl * q(i, k) 101 tv(i, k) = t(i, k) * (1.0 + q(i, k) * epsim1) 105 102 END DO 106 103 END DO … … 113 110 DO k = 2, nlp 114 111 DO i = 1, len 115 gz(i, k) = gz(i, k -1) + hrd*(tv(i,k-1)+tv(i,k))*(p(i,k-1)-p(i,k))/ph(i, &116 k)112 gz(i, k) = gz(i, k - 1) + hrd * (tv(i, k - 1) + tv(i, k)) * (p(i, k - 1) - p(i, k)) / ph(i, & 113 k) 117 114 END DO 118 115 END DO … … 123 120 DO k = 1, nlp 124 121 DO i = 1, len 125 h(i, k) = gz(i, k) + cpn(i, k)*t(i, k) 126 hm(i, k) = gz(i, k) + cpx(i, k)*(t(i,k)-t(i,1)) + lv(i, k)*q(i, k) 127 END DO 128 END DO 129 122 h(i, k) = gz(i, k) + cpn(i, k) * t(i, k) 123 hm(i, k) = gz(i, k) + cpx(i, k) * (t(i, k) - t(i, 1)) + lv(i, k) * q(i, k) 124 END DO 125 END DO 130 126 131 127 END SUBROUTINE cv_prelim 132 128 133 129 SUBROUTINE cv_feed(len, nd, t, q, qs, p, hm, gz, nk, icb, icbmax, iflag, tnk, & 134 qnk, gznk, plcl)130 qnk, gznk, plcl) 135 131 IMPLICIT NONE 136 132 … … 169 165 DO k = 2, nlp 170 166 DO i = 1, len 171 IF ((hm(i, k)<work(i)) .AND. (hm(i,k)<hm(i,k-1))) THEN167 IF ((hm(i, k)<work(i)) .AND. (hm(i, k)<hm(i, k - 1))) THEN 172 168 work(i) = hm(i, k) 173 169 ihmin(i) = k … … 193 189 DO k = minorig + 1, nl 194 190 DO i = 1, len 195 IF ((hm(i, k)>work(i)) .AND. (k<=ihmin(i))) THEN191 IF ((hm(i, k)>work(i)) .AND. (k<=ihmin(i))) THEN 196 192 work(i) = hm(i, k) 197 193 nk(i) = k … … 204 200 ! ------------------------------------------------------------------- 205 201 DO i = 1, len 206 IF (((t(i, nk(i))<250.0) .OR. (q(i,nk(i))<=0.0) .OR. (p(i,ihmin(i))< &207 400.0)) .AND. (iflag(i)==0)) iflag(i) = 7202 IF (((t(i, nk(i))<250.0) .OR. (q(i, nk(i))<=0.0) .OR. (p(i, ihmin(i))< & 203 400.0)) .AND. (iflag(i)==0)) iflag(i) = 7 208 204 END DO 209 205 ! ------------------------------------------------------------------- … … 218 214 qsnk(i) = qs(i, nk(i)) 219 215 220 rh(i) = qnk(i) /qsnk(i)216 rh(i) = qnk(i) / qsnk(i) 221 217 rh(i) = min(1.0, rh(i)) 222 chi(i) = tnk(i) /(1669.0-122.0*rh(i)-tnk(i))223 plcl(i) = pnk(i) *(rh(i)**chi(i))218 chi(i) = tnk(i) / (1669.0 - 122.0 * rh(i) - tnk(i)) 219 plcl(i) = pnk(i) * (rh(i)**chi(i)) 224 220 IF (((plcl(i)<200.0) .OR. (plcl(i)>=2000.0)) .AND. (iflag(i)==0)) iflag(i & 225 ) = 8221 ) = 8 226 222 END DO 227 223 ! ------------------------------------------------------------------- … … 234 230 DO k = minorig, nl 235 231 DO i = 1, len 236 IF ((k>=(nk(i) +1)) .AND. (p(i,k)<plcl(i))) icb(i) = min(icb(i), k)232 IF ((k>=(nk(i) + 1)) .AND. (p(i, k)<plcl(i))) icb(i) = min(icb(i), k) 237 233 END DO 238 234 END DO … … 249 245 END DO 250 246 251 252 247 END SUBROUTINE cv_feed 253 248 254 249 SUBROUTINE cv_undilute1(len, nd, t, q, qs, gz, p, nk, icb, icbmax, tp, tvp, & 255 clw)250 clw) 256 251 IMPLICIT NONE 257 252 … … 292 287 293 288 DO i = 1, len 294 ah0(i) = (cpd *(1.-qnk(i))+cl*qnk(i))*tnk(i) + qnk(i)*(lv0-clmcpv*(tnk(i)- &295 273.15)) + gznk(i)296 cpp(i) = cpd *(1.-qnk(i)) + qnk(i)*cpv289 ah0(i) = (cpd * (1. - qnk(i)) + cl * qnk(i)) * tnk(i) + qnk(i) * (lv0 - clmcpv * (tnk(i) - & 290 273.15)) + gznk(i) 291 cpp(i) = cpd * (1. - qnk(i)) + qnk(i) * cpv 297 292 END DO 298 293 … … 301 296 DO k = minorig, icbmax - 1 302 297 DO i = 1, len 303 tp(i, k) = tnk(i) - (gz(i, k)-gznk(i))/cpp(i)304 tvp(i, k) = tp(i, k) *(1.+qnk(i)*epsi)298 tp(i, k) = tnk(i) - (gz(i, k) - gznk(i)) / cpp(i) 299 tvp(i, k) = tp(i, k) * (1. + qnk(i) * epsi) 305 300 END DO 306 301 END DO … … 311 306 tg = ticb(i) 312 307 qg = qs(i, icb(i)) 313 alv = lv0 - clmcpv *(ticb(i)-t0)308 alv = lv0 - clmcpv * (ticb(i) - t0) 314 309 315 310 ! First iteration. 316 311 317 s = cpd + alv *alv*qg/(rrv*ticb(i)*ticb(i))318 s = 1. /s319 ahg = cpd *tg + (cl-cpd)*qnk(i)*ticb(i) + alv*qg + gzicb(i)320 tg = tg + s *(ah0(i)-ahg)312 s = cpd + alv * alv * qg / (rrv * ticb(i) * ticb(i)) 313 s = 1. / s 314 ahg = cpd * tg + (cl - cpd) * qnk(i) * ticb(i) + alv * qg + gzicb(i) 315 tg = tg + s * (ah0(i) - ahg) 321 316 tg = max(tg, 35.0) 322 317 tc = tg - t0 323 318 denom = 243.5 + tc 324 319 IF (tc>=0.0) THEN 325 es = 6.112 *exp(17.67*tc/denom)320 es = 6.112 * exp(17.67 * tc / denom) 326 321 ELSE 327 es = exp(23.33086 -6111.72784/tg+0.15215*log(tg))322 es = exp(23.33086 - 6111.72784 / tg + 0.15215 * log(tg)) 328 323 END IF 329 qg = eps *es/(p(i,icb(i))-es*(1.-eps))324 qg = eps * es / (p(i, icb(i)) - es * (1. - eps)) 330 325 331 326 ! Second iteration. 332 327 333 s = cpd + alv *alv*qg/(rrv*ticb(i)*ticb(i))334 s = 1. /s335 ahg = cpd *tg + (cl-cpd)*qnk(i)*ticb(i) + alv*qg + gzicb(i)336 tg = tg + s *(ah0(i)-ahg)328 s = cpd + alv * alv * qg / (rrv * ticb(i) * ticb(i)) 329 s = 1. / s 330 ahg = cpd * tg + (cl - cpd) * qnk(i) * ticb(i) + alv * qg + gzicb(i) 331 tg = tg + s * (ah0(i) - ahg) 337 332 tg = max(tg, 35.0) 338 333 tc = tg - t0 339 334 denom = 243.5 + tc 340 335 IF (tc>=0.0) THEN 341 es = 6.112 *exp(17.67*tc/denom)336 es = 6.112 * exp(17.67 * tc / denom) 342 337 ELSE 343 es = exp(23.33086 -6111.72784/tg+0.15215*log(tg))338 es = exp(23.33086 - 6111.72784 / tg + 0.15215 * log(tg)) 344 339 END IF 345 qg = eps *es/(p(i,icb(i))-es*(1.-eps))346 347 alv = lv0 - clmcpv *(ticb(i)-273.15)348 tp(i, icb(i)) = (ah0(i) -(cl-cpd)*qnk(i)*ticb(i)-gz(i,icb(i))-alv*qg)/cpd340 qg = eps * es / (p(i, icb(i)) - es * (1. - eps)) 341 342 alv = lv0 - clmcpv * (ticb(i) - 273.15) 343 tp(i, icb(i)) = (ah0(i) - (cl - cpd) * qnk(i) * ticb(i) - gz(i, icb(i)) - alv * qg) / cpd 349 344 clw(i, icb(i)) = qnk(i) - qg 350 clw(i, icb(i)) = max(0.0, clw(i, icb(i)))351 rg = qg /(1.-qnk(i))352 tvp(i, icb(i)) = tp(i, icb(i)) *(1.+rg*epsi)345 clw(i, icb(i)) = max(0.0, clw(i, icb(i))) 346 rg = qg / (1. - qnk(i)) 347 tvp(i, icb(i)) = tp(i, icb(i)) * (1. + rg * epsi) 353 348 END DO 354 349 355 350 DO k = minorig, icbmax 356 351 DO i = 1, len 357 tvp(i, k) = tvp(i, k) - tp(i, k)*qnk(i) 358 END DO 359 END DO 360 352 tvp(i, k) = tvp(i, k) - tp(i, k) * qnk(i) 353 END DO 354 END DO 361 355 362 356 END SUBROUTINE cv_undilute1 … … 383 377 INTEGER i 384 378 385 386 379 DO i = 1, len 387 380 IF ((cbmf(i)==0.0) .AND. (iflag(i)==0) .AND. (tvp(i, & 388 icb(i))<=(tv(i,icb(i))-dtmax))) iflag(i) = 4 389 END DO 390 381 icb(i))<=(tv(i, icb(i)) - dtmax))) iflag(i) = 4 382 END DO 391 383 392 384 END SUBROUTINE cv_trigger 393 385 394 386 SUBROUTINE cv_compress(len, nloc, ncum, nd, iflag1, nk1, icb1, cbmf1, plcl1, & 395 tnk1, qnk1, gznk1, t1, q1, qs1, u1, v1, gz1, h1, lv1, cpn1, p1, ph1, tv1, &396 tp1, tvp1, clw1, iflag, nk, icb, cbmf, plcl, tnk, qnk, gznk, t, q, qs, u, &397 v, gz, h, lv, cpn, p, ph, tv, tp, tvp, clw, dph)387 tnk1, qnk1, gznk1, t1, q1, qs1, u1, v1, gz1, h1, lv1, cpn1, p1, ph1, tv1, & 388 tp1, tvp1, clw1, iflag, nk, icb, cbmf, plcl, tnk, qnk, gznk, t, q, qs, u, & 389 v, gz, h, lv, cpn, p, ph, tv, tp, tvp, clw, dph) 398 390 USE lmdz_print_control, ONLY: lunout 391 USE lmdz_abort_physic, ONLY: abort_physic 399 392 IMPLICIT NONE 400 393 … … 407 400 REAL t1(len, nd), q1(len, nd), qs1(len, nd), u1(len, nd), v1(len, nd) 408 401 REAL gz1(len, nd), h1(len, nd), lv1(len, nd), cpn1(len, nd) 409 REAL p1(len, nd), ph1(len, nd +1), tv1(len, nd), tp1(len, nd)402 REAL p1(len, nd), ph1(len, nd + 1), tv1(len, nd), tp1(len, nd) 410 403 REAL tvp1(len, nd), clw1(len, nd) 411 404 … … 415 408 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), u(nloc, nd), v(nloc, nd) 416 409 REAL gz(nloc, nd), h(nloc, nd), lv(nloc, nd), cpn(nloc, nd) 417 REAL p(nloc, nd), ph(nloc, nd +1), tv(nloc, nd), tp(nloc, nd)410 REAL p(nloc, nd), ph(nloc, nd + 1), tv(nloc, nd), tp(nloc, nd) 418 411 REAL tvp(nloc, nd), clw(nloc, nd) 419 412 REAL dph(nloc, nd) … … 421 414 ! local variables: 422 415 INTEGER i, k, nn 423 CHARACTER (LEN=20) :: modname = 'cv_compress' 424 CHARACTER (LEN=80) :: abort_message 425 416 CHARACTER (LEN = 20) :: modname = 'cv_compress' 417 CHARACTER (LEN = 80) :: abort_message 426 418 427 419 DO k = 1, nl + 1 … … 472 464 DO k = 1, nl 473 465 DO i = 1, ncum 474 dph(i, k) = ph(i, k) - ph(i, k+1) 475 END DO 476 END DO 477 466 dph(i, k) = ph(i, k) - ph(i, k + 1) 467 END DO 468 END DO 478 469 479 470 END SUBROUTINE cv_compress 480 471 481 472 SUBROUTINE cv_undilute2(nloc, ncum, nd, icb, nk, tnk, qnk, gznk, t, q, qs, & 482 gz, p, dph, h, tv, lv, inb, inb1, tp, tvp, clw, hp, ep, sigp, frac)473 gz, p, dph, h, tv, lv, inb, inb1, tp, tvp, clw, hp, ep, sigp, frac) 483 474 IMPLICIT NONE 484 475 … … 537 528 ! *** Calculate certain parcel quantities, including static energy *** 538 529 539 540 DO i = 1, ncum 541 ah0(i) = (cpd*(1.-qnk(i))+cl*qnk(i))*tnk(i) + qnk(i)*(lv0-clmcpv*(tnk(i)- & 542 t0)) + gznk(i) 530 DO i = 1, ncum 531 ah0(i) = (cpd * (1. - qnk(i)) + cl * qnk(i)) * tnk(i) + qnk(i) * (lv0 - clmcpv * (tnk(i) - & 532 t0)) + gznk(i) 543 533 END DO 544 534 … … 546 536 ! *** Find lifted parcel quantities above cloud base *** 547 537 548 549 538 DO k = minorig + 1, nl 550 539 DO i = 1, ncum 551 IF (k>=(icb(i) +1)) THEN540 IF (k>=(icb(i) + 1)) THEN 552 541 tg = t(i, k) 553 542 qg = qs(i, k) 554 alv = lv0 - clmcpv *(t(i,k)-t0)543 alv = lv0 - clmcpv * (t(i, k) - t0) 555 544 556 545 ! First iteration. 557 546 558 s = cpd + alv *alv*qg/(rrv*t(i,k)*t(i,k))559 s = 1. /s560 ahg = cpd *tg + (cl-cpd)*qnk(i)*t(i, k) + alv*qg + gz(i, k)561 tg = tg + s *(ah0(i)-ahg)547 s = cpd + alv * alv * qg / (rrv * t(i, k) * t(i, k)) 548 s = 1. / s 549 ahg = cpd * tg + (cl - cpd) * qnk(i) * t(i, k) + alv * qg + gz(i, k) 550 tg = tg + s * (ah0(i) - ahg) 562 551 tg = max(tg, 35.0) 563 552 tc = tg - t0 564 553 denom = 243.5 + tc 565 554 IF (tc>=0.0) THEN 566 es = 6.112 *exp(17.67*tc/denom)555 es = 6.112 * exp(17.67 * tc / denom) 567 556 ELSE 568 es = exp(23.33086 -6111.72784/tg+0.15215*log(tg))557 es = exp(23.33086 - 6111.72784 / tg + 0.15215 * log(tg)) 569 558 END IF 570 qg = eps *es/(p(i,k)-es*(1.-eps))559 qg = eps * es / (p(i, k) - es * (1. - eps)) 571 560 572 561 ! Second iteration. 573 562 574 s = cpd + alv *alv*qg/(rrv*t(i,k)*t(i,k))575 s = 1. /s576 ahg = cpd *tg + (cl-cpd)*qnk(i)*t(i, k) + alv*qg + gz(i, k)577 tg = tg + s *(ah0(i)-ahg)563 s = cpd + alv * alv * qg / (rrv * t(i, k) * t(i, k)) 564 s = 1. / s 565 ahg = cpd * tg + (cl - cpd) * qnk(i) * t(i, k) + alv * qg + gz(i, k) 566 tg = tg + s * (ah0(i) - ahg) 578 567 tg = max(tg, 35.0) 579 568 tc = tg - t0 580 569 denom = 243.5 + tc 581 570 IF (tc>=0.0) THEN 582 es = 6.112 *exp(17.67*tc/denom)571 es = 6.112 * exp(17.67 * tc / denom) 583 572 ELSE 584 es = exp(23.33086 -6111.72784/tg+0.15215*log(tg))573 es = exp(23.33086 - 6111.72784 / tg + 0.15215 * log(tg)) 585 574 END IF 586 qg = eps *es/(p(i,k)-es*(1.-eps))587 588 alv = lv0 - clmcpv *(t(i,k)-t0)575 qg = eps * es / (p(i, k) - es * (1. - eps)) 576 577 alv = lv0 - clmcpv * (t(i, k) - t0) 589 578 ! PRINT*,'cpd dans convect2 ',cpd 590 579 ! PRINT*,'tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd' 591 580 ! PRINT*,tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd 592 tp(i, k) = (ah0(i) -(cl-cpd)*qnk(i)*t(i,k)-gz(i,k)-alv*qg)/cpd581 tp(i, k) = (ah0(i) - (cl - cpd) * qnk(i) * t(i, k) - gz(i, k) - alv * qg) / cpd 593 582 ! if (.NOT.cpd.gt.1000.) THEN 594 583 ! PRINT*,'CPD=',cpd … … 596 585 ! END IF 597 586 clw(i, k) = qnk(i) - qg 598 clw(i, k) = max(0.0, clw(i, k))599 rg = qg /(1.-qnk(i))600 tvp(i, k) = tp(i, k) *(1.+rg*epsi)587 clw(i, k) = max(0.0, clw(i, k)) 588 rg = qg / (1. - qnk(i)) 589 tvp(i, k) = tp(i, k) * (1. + rg * epsi) 601 590 END IF 602 591 END DO … … 611 600 DO k = minorig + 1, nl 612 601 DO i = 1, ncum 613 IF (k>=(nk(i) +1)) THEN602 IF (k>=(nk(i) + 1)) THEN 614 603 tca = tp(i, k) - t0 615 604 IF (tca>=0.0) THEN 616 605 elacrit = elcrit 617 606 ELSE 618 elacrit = elcrit *(1.0-tca/tlcrit)607 elacrit = elcrit * (1.0 - tca / tlcrit) 619 608 END IF 620 609 elacrit = max(elacrit, 0.0) 621 ep(i, k) = 1.0 - elacrit /max(clw(i,k), 1.0E-8)622 ep(i, k) = max(ep(i, k), 0.0)623 ep(i, k) = min(ep(i, k), 1.0)610 ep(i, k) = 1.0 - elacrit / max(clw(i, k), 1.0E-8) 611 ep(i, k) = max(ep(i, k), 0.0) 612 ep(i, k) = min(ep(i, k), 1.0) 624 613 sigp(i, k) = sigs 625 614 END IF … … 634 623 DO k = minorig + 1, nl 635 624 DO i = 1, ncum 636 IF (k>=(icb(i) +1)) THEN637 tvp(i, k) = tvp(i, k) *(1.0-qnk(i)+ep(i,k)*clw(i,k))625 IF (k>=(icb(i) + 1)) THEN 626 tvp(i, k) = tvp(i, k) * (1.0 - qnk(i) + ep(i, k) * clw(i, k)) 638 627 ! PRINT*,'i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)' 639 628 ! PRINT*, i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k) … … 642 631 END DO 643 632 DO i = 1, ncum 644 tvp(i, nlp) = tvp(i, nl) - (gz(i, nlp)-gz(i,nl))/cpd633 tvp(i, nlp) = tvp(i, nl) - (gz(i, nlp) - gz(i, nl)) / cpd 645 634 END DO 646 635 … … 720 709 DO i = 1, ncum 721 710 IF (cape(i)<0.0) lcape(i) = .FALSE. 722 IF ((k>=(icb(i) +1)) .AND. lcape(i)) THEN723 by = (tvp(i, k)-tv(i,k))*dph(i, k)/p(i, k)724 byp(i) = (tvp(i, k+1)-tv(i,k+1))*dph(i, k+1)/p(i, k+1)711 IF ((k>=(icb(i) + 1)) .AND. lcape(i)) THEN 712 by = (tvp(i, k) - tv(i, k)) * dph(i, k) / p(i, k) 713 byp(i) = (tvp(i, k + 1) - tv(i, k + 1)) * dph(i, k + 1) / p(i, k + 1) 725 714 cape(i) = cape(i) + by 726 715 IF (by>=0.0) inb1(i) = k + 1 … … 736 725 defrac = capem(i) - cape(i) 737 726 defrac = max(defrac, 0.001) 738 frac(i) = -cape(i) /defrac727 frac(i) = -cape(i) / defrac 739 728 frac(i) = min(frac(i), 1.0) 740 729 frac(i) = max(frac(i), 0.0) … … 746 735 747 736 ! initialization: 748 DO i = 1, ncum *nlp737 DO i = 1, ncum * nlp 749 738 hp(i, 1) = h(i, 1) 750 739 END DO … … 753 742 DO i = 1, ncum 754 743 IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN 755 hp(i, k) = h(i, nk(i)) + (lv(i,k)+(cpd-cpv)*t(i,k))*ep(i, k)*clw(i, k & 756 ) 757 END IF 758 END DO 759 END DO 760 744 hp(i, k) = h(i, nk(i)) + (lv(i, k) + (cpd - cpv) * t(i, k)) * ep(i, k) * clw(i, k & 745 ) 746 END IF 747 END DO 748 END DO 761 749 762 750 END SUBROUTINE cv_undilute2 763 751 764 752 SUBROUTINE cv_closure(nloc, ncum, nd, nk, icb, tv, tvp, p, ph, dph, plcl, & 765 cpn, iflag, cbmf)753 cpn, iflag, cbmf) 766 754 IMPLICIT NONE 767 755 … … 770 758 INTEGER nk(nloc), icb(nloc) 771 759 REAL tv(nloc, nd), tvp(nloc, nd), p(nloc, nd), dph(nloc, nd) 772 REAL ph(nloc, nd +1) ! caution nd instead ndp1 to be consistent...760 REAL ph(nloc, nd + 1) ! caution nd instead ndp1 to be consistent... 773 761 REAL plcl(nloc), cpn(nloc, nd) 774 762 … … 804 792 DO i = 1, ncum 805 793 dtpbl(i) = 0.0 806 tvpplcl(i) = tvp(i, icb(i) -1) - rrd*tvp(i, icb(i)-1)*(p(i,icb(i)-1)-plcl(&807 i))/(cpn(i,icb(i)-1)*p(i,icb(i)-1))808 tvaplcl(i) = tv(i, icb(i)) + (tvp(i, icb(i))-tvp(i,icb(i)+1))*(plcl(i)-p(i &809 ,icb(i)))/(p(i,icb(i))-p(i,icb(i)+1))794 tvpplcl(i) = tvp(i, icb(i) - 1) - rrd * tvp(i, icb(i) - 1) * (p(i, icb(i) - 1) - plcl(& 795 i)) / (cpn(i, icb(i) - 1) * p(i, icb(i) - 1)) 796 tvaplcl(i) = tv(i, icb(i)) + (tvp(i, icb(i)) - tvp(i, icb(i) + 1)) * (plcl(i) - p(i & 797 , icb(i))) / (p(i, icb(i)) - p(i, icb(i) + 1)) 810 798 END DO 811 799 … … 819 807 DO k = minorig, icbmax 820 808 DO i = 1, ncum 821 IF ((k>=nk(i)) .AND. (k<=(icb(i) -1))) THEN822 dtpbl(i) = dtpbl(i) + (tvp(i, k)-tv(i,k))*dph(i, k)823 END IF 824 END DO 825 END DO 826 DO i = 1, ncum 827 dtpbl(i) = dtpbl(i) /(ph(i,nk(i))-ph(i,icb(i)))809 IF ((k>=nk(i)) .AND. (k<=(icb(i) - 1))) THEN 810 dtpbl(i) = dtpbl(i) + (tvp(i, k) - tv(i, k)) * dph(i, k) 811 END IF 812 END DO 813 END DO 814 DO i = 1, ncum 815 dtpbl(i) = dtpbl(i) / (ph(i, nk(i)) - ph(i, icb(i))) 828 816 dtmin(i) = tvpplcl(i) - tvaplcl(i) + dtmax + dtpbl(i) 829 817 END DO … … 835 823 DO i = 1, ncum 836 824 work(i) = cbmf(i) 837 cbmf(i) = max(0.0, (1.0 -damp)*cbmf(i)+0.1*alpha*dtmin(i))825 cbmf(i) = max(0.0, (1.0 - damp) * cbmf(i) + 0.1 * alpha * dtmin(i)) 838 826 IF ((work(i)==0.0) .AND. (cbmf(i)==0.0)) THEN 839 827 iflag(i) = 3 … … 841 829 END DO 842 830 843 844 831 END SUBROUTINE cv_closure 845 832 846 833 SUBROUTINE cv_mixing(nloc, ncum, nd, icb, nk, inb, inb1, ph, t, q, qs, u, v, & 847 h, lv, qnk, hp, tv, tvp, ep, clw, cbmf, m, ment, qent, uent, vent, nent, &848 sij, elij)834 h, lv, qnk, hp, tv, tvp, ep, clw, cbmf, m, ment, qent, uent, vent, nent, & 835 sij, elij) 849 836 IMPLICIT NONE 850 837 … … 856 843 INTEGER icb(nloc), inb(nloc), inb1(nloc), nk(nloc) 857 844 REAL cbmf(nloc), qnk(nloc) 858 REAL ph(nloc, nd +1)845 REAL ph(nloc, nd + 1) 859 846 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), lv(nloc, nd) 860 847 REAL u(nloc, nd), v(nloc, nd), h(nloc, nd), hp(nloc, nd) … … 880 867 ! ===================================================================== 881 868 882 DO i = 1, ncum *nlp869 DO i = 1, ncum * nlp 883 870 nent(i, 1) = 0 884 871 m(i, 1) = 0.0 … … 906 893 DO j = minorig + 1, nl 907 894 DO i = 1, ncum 908 IF ((j>=(icb(i) +1)) .AND. (j<=inb(i))) THEN895 IF ((j>=(icb(i) + 1)) .AND. (j<=inb(i))) THEN 909 896 k = min(j, inb1(i)) 910 dbo = abs(tv(i, k+1)-tvp(i,k+1)-tv(i,k-1)+tvp(i,k-1)) + &911 entp*0.04*(ph(i,k)-ph(i,k+1))897 dbo = abs(tv(i, k + 1) - tvp(i, k + 1) - tv(i, k - 1) + tvp(i, k - 1)) + & 898 entp * 0.04 * (ph(i, k) - ph(i, k + 1)) 912 899 work(i) = work(i) + dbo 913 m(i, j) = cbmf(i) *dbo900 m(i, j) = cbmf(i) * dbo 914 901 END IF 915 902 END DO … … 917 904 DO k = minorig + 1, nl 918 905 DO i = 1, ncum 919 IF ((k>=(icb(i) +1)) .AND. (k<=inb(i))) THEN920 m(i, k) = m(i, k) /work(i)906 IF ((k>=(icb(i) + 1)) .AND. (k<=inb(i))) THEN 907 m(i, k) = m(i, k) / work(i) 921 908 END IF 922 909 END DO … … 930 917 ! ===================================================================== 931 918 932 933 919 DO i = minorig + 1, nl 934 920 DO j = minorig + 1, nl 935 921 DO ij = 1, ncum 936 IF ((i>=(icb(ij) +1)) .AND. (j>=icb(ij)) .AND. (i<=inb(ij)) .AND. (j<= &937 inb(ij))) THEN938 qti = qnk(ij) - ep(ij, i) *clw(ij, i)939 bf2 = 1. + lv(ij, j) *lv(ij, j)*qs(ij, j)/(rrv*t(ij,j)*t(ij,j)*cpd)940 anum = h(ij, j) - hp(ij, i) + (cpv -cpd)*t(ij, j)*(qti-q(ij,j))941 denom = h(ij, i) - hp(ij, i) + (cpd -cpv)*(q(ij,i)-qti)*t(ij, j)922 IF ((i>=(icb(ij) + 1)) .AND. (j>=icb(ij)) .AND. (i<=inb(ij)) .AND. (j<= & 923 inb(ij))) THEN 924 qti = qnk(ij) - ep(ij, i) * clw(ij, i) 925 bf2 = 1. + lv(ij, j) * lv(ij, j) * qs(ij, j) / (rrv * t(ij, j) * t(ij, j) * cpd) 926 anum = h(ij, j) - hp(ij, i) + (cpv - cpd) * t(ij, j) * (qti - q(ij, j)) 927 denom = h(ij, i) - hp(ij, i) + (cpd - cpv) * (q(ij, i) - qti) * t(ij, j) 942 928 dei = denom 943 929 IF (abs(dei)<0.01) dei = 0.01 944 sij(ij, i, j) = anum /dei930 sij(ij, i, j) = anum / dei 945 931 sij(ij, i, i) = 1.0 946 altem = sij(ij, i, j) *q(ij, i) + (1.-sij(ij,i,j))*qti - qs(ij, j)947 altem = altem /bf2948 cwat = clw(ij, j) *(1.-ep(ij,j))932 altem = sij(ij, i, j) * q(ij, i) + (1. - sij(ij, i, j)) * qti - qs(ij, j) 933 altem = altem / bf2 934 cwat = clw(ij, j) * (1. - ep(ij, j)) 949 935 stemp = sij(ij, i, j) 950 936 IF ((stemp<0.0 .OR. stemp>1.0 .OR. altem>cwat) .AND. j>i) THEN 951 anum = anum - lv(ij, j) *(qti-qs(ij,j)-cwat*bf2)952 denom = denom + lv(ij, j) *(q(ij,i)-qti)937 anum = anum - lv(ij, j) * (qti - qs(ij, j) - cwat * bf2) 938 denom = denom + lv(ij, j) * (q(ij, i) - qti) 953 939 IF (abs(denom)<0.01) denom = 0.01 954 sij(ij, i, j) = anum /denom955 altem = sij(ij, i, j) *q(ij, i) + (1.-sij(ij,i,j))*qti - qs(ij, j)956 altem = altem - (bf2 -1.)*cwat940 sij(ij, i, j) = anum / denom 941 altem = sij(ij, i, j) * q(ij, i) + (1. - sij(ij, i, j)) * qti - qs(ij, j) 942 altem = altem - (bf2 - 1.) * cwat 957 943 END IF 958 IF (sij(ij, i,j)>0.0 .AND. sij(ij,i,j)<0.9) THEN959 qent(ij, i, j) = sij(ij, i, j) *q(ij, i) + (1.-sij(ij,i,j))*qti960 uent(ij, i, j) = sij(ij, i, j) *u(ij, i) + &961 (1.-sij(ij,i,j))*u(ij, nk(ij))962 vent(ij, i, j) = sij(ij, i, j) *v(ij, i) + &963 (1.-sij(ij,i,j))*v(ij, nk(ij))944 IF (sij(ij, i, j)>0.0 .AND. sij(ij, i, j)<0.9) THEN 945 qent(ij, i, j) = sij(ij, i, j) * q(ij, i) + (1. - sij(ij, i, j)) * qti 946 uent(ij, i, j) = sij(ij, i, j) * u(ij, i) + & 947 (1. - sij(ij, i, j)) * u(ij, nk(ij)) 948 vent(ij, i, j) = sij(ij, i, j) * v(ij, i) + & 949 (1. - sij(ij, i, j)) * v(ij, nk(ij)) 964 950 elij(ij, i, j) = altem 965 elij(ij, i, j) = max(0.0, elij(ij, i,j))966 ment(ij, i, j) = m(ij, i) /(1.-sij(ij,i,j))951 elij(ij, i, j) = max(0.0, elij(ij, i, j)) 952 ment(ij, i, j) = m(ij, i) / (1. - sij(ij, i, j)) 967 953 nent(ij, i) = nent(ij, i) + 1 968 954 END IF 969 sij(ij, i, j) = max(0.0, sij(ij, i,j))970 sij(ij, i, j) = min(1.0, sij(ij, i,j))955 sij(ij, i, j) = max(0.0, sij(ij, i, j)) 956 sij(ij, i, j) = min(1.0, sij(ij, i, j)) 971 957 END IF 972 958 END DO … … 979 965 980 966 DO ij = 1, ncum 981 IF ((i>=(icb(ij) +1)) .AND. (i<=inb(ij)) .AND. (nent(ij,i)==0)) THEN967 IF ((i>=(icb(ij) + 1)) .AND. (i<=inb(ij)) .AND. (nent(ij, i)==0)) THEN 982 968 ment(ij, i, i) = m(ij, i) 983 qent(ij, i, i) = q(ij, nk(ij)) - ep(ij, i) *clw(ij, i)969 qent(ij, i, i) = q(ij, nk(ij)) - ep(ij, i) * clw(ij, i) 984 970 uent(ij, i, i) = u(ij, nk(ij)) 985 971 vent(ij, i, i) = v(ij, nk(ij)) … … 999 985 ! ===================================================================== 1000 986 1001 CALL zilch(bsum, ncum *nlp)987 CALL zilch(bsum, ncum * nlp) 1002 988 DO ij = 1, ncum 1003 989 lwork(ij) = .FALSE. … … 1007 993 num1 = 0 1008 994 DO ij = 1, ncum 1009 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij))) num1 = num1 + 1995 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij))) num1 = num1 + 1 1010 996 END DO 1011 997 IF (num1<=0) GO TO 789 1012 998 1013 999 DO ij = 1, ncum 1014 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij))) THEN1015 lwork(ij) = (nent(ij, i)/=0)1016 qp1 = q(ij, nk(ij)) - ep(ij, i) *clw(ij, i)1017 anum = h(ij, i) - hp(ij, i) - lv(ij, i) *(qp1-qs(ij,i))1018 denom = h(ij, i) - hp(ij, i) + lv(ij, i) *(q(ij,i)-qp1)1000 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij))) THEN 1001 lwork(ij) = (nent(ij, i)/=0) 1002 qp1 = q(ij, nk(ij)) - ep(ij, i) * clw(ij, i) 1003 anum = h(ij, i) - hp(ij, i) - lv(ij, i) * (qp1 - qs(ij, i)) 1004 denom = h(ij, i) - hp(ij, i) + lv(ij, i) * (q(ij, i) - qp1) 1019 1005 IF (abs(denom)<0.01) denom = 0.01 1020 scrit(ij) = anum /denom1021 alt = qp1 - qs(ij, i) + scrit(ij) *(q(ij,i)-qp1)1006 scrit(ij) = anum / denom 1007 alt = qp1 - qs(ij, i) + scrit(ij) * (q(ij, i) - qp1) 1022 1008 IF (scrit(ij)<0.0 .OR. alt<0.0) scrit(ij) = 1.0 1023 1009 asij(ij) = 0.0 … … 1029 1015 num2 = 0 1030 1016 DO ij = 1, ncum 1031 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij)) .AND. (j>=icb(&1032 ij)) .AND. (j<=inb(ij)) .AND. lwork(ij)) num2 = num2 + 11017 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij)) .AND. (j>=icb(& 1018 ij)) .AND. (j<=inb(ij)) .AND. lwork(ij)) num2 = num2 + 1 1033 1019 END DO 1034 1020 IF (num2<=0) GO TO 783 1035 1021 1036 1022 DO ij = 1, ncum 1037 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij)) .AND. (j>=icb(&1038 ij)) .AND. (j<=inb(ij)) .AND. lwork(ij)) THEN1039 IF (sij(ij, i,j)>0.0 .AND. sij(ij,i,j)<0.9) THEN1023 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij)) .AND. (j>=icb(& 1024 ij)) .AND. (j<=inb(ij)) .AND. lwork(ij)) THEN 1025 IF (sij(ij, i, j)>0.0 .AND. sij(ij, i, j)<0.9) THEN 1040 1026 IF (j>i) THEN 1041 smid = min(sij(ij, i,j), scrit(ij))1027 smid = min(sij(ij, i, j), scrit(ij)) 1042 1028 sjmax = smid 1043 1029 sjmin = smid 1044 IF (smid<smin(ij) .AND. sij(ij, i,j+1)<smid) THEN1030 IF (smid<smin(ij) .AND. sij(ij, i, j + 1)<smid) THEN 1045 1031 smin(ij) = smid 1046 sjmax = min(sij(ij, i,j+1), sij(ij,i,j), scrit(ij))1047 sjmin = max(sij(ij, i,j-1), sij(ij,i,j))1032 sjmax = min(sij(ij, i, j + 1), sij(ij, i, j), scrit(ij)) 1033 sjmin = max(sij(ij, i, j - 1), sij(ij, i, j)) 1048 1034 sjmin = min(sjmin, scrit(ij)) 1049 1035 END IF 1050 1036 ELSE 1051 sjmax = max(sij(ij, i,j+1), scrit(ij))1052 smid = max(sij(ij, i,j), scrit(ij))1037 sjmax = max(sij(ij, i, j + 1), scrit(ij)) 1038 smid = max(sij(ij, i, j), scrit(ij)) 1053 1039 sjmin = 0.0 1054 IF (j>1) sjmin = sij(ij, i, j -1)1040 IF (j>1) sjmin = sij(ij, i, j - 1) 1055 1041 sjmin = max(sjmin, scrit(ij)) 1056 1042 END IF 1057 delp = abs(sjmax -smid)1058 delm = abs(sjmin -smid)1059 asij(ij) = asij(ij) + (delp +delm)*(ph(ij,j)-ph(ij,j+1))1060 ment(ij, i, j) = ment(ij, i, j) *(delp+delm)*(ph(ij,j)-ph(ij,j+1))1043 delp = abs(sjmax - smid) 1044 delm = abs(sjmin - smid) 1045 asij(ij) = asij(ij) + (delp + delm) * (ph(ij, j) - ph(ij, j + 1)) 1046 ment(ij, i, j) = ment(ij, i, j) * (delp + delm) * (ph(ij, j) - ph(ij, j + 1)) 1061 1047 END IF 1062 1048 END IF 1063 1049 END DO 1064 783 END DO1050 783 END DO 1065 1051 DO ij = 1, ncum 1066 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij)) .AND. lwork(ij)) THEN1052 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij)) .AND. lwork(ij)) THEN 1067 1053 asij(ij) = max(1.0E-21, asij(ij)) 1068 asij(ij) = 1.0 /asij(ij)1054 asij(ij) = 1.0 / asij(ij) 1069 1055 bsum(ij, i) = 0.0 1070 1056 END IF … … 1072 1058 DO j = minorig, nl + 1 1073 1059 DO ij = 1, ncum 1074 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij)) .AND. (j>=icb(&1075 ij)) .AND. (j<=inb(ij)) .AND. lwork(ij)) THEN1076 ment(ij, i, j) = ment(ij, i, j) *asij(ij)1060 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij)) .AND. (j>=icb(& 1061 ij)) .AND. (j<=inb(ij)) .AND. lwork(ij)) THEN 1062 ment(ij, i, j) = ment(ij, i, j) * asij(ij) 1077 1063 bsum(ij, i) = bsum(ij, i) + ment(ij, i, j) 1078 1064 END IF … … 1080 1066 END DO 1081 1067 DO ij = 1, ncum 1082 IF ((i>=icb(ij) +1) .AND. (i<=inb(ij)) .AND. (bsum(ij, &1083 i)<1.0E-18) .AND. lwork(ij)) THEN1068 IF ((i>=icb(ij) + 1) .AND. (i<=inb(ij)) .AND. (bsum(ij, & 1069 i)<1.0E-18) .AND. lwork(ij)) THEN 1084 1070 nent(ij, i) = 0 1085 1071 ment(ij, i, i) = m(ij, i) 1086 qent(ij, i, i) = q(ij, nk(ij)) - ep(ij, i) *clw(ij, i)1072 qent(ij, i, i) = q(ij, nk(ij)) - ep(ij, i) * clw(ij, i) 1087 1073 uent(ij, i, i) = u(ij, nk(ij)) 1088 1074 vent(ij, i, i) = v(ij, nk(ij)) … … 1091 1077 END IF 1092 1078 END DO 1093 789 END DO 1094 1079 789 END DO 1095 1080 1096 1081 END SUBROUTINE cv_mixing 1097 1082 1098 1083 SUBROUTINE cv_unsat(nloc, ncum, nd, inb, t, q, qs, gz, u, v, p, ph, h, lv, & 1099 ep, sigp, clw, m, ment, elij, iflag, mp, qp, up, vp, wt, water, evap)1084 ep, sigp, clw, m, ment, elij, iflag, mp, qp, up, vp, wt, water, evap) 1100 1085 IMPLICIT NONE 1101 1102 1086 1103 1087 include "cvthermo.h" … … 1109 1093 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd) 1110 1094 REAL gz(nloc, nd), u(nloc, nd), v(nloc, nd) 1111 REAL p(nloc, nd), ph(nloc, nd +1), h(nloc, nd)1095 REAL p(nloc, nd), ph(nloc, nd + 1), h(nloc, nd) 1112 1096 REAL lv(nloc, nd), ep(nloc, nd), sigp(nloc, nd), clw(nloc, nd) 1113 1097 REAL m(nloc, nd), ment(nloc, nd, nd), elij(nloc, nd, nd) … … 1149 1133 DO k = 2, nl + 1 1150 1134 DO i = 1, ncum 1151 qp(i, k) = q(i, k -1)1152 up(i, k) = u(i, k -1)1153 vp(i, k) = v(i, k -1)1135 qp(i, k) = q(i, k - 1) 1136 up(i, k) = u(i, k - 1) 1137 vp(i, k) = v(i, k - 1) 1154 1138 END DO 1155 1139 END DO … … 1163 1147 ! *** and condensed water flux *** 1164 1148 1165 1166 1149 DO i = 1, ncum 1167 1150 jtt(i) = 2 1168 IF (ep(i, inb(i))<=0.0001) iflag(i) = 21151 IF (ep(i, inb(i))<=0.0001) iflag(i) = 2 1169 1152 IF (iflag(i)==0) THEN 1170 1153 lwork(i) = .TRUE. … … 1176 1159 ! *** Begin downdraft loop *** 1177 1160 1178 1179 1161 CALL zilch(wdtrain, ncum) 1180 1162 DO i = nl + 1, 1, -1 … … 1191 1173 DO ij = 1, ncum 1192 1174 IF ((i<=inb(ij)) .AND. (lwork(ij))) THEN 1193 wdtrain(ij) = g *ep(ij, i)*m(ij, i)*clw(ij, i)1175 wdtrain(ij) = g * ep(ij, i) * m(ij, i) * clw(ij, i) 1194 1176 END IF 1195 1177 END DO … … 1199 1181 DO ij = 1, ncum 1200 1182 IF ((i<=inb(ij)) .AND. (lwork(ij))) THEN 1201 awat = elij(ij, j, i) - (1. -ep(ij,i))*clw(ij, i)1183 awat = elij(ij, j, i) - (1. - ep(ij, i)) * clw(ij, i) 1202 1184 awat = max(0.0, awat) 1203 wdtrain(ij) = wdtrain(ij) + g *awat*ment(ij, j, i)1185 wdtrain(ij) = wdtrain(ij) + g * awat * ment(ij, j, i) 1204 1186 END IF 1205 1187 END DO … … 1222 1204 ! rain *** 1223 1205 1224 IF (t(ij, i)>273.0) THEN1206 IF (t(ij, i)>273.0) THEN 1225 1207 coeff = coeffr 1226 1208 wt(ij, i) = omtrain 1227 1209 END IF 1228 qsm = 0.5 *(q(ij,i)+qp(ij,i+1))1229 afac = coeff *ph(ij, i)*(qs(ij,i)-qsm)/(1.0E4+2.0E3*ph(ij,i)*qs(ij,i))1210 qsm = 0.5 * (q(ij, i) + qp(ij, i + 1)) 1211 afac = coeff * ph(ij, i) * (qs(ij, i) - qsm) / (1.0E4 + 2.0E3 * ph(ij, i) * qs(ij, i)) 1230 1212 afac = max(afac, 0.0) 1231 1213 sigt = sigp(ij, i) 1232 1214 sigt = max(0.0, sigt) 1233 1215 sigt = min(1.0, sigt) 1234 b6 = 100. *(ph(ij,i)-ph(ij,i+1))*sigt*afac/wt(ij, i)1235 c6 = (water(ij, i+1)*wt(ij,i+1)+wdtrain(ij)/sigd)/wt(ij, i)1236 revap = 0.5 *(-b6+sqrt(b6*b6+4.*c6))1237 evap(ij, i) = sigt *afac*revap1238 water(ij, i) = revap *revap1216 b6 = 100. * (ph(ij, i) - ph(ij, i + 1)) * sigt * afac / wt(ij, i) 1217 c6 = (water(ij, i + 1) * wt(ij, i + 1) + wdtrain(ij) / sigd) / wt(ij, i) 1218 revap = 0.5 * (-b6 + sqrt(b6 * b6 + 4. * c6)) 1219 evap(ij, i) = sigt * afac * revap 1220 water(ij, i) = revap * revap 1239 1221 1240 1222 ! *** Calculate precipitating downdraft mass flux under *** … … 1242 1224 1243 1225 IF (i>1) THEN 1244 dhdp = (h(ij, i)-h(ij,i-1))/(p(ij,i-1)-p(ij,i))1226 dhdp = (h(ij, i) - h(ij, i - 1)) / (p(ij, i - 1) - p(ij, i)) 1245 1227 dhdp = max(dhdp, 10.0) 1246 mp(ij, i) = 100. *ginv*lv(ij, i)*sigd*evap(ij, i)/dhdp1247 mp(ij, i) = max(mp(ij, i), 0.0)1228 mp(ij, i) = 100. * ginv * lv(ij, i) * sigd * evap(ij, i) / dhdp 1229 mp(ij, i) = max(mp(ij, i), 0.0) 1248 1230 1249 1231 ! *** Add small amount of inertia to downdraft *** 1250 1232 1251 fac = 20.0 /(ph(ij,i-1)-ph(ij,i))1252 mp(ij, i) = (fac *mp(ij,i+1)+mp(ij,i))/(1.+fac)1233 fac = 20.0 / (ph(ij, i - 1) - ph(ij, i)) 1234 mp(ij, i) = (fac * mp(ij, i + 1) + mp(ij, i)) / (1. + fac) 1253 1235 1254 1236 ! *** Force mp to decrease linearly to zero … … 1257 1239 ! *** 1258 1240 1259 IF (p(ij, i)>(0.949*p(ij,1))) THEN1241 IF (p(ij, i)>(0.949 * p(ij, 1))) THEN 1260 1242 jtt(ij) = max(jtt(ij), i) 1261 mp(ij, i) = mp(ij, jtt(ij)) *(p(ij,1)-p(ij,i))/ &1262 (p(ij,1)-p(ij,jtt(ij)))1243 mp(ij, i) = mp(ij, jtt(ij)) * (p(ij, 1) - p(ij, i)) / & 1244 (p(ij, 1) - p(ij, jtt(ij))) 1263 1245 END IF 1264 1246 END IF … … 1270 1252 qstm = qs(ij, 1) 1271 1253 ELSE 1272 qstm = qs(ij, i -1)1254 qstm = qs(ij, i - 1) 1273 1255 END IF 1274 IF (mp(ij, i)>mp(ij,i+1)) THEN1275 rat = mp(ij, i +1)/mp(ij, i)1276 qp(ij, i) = qp(ij, i +1)*rat + q(ij, i)*(1.0-rat) + &1277 100.*ginv*sigd*(ph(ij,i)-ph(ij,i+1))*(evap(ij,i)/mp(ij,i))1278 up(ij, i) = up(ij, i +1)*rat + u(ij, i)*(1.-rat)1279 vp(ij, i) = vp(ij, i +1)*rat + v(ij, i)*(1.-rat)1256 IF (mp(ij, i)>mp(ij, i + 1)) THEN 1257 rat = mp(ij, i + 1) / mp(ij, i) 1258 qp(ij, i) = qp(ij, i + 1) * rat + q(ij, i) * (1.0 - rat) + & 1259 100. * ginv * sigd * (ph(ij, i) - ph(ij, i + 1)) * (evap(ij, i) / mp(ij, i)) 1260 up(ij, i) = up(ij, i + 1) * rat + u(ij, i) * (1. - rat) 1261 vp(ij, i) = vp(ij, i + 1) * rat + v(ij, i) * (1. - rat) 1280 1262 ELSE 1281 IF (mp(ij, i+1)>0.0) THEN1282 qp(ij, i) = (gz(ij, i+1)-gz(ij,i)+qp(ij,i+1)*(lv(ij,i+1)+t(ij, &1283 i+1)*(cl-cpd))+cpd*(t(ij,i+1)-t(ij, &1284 i)))/(lv(ij,i)+t(ij,i)*(cl-cpd))1285 up(ij, i) = up(ij, i +1)1286 vp(ij, i) = vp(ij, i +1)1263 IF (mp(ij, i + 1)>0.0) THEN 1264 qp(ij, i) = (gz(ij, i + 1) - gz(ij, i) + qp(ij, i + 1) * (lv(ij, i + 1) + t(ij, & 1265 i + 1) * (cl - cpd)) + cpd * (t(ij, i + 1) - t(ij, & 1266 i))) / (lv(ij, i) + t(ij, i) * (cl - cpd)) 1267 up(ij, i) = up(ij, i + 1) 1268 vp(ij, i) = vp(ij, i + 1) 1287 1269 END IF 1288 1270 END IF 1289 qp(ij, i) = min(qp(ij, i), qstm)1290 qp(ij, i) = max(qp(ij, i), 0.0)1271 qp(ij, i) = min(qp(ij, i), qstm) 1272 qp(ij, i) = max(qp(ij, i), 0.0) 1291 1273 END IF 1292 1274 END IF 1293 1275 END DO 1294 899 END DO 1295 1276 899 END DO 1296 1277 1297 1278 END SUBROUTINE cv_unsat 1298 1279 1299 1280 SUBROUTINE cv_yield(nloc, ncum, nd, nk, icb, inb, delt, t, q, u, v, gz, p, & 1300 ph, h, hp, lv, cpn, ep, clw, frac, m, mp, qp, up, vp, wt, water, evap, &1301 ment, qent, uent, vent, nent, elij, tv, tvp, iflag, wd, qprime, tprime, &1302 precip, cbmf, ft, fq, fu, fv, ma, qcondc)1281 ph, h, hp, lv, cpn, ep, clw, frac, m, mp, qp, up, vp, wt, water, evap, & 1282 ment, qent, uent, vent, nent, elij, tv, tvp, iflag, wd, qprime, tprime, & 1283 precip, cbmf, ft, fq, fu, fv, ma, qcondc) 1303 1284 IMPLICIT NONE 1304 1285 … … 1313 1294 REAL t(nloc, nd), q(nloc, nd), u(nloc, nd), v(nloc, nd) 1314 1295 REAL gz(nloc, nd) 1315 REAL p(nloc, nd), ph(nloc, nd +1), h(nloc, nd)1296 REAL p(nloc, nd), ph(nloc, nd + 1), h(nloc, nd) 1316 1297 REAL hp(nloc, nd), lv(nloc, nd) 1317 1298 REAL cpn(nloc, nd), ep(nloc, nd), clw(nloc, nd), frac(nloc) … … 1343 1324 ! -- initializations: 1344 1325 1345 delti = 1.0 /delt1326 delti = 1.0 / delt 1346 1327 1347 1328 DO i = 1, ncum … … 1355 1336 fv(i, k) = 0.0 1356 1337 fq(i, k) = 0.0 1357 lvcp(i, k) = lv(i, k) /cpn(i, k)1338 lvcp(i, k) = lv(i, k) / cpn(i, k) 1358 1339 qcondc(i, k) = 0.0 ! cld 1359 1340 qcond(i, k) = 0.0 ! cld … … 1370 1351 ! c & /(rowl*g) 1371 1352 ! c precip(i)=precip(i)*delt/86400. 1372 precip(i) = wt(i, 1) *sigd*water(i, 1)*86400/g1353 precip(i) = wt(i, 1) * sigd * water(i, 1) * 86400 / g 1373 1354 END IF 1374 1355 END DO … … 1379 1360 1380 1361 DO i = 1, ncum 1381 wd(i) = betad *abs(mp(i,icb(i)))*0.01*rrd*t(i, icb(i))/(sigd*p(i,icb(i)))1382 qprime(i) = 0.5 *(qp(i,1)-q(i,1))1383 tprime(i) = lv0 *qprime(i)/cpd1362 wd(i) = betad * abs(mp(i, icb(i))) * 0.01 * rrd * t(i, icb(i)) / (sigd * p(i, icb(i))) 1363 qprime(i) = 0.5 * (qp(i, 1) - q(i, 1)) 1364 tprime(i) = lv0 * qprime(i) / cpd 1384 1365 END DO 1385 1366 … … 1388 1369 1389 1370 DO i = 1, ncum 1390 work(i) = 0.01 /(ph(i,1)-ph(i,2))1371 work(i) = 0.01 / (ph(i, 1) - ph(i, 2)) 1391 1372 am(i) = 0.0 1392 1373 END DO … … 1399 1380 END DO 1400 1381 DO i = 1, ncum 1401 IF ((g *work(i)*am(i))>=delti) iflag(i) = 11402 ft(i, 1) = ft(i, 1) + g *work(i)*am(i)*(t(i,2)-t(i,1)+(gz(i,2)-gz(i, &1403 1))/cpn(i,1))1404 ft(i, 1) = ft(i, 1) - lvcp(i, 1) *sigd*evap(i, 1)1405 ft(i, 1) = ft(i, 1) + sigd *wt(i, 2)*(cl-cpd)*water(i, 2)*(t(i,2)-t(i,1))* &1406 work(i)/cpn(i, 1)1407 fq(i, 1) = fq(i, 1) + g *mp(i, 2)*(qp(i,2)-q(i,1))*work(i) + &1408 sigd*evap(i, 1)1409 fq(i, 1) = fq(i, 1) + g *am(i)*(q(i,2)-q(i,1))*work(i)1410 fu(i, 1) = fu(i, 1) + g *work(i)*(mp(i,2)*(up(i,2)-u(i,1))+am(i)*(u(i, &1411 2)-u(i,1)))1412 fv(i, 1) = fv(i, 1) + g *work(i)*(mp(i,2)*(vp(i,2)-v(i,1))+am(i)*(v(i, &1413 2)-v(i,1)))1382 IF ((g * work(i) * am(i))>=delti) iflag(i) = 1 1383 ft(i, 1) = ft(i, 1) + g * work(i) * am(i) * (t(i, 2) - t(i, 1) + (gz(i, 2) - gz(i, & 1384 1)) / cpn(i, 1)) 1385 ft(i, 1) = ft(i, 1) - lvcp(i, 1) * sigd * evap(i, 1) 1386 ft(i, 1) = ft(i, 1) + sigd * wt(i, 2) * (cl - cpd) * water(i, 2) * (t(i, 2) - t(i, 1)) * & 1387 work(i) / cpn(i, 1) 1388 fq(i, 1) = fq(i, 1) + g * mp(i, 2) * (qp(i, 2) - q(i, 1)) * work(i) + & 1389 sigd * evap(i, 1) 1390 fq(i, 1) = fq(i, 1) + g * am(i) * (q(i, 2) - q(i, 1)) * work(i) 1391 fu(i, 1) = fu(i, 1) + g * work(i) * (mp(i, 2) * (up(i, 2) - u(i, 1)) + am(i) * (u(i, & 1392 2) - u(i, 1))) 1393 fv(i, 1) = fv(i, 1) + g * work(i) * (mp(i, 2) * (vp(i, 2) - v(i, 1)) + am(i) * (v(i, & 1394 2) - v(i, 1))) 1414 1395 END DO 1415 1396 DO j = 2, nl 1416 1397 DO i = 1, ncum 1417 1398 IF (j<=inb(i)) THEN 1418 fq(i, 1) = fq(i, 1) + g *work(i)*ment(i, j, 1)*(qent(i,j,1)-q(i,1))1419 fu(i, 1) = fu(i, 1) + g *work(i)*ment(i, j, 1)*(uent(i,j,1)-u(i,1))1420 fv(i, 1) = fv(i, 1) + g *work(i)*ment(i, j, 1)*(vent(i,j,1)-v(i,1))1399 fq(i, 1) = fq(i, 1) + g * work(i) * ment(i, j, 1) * (qent(i, j, 1) - q(i, 1)) 1400 fu(i, 1) = fu(i, 1) + g * work(i) * ment(i, j, 1) * (uent(i, j, 1) - u(i, 1)) 1401 fv(i, 1) = fv(i, 1) + g * work(i) * ment(i, j, 1) * (vent(i, j, 1) - v(i, 1)) 1421 1402 END IF 1422 1403 END DO … … 1442 1423 DO k = i + 1, nl + 1 1443 1424 DO ij = 1, ncum 1444 IF ((i>=nk(ij)) .AND. (i<=inb(ij)) .AND. (k<=(inb(ij) +1))) THEN1425 IF ((i>=nk(ij)) .AND. (i<=inb(ij)) .AND. (k<=(inb(ij) + 1))) THEN 1445 1426 amp1(ij) = amp1(ij) + m(ij, k) 1446 1427 END IF … … 1451 1432 DO j = i + 1, nl + 1 1452 1433 DO ij = 1, ncum 1453 IF ((j<=(inb(ij) +1)) .AND. (i<=inb(ij))) THEN1434 IF ((j<=(inb(ij) + 1)) .AND. (i<=inb(ij))) THEN 1454 1435 amp1(ij) = amp1(ij) + ment(ij, k, j) 1455 1436 END IF … … 1469 1450 DO ij = 1, ncum 1470 1451 IF (i<=inb(ij)) THEN 1471 dpinv = 0.01 /(ph(ij,i)-ph(ij,i+1))1472 cpinv = 1.0 /cpn(ij, i)1473 1474 ft(ij, i) = ft(ij, i) + g *dpinv*(amp1(ij)*(t(ij,i+1)-t(ij, &1475 i)+(gz(ij,i+1)-gz(ij,i))*cpinv)-ad(ij)*(t(ij,i)-t(ij, &1476 i-1)+(gz(ij,i)-gz(ij,i-1))*cpinv)) - sigd*lvcp(ij, i)*evap(ij, i)1477 ft(ij, i) = ft(ij, i) + g *dpinv*ment(ij, i, i)*(hp(ij,i)-h(ij,i)+t(ij &1478 ,i)*(cpv-cpd)*(q(ij,i)-qent(ij,i,i)))*cpinv1479 ft(ij, i) = ft(ij, i) + sigd *wt(ij, i+1)*(cl-cpd)*water(ij, i+1)*(t(&1480 ij,i+1)-t(ij,i))*dpinv*cpinv1481 fq(ij, i) = fq(ij, i) + g *dpinv*(amp1(ij)*(q(ij,i+1)-q(ij, &1482 i))-ad(ij)*(q(ij,i)-q(ij,i-1)))1483 fu(ij, i) = fu(ij, i) + g *dpinv*(amp1(ij)*(u(ij,i+1)-u(ij, &1484 i))-ad(ij)*(u(ij,i)-u(ij,i-1)))1485 fv(ij, i) = fv(ij, i) + g *dpinv*(amp1(ij)*(v(ij,i+1)-v(ij, &1486 i))-ad(ij)*(v(ij,i)-v(ij,i-1)))1452 dpinv = 0.01 / (ph(ij, i) - ph(ij, i + 1)) 1453 cpinv = 1.0 / cpn(ij, i) 1454 1455 ft(ij, i) = ft(ij, i) + g * dpinv * (amp1(ij) * (t(ij, i + 1) - t(ij, & 1456 i) + (gz(ij, i + 1) - gz(ij, i)) * cpinv) - ad(ij) * (t(ij, i) - t(ij, & 1457 i - 1) + (gz(ij, i) - gz(ij, i - 1)) * cpinv)) - sigd * lvcp(ij, i) * evap(ij, i) 1458 ft(ij, i) = ft(ij, i) + g * dpinv * ment(ij, i, i) * (hp(ij, i) - h(ij, i) + t(ij & 1459 , i) * (cpv - cpd) * (q(ij, i) - qent(ij, i, i))) * cpinv 1460 ft(ij, i) = ft(ij, i) + sigd * wt(ij, i + 1) * (cl - cpd) * water(ij, i + 1) * (t(& 1461 ij, i + 1) - t(ij, i)) * dpinv * cpinv 1462 fq(ij, i) = fq(ij, i) + g * dpinv * (amp1(ij) * (q(ij, i + 1) - q(ij, & 1463 i)) - ad(ij) * (q(ij, i) - q(ij, i - 1))) 1464 fu(ij, i) = fu(ij, i) + g * dpinv * (amp1(ij) * (u(ij, i + 1) - u(ij, & 1465 i)) - ad(ij) * (u(ij, i) - u(ij, i - 1))) 1466 fv(ij, i) = fv(ij, i) + g * dpinv * (amp1(ij) * (v(ij, i + 1) - v(ij, & 1467 i)) - ad(ij) * (v(ij, i) - v(ij, i - 1))) 1487 1468 END IF 1488 1469 END DO … … 1490 1471 DO ij = 1, ncum 1491 1472 IF (i<=inb(ij)) THEN 1492 awat = elij(ij, k, i) - (1. -ep(ij,i))*clw(ij, i)1473 awat = elij(ij, k, i) - (1. - ep(ij, i)) * clw(ij, i) 1493 1474 awat = max(awat, 0.0) 1494 fq(ij, i) = fq(ij, i) + g *dpinv*ment(ij, k, i)*(qent(ij,k,i)-awat-q &1495 (ij,i))1496 fu(ij, i) = fu(ij, i) + g *dpinv*ment(ij, k, i)*(uent(ij,k,i)-u(ij,i &1497 ))1498 fv(ij, i) = fv(ij, i) + g *dpinv*ment(ij, k, i)*(vent(ij,k,i)-v(ij,i &1499 ))1475 fq(ij, i) = fq(ij, i) + g * dpinv * ment(ij, k, i) * (qent(ij, k, i) - awat - q & 1476 (ij, i)) 1477 fu(ij, i) = fu(ij, i) + g * dpinv * ment(ij, k, i) * (uent(ij, k, i) - u(ij, i & 1478 )) 1479 fv(ij, i) = fv(ij, i) + g * dpinv * ment(ij, k, i) * (vent(ij, k, i) - v(ij, i & 1480 )) 1500 1481 ! (saturated updrafts resulting from mixing) ! cld 1501 qcond(ij, i) = qcond(ij, i) + (elij(ij, k,i)-awat) ! cld1482 qcond(ij, i) = qcond(ij, i) + (elij(ij, k, i) - awat) ! cld 1502 1483 nqcond(ij, i) = nqcond(ij, i) + 1. ! cld 1503 1484 END IF … … 1507 1488 DO ij = 1, ncum 1508 1489 IF ((i<=inb(ij)) .AND. (k<=inb(ij))) THEN 1509 fq(ij, i) = fq(ij, i) + g *dpinv*ment(ij, k, i)*(qent(ij,k,i)-q(ij,i &1510 ))1511 fu(ij, i) = fu(ij, i) + g *dpinv*ment(ij, k, i)*(uent(ij,k,i)-u(ij,i &1512 ))1513 fv(ij, i) = fv(ij, i) + g *dpinv*ment(ij, k, i)*(vent(ij,k,i)-v(ij,i &1514 ))1490 fq(ij, i) = fq(ij, i) + g * dpinv * ment(ij, k, i) * (qent(ij, k, i) - q(ij, i & 1491 )) 1492 fu(ij, i) = fu(ij, i) + g * dpinv * ment(ij, k, i) * (uent(ij, k, i) - u(ij, i & 1493 )) 1494 fv(ij, i) = fv(ij, i) + g * dpinv * ment(ij, k, i) * (vent(ij, k, i) - v(ij, i & 1495 )) 1515 1496 END IF 1516 1497 END DO … … 1518 1499 DO ij = 1, ncum 1519 1500 IF (i<=inb(ij)) THEN 1520 fq(ij, i) = fq(ij, i) + sigd *evap(ij, i) + g*(mp(ij,i+1)*(qp(ij, &1521 i+1)-q(ij,i))-mp(ij,i)*(qp(ij,i)-q(ij,i-1)))*dpinv1522 fu(ij, i) = fu(ij, i) + g *(mp(ij,i+1)*(up(ij,i+1)-u(ij, &1523 i))-mp(ij,i)*(up(ij,i)-u(ij,i-1)))*dpinv1524 fv(ij, i) = fv(ij, i) + g *(mp(ij,i+1)*(vp(ij,i+1)-v(ij, &1525 i))-mp(ij,i)*(vp(ij,i)-v(ij,i-1)))*dpinv1501 fq(ij, i) = fq(ij, i) + sigd * evap(ij, i) + g * (mp(ij, i + 1) * (qp(ij, & 1502 i + 1) - q(ij, i)) - mp(ij, i) * (qp(ij, i) - q(ij, i - 1))) * dpinv 1503 fu(ij, i) = fu(ij, i) + g * (mp(ij, i + 1) * (up(ij, i + 1) - u(ij, & 1504 i)) - mp(ij, i) * (up(ij, i) - u(ij, i - 1))) * dpinv 1505 fv(ij, i) = fv(ij, i) + g * (mp(ij, i + 1) * (vp(ij, i + 1) - v(ij, & 1506 i)) - mp(ij, i) * (vp(ij, i) - v(ij, i - 1))) * dpinv 1526 1507 ! (saturated downdrafts resulting from mixing) ! cld 1527 1508 DO k = i + 1, inb(ij) ! cld … … 1530 1511 END DO ! cld 1531 1512 ! (particular case: no detraining level is found) ! cld 1532 IF (nent(ij, i)==0) THEN ! cld1533 qcond(ij, i) = qcond(ij, i) + (1. -ep(ij,i))*clw(ij, i) ! cld1513 IF (nent(ij, i)==0) THEN ! cld 1514 qcond(ij, i) = qcond(ij, i) + (1. - ep(ij, i)) * clw(ij, i) ! cld 1534 1515 nqcond(ij, i) = nqcond(ij, i) + 1. ! cld 1535 1516 END IF ! cld 1536 IF (nqcond(ij, i)/=0.) THEN ! cld1537 qcond(ij, i) = qcond(ij, i) /nqcond(ij, i) ! cld1517 IF (nqcond(ij, i)/=0.) THEN ! cld 1518 qcond(ij, i) = qcond(ij, i) / nqcond(ij, i) ! cld 1538 1519 END IF ! cld 1539 1520 END IF 1540 1521 END DO 1541 1500 END DO1522 1500 END DO 1542 1523 1543 1524 ! *** Adjust tendencies at top of convection layer to reflect *** … … 1546 1527 DO ij = 1, ncum 1547 1528 fqold = fq(ij, inb(ij)) 1548 fq(ij, inb(ij)) = fq(ij, inb(ij)) *(1.-frac(ij))1549 fq(ij, inb(ij) -1) = fq(ij, inb(ij)-1) + frac(ij)*fqold*((ph(ij, &1550 inb(ij))-ph(ij,inb(ij)+1))/(ph(ij,inb(ij)-1)-ph(ij, &1551 inb(ij))))*lv(ij, inb(ij))/lv(ij, inb(ij)-1)1529 fq(ij, inb(ij)) = fq(ij, inb(ij)) * (1. - frac(ij)) 1530 fq(ij, inb(ij) - 1) = fq(ij, inb(ij) - 1) + frac(ij) * fqold * ((ph(ij, & 1531 inb(ij)) - ph(ij, inb(ij) + 1)) / (ph(ij, inb(ij) - 1) - ph(ij, & 1532 inb(ij)))) * lv(ij, inb(ij)) / lv(ij, inb(ij) - 1) 1552 1533 ftold = ft(ij, inb(ij)) 1553 ft(ij, inb(ij)) = ft(ij, inb(ij)) *(1.-frac(ij))1554 ft(ij, inb(ij) -1) = ft(ij, inb(ij)-1) + frac(ij)*ftold*((ph(ij, &1555 inb(ij))-ph(ij,inb(ij)+1))/(ph(ij,inb(ij)-1)-ph(ij, &1556 inb(ij))))*cpn(ij, inb(ij))/cpn(ij, inb(ij)-1)1534 ft(ij, inb(ij)) = ft(ij, inb(ij)) * (1. - frac(ij)) 1535 ft(ij, inb(ij) - 1) = ft(ij, inb(ij) - 1) + frac(ij) * ftold * ((ph(ij, & 1536 inb(ij)) - ph(ij, inb(ij) + 1)) / (ph(ij, inb(ij) - 1) - ph(ij, & 1537 inb(ij)))) * cpn(ij, inb(ij)) / cpn(ij, inb(ij) - 1) 1557 1538 fuold = fu(ij, inb(ij)) 1558 fu(ij, inb(ij)) = fu(ij, inb(ij)) *(1.-frac(ij))1559 fu(ij, inb(ij) -1) = fu(ij, inb(ij)-1) + frac(ij)*fuold*((ph(ij, &1560 inb(ij))-ph(ij,inb(ij)+1))/(ph(ij,inb(ij)-1)-ph(ij,inb(ij))))1539 fu(ij, inb(ij)) = fu(ij, inb(ij)) * (1. - frac(ij)) 1540 fu(ij, inb(ij) - 1) = fu(ij, inb(ij) - 1) + frac(ij) * fuold * ((ph(ij, & 1541 inb(ij)) - ph(ij, inb(ij) + 1)) / (ph(ij, inb(ij) - 1) - ph(ij, inb(ij)))) 1561 1542 fvold = fv(ij, inb(ij)) 1562 fv(ij, inb(ij)) = fv(ij, inb(ij)) *(1.-frac(ij))1563 fv(ij, inb(ij) -1) = fv(ij, inb(ij)-1) + frac(ij)*fvold*((ph(ij, &1564 inb(ij))-ph(ij,inb(ij)+1))/(ph(ij,inb(ij)-1)-ph(ij,inb(ij))))1543 fv(ij, inb(ij)) = fv(ij, inb(ij)) * (1. - frac(ij)) 1544 fv(ij, inb(ij) - 1) = fv(ij, inb(ij) - 1) + frac(ij) * fvold * ((ph(ij, & 1545 inb(ij)) - ph(ij, inb(ij) + 1)) / (ph(ij, inb(ij) - 1) - ph(ij, inb(ij)))) 1565 1546 END DO 1566 1547 … … 1573 1554 vav(ij) = 0.0 1574 1555 DO i = 1, inb(ij) 1575 ents(ij) = ents(ij) + (cpn(ij, i)*ft(ij,i)+lv(ij,i)*fq(ij,i))*(ph(ij,i)- &1576 ph(ij,i+1))1577 uav(ij) = uav(ij) + fu(ij, i) *(ph(ij,i)-ph(ij,i+1))1578 vav(ij) = vav(ij) + fv(ij, i) *(ph(ij,i)-ph(ij,i+1))1556 ents(ij) = ents(ij) + (cpn(ij, i) * ft(ij, i) + lv(ij, i) * fq(ij, i)) * (ph(ij, i) - & 1557 ph(ij, i + 1)) 1558 uav(ij) = uav(ij) + fu(ij, i) * (ph(ij, i) - ph(ij, i + 1)) 1559 vav(ij) = vav(ij) + fv(ij, i) * (ph(ij, i) - ph(ij, i + 1)) 1579 1560 END DO 1580 1561 END DO 1581 1562 DO ij = 1, ncum 1582 ents(ij) = ents(ij) /(ph(ij,1)-ph(ij,inb(ij)+1))1583 uav(ij) = uav(ij) /(ph(ij,1)-ph(ij,inb(ij)+1))1584 vav(ij) = vav(ij) /(ph(ij,1)-ph(ij,inb(ij)+1))1563 ents(ij) = ents(ij) / (ph(ij, 1) - ph(ij, inb(ij) + 1)) 1564 uav(ij) = uav(ij) / (ph(ij, 1) - ph(ij, inb(ij) + 1)) 1565 vav(ij) = vav(ij) / (ph(ij, 1) - ph(ij, inb(ij) + 1)) 1585 1566 END DO 1586 1567 DO ij = 1, ncum 1587 1568 DO i = 1, inb(ij) 1588 ft(ij, i) = ft(ij, i) - ents(ij) /cpn(ij, i)1589 fu(ij, i) = (1. -cu)*(fu(ij,i)-uav(ij))1590 fv(ij, i) = (1. -cu)*(fv(ij,i)-vav(ij))1569 ft(ij, i) = ft(ij, i) - ents(ij) / cpn(ij, i) 1570 fu(ij, i) = (1. - cu) * (fu(ij, i) - uav(ij)) 1571 fv(ij, i) = (1. - cu) * (fv(ij, i) - vav(ij)) 1591 1572 END DO 1592 1573 END DO … … 1594 1575 DO k = 1, nl + 1 1595 1576 DO i = 1, ncum 1596 IF ((q(i,k)+delt*fq(i,k))<0.0) iflag(i) = 10 1597 END DO 1598 END DO 1599 1577 IF ((q(i, k) + delt * fq(i, k))<0.0) iflag(i) = 10 1578 END DO 1579 END DO 1600 1580 1601 1581 DO i = 1, ncum … … 1624 1604 DO k = nl, 1, -1 1625 1605 DO i = 1, ncum 1626 ma(i, k) = ma(i, k +1) + m(i, k)1606 ma(i, k) = ma(i, k + 1) + m(i, k) 1627 1607 END DO 1628 1608 END DO … … 1646 1626 ax(ij, i) = 0. ! cld 1647 1627 DO j = icb(ij), i ! cld 1648 ax(ij, i) = ax(ij, i) + rrd *(tvp(ij,j)-tv(ij,j)) & ! cld1649 *(ph(ij,j)-ph(ij,j+1))/p(ij, j) ! cld1628 ax(ij, i) = ax(ij, i) + rrd * (tvp(ij, j) - tv(ij, j)) & ! cld 1629 * (ph(ij, j) - ph(ij, j + 1)) / p(ij, j) ! cld 1650 1630 END DO ! cld 1651 IF (ax(ij, i)>0.0) THEN ! cld1652 wa(ij, i) = sqrt(2. *ax(ij,i)) ! cld1631 IF (ax(ij, i)>0.0) THEN ! cld 1632 wa(ij, i) = sqrt(2. * ax(ij, i)) ! cld 1653 1633 END IF ! cld 1654 1634 END DO ! cld 1655 1635 DO i = 1, nl ! cld 1656 IF (wa(ij, i)>0.0) & ! cld1657 siga(ij, i) = mac(ij, i)/wa(ij, i) & ! cld1658 *rrd*tvp(ij, i)/p(ij, i)/100./delta ! cld1659 siga(ij, i) = min(siga(ij, i), 1.0) ! cld1660 qcondc(ij, i) = siga(ij, i) *clw(ij, i)*(1.-ep(ij,i)) & ! cld1661 +(1.-siga(ij,i))*qcond(ij, i) ! cld1636 IF (wa(ij, i)>0.0) & ! cld 1637 siga(ij, i) = mac(ij, i) / wa(ij, i) & ! cld 1638 * rrd * tvp(ij, i) / p(ij, i) / 100. / delta ! cld 1639 siga(ij, i) = min(siga(ij, i), 1.0) ! cld 1640 qcondc(ij, i) = siga(ij, i) * clw(ij, i) * (1. - ep(ij, i)) & ! cld 1641 + (1. - siga(ij, i)) * qcond(ij, i) ! cld 1662 1642 END DO ! cld 1663 1643 END DO ! cld 1664 1644 1665 1666 1645 END SUBROUTINE cv_yield 1667 1646 1668 1647 SUBROUTINE cv_uncompress(nloc, len, ncum, nd, idcum, iflag, precip, cbmf, ft, & 1669 fq, fu, fv, ma, qcondc, iflag1, precip1, cbmf1, ft1, fq1, fu1, fv1, ma1, &1670 qcondc1)1648 fq, fu, fv, ma, qcondc, iflag1, precip1, cbmf1, ft1, fq1, fu1, fv1, ma1, & 1649 qcondc1) 1671 1650 IMPLICIT NONE 1672 1651 … … 1709 1688 END DO 1710 1689 1711 1712 1690 END SUBROUTINE cv_uncompress 1713 1691 -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/cva_driver.F90
r5117 r5132 53 53 USE lmdz_print_control, ONLY: prt_level, lunout 54 54 USE add_phys_tend_mod, ONLY: fl_cor_ebil 55 USE lmdz_abort_physic, ONLY: abort_physic 55 56 #ifdef ISO 56 57 USE infotrac_phy, ONLY: ntraciso=>ntiso,niso,niso,itZonIso,nzone -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/isotopes_mod.F90
r5117 r5132 432 432 433 433 SUBROUTINE getinp_s(nam, val, def, lDisp) 434 USE ioipsl_getincom, ONLY: getin434 USE IOIPSL, ONLY: getin 435 435 USE lmdz_phys_mpi_data, ONLY: is_mpi_root 436 436 USE lmdz_phys_omp_data, ONLY: is_omp_root … … 451 451 452 452 SUBROUTINE getinp_i(nam, val, def, lDisp) 453 USE ioipsl_getincom, ONLY: getin453 USE IOIPSL, ONLY: getin 454 454 USE lmdz_phys_mpi_data, ONLY: is_mpi_root 455 455 USE lmdz_phys_omp_data, ONLY: is_omp_root … … 470 470 471 471 SUBROUTINE getinp_r(nam, val, def, lDisp) 472 USE ioipsl_getincom, ONLY: getin472 USE IOIPSL, ONLY: getin 473 473 USE lmdz_phys_mpi_data, ONLY: is_mpi_root 474 474 USE lmdz_phys_omp_data, ONLY: is_omp_root … … 489 489 490 490 SUBROUTINE getinp_l(nam, val, def, lDisp) 491 USE ioipsl_getincom, ONLY: getin491 USE IOIPSL, ONLY: getin 492 492 USE lmdz_phys_mpi_data, ONLY: is_mpi_root 493 493 USE lmdz_phys_omp_data, ONLY: is_omp_root -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/isotopes_routines_mod.F90
r5117 r5132 4 4 MODULE isotopes_routines_mod 5 5 USE infotrac_phy, ONLY: niso, ntraciso=>ntiso, index_trac=>itZonIso, ntraceurs_zone=>nzone 6 USE lmdz_abort_physic, ONLY: abort_physic 6 7 IMPLICIT NONE 7 8 -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/isotopes_verif_mod.F90
r5117 r5132 9 9 !#endif 10 10 USE infotrac_phy, ONLY: ntraciso=>ntiso, niso, itZonIso, nzone 11 USE lmdz_abort_physic, ONLY: abort_physic 11 12 IMPLICIT NONE 12 13 save -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/isotrac_mod.F90
r5117 r5132 6 6 USE lmdz_readTracFiles, ONLY: delPhase 7 7 USE isotopes_mod, ONLY: ridicule, get_in 8 USE lmdz_abort_physic, ONLY: abort_physic 8 9 9 10 IMPLICIT NONE -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/limit_read_mod.F90
r5117 r5132 11 11 ! limit_read_sst : return sea ice temperature 12 12 ! limit_read_tot : read limit.nc and store the fields in local modules variables 13 14 USE lmdz_abort_physic, ONLY: abort_physic 13 15 14 16 IMPLICIT NONE -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/lmdz_lscp_old.F90
r5117 r5132 4 4 5 5 MODULE lmdz_lscp_old 6 USE lmdz_abort_physic, ONLY: abort_physic 6 7 CONTAINS 7 8 SUBROUTINE fisrtilp(dtime,paprs,pplay,t,q,ptconv,ratqs, & -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/phyaqua_mod.F90
r5117 r5132 4 4 MODULE phyaqua_mod 5 5 ! Routines complementaires pour la physique planetaire. 6 USE lmdz_abort_physic, ONLY: abort_physic 6 7 IMPLICIT NONE 7 8 -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/phyetat0_mod.F90
r5117 r5132 2 2 3 3 MODULE phyetat0_mod 4 USE lmdz_abort_physic, ONLY: abort_physic 4 5 5 6 PRIVATE -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/phyredem.F90
r5117 r5132 51 51 USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys 52 52 USE config_ocean_skin_m, ONLY: activate_ocean_skin 53 USE lmdz_abort_physic, ONLY: abort_physic 53 54 54 55 IMPLICIT none -
LMDZ6/branches/Amaury_dev/libf/phylmdiso/physiq_mod.F90
r5128 r5132 111 111 USE phys_output_write_mod 112 112 113 USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DUST 113 USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DUST, CPPKEY_STRATAER 114 114 115 115 !!!!!!!!!!!!!!!!!! "USE" section for CPP keys !!!!!!!!!!!!!!!!!!!!!!!! … … 1494 1494 1495 1495 IF (CPPKEY_STRATAER) THEN 1496 #ifdef ISO 1497 CALL abort_gcm("physiq_mod", "StratAer isn't ISO-compatible for now, 07/24",1) 1498 #else 1496 1499 CALL strataer_init 1497 1500 CALL strataer_nuc_init 1498 1501 CALL strataer_emiss_init 1502 #endif 1499 1503 END IF 1500 1504 … … 1620 1624 CALL getin_p('iflag_phytrac',iflag_phytrac) 1621 1625 IF (CPPKEY_DUST) THEN 1622 IF (iflag_phytrac .EQ.0) THEN1626 IF (iflag_phytrac==0) THEN 1623 1627 WRITE(lunout,*) 'In order to run with SPLA, iflag_phytrac will be forced to 1' 1624 1628 iflag_phytrac = 1 … … 5776 5780 5777 5781 #ifdef CPP_RRTM 5778 IF (CPPKEY_STRATER) THEN 5782 IF (CPPKEY_STRATAER) THEN 5783 #ifdef ISO 5784 CALL abort_gcm("physiq_mod", "StratAer isn't ISO-compatible for now, 07/24",1) 5785 #else 5779 5786 !--compute stratospheric mask 5780 5787 CALL stratosphere_mask(missing_val, pphis, t_seri, pplay, latitude_deg) 5781 5788 !--interactive strat aerosols 5782 5789 CALL calcaerosolstrato_rrtm(pplay,t_seri,paprs,debut) 5790 #endif 5783 5791 END IF 5784 5792 #endif … … 6411 6419 IF (ok_qch4) THEN 6412 6420 ! d_q_ch4: H2O source from CH4 in MMR/s (mass mixing ratio/s or kg H2O/kg air/s) 6413 IF (CPPKEY_STRATER) THEN 6421 IF (CPPKEY_STRATAER) THEN 6422 #ifdef ISO 6423 CALL abort_gcm("physiq_mod", "StratAer isn't ISO-compatible for now, 07/24",1) 6424 #else 6414 6425 CALL stratH2O_methox(debut,paprs,d_q_ch4) 6426 #endif 6415 6427 ELSE 6416 6428 ! ECMWF routine METHOX … … 6435 6447 6436 6448 6437 IF (CPPKEY_STRATER) THEN 6449 IF (CPPKEY_STRATAER) THEN 6450 #ifdef ISO 6451 CALL abort_gcm("physiq_mod", "StratAer isn't ISO-compatible for now, 07/24",1) 6452 #else 6438 6453 IF (ok_qemiss) THEN 6439 6454 flh2o=1 … … 6478 6493 END SELECT ! emission scenario (flag_emit) 6479 6494 ENDIF 6495 #endif 6480 6496 END IF 6481 6497 … … 6932 6948 ENDDO 6933 6949 6934 IF (CPPKEY_STRATER) THEN 6950 IF (CPPKEY_STRATAER) THEN 6951 #ifdef ISO 6952 CALL abort_gcm("physiq_mod", "StratAer isn't ISO-compatible for now, 07/24",1) 6953 #else 6935 6954 IF (ok_qemiss) THEN 6936 6955 DO k = 1, klev … … 6938 6957 ENDDO 6939 6958 ENDIF 6959 #endif 6940 6960 END IF 6941 6961 IF (ok_qch4) THEN
Note: See TracChangeset
for help on using the changeset viewer.