--- trunk/Sources/phylmd/CV3_routines/cv3_undilute2.f 2016/03/16 14:42:58 183 +++ trunk/Sources/phylmd/CV30_routines/cv30_undilute2.f 2016/03/21 18:01:02 187 @@ -1,46 +1,52 @@ -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(ncum, icb, icbs, nk, tnk, qnk, gznk, t, qs, gz, & + p, h, tv, lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, ep, sigp, & + 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 cv30_param_m, only: dtovsh, minorig, nl, pbcrit, ptcrit, spfac use cvthermo, only: cl, clmcpv, cpd, cpv, eps, lv0, rrv + USE dimphy, ONLY: klon, klev - ! 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) + integer, intent(in):: ncum + + integer, intent(in):: icb(klon), icbs(klon) + ! 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(klon), buoybase(klon), plcl(klon) ! 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 (<= 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), sigp(klon, klev) + real buoy(klon, klev) ! Local: integer i, k real tg, qg, ahg, alv, s, tc, es, denom real pden - real ah0(nloc) + real ah0(klon) !--------------------------------------------------------------------- @@ -137,7 +143,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 +166,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 +180,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 +193,6 @@ end do end do - end SUBROUTINE cv3_undilute2 + end SUBROUTINE cv30_undilute2 -end module cv3_undilute2_m +end module cv30_undilute2_m