/[lmdze]/trunk/Sources/phylmd/CV30_routines/cv30_undilute2.f
ViewVC logotype

Diff of /trunk/Sources/phylmd/CV30_routines/cv30_undilute2.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 192 by guez, Thu May 12 13:00:07 2016 UTC revision 201 by guez, Mon Jun 6 17:42:15 2016 UTC
# Line 4  module cv30_undilute2_m Line 4  module cv30_undilute2_m
4    
5  contains  contains
6    
7    SUBROUTINE cv30_undilute2(ncum, icb, icbs, nk, tnk, qnk, gznk, t, qs, gz, &    SUBROUTINE cv30_undilute2(icb, icbs, tnk, qnk, gznk, t, qs, gz, p, h, tv, &
8         p, h, tv, lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, ep, sigp, &         lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, ep, buoy)
        buoy)  
9    
10      ! Undilute (adiabatic) updraft, second part. Purpose: find the      ! Undilute (adiabatic) updraft, second part. Purpose: find the
11      ! rest of the lifted parcel temperatures; compute the      ! rest of the lifted parcel temperatures; compute the
# Line 16  contains Line 15  contains
15      ! Vertical profile of buoyancy computed here (use of buoybase).      ! Vertical profile of buoyancy computed here (use of buoybase).
16    
17      use conema3_m, only: epmax      use conema3_m, only: epmax
18      use cv30_param_m, only: dtovsh, minorig, nl, pbcrit, ptcrit, spfac      use cv30_param_m, only: minorig, nl
19      use cv_thermo_m, only: cl, clmcpv, cpd, cpv, eps, lv0, rrv      use cv_thermo_m, only: clmcpv, eps
20      USE dimphy, ONLY: klon, klev      USE dimphy, ONLY: klon, klev
21        use SUPHEC_M, only: rcw, rlvtt, rcpd, rcpv, rv
22    
23      integer, intent(in):: ncum      integer, intent(in):: icb(:), icbs(:) ! (ncum)
   
     integer, intent(in):: icb(klon), icbs(klon)  
24      ! icbs is the first level above LCL (may differ from icb)      ! icbs is the first level above LCL (may differ from icb)
25    
26      integer, intent(in):: nk(klon)      real, intent(in):: tnk(:), qnk(:), gznk(:) ! (klon)
     real, intent(in):: tnk(klon), qnk(klon), gznk(klon)  
27      real, intent(in):: t(klon, klev), qs(klon, klev), gz(klon, klev)      real, intent(in):: t(klon, klev), qs(klon, klev), gz(klon, klev)
28      real, intent(in):: p(klon, klev), h(klon, klev)      real, intent(in):: p(klon, klev), h(klon, klev)
29      real, intent(in):: tv(klon, klev), lv(klon, klev)      real, intent(in):: tv(klon, klev)
30      real, intent(in):: pbase(klon), buoybase(klon), plcl(klon)      real, intent(in):: lv(:, :) ! (ncum, nl)
31        real, intent(in):: pbase(:), buoybase(:), plcl(:) ! (ncum)
32    
33      ! outputs:      ! outputs:
34      integer, intent(out):: inb(:) ! (ncum)      integer, intent(out):: inb(:) ! (ncum)
# Line 39  contains Line 37  contains
37    
38      real tp(klon, klev), tvp(klon, klev), clw(klon, klev)      real tp(klon, klev), tvp(klon, klev), clw(klon, klev)
39      ! condensed water not removed from tvp      ! condensed water not removed from tvp
40      real hp(klon, klev), ep(klon, klev), sigp(klon, klev)      real hp(klon, klev), ep(klon, klev)
41      real buoy(klon, klev)      real buoy(klon, klev)
42    
43      ! Local:      ! Local:
44    
45        integer ncum
46    
47        real, parameter:: pbcrit = 150.
48        ! critical cloud depth (mbar) beneath which the precipitation
49        ! efficiency is assumed to be zero
50    
51        real, parameter:: ptcrit = 500.
52        ! cloud depth (mbar) above which the precipitation efficiency is
53        ! assumed to be unity
54    
55        real, parameter:: dtovsh = - 0.2 ! dT for overshoot
56    
57      integer i, k      integer i, k
58      real tg, qg, ahg, alv, s, tc, es, denom      real tg, qg, ahg, alv, s, tc, es, denom
59      real pden      real pden
# Line 50  contains Line 61  contains
61    
62      !---------------------------------------------------------------------      !---------------------------------------------------------------------
63    
64        ncum = size(icb)
65    
66      ! SOME INITIALIZATIONS      ! SOME INITIALIZATIONS
67    
68      do k = 1, nl      do k = 1, nl
69         do i = 1, ncum         do i = 1, ncum
70            ep(i, k) = 0.0            ep(i, k) = 0.
           sigp(i, k) = spfac  
