--- trunk/Sources/phylmd/CV30_routines/cv3_undilute2.f 2016/03/16 14:50:46 184 +++ trunk/Sources/phylmd/CV30_routines/cv30_undilute2.f 2016/05/23 13:50:39 196 @@ -1,55 +1,72 @@ -module cv3_undilute2_m +module cv30_undilute2_m implicit none contains - SUBROUTINE cv3_undilute2(nloc, ncum, nd, icb, icbs, nk, tnk, qnk, gznk, t, & - qs, gz, p, h, tv, lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, & - ep, sigp, buoy) - - ! Purpose: find the rest of the lifted parcel temperatures; - ! compute the precipitation efficiencies and the fraction of - ! precipitation falling outside of cloud; find the level of - ! neutral buoyancy. + SUBROUTINE cv30_undilute2(icb, icbs, nk, tnk, qnk, gznk, t, qs, gz, p, h, & + tv, lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, ep, buoy) + + ! Undilute (adiabatic) updraft, second part. Purpose: find the + ! rest of the lifted parcel temperatures; compute the + ! precipitation efficiencies and the fraction of precipitation + ! falling outside of cloud; find the level of neutral buoyancy. ! Vertical profile of buoyancy computed here (use of buoybase). use conema3_m, only: epmax - use cv3_param_m, only: dtovsh, minorig, nl, nlp, pbcrit, ptcrit, spfac - use cvthermo, only: cl, clmcpv, cpd, cpv, eps, lv0, rrv - - ! inputs: - integer, intent(in):: nloc, ncum, nd - integer icb(nloc), icbs(nloc), nk(nloc) - ! icbs (input) is the first level above LCL (may differ from icb) - real tnk(nloc), qnk(nloc), gznk(nloc) - real t(nloc, nd), qs(nloc, nd), gz(nloc, nd) - real p(nloc, nd), h(nloc, nd) - real tv(nloc, nd), lv(nloc, nd) - real pbase(nloc), buoybase(nloc), plcl(nloc) + use cv30_param_m, only: minorig, nl + use cv_thermo_m, only: cl, clmcpv, cpd, cpv, eps, lv0, rrv + USE dimphy, ONLY: klon, klev + + integer, intent(in):: icb(:), icbs(:) ! (ncum) + ! icbs is the first level above LCL (may differ from icb) + + integer, intent(in):: nk(klon) + real, intent(in):: tnk(klon), qnk(klon), gznk(klon) + real, intent(in):: t(klon, klev), qs(klon, klev), gz(klon, klev) + real, intent(in):: p(klon, klev), h(klon, klev) + real, intent(in):: tv(klon, klev), lv(klon, klev) + real, intent(in):: pbase(:), buoybase(:), plcl(:) ! (ncum) ! outputs: - integer inb(nloc) - real tp(nloc, nd), tvp(nloc, nd), clw(nloc, nd) + integer, intent(out):: inb(:) ! (ncum) + ! first model level above the level of neutral buoyancy of the + ! parcel (1 <= inb <= nl - 1) + + real tp(klon, klev), tvp(klon, klev), clw(klon, klev) ! condensed water not removed from tvp - real hp(nloc, nd), ep(nloc, nd), sigp(nloc, nd) - real buoy(nloc, nd) + real hp(klon, klev), ep(klon, klev) + real buoy(klon, klev) ! Local: + + integer ncum + + real, parameter:: pbcrit = 150. + ! critical cloud depth (mbar) beneath which the precipitation + ! efficiency is assumed to be zero + + real, parameter:: ptcrit = 500. + ! cloud depth (mbar) above which the precipitation efficiency is + ! assumed to be unity + + real, parameter:: dtovsh = - 0.2 ! dT for overshoot + integer i, k real tg, qg, ahg, alv, s, tc, es, denom real pden - real ah0(nloc) + real ah0(klon) !--------------------------------------------------------------------- + ncum = size(icb) + ! SOME INITIALIZATIONS do k = 1, nl do i = 1, ncum - ep(i, k) = 0.0 - sigp(i, k) = spfac + ep(i, k) = 0. end do end do @@ -85,7 +102,7 @@ tc = tg - 273.15 denom = 243.5 + tc - denom = MAX(denom, 1.0) + denom = MAX(denom, 1.) es = 6.112 * exp(17.67 * tc / denom) @@ -98,7 +115,7 @@ tc = tg - 273.15 denom = 243.5 + tc - denom = MAX(denom, 1.0) + denom = MAX(denom, 1.) es = 6.112 * exp(17.67 * tc / denom) @@ -111,23 +128,21 @@ / (cpd + (cl - cpd) * qnk(i)) clw(i, k) = qnk(i) - qg - clw(i, k) = max(0.0, clw(i, k)) + clw(i, k) = max(0., clw(i, k)) ! qg utilise au lieu du vrai mixing ratio rg: tvp(i, k) = tp(i, k) * (1. + qg / eps - qnk(i)) ! whole thing endif end do end do - ! SET THE PRECIPITATION EFFICIENCIES AND THE FRACTION OF - ! PRECIPITATION FALLING OUTSIDE OF CLOUD - ! THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I) + ! SET THE PRECIPITATION EFFICIENCIES + ! It MAY BE a FUNCTION OF TP(I), P(I) AND CLW(I) do k = 1, nl do i = 1, ncum pden = ptcrit - pbcrit ep(i, k) = (plcl(i) - p(i, k) - pbcrit) / pden * epmax - ep(i, k) = amax1(ep(i, k), 0.0) - ep(i, k) = amin1(ep(i, k), epmax) - sigp(i, k) = spfac + ep(i, k) = max(ep(i, k), 0.) + ep(i, k) = min(ep(i, k), epmax) end do end do @@ -137,7 +152,7 @@ ! tvp est calcule en une seule fois, et sans retirer ! l'eau condensee (~> reversible CAPE) do i = 1, ncum - tp(i, nlp) = tp(i, nl) + tp(i, nl + 1) = tp(i, nl) end do ! EFFECTIVE VERTICAL PROFILE OF BUOYANCY: @@ -160,12 +175,9 @@ buoy(icb(i), k) = buoybase(i) end do - ! FIND THE FIRST MODEL LEVEL (INB) ABOVE THE PARCEL'S - ! LEVEL OF NEUTRAL BUOYANCY + ! Compute inb: - do i = 1, ncum - inb(i) = nl - 1 - end do + inb = nl - 1 do i = 1, ncum do k = 1, nl - 1 @@ -177,7 +189,7 @@ ! CALCULATE LIQUID WATER STATIC ENERGY OF LIFTED PARCEL - do k = 1, nlp + do k = 1, nl + 1 do i = 1, ncum hp(i, k) = h(i, k) enddo @@ -190,6 +202,6 @@ end do end do - end SUBROUTINE cv3_undilute2 + end SUBROUTINE cv30_undilute2 -end module cv3_undilute2_m +end module cv30_undilute2_m