71         end do         end do
72      end do      end do
73    
# Line 67  contains Line 79  contains
79      ! Calculate certain parcel quantities, including static energy      ! Calculate certain parcel quantities, including static energy
80    
81      do i = 1, ncum      do i = 1, ncum
82         ah0(i) = (cpd * (1. - qnk(i)) + cl * qnk(i)) * tnk(i) &         ah0(i) = (rcpd * (1. - qnk(i)) + rcw * qnk(i)) * tnk(i) &
83              + qnk(i) * (lv0 - clmcpv * (tnk(i) - 273.15)) + gznk(i)              + qnk(i) * (rlvtt - clmcpv * (tnk(i) - 273.15)) + gznk(i)
84      end do      end do
85    
86      ! Find lifted parcel quantities above cloud base      ! Find lifted parcel quantities above cloud base
# Line 78  contains Line 90  contains
90            if (k >= (icbs(i) + 1)) then            if (k >= (icbs(i) + 1)) then
91               tg = t(i, k)               tg = t(i, k)
92               qg = qs(i, k)               qg = qs(i, k)
93               alv = lv0 - clmcpv * (t(i, k) - 273.15)               alv = rlvtt - clmcpv * (t(i, k) - 273.15)
94    
95               ! First iteration.               ! First iteration.
96    
97               s = cpd * (1. - qnk(i)) + cl * qnk(i) &               s = rcpd * (1. - qnk(i)) + rcw * qnk(i) &
98                    + alv * alv * qg / (rrv * t(i, k) * t(i, k))                    + alv * alv * qg / (rv * t(i, k) * t(i, k))
99               s = 1. / s               s = 1. / s
100    
101               ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gz(i, k)               ahg = rcpd * tg + (rcw - rcpd) * qnk(i) * tg + alv * qg + gz(i, k)
102               tg = tg + s * (ah0(i) - ahg)               tg = tg + s * (ah0(i) - ahg)
103    
104               tc = tg - 273.15               tc = tg - 273.15
105               denom = 243.5 + tc               denom = 243.5 + tc
106               denom = MAX(denom, 1.0)               denom = MAX(denom, 1.)
107    
108               es = 6.112 * exp(17.67 * tc / denom)               es = 6.112 * exp(17.67 * tc / denom)
109    
# Line 99  contains Line 111  contains
111    
112               ! Second iteration.               ! Second iteration.
113    
114               ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gz(i, k)               ahg = rcpd * tg + (rcw - rcpd) * qnk(i) * tg + alv * qg + gz(i, k)
115               tg = tg + s * (ah0(i) - ahg)               tg = tg + s * (ah0(i) - ahg)
116    
117               tc = tg - 273.15               tc = tg - 273.15
118               denom = 243.5 + tc               denom = 243.5 + tc
119               denom = MAX(denom, 1.0)               denom = MAX(denom, 1.)
120    
121               es = 6.112 * exp(17.67 * tc / denom)               es = 6.112 * exp(17.67 * tc / denom)
122    
123               qg = eps * es / (p(i, k) - es * (1. - eps))               qg = eps * es / (p(i, k) - es * (1. - eps))
124    
125               alv = lv0 - clmcpv * (t(i, k) - 273.15)               alv = rlvtt - clmcpv * (t(i, k) - 273.15)
126    
127               ! no approximation:               ! no approximation:
128               tp(i, k) = (ah0(i) - gz(i, k) - alv * qg) &               tp(i, k) = (ah0(i) - gz(i, k) - alv * qg) &
129                    / (cpd + (cl - cpd) * qnk(i))                    / (rcpd + (rcw - rcpd) * qnk(i))
130    
131               clw(i, k) = qnk(i) - qg               clw(i, k) = qnk(i) - qg
132               clw(i, k) = max(0.0, clw(i, k))               clw(i, k) = max(0., clw(i, k))
133               ! qg utilise au lieu du vrai mixing ratio rg:               ! qg utilise au lieu du vrai mixing ratio rg:
134               tvp(i, k) = tp(i, k) * (1. + qg / eps - qnk(i)) ! whole thing               tvp(i, k) = tp(i, k) * (1. + qg / eps - qnk(i)) ! whole thing
135            endif            endif
136         end do         end do
137      end do      end do
138    
139      ! SET THE PRECIPITATION EFFICIENCIES AND THE FRACTION OF      ! SET THE PRECIPITATION EFFICIENCIES
140      ! PRECIPITATION FALLING OUTSIDE OF CLOUD      ! It MAY BE a FUNCTION OF TP(I), P(I) AND CLW(I)
     ! THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I)  
141      do k = 1, nl      do k = 1, nl
142         do i = 1, ncum         do i = 1, ncum
143            pden = ptcrit - pbcrit            pden = ptcrit - pbcrit
144            ep(i, k) = (plcl(i) - p(i, k) - pbcrit) / pden * epmax            ep(i, k) = (plcl(i) - p(i, k) - pbcrit) / pden * epmax
145            ep(i, k) = max(ep(i, k), 0.0)            ep(i, k) = max(ep(i, k), 0.)
146            ep(i, k) = min(ep(i, k), epmax)            ep(i, k) = min(ep(i, k), epmax)
           sigp(i, k) = spfac  
147         end do         end do
148      end do      end do
149    
# Line 188  contains Line 198  contains
198    
199      do k = minorig + 1, nl      do k = minorig + 1, nl
200         do i = 1, ncum         do i = 1, ncum
201            if (k >= icb(i) .and. k <= inb(i)) hp(i, k) = h(i, nk(i)) &            if (k >= icb(i) .and. k <= inb(i)) hp(i, k) = h(i, minorig) &
202                 + (lv(i, k) + (cpd - cpv) * t(i, k)) * ep(i, k) * clw(i, k)                 + (lv(i, k) + (rcpd - rcpv) * t(i, k)) * ep(i, k) * clw(i, k)
203         end do         end do
204      end do      end do
205    

Legend:
Removed from v.192  
changed lines
  Added in v.201

  ViewVC Help
Powered by ViewVC 1.1.21