[1992] | 1 | |
---|
[1403] | 2 | ! $Id: cv3_routines.F90 5117 2024-07-24 14:23:34Z abarral $ |
---|
[524] | 3 | |
---|
| 4 | |
---|
| 5 | |
---|
[2205] | 6 | |
---|
[2259] | 7 | SUBROUTINE cv3_param(nd, k_upper, delt) |
---|
[2078] | 8 | |
---|
[5112] | 9 | USE lmdz_ioipsl_getin_p, ONLY: getin_p |
---|
[5117] | 10 | USE lmdz_phys_para |
---|
[1992] | 11 | IMPLICIT NONE |
---|
[524] | 12 | |
---|
[2007] | 13 | !------------------------------------------------------------ |
---|
| 14 | !Set parameters for convectL for iflag_con = 3 |
---|
| 15 | !------------------------------------------------------------ |
---|
[524] | 16 | |
---|
[1516] | 17 | |
---|
[2007] | 18 | !*** PBCRIT IS THE CRITICAL CLOUD DEPTH (MB) BENEATH WHICH THE *** |
---|
| 19 | !*** PRECIPITATION EFFICIENCY IS ASSUMED TO BE ZERO *** |
---|
| 20 | !*** PTCRIT IS THE CLOUD DEPTH (MB) ABOVE WHICH THE PRECIP. *** |
---|
| 21 | !*** EFFICIENCY IS ASSUMED TO BE UNITY *** |
---|
| 22 | !*** SIGD IS THE FRACTIONAL AREA COVERED BY UNSATURATED DNDRAFT *** |
---|
| 23 | !*** SPFAC IS THE FRACTION OF PRECIPITATION FALLING OUTSIDE *** |
---|
| 24 | !*** OF CLOUD *** |
---|
[1403] | 25 | |
---|
[2007] | 26 | ![TAU: CHARACTERISTIC TIMESCALE USED TO COMPUTE ALPHA & BETA] |
---|
| 27 | !*** ALPHA AND BETA ARE PARAMETERS THAT CONTROL THE RATE OF *** |
---|
| 28 | !*** APPROACH TO QUASI-EQUILIBRIUM *** |
---|
| 29 | !*** (THEIR STANDARD VALUES ARE 1.0 AND 0.96, RESPECTIVELY) *** |
---|
| 30 | !*** (BETA MUST BE LESS THAN OR EQUAL TO 1) *** |
---|
[1506] | 31 | |
---|
[2007] | 32 | !*** DTCRIT IS THE CRITICAL BUOYANCY (K) USED TO ADJUST THE *** |
---|
| 33 | !*** APPROACH TO QUASI-EQUILIBRIUM *** |
---|
| 34 | !*** IT MUST BE LESS THAN 0 *** |
---|
[524] | 35 | |
---|
[1992] | 36 | include "cv3param.h" |
---|
[3496] | 37 | include "cvflag.h" |
---|
[1992] | 38 | include "conema3.h" |
---|
[524] | 39 | |
---|
[2259] | 40 | INTEGER, INTENT(IN) :: nd |
---|
| 41 | INTEGER, INTENT(IN) :: k_upper |
---|
| 42 | REAL, INTENT(IN) :: delt ! timestep (seconds) |
---|
[524] | 43 | |
---|
[2393] | 44 | ! Local variables |
---|
[1992] | 45 | CHARACTER (LEN=20) :: modname = 'cv3_param' |
---|
| 46 | CHARACTER (LEN=80) :: abort_message |
---|
[524] | 47 | |
---|
[1992] | 48 | LOGICAL, SAVE :: first = .TRUE. |
---|
[2007] | 49 | !$OMP THREADPRIVATE(first) |
---|
[524] | 50 | |
---|
[2007] | 51 | !glb noff: integer limit for convection (nd-noff) |
---|
| 52 | ! minorig: First level of convection |
---|
[524] | 53 | |
---|
[2007] | 54 | ! -- limit levels for convection: |
---|
[524] | 55 | |
---|
[2259] | 56 | !jyg< |
---|
| 57 | ! noff is chosen such that nl = k_upper so that upmost loops end at about 22 km |
---|
[5099] | 58 | |
---|
[2259] | 59 | noff = min(max(nd-k_upper, 1), (nd+1)/2) |
---|
| 60 | !! noff = 1 |
---|
| 61 | !>jyg |
---|
[1992] | 62 | minorig = 1 |
---|
| 63 | nl = nd - noff |
---|
| 64 | nlp = nl + 1 |
---|
| 65 | nlm = nl - 1 |
---|
[524] | 66 | |
---|
[1992] | 67 | IF (first) THEN |
---|
[2007] | 68 | ! -- "microphysical" parameters: |
---|
| 69 | ! IM beg: ajout fis. reglage ep |
---|
[2458] | 70 | ! CR+JYG: shedding coefficient (used when iflag_mix_adiab=1) |
---|
[2007] | 71 | ! IM lu dans physiq.def via conf_phys.F90 epmax = 0.993 |
---|
[524] | 72 | |
---|
[1992] | 73 | omtrain = 45.0 ! used also for snow (no disctinction rain/snow) |
---|
[2007] | 74 | ! -- misc: |
---|
[1992] | 75 | dtovsh = -0.2 ! dT for overshoot |
---|
[2007] | 76 | ! cc dttrig = 5. ! (loose) condition for triggering |
---|
[1992] | 77 | dttrig = 10. ! (loose) condition for triggering |
---|
| 78 | dtcrit = -2.0 |
---|
[2398] | 79 | ! -- end of convection |
---|
[2007] | 80 | ! -- interface cloud parameterization: |
---|
[1992] | 81 | delta = 0.01 ! cld |
---|
[2007] | 82 | ! -- interface with boundary-layer (gust factor): (sb) |
---|
[1992] | 83 | betad = 10.0 ! original value (from convect 4.3) |
---|
[524] | 84 | |
---|
[2474] | 85 | ! Var interm pour le getin |
---|
[2757] | 86 | cv_flag_feed=1 |
---|
| 87 | CALL getin_p('cv_flag_feed',cv_flag_feed) |
---|
[2761] | 88 | T_top_max = 1000. |
---|
| 89 | CALL getin_p('t_top_max',T_top_max) |
---|
[2474] | 90 | dpbase=-40. |
---|
| 91 | CALL getin_p('dpbase',dpbase) |
---|
| 92 | pbcrit=150.0 |
---|
| 93 | CALL getin_p('pbcrit',pbcrit) |
---|
| 94 | ptcrit=500.0 |
---|
| 95 | CALL getin_p('ptcrit',ptcrit) |
---|
| 96 | sigdz=0.01 |
---|
| 97 | CALL getin_p('sigdz',sigdz) |
---|
| 98 | spfac=0.15 |
---|
| 99 | CALL getin_p('spfac',spfac) |
---|
| 100 | tau=8000. |
---|
| 101 | CALL getin_p('tau',tau) |
---|
| 102 | flag_wb=1 |
---|
| 103 | CALL getin_p('flag_wb',flag_wb) |
---|
| 104 | wbmax=6. |
---|
| 105 | CALL getin_p('wbmax',wbmax) |
---|
| 106 | ok_convstop=.False. |
---|
[5105] | 107 | CALL getin_p('ok_convstop ',ok_convstop) |
---|
[2474] | 108 | tau_stop=15000. |
---|
[5105] | 109 | CALL getin_p('tau_stop ',tau_stop) |
---|
[2474] | 110 | ok_intermittent=.False. |
---|
| 111 | CALL getin_p('ok_intermittent',ok_intermittent) |
---|
[2508] | 112 | ok_optim_yield=.False. |
---|
| 113 | CALL getin_p('ok_optim_yield',ok_optim_yield) |
---|
[2901] | 114 | ok_homo_tend=.TRUE. |
---|
| 115 | CALL getin_p('ok_homo_tend',ok_homo_tend) |
---|
[2905] | 116 | ok_entrain=.TRUE. |
---|
| 117 | CALL getin_p('ok_entrain',ok_entrain) |
---|
[2901] | 118 | |
---|
[2474] | 119 | coef_peel=0.25 |
---|
| 120 | CALL getin_p('coef_peel',coef_peel) |
---|
[524] | 121 | |
---|
[2474] | 122 | flag_epKEorig=1 |
---|
| 123 | CALL getin_p('flag_epKEorig',flag_epKEorig) |
---|
| 124 | elcrit=0.0003 |
---|
| 125 | CALL getin_p('elcrit',elcrit) |
---|
| 126 | tlcrit=-55.0 |
---|
| 127 | CALL getin_p('tlcrit',tlcrit) |
---|
[3496] | 128 | ejectliq=0. |
---|
| 129 | CALL getin_p('ejectliq',ejectliq) |
---|
| 130 | ejectice=0. |
---|
| 131 | CALL getin_p('ejectice',ejectice) |
---|
| 132 | cvflag_prec_eject = .FALSE. |
---|
| 133 | CALL getin_p('cvflag_prec_eject',cvflag_prec_eject) |
---|
[3492] | 134 | qsat_depends_on_qt = .FALSE. |
---|
| 135 | CALL getin_p('qsat_depends_on_qt',qsat_depends_on_qt) |
---|
[3496] | 136 | adiab_ascent_mass_flux_depends_on_ejectliq = .FALSE. |
---|
| 137 | CALL getin_p('adiab_ascent_mass_flux_depends_on_ejectliq',adiab_ascent_mass_flux_depends_on_ejectliq) |
---|
[3502] | 138 | keepbug_ice_frac = .TRUE. |
---|
| 139 | CALL getin_p('keepbug_ice_frac', keepbug_ice_frac) |
---|
[2474] | 140 | |
---|
[2761] | 141 | WRITE (*, *) 't_top_max=', t_top_max |
---|
[2474] | 142 | WRITE (*, *) 'dpbase=', dpbase |
---|
| 143 | WRITE (*, *) 'pbcrit=', pbcrit |
---|
| 144 | WRITE (*, *) 'ptcrit=', ptcrit |
---|
| 145 | WRITE (*, *) 'sigdz=', sigdz |
---|
| 146 | WRITE (*, *) 'spfac=', spfac |
---|
| 147 | WRITE (*, *) 'tau=', tau |
---|
| 148 | WRITE (*, *) 'flag_wb=', flag_wb |
---|
| 149 | WRITE (*, *) 'wbmax=', wbmax |
---|
| 150 | WRITE (*, *) 'ok_convstop=', ok_convstop |
---|
| 151 | WRITE (*, *) 'tau_stop=', tau_stop |
---|
| 152 | WRITE (*, *) 'ok_intermittent=', ok_intermittent |
---|
[2508] | 153 | WRITE (*, *) 'ok_optim_yield =', ok_optim_yield |
---|
[2474] | 154 | WRITE (*, *) 'coef_peel=', coef_peel |
---|
| 155 | |
---|
| 156 | WRITE (*, *) 'flag_epKEorig=', flag_epKEorig |
---|
| 157 | WRITE (*, *) 'elcrit=', elcrit |
---|
| 158 | WRITE (*, *) 'tlcrit=', tlcrit |
---|
[3502] | 159 | WRITE (*, *) 'ejectliq=', ejectliq |
---|
| 160 | WRITE (*, *) 'ejectice=', ejectice |
---|
| 161 | WRITE (*, *) 'cvflag_prec_eject =', cvflag_prec_eject |
---|
| 162 | WRITE (*, *) 'qsat_depends_on_qt =', qsat_depends_on_qt |
---|
| 163 | WRITE (*, *) 'adiab_ascent_mass_flux_depends_on_ejectliq =', adiab_ascent_mass_flux_depends_on_ejectliq |
---|
| 164 | WRITE (*, *) 'keepbug_ice_frac =', keepbug_ice_frac |
---|
| 165 | |
---|
[1992] | 166 | first = .FALSE. |
---|
[2007] | 167 | END IF ! (first) |
---|
| 168 | |
---|
[1992] | 169 | beta = 1.0 - delt/tau |
---|
| 170 | alpha1 = 1.5E-3 |
---|
[2007] | 171 | !JYG Correction bug alpha |
---|
[1992] | 172 | alpha1 = alpha1*1.5 |
---|
| 173 | alpha = alpha1*delt/tau |
---|
[2007] | 174 | !JYG Bug |
---|
| 175 | ! cc increase alpha to compensate W decrease: |
---|
| 176 | ! c alpha = alpha*1.5 |
---|
[524] | 177 | |
---|
[2398] | 178 | noconv_stop = max(2.,tau_stop/delt) |
---|
| 179 | |
---|
[5105] | 180 | |
---|
[2468] | 181 | END SUBROUTINE cv3_param |
---|
[524] | 182 | |
---|
[2398] | 183 | SUBROUTINE cv3_incrcount(len, nd, delt, sig) |
---|
| 184 | |
---|
| 185 | IMPLICIT NONE |
---|
| 186 | |
---|
| 187 | ! ===================================================================== |
---|
| 188 | ! Increment the counter sig(nd) |
---|
| 189 | ! ===================================================================== |
---|
| 190 | |
---|
| 191 | include "cv3param.h" |
---|
[3496] | 192 | include "cvflag.h" |
---|
[2398] | 193 | |
---|
| 194 | !inputs: |
---|
| 195 | INTEGER, INTENT(IN) :: len |
---|
| 196 | INTEGER, INTENT(IN) :: nd |
---|
| 197 | REAL, INTENT(IN) :: delt ! timestep (seconds) |
---|
| 198 | |
---|
| 199 | !input/output |
---|
| 200 | REAL, DIMENSION(len,nd), INTENT(INOUT) :: sig |
---|
| 201 | |
---|
| 202 | !local variables |
---|
| 203 | INTEGER il |
---|
| 204 | |
---|
| 205 | ! print *,'cv3_incrcount : noconv_stop ',noconv_stop |
---|
| 206 | ! print *,'cv3_incrcount in, sig(1,nd) ',sig(1,nd) |
---|
| 207 | IF(ok_convstop) THEN |
---|
| 208 | DO il = 1, len |
---|
| 209 | sig(il, nd) = sig(il, nd) + 1. |
---|
| 210 | sig(il, nd) = min(sig(il,nd), noconv_stop+0.1) |
---|
| 211 | END DO |
---|
| 212 | ELSE |
---|
| 213 | DO il = 1, len |
---|
| 214 | sig(il, nd) = sig(il, nd) + 1. |
---|
| 215 | sig(il, nd) = min(sig(il,nd), 12.1) |
---|
| 216 | END DO |
---|
| 217 | ENDIF ! (ok_convstop) |
---|
| 218 | ! print *,'cv3_incrcount out, sig(1,nd) ',sig(1,nd) |
---|
| 219 | |
---|
[5105] | 220 | |
---|
[2398] | 221 | END SUBROUTINE cv3_incrcount |
---|
| 222 | |
---|
[2007] | 223 | SUBROUTINE cv3_prelim(len, nd, ndp1, t, q, p, ph, & |
---|
| 224 | lv, lf, cpn, tv, gz, h, hm, th) |
---|
[1992] | 225 | IMPLICIT NONE |
---|
[524] | 226 | |
---|
[2007] | 227 | ! ===================================================================== |
---|
| 228 | ! --- CALCULATE ARRAYS OF GEOPOTENTIAL, HEAT CAPACITY & STATIC ENERGY |
---|
| 229 | ! "ori": from convect4.3 (vectorized) |
---|
| 230 | ! "convect3": to be exactly consistent with convect3 |
---|
| 231 | ! ===================================================================== |
---|
[524] | 232 | |
---|
[2007] | 233 | ! inputs: |
---|
[1992] | 234 | INTEGER len, nd, ndp1 |
---|
| 235 | REAL t(len, nd), q(len, nd), p(len, nd), ph(len, ndp1) |
---|
[524] | 236 | |
---|
[2007] | 237 | ! outputs: |
---|
[1992] | 238 | REAL lv(len, nd), lf(len, nd), cpn(len, nd), tv(len, nd) |
---|
| 239 | REAL gz(len, nd), h(len, nd), hm(len, nd) |
---|
| 240 | REAL th(len, nd) |
---|
[524] | 241 | |
---|
[2007] | 242 | ! local variables: |
---|
[1992] | 243 | INTEGER k, i |
---|
| 244 | REAL rdcp |
---|
| 245 | REAL tvx, tvy ! convect3 |
---|
| 246 | REAL cpx(len, nd) |
---|
[524] | 247 | |
---|
[1992] | 248 | include "cvthermo.h" |
---|
| 249 | include "cv3param.h" |
---|
[524] | 250 | |
---|
| 251 | |
---|
[2007] | 252 | ! ori do 110 k=1,nlp |
---|
| 253 | ! abderr do 110 k=1,nl ! convect3 |
---|
[1992] | 254 | DO k = 1, nlp |
---|
[524] | 255 | |
---|
[1992] | 256 | DO i = 1, len |
---|
[2007] | 257 | ! debug lv(i,k)= lv0-clmcpv*(t(i,k)-t0) |
---|
[1992] | 258 | lv(i, k) = lv0 - clmcpv*(t(i,k)-273.15) |
---|
[3492] | 259 | !! lf(i, k) = lf0 - clmci*(t(i,k)-273.15) ! erreur de signe !! |
---|
| 260 | lf(i, k) = lf0 + clmci*(t(i,k)-273.15) |
---|
[1992] | 261 | cpn(i, k) = cpd*(1.0-q(i,k)) + cpv*q(i, k) |
---|
| 262 | cpx(i, k) = cpd*(1.0-q(i,k)) + cl*q(i, k) |
---|
[2007] | 263 | ! ori tv(i,k)=t(i,k)*(1.0+q(i,k)*epsim1) |
---|
[1992] | 264 | tv(i, k) = t(i, k)*(1.0+q(i,k)/eps-q(i,k)) |
---|
| 265 | rdcp = (rrd*(1.-q(i,k))+q(i,k)*rrv)/cpn(i, k) |
---|
| 266 | th(i, k) = t(i, k)*(1000.0/p(i,k))**rdcp |
---|
| 267 | END DO |
---|
| 268 | END DO |
---|
[524] | 269 | |
---|
[2007] | 270 | ! gz = phi at the full levels (same as p). |
---|
[524] | 271 | |
---|
[2605] | 272 | !! DO i = 1, len !jyg |
---|
| 273 | !! gz(i, 1) = 0.0 !jyg |
---|
| 274 | !! END DO !jyg |
---|
| 275 | gz(:,:) = 0. !jyg: initialization of the whole array |
---|
[2007] | 276 | ! ori do 140 k=2,nlp |
---|
[1992] | 277 | DO k = 2, nl ! convect3 |
---|
| 278 | DO i = 1, len |
---|
[2007] | 279 | tvx = t(i, k)*(1.+q(i,k)/eps-q(i,k)) !convect3 |
---|
| 280 | tvy = t(i, k-1)*(1.+q(i,k-1)/eps-q(i,k-1)) !convect3 |
---|
| 281 | gz(i, k) = gz(i, k-1) + 0.5*rrd*(tvx+tvy)* & !convect3 |
---|
| 282 | (p(i,k-1)-p(i,k))/ph(i, k) !convect3 |
---|
[879] | 283 | |
---|
[2007] | 284 | ! c print *,' gz(',k,')',gz(i,k),' tvx',tvx,' tvy ',tvy |
---|
[879] | 285 | |
---|
[2007] | 286 | ! ori gz(i,k)=gz(i,k-1)+hrd*(tv(i,k-1)+tv(i,k)) |
---|
| 287 | ! ori & *(p(i,k-1)-p(i,k))/ph(i,k) |
---|
[1992] | 288 | END DO |
---|
| 289 | END DO |
---|
[524] | 290 | |
---|
[2007] | 291 | ! h = phi + cpT (dry static energy). |
---|
| 292 | ! hm = phi + cp(T-Tbase)+Lq |
---|
[524] | 293 | |
---|
[2007] | 294 | ! ori do 170 k=1,nlp |
---|
[1992] | 295 | DO k = 1, nl ! convect3 |
---|
| 296 | DO i = 1, len |
---|
| 297 | h(i, k) = gz(i, k) + cpn(i, k)*t(i, k) |
---|
| 298 | hm(i, k) = gz(i, k) + cpx(i, k)*(t(i,k)-t(i,1)) + lv(i, k)*q(i, k) |
---|
| 299 | END DO |
---|
| 300 | END DO |
---|
[524] | 301 | |
---|
[5105] | 302 | |
---|
[1992] | 303 | END SUBROUTINE cv3_prelim |
---|
[524] | 304 | |
---|
[2007] | 305 | SUBROUTINE cv3_feed(len, nd, ok_conserv_q, & |
---|
[2902] | 306 | t, q, u, v, p, ph, h, gz, & |
---|
[2007] | 307 | p1feed, p2feed, wght, & |
---|
| 308 | wghti, tnk, thnk, qnk, qsnk, unk, vnk, & |
---|
| 309 | cpnk, hnk, nk, icb, icbmax, iflag, gznk, plcl) |
---|
[2818] | 310 | |
---|
[5110] | 311 | USE lmdz_phys_transfert_para, ONLY: bcast |
---|
[2902] | 312 | USE add_phys_tend_mod, ONLY: fl_cor_ebil |
---|
[5112] | 313 | USE lmdz_print_control, ONLY: prt_level |
---|
[1992] | 314 | IMPLICIT NONE |
---|
[524] | 315 | |
---|
[2007] | 316 | ! ================================================================ |
---|
| 317 | ! Purpose: CONVECTIVE FEED |
---|
[524] | 318 | |
---|
[2007] | 319 | ! Main differences with cv_feed: |
---|
| 320 | ! - ph added in input |
---|
| 321 | ! - here, nk(i)=minorig |
---|
| 322 | ! - icb defined differently (plcl compared with ph instead of p) |
---|
[2902] | 323 | ! - dry static energy as argument instead of moist static energy |
---|
[524] | 324 | |
---|
[2007] | 325 | ! Main differences with convect3: |
---|
| 326 | ! - we do not compute dplcldt and dplcldr of CLIFT anymore |
---|
| 327 | ! - values iflag different (but tests identical) |
---|
| 328 | ! - A,B explicitely defined (!...) |
---|
| 329 | ! ================================================================ |
---|
[524] | 330 | |
---|
[1992] | 331 | include "cv3param.h" |
---|
| 332 | include "cvthermo.h" |
---|
[524] | 333 | |
---|
[2007] | 334 | !inputs: |
---|
[2253] | 335 | INTEGER, INTENT (IN) :: len, nd |
---|
| 336 | LOGICAL, INTENT (IN) :: ok_conserv_q |
---|
| 337 | REAL, DIMENSION (len, nd), INTENT (IN) :: t, q, p |
---|
| 338 | REAL, DIMENSION (len, nd), INTENT (IN) :: u, v |
---|
[2902] | 339 | REAL, DIMENSION (len, nd), INTENT (IN) :: h, gz |
---|
[2253] | 340 | REAL, DIMENSION (len, nd+1), INTENT (IN) :: ph |
---|
| 341 | REAL, DIMENSION (len), INTENT (IN) :: p1feed |
---|
| 342 | REAL, DIMENSION (nd), INTENT (IN) :: wght |
---|
[2007] | 343 | !input-output |
---|
[2253] | 344 | REAL, DIMENSION (len), INTENT (INOUT) :: p2feed |
---|
[2007] | 345 | !outputs: |
---|
[2253] | 346 | INTEGER, INTENT (OUT) :: icbmax |
---|
| 347 | INTEGER, DIMENSION (len), INTENT (OUT) :: iflag, nk, icb |
---|
| 348 | REAL, DIMENSION (len, nd), INTENT (OUT) :: wghti |
---|
| 349 | REAL, DIMENSION (len), INTENT (OUT) :: tnk, thnk, qnk, qsnk |
---|
| 350 | REAL, DIMENSION (len), INTENT (OUT) :: unk, vnk |
---|
| 351 | REAL, DIMENSION (len), INTENT (OUT) :: cpnk, hnk, gznk |
---|
| 352 | REAL, DIMENSION (len), INTENT (OUT) :: plcl |
---|
[524] | 353 | |
---|
[2007] | 354 | !local variables: |
---|
[1992] | 355 | INTEGER i, k, iter, niter |
---|
| 356 | INTEGER ihmin(len) |
---|
| 357 | REAL work(len) |
---|
| 358 | REAL pup(len), plo(len), pfeed(len) |
---|
| 359 | REAL plclup(len), plcllo(len), plclfeed(len) |
---|
[2007] | 360 | REAL pfeedmin(len) |
---|
[1992] | 361 | REAL posit(len) |
---|
| 362 | LOGICAL nocond(len) |
---|
[524] | 363 | |
---|
[2007] | 364 | !jyg20140217< |
---|
| 365 | INTEGER iostat |
---|
| 366 | LOGICAL, SAVE :: first |
---|
| 367 | LOGICAL, SAVE :: ok_new_feed |
---|
| 368 | REAL, SAVE :: dp_lcl_feed |
---|
| 369 | !$OMP THREADPRIVATE (first,ok_new_feed,dp_lcl_feed) |
---|
| 370 | DATA first/.TRUE./ |
---|
| 371 | DATA dp_lcl_feed/2./ |
---|
[524] | 372 | |
---|
[2007] | 373 | IF (first) THEN |
---|
| 374 | !$OMP MASTER |
---|
| 375 | ok_new_feed = ok_conserv_q |
---|
| 376 | OPEN (98, FILE='cv3feed_param.data', STATUS='old', FORM='formatted', IOSTAT=iostat) |
---|
| 377 | IF (iostat==0) THEN |
---|
| 378 | READ (98, *, END=998) ok_new_feed |
---|
| 379 | 998 CONTINUE |
---|
| 380 | CLOSE (98) |
---|
| 381 | END IF |
---|
| 382 | PRINT *, ' ok_new_feed: ', ok_new_feed |
---|
| 383 | !$OMP END MASTER |
---|
[5101] | 384 | CALL bcast(ok_new_feed) |
---|
[2818] | 385 | first = .FALSE. |
---|
[2007] | 386 | END IF |
---|
| 387 | !jyg> |
---|
| 388 | ! ------------------------------------------------------------------- |
---|
| 389 | ! --- Origin level of ascending parcels for convect3: |
---|
| 390 | ! ------------------------------------------------------------------- |
---|
| 391 | |
---|
[1992] | 392 | DO i = 1, len |
---|
| 393 | nk(i) = minorig |
---|
| 394 | gznk(i) = gz(i, nk(i)) |
---|
| 395 | END DO |
---|
[524] | 396 | |
---|
[2007] | 397 | ! ------------------------------------------------------------------- |
---|
| 398 | ! --- Adjust feeding layer thickness so that lifting up to the top of |
---|
| 399 | ! --- the feeding layer does not induce condensation (i.e. so that |
---|
| 400 | ! --- plcl < p2feed). |
---|
| 401 | ! --- Method : iterative secant method. |
---|
| 402 | ! ------------------------------------------------------------------- |
---|
[524] | 403 | |
---|
[2007] | 404 | ! 1- First bracketing of the solution : ph(nk+1), p2feed |
---|
[524] | 405 | |
---|
[2007] | 406 | ! 1.a- LCL associated with p2feed |
---|
[1992] | 407 | DO i = 1, len |
---|
| 408 | pup(i) = p2feed(i) |
---|
| 409 | END DO |
---|
[2902] | 410 | IF (fl_cor_ebil >=2 ) THEN |
---|
| 411 | CALL cv3_estatmix(len, nd, iflag, p1feed, pup, p, ph, & |
---|
| 412 | t, q, u, v, h, gz, wght, & |
---|
| 413 | wghti, nk, tnk, thnk, qnk, qsnk, unk, vnk, plclup) |
---|
| 414 | ELSE |
---|
| 415 | CALL cv3_enthalpmix(len, nd, iflag, p1feed, pup, p, ph, & |
---|
| 416 | t, q, u, v, wght, & |
---|
| 417 | wghti, nk, tnk, thnk, qnk, qsnk, unk, vnk, plclup) |
---|
| 418 | ENDIF ! (fl_cor_ebil >=2 ) |
---|
[2007] | 419 | ! 1.b- LCL associated with ph(nk+1) |
---|
[1992] | 420 | DO i = 1, len |
---|
| 421 | plo(i) = ph(i, nk(i)+1) |
---|
| 422 | END DO |
---|
[2902] | 423 | IF (fl_cor_ebil >=2 ) THEN |
---|
| 424 | CALL cv3_estatmix(len, nd, iflag, p1feed, plo, p, ph, & |
---|
| 425 | t, q, u, v, h, gz, wght, & |
---|
| 426 | wghti, nk, tnk, thnk, qnk, qsnk, unk, vnk, plcllo) |
---|
| 427 | ELSE |
---|
| 428 | CALL cv3_enthalpmix(len, nd, iflag, p1feed, plo, p, ph, & |
---|
| 429 | t, q, u, v, wght, & |
---|
| 430 | wghti, nk, tnk, thnk, qnk, qsnk, unk, vnk, plcllo) |
---|
| 431 | ENDIF ! (fl_cor_ebil >=2 ) |
---|
[2007] | 432 | ! 2- Iterations |
---|
[1992] | 433 | niter = 5 |
---|
| 434 | DO iter = 1, niter |
---|
| 435 | DO i = 1, len |
---|
| 436 | plcllo(i) = min(plo(i), plcllo(i)) |
---|
| 437 | plclup(i) = max(pup(i), plclup(i)) |
---|
| 438 | nocond(i) = plclup(i) <= pup(i) |
---|
| 439 | END DO |
---|
| 440 | DO i = 1, len |
---|
| 441 | IF (nocond(i)) THEN |
---|
| 442 | pfeed(i) = pup(i) |
---|
| 443 | ELSE |
---|
[2007] | 444 | !JYG20140217< |
---|
| 445 | IF (ok_new_feed) THEN |
---|
| 446 | pfeed(i) = (pup(i)*(plo(i)-plcllo(i)-dp_lcl_feed)+ & |
---|
| 447 | plo(i)*(plclup(i)-pup(i)+dp_lcl_feed))/ & |
---|
| 448 | (plo(i)-plcllo(i)+plclup(i)-pup(i)) |
---|
| 449 | ELSE |
---|
| 450 | pfeed(i) = (pup(i)*(plo(i)-plcllo(i))+ & |
---|
| 451 | plo(i)*(plclup(i)-pup(i)))/ & |
---|
| 452 | (plo(i)-plcllo(i)+plclup(i)-pup(i)) |
---|
| 453 | END IF |
---|
| 454 | !JYG> |
---|
[1992] | 455 | END IF |
---|
| 456 | END DO |
---|
[2007] | 457 | !jyg20140217< |
---|
| 458 | ! For the last iteration, make sure that the top of the feeding layer |
---|
| 459 | ! and LCL are not in the same layer: |
---|
| 460 | IF (ok_new_feed) THEN |
---|
| 461 | IF (iter==niter) THEN |
---|
[2605] | 462 | DO i = 1,len !jyg |
---|
| 463 | pfeedmin(i) = ph(i,minorig+1) !jyg |
---|
| 464 | ENDDO !jyg |
---|
| 465 | DO k = minorig+1, nl !jyg |
---|
| 466 | !! DO k = minorig, nl !jyg |
---|
[2007] | 467 | DO i = 1, len |
---|
| 468 | IF (ph(i,k)>=plclfeed(i)) pfeedmin(i) = ph(i, k) |
---|
| 469 | END DO |
---|
| 470 | END DO |
---|
| 471 | DO i = 1, len |
---|
| 472 | pfeed(i) = max(pfeedmin(i), pfeed(i)) |
---|
| 473 | END DO |
---|
| 474 | END IF |
---|
| 475 | END IF |
---|
| 476 | !jyg> |
---|
| 477 | |
---|
[2902] | 478 | IF (fl_cor_ebil >=2 ) THEN |
---|
| 479 | CALL cv3_estatmix(len, nd, iflag, p1feed, pfeed, p, ph, & |
---|
| 480 | t, q, u, v, h, gz, wght, & |
---|
| 481 | wghti, nk, tnk, thnk, qnk, qsnk, unk, vnk, plclfeed) |
---|
| 482 | ELSE |
---|
| 483 | CALL cv3_enthalpmix(len, nd, iflag, p1feed, pfeed, p, ph, & |
---|
| 484 | t, q, u, v, wght, & |
---|
| 485 | wghti, nk, tnk, thnk, qnk, qsnk, unk, vnk, plclfeed) |
---|
| 486 | ENDIF ! (fl_cor_ebil >=2 ) |
---|
[2007] | 487 | !jyg20140217< |
---|
| 488 | IF (ok_new_feed) THEN |
---|
| 489 | DO i = 1, len |
---|
| 490 | posit(i) = (sign(1.,plclfeed(i)-pfeed(i)+dp_lcl_feed)+1.)*0.5 |
---|
| 491 | IF (plclfeed(i)-pfeed(i)+dp_lcl_feed==0.) posit(i) = 1. |
---|
| 492 | END DO |
---|
| 493 | ELSE |
---|
| 494 | DO i = 1, len |
---|
| 495 | posit(i) = (sign(1.,plclfeed(i)-pfeed(i))+1.)*0.5 |
---|
| 496 | IF (plclfeed(i)==pfeed(i)) posit(i) = 1. |
---|
| 497 | END DO |
---|
| 498 | END IF |
---|
| 499 | !jyg> |
---|
[1992] | 500 | DO i = 1, len |
---|
[2007] | 501 | ! - posit = 1 when lcl is below top of feeding layer (plclfeed>pfeed) |
---|
| 502 | ! - => pup=pfeed |
---|
| 503 | ! - posit = 0 when lcl is above top of feeding layer (plclfeed<pfeed) |
---|
| 504 | ! - => plo=pfeed |
---|
[1992] | 505 | pup(i) = posit(i)*pfeed(i) + (1.-posit(i))*pup(i) |
---|
| 506 | plo(i) = (1.-posit(i))*pfeed(i) + posit(i)*plo(i) |
---|
| 507 | plclup(i) = posit(i)*plclfeed(i) + (1.-posit(i))*plclup(i) |
---|
| 508 | plcllo(i) = (1.-posit(i))*plclfeed(i) + posit(i)*plcllo(i) |
---|
| 509 | END DO |
---|
| 510 | END DO ! iter |
---|
[2757] | 511 | |
---|
[1992] | 512 | DO i = 1, len |
---|
| 513 | p2feed(i) = pfeed(i) |
---|
| 514 | plcl(i) = plclfeed(i) |
---|
| 515 | END DO |
---|
[524] | 516 | |
---|
[1992] | 517 | DO i = 1, len |
---|
| 518 | cpnk(i) = cpd*(1.0-qnk(i)) + cpv*qnk(i) |
---|
| 519 | hnk(i) = gz(i, 1) + cpnk(i)*tnk(i) |
---|
| 520 | END DO |
---|
[524] | 521 | |
---|
[2007] | 522 | ! ------------------------------------------------------------------- |
---|
| 523 | ! --- Check whether parcel level temperature and specific humidity |
---|
| 524 | ! --- are reasonable |
---|
| 525 | ! ------------------------------------------------------------------- |
---|
[2757] | 526 | IF (cv_flag_feed == 1) THEN |
---|
| 527 | DO i = 1, len |
---|
| 528 | IF (((tnk(i)<250.0) .OR. & |
---|
| 529 | (qnk(i)<=0.0)) .AND. & |
---|
| 530 | (iflag(i)==0)) iflag(i) = 7 |
---|
| 531 | END DO |
---|
| 532 | ELSEIF (cv_flag_feed >= 2) THEN |
---|
| 533 | ! --- and demand that LCL be high enough |
---|
| 534 | DO i = 1, len |
---|
| 535 | IF (((tnk(i)<250.0) .OR. & |
---|
| 536 | (qnk(i)<=0.0) .OR. & |
---|
| 537 | (plcl(i)>min(0.99*ph(i,1),ph(i,3)))) .AND. & |
---|
| 538 | (iflag(i)==0)) iflag(i) = 7 |
---|
| 539 | END DO |
---|
| 540 | ENDIF |
---|
[5082] | 541 | IF (prt_level >= 10) THEN |
---|
[3496] | 542 | print *,'cv3_feed : iflag(1), pfeed(1), plcl(1), wghti(1,k) ', & |
---|
| 543 | iflag(1), pfeed(1), plcl(1), (wghti(1,k),k=1,10) |
---|
| 544 | ENDIF |
---|
[524] | 545 | |
---|
[2007] | 546 | ! ------------------------------------------------------------------- |
---|
| 547 | ! --- Calculate first level above lcl (=icb) |
---|
| 548 | ! ------------------------------------------------------------------- |
---|
[524] | 549 | |
---|
[2007] | 550 | !@ do 270 i=1,len |
---|
| 551 | !@ icb(i)=nlm |
---|
| 552 | !@ 270 continue |
---|
| 553 | !@c |
---|
| 554 | !@ do 290 k=minorig,nl |
---|
| 555 | !@ do 280 i=1,len |
---|
[5117] | 556 | !@ if((k.ge.(nk(i)+1)).AND.(p(i,k).lt.plcl(i))) |
---|
[2007] | 557 | !@ & icb(i)=min(icb(i),k) |
---|
| 558 | !@ 280 continue |
---|
| 559 | !@ 290 continue |
---|
| 560 | !@c |
---|
| 561 | !@ do 300 i=1,len |
---|
[5117] | 562 | !@ if((icb(i).ge.nlm).AND.(iflag(i).EQ.0))iflag(i)=9 |
---|
[2007] | 563 | !@ 300 continue |
---|
[524] | 564 | |
---|
[1992] | 565 | DO i = 1, len |
---|
| 566 | icb(i) = nlm |
---|
| 567 | END DO |
---|
[524] | 568 | |
---|
[2007] | 569 | ! la modification consiste a comparer plcl a ph et non a p: |
---|
| 570 | ! icb est defini par : ph(icb)<plcl<ph(icb-1) |
---|
| 571 | !@ do 290 k=minorig,nl |
---|
[1992] | 572 | DO k = 3, nl - 1 ! modif pour que icb soit sup/egal a 2 |
---|
| 573 | DO i = 1, len |
---|
| 574 | IF (ph(i,k)<plcl(i)) icb(i) = min(icb(i), k) |
---|
| 575 | END DO |
---|
| 576 | END DO |
---|
[524] | 577 | |
---|
| 578 | |
---|
[5103] | 579 | ! PRINT*,'icb dans cv3_feed ' |
---|
[5116] | 580 | ! WRITE(*,'(64i2)') icb(2:len-1) |
---|
[5101] | 581 | ! CALL dump2d(64,43,'plcl dans cv3_feed ',plcl(2:len-1)) |
---|
[524] | 582 | |
---|
[1992] | 583 | DO i = 1, len |
---|
[5117] | 584 | !@ if((icb(i).ge.nlm).AND.(iflag(i).EQ.0))iflag(i)=9 |
---|
[1992] | 585 | IF ((icb(i)==nlm) .AND. (iflag(i)==0)) iflag(i) = 9 |
---|
| 586 | END DO |
---|
[524] | 587 | |
---|
[1992] | 588 | DO i = 1, len |
---|
| 589 | icb(i) = icb(i) - 1 ! icb sup ou egal a 2 |
---|
| 590 | END DO |
---|
[524] | 591 | |
---|
[2007] | 592 | ! Compute icbmax. |
---|
[524] | 593 | |
---|
[1992] | 594 | icbmax = 2 |
---|
| 595 | DO i = 1, len |
---|
[2007] | 596 | !! icbmax=max(icbmax,icb(i)) |
---|
| 597 | IF (iflag(i)<7) icbmax = max(icbmax, icb(i)) ! sb Jun7th02 |
---|
[1992] | 598 | END DO |
---|
[524] | 599 | |
---|
[5105] | 600 | |
---|
[1992] | 601 | END SUBROUTINE cv3_feed |
---|
[524] | 602 | |
---|
[1992] | 603 | SUBROUTINE cv3_undilute1(len, nd, t, qs, gz, plcl, p, icb, tnk, qnk, gznk, & |
---|
[2007] | 604 | tp, tvp, clw, icbs) |
---|
[1992] | 605 | IMPLICIT NONE |
---|
[524] | 606 | |
---|
[2007] | 607 | ! ---------------------------------------------------------------- |
---|
| 608 | ! Equivalent de TLIFT entre NK et ICB+1 inclus |
---|
[524] | 609 | |
---|
[2007] | 610 | ! Differences with convect4: |
---|
| 611 | ! - specify plcl in input |
---|
| 612 | ! - icbs is the first level above LCL (may differ from icb) |
---|
| 613 | ! - in the iterations, used x(icbs) instead x(icb) |
---|
| 614 | ! - many minor differences in the iterations |
---|
| 615 | ! - tvp is computed in only one time |
---|
| 616 | ! - icbs: first level above Plcl (IMIN de TLIFT) in output |
---|
| 617 | ! - if icbs=icb, compute also tp(icb+1),tvp(icb+1) & clw(icb+1) |
---|
| 618 | ! ---------------------------------------------------------------- |
---|
[524] | 619 | |
---|
[1992] | 620 | include "cvthermo.h" |
---|
| 621 | include "cv3param.h" |
---|
[524] | 622 | |
---|
[2007] | 623 | ! inputs: |
---|
[2253] | 624 | INTEGER, INTENT (IN) :: len, nd |
---|
| 625 | INTEGER, DIMENSION (len), INTENT (IN) :: icb |
---|
| 626 | REAL, DIMENSION (len, nd), INTENT (IN) :: t, qs, gz |
---|
| 627 | REAL, DIMENSION (len), INTENT (IN) :: tnk, qnk, gznk |
---|
| 628 | REAL, DIMENSION (len, nd), INTENT (IN) :: p |
---|
| 629 | REAL, DIMENSION (len), INTENT (IN) :: plcl ! convect3 |
---|
[524] | 630 | |
---|
[2007] | 631 | ! outputs: |
---|
[2253] | 632 | INTEGER, DIMENSION (len), INTENT (OUT) :: icbs |
---|
| 633 | REAL, DIMENSION (len, nd), INTENT (OUT) :: tp, tvp, clw |
---|
[524] | 634 | |
---|
[2007] | 635 | ! local variables: |
---|
[1992] | 636 | INTEGER i, k |
---|
[2253] | 637 | INTEGER icb1(len), icbsmax2 ! convect3 |
---|
[1992] | 638 | REAL tg, qg, alv, s, ahg, tc, denom, es, rg |
---|
| 639 | REAL ah0(len), cpp(len) |
---|
| 640 | REAL ticb(len), gzicb(len) |
---|
[2253] | 641 | REAL qsicb(len) ! convect3 |
---|
| 642 | REAL cpinv(len) ! convect3 |
---|
[524] | 643 | |
---|
[2007] | 644 | ! ------------------------------------------------------------------- |
---|
| 645 | ! --- Calculates the lifted parcel virtual temperature at nk, |
---|
| 646 | ! --- the actual temperature, and the adiabatic |
---|
| 647 | ! --- liquid water content. The procedure is to solve the equation. |
---|
| 648 | ! cp*tp+L*qp+phi=cp*tnk+L*qnk+gznk. |
---|
| 649 | ! ------------------------------------------------------------------- |
---|
[524] | 650 | |
---|
| 651 | |
---|
[2007] | 652 | ! *** Calculate certain parcel quantities, including static energy *** |
---|
[524] | 653 | |
---|
[1992] | 654 | DO i = 1, len |
---|
[2007] | 655 | ah0(i) = (cpd*(1.-qnk(i))+cl*qnk(i))*tnk(i) + qnk(i)*(lv0-clmcpv*(tnk(i)-273.15)) + gznk(i) |
---|
[1992] | 656 | cpp(i) = cpd*(1.-qnk(i)) + qnk(i)*cpv |
---|
| 657 | cpinv(i) = 1./cpp(i) |
---|
| 658 | END DO |
---|
[524] | 659 | |
---|
[2007] | 660 | ! *** Calculate lifted parcel quantities below cloud base *** |
---|
[524] | 661 | |
---|
[2007] | 662 | DO i = 1, len !convect3 |
---|
[2520] | 663 | icb1(i) = min(max(icb(i), 2), nl) |
---|
[2007] | 664 | ! if icb is below LCL, start loop at ICB+1: |
---|
| 665 | ! (icbs est le premier niveau au-dessus du LCL) |
---|
| 666 | icbs(i) = icb1(i) !convect3 |
---|
[1992] | 667 | IF (plcl(i)<p(i,icb1(i))) THEN |
---|
[2007] | 668 | icbs(i) = min(icbs(i)+1, nl) !convect3 |
---|
[1992] | 669 | END IF |
---|
[2007] | 670 | END DO !convect3 |
---|
[524] | 671 | |
---|
[1992] | 672 | DO i = 1, len !convect3 |
---|
[2007] | 673 | ticb(i) = t(i, icbs(i)) !convect3 |
---|
| 674 | gzicb(i) = gz(i, icbs(i)) !convect3 |
---|
| 675 | qsicb(i) = qs(i, icbs(i)) !convect3 |
---|
[1992] | 676 | END DO !convect3 |
---|
[524] | 677 | |
---|
| 678 | |
---|
[2007] | 679 | ! Re-compute icbsmax (icbsmax2): !convect3 |
---|
| 680 | ! !convect3 |
---|
| 681 | icbsmax2 = 2 !convect3 |
---|
| 682 | DO i = 1, len !convect3 |
---|
| 683 | icbsmax2 = max(icbsmax2, icbs(i)) !convect3 |
---|
| 684 | END DO !convect3 |
---|
[524] | 685 | |
---|
[2007] | 686 | ! initialization outputs: |
---|
[524] | 687 | |
---|
[2007] | 688 | DO k = 1, icbsmax2 ! convect3 |
---|
| 689 | DO i = 1, len ! convect3 |
---|
| 690 | tp(i, k) = 0.0 ! convect3 |
---|
| 691 | tvp(i, k) = 0.0 ! convect3 |
---|
| 692 | clw(i, k) = 0.0 ! convect3 |
---|
| 693 | END DO ! convect3 |
---|
| 694 | END DO ! convect3 |
---|
[524] | 695 | |
---|
[2007] | 696 | ! tp and tvp below cloud base: |
---|
[524] | 697 | |
---|
[1992] | 698 | DO k = minorig, icbsmax2 - 1 |
---|
| 699 | DO i = 1, len |
---|
| 700 | tp(i, k) = tnk(i) - (gz(i,k)-gznk(i))*cpinv(i) |
---|
[2007] | 701 | tvp(i, k) = tp(i, k)*(1.+qnk(i)/eps-qnk(i)) !whole thing (convect3) |
---|
[1992] | 702 | END DO |
---|
| 703 | END DO |
---|
[524] | 704 | |
---|
[2007] | 705 | ! *** Find lifted parcel quantities above cloud base *** |
---|
[524] | 706 | |
---|
[1992] | 707 | DO i = 1, len |
---|
| 708 | tg = ticb(i) |
---|
[2007] | 709 | ! ori qg=qs(i,icb(i)) |
---|
[1992] | 710 | qg = qsicb(i) ! convect3 |
---|
[2007] | 711 | ! debug alv=lv0-clmcpv*(ticb(i)-t0) |
---|
[1992] | 712 | alv = lv0 - clmcpv*(ticb(i)-273.15) |
---|
[524] | 713 | |
---|
[2007] | 714 | ! First iteration. |
---|
[524] | 715 | |
---|
[2007] | 716 | ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) |
---|
| 717 | s = cpd*(1.-qnk(i)) + cl*qnk(i) + & ! convect3 |
---|
| 718 | alv*alv*qg/(rrv*ticb(i)*ticb(i)) ! convect3 |
---|
[1992] | 719 | s = 1./s |
---|
[2007] | 720 | ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) |
---|
[1992] | 721 | ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 |
---|
| 722 | tg = tg + s*(ah0(i)-ahg) |
---|
[2007] | 723 | ! ori tg=max(tg,35.0) |
---|
| 724 | ! debug tc=tg-t0 |
---|
[1992] | 725 | tc = tg - 273.15 |
---|
| 726 | denom = 243.5 + tc |
---|
| 727 | denom = max(denom, 1.0) ! convect3 |
---|
[5116] | 728 | ! ori IF(tc.ge.0.0)THEN |
---|
[1992] | 729 | es = 6.112*exp(17.67*tc/denom) |
---|
[2007] | 730 | ! ori else |
---|
| 731 | ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) |
---|
| 732 | ! ori endif |
---|
| 733 | ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) |
---|
[1992] | 734 | qg = eps*es/(p(i,icbs(i))-es*(1.-eps)) |
---|
[524] | 735 | |
---|
[2007] | 736 | ! Second iteration. |
---|
[524] | 737 | |
---|
| 738 | |
---|
[2007] | 739 | ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) |
---|
| 740 | ! ori s=1./s |
---|
| 741 | ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) |
---|
[1992] | 742 | ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 |
---|
| 743 | tg = tg + s*(ah0(i)-ahg) |
---|
[2007] | 744 | ! ori tg=max(tg,35.0) |
---|
| 745 | ! debug tc=tg-t0 |
---|
[1992] | 746 | tc = tg - 273.15 |
---|
| 747 | denom = 243.5 + tc |
---|
[2007] | 748 | denom = max(denom, 1.0) ! convect3 |
---|
[5116] | 749 | ! ori IF(tc.ge.0.0)THEN |
---|
[1992] | 750 | es = 6.112*exp(17.67*tc/denom) |
---|
[2007] | 751 | ! ori else |
---|
| 752 | ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) |
---|
| 753 | ! ori end if |
---|
| 754 | ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) |
---|
[1992] | 755 | qg = eps*es/(p(i,icbs(i))-es*(1.-eps)) |
---|
[524] | 756 | |
---|
[1992] | 757 | alv = lv0 - clmcpv*(ticb(i)-273.15) |
---|
[524] | 758 | |
---|
[2007] | 759 | ! ori c approximation here: |
---|
| 760 | ! ori tp(i,icb(i))=(ah0(i)-(cl-cpd)*qnk(i)*ticb(i) |
---|
| 761 | ! ori & -gz(i,icb(i))-alv*qg)/cpd |
---|
[524] | 762 | |
---|
[2007] | 763 | ! convect3: no approximation: |
---|
[1992] | 764 | tp(i, icbs(i)) = (ah0(i)-gz(i,icbs(i))-alv*qg)/(cpd+(cl-cpd)*qnk(i)) |
---|
[524] | 765 | |
---|
[2007] | 766 | ! ori clw(i,icb(i))=qnk(i)-qg |
---|
| 767 | ! ori clw(i,icb(i))=max(0.0,clw(i,icb(i))) |
---|
[1992] | 768 | clw(i, icbs(i)) = qnk(i) - qg |
---|
| 769 | clw(i, icbs(i)) = max(0.0, clw(i,icbs(i))) |
---|
[524] | 770 | |
---|
[1992] | 771 | rg = qg/(1.-qnk(i)) |
---|
[2007] | 772 | ! ori tvp(i,icb(i))=tp(i,icb(i))*(1.+rg*epsi) |
---|
| 773 | ! convect3: (qg utilise au lieu du vrai mixing ratio rg) |
---|
| 774 | tvp(i, icbs(i)) = tp(i, icbs(i))*(1.+qg/eps-qnk(i)) !whole thing |
---|
[524] | 775 | |
---|
[1992] | 776 | END DO |
---|
[524] | 777 | |
---|
[2007] | 778 | ! ori do 380 k=minorig,icbsmax2 |
---|
| 779 | ! ori do 370 i=1,len |
---|
| 780 | ! ori tvp(i,k)=tvp(i,k)-tp(i,k)*qnk(i) |
---|
| 781 | ! ori 370 continue |
---|
| 782 | ! ori 380 continue |
---|
[1849] | 783 | |
---|
| 784 | |
---|
[2007] | 785 | ! -- The following is only for convect3: |
---|
[1849] | 786 | |
---|
[2007] | 787 | ! * icbs is the first level above the LCL: |
---|
| 788 | ! if plcl<p(icb), then icbs=icb+1 |
---|
| 789 | ! if plcl>p(icb), then icbs=icb |
---|
[1849] | 790 | |
---|
[2007] | 791 | ! * the routine above computes tvp from minorig to icbs (included). |
---|
[1849] | 792 | |
---|
[2007] | 793 | ! * to compute buoybase (in cv3_trigger.F), both tvp(icb) and tvp(icb+1) |
---|
| 794 | ! must be known. This is the case if icbs=icb+1, but not if icbs=icb. |
---|
[1849] | 795 | |
---|
[2007] | 796 | ! * therefore, in the case icbs=icb, we compute tvp at level icb+1 |
---|
| 797 | ! (tvp at other levels will be computed in cv3_undilute2.F) |
---|
[524] | 798 | |
---|
| 799 | |
---|
[1992] | 800 | DO i = 1, len |
---|
| 801 | ticb(i) = t(i, icb(i)+1) |
---|
| 802 | gzicb(i) = gz(i, icb(i)+1) |
---|
| 803 | qsicb(i) = qs(i, icb(i)+1) |
---|
| 804 | END DO |
---|
[524] | 805 | |
---|
[1992] | 806 | DO i = 1, len |
---|
| 807 | tg = ticb(i) |
---|
| 808 | qg = qsicb(i) ! convect3 |
---|
[2007] | 809 | ! debug alv=lv0-clmcpv*(ticb(i)-t0) |
---|
[1992] | 810 | alv = lv0 - clmcpv*(ticb(i)-273.15) |
---|
[524] | 811 | |
---|
[2007] | 812 | ! First iteration. |
---|
[524] | 813 | |
---|
[2007] | 814 | ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) |
---|
| 815 | s = cpd*(1.-qnk(i)) + cl*qnk(i) & ! convect3 |
---|
| 816 | +alv*alv*qg/(rrv*ticb(i)*ticb(i)) ! convect3 |
---|
[1992] | 817 | s = 1./s |
---|
[2007] | 818 | ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) |
---|
| 819 | ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 |
---|
[1992] | 820 | tg = tg + s*(ah0(i)-ahg) |
---|
[2007] | 821 | ! ori tg=max(tg,35.0) |
---|
| 822 | ! debug tc=tg-t0 |
---|
[1992] | 823 | tc = tg - 273.15 |
---|
| 824 | denom = 243.5 + tc |
---|
[2007] | 825 | denom = max(denom, 1.0) ! convect3 |
---|
[5116] | 826 | ! ori IF(tc.ge.0.0)THEN |
---|
[1992] | 827 | es = 6.112*exp(17.67*tc/denom) |
---|
[2007] | 828 | ! ori else |
---|
| 829 | ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) |
---|
| 830 | ! ori endif |
---|
| 831 | ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) |
---|
[1992] | 832 | qg = eps*es/(p(i,icb(i)+1)-es*(1.-eps)) |
---|
[524] | 833 | |
---|
[2007] | 834 | ! Second iteration. |
---|
[524] | 835 | |
---|
| 836 | |
---|
[2007] | 837 | ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) |
---|
| 838 | ! ori s=1./s |
---|
| 839 | ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) |
---|
| 840 | ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 |
---|
[1992] | 841 | tg = tg + s*(ah0(i)-ahg) |
---|
[2007] | 842 | ! ori tg=max(tg,35.0) |
---|
| 843 | ! debug tc=tg-t0 |
---|
[1992] | 844 | tc = tg - 273.15 |
---|
| 845 | denom = 243.5 + tc |
---|
[2007] | 846 | denom = max(denom, 1.0) ! convect3 |
---|
[5116] | 847 | ! ori IF(tc.ge.0.0)THEN |
---|
[1992] | 848 | es = 6.112*exp(17.67*tc/denom) |
---|
[2007] | 849 | ! ori else |
---|
| 850 | ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) |
---|
| 851 | ! ori end if |
---|
| 852 | ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) |
---|
[1992] | 853 | qg = eps*es/(p(i,icb(i)+1)-es*(1.-eps)) |
---|
[524] | 854 | |
---|
[1992] | 855 | alv = lv0 - clmcpv*(ticb(i)-273.15) |
---|
[524] | 856 | |
---|
[2007] | 857 | ! ori c approximation here: |
---|
| 858 | ! ori tp(i,icb(i))=(ah0(i)-(cl-cpd)*qnk(i)*ticb(i) |
---|
| 859 | ! ori & -gz(i,icb(i))-alv*qg)/cpd |
---|
[1849] | 860 | |
---|
[2007] | 861 | ! convect3: no approximation: |
---|
[1992] | 862 | tp(i, icb(i)+1) = (ah0(i)-gz(i,icb(i)+1)-alv*qg)/(cpd+(cl-cpd)*qnk(i)) |
---|
[1849] | 863 | |
---|
[2007] | 864 | ! ori clw(i,icb(i))=qnk(i)-qg |
---|
| 865 | ! ori clw(i,icb(i))=max(0.0,clw(i,icb(i))) |
---|
[1992] | 866 | clw(i, icb(i)+1) = qnk(i) - qg |
---|
| 867 | clw(i, icb(i)+1) = max(0.0, clw(i,icb(i)+1)) |
---|
[1849] | 868 | |
---|
[1992] | 869 | rg = qg/(1.-qnk(i)) |
---|
[2007] | 870 | ! ori tvp(i,icb(i))=tp(i,icb(i))*(1.+rg*epsi) |
---|
| 871 | ! convect3: (qg utilise au lieu du vrai mixing ratio rg) |
---|
| 872 | tvp(i, icb(i)+1) = tp(i, icb(i)+1)*(1.+qg/eps-qnk(i)) !whole thing |
---|
[1849] | 873 | |
---|
[1992] | 874 | END DO |
---|
[1501] | 875 | |
---|
[5105] | 876 | |
---|
[1992] | 877 | END SUBROUTINE cv3_undilute1 |
---|
[524] | 878 | |
---|
[2007] | 879 | SUBROUTINE cv3_trigger(len, nd, icb, plcl, p, th, tv, tvp, thnk, & |
---|
| 880 | pbase, buoybase, iflag, sig, w0) |
---|
[1992] | 881 | IMPLICIT NONE |
---|
[524] | 882 | |
---|
[2007] | 883 | ! ------------------------------------------------------------------- |
---|
| 884 | ! --- TRIGGERING |
---|
[524] | 885 | |
---|
[2007] | 886 | ! - computes the cloud base |
---|
| 887 | ! - triggering (crude in this version) |
---|
| 888 | ! - relaxation of sig and w0 when no convection |
---|
[524] | 889 | |
---|
[3670] | 890 | ! Caution1: if no convection, we set iflag=14 |
---|
[2007] | 891 | ! (it used to be 0 in convect3) |
---|
[524] | 892 | |
---|
[2007] | 893 | ! Caution2: at this stage, tvp (and thus buoy) are know up |
---|
| 894 | ! through icb only! |
---|
| 895 | ! -> the buoyancy below cloud base not (yet) set to the cloud base buoyancy |
---|
| 896 | ! ------------------------------------------------------------------- |
---|
[524] | 897 | |
---|
[1992] | 898 | include "cv3param.h" |
---|
[524] | 899 | |
---|
[2007] | 900 | ! input: |
---|
[1992] | 901 | INTEGER len, nd |
---|
| 902 | INTEGER icb(len) |
---|
| 903 | REAL plcl(len), p(len, nd) |
---|
| 904 | REAL th(len, nd), tv(len, nd), tvp(len, nd) |
---|
| 905 | REAL thnk(len) |
---|
[524] | 906 | |
---|
[2007] | 907 | ! output: |
---|
[1992] | 908 | REAL pbase(len), buoybase(len) |
---|
[524] | 909 | |
---|
[2007] | 910 | ! input AND output: |
---|
[1992] | 911 | INTEGER iflag(len) |
---|
| 912 | REAL sig(len, nd), w0(len, nd) |
---|
[524] | 913 | |
---|
[2007] | 914 | ! local variables: |
---|
[1992] | 915 | INTEGER i, k |
---|
| 916 | REAL tvpbase, tvbase, tdif, ath, ath1 |
---|
[524] | 917 | |
---|
[879] | 918 | |
---|
[2007] | 919 | ! *** set cloud base buoyancy at (plcl+dpbase) level buoyancy |
---|
[879] | 920 | |
---|
[1992] | 921 | DO i = 1, len |
---|
| 922 | pbase(i) = plcl(i) + dpbase |
---|
[2007] | 923 | tvpbase = tvp(i, icb(i)) *(pbase(i)-p(i,icb(i)+1))/(p(i,icb(i))-p(i,icb(i)+1)) + & |
---|
| 924 | tvp(i, icb(i)+1)*(p(i,icb(i))-pbase(i)) /(p(i,icb(i))-p(i,icb(i)+1)) |
---|
| 925 | tvbase = tv(i, icb(i)) *(pbase(i)-p(i,icb(i)+1))/(p(i,icb(i))-p(i,icb(i)+1)) + & |
---|
| 926 | tv(i, icb(i)+1)*(p(i,icb(i))-pbase(i)) /(p(i,icb(i))-p(i,icb(i)+1)) |
---|
[1992] | 927 | buoybase(i) = tvpbase - tvbase |
---|
| 928 | END DO |
---|
[524] | 929 | |
---|
[829] | 930 | |
---|
[2007] | 931 | ! *** make sure that column is dry adiabatic between the surface *** |
---|
| 932 | ! *** and cloud base, and that lifted air is positively buoyant *** |
---|
| 933 | ! *** at cloud base *** |
---|
| 934 | ! *** if not, return to calling program after resetting *** |
---|
| 935 | ! *** sig(i) and w0(i) *** |
---|
[1849] | 936 | |
---|
| 937 | |
---|
[2007] | 938 | ! oct3 do 200 i=1,len |
---|
| 939 | ! oct3 |
---|
| 940 | ! oct3 tdif = buoybase(i) |
---|
| 941 | ! oct3 ath1 = th(i,1) |
---|
| 942 | ! oct3 ath = th(i,icb(i)-1) - dttrig |
---|
| 943 | ! oct3 |
---|
[5117] | 944 | ! oct3 if (tdif.lt.dtcrit .OR. ath.gt.ath1) THEN |
---|
[2007] | 945 | ! oct3 do 60 k=1,nl |
---|
| 946 | ! oct3 sig(i,k) = beta*sig(i,k) - 2.*alpha*tdif*tdif |
---|
| 947 | ! oct3 sig(i,k) = AMAX1(sig(i,k),0.0) |
---|
| 948 | ! oct3 w0(i,k) = beta*w0(i,k) |
---|
| 949 | ! oct3 60 continue |
---|
| 950 | ! oct3 iflag(i)=4 ! pour version vectorisee |
---|
| 951 | ! oct3c convect3 iflag(i)=0 |
---|
[5116] | 952 | ! oct3cccc RETURN |
---|
[2007] | 953 | ! oct3 endif |
---|
| 954 | ! oct3 |
---|
| 955 | ! oct3200 continue |
---|
[1849] | 956 | |
---|
[2007] | 957 | ! -- oct3: on reecrit la boucle 200 (pour la vectorisation) |
---|
[524] | 958 | |
---|
[1992] | 959 | DO k = 1, nl |
---|
| 960 | DO i = 1, len |
---|
[524] | 961 | |
---|
[1992] | 962 | tdif = buoybase(i) |
---|
| 963 | ath1 = thnk(i) |
---|
| 964 | ath = th(i, icb(i)-1) - dttrig |
---|
[524] | 965 | |
---|
[1992] | 966 | IF (tdif<dtcrit .OR. ath>ath1) THEN |
---|
| 967 | sig(i, k) = beta*sig(i, k) - 2.*alpha*tdif*tdif |
---|
| 968 | sig(i, k) = amax1(sig(i,k), 0.0) |
---|
| 969 | w0(i, k) = beta*w0(i, k) |
---|
[3670] | 970 | iflag(i) = 14 ! pour version vectorisee |
---|
[2007] | 971 | ! convect3 iflag(i)=0 |
---|
[1992] | 972 | END IF |
---|
[524] | 973 | |
---|
[1992] | 974 | END DO |
---|
| 975 | END DO |
---|
[524] | 976 | |
---|
[2007] | 977 | ! fin oct3 -- |
---|
[524] | 978 | |
---|
[5105] | 979 | |
---|
[1992] | 980 | END SUBROUTINE cv3_trigger |
---|
[524] | 981 | |
---|
[2007] | 982 | SUBROUTINE cv3_compress(len, nloc, ncum, nd, ntra, & |
---|
| 983 | iflag1, nk1, icb1, icbs1, & |
---|
| 984 | plcl1, tnk1, qnk1, gznk1, pbase1, buoybase1, & |
---|
| 985 | t1, q1, qs1, u1, v1, gz1, th1, & |
---|
| 986 | tra1, & |
---|
| 987 | h1, lv1, cpn1, p1, ph1, tv1, tp1, tvp1, clw1, & |
---|
| 988 | sig1, w01, & |
---|
| 989 | iflag, nk, icb, icbs, & |
---|
| 990 | plcl, tnk, qnk, gznk, pbase, buoybase, & |
---|
| 991 | t, q, qs, u, v, gz, th, & |
---|
| 992 | tra, & |
---|
| 993 | h, lv, cpn, p, ph, tv, tp, tvp, clw, & |
---|
| 994 | sig, w0) |
---|
[5112] | 995 | USE lmdz_print_control, ONLY: lunout |
---|
[5111] | 996 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
[1992] | 997 | IMPLICIT NONE |
---|
[524] | 998 | |
---|
[1992] | 999 | include "cv3param.h" |
---|
[524] | 1000 | |
---|
[2007] | 1001 | !inputs: |
---|
[1992] | 1002 | INTEGER len, ncum, nd, ntra, nloc |
---|
| 1003 | INTEGER iflag1(len), nk1(len), icb1(len), icbs1(len) |
---|
| 1004 | REAL plcl1(len), tnk1(len), qnk1(len), gznk1(len) |
---|
| 1005 | REAL pbase1(len), buoybase1(len) |
---|
| 1006 | REAL t1(len, nd), q1(len, nd), qs1(len, nd), u1(len, nd), v1(len, nd) |
---|
| 1007 | REAL gz1(len, nd), h1(len, nd), lv1(len, nd), cpn1(len, nd) |
---|
| 1008 | REAL p1(len, nd), ph1(len, nd+1), tv1(len, nd), tp1(len, nd) |
---|
| 1009 | REAL tvp1(len, nd), clw1(len, nd) |
---|
| 1010 | REAL th1(len, nd) |
---|
| 1011 | REAL sig1(len, nd), w01(len, nd) |
---|
| 1012 | REAL tra1(len, nd, ntra) |
---|
[524] | 1013 | |
---|
[2007] | 1014 | !outputs: |
---|
| 1015 | ! en fait, on a nloc=len pour l'instant (cf cv_driver) |
---|
[1992] | 1016 | INTEGER iflag(nloc), nk(nloc), icb(nloc), icbs(nloc) |
---|
| 1017 | REAL plcl(nloc), tnk(nloc), qnk(nloc), gznk(nloc) |
---|
| 1018 | REAL pbase(nloc), buoybase(nloc) |
---|
| 1019 | REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), u(nloc, nd), v(nloc, nd) |
---|
| 1020 | REAL gz(nloc, nd), h(nloc, nd), lv(nloc, nd), cpn(nloc, nd) |
---|
| 1021 | REAL p(nloc, nd), ph(nloc, nd+1), tv(nloc, nd), tp(nloc, nd) |
---|
| 1022 | REAL tvp(nloc, nd), clw(nloc, nd) |
---|
| 1023 | REAL th(nloc, nd) |
---|
| 1024 | REAL sig(nloc, nd), w0(nloc, nd) |
---|
| 1025 | REAL tra(nloc, nd, ntra) |
---|
[524] | 1026 | |
---|
[2007] | 1027 | !local variables: |
---|
[1992] | 1028 | INTEGER i, k, nn, j |
---|
[524] | 1029 | |
---|
[1992] | 1030 | CHARACTER (LEN=20) :: modname = 'cv3_compress' |
---|
| 1031 | CHARACTER (LEN=80) :: abort_message |
---|
[879] | 1032 | |
---|
[1992] | 1033 | DO k = 1, nl + 1 |
---|
| 1034 | nn = 0 |
---|
| 1035 | DO i = 1, len |
---|
| 1036 | IF (iflag1(i)==0) THEN |
---|
| 1037 | nn = nn + 1 |
---|
| 1038 | sig(nn, k) = sig1(i, k) |
---|
| 1039 | w0(nn, k) = w01(i, k) |
---|
| 1040 | t(nn, k) = t1(i, k) |
---|
| 1041 | q(nn, k) = q1(i, k) |
---|
| 1042 | qs(nn, k) = qs1(i, k) |
---|
| 1043 | u(nn, k) = u1(i, k) |
---|
| 1044 | v(nn, k) = v1(i, k) |
---|
| 1045 | gz(nn, k) = gz1(i, k) |
---|
| 1046 | h(nn, k) = h1(i, k) |
---|
| 1047 | lv(nn, k) = lv1(i, k) |
---|
| 1048 | cpn(nn, k) = cpn1(i, k) |
---|
| 1049 | p(nn, k) = p1(i, k) |
---|
| 1050 | ph(nn, k) = ph1(i, k) |
---|
| 1051 | tv(nn, k) = tv1(i, k) |
---|
| 1052 | tp(nn, k) = tp1(i, k) |
---|
| 1053 | tvp(nn, k) = tvp1(i, k) |
---|
| 1054 | clw(nn, k) = clw1(i, k) |
---|
| 1055 | th(nn, k) = th1(i, k) |
---|
| 1056 | END IF |
---|
| 1057 | END DO |
---|
| 1058 | END DO |
---|
[524] | 1059 | |
---|
[2007] | 1060 | !AC! do 121 j=1,ntra |
---|
| 1061 | !AC!ccccc do 111 k=1,nl+1 |
---|
| 1062 | !AC! do 111 k=1,nd |
---|
| 1063 | !AC! nn=0 |
---|
| 1064 | !AC! do 101 i=1,len |
---|
[5117] | 1065 | !AC! IF(iflag1(i).EQ.0)THEN |
---|
[2007] | 1066 | !AC! nn=nn+1 |
---|
| 1067 | !AC! tra(nn,k,j)=tra1(i,k,j) |
---|
| 1068 | !AC! endif |
---|
| 1069 | !AC! 101 continue |
---|
| 1070 | !AC! 111 continue |
---|
| 1071 | !AC! 121 continue |
---|
[524] | 1072 | |
---|
[1992] | 1073 | IF (nn/=ncum) THEN |
---|
| 1074 | WRITE (lunout, *) 'strange! nn not equal to ncum: ', nn, ncum |
---|
| 1075 | abort_message = '' |
---|
[2311] | 1076 | CALL abort_physic(modname, abort_message, 1) |
---|
[1992] | 1077 | END IF |
---|
[524] | 1078 | |
---|
[1992] | 1079 | nn = 0 |
---|
| 1080 | DO i = 1, len |
---|
| 1081 | IF (iflag1(i)==0) THEN |
---|
| 1082 | nn = nn + 1 |
---|
| 1083 | pbase(nn) = pbase1(i) |
---|
| 1084 | buoybase(nn) = buoybase1(i) |
---|
| 1085 | plcl(nn) = plcl1(i) |
---|
| 1086 | tnk(nn) = tnk1(i) |
---|
| 1087 | qnk(nn) = qnk1(i) |
---|
| 1088 | gznk(nn) = gznk1(i) |
---|
| 1089 | nk(nn) = nk1(i) |
---|
| 1090 | icb(nn) = icb1(i) |
---|
| 1091 | icbs(nn) = icbs1(i) |
---|
| 1092 | iflag(nn) = iflag1(i) |
---|
| 1093 | END IF |
---|
| 1094 | END DO |
---|
[524] | 1095 | |
---|
[5105] | 1096 | |
---|
[1992] | 1097 | END SUBROUTINE cv3_compress |
---|
[524] | 1098 | |
---|
[1992] | 1099 | SUBROUTINE icefrac(t, clw, qi, nl, len) |
---|
| 1100 | IMPLICIT NONE |
---|
[524] | 1101 | |
---|
| 1102 | |
---|
[2007] | 1103 | !JAM-------------------------------------------------------------------- |
---|
[5093] | 1104 | ! Calcul de la quantité d'eau sous forme de glace |
---|
[2007] | 1105 | ! -------------------------------------------------------------------- |
---|
[2110] | 1106 | INTEGER nl, len |
---|
[1992] | 1107 | REAL qi(len, nl) |
---|
| 1108 | REAL t(len, nl), clw(len, nl) |
---|
| 1109 | REAL fracg |
---|
[2110] | 1110 | INTEGER k, i |
---|
[524] | 1111 | |
---|
[1992] | 1112 | DO k = 3, nl |
---|
| 1113 | DO i = 1, len |
---|
| 1114 | IF (t(i,k)>263.15) THEN |
---|
| 1115 | qi(i, k) = 0. |
---|
| 1116 | ELSE |
---|
| 1117 | IF (t(i,k)<243.15) THEN |
---|
| 1118 | qi(i, k) = clw(i, k) |
---|
| 1119 | ELSE |
---|
| 1120 | fracg = (263.15-t(i,k))/20 |
---|
| 1121 | qi(i, k) = clw(i, k)*fracg |
---|
| 1122 | END IF |
---|
| 1123 | END IF |
---|
[5103] | 1124 | ! PRINT*,t(i,k),qi(i,k),'temp,testglace' |
---|
[1992] | 1125 | END DO |
---|
| 1126 | END DO |
---|
[879] | 1127 | |
---|
[524] | 1128 | |
---|
[5105] | 1129 | |
---|
[1992] | 1130 | END SUBROUTINE icefrac |
---|
[524] | 1131 | |
---|
[2761] | 1132 | SUBROUTINE cv3_undilute2(nloc, ncum, nd, iflag, icb, icbs, nk, & |
---|
[2007] | 1133 | tnk, qnk, gznk, hnk, t, q, qs, gz, & |
---|
[2420] | 1134 | p, ph, h, tv, lv, lf, pbase, buoybase, plcl, & |
---|
[3496] | 1135 | inb, tp, tvp, clw, hp, ep, sigp, buoy, & |
---|
| 1136 | frac_a, frac_s, qpreca, qta) |
---|
[5112] | 1137 | USE lmdz_print_control, ONLY: prt_level |
---|
[1992] | 1138 | IMPLICIT NONE |
---|
[524] | 1139 | |
---|
[2007] | 1140 | ! --------------------------------------------------------------------- |
---|
| 1141 | ! Purpose: |
---|
| 1142 | ! FIND THE REST OF THE LIFTED PARCEL TEMPERATURES |
---|
| 1143 | ! & |
---|
| 1144 | ! COMPUTE THE PRECIPITATION EFFICIENCIES AND THE |
---|
| 1145 | ! FRACTION OF PRECIPITATION FALLING OUTSIDE OF CLOUD |
---|
| 1146 | ! & |
---|
| 1147 | ! FIND THE LEVEL OF NEUTRAL BUOYANCY |
---|
[524] | 1148 | |
---|
[2007] | 1149 | ! Main differences convect3/convect4: |
---|
| 1150 | ! - icbs (input) is the first level above LCL (may differ from icb) |
---|
| 1151 | ! - many minor differences in the iterations |
---|
| 1152 | ! - condensed water not removed from tvp in convect3 |
---|
| 1153 | ! - vertical profile of buoyancy computed here (use of buoybase) |
---|
| 1154 | ! - the determination of inb is different |
---|
[5116] | 1155 | ! - no inb1, ONLY inb in output |
---|
[2007] | 1156 | ! --------------------------------------------------------------------- |
---|
[524] | 1157 | |
---|
[1992] | 1158 | include "cvthermo.h" |
---|
| 1159 | include "cv3param.h" |
---|
| 1160 | include "conema3.h" |
---|
| 1161 | include "cvflag.h" |
---|
[2420] | 1162 | include "YOMCST2.h" |
---|
[524] | 1163 | |
---|
[2007] | 1164 | !inputs: |
---|
[2253] | 1165 | INTEGER, INTENT (IN) :: ncum, nd, nloc |
---|
| 1166 | INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, icbs, nk |
---|
| 1167 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, q, qs, gz |
---|
| 1168 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: p |
---|
[2420] | 1169 | REAL, DIMENSION (nloc, nd+1), INTENT (IN) :: ph |
---|
[2253] | 1170 | REAL, DIMENSION (nloc), INTENT (IN) :: tnk, qnk, gznk |
---|
| 1171 | REAL, DIMENSION (nloc), INTENT (IN) :: hnk |
---|
| 1172 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: lv, lf, tv, h |
---|
| 1173 | REAL, DIMENSION (nloc), INTENT (IN) :: pbase, buoybase, plcl |
---|
[524] | 1174 | |
---|
[2253] | 1175 | !input/outputs: |
---|
| 1176 | REAL, DIMENSION (nloc, nd), INTENT (INOUT) :: tp, tvp, clw ! Input for k = 1, icb+1 (computed in cv3_undilute1) |
---|
| 1177 | ! Output above |
---|
[2761] | 1178 | INTEGER, DIMENSION (nloc), INTENT (INOUT) :: iflag |
---|
[2253] | 1179 | |
---|
[2007] | 1180 | !outputs: |
---|
[2253] | 1181 | INTEGER, DIMENSION (nloc), INTENT (OUT) :: inb |
---|
| 1182 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: ep, sigp, hp |
---|
| 1183 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: buoy |
---|
[3496] | 1184 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: frac_a, frac_s |
---|
| 1185 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: qpreca |
---|
| 1186 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: qta |
---|
[524] | 1187 | |
---|
[2007] | 1188 | !local variables: |
---|
[2253] | 1189 | INTEGER i, j, k |
---|
[3492] | 1190 | REAL smallestreal |
---|
| 1191 | REAL tg, qg, dqgdT, ahg, alv, alf, s, tc, es, esi, denom, rg, tca, elacrit |
---|
[3496] | 1192 | REAL :: phinu2p |
---|
[3624] | 1193 | REAL :: qhthreshold |
---|
| 1194 | REAL :: als |
---|
[3492] | 1195 | REAL :: qsat_new, snew |
---|
| 1196 | REAL, DIMENSION (nloc,nd) :: qi |
---|
[3496] | 1197 | REAL, DIMENSION (nloc,nd) :: ha ! moist static energy of adiabatic ascents |
---|
| 1198 | ! taking into account precip ejection |
---|
| 1199 | REAL, DIMENSION (nloc,nd) :: hla ! liquid water static energy of adiabatic ascents |
---|
| 1200 | ! taking into account precip ejection |
---|
| 1201 | REAL, DIMENSION (nloc,nd) :: qcld ! specific cloud water |
---|
[3492] | 1202 | REAL, DIMENSION (nloc,nd) :: qhsat ! specific humidity at saturation |
---|
| 1203 | REAL, DIMENSION (nloc,nd) :: dqhsatdT ! dqhsat/dT |
---|
[3496] | 1204 | REAL, DIMENSION (nloc,nd) :: frac ! ice fraction function of envt temperature |
---|
| 1205 | REAL, DIMENSION (nloc,nd) :: qps ! specific solid precipitation |
---|
| 1206 | REAL, DIMENSION (nloc,nd) :: qpl ! specific liquid precipitation |
---|
[3492] | 1207 | REAL, DIMENSION (nloc) :: ah0, cape, capem, byp |
---|
| 1208 | LOGICAL, DIMENSION (nloc) :: lcape |
---|
| 1209 | INTEGER, DIMENSION (nloc) :: iposit |
---|
[3496] | 1210 | REAL :: denomm1 |
---|
[3492] | 1211 | REAL :: by, defrac, pden, tbis |
---|
| 1212 | REAL :: fracg |
---|
| 1213 | REAL :: deltap |
---|
| 1214 | REAL, SAVE :: Tx, Tm |
---|
| 1215 | DATA Tx/263.15/, Tm/243.15/ |
---|
| 1216 | !$OMP THREADPRIVATE(Tx, Tm) |
---|
| 1217 | REAL :: aa, bb, dd, ddelta, discr |
---|
| 1218 | REAL :: ff, fp |
---|
| 1219 | REAL :: coefx, coefm, Zx, Zm, Ux, U, Um |
---|
[524] | 1220 | |
---|
[2638] | 1221 | IF (prt_level >= 10) THEN |
---|
[3492] | 1222 | print *,'cv3_undilute2.0. icvflag_Tpa, t(1,k), q(1,k), qs(1,k) ', & |
---|
| 1223 | icvflag_Tpa, (k, t(1,k), q(1,k), qs(1,k), k = 1,nl) |
---|
[2638] | 1224 | ENDIF |
---|
[3492] | 1225 | smallestreal=tiny(smallestreal) |
---|
[2638] | 1226 | |
---|
[2007] | 1227 | ! ===================================================================== |
---|
| 1228 | ! --- SOME INITIALIZATIONS |
---|
| 1229 | ! ===================================================================== |
---|
[524] | 1230 | |
---|
[1992] | 1231 | DO k = 1, nl |
---|
| 1232 | DO i = 1, ncum |
---|
| 1233 | qi(i, k) = 0. |
---|
| 1234 | END DO |
---|
| 1235 | END DO |
---|
[524] | 1236 | |
---|
[3496] | 1237 | |
---|
[2007] | 1238 | ! ===================================================================== |
---|
| 1239 | ! --- FIND THE REST OF THE LIFTED PARCEL TEMPERATURES |
---|
| 1240 | ! ===================================================================== |
---|
[524] | 1241 | |
---|
[2007] | 1242 | ! --- The procedure is to solve the equation. |
---|
| 1243 | ! cp*tp+L*qp+phi=cp*tnk+L*qnk+gznk. |
---|
[524] | 1244 | |
---|
[2007] | 1245 | ! *** Calculate certain parcel quantities, including static energy *** |
---|
[524] | 1246 | |
---|
| 1247 | |
---|
[1992] | 1248 | DO i = 1, ncum |
---|
[2007] | 1249 | ah0(i) = (cpd*(1.-qnk(i))+cl*qnk(i))*tnk(i)+ & |
---|
| 1250 | ! debug qnk(i)*(lv0-clmcpv*(tnk(i)-t0))+gznk(i) |
---|
| 1251 | qnk(i)*(lv0-clmcpv*(tnk(i)-273.15)) + gznk(i) |
---|
[1992] | 1252 | END DO |
---|
[5099] | 1253 | |
---|
[3496] | 1254 | ! Ice fraction |
---|
[5099] | 1255 | |
---|
[3496] | 1256 | IF (cvflag_ice) THEN |
---|
| 1257 | DO k = minorig, nl |
---|
| 1258 | DO i = 1, ncum |
---|
| 1259 | frac(i, k) = (Tx - t(i,k))/(Tx - Tm) |
---|
| 1260 | frac(i, k) = min(max(frac(i,k),0.0), 1.0) |
---|
| 1261 | END DO |
---|
| 1262 | END DO |
---|
| 1263 | ! Below cloud base, set ice fraction to cloud base value |
---|
| 1264 | DO k = 1, nl |
---|
| 1265 | DO i = 1, ncum |
---|
| 1266 | IF (k<icb(i)) THEN |
---|
| 1267 | frac(i,k) = frac(i,icb(i)) |
---|
| 1268 | END IF |
---|
| 1269 | END DO |
---|
| 1270 | END DO |
---|
| 1271 | ELSE |
---|
| 1272 | DO k = 1, nl |
---|
| 1273 | DO i = 1, ncum |
---|
| 1274 | frac(i,k) = 0. |
---|
| 1275 | END DO |
---|
| 1276 | END DO |
---|
| 1277 | ENDIF ! (cvflag_ice) |
---|
[524] | 1278 | |
---|
[3496] | 1279 | |
---|
[3492] | 1280 | DO k = minorig, nl |
---|
| 1281 | DO i = 1,ncum |
---|
[3496] | 1282 | ha(i,k) = ah0(i) |
---|
| 1283 | hla(i,k) = hnk(i) |
---|
| 1284 | qta(i,k) = qnk(i) |
---|
| 1285 | qpreca(i,k) = 0. |
---|
| 1286 | frac_a(i,k) = 0. |
---|
| 1287 | frac_s(i,k) = frac(i,k) |
---|
| 1288 | qpl(i,k) = 0. |
---|
| 1289 | qps(i,k) = 0. |
---|
[3492] | 1290 | qhsat(i,k) = qs(i,k) |
---|
[3496] | 1291 | qcld(i,k) = max(qta(i,k)-qhsat(i,k),0.) |
---|
| 1292 | IF (k <= icb(i)+1) THEN |
---|
| 1293 | qhsat(i,k) = qnk(i)-clw(i,k) |
---|
| 1294 | qcld(i,k) = clw(i,k) |
---|
| 1295 | ENDIF |
---|
[3492] | 1296 | ENDDO |
---|
| 1297 | ENDDO |
---|
[524] | 1298 | |
---|
[3492] | 1299 | !jyg< |
---|
| 1300 | ! ===================================================================== |
---|
| 1301 | ! --- SET THE THE FRACTION OF PRECIPITATION FALLING OUTSIDE OF CLOUD |
---|
| 1302 | ! ===================================================================== |
---|
| 1303 | DO k = 1, nl |
---|
| 1304 | DO i = 1, ncum |
---|
| 1305 | ep(i, k) = 0.0 |
---|
| 1306 | sigp(i, k) = spfac |
---|
| 1307 | END DO |
---|
| 1308 | END DO |
---|
| 1309 | !>jyg |
---|
| 1310 | |
---|
[2007] | 1311 | ! *** Find lifted parcel quantities above cloud base *** |
---|
[524] | 1312 | |
---|
[3492] | 1313 | !---------------------------------------------------------------------------- |
---|
[5099] | 1314 | |
---|
[3492] | 1315 | IF (icvflag_Tpa == 2) THEN |
---|
[5099] | 1316 | |
---|
[3492] | 1317 | !---------------------------------------------------------------------------- |
---|
[5099] | 1318 | |
---|
[3492] | 1319 | DO k = minorig + 1, nl |
---|
| 1320 | DO i = 1,ncum |
---|
| 1321 | tp(i,k) = t(i,k) |
---|
| 1322 | ENDDO |
---|
| 1323 | !! alv = lv0 - clmcpv*(t(i,k)-273.15) |
---|
| 1324 | !! alf = lf0 + clmci*(t(i,k)-273.15) |
---|
| 1325 | !! als = alf + alv |
---|
| 1326 | DO j = 1,4 |
---|
| 1327 | DO i = 1, ncum |
---|
[5116] | 1328 | ! ori IF(k.ge.(icb(i)+1))THEN |
---|
[3492] | 1329 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
| 1330 | tg = tp(i, k) |
---|
[5082] | 1331 | IF (tg > Tx) THEN |
---|
[3492] | 1332 | es = 6.112*exp(17.67*(tg - 273.15)/(tg + 243.5 - 273.15)) |
---|
| 1333 | qg = eps*es/(p(i,k)-es*(1.-eps)) |
---|
| 1334 | ELSE |
---|
| 1335 | esi = exp(23.33086-(6111.72784/tg)+0.15215*log(tg)) |
---|
| 1336 | qg = eps*esi/(p(i,k)-esi*(1.-eps)) |
---|
| 1337 | ENDIF |
---|
| 1338 | ! Ice fraction |
---|
| 1339 | ff = 0. |
---|
| 1340 | fp = 1./(Tx - Tm) |
---|
| 1341 | IF (tg < Tx) THEN |
---|
| 1342 | IF (tg > Tm) THEN |
---|
| 1343 | ff = (Tx - tg)*fp |
---|
| 1344 | ELSE |
---|
| 1345 | ff = 1. |
---|
| 1346 | ENDIF ! (tg > Tm) |
---|
| 1347 | ENDIF ! (tg < Tx) |
---|
| 1348 | ! Intermediate variables |
---|
| 1349 | aa = cpd + (cl-cpd)*qnk(i) + lv(i,k)*lv(i,k)*qg/(rrv*tg*tg) |
---|
| 1350 | ahg = (cpd + (cl-cpd)*qnk(i))*tg + lv(i,k)*qg - & |
---|
| 1351 | lf(i,k)*ff*(qnk(i) - qg) + gz(i,k) |
---|
| 1352 | dd = lf(i,k)*lv(i,k)*qg/(rrv*tg*tg) |
---|
| 1353 | ddelta = lf(i,k)*(qnk(i) - qg) |
---|
| 1354 | bb = aa + ddelta*fp + dd*fp*(Tx-tg) |
---|
| 1355 | ! Compute Zx and Zm |
---|
| 1356 | coefx = aa |
---|
| 1357 | coefm = aa + dd |
---|
[5082] | 1358 | IF (tg > Tx) THEN |
---|
[3492] | 1359 | Zx = ahg + coefx*(Tx - tg) |
---|
| 1360 | Zm = ahg - ddelta + coefm*(Tm - tg) |
---|
| 1361 | ELSE |
---|
[5082] | 1362 | IF (tg > Tm) THEN |
---|
[3492] | 1363 | Zx = ahg + (coefx +fp*ddelta)*(Tx - Tg) |
---|
| 1364 | Zm = ahg + (coefm +fp*ddelta)*(Tm - Tg) |
---|
| 1365 | ELSE |
---|
| 1366 | Zx = ahg + ddelta + coefx*(Tx - tg) |
---|
| 1367 | Zm = ahg + coefm*(Tm - tg) |
---|
| 1368 | ENDIF ! (tg .gt. Tm) |
---|
| 1369 | ENDIF ! (tg .gt. Tx) |
---|
| 1370 | ! Compute the masks Um, U, Ux |
---|
| 1371 | Um = (sign(1., Zm-ah0(i))+1.)/2. |
---|
| 1372 | Ux = (sign(1., ah0(i)-Zx)+1.)/2. |
---|
| 1373 | U = (1. - Um)*(1. - Ux) |
---|
| 1374 | ! Compute the updated parcell temperature Tp : 3 cases depending on tg value |
---|
[5082] | 1375 | IF (tg > Tx) THEN |
---|
[3492] | 1376 | discr = bb*bb - 4*dd*fp*(ah0(i) - ahg + ddelta*fp*(Tx-tg)) |
---|
| 1377 | Tp(i,k) = tg + & |
---|
| 1378 | Um* (ah0(i) - ahg + ddelta) /(aa + dd) + & |
---|
| 1379 | U *2*(ah0(i) - ahg + ddelta*fp*(Tx-tg))/(bb + sqrt(discr)) + & |
---|
| 1380 | Ux* (ah0(i) - ahg) /aa |
---|
[5082] | 1381 | ELSEIF (tg > Tm) THEN |
---|
[3492] | 1382 | discr = bb*bb - 4*dd*fp*(ah0(i) - ahg) |
---|
| 1383 | Tp(i,k) = tg + & |
---|
| 1384 | Um* (ah0(i) - ahg + ddelta*fp*(tg-Tm))/(aa + dd) + & |
---|
| 1385 | U *2*(ah0(i) - ahg) /(bb + sqrt(discr)) + & |
---|
| 1386 | Ux* (ah0(i) - ahg + ddelta*fp*(tg-Tx))/aa |
---|
| 1387 | ELSE |
---|
| 1388 | discr = bb*bb - 4*dd*fp*(ah0(i) - ahg + ddelta*fp*(Tm-tg)) |
---|
| 1389 | Tp(i,k) = tg + & |
---|
| 1390 | Um* (ah0(i) - ahg) /(aa + dd) + & |
---|
| 1391 | U *2*(ah0(i) - ahg + ddelta*fp*(Tm-tg))/(bb + sqrt(discr)) + & |
---|
| 1392 | Ux* (ah0(i) - ahg - ddelta) /aa |
---|
| 1393 | ENDIF ! (tg .gt. Tx) |
---|
[5099] | 1394 | |
---|
[3492] | 1395 | !! print *,' j, k, Um, U, Ux, aa, bb, discr, dd, ddelta ', j, k, Um, U, Ux, aa, bb, discr, dd, ddelta |
---|
| 1396 | !! print *,' j, k, ah0(i), ahg, tg, qg, tp(i,k), ff ', j, k, ah0(i), ahg, tg, qg, tp(i,k), ff |
---|
| 1397 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1398 | END DO ! i = 1, ncum |
---|
| 1399 | END DO ! j = 1,4 |
---|
| 1400 | DO i = 1, ncum |
---|
| 1401 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
| 1402 | tg = tp(i, k) |
---|
[5082] | 1403 | IF (tg > Tx) THEN |
---|
[3492] | 1404 | es = 6.112*exp(17.67*(tg - 273.15)/(tg + 243.5 - 273.15)) |
---|
| 1405 | qg = eps*es/(p(i,k)-es*(1.-eps)) |
---|
| 1406 | ELSE |
---|
| 1407 | esi = exp(23.33086-(6111.72784/tg)+0.15215*log(tg)) |
---|
| 1408 | qg = eps*esi/(p(i,k)-esi*(1.-eps)) |
---|
| 1409 | ENDIF |
---|
| 1410 | clw(i, k) = qnk(i) - qg |
---|
| 1411 | clw(i, k) = max(0.0, clw(i,k)) |
---|
| 1412 | tvp(i, k) = max(0., tp(i,k)*(1.+qg/eps-qnk(i))) |
---|
[5103] | 1413 | ! PRINT*,tvp(i,k),'tvp' |
---|
[3492] | 1414 | IF (clw(i,k)<1.E-11) THEN |
---|
| 1415 | tp(i, k) = tv(i, k) |
---|
| 1416 | tvp(i, k) = tv(i, k) |
---|
| 1417 | END IF ! (clw(i,k)<1.E-11) |
---|
| 1418 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1419 | END DO ! i = 1, ncum |
---|
| 1420 | END DO ! k = minorig + 1, nl |
---|
| 1421 | !---------------------------------------------------------------------------- |
---|
[5099] | 1422 | |
---|
[3492] | 1423 | ELSE IF (icvflag_Tpa == 1) THEN ! (icvflag_Tpa == 2) |
---|
[5099] | 1424 | |
---|
[3492] | 1425 | !---------------------------------------------------------------------------- |
---|
[5099] | 1426 | |
---|
[3492] | 1427 | DO k = minorig + 1, nl |
---|
| 1428 | DO i = 1,ncum |
---|
| 1429 | tp(i,k) = t(i,k) |
---|
| 1430 | ENDDO |
---|
| 1431 | !! alv = lv0 - clmcpv*(t(i,k)-273.15) |
---|
| 1432 | !! alf = lf0 + clmci*(t(i,k)-273.15) |
---|
| 1433 | !! als = alf + alv |
---|
| 1434 | DO j = 1,4 |
---|
| 1435 | DO i = 1, ncum |
---|
[5116] | 1436 | ! ori IF(k.ge.(icb(i)+1))THEN |
---|
[3492] | 1437 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
| 1438 | tg = tp(i, k) |
---|
[5082] | 1439 | IF (tg > Tx .OR. .NOT.cvflag_ice) THEN |
---|
[3492] | 1440 | es = 6.112*exp(17.67*(tg - 273.15)/(tg + 243.5 - 273.15)) |
---|
| 1441 | qg = eps*es/(p(i,k)-es*(1.-eps)) |
---|
| 1442 | dqgdT = lv(i,k)*qg/(rrv*tg*tg) |
---|
| 1443 | ELSE |
---|
| 1444 | esi = exp(23.33086-(6111.72784/tg)+0.15215*log(tg)) |
---|
| 1445 | qg = eps*esi/(p(i,k)-esi*(1.-eps)) |
---|
| 1446 | dqgdT = (lv(i,k)+lf(i,k))*qg/(rrv*tg*tg) |
---|
| 1447 | ENDIF |
---|
| 1448 | IF (qsat_depends_on_qt) THEN |
---|
[3496] | 1449 | dqgdT = dqgdT*(1.-qta(i,k-1))/(1.-qg)**2 |
---|
| 1450 | qg = qg*(1.-qta(i,k-1))/(1.-qg) |
---|
[3492] | 1451 | ENDIF |
---|
[3496] | 1452 | ahg = (cpd + (cl-cpd)*qta(i,k-1))*tg + lv(i,k)*qg - & |
---|
| 1453 | lf(i,k)*frac(i,k)*(qta(i,k-1) - qg) + gz(i,k) |
---|
[3492] | 1454 | Tp(i,k) = tg + (ah0(i) - ahg)/ & |
---|
[3496] | 1455 | (cpd + (cl-cpd)*qta(i,k-1) + (lv(i,k)+frac(i,k)*lf(i,k))*dqgdT) |
---|
[3492] | 1456 | !! print *,'undilute2 iterations k, Tp(i,k), ah0(i), ahg ', & |
---|
| 1457 | !! k, Tp(i,k), ah0(i), ahg |
---|
| 1458 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1459 | END DO ! i = 1, ncum |
---|
| 1460 | END DO ! j = 1,4 |
---|
| 1461 | DO i = 1, ncum |
---|
| 1462 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
| 1463 | tg = tp(i, k) |
---|
[5082] | 1464 | IF (tg > Tx .OR. .NOT.cvflag_ice) THEN |
---|
[3492] | 1465 | es = 6.112*exp(17.67*(tg - 273.15)/(tg + 243.5 - 273.15)) |
---|
| 1466 | qg = eps*es/(p(i,k)-es*(1.-eps)) |
---|
| 1467 | ELSE |
---|
| 1468 | esi = exp(23.33086-(6111.72784/tg)+0.15215*log(tg)) |
---|
| 1469 | qg = eps*esi/(p(i,k)-esi*(1.-eps)) |
---|
| 1470 | ENDIF |
---|
[3496] | 1471 | IF (qsat_depends_on_qt) THEN |
---|
| 1472 | qg = qg*(1.-qta(i,k-1))/(1.-qg) |
---|
| 1473 | ENDIF |
---|
| 1474 | qhsat(i,k) = qg |
---|
| 1475 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1476 | END DO ! i = 1, ncum |
---|
| 1477 | DO i = 1, ncum |
---|
| 1478 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
| 1479 | clw(i, k) = qta(i,k-1) - qhsat(i,k) |
---|
[3492] | 1480 | clw(i, k) = max(0.0, clw(i,k)) |
---|
[3496] | 1481 | tvp(i, k) = max(0., tp(i,k)*(1.+qhsat(i,k)/eps-qta(i,k-1))) |
---|
[5103] | 1482 | ! PRINT*,tvp(i,k),'tvp' |
---|
[3492] | 1483 | IF (clw(i,k)<1.E-11) THEN |
---|
| 1484 | tp(i, k) = tv(i, k) |
---|
| 1485 | tvp(i, k) = tv(i, k) |
---|
| 1486 | END IF ! (clw(i,k)<1.E-11) |
---|
| 1487 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1488 | END DO ! i = 1, ncum |
---|
[5099] | 1489 | |
---|
[3496] | 1490 | IF (cvflag_prec_eject) THEN |
---|
| 1491 | DO i = 1, ncum |
---|
| 1492 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
| 1493 | ! Specific precipitation (liquid and solid) and ice content |
---|
| 1494 | ! before ejection of precipitation !!jygprl |
---|
| 1495 | elacrit = elcrit*min(max(1.-(tp(i,k)-T0)/Tlcrit, 0.), 1.) !!jygprl |
---|
| 1496 | !!!! qcld(i,k) = min(clw(i,k), elacrit) !!jygprl |
---|
[3624] | 1497 | qhthreshold = elacrit*(1.-qta(i,k-1))/(1.-elacrit) |
---|
| 1498 | qcld(i,k) = min(clw(i,k), qhthreshold) !!jygprl |
---|
| 1499 | !!!! phinu2p = max(qhsat(i,k-1) + qcld(i,k-1) - (qhsat(i,k) + qcld(i,k)),0.) !!jygprl |
---|
| 1500 | phinu2p = max(clw(i,k) - max(qta(i,k-1) - qhsat(i,k-1), qhthreshold), 0.) |
---|
[3496] | 1501 | qpl(i,k) = qpl(i,k-1) + (1.-frac(i,k))*phinu2p !!jygprl |
---|
| 1502 | qps(i,k) = qps(i,k-1) + frac(i,k) *phinu2p !!jygprl |
---|
| 1503 | qi(i,k) = (1.-ejectliq)*clw(i,k)*frac(i,k) + & !!jygprl |
---|
| 1504 | ejectliq*(qps(i,k-1) + frac(i,k)*(phinu2p+qcld(i,k))) !!jygprl |
---|
| 1505 | !! |
---|
| 1506 | ! ===================================================================================== |
---|
| 1507 | ! Ejection of precipitation from adiabatic ascents if requested (cvflag_prec_eject=True): |
---|
| 1508 | ! Compute the steps of total water (qta), of moist static energy (ha), of specific |
---|
| 1509 | ! precipitation (qpl and qps) and of specific cloud water (qcld) associated with precipitation |
---|
| 1510 | ! ejection. |
---|
| 1511 | ! ===================================================================================== |
---|
[5099] | 1512 | |
---|
[3496] | 1513 | ! Verif |
---|
| 1514 | qpreca(i,k) = ejectliq*qpl(i,k) + ejectice*qps(i,k) !!jygprl |
---|
| 1515 | frac_a(i,k) = ejectice*qps(i,k)/max(qpreca(i,k),smallestreal) !!jygprl |
---|
| 1516 | frac_s(i,k) = (1.-ejectliq)*frac(i,k) + & !!jygprl |
---|
| 1517 | ejectliq*(1. - (qpl(i,k)+(1.-frac(i,k))*qcld(i,k))/max(clw(i,k),smallestreal)) !!jygprl |
---|
[5099] | 1518 | |
---|
[3496] | 1519 | denomm1 = 1./(1. - qpreca(i,k)) |
---|
[5099] | 1520 | |
---|
[3496] | 1521 | qta(i,k) = qta(i,k-1) - & |
---|
| 1522 | qpreca(i,k)*(1.-qta(i,k-1))*denomm1 |
---|
| 1523 | ha(i,k) = ha(i,k-1) + & |
---|
| 1524 | ( qpreca(i,k)*(-(1.-qta(i,k-1))*(cl-cpd)*tp(i,k) + & |
---|
| 1525 | lv(i,k)*qhsat(i,k) - lf(i,k)*(frac_s(i,k)*qcld(i,k)+qps(i,k))) + & |
---|
| 1526 | lf(i,k)*ejectice*qps(i,k))*denomm1 |
---|
| 1527 | hla(i,k) = hla(i,k-1) + & |
---|
| 1528 | ( qpreca(i,k)*(-(1.-qta(i,k-1))*(cpv-cpd)*tp(i,k) - & |
---|
| 1529 | lv(i,k)*((1.-frac_s(i,k))*qcld(i,k)+qpl(i,k)) - & |
---|
| 1530 | (lv(i,k)+lf(i,k))*(frac_s(i,k)*qcld(i,k)+qps(i,k))) + & |
---|
| 1531 | lv(i,k)*ejectliq*qpl(i,k) + (lv(i,k)+lf(i,k))*ejectice*qps(i,k))*denomm1 |
---|
| 1532 | qpl(i,k) = qpl(i,k)*(1.-ejectliq)*denomm1 |
---|
| 1533 | qps(i,k) = qps(i,k)*(1.-ejectice)*denomm1 |
---|
| 1534 | qcld(i,k) = qcld(i,k)*denomm1 |
---|
| 1535 | qhsat(i,k) = qhsat(i,k)*(1.-qta(i,k))/(1.-qta(i,k-1)) |
---|
| 1536 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1537 | END DO ! i = 1, ncum |
---|
| 1538 | ENDIF ! (cvflag_prec_eject) |
---|
[5099] | 1539 | |
---|
[3492] | 1540 | END DO ! k = minorig + 1, nl |
---|
[5099] | 1541 | |
---|
[3492] | 1542 | !---------------------------------------------------------------------------- |
---|
[5099] | 1543 | |
---|
[3496] | 1544 | ELSE IF (icvflag_Tpa == 0) THEN! (icvflag_Tpa == 2) ELSE IF(icvflag_Tpa == 1) |
---|
[5099] | 1545 | |
---|
[3492] | 1546 | !---------------------------------------------------------------------------- |
---|
[5099] | 1547 | |
---|
[1992] | 1548 | DO k = minorig + 1, nl |
---|
| 1549 | DO i = 1, ncum |
---|
[5116] | 1550 | ! ori IF(k.ge.(icb(i)+1))THEN |
---|
[2007] | 1551 | IF (k>=(icbs(i)+1)) THEN ! convect3 |
---|
[1992] | 1552 | tg = t(i, k) |
---|
| 1553 | qg = qs(i, k) |
---|
[2007] | 1554 | ! debug alv=lv0-clmcpv*(t(i,k)-t0) |
---|
[1992] | 1555 | alv = lv0 - clmcpv*(t(i,k)-273.15) |
---|
[524] | 1556 | |
---|
[2007] | 1557 | ! First iteration. |
---|
[524] | 1558 | |
---|
[2007] | 1559 | ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) |
---|
| 1560 | s = cpd*(1.-qnk(i)) + cl*qnk(i) + & ! convect3 |
---|
| 1561 | alv*alv*qg/(rrv*t(i,k)*t(i,k)) ! convect3 |
---|
[1992] | 1562 | s = 1./s |
---|
[2007] | 1563 | ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) |
---|
[1992] | 1564 | ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gz(i, k) ! convect3 |
---|
| 1565 | tg = tg + s*(ah0(i)-ahg) |
---|
[2007] | 1566 | ! ori tg=max(tg,35.0) |
---|
| 1567 | ! debug tc=tg-t0 |
---|
[1992] | 1568 | tc = tg - 273.15 |
---|
| 1569 | denom = 243.5 + tc |
---|
[2007] | 1570 | denom = max(denom, 1.0) ! convect3 |
---|
[5116] | 1571 | ! ori IF(tc.ge.0.0)THEN |
---|
[1992] | 1572 | es = 6.112*exp(17.67*tc/denom) |
---|
[2007] | 1573 | ! ori else |
---|
| 1574 | ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) |
---|
| 1575 | ! ori endif |
---|
[1992] | 1576 | qg = eps*es/(p(i,k)-es*(1.-eps)) |
---|
[524] | 1577 | |
---|
[2007] | 1578 | ! Second iteration. |
---|
[524] | 1579 | |
---|
[2007] | 1580 | ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) |
---|
| 1581 | ! ori s=1./s |
---|
| 1582 | ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) |
---|
[1992] | 1583 | ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gz(i, k) ! convect3 |
---|
| 1584 | tg = tg + s*(ah0(i)-ahg) |
---|
[2007] | 1585 | ! ori tg=max(tg,35.0) |
---|
| 1586 | ! debug tc=tg-t0 |
---|
[1992] | 1587 | tc = tg - 273.15 |
---|
| 1588 | denom = 243.5 + tc |
---|
[2007] | 1589 | denom = max(denom, 1.0) ! convect3 |
---|
[5116] | 1590 | ! ori IF(tc.ge.0.0)THEN |
---|
[1992] | 1591 | es = 6.112*exp(17.67*tc/denom) |
---|
[2007] | 1592 | ! ori else |
---|
| 1593 | ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) |
---|
| 1594 | ! ori endif |
---|
[1992] | 1595 | qg = eps*es/(p(i,k)-es*(1.-eps)) |
---|
[524] | 1596 | |
---|
[2007] | 1597 | ! debug alv=lv0-clmcpv*(t(i,k)-t0) |
---|
[1992] | 1598 | alv = lv0 - clmcpv*(t(i,k)-273.15) |
---|
[5103] | 1599 | ! PRINT*,'cpd dans convect2 ',cpd |
---|
| 1600 | ! PRINT*,'tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd' |
---|
| 1601 | ! PRINT*,tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd |
---|
[524] | 1602 | |
---|
[2007] | 1603 | ! ori c approximation here: |
---|
| 1604 | ! ori tp(i,k)=(ah0(i)-(cl-cpd)*qnk(i)*t(i,k)-gz(i,k)-alv*qg)/cpd |
---|
[524] | 1605 | |
---|
[2007] | 1606 | ! convect3: no approximation: |
---|
[1992] | 1607 | IF (cvflag_ice) THEN |
---|
| 1608 | tp(i, k) = max(0., (ah0(i)-gz(i,k)-alv*qg)/(cpd+(cl-cpd)*qnk(i))) |
---|
| 1609 | ELSE |
---|
| 1610 | tp(i, k) = (ah0(i)-gz(i,k)-alv*qg)/(cpd+(cl-cpd)*qnk(i)) |
---|
| 1611 | END IF |
---|
[524] | 1612 | |
---|
[1992] | 1613 | clw(i, k) = qnk(i) - qg |
---|
| 1614 | clw(i, k) = max(0.0, clw(i,k)) |
---|
| 1615 | rg = qg/(1.-qnk(i)) |
---|
[2007] | 1616 | ! ori tvp(i,k)=tp(i,k)*(1.+rg*epsi) |
---|
| 1617 | ! convect3: (qg utilise au lieu du vrai mixing ratio rg): |
---|
[1992] | 1618 | tvp(i, k) = tp(i, k)*(1.+qg/eps-qnk(i)) ! whole thing |
---|
| 1619 | IF (cvflag_ice) THEN |
---|
| 1620 | IF (clw(i,k)<1.E-11) THEN |
---|
| 1621 | tp(i, k) = tv(i, k) |
---|
| 1622 | tvp(i, k) = tv(i, k) |
---|
| 1623 | END IF |
---|
| 1624 | END IF |
---|
[2253] | 1625 | !jyg< |
---|
| 1626 | !! END IF ! Endif moved to the end of the loop |
---|
| 1627 | !>jyg |
---|
[524] | 1628 | |
---|
[1992] | 1629 | IF (cvflag_ice) THEN |
---|
[2007] | 1630 | !CR:attention boucle en klon dans Icefrac |
---|
| 1631 | ! Call Icefrac(t,clw,qi,nl,nloc) |
---|
[1992] | 1632 | IF (t(i,k)>263.15) THEN |
---|
| 1633 | qi(i, k) = 0. |
---|
| 1634 | ELSE |
---|
| 1635 | IF (t(i,k)<243.15) THEN |
---|
| 1636 | qi(i, k) = clw(i, k) |
---|
| 1637 | ELSE |
---|
| 1638 | fracg = (263.15-t(i,k))/20 |
---|
| 1639 | qi(i, k) = clw(i, k)*fracg |
---|
| 1640 | END IF |
---|
| 1641 | END IF |
---|
[2007] | 1642 | !CR: fin test |
---|
[1992] | 1643 | IF (t(i,k)<263.15) THEN |
---|
[2007] | 1644 | !CR: on commente les calculs d'Arnaud car division par zero |
---|
| 1645 | ! nouveau calcul propose par JYG |
---|
| 1646 | ! alv=lv0-clmcpv*(t(i,k)-273.15) |
---|
| 1647 | ! alf=lf0-clmci*(t(i,k)-273.15) |
---|
| 1648 | ! tg=tp(i,k) |
---|
| 1649 | ! tc=tp(i,k)-273.15 |
---|
| 1650 | ! denom=243.5+tc |
---|
| 1651 | ! do j=1,3 |
---|
| 1652 | ! cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 1653 | ! il faudra que esi vienne en argument de la convection |
---|
| 1654 | ! cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 1655 | ! tbis=t(i,k)+(tp(i,k)-tg) |
---|
| 1656 | ! esi=exp(23.33086-(6111.72784/tbis) + & |
---|
| 1657 | ! 0.15215*log(tbis)) |
---|
| 1658 | ! qsat_new=eps*esi/(p(i,k)-esi*(1.-eps)) |
---|
| 1659 | ! snew=cpd*(1.-qnk(i))+cl*qnk(i)+alv*alv*qsat_new/ & |
---|
| 1660 | ! (rrv*tbis*tbis) |
---|
| 1661 | ! snew=1./snew |
---|
[5103] | 1662 | ! PRINT*,esi,qsat_new,snew,'esi,qsat,snew' |
---|
[2007] | 1663 | ! tp(i,k)=tg+(alf*qi(i,k)+alv*qg*(1.-(esi/es)))*snew |
---|
[5103] | 1664 | ! PRINT*,k,tp(i,k),qnk(i),'avec glace' |
---|
| 1665 | ! PRINT*,'tpNAN',tg,alf,qi(i,k),alv,qg,esi,es,snew |
---|
[2007] | 1666 | ! enddo |
---|
[524] | 1667 | |
---|
[1992] | 1668 | alv = lv0 - clmcpv*(t(i,k)-273.15) |
---|
| 1669 | alf = lf0 + clmci*(t(i,k)-273.15) |
---|
| 1670 | als = alf + alv |
---|
| 1671 | tg = tp(i, k) |
---|
| 1672 | tp(i, k) = t(i, k) |
---|
| 1673 | DO j = 1, 3 |
---|
| 1674 | esi = exp(23.33086-(6111.72784/tp(i,k))+0.15215*log(tp(i,k))) |
---|
| 1675 | qsat_new = eps*esi/(p(i,k)-esi*(1.-eps)) |
---|
[2007] | 1676 | snew = cpd*(1.-qnk(i)) + cl*qnk(i) + alv*als*qsat_new/ & |
---|
| 1677 | (rrv*tp(i,k)*tp(i,k)) |
---|
[1992] | 1678 | snew = 1./snew |
---|
[5103] | 1679 | ! c PRINT*,esi,qsat_new,snew,'esi,qsat,snew' |
---|
[2007] | 1680 | tp(i, k) = tp(i, k) + & |
---|
| 1681 | ((cpd*(1.-qnk(i))+cl*qnk(i))*(tg-tp(i,k)) + & |
---|
| 1682 | alv*(qg-qsat_new)+alf*qi(i,k))*snew |
---|
[5103] | 1683 | ! PRINT*,k,tp(i,k),qsat_new,qnk(i),qi(i,k), & |
---|
[2007] | 1684 | ! 'k,tp,q,qt,qi avec glace' |
---|
[1992] | 1685 | END DO |
---|
[524] | 1686 | |
---|
[2007] | 1687 | !CR:reprise du code AJ |
---|
[1992] | 1688 | clw(i, k) = qnk(i) - qsat_new |
---|
| 1689 | clw(i, k) = max(0.0, clw(i,k)) |
---|
| 1690 | tvp(i, k) = max(0., tp(i,k)*(1.+qsat_new/eps-qnk(i))) |
---|
[5103] | 1691 | ! PRINT*,tvp(i,k),'tvp' |
---|
[1992] | 1692 | END IF |
---|
| 1693 | IF (clw(i,k)<1.E-11) THEN |
---|
| 1694 | tp(i, k) = tv(i, k) |
---|
| 1695 | tvp(i, k) = tv(i, k) |
---|
| 1696 | END IF |
---|
| 1697 | END IF ! (cvflag_ice) |
---|
[2253] | 1698 | !jyg< |
---|
| 1699 | END IF ! (k>=(icbs(i)+1)) |
---|
| 1700 | !>jyg |
---|
[1992] | 1701 | END DO |
---|
| 1702 | END DO |
---|
[1849] | 1703 | |
---|
[3492] | 1704 | !---------------------------------------------------------------------------- |
---|
[5099] | 1705 | |
---|
[3496] | 1706 | ENDIF ! (icvflag_Tpa == 2) ELSEIF (icvflag_Tpa == 1) ELSE (icvflag_Tpa == 0) |
---|
[5099] | 1707 | |
---|
[3492] | 1708 | !---------------------------------------------------------------------------- |
---|
[5099] | 1709 | |
---|
[2007] | 1710 | ! ===================================================================== |
---|
[3492] | 1711 | ! --- SET THE PRECIPITATION EFFICIENCIES |
---|
[2007] | 1712 | ! --- THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I) |
---|
| 1713 | ! ===================================================================== |
---|
[5099] | 1714 | |
---|
[1992] | 1715 | IF (flag_epkeorig/=1) THEN |
---|
| 1716 | DO k = 1, nl ! convect3 |
---|
| 1717 | DO i = 1, ncum |
---|
[2253] | 1718 | !jyg< |
---|
| 1719 | IF(k>=icb(i)) THEN |
---|
| 1720 | !>jyg |
---|
| 1721 | pden = ptcrit - pbcrit |
---|
| 1722 | ep(i, k) = (plcl(i)-p(i,k)-pbcrit)/pden*epmax |
---|
| 1723 | ep(i, k) = max(ep(i,k), 0.0) |
---|
| 1724 | ep(i, k) = min(ep(i,k), epmax) |
---|
| 1725 | !! sigp(i, k) = spfac ! jyg |
---|
| 1726 | ENDIF ! (k>=icb(i)) |
---|
[1992] | 1727 | END DO |
---|
| 1728 | END DO |
---|
| 1729 | ELSE |
---|
| 1730 | DO k = 1, nl |
---|
| 1731 | DO i = 1, ncum |
---|
[2253] | 1732 | IF(k>=icb(i)) THEN |
---|
| 1733 | !! IF (k>=(nk(i)+1)) THEN |
---|
| 1734 | !>jyg |
---|
[1992] | 1735 | tca = tp(i, k) - t0 |
---|
| 1736 | IF (tca>=0.0) THEN |
---|
| 1737 | elacrit = elcrit |
---|
| 1738 | ELSE |
---|
| 1739 | elacrit = elcrit*(1.0-tca/tlcrit) |
---|
| 1740 | END IF |
---|
| 1741 | elacrit = max(elacrit, 0.0) |
---|
| 1742 | ep(i, k) = 1.0 - elacrit/max(clw(i,k), 1.0E-8) |
---|
| 1743 | ep(i, k) = max(ep(i,k), 0.0) |
---|
| 1744 | ep(i, k) = min(ep(i,k), epmax) |
---|
[2253] | 1745 | !! sigp(i, k) = spfac ! jyg |
---|
| 1746 | END IF ! (k>=icb(i)) |
---|
[1992] | 1747 | END DO |
---|
| 1748 | END DO |
---|
| 1749 | END IF |
---|
[5099] | 1750 | |
---|
[3492] | 1751 | ! ========================================================================= |
---|
| 1752 | IF (prt_level >= 10) THEN |
---|
| 1753 | print *,'cv3_undilute2.1. tp(1,k), tvp(1,k) ', & |
---|
| 1754 | (k, tp(1,k), tvp(1,k), k = 1,nl) |
---|
| 1755 | ENDIF |
---|
[5099] | 1756 | |
---|
[2007] | 1757 | ! ===================================================================== |
---|
| 1758 | ! --- CALCULATE VIRTUAL TEMPERATURE AND LIFTED PARCEL |
---|
| 1759 | ! --- VIRTUAL TEMPERATURE |
---|
| 1760 | ! ===================================================================== |
---|
[1849] | 1761 | |
---|
[2007] | 1762 | ! dans convect3, tvp est calcule en une seule fois, et sans retirer |
---|
| 1763 | ! l'eau condensee (~> reversible CAPE) |
---|
[1849] | 1764 | |
---|
[2007] | 1765 | ! ori do 340 k=minorig+1,nl |
---|
| 1766 | ! ori do 330 i=1,ncum |
---|
[5116] | 1767 | ! ori IF(k.ge.(icb(i)+1))THEN |
---|
[2007] | 1768 | ! ori tvp(i,k)=tvp(i,k)*(1.0-qnk(i)+ep(i,k)*clw(i,k)) |
---|
[5103] | 1769 | ! oric PRINT*,'i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)' |
---|
| 1770 | ! oric PRINT*, i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k) |
---|
[2007] | 1771 | ! ori endif |
---|
| 1772 | ! ori 330 continue |
---|
| 1773 | ! ori 340 continue |
---|
[524] | 1774 | |
---|
[2007] | 1775 | ! ori do 350 i=1,ncum |
---|
| 1776 | ! ori tvp(i,nlp)=tvp(i,nl)-(gz(i,nlp)-gz(i,nl))/cpd |
---|
| 1777 | ! ori 350 continue |
---|
[524] | 1778 | |
---|
[2007] | 1779 | DO i = 1, ncum ! convect3 |
---|
| 1780 | tp(i, nlp) = tp(i, nl) ! convect3 |
---|
| 1781 | END DO ! convect3 |
---|
[524] | 1782 | |
---|
[2007] | 1783 | ! ===================================================================== |
---|
| 1784 | ! --- EFFECTIVE VERTICAL PROFILE OF BUOYANCY (convect3 only): |
---|
| 1785 | ! ===================================================================== |
---|
[524] | 1786 | |
---|
[2007] | 1787 | ! -- this is for convect3 only: |
---|
[524] | 1788 | |
---|
[2007] | 1789 | ! first estimate of buoyancy: |
---|
[879] | 1790 | |
---|
[2257] | 1791 | !jyg : k-loop outside i-loop (07042015) |
---|
| 1792 | DO k = 1, nl |
---|
| 1793 | DO i = 1, ncum |
---|
[1992] | 1794 | buoy(i, k) = tvp(i, k) - tv(i, k) |
---|
| 1795 | END DO |
---|
| 1796 | END DO |
---|
[524] | 1797 | |
---|
[2007] | 1798 | ! set buoyancy=buoybase for all levels below base |
---|
| 1799 | ! for safety, set buoy(icb)=buoybase |
---|
[524] | 1800 | |
---|
[2257] | 1801 | !jyg : k-loop outside i-loop (07042015) |
---|
| 1802 | DO k = 1, nl |
---|
| 1803 | DO i = 1, ncum |
---|
[1992] | 1804 | IF ((k>=icb(i)) .AND. (k<=nl) .AND. (p(i,k)>=pbase(i))) THEN |
---|
| 1805 | buoy(i, k) = buoybase(i) |
---|
| 1806 | END IF |
---|
| 1807 | END DO |
---|
[2257] | 1808 | END DO |
---|
| 1809 | DO i = 1, ncum |
---|
[2007] | 1810 | ! buoy(icb(i),k)=buoybase(i) |
---|
[1992] | 1811 | buoy(i, icb(i)) = buoybase(i) |
---|
| 1812 | END DO |
---|
[524] | 1813 | |
---|
[2007] | 1814 | ! -- end convect3 |
---|
[524] | 1815 | |
---|
[2007] | 1816 | ! ===================================================================== |
---|
| 1817 | ! --- FIND THE FIRST MODEL LEVEL (INB) ABOVE THE PARCEL'S |
---|
| 1818 | ! --- LEVEL OF NEUTRAL BUOYANCY |
---|
| 1819 | ! ===================================================================== |
---|
[524] | 1820 | |
---|
[2007] | 1821 | ! -- this is for convect3 only: |
---|
[524] | 1822 | |
---|
[1992] | 1823 | DO i = 1, ncum |
---|
| 1824 | inb(i) = nl - 1 |
---|
| 1825 | iposit(i) = nl |
---|
| 1826 | END DO |
---|
[524] | 1827 | |
---|
| 1828 | |
---|
[2007] | 1829 | ! -- iposit(i) = first level, above icb, with positive buoyancy |
---|
[1992] | 1830 | DO k = 1, nl - 1 |
---|
| 1831 | DO i = 1, ncum |
---|
| 1832 | IF (k>=icb(i) .AND. buoy(i,k)>0.) THEN |
---|
| 1833 | iposit(i) = min(iposit(i), k) |
---|
| 1834 | END IF |
---|
| 1835 | END DO |
---|
| 1836 | END DO |
---|
[1849] | 1837 | |
---|
[1992] | 1838 | DO i = 1, ncum |
---|
| 1839 | IF (iposit(i)==nl) THEN |
---|
| 1840 | iposit(i) = icb(i) |
---|
| 1841 | END IF |
---|
| 1842 | END DO |
---|
[1849] | 1843 | |
---|
[1992] | 1844 | DO k = 1, nl - 1 |
---|
| 1845 | DO i = 1, ncum |
---|
| 1846 | IF ((k>=iposit(i)) .AND. (buoy(i,k)<dtovsh)) THEN |
---|
| 1847 | inb(i) = min(inb(i), k) |
---|
| 1848 | END IF |
---|
| 1849 | END DO |
---|
| 1850 | END DO |
---|
[1849] | 1851 | |
---|
[2420] | 1852 | !CR fix computation of inb |
---|
| 1853 | !keep flag or modify in all cases? |
---|
[5082] | 1854 | IF (iflag_mix_adiab==1) THEN |
---|
[2420] | 1855 | DO i = 1, ncum |
---|
| 1856 | cape(i)=0. |
---|
| 1857 | inb(i)=icb(i)+1 |
---|
| 1858 | ENDDO |
---|
| 1859 | |
---|
| 1860 | DO k = 2, nl |
---|
| 1861 | DO i = 1, ncum |
---|
| 1862 | IF ((k>=iposit(i))) THEN |
---|
| 1863 | deltap = min(plcl(i), ph(i,k-1)) - min(plcl(i), ph(i,k)) |
---|
| 1864 | cape(i) = cape(i) + rrd*buoy(i, k-1)*deltap/p(i, k-1) |
---|
[5082] | 1865 | IF (cape(i)>0.) THEN |
---|
[2420] | 1866 | inb(i) = max(inb(i), k) |
---|
| 1867 | END IF |
---|
| 1868 | ENDIF |
---|
| 1869 | ENDDO |
---|
| 1870 | ENDDO |
---|
| 1871 | |
---|
| 1872 | ! DO i = 1, ncum |
---|
[5103] | 1873 | ! PRINT*,"inb",inb(i) |
---|
[2420] | 1874 | ! ENDDO |
---|
| 1875 | |
---|
[5117] | 1876 | ENDIF |
---|
[2420] | 1877 | |
---|
[2007] | 1878 | ! -- end convect3 |
---|
[1849] | 1879 | |
---|
[2007] | 1880 | ! ori do 510 i=1,ncum |
---|
| 1881 | ! ori cape(i)=0.0 |
---|
| 1882 | ! ori capem(i)=0.0 |
---|
| 1883 | ! ori inb(i)=icb(i)+1 |
---|
| 1884 | ! ori inb1(i)=inb(i) |
---|
| 1885 | ! ori 510 continue |
---|
[524] | 1886 | |
---|
[2007] | 1887 | ! Originial Code |
---|
[524] | 1888 | |
---|
[2007] | 1889 | ! do 530 k=minorig+1,nl-1 |
---|
| 1890 | ! do 520 i=1,ncum |
---|
[5116] | 1891 | ! IF(k.ge.(icb(i)+1))THEN |
---|
[2007] | 1892 | ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) |
---|
| 1893 | ! byp=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) |
---|
| 1894 | ! cape(i)=cape(i)+by |
---|
[5116] | 1895 | ! IF(by.ge.0.0)inb1(i)=k+1 |
---|
| 1896 | ! IF(cape(i).gt.0.0)THEN |
---|
[2007] | 1897 | ! inb(i)=k+1 |
---|
| 1898 | ! capem(i)=cape(i) |
---|
| 1899 | ! endif |
---|
| 1900 | ! endif |
---|
| 1901 | !520 continue |
---|
| 1902 | !530 continue |
---|
| 1903 | ! do 540 i=1,ncum |
---|
| 1904 | ! byp=(tvp(i,nl)-tv(i,nl))*dph(i,nl)/p(i,nl) |
---|
| 1905 | ! cape(i)=capem(i)+byp |
---|
| 1906 | ! defrac=capem(i)-cape(i) |
---|
| 1907 | ! defrac=max(defrac,0.001) |
---|
| 1908 | ! frac(i)=-cape(i)/defrac |
---|
| 1909 | ! frac(i)=min(frac(i),1.0) |
---|
| 1910 | ! frac(i)=max(frac(i),0.0) |
---|
| 1911 | !540 continue |
---|
[524] | 1912 | |
---|
[2007] | 1913 | ! K Emanuel fix |
---|
[524] | 1914 | |
---|
[5101] | 1915 | ! CALL zilch(byp,ncum) |
---|
[2007] | 1916 | ! do 530 k=minorig+1,nl-1 |
---|
| 1917 | ! do 520 i=1,ncum |
---|
[5116] | 1918 | ! IF(k.ge.(icb(i)+1))THEN |
---|
[2007] | 1919 | ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) |
---|
| 1920 | ! cape(i)=cape(i)+by |
---|
[5116] | 1921 | ! IF(by.ge.0.0)inb1(i)=k+1 |
---|
| 1922 | ! IF(cape(i).gt.0.0)THEN |
---|
[2007] | 1923 | ! inb(i)=k+1 |
---|
| 1924 | ! capem(i)=cape(i) |
---|
| 1925 | ! byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) |
---|
| 1926 | ! endif |
---|
| 1927 | ! endif |
---|
| 1928 | !520 continue |
---|
| 1929 | !530 continue |
---|
| 1930 | ! do 540 i=1,ncum |
---|
| 1931 | ! inb(i)=max(inb(i),inb1(i)) |
---|
| 1932 | ! cape(i)=capem(i)+byp(i) |
---|
| 1933 | ! defrac=capem(i)-cape(i) |
---|
| 1934 | ! defrac=max(defrac,0.001) |
---|
| 1935 | ! frac(i)=-cape(i)/defrac |
---|
| 1936 | ! frac(i)=min(frac(i),1.0) |
---|
| 1937 | ! frac(i)=max(frac(i),0.0) |
---|
| 1938 | !540 continue |
---|
[524] | 1939 | |
---|
[2007] | 1940 | ! J Teixeira fix |
---|
[524] | 1941 | |
---|
[5101] | 1942 | ! ori CALL zilch(byp,ncum) |
---|
[2007] | 1943 | ! ori do 515 i=1,ncum |
---|
[5103] | 1944 | ! ori lcape(i)=.TRUE. |
---|
[2007] | 1945 | ! ori 515 continue |
---|
| 1946 | ! ori do 530 k=minorig+1,nl-1 |
---|
| 1947 | ! ori do 520 i=1,ncum |
---|
[5116] | 1948 | ! ori IF(cape(i).lt.0.0)lcape(i)=.FALSE. |
---|
[5117] | 1949 | ! ori if((k.ge.(icb(i)+1)).AND.lcape(i))THEN |
---|
[2007] | 1950 | ! ori by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) |
---|
| 1951 | ! ori byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) |
---|
| 1952 | ! ori cape(i)=cape(i)+by |
---|
[5116] | 1953 | ! ori IF(by.ge.0.0)inb1(i)=k+1 |
---|
| 1954 | ! ori IF(cape(i).gt.0.0)THEN |
---|
[2007] | 1955 | ! ori inb(i)=k+1 |
---|
| 1956 | ! ori capem(i)=cape(i) |
---|
| 1957 | ! ori endif |
---|
| 1958 | ! ori endif |
---|
| 1959 | ! ori 520 continue |
---|
| 1960 | ! ori 530 continue |
---|
| 1961 | ! ori do 540 i=1,ncum |
---|
| 1962 | ! ori cape(i)=capem(i)+byp(i) |
---|
| 1963 | ! ori defrac=capem(i)-cape(i) |
---|
| 1964 | ! ori defrac=max(defrac,0.001) |
---|
| 1965 | ! ori frac(i)=-cape(i)/defrac |
---|
| 1966 | ! ori frac(i)=min(frac(i),1.0) |
---|
| 1967 | ! ori frac(i)=max(frac(i),0.0) |
---|
| 1968 | ! ori 540 continue |
---|
[524] | 1969 | |
---|
[2761] | 1970 | ! -------------------------------------------------------------------- |
---|
| 1971 | ! Prevent convection when top is too hot |
---|
| 1972 | ! -------------------------------------------------------------------- |
---|
| 1973 | DO i = 1,ncum |
---|
| 1974 | IF (t(i,inb(i)) > T_top_max) iflag(i) = 10 |
---|
| 1975 | ENDDO |
---|
| 1976 | |
---|
[2007] | 1977 | ! ===================================================================== |
---|
| 1978 | ! --- CALCULATE LIQUID WATER STATIC ENERGY OF LIFTED PARCEL |
---|
| 1979 | ! ===================================================================== |
---|
[524] | 1980 | |
---|
[2393] | 1981 | DO k = 1, nl |
---|
[1992] | 1982 | DO i = 1, ncum |
---|
| 1983 | hp(i, k) = h(i, k) |
---|
| 1984 | END DO |
---|
| 1985 | END DO |
---|
[524] | 1986 | |
---|
[2257] | 1987 | !jyg : cvflag_ice test outside the loops (07042015) |
---|
[5099] | 1988 | |
---|
[2257] | 1989 | IF (cvflag_ice) THEN |
---|
[5099] | 1990 | |
---|
[3496] | 1991 | IF (cvflag_prec_eject) THEN |
---|
| 1992 | !! DO k = minorig + 1, nl |
---|
| 1993 | !! DO i = 1, ncum |
---|
| 1994 | !! IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN |
---|
| 1995 | !! frac_s(i,k) = qi(i,k)/max(clw(i,k),smallestreal) |
---|
| 1996 | !! frac_s(i,k) = 1. - (qpl(i,k)+(1.-frac_s(i,k))*qcld(i,k))/max(clw(i,k),smallestreal) |
---|
| 1997 | !! END IF |
---|
| 1998 | !! END DO |
---|
| 1999 | !! END DO |
---|
| 2000 | ELSE ! (cvflag_prec_eject) |
---|
[2257] | 2001 | DO k = minorig + 1, nl |
---|
| 2002 | DO i = 1, ncum |
---|
| 2003 | IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN |
---|
[3492] | 2004 | !jyg< frac computation moved to beginning of cv3_undilute2. |
---|
| 2005 | ! kept here for compatibility test with CMip6 version |
---|
[3496] | 2006 | frac_s(i, k) = 1. - (t(i,k)-243.15)/(263.15-243.15) |
---|
| 2007 | frac_s(i, k) = min(max(frac_s(i,k),0.0), 1.0) |
---|
[2257] | 2008 | END IF |
---|
| 2009 | END DO |
---|
| 2010 | END DO |
---|
[3496] | 2011 | ENDIF ! (cvflag_prec_eject) ELSE |
---|
| 2012 | DO k = minorig + 1, nl |
---|
| 2013 | DO i = 1, ncum |
---|
| 2014 | IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN |
---|
| 2015 | !! hp(i, k) = hnk(i) + (lv(i,k)+(cpd-cpv)*t(i,k)+frac_s(i,k)*lf(i,k))* & !!jygprl |
---|
| 2016 | !! ep(i, k)*clw(i, k) !!jygprl |
---|
| 2017 | hp(i, k) = hla(i,k-1) + (lv(i,k)+(cpd-cpv)*t(i,k)+frac_s(i,k)*lf(i,k))* & !!jygprl |
---|
| 2018 | ep(i, k)*clw(i, k) !!jygprl |
---|
| 2019 | END IF |
---|
| 2020 | END DO |
---|
| 2021 | END DO |
---|
[5099] | 2022 | |
---|
[3492] | 2023 | ELSE ! (cvflag_ice) |
---|
[5099] | 2024 | |
---|
[2257] | 2025 | DO k = minorig + 1, nl |
---|
| 2026 | DO i = 1, ncum |
---|
| 2027 | IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN |
---|
[2902] | 2028 | !jyg< (energy conservation tests) |
---|
| 2029 | !! hp(i, k) = hnk(i) + (lv(i,k)+(cpd-cpv)*tp(i,k))*ep(i, k)*clw(i, k) |
---|
| 2030 | !! hp(i, k) = ( hnk(i) + (lv(i,k)+(cpd-cpv)*t(i,k))*ep(i, k)*clw(i, k) ) / & |
---|
| 2031 | !! (1. - ep(i,k)*clw(i,k)) |
---|
| 2032 | !! hp(i, k) = ( hnk(i) + (lv(i,k)+(cpd-cl)*t(i,k))*ep(i, k)*clw(i, k) ) / & |
---|
| 2033 | !! (1. - ep(i,k)*clw(i,k)) |
---|
[1992] | 2034 | hp(i, k) = hnk(i) + (lv(i,k)+(cpd-cpv)*t(i,k))*ep(i, k)*clw(i, k) |
---|
| 2035 | END IF |
---|
[2257] | 2036 | END DO |
---|
[1992] | 2037 | END DO |
---|
[5099] | 2038 | |
---|
[2257] | 2039 | END IF ! (cvflag_ice) |
---|
[524] | 2040 | |
---|
[5105] | 2041 | |
---|
[1992] | 2042 | END SUBROUTINE cv3_undilute2 |
---|
[524] | 2043 | |
---|
[2007] | 2044 | SUBROUTINE cv3_closure(nloc, ncum, nd, icb, inb, & |
---|
| 2045 | pbase, p, ph, tv, buoy, & |
---|
| 2046 | sig, w0, cape, m, iflag) |
---|
[1992] | 2047 | IMPLICIT NONE |
---|
[524] | 2048 | |
---|
[2007] | 2049 | ! =================================================================== |
---|
| 2050 | ! --- CLOSURE OF CONVECT3 |
---|
[5099] | 2051 | |
---|
[2007] | 2052 | ! vectorization: S. Bony |
---|
| 2053 | ! =================================================================== |
---|
[524] | 2054 | |
---|
[1992] | 2055 | include "cvthermo.h" |
---|
| 2056 | include "cv3param.h" |
---|
[524] | 2057 | |
---|
[2007] | 2058 | !input: |
---|
[1992] | 2059 | INTEGER ncum, nd, nloc |
---|
| 2060 | INTEGER icb(nloc), inb(nloc) |
---|
| 2061 | REAL pbase(nloc) |
---|
| 2062 | REAL p(nloc, nd), ph(nloc, nd+1) |
---|
| 2063 | REAL tv(nloc, nd), buoy(nloc, nd) |
---|
[524] | 2064 | |
---|
[2007] | 2065 | !input/output: |
---|
[1992] | 2066 | REAL sig(nloc, nd), w0(nloc, nd) |
---|
| 2067 | INTEGER iflag(nloc) |
---|
[524] | 2068 | |
---|
[2007] | 2069 | !output: |
---|
[1992] | 2070 | REAL cape(nloc) |
---|
| 2071 | REAL m(nloc, nd) |
---|
[524] | 2072 | |
---|
[2007] | 2073 | !local variables: |
---|
[1992] | 2074 | INTEGER i, j, k, icbmax |
---|
| 2075 | REAL deltap, fac, w, amu |
---|
| 2076 | REAL dtmin(nloc, nd), sigold(nloc, nd) |
---|
| 2077 | REAL cbmflast(nloc) |
---|
[524] | 2078 | |
---|
[776] | 2079 | |
---|
[2007] | 2080 | ! ------------------------------------------------------- |
---|
| 2081 | ! -- Initialization |
---|
| 2082 | ! ------------------------------------------------------- |
---|
[524] | 2083 | |
---|
[1992] | 2084 | DO k = 1, nl |
---|
| 2085 | DO i = 1, ncum |
---|
| 2086 | m(i, k) = 0.0 |
---|
| 2087 | END DO |
---|
| 2088 | END DO |
---|
[524] | 2089 | |
---|
[2007] | 2090 | ! ------------------------------------------------------- |
---|
| 2091 | ! -- Reset sig(i) and w0(i) for i>inb and i<icb |
---|
| 2092 | ! ------------------------------------------------------- |
---|
[524] | 2093 | |
---|
[2007] | 2094 | ! update sig and w0 above LNB: |
---|
[879] | 2095 | |
---|
[1992] | 2096 | DO k = 1, nl - 1 |
---|
| 2097 | DO i = 1, ncum |
---|
| 2098 | IF ((inb(i)<(nl-1)) .AND. (k>=(inb(i)+1))) THEN |
---|
[2007] | 2099 | sig(i, k) = beta*sig(i, k) + & |
---|
| 2100 | 2.*alpha*buoy(i, inb(i))*abs(buoy(i,inb(i))) |
---|
[1992] | 2101 | sig(i, k) = amax1(sig(i,k), 0.0) |
---|
| 2102 | w0(i, k) = beta*w0(i, k) |
---|
| 2103 | END IF |
---|
| 2104 | END DO |
---|
| 2105 | END DO |
---|
[1494] | 2106 | |
---|
[2007] | 2107 | ! compute icbmax: |
---|
[524] | 2108 | |
---|
[1992] | 2109 | icbmax = 2 |
---|
| 2110 | DO i = 1, ncum |
---|
| 2111 | icbmax = max(icbmax, icb(i)) |
---|
| 2112 | END DO |
---|
[524] | 2113 | |
---|
[2007] | 2114 | ! update sig and w0 below cloud base: |
---|
[1494] | 2115 | |
---|
[1992] | 2116 | DO k = 1, icbmax |
---|
| 2117 | DO i = 1, ncum |
---|
| 2118 | IF (k<=icb(i)) THEN |
---|
[2007] | 2119 | sig(i, k) = beta*sig(i, k) - & |
---|
| 2120 | 2.*alpha*buoy(i, icb(i))*buoy(i, icb(i)) |
---|
[1992] | 2121 | sig(i, k) = max(sig(i,k), 0.0) |
---|
| 2122 | w0(i, k) = beta*w0(i, k) |
---|
| 2123 | END IF |
---|
| 2124 | END DO |
---|
| 2125 | END DO |
---|
[524] | 2126 | |
---|
[5116] | 2127 | !! IF(inb.lt.(nl-1))THEN |
---|
[2007] | 2128 | !! do 85 i=inb+1,nl-1 |
---|
| 2129 | !! sig(i)=beta*sig(i)+2.*alpha*buoy(inb)* |
---|
| 2130 | !! 1 abs(buoy(inb)) |
---|
| 2131 | !! sig(i)=max(sig(i),0.0) |
---|
| 2132 | !! w0(i)=beta*w0(i) |
---|
| 2133 | !! 85 continue |
---|
| 2134 | !! end if |
---|
[524] | 2135 | |
---|
[2007] | 2136 | !! do 87 i=1,icb |
---|
| 2137 | !! sig(i)=beta*sig(i)-2.*alpha*buoy(icb)*buoy(icb) |
---|
| 2138 | !! sig(i)=max(sig(i),0.0) |
---|
| 2139 | !! w0(i)=beta*w0(i) |
---|
| 2140 | !! 87 continue |
---|
[524] | 2141 | |
---|
[2007] | 2142 | ! ------------------------------------------------------------- |
---|
| 2143 | ! -- Reset fractional areas of updrafts and w0 at initial time |
---|
| 2144 | ! -- and after 10 time steps of no convection |
---|
| 2145 | ! ------------------------------------------------------------- |
---|
[524] | 2146 | |
---|
[1992] | 2147 | DO k = 1, nl - 1 |
---|
| 2148 | DO i = 1, ncum |
---|
| 2149 | IF (sig(i,nd)<1.5 .OR. sig(i,nd)>12.0) THEN |
---|
| 2150 | sig(i, k) = 0.0 |
---|
| 2151 | w0(i, k) = 0.0 |
---|
| 2152 | END IF |
---|
| 2153 | END DO |
---|
| 2154 | END DO |
---|
[524] | 2155 | |
---|
[2007] | 2156 | ! ------------------------------------------------------------- |
---|
| 2157 | ! -- Calculate convective available potential energy (cape), |
---|
| 2158 | ! -- vertical velocity (w), fractional area covered by |
---|
| 2159 | ! -- undilute updraft (sig), and updraft mass flux (m) |
---|
| 2160 | ! ------------------------------------------------------------- |
---|
[1849] | 2161 | |
---|
[1992] | 2162 | DO i = 1, ncum |
---|
| 2163 | cape(i) = 0.0 |
---|
| 2164 | END DO |
---|
[1849] | 2165 | |
---|
[2007] | 2166 | ! compute dtmin (minimum buoyancy between ICB and given level k): |
---|
[1849] | 2167 | |
---|
[1992] | 2168 | DO i = 1, ncum |
---|
| 2169 | DO k = 1, nl |
---|
| 2170 | dtmin(i, k) = 100.0 |
---|
| 2171 | END DO |
---|
| 2172 | END DO |
---|
[524] | 2173 | |
---|
[1992] | 2174 | DO i = 1, ncum |
---|
| 2175 | DO k = 1, nl |
---|
| 2176 | DO j = minorig, nl |
---|
[2007] | 2177 | IF ((k>=(icb(i)+1)) .AND. (k<=inb(i)) .AND. (j>=icb(i)) .AND. (j<=(k-1))) THEN |
---|
[1992] | 2178 | dtmin(i, k) = amin1(dtmin(i,k), buoy(i,j)) |
---|
| 2179 | END IF |
---|
| 2180 | END DO |
---|
| 2181 | END DO |
---|
| 2182 | END DO |
---|
[1849] | 2183 | |
---|
[2007] | 2184 | ! the interval on which cape is computed starts at pbase : |
---|
[1849] | 2185 | |
---|
[1992] | 2186 | DO k = 1, nl |
---|
| 2187 | DO i = 1, ncum |
---|
[1849] | 2188 | |
---|
[1992] | 2189 | IF ((k>=(icb(i)+1)) .AND. (k<=inb(i))) THEN |
---|
[1849] | 2190 | |
---|
[1992] | 2191 | deltap = min(pbase(i), ph(i,k-1)) - min(pbase(i), ph(i,k)) |
---|
| 2192 | cape(i) = cape(i) + rrd*buoy(i, k-1)*deltap/p(i, k-1) |
---|
| 2193 | cape(i) = amax1(0.0, cape(i)) |
---|
| 2194 | sigold(i, k) = sig(i, k) |
---|
[1849] | 2195 | |
---|
[2007] | 2196 | ! dtmin(i,k)=100.0 |
---|
| 2197 | ! do 97 j=icb(i),k-1 ! mauvaise vectorisation |
---|
| 2198 | ! dtmin(i,k)=AMIN1(dtmin(i,k),buoy(i,j)) |
---|
| 2199 | ! 97 continue |
---|
[1849] | 2200 | |
---|
[1992] | 2201 | sig(i, k) = beta*sig(i, k) + alpha*dtmin(i, k)*abs(dtmin(i,k)) |
---|
| 2202 | sig(i, k) = max(sig(i,k), 0.0) |
---|
| 2203 | sig(i, k) = amin1(sig(i,k), 0.01) |
---|
| 2204 | fac = amin1(((dtcrit-dtmin(i,k))/dtcrit), 1.0) |
---|
| 2205 | w = (1.-beta)*fac*sqrt(cape(i)) + beta*w0(i, k) |
---|
| 2206 | amu = 0.5*(sig(i,k)+sigold(i,k))*w |
---|
| 2207 | m(i, k) = amu*0.007*p(i, k)*(ph(i,k)-ph(i,k+1))/tv(i, k) |
---|
| 2208 | w0(i, k) = w |
---|
| 2209 | END IF |
---|
[1849] | 2210 | |
---|
[1992] | 2211 | END DO |
---|
| 2212 | END DO |
---|
[1849] | 2213 | |
---|
[1992] | 2214 | DO i = 1, ncum |
---|
| 2215 | w0(i, icb(i)) = 0.5*w0(i, icb(i)+1) |
---|
[2007] | 2216 | m(i, icb(i)) = 0.5*m(i, icb(i)+1)*(ph(i,icb(i))-ph(i,icb(i)+1))/(ph(i,icb(i)+1)-ph(i,icb(i)+2)) |
---|
[1992] | 2217 | sig(i, icb(i)) = sig(i, icb(i)+1) |
---|
| 2218 | sig(i, icb(i)-1) = sig(i, icb(i)) |
---|
| 2219 | END DO |
---|
[1849] | 2220 | |
---|
[2007] | 2221 | ! ccc 3. Compute final cloud base mass flux and set iflag to 3 if |
---|
| 2222 | ! ccc cloud base mass flux is exceedingly small and is decreasing (i.e. if |
---|
| 2223 | ! ccc the final mass flux (cbmflast) is greater than the target mass flux |
---|
| 2224 | ! ccc (cbmf) ??). |
---|
| 2225 | ! cc |
---|
| 2226 | ! c do i = 1,ncum |
---|
| 2227 | ! c cbmflast(i) = 0. |
---|
| 2228 | ! c enddo |
---|
| 2229 | ! cc |
---|
| 2230 | ! c do k= 1,nl |
---|
| 2231 | ! c do i = 1,ncum |
---|
[5117] | 2232 | ! c IF (k .ge. icb(i) .AND. k .le. inb(i)) THEN |
---|
[2007] | 2233 | ! c cbmflast(i) = cbmflast(i)+M(i,k) |
---|
| 2234 | ! c ENDIF |
---|
| 2235 | ! c enddo |
---|
| 2236 | ! c enddo |
---|
| 2237 | ! cc |
---|
| 2238 | ! c do i = 1,ncum |
---|
| 2239 | ! c IF (cbmflast(i) .lt. 1.e-6) THEN |
---|
| 2240 | ! c iflag(i) = 3 |
---|
| 2241 | ! c ENDIF |
---|
| 2242 | ! c enddo |
---|
| 2243 | ! cc |
---|
| 2244 | ! c do k= 1,nl |
---|
| 2245 | ! c do i = 1,ncum |
---|
| 2246 | ! c IF (iflag(i) .ge. 3) THEN |
---|
| 2247 | ! c M(i,k) = 0. |
---|
| 2248 | ! c sig(i,k) = 0. |
---|
| 2249 | ! c w0(i,k) = 0. |
---|
| 2250 | ! c ENDIF |
---|
| 2251 | ! c enddo |
---|
| 2252 | ! c enddo |
---|
| 2253 | ! cc |
---|
| 2254 | !! cape=0.0 |
---|
| 2255 | !! do 98 i=icb+1,inb |
---|
| 2256 | !! deltap = min(pbase,ph(i-1))-min(pbase,ph(i)) |
---|
| 2257 | !! cape=cape+rrd*buoy(i-1)*deltap/p(i-1) |
---|
| 2258 | !! dcape=rrd*buoy(i-1)*deltap/p(i-1) |
---|
| 2259 | !! dlnp=deltap/p(i-1) |
---|
| 2260 | !! cape=max(0.0,cape) |
---|
| 2261 | !! sigold=sig(i) |
---|
[1849] | 2262 | |
---|
[2007] | 2263 | !! dtmin=100.0 |
---|
| 2264 | !! do 97 j=icb,i-1 |
---|
| 2265 | !! dtmin=amin1(dtmin,buoy(j)) |
---|
| 2266 | !! 97 continue |
---|
[1849] | 2267 | |
---|
[2007] | 2268 | !! sig(i)=beta*sig(i)+alpha*dtmin*abs(dtmin) |
---|
| 2269 | !! sig(i)=max(sig(i),0.0) |
---|
| 2270 | !! sig(i)=amin1(sig(i),0.01) |
---|
| 2271 | !! fac=amin1(((dtcrit-dtmin)/dtcrit),1.0) |
---|
| 2272 | !! w=(1.-beta)*fac*sqrt(cape)+beta*w0(i) |
---|
| 2273 | !! amu=0.5*(sig(i)+sigold)*w |
---|
| 2274 | !! m(i)=amu*0.007*p(i)*(ph(i)-ph(i+1))/tv(i) |
---|
| 2275 | !! w0(i)=w |
---|
| 2276 | !! 98 continue |
---|
| 2277 | !! w0(icb)=0.5*w0(icb+1) |
---|
| 2278 | !! m(icb)=0.5*m(icb+1)*(ph(icb)-ph(icb+1))/(ph(icb+1)-ph(icb+2)) |
---|
| 2279 | !! sig(icb)=sig(icb+1) |
---|
| 2280 | !! sig(icb-1)=sig(icb) |
---|
[1849] | 2281 | |
---|
[5105] | 2282 | |
---|
[1992] | 2283 | END SUBROUTINE cv3_closure |
---|
[1849] | 2284 | |
---|
[2007] | 2285 | SUBROUTINE cv3_mixing(nloc, ncum, nd, na, ntra, icb, nk, inb, & |
---|
| 2286 | ph, t, rr, rs, u, v, tra, h, lv, lf, frac, qnk, & |
---|
| 2287 | unk, vnk, hp, tv, tvp, ep, clw, m, sig, & |
---|
| 2288 | ment, qent, uent, vent, nent, sij, elij, ments, qents, traent) |
---|
[1992] | 2289 | IMPLICIT NONE |
---|
[1849] | 2290 | |
---|
[2007] | 2291 | ! --------------------------------------------------------------------- |
---|
| 2292 | ! a faire: |
---|
| 2293 | ! - vectorisation de la partie normalisation des flux (do 789...) |
---|
| 2294 | ! --------------------------------------------------------------------- |
---|
[524] | 2295 | |
---|
[1992] | 2296 | include "cvthermo.h" |
---|
| 2297 | include "cv3param.h" |
---|
| 2298 | include "cvflag.h" |
---|
[524] | 2299 | |
---|
[2007] | 2300 | !inputs: |
---|
[2253] | 2301 | INTEGER, INTENT (IN) :: ncum, nd, na, ntra, nloc |
---|
| 2302 | INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, inb, nk |
---|
| 2303 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: sig |
---|
| 2304 | REAL, DIMENSION (nloc), INTENT (IN) :: qnk, unk, vnk |
---|
| 2305 | REAL, DIMENSION (nloc, nd+1), INTENT (IN) :: ph |
---|
| 2306 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, rr, rs |
---|
| 2307 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: u, v |
---|
| 2308 | REAL, DIMENSION (nloc, nd, ntra), INTENT (IN) :: tra ! input of convect3 |
---|
| 2309 | REAL, DIMENSION (nloc, na), INTENT (IN) :: lv, h, hp |
---|
| 2310 | REAL, DIMENSION (nloc, na), INTENT (IN) :: lf, frac |
---|
| 2311 | REAL, DIMENSION (nloc, na), INTENT (IN) :: tv, tvp, ep, clw |
---|
| 2312 | REAL, DIMENSION (nloc, na), INTENT (IN) :: m ! input of convect3 |
---|
[524] | 2313 | |
---|
[2007] | 2314 | !outputs: |
---|
[2253] | 2315 | REAL, DIMENSION (nloc, na, na), INTENT (OUT) :: ment, qent |
---|
| 2316 | REAL, DIMENSION (nloc, na, na), INTENT (OUT) :: uent, vent |
---|
| 2317 | REAL, DIMENSION (nloc, na, na), INTENT (OUT) :: sij, elij |
---|
| 2318 | REAL, DIMENSION (nloc, nd, nd, ntra), INTENT (OUT) :: traent |
---|
| 2319 | REAL, DIMENSION (nloc, nd, nd), INTENT (OUT) :: ments, qents |
---|
| 2320 | INTEGER, DIMENSION (nloc, nd), INTENT (OUT) :: nent |
---|
[524] | 2321 | |
---|
[2007] | 2322 | !local variables: |
---|
[1992] | 2323 | INTEGER i, j, k, il, im, jm |
---|
| 2324 | INTEGER num1, num2 |
---|
| 2325 | REAL rti, bf2, anum, denom, dei, altem, cwat, stemp, qp |
---|
| 2326 | REAL alt, smid, sjmin, sjmax, delp, delm |
---|
| 2327 | REAL asij(nloc), smax(nloc), scrit(nloc) |
---|
| 2328 | REAL asum(nloc, nd), bsum(nloc, nd), csum(nloc, nd) |
---|
[2253] | 2329 | REAL sigij(nloc, nd, nd) |
---|
[1992] | 2330 | REAL wgh |
---|
| 2331 | REAL zm(nloc, na) |
---|
| 2332 | LOGICAL lwork(nloc) |
---|
[524] | 2333 | |
---|
[2007] | 2334 | ! ===================================================================== |
---|
| 2335 | ! --- INITIALIZE VARIOUS ARRAYS USED IN THE COMPUTATIONS |
---|
| 2336 | ! ===================================================================== |
---|
[524] | 2337 | |
---|
[2007] | 2338 | ! ori do 360 i=1,ncum*nlp |
---|
[1992] | 2339 | DO j = 1, nl |
---|
| 2340 | DO i = 1, ncum |
---|
| 2341 | nent(i, j) = 0 |
---|
[2007] | 2342 | ! in convect3, m is computed in cv3_closure |
---|
| 2343 | ! ori m(i,1)=0.0 |
---|
[1992] | 2344 | END DO |
---|
| 2345 | END DO |
---|
[524] | 2346 | |
---|
[2007] | 2347 | ! ori do 400 k=1,nlp |
---|
| 2348 | ! ori do 390 j=1,nlp |
---|
[1992] | 2349 | DO j = 1, nl |
---|
[2459] | 2350 | DO k = 1, nl |
---|
| 2351 | DO i = 1, ncum |
---|
| 2352 | qent(i, k, j) = rr(i, j) |
---|
| 2353 | uent(i, k, j) = u(i, j) |
---|
| 2354 | vent(i, k, j) = v(i, j) |
---|
| 2355 | elij(i, k, j) = 0.0 |
---|
| 2356 | !ym ment(i,k,j)=0.0 |
---|
| 2357 | !ym sij(i,k,j)=0.0 |
---|
| 2358 | END DO |
---|
| 2359 | END DO |
---|
[1992] | 2360 | END DO |
---|
[524] | 2361 | |
---|
[2007] | 2362 | !ym |
---|
[1992] | 2363 | ment(1:ncum, 1:nd, 1:nd) = 0.0 |
---|
| 2364 | sij(1:ncum, 1:nd, 1:nd) = 0.0 |
---|
[524] | 2365 | |
---|
[2007] | 2366 | !AC! do k=1,ntra |
---|
| 2367 | !AC! do j=1,nd ! instead nlp |
---|
| 2368 | !AC! do i=1,nd ! instead nlp |
---|
| 2369 | !AC! do il=1,ncum |
---|
| 2370 | !AC! traent(il,i,j,k)=tra(il,j,k) |
---|
| 2371 | !AC! enddo |
---|
| 2372 | !AC! enddo |
---|
| 2373 | !AC! enddo |
---|
| 2374 | !AC! enddo |
---|
[1992] | 2375 | zm(:, :) = 0. |
---|
[524] | 2376 | |
---|
[2007] | 2377 | ! ===================================================================== |
---|
| 2378 | ! --- CALCULATE ENTRAINED AIR MASS FLUX (ment), TOTAL WATER MIXING |
---|
| 2379 | ! --- RATIO (QENT), TOTAL CONDENSED WATER (elij), AND MIXING |
---|
| 2380 | ! --- FRACTION (sij) |
---|
| 2381 | ! ===================================================================== |
---|
[524] | 2382 | |
---|
[1992] | 2383 | DO i = minorig + 1, nl |
---|
[524] | 2384 | |
---|
[1992] | 2385 | DO j = minorig, nl |
---|
| 2386 | DO il = 1, ncum |
---|
[2007] | 2387 | IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (j>=(icb(il)-1)) .AND. (j<=inb(il))) THEN |
---|
[524] | 2388 | |
---|
[1992] | 2389 | rti = qnk(il) - ep(il, i)*clw(il, i) |
---|
| 2390 | bf2 = 1. + lv(il, j)*lv(il, j)*rs(il, j)/(rrv*t(il,j)*t(il,j)*cpd) |
---|
[524] | 2391 | |
---|
| 2392 | |
---|
[1992] | 2393 | IF (cvflag_ice) THEN |
---|
[5103] | 2394 | ! PRINT*,cvflag_ice,'cvflag_ice dans do 700' |
---|
[1992] | 2395 | IF (t(il,j)<=263.15) THEN |
---|
[2007] | 2396 | bf2 = 1. + (lf(il,j)+lv(il,j))*(lv(il,j)+frac(il,j)* & |
---|
| 2397 | lf(il,j))*rs(il, j)/(rrv*t(il,j)*t(il,j)*cpd) |
---|
[1992] | 2398 | END IF |
---|
| 2399 | END IF |
---|
[524] | 2400 | |
---|
[1992] | 2401 | anum = h(il, j) - hp(il, i) + (cpv-cpd)*t(il, j)*(rti-rr(il,j)) |
---|
| 2402 | denom = h(il, i) - hp(il, i) + (cpd-cpv)*(rr(il,i)-rti)*t(il, j) |
---|
| 2403 | dei = denom |
---|
| 2404 | IF (abs(dei)<0.01) dei = 0.01 |
---|
| 2405 | sij(il, i, j) = anum/dei |
---|
| 2406 | sij(il, i, i) = 1.0 |
---|
| 2407 | altem = sij(il, i, j)*rr(il, i) + (1.-sij(il,i,j))*rti - rs(il, j) |
---|
| 2408 | altem = altem/bf2 |
---|
| 2409 | cwat = clw(il, j)*(1.-ep(il,j)) |
---|
| 2410 | stemp = sij(il, i, j) |
---|
| 2411 | IF ((stemp<0.0 .OR. stemp>1.0 .OR. altem>cwat) .AND. j>i) THEN |
---|
[524] | 2412 | |
---|
[1992] | 2413 | IF (cvflag_ice) THEN |
---|
[2007] | 2414 | anum = anum - (lv(il,j)+frac(il,j)*lf(il,j))*(rti-rs(il,j)-cwat*bf2) |
---|
[1992] | 2415 | denom = denom + (lv(il,j)+frac(il,j)*lf(il,j))*(rr(il,i)-rti) |
---|
| 2416 | ELSE |
---|
| 2417 | anum = anum - lv(il, j)*(rti-rs(il,j)-cwat*bf2) |
---|
| 2418 | denom = denom + lv(il, j)*(rr(il,i)-rti) |
---|
| 2419 | END IF |
---|
[524] | 2420 | |
---|
[1992] | 2421 | IF (abs(denom)<0.01) denom = 0.01 |
---|
| 2422 | sij(il, i, j) = anum/denom |
---|
[2007] | 2423 | altem = sij(il, i, j)*rr(il, i) + (1.-sij(il,i,j))*rti - rs(il, j) |
---|
[1992] | 2424 | altem = altem - (bf2-1.)*cwat |
---|
| 2425 | END IF |
---|
| 2426 | IF (sij(il,i,j)>0.0 .AND. sij(il,i,j)<0.95) THEN |
---|
| 2427 | qent(il, i, j) = sij(il, i, j)*rr(il, i) + (1.-sij(il,i,j))*rti |
---|
[2007] | 2428 | uent(il, i, j) = sij(il, i, j)*u(il, i) + (1.-sij(il,i,j))*unk(il) |
---|
| 2429 | vent(il, i, j) = sij(il, i, j)*v(il, i) + (1.-sij(il,i,j))*vnk(il) |
---|
| 2430 | !!!! do k=1,ntra |
---|
| 2431 | !!!! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) |
---|
| 2432 | !!!! : +(1.-sij(il,i,j))*tra(il,nk(il),k) |
---|
[5086] | 2433 | !!!! END DO |
---|
[1992] | 2434 | elij(il, i, j) = altem |
---|
| 2435 | elij(il, i, j) = max(0.0, elij(il,i,j)) |
---|
| 2436 | ment(il, i, j) = m(il, i)/(1.-sij(il,i,j)) |
---|
| 2437 | nent(il, i) = nent(il, i) + 1 |
---|
| 2438 | END IF |
---|
| 2439 | sij(il, i, j) = max(0.0, sij(il,i,j)) |
---|
| 2440 | sij(il, i, j) = amin1(1.0, sij(il,i,j)) |
---|
| 2441 | END IF ! new |
---|
| 2442 | END DO |
---|
| 2443 | END DO |
---|
[524] | 2444 | |
---|
[2007] | 2445 | !AC! do k=1,ntra |
---|
| 2446 | !AC! do j=minorig,nl |
---|
| 2447 | !AC! do il=1,ncum |
---|
[5117] | 2448 | !AC! IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. |
---|
| 2449 | !AC! : (j.ge.(icb(il)-1)).AND.(j.le.inb(il)))THEN |
---|
[2007] | 2450 | !AC! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) |
---|
| 2451 | !AC! : +(1.-sij(il,i,j))*tra(il,nk(il),k) |
---|
| 2452 | !AC! endif |
---|
| 2453 | !AC! enddo |
---|
| 2454 | !AC! enddo |
---|
| 2455 | !AC! enddo |
---|
[524] | 2456 | |
---|
| 2457 | |
---|
[2007] | 2458 | ! *** if no air can entrain at level i assume that updraft detrains *** |
---|
| 2459 | ! *** at that level and calculate detrained air flux and properties *** |
---|
[524] | 2460 | |
---|
| 2461 | |
---|
[2007] | 2462 | ! @ do 170 i=icb(il),inb(il) |
---|
[524] | 2463 | |
---|
[1992] | 2464 | DO il = 1, ncum |
---|
| 2465 | IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (nent(il,i)==0)) THEN |
---|
[5117] | 2466 | ! @ IF(nent(il,i).EQ.0)THEN |
---|
[1992] | 2467 | ment(il, i, i) = m(il, i) |
---|
| 2468 | qent(il, i, i) = qnk(il) - ep(il, i)*clw(il, i) |
---|
| 2469 | uent(il, i, i) = unk(il) |
---|
| 2470 | vent(il, i, i) = vnk(il) |
---|
| 2471 | elij(il, i, i) = clw(il, i) |
---|
[2007] | 2472 | ! MAF sij(il,i,i)=1.0 |
---|
[1992] | 2473 | sij(il, i, i) = 0.0 |
---|
| 2474 | END IF |
---|
| 2475 | END DO |
---|
| 2476 | END DO |
---|
[879] | 2477 | |
---|
[2007] | 2478 | !AC! do j=1,ntra |
---|
| 2479 | !AC! do i=minorig+1,nl |
---|
| 2480 | !AC! do il=1,ncum |
---|
[5117] | 2481 | !AC! if (i.ge.icb(il) .AND. i.le.inb(il) .AND. nent(il,i).EQ.0) THEN |
---|
[2007] | 2482 | !AC! traent(il,i,i,j)=tra(il,nk(il),j) |
---|
| 2483 | !AC! endif |
---|
| 2484 | !AC! enddo |
---|
| 2485 | !AC! enddo |
---|
| 2486 | !AC! enddo |
---|
[879] | 2487 | |
---|
[1992] | 2488 | DO j = minorig, nl |
---|
| 2489 | DO i = minorig, nl |
---|
| 2490 | DO il = 1, ncum |
---|
[2007] | 2491 | IF ((j>=(icb(il)-1)) .AND. (j<=inb(il)) .AND. (i>=icb(il)) .AND. (i<=inb(il))) THEN |
---|
[1992] | 2492 | sigij(il, i, j) = sij(il, i, j) |
---|
| 2493 | END IF |
---|
| 2494 | END DO |
---|
| 2495 | END DO |
---|
| 2496 | END DO |
---|
[2007] | 2497 | ! @ enddo |
---|
[879] | 2498 | |
---|
[2007] | 2499 | ! @170 continue |
---|
[524] | 2500 | |
---|
[2007] | 2501 | ! ===================================================================== |
---|
| 2502 | ! --- NORMALIZE ENTRAINED AIR MASS FLUXES |
---|
| 2503 | ! --- TO REPRESENT EQUAL PROBABILITIES OF MIXING |
---|
| 2504 | ! ===================================================================== |
---|
[970] | 2505 | |
---|
[1992] | 2506 | CALL zilch(asum, nloc*nd) |
---|
| 2507 | CALL zilch(csum, nloc*nd) |
---|
| 2508 | CALL zilch(csum, nloc*nd) |
---|
[524] | 2509 | |
---|
[1992] | 2510 | DO il = 1, ncum |
---|
| 2511 | lwork(il) = .FALSE. |
---|
| 2512 | END DO |
---|
[524] | 2513 | |
---|
[1992] | 2514 | DO i = minorig + 1, nl |
---|
[524] | 2515 | |
---|
[1992] | 2516 | num1 = 0 |
---|
| 2517 | DO il = 1, ncum |
---|
| 2518 | IF (i>=icb(il) .AND. i<=inb(il)) num1 = num1 + 1 |
---|
| 2519 | END DO |
---|
| 2520 | IF (num1<=0) GO TO 789 |
---|
[524] | 2521 | |
---|
[879] | 2522 | |
---|
[1992] | 2523 | DO il = 1, ncum |
---|
| 2524 | IF (i>=icb(il) .AND. i<=inb(il)) THEN |
---|
| 2525 | lwork(il) = (nent(il,i)/=0) |
---|
| 2526 | qp = qnk(il) - ep(il, i)*clw(il, i) |
---|
[524] | 2527 | |
---|
[1992] | 2528 | IF (cvflag_ice) THEN |
---|
[524] | 2529 | |
---|
[2007] | 2530 | anum = h(il, i) - hp(il, i) - (lv(il,i)+frac(il,i)*lf(il,i))* & |
---|
| 2531 | (qp-rs(il,i)) + (cpv-cpd)*t(il, i)*(qp-rr(il,i)) |
---|
| 2532 | denom = h(il, i) - hp(il, i) + (lv(il,i)+frac(il,i)*lf(il,i))* & |
---|
| 2533 | (rr(il,i)-qp) + (cpd-cpv)*t(il, i)*(rr(il,i)-qp) |
---|
[1992] | 2534 | ELSE |
---|
[879] | 2535 | |
---|
[1992] | 2536 | anum = h(il, i) - hp(il, i) - lv(il, i)*(qp-rs(il,i)) + & |
---|
[2007] | 2537 | (cpv-cpd)*t(il, i)*(qp-rr(il,i)) |
---|
[1992] | 2538 | denom = h(il, i) - hp(il, i) + lv(il, i)*(rr(il,i)-qp) + & |
---|
[2007] | 2539 | (cpd-cpv)*t(il, i)*(rr(il,i)-qp) |
---|
[1992] | 2540 | END IF |
---|
[524] | 2541 | |
---|
[1992] | 2542 | IF (abs(denom)<0.01) denom = 0.01 |
---|
| 2543 | scrit(il) = anum/denom |
---|
| 2544 | alt = qp - rs(il, i) + scrit(il)*(rr(il,i)-qp) |
---|
| 2545 | IF (scrit(il)<=0.0 .OR. alt<=0.0) scrit(il) = 1.0 |
---|
| 2546 | smax(il) = 0.0 |
---|
| 2547 | asij(il) = 0.0 |
---|
| 2548 | END IF |
---|
| 2549 | END DO |
---|
[524] | 2550 | |
---|
[1992] | 2551 | DO j = nl, minorig, -1 |
---|
[524] | 2552 | |
---|
[1992] | 2553 | num2 = 0 |
---|
| 2554 | DO il = 1, ncum |
---|
[2007] | 2555 | IF (i>=icb(il) .AND. i<=inb(il) .AND. & |
---|
| 2556 | j>=(icb(il)-1) .AND. j<=inb(il) .AND. & |
---|
| 2557 | lwork(il)) num2 = num2 + 1 |
---|
[1992] | 2558 | END DO |
---|
| 2559 | IF (num2<=0) GO TO 175 |
---|
[524] | 2560 | |
---|
[1992] | 2561 | DO il = 1, ncum |
---|
[2007] | 2562 | IF (i>=icb(il) .AND. i<=inb(il) .AND. & |
---|
| 2563 | j>=(icb(il)-1) .AND. j<=inb(il) .AND. & |
---|
| 2564 | lwork(il)) THEN |
---|
[524] | 2565 | |
---|
[1992] | 2566 | IF (sij(il,i,j)>1.0E-16 .AND. sij(il,i,j)<0.95) THEN |
---|
| 2567 | wgh = 1.0 |
---|
| 2568 | IF (j>i) THEN |
---|
| 2569 | sjmax = max(sij(il,i,j+1), smax(il)) |
---|
| 2570 | sjmax = amin1(sjmax, scrit(il)) |
---|
| 2571 | smax(il) = max(sij(il,i,j), smax(il)) |
---|
| 2572 | sjmin = max(sij(il,i,j-1), smax(il)) |
---|
| 2573 | sjmin = amin1(sjmin, scrit(il)) |
---|
| 2574 | IF (sij(il,i,j)<(smax(il)-1.0E-16)) wgh = 0.0 |
---|
| 2575 | smid = amin1(sij(il,i,j), scrit(il)) |
---|
| 2576 | ELSE |
---|
| 2577 | sjmax = max(sij(il,i,j+1), scrit(il)) |
---|
| 2578 | smid = max(sij(il,i,j), scrit(il)) |
---|
| 2579 | sjmin = 0.0 |
---|
| 2580 | IF (j>1) sjmin = sij(il, i, j-1) |
---|
| 2581 | sjmin = max(sjmin, scrit(il)) |
---|
| 2582 | END IF |
---|
| 2583 | delp = abs(sjmax-smid) |
---|
| 2584 | delm = abs(sjmin-smid) |
---|
| 2585 | asij(il) = asij(il) + wgh*(delp+delm) |
---|
| 2586 | ment(il, i, j) = ment(il, i, j)*(delp+delm)*wgh |
---|
| 2587 | END IF |
---|
| 2588 | END IF |
---|
| 2589 | END DO |
---|
[524] | 2590 | |
---|
[1992] | 2591 | 175 END DO |
---|
[524] | 2592 | |
---|
[1992] | 2593 | DO il = 1, ncum |
---|
| 2594 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il)) THEN |
---|
| 2595 | asij(il) = max(1.0E-16, asij(il)) |
---|
| 2596 | asij(il) = 1.0/asij(il) |
---|
| 2597 | asum(il, i) = 0.0 |
---|
| 2598 | bsum(il, i) = 0.0 |
---|
| 2599 | csum(il, i) = 0.0 |
---|
| 2600 | END IF |
---|
| 2601 | END DO |
---|
[524] | 2602 | |
---|
[1992] | 2603 | DO j = minorig, nl |
---|
| 2604 | DO il = 1, ncum |
---|
[2007] | 2605 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. & |
---|
| 2606 | j>=(icb(il)-1) .AND. j<=inb(il)) THEN |
---|
[1992] | 2607 | ment(il, i, j) = ment(il, i, j)*asij(il) |
---|
| 2608 | END IF |
---|
| 2609 | END DO |
---|
| 2610 | END DO |
---|
[524] | 2611 | |
---|
[1992] | 2612 | DO j = minorig, nl |
---|
| 2613 | DO il = 1, ncum |
---|
[2007] | 2614 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. & |
---|
| 2615 | j>=(icb(il)-1) .AND. j<=inb(il)) THEN |
---|
[1992] | 2616 | asum(il, i) = asum(il, i) + ment(il, i, j) |
---|
| 2617 | ment(il, i, j) = ment(il, i, j)*sig(il, j) |
---|
| 2618 | bsum(il, i) = bsum(il, i) + ment(il, i, j) |
---|
| 2619 | END IF |
---|
| 2620 | END DO |
---|
| 2621 | END DO |
---|
[1849] | 2622 | |
---|
[1992] | 2623 | DO il = 1, ncum |
---|
| 2624 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il)) THEN |
---|
| 2625 | bsum(il, i) = max(bsum(il,i), 1.0E-16) |
---|
| 2626 | bsum(il, i) = 1.0/bsum(il, i) |
---|
| 2627 | END IF |
---|
| 2628 | END DO |
---|
[1849] | 2629 | |
---|
[1992] | 2630 | DO j = minorig, nl |
---|
| 2631 | DO il = 1, ncum |
---|
[2007] | 2632 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. & |
---|
| 2633 | j>=(icb(il)-1) .AND. j<=inb(il)) THEN |
---|
[1992] | 2634 | ment(il, i, j) = ment(il, i, j)*asum(il, i)*bsum(il, i) |
---|
| 2635 | END IF |
---|
| 2636 | END DO |
---|
| 2637 | END DO |
---|
[879] | 2638 | |
---|
[1992] | 2639 | DO j = minorig, nl |
---|
| 2640 | DO il = 1, ncum |
---|
[2007] | 2641 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. & |
---|
| 2642 | j>=(icb(il)-1) .AND. j<=inb(il)) THEN |
---|
[1992] | 2643 | csum(il, i) = csum(il, i) + ment(il, i, j) |
---|
| 2644 | END IF |
---|
| 2645 | END DO |
---|
| 2646 | END DO |
---|
[1849] | 2647 | |
---|
[1992] | 2648 | DO il = 1, ncum |
---|
| 2649 | IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. & |
---|
| 2650 | csum(il,i)<m(il,i)) THEN |
---|
| 2651 | nent(il, i) = 0 |
---|
| 2652 | ment(il, i, i) = m(il, i) |
---|
| 2653 | qent(il, i, i) = qnk(il) - ep(il, i)*clw(il, i) |
---|
| 2654 | uent(il, i, i) = unk(il) |
---|
| 2655 | vent(il, i, i) = vnk(il) |
---|
| 2656 | elij(il, i, i) = clw(il, i) |
---|
[2007] | 2657 | ! MAF sij(il,i,i)=1.0 |
---|
[1992] | 2658 | sij(il, i, i) = 0.0 |
---|
| 2659 | END IF |
---|
| 2660 | END DO ! il |
---|
[1849] | 2661 | |
---|
[2007] | 2662 | !AC! do j=1,ntra |
---|
| 2663 | !AC! do il=1,ncum |
---|
[5117] | 2664 | !AC! if ( i.ge.icb(il) .AND. i.le.inb(il) .AND. lwork(il) |
---|
| 2665 | !AC! : .AND. csum(il,i).lt.m(il,i) ) THEN |
---|
[2007] | 2666 | !AC! traent(il,i,i,j)=tra(il,nk(il),j) |
---|
| 2667 | !AC! endif |
---|
| 2668 | !AC! enddo |
---|
| 2669 | !AC! enddo |
---|
[1992] | 2670 | 789 END DO |
---|
[879] | 2671 | |
---|
[2007] | 2672 | ! MAF: renormalisation de MENT |
---|
[1992] | 2673 | CALL zilch(zm, nloc*na) |
---|
[2393] | 2674 | DO jm = 1, nl |
---|
[2459] | 2675 | DO im = 1, nl |
---|
| 2676 | DO il = 1, ncum |
---|
| 2677 | zm(il, im) = zm(il, im) + (1.-sij(il,im,jm))*ment(il, im, jm) |
---|
| 2678 | END DO |
---|
| 2679 | END DO |
---|
[1992] | 2680 | END DO |
---|
[524] | 2681 | |
---|
[2393] | 2682 | DO jm = 1, nl |
---|
| 2683 | DO im = 1, nl |
---|
[1992] | 2684 | DO il = 1, ncum |
---|
| 2685 | IF (zm(il,im)/=0.) THEN |
---|
| 2686 | ment(il, im, jm) = ment(il, im, jm)*m(il, im)/zm(il, im) |
---|
| 2687 | END IF |
---|
| 2688 | END DO |
---|
| 2689 | END DO |
---|
| 2690 | END DO |
---|
[524] | 2691 | |
---|
[2459] | 2692 | DO jm = 1, nl |
---|
| 2693 | DO im = 1, nl |
---|
| 2694 | DO il = 1, ncum |
---|
| 2695 | qents(il, im, jm) = qent(il, im, jm) |
---|
| 2696 | ments(il, im, jm) = ment(il, im, jm) |
---|
| 2697 | END DO |
---|
| 2698 | END DO |
---|
| 2699 | END DO |
---|
[524] | 2700 | |
---|
[5105] | 2701 | |
---|
[1992] | 2702 | END SUBROUTINE cv3_mixing |
---|
[879] | 2703 | |
---|
[2007] | 2704 | SUBROUTINE cv3_unsat(nloc, ncum, nd, na, ntra, icb, inb, iflag, & |
---|
| 2705 | t, rr, rs, gz, u, v, tra, p, ph, & |
---|
[3496] | 2706 | th, tv, lv, lf, cpn, ep, sigp, clw, frac_s, qpreca, frac_a, qta , & !!jygprl |
---|
[2007] | 2707 | m, ment, elij, delt, plcl, coef_clos, & |
---|
| 2708 | mp, rp, up, vp, trap, wt, water, evap, fondue, ice, & |
---|
| 2709 | faci, b, sigd, & |
---|
[3496] | 2710 | wdtrainA, wdtrainS, wdtrainM) ! RomP |
---|
[5112] | 2711 | USE lmdz_print_control, ONLY: prt_level, lunout |
---|
[1992] | 2712 | IMPLICIT NONE |
---|
[879] | 2713 | |
---|
| 2714 | |
---|
[1992] | 2715 | include "cvthermo.h" |
---|
| 2716 | include "cv3param.h" |
---|
| 2717 | include "cvflag.h" |
---|
[2287] | 2718 | include "nuage.h" |
---|
[524] | 2719 | |
---|
[2007] | 2720 | !inputs: |
---|
[2393] | 2721 | INTEGER, INTENT (IN) :: ncum, nd, na, ntra, nloc |
---|
| 2722 | INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, inb |
---|
| 2723 | REAL, INTENT(IN) :: delt |
---|
| 2724 | REAL, DIMENSION (nloc), INTENT (IN) :: plcl |
---|
| 2725 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, rr, rs |
---|
| 2726 | REAL, DIMENSION (nloc, na), INTENT (IN) :: gz |
---|
| 2727 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: u, v |
---|
[3496] | 2728 | REAL, DIMENSION (nloc, nd, ntra), INTENT(IN) :: tra |
---|
| 2729 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: p |
---|
| 2730 | REAL, DIMENSION (nloc, nd+1), INTENT (IN) :: ph |
---|
| 2731 | REAL, DIMENSION (nloc, na), INTENT (IN) :: ep, sigp, clw !adiab ascent shedding |
---|
| 2732 | REAL, DIMENSION (nloc, na), INTENT (IN) :: frac_s !ice fraction in adiab ascent shedding !!jygprl |
---|
| 2733 | REAL, DIMENSION (nloc, na), INTENT (IN) :: qpreca !adiab ascent precip !!jygprl |
---|
| 2734 | REAL, DIMENSION (nloc, na), INTENT (IN) :: frac_a !ice fraction in adiab ascent precip !!jygprl |
---|
| 2735 | REAL, DIMENSION (nloc, na), INTENT (IN) :: qta !adiab ascent specific total water !!jygprl |
---|
[2393] | 2736 | REAL, DIMENSION (nloc, na), INTENT (IN) :: th, tv, lv, cpn |
---|
| 2737 | REAL, DIMENSION (nloc, na), INTENT (IN) :: lf |
---|
| 2738 | REAL, DIMENSION (nloc, na), INTENT (IN) :: m |
---|
| 2739 | REAL, DIMENSION (nloc, na, na), INTENT (IN) :: ment, elij |
---|
| 2740 | REAL, DIMENSION (nloc), INTENT (IN) :: coef_clos |
---|
[524] | 2741 | |
---|
[2007] | 2742 | !input/output |
---|
[2393] | 2743 | INTEGER, DIMENSION (nloc), INTENT (INOUT) :: iflag(nloc) |
---|
[524] | 2744 | |
---|
[2007] | 2745 | !outputs: |
---|
[2393] | 2746 | REAL, DIMENSION (nloc, na), INTENT (OUT) :: mp, rp, up, vp |
---|
| 2747 | REAL, DIMENSION (nloc, na), INTENT (OUT) :: water, evap, wt |
---|
[3496] | 2748 | REAL, DIMENSION (nloc, na), INTENT (OUT) :: ice, fondue |
---|
| 2749 | REAL, DIMENSION (nloc, na), INTENT (OUT) :: faci ! ice fraction in precipitation |
---|
[2393] | 2750 | REAL, DIMENSION (nloc, na, ntra), INTENT (OUT) :: trap |
---|
| 2751 | REAL, DIMENSION (nloc, na), INTENT (OUT) :: b |
---|
| 2752 | REAL, DIMENSION (nloc), INTENT (OUT) :: sigd |
---|
[2007] | 2753 | ! 25/08/10 - RomP---- ajout des masses precipitantes ejectees |
---|
| 2754 | ! de l ascendance adiabatique et des flux melanges Pa et Pm. |
---|
| 2755 | ! Distinction des wdtrain |
---|
| 2756 | ! Pa = wdtrainA Pm = wdtrainM |
---|
[3496] | 2757 | REAL, DIMENSION (nloc, na), INTENT (OUT) :: wdtrainA, wdtrainS, wdtrainM |
---|
[879] | 2758 | |
---|
[2007] | 2759 | !local variables |
---|
[1992] | 2760 | INTEGER i, j, k, il, num1, ndp1 |
---|
[3496] | 2761 | REAL smallestreal |
---|
[1992] | 2762 | REAL tinv, delti, coef |
---|
| 2763 | REAL awat, afac, afac1, afac2, bfac |
---|
| 2764 | REAL pr1, pr2, sigt, b6, c6, d6, e6, f6, revap, delth |
---|
| 2765 | REAL amfac, amp2, xf, tf, fac2, ur, sru, fac, d, af, bf |
---|
| 2766 | REAL ampmax, thaw |
---|
| 2767 | REAL tevap(nloc) |
---|
[3496] | 2768 | REAL, DIMENSION (nloc, na) :: lvcp, lfcp |
---|
| 2769 | REAL, DIMENSION (nloc, na) :: h, hm |
---|
| 2770 | REAL, DIMENSION (nloc, na) :: ma |
---|
| 2771 | REAL, DIMENSION (nloc, na) :: frac ! ice fraction in precipitation source |
---|
| 2772 | REAL, DIMENSION (nloc, na) :: fraci ! provisionnal ice fraction in precipitation |
---|
| 2773 | REAL, DIMENSION (nloc, na) :: prec |
---|
[1992] | 2774 | REAL wdtrain(nloc) |
---|
| 2775 | LOGICAL lwork(nloc), mplus(nloc) |
---|
[524] | 2776 | |
---|
| 2777 | |
---|
[2007] | 2778 | ! ------------------------------------------------------ |
---|
[5082] | 2779 | IF (prt_level >= 10) print *,' ->cv3_unsat, iflag(1) ', iflag(1) |
---|
[524] | 2780 | |
---|
[3496] | 2781 | smallestreal=tiny(smallestreal) |
---|
| 2782 | |
---|
[2393] | 2783 | ! ============================= |
---|
| 2784 | ! --- INITIALIZE OUTPUT ARRAYS |
---|
| 2785 | ! ============================= |
---|
| 2786 | ! (loops up to nl+1) |
---|
[2671] | 2787 | mp(:,:) = 0. |
---|
| 2788 | rp(:,:) = 0. |
---|
| 2789 | up(:,:) = 0. |
---|
| 2790 | vp(:,:) = 0. |
---|
| 2791 | water(:,:) = 0. |
---|
| 2792 | evap(:,:) = 0. |
---|
| 2793 | wt(:,:) = 0. |
---|
| 2794 | ice(:,:) = 0. |
---|
| 2795 | fondue(:,:) = 0. |
---|
| 2796 | faci(:,:) = 0. |
---|
| 2797 | b(:,:) = 0. |
---|
| 2798 | sigd(:) = 0. |
---|
| 2799 | !! RomP >>> |
---|
| 2800 | wdtrainA(:,:) = 0. |
---|
[3496] | 2801 | wdtrainS(:,:) = 0. |
---|
[2671] | 2802 | wdtrainM(:,:) = 0. |
---|
| 2803 | !! RomP <<< |
---|
[524] | 2804 | |
---|
[2393] | 2805 | DO i = 1, nlp |
---|
[1992] | 2806 | DO il = 1, ncum |
---|
| 2807 | rp(il, i) = rr(il, i) |
---|
| 2808 | up(il, i) = u(il, i) |
---|
| 2809 | vp(il, i) = v(il, i) |
---|
| 2810 | wt(il, i) = 0.001 |
---|
[2393] | 2811 | END DO |
---|
| 2812 | END DO |
---|
| 2813 | |
---|
| 2814 | ! *** Set the fractionnal area sigd of precipitating downdraughts |
---|
| 2815 | DO il = 1, ncum |
---|
| 2816 | sigd(il) = sigdz*coef_clos(il) |
---|
| 2817 | END DO |
---|
| 2818 | |
---|
| 2819 | ! ===================================================================== |
---|
| 2820 | ! --- INITIALIZE VARIOUS ARRAYS AND PARAMETERS USED IN THE COMPUTATIONS |
---|
| 2821 | ! ===================================================================== |
---|
| 2822 | ! (loops up to nl+1) |
---|
| 2823 | |
---|
| 2824 | delti = 1./delt |
---|
| 2825 | tinv = 1./3. |
---|
| 2826 | |
---|
| 2827 | DO i = 1, nlp |
---|
| 2828 | DO il = 1, ncum |
---|
| 2829 | frac(il, i) = 0.0 |
---|
| 2830 | fraci(il, i) = 0.0 |
---|
| 2831 | prec(il, i) = 0.0 |
---|
[1992] | 2832 | lvcp(il, i) = lv(il, i)/cpn(il, i) |
---|
| 2833 | lfcp(il, i) = lf(il, i)/cpn(il, i) |
---|
| 2834 | END DO |
---|
| 2835 | END DO |
---|
[2393] | 2836 | |
---|
[2007] | 2837 | !AC! do k=1,ntra |
---|
| 2838 | !AC! do i=1,nd |
---|
| 2839 | !AC! do il=1,ncum |
---|
| 2840 | !AC! trap(il,i,k)=tra(il,i,k) |
---|
| 2841 | !AC! enddo |
---|
| 2842 | !AC! enddo |
---|
| 2843 | !AC! enddo |
---|
[524] | 2844 | |
---|
[2007] | 2845 | ! *** check whether ep(inb)=0, if so, skip precipitating *** |
---|
| 2846 | ! *** downdraft calculation *** |
---|
[524] | 2847 | |
---|
| 2848 | |
---|
[1992] | 2849 | DO il = 1, ncum |
---|
[2007] | 2850 | !! lwork(il)=.TRUE. |
---|
[5116] | 2851 | !! IF(ep(il,inb(il)).lt.0.0001)lwork(il)=.FALSE. |
---|
[2671] | 2852 | !jyg< |
---|
| 2853 | !! lwork(il) = ep(il, inb(il)) >= 0.0001 |
---|
| 2854 | lwork(il) = ep(il, inb(il)) >= 0.0001 .AND. iflag(il) <= 2 |
---|
[1992] | 2855 | END DO |
---|
[524] | 2856 | |
---|
[3496] | 2857 | ! Get adiabatic ascent mass flux |
---|
[5099] | 2858 | |
---|
[3496] | 2859 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2860 | IF (adiab_ascent_mass_flux_depends_on_ejectliq) THEN |
---|
| 2861 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2862 | !!! Warning : this option leads to water conservation violation |
---|
| 2863 | !!! Expert only |
---|
| 2864 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2865 | DO il = 1, ncum |
---|
| 2866 | ma(il, nlp) = 0. |
---|
| 2867 | ma(il, 1) = 0. |
---|
| 2868 | END DO |
---|
[524] | 2869 | |
---|
[3496] | 2870 | DO i = nl, 2, -1 |
---|
| 2871 | DO il = 1, ncum |
---|
| 2872 | ma(il, i) = ma(il, i+1)*(1.-qta(il,i))/(1.-qta(il,i-1)) + m(il, i) |
---|
| 2873 | END DO |
---|
| 2874 | END DO |
---|
| 2875 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2876 | ELSE ! (adiab_ascent_mass_flux_depends_on_ejectliq) |
---|
| 2877 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2878 | DO il = 1, ncum |
---|
| 2879 | ma(il, nlp) = 0. |
---|
| 2880 | ma(il, 1) = 0. |
---|
| 2881 | END DO |
---|
| 2882 | |
---|
| 2883 | DO i = nl, 2, -1 |
---|
| 2884 | DO il = 1, ncum |
---|
| 2885 | ma(il, i) = ma(il, i+1) + m(il, i) |
---|
| 2886 | END DO |
---|
| 2887 | END DO |
---|
| 2888 | |
---|
| 2889 | ENDIF ! (adiab_ascent_mass_flux_depends_on_ejectliq) ELSE |
---|
| 2890 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2891 | |
---|
[2007] | 2892 | ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
[5099] | 2893 | |
---|
[2007] | 2894 | ! *** begin downdraft loop *** |
---|
[5099] | 2895 | |
---|
[2007] | 2896 | ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
[524] | 2897 | |
---|
[1992] | 2898 | DO i = nl + 1, 1, -1 |
---|
[524] | 2899 | |
---|
[1992] | 2900 | num1 = 0 |
---|
| 2901 | DO il = 1, ncum |
---|
| 2902 | IF (i<=inb(il) .AND. lwork(il)) num1 = num1 + 1 |
---|
| 2903 | END DO |
---|
| 2904 | IF (num1<=0) GO TO 400 |
---|
[1146] | 2905 | |
---|
[1992] | 2906 | CALL zilch(wdtrain, ncum) |
---|
[1146] | 2907 | |
---|
| 2908 | |
---|
[2007] | 2909 | ! *** integrate liquid water equation to find condensed water *** |
---|
| 2910 | ! *** and condensed water flux *** |
---|
[5099] | 2911 | |
---|
| 2912 | |
---|
[2007] | 2913 | ! *** calculate detrained precipitation *** |
---|
[524] | 2914 | |
---|
| 2915 | |
---|
[3496] | 2916 | DO il = 1, ncum |
---|
| 2917 | IF (i<=inb(il) .AND. lwork(il)) THEN |
---|
| 2918 | wdtrain(il) = grav*ep(il, i)*m(il, i)*clw(il, i) |
---|
| 2919 | wdtrainS(il, i) = wdtrain(il)/grav ! Ps jyg |
---|
| 2920 | !! wdtrainA(il, i) = wdtrain(il)/grav ! Ps RomP |
---|
| 2921 | END IF |
---|
| 2922 | END DO |
---|
| 2923 | |
---|
[1992] | 2924 | IF (i>1) THEN |
---|
| 2925 | DO j = 1, i - 1 |
---|
| 2926 | DO il = 1, ncum |
---|
| 2927 | IF (i<=inb(il) .AND. lwork(il)) THEN |
---|
| 2928 | awat = elij(il, j, i) - (1.-ep(il,i))*clw(il, i) |
---|
| 2929 | awat = max(awat, 0.0) |
---|
[3496] | 2930 | wdtrain(il) = wdtrain(il) + grav*awat*ment(il, j, i) |
---|
| 2931 | wdtrainM(il, i) = wdtrain(il)/grav - wdtrainS(il, i) ! Pm jyg |
---|
| 2932 | !! wdtrainM(il, i) = wdtrain(il)/grav - wdtrainA(il, i) ! Pm RomP |
---|
[1992] | 2933 | END IF |
---|
| 2934 | END DO |
---|
| 2935 | END DO |
---|
| 2936 | END IF |
---|
[524] | 2937 | |
---|
[3496] | 2938 | IF (cvflag_prec_eject) THEN |
---|
| 2939 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2940 | IF (adiab_ascent_mass_flux_depends_on_ejectliq) THEN |
---|
| 2941 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2942 | !!! Warning : this option leads to water conservation violation |
---|
| 2943 | !!! Expert only |
---|
| 2944 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2945 | IF ( i > 1) THEN |
---|
| 2946 | DO il = 1, ncum |
---|
| 2947 | IF (i<=inb(il) .AND. lwork(il)) THEN |
---|
| 2948 | wdtrainA(il,i) = ma(il, i+1)*(qta(il, i-1)-qta(il,i))/(1. - qta(il, i-1)) ! Pa jygprl |
---|
| 2949 | wdtrain(il) = wdtrain(il) + grav*wdtrainA(il,i) |
---|
| 2950 | END IF |
---|
| 2951 | END DO |
---|
| 2952 | ENDIF ! ( i > 1) |
---|
| 2953 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2954 | ELSE ! (adiab_ascent_mass_flux_depends_on_ejectliq) |
---|
| 2955 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2956 | IF ( i > 1) THEN |
---|
| 2957 | DO il = 1, ncum |
---|
| 2958 | IF (i<=inb(il) .AND. lwork(il)) THEN |
---|
| 2959 | wdtrainA(il,i) = ma(il, i+1)*(qta(il, i-1)-qta(il,i)) ! Pa jygprl |
---|
| 2960 | wdtrain(il) = wdtrain(il) + grav*wdtrainA(il,i) |
---|
| 2961 | END IF |
---|
| 2962 | END DO |
---|
| 2963 | ENDIF ! ( i > 1) |
---|
[1146] | 2964 | |
---|
[3496] | 2965 | ENDIF ! (adiab_ascent_mass_flux_depends_on_ejectliq) ELSE |
---|
| 2966 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2967 | ENDIF ! (cvflag_prec_eject) |
---|
| 2968 | |
---|
| 2969 | |
---|
[2007] | 2970 | ! *** find rain water and evaporation using provisional *** |
---|
| 2971 | ! *** estimates of rp(i)and rp(i-1) *** |
---|
[1146] | 2972 | |
---|
[1650] | 2973 | |
---|
[3496] | 2974 | IF (cvflag_ice) THEN !!jygprl |
---|
[3500] | 2975 | IF (cvflag_prec_eject) THEN |
---|
| 2976 | DO il = 1, ncum !!jygprl |
---|
| 2977 | IF (i<=inb(il) .AND. lwork(il)) THEN !!jygprl |
---|
| 2978 | frac(il, i) = (frac_a(il,i)*wdtrainA(il,i)+frac_s(il,i)*(wdtrainS(il,i)+wdtrainM(il,i))) / & !!jygprl |
---|
| 2979 | max(wdtrainA(il,i)+wdtrainS(il,i)+wdtrainM(il,i),smallestreal) !!jygprl |
---|
| 2980 | fraci(il, i) = frac(il, i) !!jygprl |
---|
| 2981 | END IF !!jygprl |
---|
| 2982 | END DO !!jygprl |
---|
| 2983 | ELSE ! (cvflag_prec_eject) |
---|
| 2984 | DO il = 1, ncum !!jygprl |
---|
| 2985 | IF (i<=inb(il) .AND. lwork(il)) THEN !!jygprl |
---|
[3502] | 2986 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2987 | IF (keepbug_ice_frac) THEN |
---|
| 2988 | frac(il, i) = frac_s(il, i) |
---|
[3500] | 2989 | ! Ice fraction computed again here as a function of the temperature seen by unsaturated downdraughts |
---|
| 2990 | ! (i.e. the cold pool temperature) for compatibility with earlier versions. |
---|
[3502] | 2991 | fraci(il, i) = 1. - (t(il,i)-243.15)/(263.15-243.15) |
---|
| 2992 | fraci(il, i) = min(max(fraci(il,i),0.0), 1.0) |
---|
| 2993 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2994 | ELSE ! (keepbug_ice_frac) |
---|
| 2995 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 2996 | frac(il, i) = frac_s(il, i) |
---|
| 2997 | fraci(il, i) = frac(il, i) !!jygprl |
---|
| 2998 | ENDIF ! (keepbug_ice_frac) |
---|
| 2999 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[3500] | 3000 | END IF !!jygprl |
---|
| 3001 | END DO !!jygprl |
---|
| 3002 | ENDIF ! (cvflag_prec_eject) |
---|
[3496] | 3003 | END IF !!jygprl |
---|
| 3004 | |
---|
[3502] | 3005 | |
---|
[1992] | 3006 | DO il = 1, ncum |
---|
| 3007 | IF (i<=inb(il) .AND. lwork(il)) THEN |
---|
[524] | 3008 | |
---|
[1992] | 3009 | wt(il, i) = 45.0 |
---|
[524] | 3010 | |
---|
[1992] | 3011 | IF (i<inb(il)) THEN |
---|
[2007] | 3012 | rp(il, i) = rp(il, i+1) + & |
---|
| 3013 | (cpd*(t(il,i+1)-t(il,i))+gz(il,i+1)-gz(il,i))/lv(il, i) |
---|
[1992] | 3014 | rp(il, i) = 0.5*(rp(il,i)+rr(il,i)) |
---|
| 3015 | END IF |
---|
| 3016 | rp(il, i) = max(rp(il,i), 0.0) |
---|
| 3017 | rp(il, i) = amin1(rp(il,i), rs(il,i)) |
---|
| 3018 | rp(il, inb(il)) = rr(il, inb(il)) |
---|
[524] | 3019 | |
---|
[1992] | 3020 | IF (i==1) THEN |
---|
| 3021 | afac = p(il, 1)*(rs(il,1)-rp(il,1))/(1.0E4+2000.0*p(il,1)*rs(il,1)) |
---|
| 3022 | IF (cvflag_ice) THEN |
---|
[2007] | 3023 | afac1 = p(il, i)*(rs(il,1)-rp(il,1))/(1.0E4+2000.0*p(il,1)*rs(il,1)) |
---|
[1992] | 3024 | END IF |
---|
| 3025 | ELSE |
---|
[2007] | 3026 | rp(il, i-1) = rp(il, i) + (cpd*(t(il,i)-t(il,i-1))+gz(il,i)-gz(il,i-1))/lv(il, i) |
---|
[1992] | 3027 | rp(il, i-1) = 0.5*(rp(il,i-1)+rr(il,i-1)) |
---|
| 3028 | rp(il, i-1) = amin1(rp(il,i-1), rs(il,i-1)) |
---|
| 3029 | rp(il, i-1) = max(rp(il,i-1), 0.0) |
---|
[2007] | 3030 | afac1 = p(il, i)*(rs(il,i)-rp(il,i))/(1.0E4+2000.0*p(il,i)*rs(il,i)) |
---|
| 3031 | afac2 = p(il, i-1)*(rs(il,i-1)-rp(il,i-1))/(1.0E4+2000.0*p(il,i-1)*rs(il,i-1)) |
---|
[1992] | 3032 | afac = 0.5*(afac1+afac2) |
---|
| 3033 | END IF |
---|
| 3034 | IF (i==inb(il)) afac = 0.0 |
---|
| 3035 | afac = max(afac, 0.0) |
---|
| 3036 | bfac = 1./(sigd(il)*wt(il,i)) |
---|
[524] | 3037 | |
---|
[2393] | 3038 | IF (prt_level >= 20) THEN |
---|
| 3039 | Print*, 'cv3_unsat after provisional rp estimate: rp, afac, bfac ', & |
---|
| 3040 | i, rp(1, i), afac,bfac |
---|
| 3041 | ENDIF |
---|
[5099] | 3042 | |
---|
[2007] | 3043 | !JYG1 |
---|
| 3044 | ! cc sigt=1.0 |
---|
[5116] | 3045 | ! cc IF(i.ge.icb)sigt=sigp(i) |
---|
[2007] | 3046 | ! prise en compte de la variation progressive de sigt dans |
---|
| 3047 | ! les couches icb et icb-1: |
---|
| 3048 | ! pour plcl<ph(i+1), pr1=0 & pr2=1 |
---|
| 3049 | ! pour plcl>ph(i), pr1=1 & pr2=0 |
---|
| 3050 | ! pour ph(i+1)<plcl<ph(i), pr1 est la proportion a cheval |
---|
| 3051 | ! sur le nuage, et pr2 est la proportion sous la base du |
---|
| 3052 | ! nuage. |
---|
[1992] | 3053 | pr1 = (plcl(il)-ph(il,i+1))/(ph(il,i)-ph(il,i+1)) |
---|
| 3054 | pr1 = max(0., min(1.,pr1)) |
---|
| 3055 | pr2 = (ph(il,i)-plcl(il))/(ph(il,i)-ph(il,i+1)) |
---|
| 3056 | pr2 = max(0., min(1.,pr2)) |
---|
| 3057 | sigt = sigp(il, i)*pr1 + pr2 |
---|
[2007] | 3058 | !JYG2 |
---|
[524] | 3059 | |
---|
[2007] | 3060 | !JYG---- |
---|
| 3061 | ! b6 = bfac*100.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac |
---|
| 3062 | ! c6 = water(il,i+1) + wdtrain(il)*bfac |
---|
| 3063 | ! c6 = prec(il,i+1) + wdtrain(il)*bfac |
---|
| 3064 | ! revap=0.5*(-b6+sqrt(b6*b6+4.*c6)) |
---|
| 3065 | ! evap(il,i)=sigt*afac*revap |
---|
| 3066 | ! water(il,i)=revap*revap |
---|
| 3067 | ! prec(il,i)=revap*revap |
---|
| 3068 | !! print *,' i,b6,c6,revap,evap(il,i),water(il,i),wdtrain(il) ', & |
---|
| 3069 | !! i,b6,c6,revap,evap(il,i),water(il,i),wdtrain(il) |
---|
| 3070 | !!---end jyg--- |
---|
[879] | 3071 | |
---|
[5093] | 3072 | ! --------retour à la formulation originale d'Emanuel. |
---|
[1992] | 3073 | IF (cvflag_ice) THEN |
---|
[524] | 3074 | |
---|
[2007] | 3075 | ! b6=bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac |
---|
| 3076 | ! c6=prec(il,i+1)+bfac*wdtrain(il) & |
---|
| 3077 | ! -50.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*evap(il,i+1) |
---|
[5116] | 3078 | ! IF(c6.gt.0.0)THEN |
---|
[2007] | 3079 | ! revap=0.5*(-b6+sqrt(b6*b6+4.*c6)) |
---|
[524] | 3080 | |
---|
[2007] | 3081 | !JAM Attention: evap=sigt*E |
---|
[5093] | 3082 | ! Modification: evap devient l'évaporation en milieu de couche |
---|
| 3083 | ! car nécessaire dans cv3_yield |
---|
| 3084 | ! Du coup, il faut modifier pas mal d'équations... |
---|
[2007] | 3085 | ! et l'expression de afac qui devient afac1 |
---|
| 3086 | ! revap=sqrt((prec(i+1)+prec(i))/2) |
---|
[524] | 3087 | |
---|
[1992] | 3088 | b6 = bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac1 |
---|
| 3089 | c6 = prec(il, i+1) + 0.5*bfac*wdtrain(il) |
---|
[2007] | 3090 | ! print *,'bfac,sigd(il),sigt,afac1 ',bfac,sigd(il),sigt,afac1 |
---|
| 3091 | ! print *,'prec(il,i+1),wdtrain(il) ',prec(il,i+1),wdtrain(il) |
---|
| 3092 | ! print *,'b6,c6,b6*b6+4.*c6 ',b6,c6,b6*b6+4.*c6 |
---|
[1992] | 3093 | IF (c6>b6*b6+1.E-20) THEN |
---|
| 3094 | revap = 2.*c6/(b6+sqrt(b6*b6+4.*c6)) |
---|
| 3095 | ELSE |
---|
| 3096 | revap = (-b6+sqrt(b6*b6+4.*c6))/2. |
---|
| 3097 | END IF |
---|
| 3098 | prec(il, i) = max(0., 2.*revap*revap-prec(il,i+1)) |
---|
[5103] | 3099 | ! PRINT*,prec(il,i),'neige' |
---|
[524] | 3100 | |
---|
[2007] | 3101 | !JYG Dans sa formulation originale, Emanuel calcule l'evaporation par: |
---|
| 3102 | ! c evap(il,i)=sigt*afac*revap |
---|
[5093] | 3103 | ! ce qui n'est pas correct. Dans cv_routines, la formulation a été modifiee. |
---|
[2007] | 3104 | ! Ici,l'evaporation evap est simplement calculee par l'equation de |
---|
| 3105 | ! conservation. |
---|
| 3106 | ! prec(il,i)=revap*revap |
---|
| 3107 | ! else |
---|
| 3108 | !JYG---- Correction : si c6 <= 0, water(il,i)=0. |
---|
| 3109 | ! prec(il,i)=0. |
---|
[5117] | 3110 | ! END IF |
---|
[524] | 3111 | |
---|
[2007] | 3112 | !JYG--- Dans tous les cas, evaporation = [tt ce qui entre dans la couche i] |
---|
| 3113 | ! moins [tt ce qui sort de la couche i] |
---|
| 3114 | ! print *, 'evap avec ice' |
---|
| 3115 | evap(il, i) = (wdtrain(il)+sigd(il)*wt(il,i)*(prec(il,i+1)-prec(il,i))) / & |
---|
| 3116 | (sigd(il)*(ph(il,i)-ph(il,i+1))*100.) |
---|
[5099] | 3117 | |
---|
[2393] | 3118 | IF (prt_level >= 20) THEN |
---|
| 3119 | Print*, 'cv3_unsat after evap computation: wdtrain, sigd, wt, prec(i+1),prec(i) ', & |
---|
| 3120 | i, wdtrain(1), sigd(1), wt(1,i), prec(1,i+1),prec(1,i) |
---|
| 3121 | ENDIF |
---|
[524] | 3122 | |
---|
[2490] | 3123 | !jyg< |
---|
| 3124 | d6 = prec(il,i)-prec(il,i+1) |
---|
[524] | 3125 | |
---|
[2490] | 3126 | !! d6 = bfac*wdtrain(il) - 100.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*evap(il, i) |
---|
| 3127 | !! e6 = bfac*wdtrain(il) |
---|
| 3128 | !! f6 = -100.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*evap(il, i) |
---|
| 3129 | !>jyg |
---|
[2287] | 3130 | !CR:tmax_fonte_cv: T for which ice is totally melted (used to be 275.15) |
---|
| 3131 | thaw = (t(il,i)-273.15)/(tmax_fonte_cv-273.15) |
---|
[1992] | 3132 | thaw = min(max(thaw,0.0), 1.0) |
---|
[2490] | 3133 | !jyg< |
---|
[1992] | 3134 | water(il, i) = water(il, i+1) + (1-fraci(il,i))*d6 |
---|
[2490] | 3135 | ice(il, i) = ice(il, i+1) + fraci(il, i)*d6 |
---|
| 3136 | water(il, i) = min(prec(il,i), max(water(il,i), 0.)) |
---|
| 3137 | ice(il, i) = min(prec(il,i), max(ice(il,i), 0.)) |
---|
| 3138 | |
---|
| 3139 | !! water(il, i) = water(il, i+1) + (1-fraci(il,i))*d6 |
---|
| 3140 | !! water(il, i) = max(water(il,i), 0.) |
---|
| 3141 | !! ice(il, i) = ice(il, i+1) + fraci(il, i)*d6 |
---|
| 3142 | !! ice(il, i) = max(ice(il,i), 0.) |
---|
| 3143 | !>jyg |
---|
[1992] | 3144 | fondue(il, i) = ice(il, i)*thaw |
---|
| 3145 | water(il, i) = water(il, i) + fondue(il, i) |
---|
| 3146 | ice(il, i) = ice(il, i) - fondue(il, i) |
---|
[524] | 3147 | |
---|
[1992] | 3148 | IF (water(il,i)+ice(il,i)<1.E-30) THEN |
---|
| 3149 | faci(il, i) = 0. |
---|
| 3150 | ELSE |
---|
| 3151 | faci(il, i) = ice(il, i)/(water(il,i)+ice(il,i)) |
---|
| 3152 | END IF |
---|
[524] | 3153 | |
---|
[2007] | 3154 | ! water(il,i)=water(il,i+1)+(1.-fraci(il,i))*e6+(1.-faci(il,i))*f6 |
---|
| 3155 | ! water(il,i)=max(water(il,i),0.) |
---|
| 3156 | ! ice(il,i)=ice(il,i+1)+fraci(il,i)*e6+faci(il,i)*f6 |
---|
| 3157 | ! ice(il,i)=max(ice(il,i),0.) |
---|
| 3158 | ! fondue(il,i)=ice(il,i)*thaw |
---|
| 3159 | ! water(il,i)=water(il,i)+fondue(il,i) |
---|
| 3160 | ! ice(il,i)=ice(il,i)-fondue(il,i) |
---|
| 3161 | |
---|
[5116] | 3162 | ! if((water(il,i)+ice(il,i)).lt.1.e-30)THEN |
---|
[2007] | 3163 | ! faci(il,i)=0. |
---|
| 3164 | ! else |
---|
| 3165 | ! faci(il,i)=ice(il,i)/(water(il,i)+ice(il,i)) |
---|
| 3166 | ! endif |
---|
[524] | 3167 | |
---|
[1992] | 3168 | ELSE |
---|
| 3169 | b6 = bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac |
---|
[2007] | 3170 | c6 = water(il, i+1) + bfac*wdtrain(il) - & |
---|
| 3171 | 50.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*evap(il, i+1) |
---|
[1992] | 3172 | IF (c6>0.0) THEN |
---|
| 3173 | revap = 0.5*(-b6+sqrt(b6*b6+4.*c6)) |
---|
| 3174 | water(il, i) = revap*revap |
---|
| 3175 | ELSE |
---|
| 3176 | water(il, i) = 0. |
---|
| 3177 | END IF |
---|
[2007] | 3178 | ! print *, 'evap sans ice' |
---|
| 3179 | evap(il, i) = (wdtrain(il)+sigd(il)*wt(il,i)*(water(il,i+1)-water(il,i)))/ & |
---|
| 3180 | (sigd(il)*(ph(il,i)-ph(il,i+1))*100.) |
---|
[524] | 3181 | |
---|
[1992] | 3182 | END IF |
---|
[5117] | 3183 | END IF !(i.le.inb(il) .AND. lwork(il)) |
---|
[1992] | 3184 | END DO |
---|
[2007] | 3185 | ! ---------------------------------------------------------------- |
---|
[524] | 3186 | |
---|
[2007] | 3187 | ! cc |
---|
| 3188 | ! *** calculate precipitating downdraft mass flux under *** |
---|
| 3189 | ! *** hydrostatic approximation *** |
---|
[524] | 3190 | |
---|
[1992] | 3191 | DO il = 1, ncum |
---|
| 3192 | IF (i<=inb(il) .AND. lwork(il) .AND. i/=1) THEN |
---|
[524] | 3193 | |
---|
[1992] | 3194 | tevap(il) = max(0.0, evap(il,i)) |
---|
| 3195 | delth = max(0.001, (th(il,i)-th(il,i-1))) |
---|
| 3196 | IF (cvflag_ice) THEN |
---|
| 3197 | IF (cvflag_grav) THEN |
---|
[2007] | 3198 | mp(il, i) = 100.*ginv*(lvcp(il,i)*sigd(il)*tevap(il)* & |
---|
| 3199 | (p(il,i-1)-p(il,i))/delth + & |
---|
| 3200 | lfcp(il,i)*sigd(il)*faci(il,i)*tevap(il)* & |
---|
| 3201 | (p(il,i-1)-p(il,i))/delth + & |
---|
| 3202 | lfcp(il,i)*sigd(il)*wt(il,i)/100.*fondue(il,i)* & |
---|
| 3203 | (p(il,i-1)-p(il,i))/delth/(ph(il,i)-ph(il,i+1))) |
---|
[1992] | 3204 | ELSE |
---|
[2007] | 3205 | mp(il, i) = 10.*(lvcp(il,i)*sigd(il)*tevap(il)* & |
---|
| 3206 | (p(il,i-1)-p(il,i))/delth + & |
---|
| 3207 | lfcp(il,i)*sigd(il)*faci(il,i)*tevap(il)* & |
---|
| 3208 | (p(il,i-1)-p(il,i))/delth + & |
---|
| 3209 | lfcp(il,i)*sigd(il)*wt(il,i)/100.*fondue(il,i)* & |
---|
| 3210 | (p(il,i-1)-p(il,i))/delth/(ph(il,i)-ph(il,i+1))) |
---|
[524] | 3211 | |
---|
[1992] | 3212 | END IF |
---|
| 3213 | ELSE |
---|
| 3214 | IF (cvflag_grav) THEN |
---|
| 3215 | mp(il, i) = 100.*ginv*lvcp(il, i)*sigd(il)*tevap(il)* & |
---|
[2007] | 3216 | (p(il,i-1)-p(il,i))/delth |
---|
[1992] | 3217 | ELSE |
---|
| 3218 | mp(il, i) = 10.*lvcp(il, i)*sigd(il)*tevap(il)* & |
---|
[2007] | 3219 | (p(il,i-1)-p(il,i))/delth |
---|
[1992] | 3220 | END IF |
---|
[524] | 3221 | |
---|
[1992] | 3222 | END IF |
---|
[879] | 3223 | |
---|
[5117] | 3224 | END IF !(i.le.inb(il) .AND. lwork(il) .AND. i.NE.1) |
---|
[5082] | 3225 | IF (prt_level >= 20) THEN |
---|
[2671] | 3226 | PRINT *,'cv3_unsat, mp hydrostatic ', i, mp(il,i) |
---|
| 3227 | ENDIF |
---|
[1992] | 3228 | END DO |
---|
[2007] | 3229 | ! ---------------------------------------------------------------- |
---|
[524] | 3230 | |
---|
[2007] | 3231 | ! *** if hydrostatic assumption fails, *** |
---|
| 3232 | ! *** solve cubic difference equation for downdraft theta *** |
---|
| 3233 | ! *** and mass flux from two simultaneous differential eqns *** |
---|
[524] | 3234 | |
---|
[1992] | 3235 | DO il = 1, ncum |
---|
| 3236 | IF (i<=inb(il) .AND. lwork(il) .AND. i/=1) THEN |
---|
[1742] | 3237 | |
---|
[1992] | 3238 | amfac = sigd(il)*sigd(il)*70.0*ph(il, i)*(p(il,i-1)-p(il,i))* & |
---|
[2007] | 3239 | (th(il,i)-th(il,i-1))/(tv(il,i)*th(il,i)) |
---|
[1992] | 3240 | amp2 = abs(mp(il,i+1)*mp(il,i+1)-mp(il,i)*mp(il,i)) |
---|
[1742] | 3241 | |
---|
[1992] | 3242 | IF (amp2>(0.1*amfac)) THEN |
---|
| 3243 | xf = 100.0*sigd(il)*sigd(il)*sigd(il)*(ph(il,i)-ph(il,i+1)) |
---|
[2007] | 3244 | tf = b(il, i) - 5.0*(th(il,i)-th(il,i-1))*t(il, i) / & |
---|
| 3245 | (lvcp(il,i)*sigd(il)*th(il,i)) |
---|
[1992] | 3246 | af = xf*tf + mp(il, i+1)*mp(il, i+1)*tinv |
---|
[1742] | 3247 | |
---|
[1992] | 3248 | IF (cvflag_ice) THEN |
---|
| 3249 | bf = 2.*(tinv*mp(il,i+1))**3 + tinv*mp(il, i+1)*xf*tf + & |
---|
[2007] | 3250 | 50.*(p(il,i-1)-p(il,i))*xf*(tevap(il)*(1.+(lf(il,i)/lv(il,i))*faci(il,i)) + & |
---|
| 3251 | (lf(il,i)/lv(il,i))*wt(il,i)/100.*fondue(il,i)/(ph(il,i)-ph(il,i+1))) |
---|
[1992] | 3252 | ELSE |
---|
[1774] | 3253 | |
---|
[1992] | 3254 | bf = 2.*(tinv*mp(il,i+1))**3 + tinv*mp(il, i+1)*xf*tf + & |
---|
[2007] | 3255 | 50.*(p(il,i-1)-p(il,i))*xf*tevap(il) |
---|
[1992] | 3256 | END IF |
---|
[1742] | 3257 | |
---|
[1992] | 3258 | fac2 = 1.0 |
---|
| 3259 | IF (bf<0.0) fac2 = -1.0 |
---|
| 3260 | bf = abs(bf) |
---|
| 3261 | ur = 0.25*bf*bf - af*af*af*tinv*tinv*tinv |
---|
| 3262 | IF (ur>=0.0) THEN |
---|
| 3263 | sru = sqrt(ur) |
---|
| 3264 | fac = 1.0 |
---|
| 3265 | IF ((0.5*bf-sru)<0.0) fac = -1.0 |
---|
| 3266 | mp(il, i) = mp(il, i+1)*tinv + (0.5*bf+sru)**tinv + & |
---|
[2007] | 3267 | fac*(abs(0.5*bf-sru))**tinv |
---|
[1992] | 3268 | ELSE |
---|
| 3269 | d = atan(2.*sqrt(-ur)/(bf+1.0E-28)) |
---|
| 3270 | IF (fac2<0.0) d = 3.14159 - d |
---|
| 3271 | mp(il, i) = mp(il, i+1)*tinv + 2.*sqrt(af*tinv)*cos(d*tinv) |
---|
| 3272 | END IF |
---|
| 3273 | mp(il, i) = max(0.0, mp(il,i)) |
---|
[5082] | 3274 | IF (prt_level >= 20) THEN |
---|
[2671] | 3275 | PRINT *,'cv3_unsat, mp cubic ', i, mp(il,i) |
---|
| 3276 | ENDIF |
---|
[524] | 3277 | |
---|
[1992] | 3278 | IF (cvflag_ice) THEN |
---|
| 3279 | IF (cvflag_grav) THEN |
---|
[2007] | 3280 | !JYG : il y a vraisemblablement une erreur dans la ligne 2 suivante: |
---|
| 3281 | ! il faut diviser par (mp(il,i)*sigd(il)*grav) et non par (mp(il,i)+sigd(il)*0.1). |
---|
| 3282 | ! Et il faut bien revoir les facteurs 100. |
---|
| 3283 | b(il, i-1) = b(il, i) + 100.0*(p(il,i-1)-p(il,i))* & |
---|
| 3284 | (tevap(il)*(1.+(lf(il,i)/lv(il,i))*faci(il,i)) + & |
---|
| 3285 | (lf(il,i)/lv(il,i))*wt(il,i)/100.*fondue(il,i) / & |
---|
| 3286 | (ph(il,i)-ph(il,i+1))) / & |
---|
| 3287 | (mp(il,i)+sigd(il)*0.1) - & |
---|
| 3288 | 10.0*(th(il,i)-th(il,i-1))*t(il, i) / & |
---|
| 3289 | (lvcp(il,i)*sigd(il)*th(il,i)) |
---|
[1992] | 3290 | ELSE |
---|
[2007] | 3291 | b(il, i-1) = b(il, i) + 100.0*(p(il,i-1)-p(il,i))*& |
---|
| 3292 | (tevap(il)*(1.+(lf(il,i)/lv(il,i))*faci(il,i)) + & |
---|
| 3293 | (lf(il,i)/lv(il,i))*wt(il,i)/100.*fondue(il,i) / & |
---|
| 3294 | (ph(il,i)-ph(il,i+1))) / & |
---|
| 3295 | (mp(il,i)+sigd(il)*0.1) - & |
---|
| 3296 | 10.0*(th(il,i)-th(il,i-1))*t(il, i) / & |
---|
| 3297 | (lvcp(il,i)*sigd(il)*th(il,i)) |
---|
[1992] | 3298 | END IF |
---|
| 3299 | ELSE |
---|
| 3300 | IF (cvflag_grav) THEN |
---|
[2007] | 3301 | b(il, i-1) = b(il, i) + 100.0*(p(il,i-1)-p(il,i))*tevap(il) / & |
---|
| 3302 | (mp(il,i)+sigd(il)*0.1) - & |
---|
| 3303 | 10.0*(th(il,i)-th(il,i-1))*t(il, i) / & |
---|
| 3304 | (lvcp(il,i)*sigd(il)*th(il,i)) |
---|
[1992] | 3305 | ELSE |
---|
[2007] | 3306 | b(il, i-1) = b(il, i) + 100.0*(p(il,i-1)-p(il,i))*tevap(il) / & |
---|
| 3307 | (mp(il,i)+sigd(il)*0.1) - & |
---|
| 3308 | 10.0*(th(il,i)-th(il,i-1))*t(il, i) / & |
---|
| 3309 | (lvcp(il,i)*sigd(il)*th(il,i)) |
---|
[1992] | 3310 | END IF |
---|
| 3311 | END IF |
---|
| 3312 | b(il, i-1) = max(b(il,i-1), 0.0) |
---|
[524] | 3313 | |
---|
[1992] | 3314 | END IF !(amp2.gt.(0.1*amfac)) |
---|
[524] | 3315 | |
---|
[2759] | 3316 | !jyg< This part shifted 10 lines farther |
---|
| 3317 | !!! *** limit magnitude of mp(i) to meet cfl condition *** |
---|
| 3318 | !! |
---|
| 3319 | !! ampmax = 2.0*(ph(il,i)-ph(il,i+1))*delti |
---|
| 3320 | !! amp2 = 2.0*(ph(il,i-1)-ph(il,i))*delti |
---|
| 3321 | !! ampmax = min(ampmax, amp2) |
---|
| 3322 | !! mp(il, i) = min(mp(il,i), ampmax) |
---|
| 3323 | !>jyg |
---|
[524] | 3324 | |
---|
[2007] | 3325 | ! *** force mp to decrease linearly to zero *** |
---|
| 3326 | ! *** between cloud base and the surface *** |
---|
[524] | 3327 | |
---|
| 3328 | |
---|
[5116] | 3329 | ! c IF(p(il,i).gt.p(il,icb(il)))THEN |
---|
[2007] | 3330 | ! c mp(il,i)=mp(il,icb(il))*(p(il,1)-p(il,i))/(p(il,1)-p(il,icb(il))) |
---|
| 3331 | ! c endif |
---|
[1992] | 3332 | IF (ph(il,i)>0.9*plcl(il)) THEN |
---|
| 3333 | mp(il, i) = mp(il, i)*(ph(il,1)-ph(il,i))/(ph(il,1)-0.9*plcl(il)) |
---|
| 3334 | END IF |
---|
[524] | 3335 | |
---|
[2759] | 3336 | !jyg< Shifted part |
---|
| 3337 | ! *** limit magnitude of mp(i) to meet cfl condition *** |
---|
| 3338 | |
---|
| 3339 | ampmax = 2.0*(ph(il,i)-ph(il,i+1))*delti |
---|
| 3340 | amp2 = 2.0*(ph(il,i-1)-ph(il,i))*delti |
---|
| 3341 | ampmax = min(ampmax, amp2) |
---|
| 3342 | mp(il, i) = min(mp(il,i), ampmax) |
---|
| 3343 | !>jyg |
---|
| 3344 | |
---|
[5117] | 3345 | END IF ! (i.le.inb(il) .AND. lwork(il) .AND. i.NE.1) |
---|
[1992] | 3346 | END DO |
---|
[2007] | 3347 | ! ---------------------------------------------------------------- |
---|
[5099] | 3348 | |
---|
[2393] | 3349 | IF (prt_level >= 20) THEN |
---|
| 3350 | Print*, 'cv3_unsat after mp computation: mp, b(i), b(i-1) ', & |
---|
| 3351 | i, mp(1, i), b(1,i), b(1,max(i-1,1)) |
---|
| 3352 | ENDIF |
---|
[524] | 3353 | |
---|
[2007] | 3354 | ! *** find mixing ratio of precipitating downdraft *** |
---|
[524] | 3355 | |
---|
[1992] | 3356 | DO il = 1, ncum |
---|
| 3357 | IF (i<inb(il) .AND. lwork(il)) THEN |
---|
| 3358 | mplus(il) = mp(il, i) > mp(il, i+1) |
---|
[5117] | 3359 | END IF ! (i.lt.inb(il) .AND. lwork(il)) |
---|
[1992] | 3360 | END DO |
---|
| 3361 | |
---|
| 3362 | DO il = 1, ncum |
---|
| 3363 | IF (i<inb(il) .AND. lwork(il)) THEN |
---|
| 3364 | |
---|
| 3365 | rp(il, i) = rr(il, i) |
---|
| 3366 | |
---|
| 3367 | IF (mplus(il)) THEN |
---|
| 3368 | |
---|
| 3369 | IF (cvflag_grav) THEN |
---|
[2007] | 3370 | rp(il, i) = rp(il, i+1)*mp(il, i+1) + rr(il, i)*(mp(il,i)-mp(il,i+1)) + & |
---|
| 3371 | 100.*ginv*0.5*sigd(il)*(ph(il,i)-ph(il,i+1))*(evap(il,i+1)+evap(il,i)) |
---|
[1992] | 3372 | ELSE |
---|
[2007] | 3373 | rp(il, i) = rp(il, i+1)*mp(il, i+1) + rr(il, i)*(mp(il,i)-mp(il,i+1)) + & |
---|
| 3374 | 5.*sigd(il)*(ph(il,i)-ph(il,i+1))*(evap(il,i+1)+evap(il,i)) |
---|
[1992] | 3375 | END IF |
---|
| 3376 | rp(il, i) = rp(il, i)/mp(il, i) |
---|
[2007] | 3377 | up(il, i) = up(il, i+1)*mp(il, i+1) + u(il, i)*(mp(il,i)-mp(il,i+1)) |
---|
[1992] | 3378 | up(il, i) = up(il, i)/mp(il, i) |
---|
[2007] | 3379 | vp(il, i) = vp(il, i+1)*mp(il, i+1) + v(il, i)*(mp(il,i)-mp(il,i+1)) |
---|
[1992] | 3380 | vp(il, i) = vp(il, i)/mp(il, i) |
---|
| 3381 | |
---|
| 3382 | ELSE ! if (mplus(il)) |
---|
| 3383 | |
---|
| 3384 | IF (mp(il,i+1)>1.0E-16) THEN |
---|
| 3385 | IF (cvflag_grav) THEN |
---|
[2007] | 3386 | rp(il, i) = rp(il,i+1) + 100.*ginv*0.5*sigd(il)*(ph(il,i)-ph(il,i+1)) * & |
---|
| 3387 | (evap(il,i+1)+evap(il,i))/mp(il,i+1) |
---|
[1992] | 3388 | ELSE |
---|
[2007] | 3389 | rp(il, i) = rp(il,i+1) + 5.*sigd(il)*(ph(il,i)-ph(il,i+1)) * & |
---|
| 3390 | (evap(il,i+1)+evap(il,i))/mp(il, i+1) |
---|
[1992] | 3391 | END IF |
---|
| 3392 | up(il, i) = up(il, i+1) |
---|
| 3393 | vp(il, i) = vp(il, i+1) |
---|
| 3394 | END IF ! (mp(il,i+1).gt.1.0e-16) |
---|
[5117] | 3395 | END IF ! (mplus(il)) ELSE IF (.NOT.mplus(il)) |
---|
[1992] | 3396 | |
---|
| 3397 | rp(il, i) = amin1(rp(il,i), rs(il,i)) |
---|
| 3398 | rp(il, i) = max(rp(il,i), 0.0) |
---|
| 3399 | |
---|
[5117] | 3400 | END IF ! (i.lt.inb(il) .AND. lwork(il)) |
---|
[1992] | 3401 | END DO |
---|
[2007] | 3402 | ! ---------------------------------------------------------------- |
---|
[1992] | 3403 | |
---|
[2007] | 3404 | ! *** find tracer concentrations in precipitating downdraft *** |
---|
[1992] | 3405 | |
---|
[2007] | 3406 | !AC! do j=1,ntra |
---|
| 3407 | !AC! do il = 1,ncum |
---|
[5117] | 3408 | !AC! if (i.lt.inb(il) .AND. lwork(il)) THEN |
---|
[2007] | 3409 | !AC!c |
---|
[5116] | 3410 | !AC! IF(mplus(il))THEN |
---|
[2007] | 3411 | !AC! trap(il,i,j)=trap(il,i+1,j)*mp(il,i+1) |
---|
| 3412 | !AC! : +trap(il,i,j)*(mp(il,i)-mp(il,i+1)) |
---|
| 3413 | !AC! trap(il,i,j)=trap(il,i,j)/mp(il,i) |
---|
| 3414 | !AC! else ! if (mplus(il)) |
---|
[5116] | 3415 | !AC! IF(mp(il,i+1).gt.1.0e-16)THEN |
---|
[2007] | 3416 | !AC! trap(il,i,j)=trap(il,i+1,j) |
---|
| 3417 | !AC! endif |
---|
[5117] | 3418 | !AC! endif ! (mplus(il)) ELSE IF (.NOT.mplus(il)) |
---|
[2007] | 3419 | !AC!c |
---|
[5117] | 3420 | !AC! endif ! (i.lt.inb(il) .AND. lwork(il)) |
---|
[2007] | 3421 | !AC! enddo |
---|
[5086] | 3422 | !AC! END DO |
---|
[1992] | 3423 | |
---|
| 3424 | 400 END DO |
---|
[2007] | 3425 | ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
[1992] | 3426 | |
---|
[2007] | 3427 | ! *** end of downdraft loop *** |
---|
[1992] | 3428 | |
---|
[2007] | 3429 | ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
[1992] | 3430 | |
---|
| 3431 | |
---|
[3502] | 3432 | |
---|
[5105] | 3433 | |
---|
[1992] | 3434 | END SUBROUTINE cv3_unsat |
---|
| 3435 | |
---|
[2007] | 3436 | SUBROUTINE cv3_yield(nloc, ncum, nd, na, ntra, ok_conserv_q, & |
---|
| 3437 | icb, inb, delt, & |
---|
| 3438 | t, rr, t_wake, rr_wake, s_wake, u, v, tra, & |
---|
| 3439 | gz, p, ph, h, hp, lv, lf, cpn, th, th_wake, & |
---|
[3496] | 3440 | ep, clw, qpreca, m, tp, mp, rp, up, vp, trap, & |
---|
[2007] | 3441 | wt, water, ice, evap, fondue, faci, b, sigd, & |
---|
| 3442 | ment, qent, hent, iflag_mix, uent, vent, & |
---|
| 3443 | nent, elij, traent, sig, & |
---|
| 3444 | tv, tvp, wghti, & |
---|
[2306] | 3445 | iflag, precip, Vprecip, Vprecipi, & ! jyg: Vprecipi |
---|
[4613] | 3446 | ft, fr, fr_comp, fu, fv, ftra, & ! jyg |
---|
[2007] | 3447 | cbmf, upwd, dnwd, dnwd0, ma, mip, & |
---|
[2259] | 3448 | !! tls, tps, ! useless . jyg |
---|
| 3449 | qcondc, wd, & |
---|
[4613] | 3450 | ftd, fqd, qta, qtc, sigt, detrain, tau_cld_cv, coefw_cld_cv) |
---|
[1992] | 3451 | |
---|
[5112] | 3452 | USE lmdz_print_control, ONLY: lunout, prt_level |
---|
[5101] | 3453 | USE add_phys_tend_mod, ONLY: fl_cor_ebil |
---|
[2901] | 3454 | |
---|
[1992] | 3455 | IMPLICIT NONE |
---|
| 3456 | |
---|
| 3457 | include "cvthermo.h" |
---|
| 3458 | include "cv3param.h" |
---|
| 3459 | include "cvflag.h" |
---|
| 3460 | include "conema3.h" |
---|
| 3461 | |
---|
[2007] | 3462 | !inputs: |
---|
[2327] | 3463 | INTEGER, INTENT (IN) :: iflag_mix |
---|
| 3464 | INTEGER, INTENT (IN) :: ncum, nd, na, ntra, nloc |
---|
| 3465 | LOGICAL, INTENT (IN) :: ok_conserv_q |
---|
| 3466 | INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, inb |
---|
| 3467 | REAL, INTENT (IN) :: delt |
---|
| 3468 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, rr, u, v |
---|
| 3469 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: t_wake, rr_wake |
---|
| 3470 | REAL, DIMENSION (nloc), INTENT (IN) :: s_wake |
---|
| 3471 | REAL, DIMENSION (nloc, nd, ntra), INTENT (IN) :: tra |
---|
| 3472 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: p |
---|
| 3473 | REAL, DIMENSION (nloc, nd+1), INTENT (IN) :: ph |
---|
| 3474 | REAL, DIMENSION (nloc, na), INTENT (IN) :: gz, h, hp |
---|
| 3475 | REAL, DIMENSION (nloc, na), INTENT (IN) :: th, tp |
---|
| 3476 | REAL, DIMENSION (nloc, na), INTENT (IN) :: lv, cpn, ep, clw |
---|
| 3477 | REAL, DIMENSION (nloc, na), INTENT (IN) :: lf |
---|
| 3478 | REAL, DIMENSION (nloc, na), INTENT (IN) :: rp, up |
---|
| 3479 | REAL, DIMENSION (nloc, na), INTENT (IN) :: vp |
---|
| 3480 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: wt |
---|
| 3481 | REAL, DIMENSION (nloc, nd, ntra), INTENT (IN) :: trap |
---|
| 3482 | REAL, DIMENSION (nloc, na), INTENT (IN) :: water, evap, b |
---|
| 3483 | REAL, DIMENSION (nloc, na), INTENT (IN) :: fondue, faci, ice |
---|
| 3484 | REAL, DIMENSION (nloc, na, na), INTENT (IN) :: qent, uent |
---|
| 3485 | REAL, DIMENSION (nloc, na, na), INTENT (IN) :: hent |
---|
| 3486 | REAL, DIMENSION (nloc, na, na), INTENT (IN) :: vent, elij |
---|
| 3487 | INTEGER, DIMENSION (nloc, nd), INTENT (IN) :: nent |
---|
| 3488 | REAL, DIMENSION (nloc, na, na, ntra), INTENT (IN) :: traent |
---|
| 3489 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: tv, tvp, wghti |
---|
[3496] | 3490 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: qta |
---|
| 3491 | REAL, DIMENSION (nloc, na),INTENT(IN) :: qpreca |
---|
| 3492 | REAL, INTENT(IN) :: tau_cld_cv, coefw_cld_cv |
---|
[5099] | 3493 | |
---|
[2007] | 3494 | !input/output: |
---|
[2327] | 3495 | REAL, DIMENSION (nloc, na), INTENT (INOUT) :: m, mp |
---|
| 3496 | REAL, DIMENSION (nloc, na, na), INTENT (INOUT) :: ment |
---|
| 3497 | INTEGER, DIMENSION (nloc), INTENT (INOUT) :: iflag |
---|
| 3498 | REAL, DIMENSION (nloc, nd), INTENT (INOUT) :: sig |
---|
| 3499 | REAL, DIMENSION (nloc), INTENT (INOUT) :: sigd |
---|
[5099] | 3500 | |
---|
[2007] | 3501 | !outputs: |
---|
[2327] | 3502 | REAL, DIMENSION (nloc), INTENT (OUT) :: precip |
---|
[4613] | 3503 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: ft, fr, fu, fv , fr_comp |
---|
[2327] | 3504 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: ftd, fqd |
---|
| 3505 | REAL, DIMENSION (nloc, nd, ntra), INTENT (OUT) :: ftra |
---|
| 3506 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: upwd, dnwd, ma |
---|
| 3507 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: dnwd0, mip |
---|
| 3508 | REAL, DIMENSION (nloc, nd+1), INTENT (OUT) :: Vprecip |
---|
| 3509 | REAL, DIMENSION (nloc, nd+1), INTENT (OUT) :: Vprecipi |
---|
| 3510 | !! REAL tls(nloc, nd), tps(nloc, nd) ! useless . jyg |
---|
| 3511 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: qcondc ! cld |
---|
| 3512 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: qtc, sigt ! cld |
---|
[4613] | 3513 | REAL, DIMENSION (nloc, nd), INTENT (OUT) :: detrain ! Louis : pour le calcul de Klein du terme de variance qui détraine dans lenvironnement |
---|
[2327] | 3514 | REAL, DIMENSION (nloc), INTENT (OUT) :: wd ! gust |
---|
| 3515 | REAL, DIMENSION (nloc), INTENT (OUT) :: cbmf |
---|
[5099] | 3516 | |
---|
[2007] | 3517 | !local variables: |
---|
[2508] | 3518 | INTEGER :: i, k, il, n, j, num1 |
---|
| 3519 | REAL :: rat, delti |
---|
| 3520 | REAL :: ax, bx, cx, dx, ex |
---|
| 3521 | REAL :: cpinv, rdcp, dpinv |
---|
[3496] | 3522 | REAL :: sigaq |
---|
[2508] | 3523 | REAL, DIMENSION (nloc) :: awat |
---|
| 3524 | REAL, DIMENSION (nloc, nd) :: lvcp, lfcp ! , mke ! unused . jyg |
---|
| 3525 | REAL, DIMENSION (nloc) :: am, work, ad, amp1 |
---|
[2007] | 3526 | !! real up1(nloc), dn1(nloc) |
---|
[2508] | 3527 | REAL, DIMENSION (nloc, nd, nd) :: up1, dn1 |
---|
| 3528 | !jyg< |
---|
| 3529 | REAL, DIMENSION (nloc, nd) :: up_to, up_from |
---|
| 3530 | REAL, DIMENSION (nloc, nd) :: dn_to, dn_from |
---|
| 3531 | !>jyg |
---|
| 3532 | REAL, DIMENSION (nloc) :: asum, bsum, csum, dsum |
---|
| 3533 | REAL, DIMENSION (nloc) :: esum, fsum, gsum, hsum |
---|
| 3534 | REAL, DIMENSION (nloc, nd) :: th_wake |
---|
| 3535 | REAL, DIMENSION (nloc) :: alpha_qpos, alpha_qpos1 |
---|
| 3536 | REAL, DIMENSION (nloc, nd) :: qcond, nqcond, wa ! cld |
---|
| 3537 | REAL, DIMENSION (nloc, nd) :: siga, sax, mac ! cld |
---|
| 3538 | REAL, DIMENSION (nloc) :: sument |
---|
| 3539 | REAL, DIMENSION (nloc, nd) :: sigment, qtment ! cld |
---|
[4613] | 3540 | REAL, DIMENSION (nloc, nd, nd) :: qdet |
---|
[2007] | 3541 | REAL sumdq !jyg |
---|
[5099] | 3542 | |
---|
[2007] | 3543 | ! ------------------------------------------------------------- |
---|
[1992] | 3544 | |
---|
[2007] | 3545 | ! initialization: |
---|
[1992] | 3546 | |
---|
| 3547 | delti = 1.0/delt |
---|
[5103] | 3548 | ! PRINT*,'cv3_yield initialisation delt', delt |
---|
[2393] | 3549 | |
---|
[1992] | 3550 | DO il = 1, ncum |
---|
| 3551 | precip(il) = 0.0 |
---|
| 3552 | wd(il) = 0.0 ! gust |
---|
| 3553 | END DO |
---|
| 3554 | |
---|
[2393] | 3555 | ! Fluxes are on a staggered grid : loops extend up to nl+1 |
---|
| 3556 | DO i = 1, nlp |
---|
[1992] | 3557 | DO il = 1, ncum |
---|
[2007] | 3558 | Vprecip(il, i) = 0.0 |
---|
[2306] | 3559 | Vprecipi(il, i) = 0.0 ! jyg |
---|
[2393] | 3560 | upwd(il, i) = 0.0 |
---|
| 3561 | dnwd(il, i) = 0.0 |
---|
| 3562 | dnwd0(il, i) = 0.0 |
---|
| 3563 | mip(il, i) = 0.0 |
---|
| 3564 | END DO |
---|
| 3565 | END DO |
---|
| 3566 | DO i = 1, nl |
---|
| 3567 | DO il = 1, ncum |
---|
[1992] | 3568 | ft(il, i) = 0.0 |
---|
| 3569 | fr(il, i) = 0.0 |
---|
[4613] | 3570 | fr_comp(il,i) = 0.0 |
---|
[1992] | 3571 | fu(il, i) = 0.0 |
---|
| 3572 | fv(il, i) = 0.0 |
---|
| 3573 | ftd(il, i) = 0.0 |
---|
| 3574 | fqd(il, i) = 0.0 |
---|
| 3575 | qcondc(il, i) = 0.0 ! cld |
---|
| 3576 | qcond(il, i) = 0.0 ! cld |
---|
[2205] | 3577 | qtc(il, i) = 0.0 ! cld |
---|
| 3578 | qtment(il, i) = 0.0 ! cld |
---|
| 3579 | sigment(il, i) = 0.0 ! cld |
---|
| 3580 | sigt(il, i) = 0.0 ! cld |
---|
[4613] | 3581 | qdet(il,i,:) = 0.0 ! cld |
---|
| 3582 | detrain(il, i) = 0.0 ! cld |
---|
[1992] | 3583 | nqcond(il, i) = 0.0 ! cld |
---|
| 3584 | END DO |
---|
| 3585 | END DO |
---|
[5103] | 3586 | ! PRINT*,'cv3_yield initialisation 2' |
---|
[2007] | 3587 | !AC! do j=1,ntra |
---|
| 3588 | !AC! do i=1,nd |
---|
| 3589 | !AC! do il=1,ncum |
---|
| 3590 | !AC! ftra(il,i,j)=0.0 |
---|
| 3591 | !AC! enddo |
---|
| 3592 | !AC! enddo |
---|
| 3593 | !AC! enddo |
---|
[5103] | 3594 | ! PRINT*,'cv3_yield initialisation 3' |
---|
[1992] | 3595 | DO i = 1, nl |
---|
| 3596 | DO il = 1, ncum |
---|
| 3597 | lvcp(il, i) = lv(il, i)/cpn(il, i) |
---|
| 3598 | lfcp(il, i) = lf(il, i)/cpn(il, i) |
---|
| 3599 | END DO |
---|
| 3600 | END DO |
---|
| 3601 | |
---|
| 3602 | |
---|
| 3603 | |
---|
[2007] | 3604 | ! *** calculate surface precipitation in mm/day *** |
---|
[1992] | 3605 | |
---|
| 3606 | DO il = 1, ncum |
---|
| 3607 | IF (ep(il,inb(il))>=0.0001 .AND. iflag(il)<=1) THEN |
---|
| 3608 | IF (cvflag_ice) THEN |
---|
[2007] | 3609 | precip(il) = wt(il, 1)*sigd(il)*(water(il,1)+ice(il,1)) & |
---|
| 3610 | *86400.*1000./(rowl*grav) |
---|
[1992] | 3611 | ELSE |
---|
[2007] | 3612 | precip(il) = wt(il, 1)*sigd(il)*water(il, 1) & |
---|
| 3613 | *86400.*1000./(rowl*grav) |
---|
[1992] | 3614 | END IF |
---|
| 3615 | END IF |
---|
| 3616 | END DO |
---|
[5103] | 3617 | ! PRINT*,'cv3_yield apres calcul precip' |
---|
[1992] | 3618 | |
---|
| 3619 | |
---|
[2007] | 3620 | ! === calculate vertical profile of precipitation in kg/m2/s === |
---|
[1992] | 3621 | |
---|
| 3622 | DO i = 1, nl |
---|
| 3623 | DO il = 1, ncum |
---|
| 3624 | IF (ep(il,inb(il))>=0.0001 .AND. i<=inb(il) .AND. iflag(il)<=1) THEN |
---|
| 3625 | IF (cvflag_ice) THEN |
---|
[2007] | 3626 | Vprecip(il, i) = wt(il, i)*sigd(il)*(water(il,i)+ice(il,i))/grav |
---|
[2306] | 3627 | Vprecipi(il, i) = wt(il, i)*sigd(il)*ice(il,i)/grav ! jyg |
---|
[1992] | 3628 | ELSE |
---|
[2007] | 3629 | Vprecip(il, i) = wt(il, i)*sigd(il)*water(il, i)/grav |
---|
[2306] | 3630 | Vprecipi(il, i) = 0. ! jyg |
---|
[1992] | 3631 | END IF |
---|
| 3632 | END IF |
---|
| 3633 | END DO |
---|
| 3634 | END DO |
---|
| 3635 | |
---|
| 3636 | |
---|
[2007] | 3637 | ! *** Calculate downdraft velocity scale *** |
---|
| 3638 | ! *** NE PAS UTILISER POUR L'INSTANT *** |
---|
[1992] | 3639 | |
---|
[2007] | 3640 | !! do il=1,ncum |
---|
| 3641 | !! wd(il)=betad*abs(mp(il,icb(il)))*0.01*rrd*t(il,icb(il)) & |
---|
| 3642 | !! /(sigd(il)*p(il,icb(il))) |
---|
| 3643 | !! enddo |
---|
[1992] | 3644 | |
---|
| 3645 | |
---|
[2007] | 3646 | ! *** calculate tendencies of lowest level potential temperature *** |
---|
| 3647 | ! *** and mixing ratio *** |
---|
[1992] | 3648 | |
---|
| 3649 | DO il = 1, ncum |
---|
| 3650 | work(il) = 1.0/(ph(il,1)-ph(il,2)) |
---|
| 3651 | cbmf(il) = 0.0 |
---|
| 3652 | END DO |
---|
| 3653 | |
---|
[3496] | 3654 | ! - Adiabatic ascent mass flux "ma" and cloud base mass flux "cbmf" |
---|
| 3655 | !----------------------------------------------------------------- |
---|
| 3656 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3657 | IF (adiab_ascent_mass_flux_depends_on_ejectliq) THEN |
---|
| 3658 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3659 | !!! Warning : this option leads to water conservation violation |
---|
| 3660 | !!! Expert only |
---|
| 3661 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3662 | DO il = 1, ncum |
---|
| 3663 | ma(il, nlp) = 0. |
---|
| 3664 | ma(il, 1) = 0. |
---|
| 3665 | END DO |
---|
| 3666 | DO k = nl, 2, -1 |
---|
| 3667 | DO il = 1, ncum |
---|
| 3668 | ma(il, k) = ma(il, k+1)*(1.-qta(il, k))/(1.-qta(il, k-1)) + m(il, k) |
---|
| 3669 | cbmf(il) = max(cbmf(il), ma(il,k)) |
---|
| 3670 | END DO |
---|
| 3671 | END DO |
---|
| 3672 | DO k = 2,nl |
---|
| 3673 | DO il = 1, ncum |
---|
| 3674 | IF (k <icb(il)) THEN |
---|
| 3675 | ma(il, k) = ma(il, k-1) + wghti(il,k-1)*cbmf(il) |
---|
| 3676 | ENDIF |
---|
| 3677 | END DO |
---|
| 3678 | END DO |
---|
| 3679 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3680 | ELSE ! (adiab_ascent_mass_flux_depends_on_ejectliq) |
---|
| 3681 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3682 | !! Line kept for compatibility with earlier versions |
---|
[1992] | 3683 | DO k = 2, nl |
---|
| 3684 | DO il = 1, ncum |
---|
| 3685 | IF (k>=icb(il)) THEN |
---|
| 3686 | cbmf(il) = cbmf(il) + m(il, k) |
---|
| 3687 | END IF |
---|
| 3688 | END DO |
---|
| 3689 | END DO |
---|
| 3690 | |
---|
[3496] | 3691 | DO il = 1, ncum |
---|
| 3692 | ma(il, nlp) = 0. |
---|
| 3693 | ma(il, 1) = 0. |
---|
| 3694 | END DO |
---|
| 3695 | DO k = nl, 2, -1 |
---|
| 3696 | DO il = 1, ncum |
---|
| 3697 | ma(il, k) = ma(il, k+1) + m(il, k) |
---|
| 3698 | END DO |
---|
| 3699 | END DO |
---|
| 3700 | DO k = 2,nl |
---|
| 3701 | DO il = 1, ncum |
---|
| 3702 | IF (k <icb(il)) THEN |
---|
| 3703 | ma(il, k) = ma(il, k-1) + wghti(il,k-1)*cbmf(il) |
---|
| 3704 | ENDIF |
---|
| 3705 | END DO |
---|
| 3706 | END DO |
---|
| 3707 | |
---|
| 3708 | ENDIF ! (adiab_ascent_mass_flux_depends_on_ejectliq) ELSE |
---|
| 3709 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[5099] | 3710 | |
---|
[5103] | 3711 | ! PRINT*,'cv3_yield avant ft' |
---|
[2007] | 3712 | ! am is the part of cbmf taken from the first level |
---|
[1992] | 3713 | DO il = 1, ncum |
---|
| 3714 | am(il) = cbmf(il)*wghti(il, 1) |
---|
| 3715 | END DO |
---|
| 3716 | |
---|
| 3717 | DO il = 1, ncum |
---|
| 3718 | IF (iflag(il)<=1) THEN |
---|
[2007] | 3719 | ! convect3 if((0.1*dpinv*am).ge.delti)iflag(il)=4 |
---|
| 3720 | !JYG Correction pour conserver l'eau |
---|
| 3721 | ! cc ft(il,1)=-0.5*lvcp(il,1)*sigd(il)*(evap(il,1)+evap(il,2)) !precip |
---|
[1992] | 3722 | IF (cvflag_ice) THEN |
---|
| 3723 | ft(il, 1) = -lvcp(il, 1)*sigd(il)*evap(il, 1) - & |
---|
[2007] | 3724 | lfcp(il, 1)*sigd(il)*evap(il, 1)*faci(il, 1) - & |
---|
| 3725 | lfcp(il, 1)*sigd(il)*(fondue(il,1)*wt(il,1)) / & |
---|
| 3726 | (100.*(ph(il,1)-ph(il,2))) !precip |
---|
[1992] | 3727 | ELSE |
---|
| 3728 | ft(il, 1) = -lvcp(il, 1)*sigd(il)*evap(il, 1) |
---|
| 3729 | END IF |
---|
| 3730 | |
---|
[2007] | 3731 | ft(il, 1) = ft(il, 1) - 0.009*grav*sigd(il)*mp(il, 2)*t_wake(il, 1)*b(il, 1)*work(il) |
---|
[1992] | 3732 | |
---|
| 3733 | IF (cvflag_ice) THEN |
---|
[2007] | 3734 | ft(il, 1) = ft(il, 1) + 0.01*sigd(il)*wt(il, 1)*(cl-cpd)*water(il, 2) * & |
---|
| 3735 | (t_wake(il,2)-t_wake(il,1))*work(il)/cpn(il, 1) + & |
---|
| 3736 | 0.01*sigd(il)*wt(il, 1)*(ci-cpd)*ice(il, 2) * & |
---|
| 3737 | (t_wake(il,2)-t_wake(il,1))*work(il)/cpn(il, 1) |
---|
[1992] | 3738 | ELSE |
---|
[2007] | 3739 | ft(il, 1) = ft(il, 1) + 0.01*sigd(il)*wt(il, 1)*(cl-cpd)*water(il, 2) * & |
---|
| 3740 | (t_wake(il,2)-t_wake(il,1))*work(il)/cpn(il, 1) |
---|
[1992] | 3741 | END IF |
---|
| 3742 | |
---|
[2007] | 3743 | ftd(il, 1) = ft(il, 1) ! fin precip |
---|
[1992] | 3744 | |
---|
[2007] | 3745 | IF ((0.01*grav*work(il)*am(il))>=delti) iflag(il) = 1 !consist vect |
---|
[2908] | 3746 | !jyg< |
---|
| 3747 | IF (fl_cor_ebil >= 2) THEN |
---|
| 3748 | ft(il, 1) = ft(il, 1) + 0.01*grav*work(il)*am(il) * & |
---|
| 3749 | ((t(il,2)-t(il,1))*cpn(il,2)+gz(il,2)-gz(il,1))/cpn(il,1) |
---|
| 3750 | ELSE |
---|
| 3751 | ft(il, 1) = ft(il, 1) + 0.01*grav*work(il)*am(il) * & |
---|
| 3752 | (t(il,2)-t(il,1)+(gz(il,2)-gz(il,1))/cpn(il,1)) |
---|
| 3753 | ENDIF |
---|
| 3754 | !>jyg |
---|
[1992] | 3755 | END IF ! iflag |
---|
| 3756 | END DO |
---|
| 3757 | |
---|
| 3758 | |
---|
| 3759 | DO j = 2, nl |
---|
| 3760 | IF (iflag_mix>0) THEN |
---|
| 3761 | DO il = 1, ncum |
---|
[2007] | 3762 | ! FH WARNING a modifier : |
---|
[1992] | 3763 | cpinv = 0. |
---|
[2007] | 3764 | ! cpinv=1.0/cpn(il,1) |
---|
[1992] | 3765 | IF (j<=inb(il) .AND. iflag(il)<=1) THEN |
---|
[2007] | 3766 | ft(il, 1) = ft(il, 1) + 0.01*grav*work(il)*ment(il, j, 1) * & |
---|
| 3767 | (hent(il,j,1)-h(il,1)+t(il,1)*(cpv-cpd)*(rr(il,1)-qent(il,j,1)))*cpinv |
---|
[1992] | 3768 | END IF ! j |
---|
| 3769 | END DO |
---|
| 3770 | END IF |
---|
| 3771 | END DO |
---|
[2007] | 3772 | ! fin sature |
---|
[1992] | 3773 | |
---|
| 3774 | |
---|
| 3775 | DO il = 1, ncum |
---|
| 3776 | IF (iflag(il)<=1) THEN |
---|
[2007] | 3777 | !JYG1 Correction pour mieux conserver l'eau (conformite avec CONVECT4.3) |
---|
| 3778 | fr(il, 1) = 0.01*grav*mp(il, 2)*(rp(il,2)-rr_wake(il,1))*work(il) + & |
---|
| 3779 | sigd(il)*evap(il, 1) |
---|
| 3780 | !!! sigd(il)*0.5*(evap(il,1)+evap(il,2)) |
---|
[1992] | 3781 | |
---|
[2007] | 3782 | fqd(il, 1) = fr(il, 1) !precip |
---|
[1992] | 3783 | |
---|
[2007] | 3784 | fr(il, 1) = fr(il, 1) + 0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il) !sature |
---|
[1992] | 3785 | |
---|
[2007] | 3786 | fu(il, 1) = fu(il, 1) + 0.01*grav*work(il)*(mp(il,2)*(up(il,2)-u(il,1)) + & |
---|
| 3787 | am(il)*(u(il,2)-u(il,1))) |
---|
| 3788 | fv(il, 1) = fv(il, 1) + 0.01*grav*work(il)*(mp(il,2)*(vp(il,2)-v(il,1)) + & |
---|
| 3789 | am(il)*(v(il,2)-v(il,1))) |
---|
[1992] | 3790 | END IF ! iflag |
---|
| 3791 | END DO ! il |
---|
| 3792 | |
---|
| 3793 | |
---|
[2007] | 3794 | !AC! do j=1,ntra |
---|
| 3795 | !AC! do il=1,ncum |
---|
[5116] | 3796 | !AC! if (iflag(il) .le. 1) THEN |
---|
| 3797 | !AC! if (cvflag_grav) THEN |
---|
[2007] | 3798 | !AC! ftra(il,1,j)=ftra(il,1,j)+0.01*grav*work(il) |
---|
| 3799 | !AC! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) |
---|
| 3800 | !AC! : +am(il)*(tra(il,2,j)-tra(il,1,j))) |
---|
| 3801 | !AC! else |
---|
| 3802 | !AC! ftra(il,1,j)=ftra(il,1,j)+0.1*work(il) |
---|
| 3803 | !AC! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) |
---|
| 3804 | !AC! : +am(il)*(tra(il,2,j)-tra(il,1,j))) |
---|
| 3805 | !AC! endif |
---|
| 3806 | !AC! endif ! iflag |
---|
| 3807 | !AC! enddo |
---|
| 3808 | !AC! enddo |
---|
[1992] | 3809 | |
---|
| 3810 | DO j = 2, nl |
---|
| 3811 | DO il = 1, ncum |
---|
| 3812 | IF (j<=inb(il) .AND. iflag(il)<=1) THEN |
---|
[2007] | 3813 | fr(il, 1) = fr(il, 1) + 0.01*grav*work(il)*ment(il, j, 1)*(qent(il,j,1)-rr(il,1)) |
---|
[4613] | 3814 | fr_comp(il,1) = fr_comp(il,1) + 0.01*grav*work(il)*ment(il, j, 1)*(qent(il,j,1)-rr(il,1)) |
---|
[2007] | 3815 | fu(il, 1) = fu(il, 1) + 0.01*grav*work(il)*ment(il, j, 1)*(uent(il,j,1)-u(il,1)) |
---|
| 3816 | fv(il, 1) = fv(il, 1) + 0.01*grav*work(il)*ment(il, j, 1)*(vent(il,j,1)-v(il,1)) |
---|
[1992] | 3817 | END IF ! j |
---|
| 3818 | END DO |
---|
| 3819 | END DO |
---|
| 3820 | |
---|
[2007] | 3821 | !AC! do k=1,ntra |
---|
| 3822 | !AC! do j=2,nl |
---|
| 3823 | !AC! do il=1,ncum |
---|
[5117] | 3824 | !AC! if (j.le.inb(il) .AND. iflag(il) .le. 1) THEN |
---|
[2007] | 3825 | !AC! |
---|
[5116] | 3826 | !AC! if (cvflag_grav) THEN |
---|
[2007] | 3827 | !AC! ftra(il,1,k)=ftra(il,1,k)+0.01*grav*work(il)*ment(il,j,1) |
---|
| 3828 | !AC! : *(traent(il,j,1,k)-tra(il,1,k)) |
---|
| 3829 | !AC! else |
---|
| 3830 | !AC! ftra(il,1,k)=ftra(il,1,k)+0.1*work(il)*ment(il,j,1) |
---|
| 3831 | !AC! : *(traent(il,j,1,k)-tra(il,1,k)) |
---|
| 3832 | !AC! endif |
---|
| 3833 | !AC! |
---|
| 3834 | !AC! endif |
---|
| 3835 | !AC! enddo |
---|
| 3836 | !AC! enddo |
---|
| 3837 | !AC! enddo |
---|
[5103] | 3838 | ! PRINT*,'cv3_yield apres ft' |
---|
[1992] | 3839 | |
---|
[2508] | 3840 | !jyg< |
---|
| 3841 | !----------------------------------------------------------- |
---|
| 3842 | IF (ok_optim_yield) THEN !| |
---|
| 3843 | !----------------------------------------------------------- |
---|
[5099] | 3844 | |
---|
[2508] | 3845 | !*** *** |
---|
| 3846 | !*** Compute convective mass fluxes upwd and dnwd *** |
---|
| 3847 | |
---|
[3496] | 3848 | ! ================================================= |
---|
| 3849 | ! upward fluxes | |
---|
| 3850 | ! ------------------------------------------------ |
---|
[5099] | 3851 | |
---|
[2508] | 3852 | upwd(:,:) = 0. |
---|
| 3853 | up_to(:,:) = 0. |
---|
| 3854 | up_from(:,:) = 0. |
---|
[5099] | 3855 | |
---|
[3496] | 3856 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3857 | IF (adiab_ascent_mass_flux_depends_on_ejectliq) THEN |
---|
| 3858 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3859 | !! The decrease of the adiabatic ascent mass flux due to ejection of precipitation |
---|
| 3860 | !! is taken into account. |
---|
| 3861 | !! WARNING : in the present version, taking into account the mass-flux decrease due to |
---|
| 3862 | !! precipitation ejection leads to water conservation violation. |
---|
[5099] | 3863 | |
---|
[3496] | 3864 | ! - Upward mass flux of mixed draughts |
---|
| 3865 | !--------------------------------------- |
---|
[2508] | 3866 | DO i = 2, nl |
---|
[3496] | 3867 | DO j = 1, i-1 |
---|
| 3868 | DO il = 1, ncum |
---|
| 3869 | IF (i<=inb(il)) THEN |
---|
| 3870 | up_to(il,i) = up_to(il,i) + ment(il,j,i) |
---|
| 3871 | ENDIF |
---|
| 3872 | ENDDO |
---|
| 3873 | ENDDO |
---|
| 3874 | ENDDO |
---|
[5099] | 3875 | |
---|
[3496] | 3876 | DO j = 3, nl |
---|
| 3877 | DO i = 2, j-1 |
---|
| 3878 | DO il = 1, ncum |
---|
| 3879 | IF (j<=inb(il)) THEN |
---|
| 3880 | up_from(il,i) = up_from(il,i) + ment(il,i,j) |
---|
| 3881 | ENDIF |
---|
| 3882 | ENDDO |
---|
| 3883 | ENDDO |
---|
| 3884 | ENDDO |
---|
[5099] | 3885 | |
---|
[3496] | 3886 | ! The difference between upwd(il,i) and upwd(il,i-1) is due to updrafts ending in layer |
---|
| 3887 | !(i-1) (theses drafts cross interface (i-1) but not interface(i)) and to updrafts starting |
---|
| 3888 | !from layer (i-1) (theses drafts cross interface (i) but not interface(i-1)): |
---|
[5099] | 3889 | |
---|
[3496] | 3890 | DO i = 2, nlp |
---|
[2508] | 3891 | DO il = 1, ncum |
---|
[3496] | 3892 | IF (i<=inb(il)+1) THEN |
---|
| 3893 | upwd(il,i) = max(0., upwd(il,i-1) - up_to(il,i-1) + up_from(il,i-1)) |
---|
| 3894 | ENDIF |
---|
| 3895 | ENDDO |
---|
| 3896 | ENDDO |
---|
[5099] | 3897 | |
---|
[3496] | 3898 | ! - Total upward mass flux |
---|
| 3899 | !--------------------------- |
---|
| 3900 | DO i = 2, nlp |
---|
| 3901 | DO il = 1, ncum |
---|
| 3902 | IF (i<=inb(il)+1) THEN |
---|
| 3903 | upwd(il,i) = upwd(il,i) + ma(il,i) |
---|
| 3904 | ENDIF |
---|
| 3905 | ENDDO |
---|
| 3906 | ENDDO |
---|
| 3907 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3908 | ELSE ! (adiab_ascent_mass_flux_depends_on_ejectliq) |
---|
| 3909 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3910 | !! The decrease of the adiabatic ascent mass flux due to ejection of precipitation |
---|
| 3911 | !! is not taken into account. |
---|
[5099] | 3912 | |
---|
[3496] | 3913 | ! - Upward mass flux |
---|
| 3914 | !------------------- |
---|
| 3915 | DO i = 2, nl |
---|
| 3916 | DO il = 1, ncum |
---|
[2508] | 3917 | IF (i<=inb(il)) THEN |
---|
| 3918 | up_to(il,i) = m(il,i) |
---|
| 3919 | ENDIF |
---|
| 3920 | ENDDO |
---|
| 3921 | DO j = 1, i-1 |
---|
| 3922 | DO il = 1, ncum |
---|
| 3923 | IF (i<=inb(il)) THEN |
---|
| 3924 | up_to(il,i) = up_to(il,i) + ment(il,j,i) |
---|
| 3925 | ENDIF |
---|
| 3926 | ENDDO |
---|
| 3927 | ENDDO |
---|
| 3928 | ENDDO |
---|
[5099] | 3929 | |
---|
[2508] | 3930 | DO i = 1, nl |
---|
| 3931 | DO il = 1, ncum |
---|
| 3932 | IF (i<=inb(il)) THEN |
---|
| 3933 | up_from(il,i) = cbmf(il)*wghti(il,i) |
---|
| 3934 | ENDIF |
---|
| 3935 | ENDDO |
---|
| 3936 | ENDDO |
---|
[5099] | 3937 | |
---|
[2508] | 3938 | DO j = 3, nl |
---|
| 3939 | DO i = 2, j-1 |
---|
| 3940 | DO il = 1, ncum |
---|
| 3941 | IF (j<=inb(il)) THEN |
---|
| 3942 | up_from(il,i) = up_from(il,i) + ment(il,i,j) |
---|
| 3943 | ENDIF |
---|
| 3944 | ENDDO |
---|
| 3945 | ENDDO |
---|
| 3946 | ENDDO |
---|
[5099] | 3947 | |
---|
[2508] | 3948 | ! The difference between upwd(il,i) and upwd(il,i-1) is due to updrafts ending in layer |
---|
| 3949 | !(i-1) (theses drafts cross interface (i-1) but not interface(i)) and to updrafts starting |
---|
| 3950 | !from layer (i-1) (theses drafts cross interface (i) but not interface(i-1)): |
---|
[5099] | 3951 | |
---|
[2508] | 3952 | DO i = 2, nlp |
---|
| 3953 | DO il = 1, ncum |
---|
[3197] | 3954 | IF (i<=inb(il)+1) THEN |
---|
| 3955 | upwd(il,i) = max(0., upwd(il,i-1) - up_to(il,i-1) + up_from(il,i-1)) |
---|
| 3956 | ENDIF |
---|
[2508] | 3957 | ENDDO |
---|
| 3958 | ENDDO |
---|
[3496] | 3959 | |
---|
| 3960 | |
---|
| 3961 | ENDIF ! (adiab_ascent_mass_flux_depends_on_ejectliq) ELSE |
---|
| 3962 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 3963 | |
---|
[2508] | 3964 | ! ================================================= |
---|
| 3965 | ! downward fluxes | |
---|
| 3966 | ! ------------------------------------------------ |
---|
[3496] | 3967 | dnwd(:,:) = 0. |
---|
| 3968 | dn_to(:,:) = 0. |
---|
| 3969 | dn_from(:,:) = 0. |
---|
[2508] | 3970 | DO i = 1, nl |
---|
| 3971 | DO j = i+1, nl |
---|
| 3972 | DO il = 1, ncum |
---|
| 3973 | IF (j<=inb(il)) THEN |
---|
[4076] | 3974 | !! dn_to(il,i) = dn_to(il,i) + ment(il,j,i) !jyg,20220202 |
---|
| 3975 | dn_to(il,i) = dn_to(il,i) - ment(il,j,i) |
---|
[2508] | 3976 | ENDIF |
---|
| 3977 | ENDDO |
---|
| 3978 | ENDDO |
---|
| 3979 | ENDDO |
---|
[5099] | 3980 | |
---|
[2508] | 3981 | DO j = 1, nl |
---|
| 3982 | DO i = j+1, nl |
---|
| 3983 | DO il = 1, ncum |
---|
| 3984 | IF (i<=inb(il)) THEN |
---|
[4076] | 3985 | !! dn_from(il,i) = dn_from(il,i) + ment(il,i,j) !jyg,20220202 |
---|
| 3986 | dn_from(il,i) = dn_from(il,i) - ment(il,i,j) |
---|
[2508] | 3987 | ENDIF |
---|
| 3988 | ENDDO |
---|
| 3989 | ENDDO |
---|
| 3990 | ENDDO |
---|
[5099] | 3991 | |
---|
[2508] | 3992 | ! The difference between dnwd(il,i) and dnwd(il,i+1) is due to downdrafts ending in layer |
---|
| 3993 | !(i) (theses drafts cross interface (i+1) but not interface(i)) and to downdrafts |
---|
| 3994 | !starting from layer (i) (theses drafts cross interface (i) but not interface(i+1)): |
---|
[5099] | 3995 | |
---|
[2508] | 3996 | DO i = nl-1, 1, -1 |
---|
| 3997 | DO il = 1, ncum |
---|
[4076] | 3998 | !! dnwd(il,i) = max(0., dnwd(il,i+1) - dn_to(il,i) + dn_from(il,i)) !jyg,20220202 |
---|
| 3999 | dnwd(il,i) = min(0., dnwd(il,i+1) - dn_to(il,i) + dn_from(il,i)) |
---|
[2508] | 4000 | ENDDO |
---|
| 4001 | ENDDO |
---|
| 4002 | ! ================================================= |
---|
[5099] | 4003 | |
---|
[2508] | 4004 | !----------------------------------------------------------- |
---|
| 4005 | ENDIF !(ok_optim_yield) !| |
---|
| 4006 | !----------------------------------------------------------- |
---|
| 4007 | !>jyg |
---|
| 4008 | |
---|
[2007] | 4009 | ! *** calculate tendencies of potential temperature and mixing ratio *** |
---|
| 4010 | ! *** at levels above the lowest level *** |
---|
[1992] | 4011 | |
---|
[2007] | 4012 | ! *** first find the net saturated updraft and downdraft mass fluxes *** |
---|
| 4013 | ! *** through each level *** |
---|
[1992] | 4014 | |
---|
| 4015 | |
---|
[2508] | 4016 | !jyg< |
---|
| 4017 | !! DO i = 2, nl + 1 ! newvecto: mettre nl au lieu nl+1? |
---|
| 4018 | DO i = 2, nl |
---|
| 4019 | !>jyg |
---|
[1992] | 4020 | |
---|
| 4021 | num1 = 0 |
---|
| 4022 | DO il = 1, ncum |
---|
| 4023 | IF (i<=inb(il) .AND. iflag(il)<=1) num1 = num1 + 1 |
---|
| 4024 | END DO |
---|
| 4025 | IF (num1<=0) GO TO 500 |
---|
| 4026 | |
---|
[2393] | 4027 | !jyg< |
---|
[2508] | 4028 | !----------------------------------------------------------- |
---|
| 4029 | IF (ok_optim_yield) THEN !| |
---|
| 4030 | !----------------------------------------------------------- |
---|
| 4031 | DO il = 1, ncum |
---|
| 4032 | amp1(il) = upwd(il,i+1) |
---|
| 4033 | ad(il) = dnwd(il,i) |
---|
| 4034 | ENDDO |
---|
| 4035 | !----------------------------------------------------------- |
---|
| 4036 | ELSE !(ok_optim_yield) !| |
---|
| 4037 | !----------------------------------------------------------- |
---|
| 4038 | !>jyg |
---|
[2393] | 4039 | DO il = 1,ncum |
---|
| 4040 | amp1(il) = 0. |
---|
| 4041 | ad(il) = 0. |
---|
| 4042 | ENDDO |
---|
[1992] | 4043 | |
---|
| 4044 | DO k = 1, nl + 1 |
---|
| 4045 | DO il = 1, ncum |
---|
| 4046 | IF (i>=icb(il)) THEN |
---|
| 4047 | IF (k>=i+1 .AND. k<=(inb(il)+1)) THEN |
---|
| 4048 | amp1(il) = amp1(il) + m(il, k) |
---|
| 4049 | END IF |
---|
| 4050 | ELSE |
---|
[2007] | 4051 | ! AMP1 is the part of cbmf taken from layers I and lower |
---|
[1992] | 4052 | IF (k<=i) THEN |
---|
| 4053 | amp1(il) = amp1(il) + cbmf(il)*wghti(il, k) |
---|
| 4054 | END IF |
---|
| 4055 | END IF |
---|
| 4056 | END DO |
---|
| 4057 | END DO |
---|
| 4058 | |
---|
[2508] | 4059 | DO j = i + 1, nl + 1 |
---|
| 4060 | DO k = 1, i |
---|
| 4061 | !yor! reverted j and k loops |
---|
| 4062 | DO il = 1, ncum |
---|
| 4063 | !yor! IF (i<=inb(il) .AND. j<=(inb(il)+1)) THEN ! the second condition implies the first ! |
---|
| 4064 | IF (j<=(inb(il)+1)) THEN |
---|
| 4065 | amp1(il) = amp1(il) + ment(il, k, j) |
---|
| 4066 | END IF |
---|
| 4067 | END DO |
---|
| 4068 | END DO |
---|
[1992] | 4069 | END DO |
---|
| 4070 | |
---|
| 4071 | DO k = 1, i - 1 |
---|
[2508] | 4072 | !jyg< |
---|
| 4073 | !! DO j = i, nl + 1 ! newvecto: nl au lieu nl+1? |
---|
| 4074 | DO j = i, nl |
---|
| 4075 | !>jyg |
---|
[1992] | 4076 | DO il = 1, ncum |
---|
[2508] | 4077 | !yor! IF (i<=inb(il) .AND. j<=inb(il)) THEN ! the second condition implies the 1st ! |
---|
| 4078 | IF (j<=inb(il)) THEN |
---|
[1992] | 4079 | ad(il) = ad(il) + ment(il, j, k) |
---|
| 4080 | END IF |
---|
| 4081 | END DO |
---|
| 4082 | END DO |
---|
| 4083 | END DO |
---|
[5099] | 4084 | |
---|
[2508] | 4085 | !----------------------------------------------------------- |
---|
| 4086 | ENDIF !(ok_optim_yield) !| |
---|
| 4087 | !----------------------------------------------------------- |
---|
[5099] | 4088 | |
---|
[2508] | 4089 | !! print *,'yield, i, amp1, ad', i, amp1(1), ad(1) |
---|
[1992] | 4090 | |
---|
| 4091 | DO il = 1, ncum |
---|
| 4092 | IF (i<=inb(il) .AND. iflag(il)<=1) THEN |
---|
| 4093 | dpinv = 1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4094 | cpinv = 1.0/cpn(il, i) |
---|
| 4095 | |
---|
[2007] | 4096 | ! convect3 if((0.1*dpinv*amp1).ge.delti)iflag(il)=4 |
---|
| 4097 | IF ((0.01*grav*dpinv*amp1(il))>=delti) iflag(il) = 1 ! vecto |
---|
[1992] | 4098 | |
---|
[2007] | 4099 | ! precip |
---|
| 4100 | ! cc ft(il,i)= -0.5*sigd(il)*lvcp(il,i)*(evap(il,i)+evap(il,i+1)) |
---|
[1992] | 4101 | IF (cvflag_ice) THEN |
---|
| 4102 | ft(il, i) = -sigd(il)*lvcp(il, i)*evap(il, i) - & |
---|
[2007] | 4103 | sigd(il)*lfcp(il, i)*evap(il, i)*faci(il, i) - & |
---|
| 4104 | sigd(il)*lfcp(il, i)*fondue(il, i)*wt(il, i)/(100.*(p(il,i-1)-p(il,i))) |
---|
[1992] | 4105 | ELSE |
---|
| 4106 | ft(il, i) = -sigd(il)*lvcp(il, i)*evap(il, i) |
---|
| 4107 | END IF |
---|
| 4108 | |
---|
| 4109 | rat = cpn(il, i-1)*cpinv |
---|
| 4110 | |
---|
[2007] | 4111 | ft(il, i) = ft(il, i) - 0.009*grav*sigd(il) * & |
---|
| 4112 | (mp(il,i+1)*t_wake(il,i)*b(il,i)-mp(il,i)*t_wake(il,i-1)*rat*b(il,i-1))*dpinv |
---|
| 4113 | IF (cvflag_ice) THEN |
---|
| 4114 | ft(il, i) = ft(il, i) + 0.01*sigd(il)*wt(il, i)*(cl-cpd)*water(il, i+1) * & |
---|
| 4115 | (t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv + & |
---|
| 4116 | 0.01*sigd(il)*wt(il, i)*(ci-cpd)*ice(il, i+1) * & |
---|
| 4117 | (t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv |
---|
| 4118 | ELSE |
---|
| 4119 | ft(il, i) = ft(il, i) + 0.01*sigd(il)*wt(il, i)*(cl-cpd)*water(il, i+1) * & |
---|
| 4120 | (t_wake(il,i+1)-t_wake(il,i))*dpinv* & |
---|
| 4121 | cpinv |
---|
| 4122 | END IF |
---|
[1992] | 4123 | |
---|
[2007] | 4124 | ftd(il, i) = ft(il, i) |
---|
| 4125 | ! fin precip |
---|
[1992] | 4126 | |
---|
[2007] | 4127 | ! sature |
---|
[2908] | 4128 | !jyg< |
---|
| 4129 | IF (fl_cor_ebil >= 2) THEN |
---|
| 4130 | ft(il, i) = ft(il, i) + 0.01*grav*dpinv * & |
---|
| 4131 | ( amp1(il)*( (t(il,i+1)-t(il,i))*cpn(il,i+1) + gz(il,i+1)-gz(il,i))*cpinv - & |
---|
| 4132 | ad(il)*( (t(il,i)-t(il,i-1))*cpn(il,i-1) + gz(il,i)-gz(il,i-1))*cpinv) |
---|
| 4133 | ELSE |
---|
| 4134 | ft(il, i) = ft(il, i) + 0.01*grav*dpinv * & |
---|
[2007] | 4135 | (amp1(il)*(t(il,i+1)-t(il,i) + (gz(il,i+1)-gz(il,i))*cpinv) - & |
---|
| 4136 | ad(il)*(t(il,i)-t(il,i-1)+(gz(il,i)-gz(il,i-1))*cpinv)) |
---|
[2908] | 4137 | ENDIF |
---|
| 4138 | !>jyg |
---|
[1992] | 4139 | |
---|
| 4140 | |
---|
[2007] | 4141 | IF (iflag_mix==0) THEN |
---|
| 4142 | ft(il, i) = ft(il, i) + 0.01*grav*dpinv*ment(il, i, i)*(hp(il,i)-h(il,i) + & |
---|
| 4143 | t(il,i)*(cpv-cpd)*(rr(il,i)-qent(il,i,i)))*cpinv |
---|
| 4144 | END IF |
---|
[5099] | 4145 | |
---|
[2007] | 4146 | ! sb: on ne fait pas encore la correction permettant de mieux |
---|
| 4147 | ! conserver l'eau: |
---|
| 4148 | !JYG: correction permettant de mieux conserver l'eau: |
---|
| 4149 | ! cc fr(il,i)=0.5*sigd(il)*(evap(il,i)+evap(il,i+1)) |
---|
| 4150 | fr(il, i) = sigd(il)*evap(il, i) + 0.01*grav*(mp(il,i+1)*(rp(il,i+1)-rr_wake(il,i)) - & |
---|
| 4151 | mp(il,i)*(rp(il,i)-rr_wake(il,i-1)))*dpinv |
---|
| 4152 | fqd(il, i) = fr(il, i) ! precip |
---|
[1992] | 4153 | |
---|
[2007] | 4154 | fu(il, i) = 0.01*grav*(mp(il,i+1)*(up(il,i+1)-u(il,i)) - & |
---|
| 4155 | mp(il,i)*(up(il,i)-u(il,i-1)))*dpinv |
---|
| 4156 | fv(il, i) = 0.01*grav*(mp(il,i+1)*(vp(il,i+1)-v(il,i)) - & |
---|
| 4157 | mp(il,i)*(vp(il,i)-v(il,i-1)))*dpinv |
---|
[1992] | 4158 | |
---|
| 4159 | |
---|
[2007] | 4160 | fr(il, i) = fr(il, i) + 0.01*grav*dpinv*(amp1(il)*(rr(il,i+1)-rr(il,i)) - & |
---|
| 4161 | ad(il)*(rr(il,i)-rr(il,i-1))) |
---|
| 4162 | fu(il, i) = fu(il, i) + 0.01*grav*dpinv*(amp1(il)*(u(il,i+1)-u(il,i)) - & |
---|
| 4163 | ad(il)*(u(il,i)-u(il,i-1))) |
---|
| 4164 | fv(il, i) = fv(il, i) + 0.01*grav*dpinv*(amp1(il)*(v(il,i+1)-v(il,i)) - & |
---|
| 4165 | ad(il)*(v(il,i)-v(il,i-1))) |
---|
[1992] | 4166 | |
---|
| 4167 | END IF ! i |
---|
| 4168 | END DO |
---|
| 4169 | |
---|
[2007] | 4170 | !AC! do k=1,ntra |
---|
| 4171 | !AC! do il=1,ncum |
---|
[5117] | 4172 | !AC! if (i.le.inb(il) .AND. iflag(il) .le. 1) THEN |
---|
[2007] | 4173 | !AC! dpinv=1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4174 | !AC! cpinv=1.0/cpn(il,i) |
---|
[5116] | 4175 | !AC! if (cvflag_grav) THEN |
---|
[2007] | 4176 | !AC! ftra(il,i,k)=ftra(il,i,k)+0.01*grav*dpinv |
---|
| 4177 | !AC! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) |
---|
| 4178 | !AC! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) |
---|
| 4179 | !AC! else |
---|
| 4180 | !AC! ftra(il,i,k)=ftra(il,i,k)+0.1*dpinv |
---|
| 4181 | !AC! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) |
---|
| 4182 | !AC! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) |
---|
| 4183 | !AC! endif |
---|
| 4184 | !AC! endif |
---|
| 4185 | !AC! enddo |
---|
| 4186 | !AC! enddo |
---|
[1992] | 4187 | |
---|
| 4188 | DO k = 1, i - 1 |
---|
| 4189 | |
---|
| 4190 | DO il = 1, ncum |
---|
| 4191 | awat(il) = elij(il, k, i) - (1.-ep(il,i))*clw(il, i) |
---|
| 4192 | awat(il) = max(awat(il), 0.0) |
---|
| 4193 | END DO |
---|
| 4194 | |
---|
| 4195 | IF (iflag_mix/=0) THEN |
---|
| 4196 | DO il = 1, ncum |
---|
| 4197 | IF (i<=inb(il) .AND. iflag(il)<=1) THEN |
---|
| 4198 | dpinv = 1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4199 | cpinv = 1.0/cpn(il, i) |
---|
[2007] | 4200 | ft(il, i) = ft(il, i) + 0.01*grav*dpinv*ment(il, k, i) * & |
---|
| 4201 | (hent(il,k,i)-h(il,i)+t(il,i)*(cpv-cpd)*(rr(il,i)+awat(il)-qent(il,k,i)))*cpinv |
---|
[5099] | 4202 | |
---|
| 4203 | |
---|
[1992] | 4204 | END IF ! i |
---|
| 4205 | END DO |
---|
| 4206 | END IF |
---|
| 4207 | |
---|
| 4208 | DO il = 1, ncum |
---|
| 4209 | IF (i<=inb(il) .AND. iflag(il)<=1) THEN |
---|
| 4210 | dpinv = 1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4211 | cpinv = 1.0/cpn(il, i) |
---|
[2007] | 4212 | fr(il, i) = fr(il, i) + 0.01*grav*dpinv*ment(il, k, i) * & |
---|
| 4213 | (qent(il,k,i)-awat(il)-rr(il,i)) |
---|
[4613] | 4214 | fr_comp(il,i) = fr_comp(il,i) + 0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-awat(il)-rr(il,i)) |
---|
[2007] | 4215 | fu(il, i) = fu(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(uent(il,k,i)-u(il,i)) |
---|
| 4216 | fv(il, i) = fv(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(vent(il,k,i)-v(il,i)) |
---|
[1992] | 4217 | |
---|
[2007] | 4218 | ! (saturated updrafts resulting from mixing) ! cld |
---|
| 4219 | qcond(il, i) = qcond(il, i) + (elij(il,k,i)-awat(il)) ! cld |
---|
[4613] | 4220 | qdet(il,k,i) = (qent(il,k,i)-awat(il)) ! cld Louis : specific humidity in detraining water |
---|
[2205] | 4221 | qtment(il, i) = qtment(il, i) + qent(il,k,i) ! cld |
---|
| 4222 | nqcond(il, i) = nqcond(il, i) + 1. ! cld |
---|
[1992] | 4223 | END IF ! i |
---|
| 4224 | END DO |
---|
| 4225 | END DO |
---|
| 4226 | |
---|
[2007] | 4227 | !AC! do j=1,ntra |
---|
| 4228 | !AC! do k=1,i-1 |
---|
| 4229 | !AC! do il=1,ncum |
---|
[5117] | 4230 | !AC! if (i.le.inb(il) .AND. iflag(il) .le. 1) THEN |
---|
[2007] | 4231 | !AC! dpinv=1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4232 | !AC! cpinv=1.0/cpn(il,i) |
---|
[5116] | 4233 | !AC! if (cvflag_grav) THEN |
---|
[2007] | 4234 | !AC! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) |
---|
| 4235 | !AC! : *(traent(il,k,i,j)-tra(il,i,j)) |
---|
| 4236 | !AC! else |
---|
| 4237 | !AC! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) |
---|
| 4238 | !AC! : *(traent(il,k,i,j)-tra(il,i,j)) |
---|
| 4239 | !AC! endif |
---|
| 4240 | !AC! endif |
---|
| 4241 | !AC! enddo |
---|
| 4242 | !AC! enddo |
---|
| 4243 | !AC! enddo |
---|
[1992] | 4244 | |
---|
[2508] | 4245 | !jyg< |
---|
| 4246 | !! DO k = i, nl + 1 |
---|
| 4247 | DO k = i, nl |
---|
| 4248 | !>jyg |
---|
[1992] | 4249 | |
---|
| 4250 | IF (iflag_mix/=0) THEN |
---|
| 4251 | DO il = 1, ncum |
---|
| 4252 | IF (i<=inb(il) .AND. k<=inb(il) .AND. iflag(il)<=1) THEN |
---|
| 4253 | dpinv = 1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4254 | cpinv = 1.0/cpn(il, i) |
---|
[2007] | 4255 | ft(il, i) = ft(il, i) + 0.01*grav*dpinv*ment(il, k, i) * & |
---|
| 4256 | (hent(il,k,i)-h(il,i)+t(il,i)*(cpv-cpd)*(rr(il,i)-qent(il,k,i)))*cpinv |
---|
[1992] | 4257 | |
---|
| 4258 | |
---|
| 4259 | END IF ! i |
---|
| 4260 | END DO |
---|
| 4261 | END IF |
---|
| 4262 | |
---|
| 4263 | DO il = 1, ncum |
---|
| 4264 | IF (i<=inb(il) .AND. k<=inb(il) .AND. iflag(il)<=1) THEN |
---|
| 4265 | dpinv = 1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4266 | cpinv = 1.0/cpn(il, i) |
---|
| 4267 | |
---|
[2007] | 4268 | fr(il, i) = fr(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-rr(il,i)) |
---|
| 4269 | fu(il, i) = fu(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(uent(il,k,i)-u(il,i)) |
---|
| 4270 | fv(il, i) = fv(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(vent(il,k,i)-v(il,i)) |
---|
[1992] | 4271 | END IF ! i and k |
---|
| 4272 | END DO |
---|
| 4273 | END DO |
---|
| 4274 | |
---|
[2007] | 4275 | !AC! do j=1,ntra |
---|
| 4276 | !AC! do k=i,nl+1 |
---|
| 4277 | !AC! do il=1,ncum |
---|
[5117] | 4278 | !AC! if (i.le.inb(il) .AND. k.le.inb(il) |
---|
| 4279 | !AC! $ .AND. iflag(il) .le. 1) THEN |
---|
[2007] | 4280 | !AC! dpinv=1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4281 | !AC! cpinv=1.0/cpn(il,i) |
---|
[5116] | 4282 | !AC! if (cvflag_grav) THEN |
---|
[2007] | 4283 | !AC! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) |
---|
| 4284 | !AC! : *(traent(il,k,i,j)-tra(il,i,j)) |
---|
| 4285 | !AC! else |
---|
| 4286 | !AC! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) |
---|
| 4287 | !AC! : *(traent(il,k,i,j)-tra(il,i,j)) |
---|
| 4288 | !AC! endif |
---|
| 4289 | !AC! endif ! i and k |
---|
| 4290 | !AC! enddo |
---|
| 4291 | !AC! enddo |
---|
| 4292 | !AC! enddo |
---|
[1992] | 4293 | |
---|
[2007] | 4294 | ! sb: interface with the cloud parameterization: ! cld |
---|
[1992] | 4295 | |
---|
| 4296 | DO k = i + 1, nl |
---|
| 4297 | DO il = 1, ncum |
---|
[2007] | 4298 | IF (k<=inb(il) .AND. i<=inb(il) .AND. iflag(il)<=1) THEN ! cld |
---|
| 4299 | ! (saturated downdrafts resulting from mixing) ! cld |
---|
| 4300 | qcond(il, i) = qcond(il, i) + elij(il, k, i) ! cld |
---|
[4613] | 4301 | qdet(il,k,i) = qent(il,k,i) ! cld Louis : specific humidity in detraining water |
---|
[2205] | 4302 | qtment(il, i) = qent(il,k,i) + qtment(il,i) ! cld |
---|
| 4303 | nqcond(il, i) = nqcond(il, i) + 1. ! cld |
---|
[1992] | 4304 | END IF ! cld |
---|
| 4305 | END DO ! cld |
---|
| 4306 | END DO ! cld |
---|
| 4307 | |
---|
[3435] | 4308 | !ym BIG Warning : it seems that the k loop is missing !!! |
---|
| 4309 | !ym Strong advice to check this |
---|
| 4310 | !ym add a k loop temporary |
---|
| 4311 | |
---|
[2007] | 4312 | ! (particular case: no detraining level is found) ! cld |
---|
[3435] | 4313 | ! Verif merge Dynamico<<<<<<< .working |
---|
[2007] | 4314 | DO il = 1, ncum ! cld |
---|
| 4315 | IF (i<=inb(il) .AND. nent(il,i)==0 .AND. iflag(il)<=1) THEN ! cld |
---|
| 4316 | qcond(il, i) = qcond(il, i) + (1.-ep(il,i))*clw(il, i) ! cld |
---|
[3345] | 4317 | !jyg< Bug correction 20180620 |
---|
| 4318 | ! PROBLEM: Should not qent(il,i,i) be taken into account even if nent(il,i)/=0? |
---|
| 4319 | !! qtment(il, i) = qent(il,k,i) + qtment(il,i) ! cld |
---|
[4613] | 4320 | qdet(il,i,i) = qent(il,i,i) ! cld Louis : specific humidity in detraining water |
---|
[3345] | 4321 | qtment(il, i) = qent(il,i,i) + qtment(il,i) ! cld |
---|
| 4322 | !>jyg |
---|
[2007] | 4323 | nqcond(il, i) = nqcond(il, i) + 1. ! cld |
---|
| 4324 | END IF ! cld |
---|
| 4325 | END DO ! cld |
---|
[3435] | 4326 | ! Verif merge Dynamico ======= |
---|
| 4327 | ! Verif merge Dynamico DO k = i + 1, nl |
---|
| 4328 | ! Verif merge Dynamico DO il = 1, ncum !ym k loop added ! cld |
---|
| 4329 | ! Verif merge Dynamico IF (i<=inb(il) .AND. nent(il,i)==0 .AND. iflag(il)<=1) THEN ! cld |
---|
| 4330 | ! Verif merge Dynamico qcond(il, i) = qcond(il, i) + (1.-ep(il,i))*clw(il, i) ! cld |
---|
| 4331 | ! Verif merge Dynamico qtment(il, i) = qent(il,k,i) + qtment(il,i) ! cld |
---|
| 4332 | ! Verif merge Dynamico nqcond(il, i) = nqcond(il, i) + 1. ! cld |
---|
| 4333 | ! Verif merge Dynamico END IF ! cld |
---|
| 4334 | ! Verif merge Dynamico END DO |
---|
| 4335 | ! Verif merge Dynamico ENDDO ! cld |
---|
| 4336 | ! Verif merge Dynamico >>>>>>> .merge-right.r3413 |
---|
[1992] | 4337 | |
---|
[2007] | 4338 | DO il = 1, ncum ! cld |
---|
| 4339 | IF (i<=inb(il) .AND. nqcond(il,i)/=0 .AND. iflag(il)<=1) THEN ! cld |
---|
| 4340 | qcond(il, i) = qcond(il, i)/nqcond(il, i) ! cld |
---|
[2205] | 4341 | qtment(il, i) = qtment(il,i)/nqcond(il, i) ! cld |
---|
[2007] | 4342 | END IF ! cld |
---|
[1992] | 4343 | END DO |
---|
| 4344 | |
---|
[2007] | 4345 | !AC! do j=1,ntra |
---|
| 4346 | !AC! do il=1,ncum |
---|
[5117] | 4347 | !AC! if (i.le.inb(il) .AND. iflag(il) .le. 1) THEN |
---|
[2007] | 4348 | !AC! dpinv=1.0/(ph(il,i)-ph(il,i+1)) |
---|
| 4349 | !AC! cpinv=1.0/cpn(il,i) |
---|
| 4350 | !AC! |
---|
[5116] | 4351 | !AC! if (cvflag_grav) THEN |
---|
[2007] | 4352 | !AC! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv |
---|
| 4353 | !AC! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) |
---|
| 4354 | !AC! : -mp(il,i)*(trap(il,i,j)-trap(il,i-1,j))) |
---|
| 4355 | !AC! else |
---|
| 4356 | !AC! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv |
---|
| 4357 | !AC! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) |
---|
| 4358 | !AC! : -mp(il,i)*(trap(il,i,j)-trap(il,i-1,j))) |
---|
| 4359 | !AC! endif |
---|
| 4360 | !AC! endif ! i |
---|
| 4361 | !AC! enddo |
---|
| 4362 | !AC! enddo |
---|
[1992] | 4363 | |
---|
| 4364 | |
---|
| 4365 | 500 END DO |
---|
| 4366 | |
---|
[2007] | 4367 | !JYG< |
---|
| 4368 | !Conservation de l'eau |
---|
| 4369 | ! sumdq = 0. |
---|
| 4370 | ! DO k = 1, nl |
---|
| 4371 | ! sumdq = sumdq + fr(1, k)*100.*(ph(1,k)-ph(1,k+1))/grav |
---|
| 4372 | ! END DO |
---|
| 4373 | ! PRINT *, 'cv3_yield, apres 500, sum(dq), precip, somme ', sumdq, Vprecip(1, 1), sumdq + vprecip(1, 1) |
---|
| 4374 | !JYG> |
---|
| 4375 | ! *** move the detrainment at level inb down to level inb-1 *** |
---|
| 4376 | ! *** in such a way as to preserve the vertically *** |
---|
| 4377 | ! *** integrated enthalpy and water tendencies *** |
---|
[1992] | 4378 | |
---|
[2007] | 4379 | ! Correction bug le 18-03-09 |
---|
[1992] | 4380 | DO il = 1, ncum |
---|
| 4381 | IF (iflag(il)<=1) THEN |
---|
[2007] | 4382 | ax = 0.01*grav*ment(il, inb(il), inb(il))* & |
---|
| 4383 | (hp(il,inb(il))-h(il,inb(il))+t(il,inb(il))*(cpv-cpd)*(rr(il,inb(il))-qent(il,inb(il),inb(il))))/ & |
---|
| 4384 | (cpn(il,inb(il))*(ph(il,inb(il))-ph(il,inb(il)+1))) |
---|
| 4385 | ft(il, inb(il)) = ft(il, inb(il)) - ax |
---|
| 4386 | ft(il, inb(il)-1) = ft(il, inb(il)-1) + ax*cpn(il, inb(il))*(ph(il,inb(il))-ph(il,inb(il)+1))/ & |
---|
| 4387 | (cpn(il,inb(il)-1)*(ph(il,inb(il)-1)-ph(il,inb(il)))) |
---|
[1992] | 4388 | |
---|
[2007] | 4389 | bx = 0.01*grav*ment(il, inb(il), inb(il))*(qent(il,inb(il),inb(il))-rr(il,inb(il)))/ & |
---|
| 4390 | (ph(il,inb(il))-ph(il,inb(il)+1)) |
---|
| 4391 | fr(il, inb(il)) = fr(il, inb(il)) - bx |
---|
| 4392 | fr(il, inb(il)-1) = fr(il, inb(il)-1) + bx*(ph(il,inb(il))-ph(il,inb(il)+1))/ & |
---|
| 4393 | (ph(il,inb(il)-1)-ph(il,inb(il))) |
---|
[1992] | 4394 | |
---|
[2007] | 4395 | cx = 0.01*grav*ment(il, inb(il), inb(il))*(uent(il,inb(il),inb(il))-u(il,inb(il)))/ & |
---|
| 4396 | (ph(il,inb(il))-ph(il,inb(il)+1)) |
---|
| 4397 | fu(il, inb(il)) = fu(il, inb(il)) - cx |
---|
| 4398 | fu(il, inb(il)-1) = fu(il, inb(il)-1) + cx*(ph(il,inb(il))-ph(il,inb(il)+1))/ & |
---|
| 4399 | (ph(il,inb(il)-1)-ph(il,inb(il))) |
---|
[1992] | 4400 | |
---|
[2007] | 4401 | dx = 0.01*grav*ment(il, inb(il), inb(il))*(vent(il,inb(il),inb(il))-v(il,inb(il)))/ & |
---|
| 4402 | (ph(il,inb(il))-ph(il,inb(il)+1)) |
---|
| 4403 | fv(il, inb(il)) = fv(il, inb(il)) - dx |
---|
| 4404 | fv(il, inb(il)-1) = fv(il, inb(il)-1) + dx*(ph(il,inb(il))-ph(il,inb(il)+1))/ & |
---|
| 4405 | (ph(il,inb(il)-1)-ph(il,inb(il))) |
---|
[1992] | 4406 | END IF !iflag |
---|
| 4407 | END DO |
---|
| 4408 | |
---|
[2007] | 4409 | !JYG< |
---|
| 4410 | !Conservation de l'eau |
---|
| 4411 | ! sumdq = 0. |
---|
| 4412 | ! DO k = 1, nl |
---|
| 4413 | ! sumdq = sumdq + fr(1, k)*100.*(ph(1,k)-ph(1,k+1))/grav |
---|
| 4414 | ! END DO |
---|
| 4415 | ! PRINT *, 'cv3_yield, apres 503, sum(dq), precip, somme ', sumdq, Vprecip(1, 1), sumdq + vprecip(1, 1) |
---|
| 4416 | !JYG> |
---|
[1992] | 4417 | |
---|
[2007] | 4418 | !AC! do j=1,ntra |
---|
| 4419 | !AC! do il=1,ncum |
---|
| 4420 | !AC! IF (iflag(il) .le. 1) THEN |
---|
[5116] | 4421 | !AC! IF (cvflag_grav) THEN |
---|
[2007] | 4422 | !AC! ex=0.01*grav*ment(il,inb(il),inb(il)) |
---|
| 4423 | !AC! : *(traent(il,inb(il),inb(il),j)-tra(il,inb(il),j)) |
---|
| 4424 | !AC! : /(ph(i l,inb(il))-ph(il,inb(il)+1)) |
---|
| 4425 | !AC! ftra(il,inb(il),j)=ftra(il,inb(il),j)-ex |
---|
| 4426 | !AC! ftra(il,inb(il)-1,j)=ftra(il,inb(il)-1,j) |
---|
| 4427 | !AC! : +ex*(ph(il,inb(il))-ph(il,inb(il)+1)) |
---|
| 4428 | !AC! : /(ph(il,inb(il)-1)-ph(il,inb(il))) |
---|
| 4429 | !AC! else |
---|
| 4430 | !AC! ex=0.1*ment(il,inb(il),inb(il)) |
---|
| 4431 | !AC! : *(traent(il,inb(il),inb(il),j)-tra(il,inb(il),j)) |
---|
| 4432 | !AC! : /(ph(i l,inb(il))-ph(il,inb(il)+1)) |
---|
| 4433 | !AC! ftra(il,inb(il),j)=ftra(il,inb(il),j)-ex |
---|
| 4434 | !AC! ftra(il,inb(il)-1,j)=ftra(il,inb(il)-1,j) |
---|
| 4435 | !AC! : +ex*(ph(il,inb(il))-ph(il,inb(il)+1)) |
---|
| 4436 | !AC! : /(ph(il,inb(il)-1)-ph(il,inb(il))) |
---|
| 4437 | !AC! ENDIF !cvflag grav |
---|
| 4438 | !AC! ENDIF !iflag |
---|
| 4439 | !AC! enddo |
---|
| 4440 | !AC! enddo |
---|
[1992] | 4441 | |
---|
| 4442 | |
---|
[2007] | 4443 | ! *** homogenize tendencies below cloud base *** |
---|
[1992] | 4444 | |
---|
[2007] | 4445 | |
---|
[1992] | 4446 | DO il = 1, ncum |
---|
| 4447 | asum(il) = 0.0 |
---|
| 4448 | bsum(il) = 0.0 |
---|
| 4449 | csum(il) = 0.0 |
---|
| 4450 | dsum(il) = 0.0 |
---|
| 4451 | esum(il) = 0.0 |
---|
| 4452 | fsum(il) = 0.0 |
---|
| 4453 | gsum(il) = 0.0 |
---|
| 4454 | hsum(il) = 0.0 |
---|
| 4455 | END DO |
---|
| 4456 | |
---|
[2007] | 4457 | !do i=1,nl |
---|
| 4458 | !do il=1,ncum |
---|
| 4459 | !th_wake(il,i)=t_wake(il,i)*(1000.0/p(il,i))**rdcp |
---|
| 4460 | !enddo |
---|
| 4461 | !enddo |
---|
[1992] | 4462 | |
---|
| 4463 | DO i = 1, nl |
---|
| 4464 | DO il = 1, ncum |
---|
| 4465 | IF (i<=(icb(il)-1) .AND. iflag(il)<=1) THEN |
---|
[2007] | 4466 | !jyg Saturated part : use T profile |
---|
[1992] | 4467 | asum(il) = asum(il) + (ft(il,i)-ftd(il,i))*(ph(il,i)-ph(il,i+1)) |
---|
[2007] | 4468 | !jyg<20140311 |
---|
| 4469 | !Correction pour conserver l eau |
---|
| 4470 | IF (ok_conserv_q) THEN |
---|
| 4471 | bsum(il) = bsum(il) + (fr(il,i)-fqd(il,i))*(ph(il,i)-ph(il,i+1)) |
---|
| 4472 | csum(il) = csum(il) + (ph(il,i)-ph(il,i+1)) |
---|
| 4473 | |
---|
| 4474 | ELSE |
---|
| 4475 | bsum(il)=bsum(il)+(fr(il,i)-fqd(il,i))*(lv(il,i)+(cl-cpd)*(t(il,i)-t(il,1)))* & |
---|
| 4476 | (ph(il,i)-ph(il,i+1)) |
---|
| 4477 | csum(il)=csum(il)+(lv(il,i)+(cl-cpd)*(t(il,i)-t(il,1)))* & |
---|
| 4478 | (ph(il,i)-ph(il,i+1)) |
---|
| 4479 | ENDIF ! (ok_conserv_q) |
---|
| 4480 | !jyg> |
---|
[1992] | 4481 | dsum(il) = dsum(il) + t(il, i)*(ph(il,i)-ph(il,i+1))/th(il, i) |
---|
[2007] | 4482 | !jyg Unsaturated part : use T_wake profile |
---|
[1992] | 4483 | esum(il) = esum(il) + ftd(il, i)*(ph(il,i)-ph(il,i+1)) |
---|
[2007] | 4484 | !jyg<20140311 |
---|
| 4485 | !Correction pour conserver l eau |
---|
| 4486 | IF (ok_conserv_q) THEN |
---|
| 4487 | fsum(il) = fsum(il) + fqd(il, i)*(ph(il,i)-ph(il,i+1)) |
---|
| 4488 | gsum(il) = gsum(il) + (ph(il,i)-ph(il,i+1)) |
---|
| 4489 | ELSE |
---|
| 4490 | fsum(il)=fsum(il)+fqd(il,i)*(lv(il,i)+(cl-cpd)*(t_wake(il,i)-t_wake(il,1)))* & |
---|
| 4491 | (ph(il,i)-ph(il,i+1)) |
---|
| 4492 | gsum(il)=gsum(il)+(lv(il,i)+(cl-cpd)*(t_wake(il,i)-t_wake(il,1)))* & |
---|
| 4493 | (ph(il,i)-ph(il,i+1)) |
---|
| 4494 | ENDIF ! (ok_conserv_q) |
---|
| 4495 | !jyg> |
---|
| 4496 | hsum(il) = hsum(il) + t_wake(il, i)*(ph(il,i)-ph(il,i+1))/th_wake(il, i) |
---|
[1992] | 4497 | END IF |
---|
| 4498 | END DO |
---|
| 4499 | END DO |
---|
| 4500 | |
---|
[2007] | 4501 | !!!! do 700 i=1,icb(il)-1 |
---|
[2901] | 4502 | IF (ok_homo_tend) THEN |
---|
| 4503 | DO i = 1, nl |
---|
| 4504 | DO il = 1, ncum |
---|
| 4505 | IF (i<=(icb(il)-1) .AND. iflag(il)<=1) THEN |
---|
| 4506 | ftd(il, i) = esum(il)*t_wake(il, i)/(th_wake(il,i)*hsum(il)) |
---|
| 4507 | fqd(il, i) = fsum(il)/gsum(il) |
---|
| 4508 | ft(il, i) = ftd(il, i) + asum(il)*t(il, i)/(th(il,i)*dsum(il)) |
---|
| 4509 | fr(il, i) = fqd(il, i) + bsum(il)/csum(il) |
---|
| 4510 | END IF |
---|
| 4511 | END DO |
---|
[1992] | 4512 | END DO |
---|
[2901] | 4513 | ENDIF |
---|
[1992] | 4514 | |
---|
[2007] | 4515 | !jyg< |
---|
| 4516 | !Conservation de l'eau |
---|
| 4517 | !! sumdq = 0. |
---|
| 4518 | !! DO k = 1, nl |
---|
| 4519 | !! sumdq = sumdq + fr(1, k)*100.*(ph(1,k)-ph(1,k+1))/grav |
---|
| 4520 | !! END DO |
---|
| 4521 | !! PRINT *, 'cv3_yield, apres hom, sum(dq), precip, somme ', sumdq, Vprecip(1, 1), sumdq + vprecip(1, 1) |
---|
| 4522 | !jyg> |
---|
[1992] | 4523 | |
---|
[2007] | 4524 | |
---|
| 4525 | ! *** Check that moisture stays positive. If not, scale tendencies |
---|
| 4526 | ! in order to ensure moisture positivity |
---|
[1992] | 4527 | DO il = 1, ncum |
---|
| 4528 | alpha_qpos(il) = 1. |
---|
| 4529 | IF (iflag(il)<=1) THEN |
---|
| 4530 | IF (fr(il,1)<=0.) THEN |
---|
[2007] | 4531 | alpha_qpos(il) = max(alpha_qpos(il), (-delt*fr(il,1))/(s_wake(il)*rr_wake(il,1)+(1.-s_wake(il))*rr(il,1))) |
---|
[1992] | 4532 | END IF |
---|
| 4533 | END IF |
---|
| 4534 | END DO |
---|
| 4535 | DO i = 2, nl |
---|
| 4536 | DO il = 1, ncum |
---|
| 4537 | IF (iflag(il)<=1) THEN |
---|
| 4538 | IF (fr(il,i)<=0.) THEN |
---|
[2007] | 4539 | alpha_qpos1(il) = max(1., (-delt*fr(il,i))/(s_wake(il)*rr_wake(il,i)+(1.-s_wake(il))*rr(il,i))) |
---|
| 4540 | IF (alpha_qpos1(il)>=alpha_qpos(il)) alpha_qpos(il) = alpha_qpos1(il) |
---|
[1992] | 4541 | END IF |
---|
| 4542 | END IF |
---|
| 4543 | END DO |
---|
| 4544 | END DO |
---|
| 4545 | DO il = 1, ncum |
---|
| 4546 | IF (iflag(il)<=1 .AND. alpha_qpos(il)>1.001) THEN |
---|
| 4547 | alpha_qpos(il) = alpha_qpos(il)*1.1 |
---|
| 4548 | END IF |
---|
| 4549 | END DO |
---|
[5099] | 4550 | |
---|
[5082] | 4551 | IF (prt_level >= 5) THEN |
---|
[2901] | 4552 | print *,' CV3_YIELD : alpha_qpos ',alpha_qpos(1) |
---|
| 4553 | ENDIF |
---|
[5099] | 4554 | |
---|
[1992] | 4555 | DO il = 1, ncum |
---|
| 4556 | IF (iflag(il)<=1) THEN |
---|
| 4557 | sigd(il) = sigd(il)/alpha_qpos(il) |
---|
| 4558 | precip(il) = precip(il)/alpha_qpos(il) |
---|
[2579] | 4559 | cbmf(il) = cbmf(il)/alpha_qpos(il) |
---|
[1992] | 4560 | END IF |
---|
| 4561 | END DO |
---|
| 4562 | DO i = 1, nl |
---|
| 4563 | DO il = 1, ncum |
---|
| 4564 | IF (iflag(il)<=1) THEN |
---|
| 4565 | fr(il, i) = fr(il, i)/alpha_qpos(il) |
---|
| 4566 | ft(il, i) = ft(il, i)/alpha_qpos(il) |
---|
| 4567 | fqd(il, i) = fqd(il, i)/alpha_qpos(il) |
---|
| 4568 | ftd(il, i) = ftd(il, i)/alpha_qpos(il) |
---|
| 4569 | fu(il, i) = fu(il, i)/alpha_qpos(il) |
---|
| 4570 | fv(il, i) = fv(il, i)/alpha_qpos(il) |
---|
| 4571 | m(il, i) = m(il, i)/alpha_qpos(il) |
---|
| 4572 | mp(il, i) = mp(il, i)/alpha_qpos(il) |
---|
[2306] | 4573 | Vprecip(il, i) = Vprecip(il, i)/alpha_qpos(il) |
---|
| 4574 | Vprecipi(il, i) = Vprecipi(il, i)/alpha_qpos(il) ! jyg |
---|
[1992] | 4575 | END IF |
---|
| 4576 | END DO |
---|
| 4577 | END DO |
---|
[2508] | 4578 | !jyg< |
---|
| 4579 | !----------------------------------------------------------- |
---|
| 4580 | IF (ok_optim_yield) THEN !| |
---|
| 4581 | !----------------------------------------------------------- |
---|
[2459] | 4582 | DO i = 1, nl |
---|
[2508] | 4583 | DO il = 1, ncum |
---|
| 4584 | IF (iflag(il)<=1) THEN |
---|
| 4585 | upwd(il, i) = upwd(il, i)/alpha_qpos(il) |
---|
| 4586 | dnwd(il, i) = dnwd(il, i)/alpha_qpos(il) |
---|
| 4587 | END IF |
---|
| 4588 | END DO |
---|
| 4589 | END DO |
---|
| 4590 | !----------------------------------------------------------- |
---|
| 4591 | ENDIF !(ok_optim_yield) !| |
---|
| 4592 | !----------------------------------------------------------- |
---|
| 4593 | !>jyg |
---|
| 4594 | DO j = 1, nl !yor! inverted i and j loops |
---|
| 4595 | DO i = 1, nl |
---|
[1992] | 4596 | DO il = 1, ncum |
---|
| 4597 | IF (iflag(il)<=1) THEN |
---|
| 4598 | ment(il, i, j) = ment(il, i, j)/alpha_qpos(il) |
---|
| 4599 | END IF |
---|
| 4600 | END DO |
---|
| 4601 | END DO |
---|
| 4602 | END DO |
---|
| 4603 | |
---|
[2007] | 4604 | !AC! DO j = 1,ntra |
---|
| 4605 | !AC! DO i = 1,nl |
---|
| 4606 | !AC! DO il = 1,ncum |
---|
| 4607 | !AC! IF (iflag(il) .le. 1) THEN |
---|
| 4608 | !AC! ftra(il,i,j) = ftra(il,i,j)/alpha_qpos(il) |
---|
| 4609 | !AC! ENDIF |
---|
| 4610 | !AC! ENDDO |
---|
| 4611 | !AC! ENDDO |
---|
| 4612 | !AC! ENDDO |
---|
[1992] | 4613 | |
---|
| 4614 | |
---|
[2007] | 4615 | ! *** reset counter and return *** |
---|
[1992] | 4616 | |
---|
[2253] | 4617 | ! Reset counter only for points actually convective (jyg) |
---|
| 4618 | ! In order take into account the possibility of changing the compression, |
---|
| 4619 | ! reset m, sig and w0 to zero for non-convecting points. |
---|
[1992] | 4620 | DO il = 1, ncum |
---|
[2253] | 4621 | IF (iflag(il) < 3) THEN |
---|
| 4622 | sig(il, nd) = 2.0 |
---|
| 4623 | ENDIF |
---|
[1992] | 4624 | END DO |
---|
| 4625 | |
---|
| 4626 | |
---|
[2393] | 4627 | DO i = 1, nl |
---|
[1992] | 4628 | DO il = 1, ncum |
---|
| 4629 | dnwd0(il, i) = -mp(il, i) |
---|
| 4630 | END DO |
---|
| 4631 | END DO |
---|
[2393] | 4632 | !jyg< (loops stop at nl) |
---|
| 4633 | !! DO i = nl + 1, nd |
---|
| 4634 | !! DO il = 1, ncum |
---|
| 4635 | !! dnwd0(il, i) = 0. |
---|
| 4636 | !! END DO |
---|
| 4637 | !! END DO |
---|
| 4638 | !>jyg |
---|
[1992] | 4639 | |
---|
| 4640 | |
---|
[2508] | 4641 | !jyg< |
---|
| 4642 | !----------------------------------------------------------- |
---|
| 4643 | IF (.NOT.ok_optim_yield) THEN !| |
---|
| 4644 | !----------------------------------------------------------- |
---|
[1992] | 4645 | DO i = 1, nl |
---|
| 4646 | DO il = 1, ncum |
---|
[2508] | 4647 | upwd(il, i) = 0.0 |
---|
| 4648 | dnwd(il, i) = 0.0 |
---|
[1992] | 4649 | END DO |
---|
| 4650 | END DO |
---|
| 4651 | |
---|
[2508] | 4652 | !! DO i = 1, nl ! useless; jyg |
---|
| 4653 | !! DO il = 1, ncum ! useless; jyg |
---|
| 4654 | !! IF (i>=icb(il) .AND. i<=inb(il)) THEN ! useless; jyg |
---|
| 4655 | !! upwd(il, i) = 0.0 ! useless; jyg |
---|
| 4656 | !! dnwd(il, i) = 0.0 ! useless; jyg |
---|
| 4657 | !! END IF ! useless; jyg |
---|
| 4658 | !! END DO ! useless; jyg |
---|
| 4659 | !! END DO ! useless; jyg |
---|
| 4660 | |
---|
[1992] | 4661 | DO i = 1, nl |
---|
| 4662 | DO k = 1, nl |
---|
| 4663 | DO il = 1, ncum |
---|
| 4664 | up1(il, k, i) = 0.0 |
---|
| 4665 | dn1(il, k, i) = 0.0 |
---|
| 4666 | END DO |
---|
| 4667 | END DO |
---|
| 4668 | END DO |
---|
| 4669 | |
---|
[2508] | 4670 | !yor! commented original |
---|
| 4671 | ! DO i = 1, nl |
---|
| 4672 | ! DO k = i, nl |
---|
| 4673 | ! DO n = 1, i - 1 |
---|
| 4674 | ! DO il = 1, ncum |
---|
| 4675 | ! IF (i>=icb(il) .AND. i<=inb(il) .AND. k<=inb(il)) THEN |
---|
| 4676 | ! up1(il, k, i) = up1(il, k, i) + ment(il, n, k) |
---|
| 4677 | ! dn1(il, k, i) = dn1(il, k, i) - ment(il, k, n) |
---|
| 4678 | ! END IF |
---|
| 4679 | ! END DO |
---|
| 4680 | ! END DO |
---|
| 4681 | ! END DO |
---|
| 4682 | ! END DO |
---|
| 4683 | !yor! replaced with |
---|
[1992] | 4684 | DO i = 1, nl |
---|
| 4685 | DO k = i, nl |
---|
| 4686 | DO n = 1, i - 1 |
---|
| 4687 | DO il = 1, ncum |
---|
[2508] | 4688 | IF (i>=icb(il) .AND. k<=inb(il)) THEN ! yor ! as i always <= k |
---|
| 4689 | up1(il, k, i) = up1(il, k, i) + ment(il, n, k) |
---|
[1992] | 4690 | END IF |
---|
| 4691 | END DO |
---|
| 4692 | END DO |
---|
| 4693 | END DO |
---|
| 4694 | END DO |
---|
[2508] | 4695 | DO i = 1, nl |
---|
| 4696 | DO n = 1, i - 1 |
---|
| 4697 | DO k = i, nl |
---|
| 4698 | DO il = 1, ncum |
---|
| 4699 | IF (i>=icb(il) .AND. k<=inb(il)) THEN ! yor ! i always <= k |
---|
| 4700 | dn1(il, k, i) = dn1(il, k, i) - ment(il, k, n) |
---|
| 4701 | END IF |
---|
| 4702 | END DO |
---|
| 4703 | END DO |
---|
| 4704 | END DO |
---|
| 4705 | END DO |
---|
| 4706 | !yor! end replace |
---|
[1992] | 4707 | |
---|
| 4708 | DO i = 1, nl |
---|
| 4709 | DO k = 1, nl |
---|
| 4710 | DO il = 1, ncum |
---|
| 4711 | IF (i>=icb(il)) THEN |
---|
| 4712 | IF (k>=i .AND. k<=(inb(il))) THEN |
---|
| 4713 | upwd(il, i) = upwd(il, i) + m(il, k) |
---|
| 4714 | END IF |
---|
| 4715 | ELSE |
---|
| 4716 | IF (k<i) THEN |
---|
| 4717 | upwd(il, i) = upwd(il, i) + cbmf(il)*wghti(il, k) |
---|
| 4718 | END IF |
---|
| 4719 | END IF |
---|
[2007] | 4720 | ! c print *,'cbmf',il,i,k,cbmf(il),wghti(il,k) |
---|
[1992] | 4721 | END DO |
---|
| 4722 | END DO |
---|
| 4723 | END DO |
---|
| 4724 | |
---|
| 4725 | DO i = 2, nl |
---|
| 4726 | DO k = i, nl |
---|
| 4727 | DO il = 1, ncum |
---|
[5117] | 4728 | ! test if (i.ge.icb(il).AND.i.le.inb(il).AND.k.le.inb(il)) THEN |
---|
[1992] | 4729 | IF (i<=inb(il) .AND. k<=inb(il)) THEN |
---|
| 4730 | upwd(il, i) = upwd(il, i) + up1(il, k, i) |
---|
| 4731 | dnwd(il, i) = dnwd(il, i) + dn1(il, k, i) |
---|
| 4732 | END IF |
---|
[2007] | 4733 | ! c print *,'upwd',il,i,k,inb(il),upwd(il,i),m(il,k),up1(il,k,i) |
---|
[1992] | 4734 | END DO |
---|
| 4735 | END DO |
---|
| 4736 | END DO |
---|
| 4737 | |
---|
| 4738 | |
---|
[2007] | 4739 | !!!! DO il=1,ncum |
---|
| 4740 | !!!! do i=icb(il),inb(il) |
---|
| 4741 | !!!! |
---|
| 4742 | !!!! upwd(il,i)=0.0 |
---|
| 4743 | !!!! dnwd(il,i)=0.0 |
---|
| 4744 | !!!! do k=i,inb(il) |
---|
| 4745 | !!!! up1=0.0 |
---|
| 4746 | !!!! dn1=0.0 |
---|
| 4747 | !!!! do n=1,i-1 |
---|
| 4748 | !!!! up1=up1+ment(il,n,k) |
---|
| 4749 | !!!! dn1=dn1-ment(il,k,n) |
---|
| 4750 | !!!! enddo |
---|
| 4751 | !!!! upwd(il,i)=upwd(il,i)+m(il,k)+up1 |
---|
| 4752 | !!!! dnwd(il,i)=dnwd(il,i)+dn1 |
---|
| 4753 | !!!! enddo |
---|
| 4754 | !!!! enddo |
---|
| 4755 | !!!! |
---|
| 4756 | !!!! ENDDO |
---|
[3496] | 4757 | |
---|
| 4758 | !! DO i = 1, nlp |
---|
| 4759 | !! DO il = 1, ncum |
---|
| 4760 | !! ma(il, i) = 0 |
---|
| 4761 | !! END DO |
---|
| 4762 | !! END DO |
---|
| 4763 | !! |
---|
| 4764 | !! DO i = 1, nl |
---|
| 4765 | !! DO j = i, nl |
---|
| 4766 | !! DO il = 1, ncum |
---|
| 4767 | !! ma(il, i) = ma(il, i) + m(il, j) |
---|
| 4768 | !! END DO |
---|
| 4769 | !! END DO |
---|
| 4770 | !! END DO |
---|
| 4771 | |
---|
| 4772 | !jyg< (loops stop at nl) |
---|
| 4773 | !! DO i = nl + 1, nd |
---|
| 4774 | !! DO il = 1, ncum |
---|
| 4775 | !! ma(il, i) = 0. |
---|
| 4776 | !! END DO |
---|
| 4777 | !! END DO |
---|
| 4778 | !>jyg |
---|
| 4779 | |
---|
| 4780 | !! DO i = 1, nl |
---|
| 4781 | !! DO il = 1, ncum |
---|
| 4782 | !! IF (i<=(icb(il)-1)) THEN |
---|
| 4783 | !! ma(il, i) = 0 |
---|
| 4784 | !! END IF |
---|
| 4785 | !! END DO |
---|
| 4786 | !! END DO |
---|
| 4787 | |
---|
[2508] | 4788 | !----------------------------------------------------------- |
---|
| 4789 | ENDIF !(.NOT.ok_optim_yield) !| |
---|
| 4790 | !----------------------------------------------------------- |
---|
| 4791 | !>jyg |
---|
[1992] | 4792 | |
---|
[2007] | 4793 | ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 4794 | ! determination de la variation de flux ascendant entre |
---|
| 4795 | ! deux niveau non dilue mip |
---|
| 4796 | ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
[1992] | 4797 | |
---|
| 4798 | DO i = 1, nl |
---|
| 4799 | DO il = 1, ncum |
---|
| 4800 | mip(il, i) = m(il, i) |
---|
| 4801 | END DO |
---|
| 4802 | END DO |
---|
| 4803 | |
---|
[2393] | 4804 | !jyg< (loops stop at nl) |
---|
| 4805 | !! DO i = nl + 1, nd |
---|
| 4806 | !! DO il = 1, ncum |
---|
| 4807 | !! mip(il, i) = 0. |
---|
| 4808 | !! END DO |
---|
| 4809 | !! END DO |
---|
| 4810 | !>jyg |
---|
[1992] | 4811 | |
---|
| 4812 | |
---|
[2007] | 4813 | ! cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 4814 | ! icb represente de niveau ou se trouve la |
---|
| 4815 | ! base du nuage , et inb le top du nuage |
---|
| 4816 | ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
[1992] | 4817 | |
---|
[2259] | 4818 | !! DO i = 1, nd ! unused . jyg |
---|
| 4819 | !! DO il = 1, ncum ! unused . jyg |
---|
| 4820 | !! mke(il, i) = upwd(il, i) + dnwd(il, i) ! unused . jyg |
---|
| 4821 | !! END DO ! unused . jyg |
---|
| 4822 | !! END DO ! unused . jyg |
---|
[1992] | 4823 | |
---|
[2259] | 4824 | !! DO i = 1, nd ! unused . jyg |
---|
| 4825 | !! DO il = 1, ncum ! unused . jyg |
---|
| 4826 | !! rdcp = (rrd*(1.-rr(il,i))-rr(il,i)*rrv)/(cpd*(1.-rr(il,i))+rr(il,i)*cpv) ! unused . jyg |
---|
| 4827 | !! tls(il, i) = t(il, i)*(1000.0/p(il,i))**rdcp ! unused . jyg |
---|
| 4828 | !! tps(il, i) = tp(il, i) ! unused . jyg |
---|
| 4829 | !! END DO ! unused . jyg |
---|
| 4830 | !! END DO ! unused . jyg |
---|
[1992] | 4831 | |
---|
| 4832 | |
---|
[2007] | 4833 | ! *** diagnose the in-cloud mixing ratio *** ! cld |
---|
| 4834 | ! *** of condensed water *** ! cld |
---|
| 4835 | !! cld |
---|
| 4836 | |
---|
[2393] | 4837 | DO i = 1, nl+1 ! cld |
---|
[2007] | 4838 | DO il = 1, ncum ! cld |
---|
| 4839 | mac(il, i) = 0.0 ! cld |
---|
| 4840 | wa(il, i) = 0.0 ! cld |
---|
| 4841 | siga(il, i) = 0.0 ! cld |
---|
| 4842 | sax(il, i) = 0.0 ! cld |
---|
| 4843 | END DO ! cld |
---|
| 4844 | END DO ! cld |
---|
| 4845 | |
---|
| 4846 | DO i = minorig, nl ! cld |
---|
| 4847 | DO k = i + 1, nl + 1 ! cld |
---|
| 4848 | DO il = 1, ncum ! cld |
---|
[1992] | 4849 | IF (i<=inb(il) .AND. k<=(inb(il)+1) .AND. iflag(il)<=1) THEN ! cld |
---|
[2007] | 4850 | mac(il, i) = mac(il, i) + m(il, k) ! cld |
---|
| 4851 | END IF ! cld |
---|
| 4852 | END DO ! cld |
---|
| 4853 | END DO ! cld |
---|
| 4854 | END DO ! cld |
---|
[1992] | 4855 | |
---|
[2007] | 4856 | DO i = 1, nl ! cld |
---|
| 4857 | DO j = 1, i ! cld |
---|
| 4858 | DO il = 1, ncum ! cld |
---|
| 4859 | IF (i>=icb(il) .AND. i<=(inb(il)-1) & ! cld |
---|
| 4860 | .AND. j>=icb(il) .AND. iflag(il)<=1) THEN ! cld |
---|
| 4861 | sax(il, i) = sax(il, i) + rrd*(tvp(il,j)-tv(il,j)) & ! cld |
---|
| 4862 | *(ph(il,j)-ph(il,j+1))/p(il, j) ! cld |
---|
| 4863 | END IF ! cld |
---|
| 4864 | END DO ! cld |
---|
| 4865 | END DO ! cld |
---|
| 4866 | END DO ! cld |
---|
[1992] | 4867 | |
---|
[2007] | 4868 | DO i = 1, nl ! cld |
---|
| 4869 | DO il = 1, ncum ! cld |
---|
| 4870 | IF (i>=icb(il) .AND. i<=(inb(il)-1) & ! cld |
---|
| 4871 | .AND. sax(il,i)>0.0 .AND. iflag(il)<=1) THEN ! cld |
---|
| 4872 | wa(il, i) = sqrt(2.*sax(il,i)) ! cld |
---|
| 4873 | END IF ! cld |
---|
| 4874 | END DO ! cld |
---|
[2205] | 4875 | END DO |
---|
| 4876 | ! cld |
---|
| 4877 | DO i = 1, nl |
---|
[1992] | 4878 | |
---|
[2205] | 4879 | ! 14/01/15 AJ je remets les parties manquantes cf JYG |
---|
| 4880 | ! Initialize sument to 0 |
---|
| 4881 | |
---|
| 4882 | DO il = 1,ncum |
---|
| 4883 | sument(il) = 0. |
---|
| 4884 | ENDDO |
---|
| 4885 | |
---|
| 4886 | ! Sum mixed mass fluxes in sument |
---|
| 4887 | |
---|
| 4888 | DO k = 1,nl |
---|
| 4889 | DO il = 1,ncum |
---|
| 4890 | IF (k<=inb(il) .AND. i<=inb(il) .AND. iflag(il)<=1) THEN ! cld |
---|
| 4891 | sument(il) =sument(il) + abs(ment(il,k,i)) |
---|
[4613] | 4892 | detrain(il,i) = detrain(il,i) + abs(ment(il,k,i))*(qdet(il,k,i) - rr(il,i))*(qdet(il,k,i) - rr(il,i)) ! Louis terme de détrainement dans le bilan de variance |
---|
[2205] | 4893 | ENDIF |
---|
| 4894 | ENDDO ! il |
---|
| 4895 | ENDDO ! k |
---|
| 4896 | |
---|
[5093] | 4897 | ! 14/01/15 AJ delta n'a rien à faire là... |
---|
[2007] | 4898 | DO il = 1, ncum ! cld |
---|
[3496] | 4899 | !! IF (wa(il,i)>0.0 .AND. iflag(il)<=1) & ! cld |
---|
| 4900 | !! siga(il, i) = mac(il, i)/(coefw_cld_cv*wa(il, i)) & ! cld |
---|
| 4901 | !! *rrd*tvp(il, i)/p(il, i)/100. ! cld |
---|
| 4902 | !! |
---|
| 4903 | !! siga(il, i) = min(siga(il,i), 1.0) ! cld |
---|
| 4904 | sigaq = 0. |
---|
| 4905 | IF (wa(il,i)>0.0 .AND. iflag(il)<=1) THEN ! cld |
---|
[2205] | 4906 | siga(il, i) = mac(il, i)/(coefw_cld_cv*wa(il, i)) & ! cld |
---|
[3496] | 4907 | *rrd*tvp(il, i)/p(il, i)/100. ! cld |
---|
| 4908 | siga(il, i) = min(siga(il,i), 1.0) ! cld |
---|
| 4909 | sigaq = siga(il,i)*qta(il,i-1) ! cld |
---|
| 4910 | ENDIF |
---|
[2205] | 4911 | |
---|
| 4912 | ! IM cf. FH |
---|
[5093] | 4913 | ! 14/01/15 AJ ne correspond pas à ce qui a été codé par JYG et SB |
---|
[2205] | 4914 | |
---|
[2007] | 4915 | IF (iflag_clw==0) THEN ! cld |
---|
| 4916 | qcondc(il, i) = siga(il, i)*clw(il, i)*(1.-ep(il,i)) & ! cld |
---|
| 4917 | +(1.-siga(il,i))*qcond(il, i) ! cld |
---|
[2205] | 4918 | |
---|
| 4919 | |
---|
| 4920 | sigment(il,i)=sument(il)*tau_cld_cv/(ph(il,i)-ph(il,i+1)) ! cld |
---|
| 4921 | sigment(il, i) = min(1.e-4+sigment(il,i), 1.0 - siga(il,i)) ! cld |
---|
[3496] | 4922 | !! qtc(il, i) = (siga(il,i)*qta(il,i-1)+sigment(il,i)*qtment(il,i)) & ! cld |
---|
| 4923 | qtc(il, i) = (sigaq+sigment(il,i)*qtment(il,i)) & ! cld |
---|
[2205] | 4924 | /(siga(il,i)+sigment(il,i)) ! cld |
---|
| 4925 | sigt(il,i) = sigment(il, i) + siga(il, i) |
---|
| 4926 | |
---|
[3496] | 4927 | ! qtc(il, i) = siga(il,i)*qta(il,i-1)+(1.-siga(il,i))*qtment(il,i) ! cld |
---|
[5103] | 4928 | ! PRINT*,'BIGAUSSIAN CONV',siga(il,i),sigment(il,i),qtc(il,i) |
---|
[2205] | 4929 | |
---|
[2007] | 4930 | ELSE IF (iflag_clw==1) THEN ! cld |
---|
| 4931 | qcondc(il, i) = qcond(il, i) ! cld |
---|
[2205] | 4932 | qtc(il,i) = qtment(il,i) ! cld |
---|
[2007] | 4933 | END IF ! cld |
---|
[1992] | 4934 | |
---|
[2007] | 4935 | END DO ! cld |
---|
[1992] | 4936 | END DO |
---|
[5103] | 4937 | ! PRINT*,'cv3_yield fin' |
---|
[2007] | 4938 | |
---|
[5105] | 4939 | |
---|
[1992] | 4940 | END SUBROUTINE cv3_yield |
---|
| 4941 | |
---|
[2007] | 4942 | !AC! et !RomP >>> |
---|
| 4943 | SUBROUTINE cv3_tracer(nloc, len, ncum, nd, na, & |
---|
| 4944 | ment, sigij, da, phi, phi2, d1a, dam, & |
---|
| 4945 | ep, Vprecip, elij, clw, epmlmMm, eplaMm, & |
---|
| 4946 | icb, inb) |
---|
[1992] | 4947 | IMPLICIT NONE |
---|
| 4948 | |
---|
| 4949 | include "cv3param.h" |
---|
| 4950 | |
---|
[2007] | 4951 | !inputs: |
---|
[3126] | 4952 | INTEGER, INTENT (IN) :: ncum, nd, na, nloc, len |
---|
| 4953 | INTEGER, DIMENSION (len), INTENT (IN) :: icb, inb |
---|
| 4954 | REAL, DIMENSION (len, na, na), INTENT (IN) :: ment, sigij, elij |
---|
| 4955 | REAL, DIMENSION (len, nd), INTENT (IN) :: clw |
---|
| 4956 | REAL, DIMENSION (len, na), INTENT (IN) :: ep |
---|
| 4957 | REAL, DIMENSION (len, nd+1), INTENT (IN) :: Vprecip |
---|
[2007] | 4958 | !ouputs: |
---|
[3126] | 4959 | REAL, DIMENSION (len, na, na), INTENT (OUT) :: phi, phi2, epmlmMm |
---|
| 4960 | REAL, DIMENSION (len, na), INTENT (OUT) :: da, d1a, dam, eplaMm |
---|
[5099] | 4961 | |
---|
[2007] | 4962 | ! variables pour tracer dans precip de l'AA et des mel |
---|
| 4963 | !local variables: |
---|
[1992] | 4964 | INTEGER i, j, k |
---|
| 4965 | REAL epm(nloc, na, na) |
---|
| 4966 | |
---|
[2007] | 4967 | ! variables d'Emanuel : du second indice au troisieme |
---|
| 4968 | ! ---> tab(i,k,j) -> de l origine k a l arrivee j |
---|
| 4969 | ! ment, sigij, elij |
---|
| 4970 | ! variables personnelles : du troisieme au second indice |
---|
| 4971 | ! ---> tab(i,j,k) -> de k a j |
---|
| 4972 | ! phi, phi2 |
---|
[1992] | 4973 | |
---|
[2007] | 4974 | ! initialisations |
---|
[1992] | 4975 | |
---|
| 4976 | da(:, :) = 0. |
---|
| 4977 | d1a(:, :) = 0. |
---|
| 4978 | dam(:, :) = 0. |
---|
| 4979 | epm(:, :, :) = 0. |
---|
[2007] | 4980 | eplaMm(:, :) = 0. |
---|
| 4981 | epmlmMm(:, :, :) = 0. |
---|
[1992] | 4982 | phi(:, :, :) = 0. |
---|
| 4983 | phi2(:, :, :) = 0. |
---|
| 4984 | |
---|
[2007] | 4985 | ! fraction deau condensee dans les melanges convertie en precip : epm |
---|
[5093] | 4986 | ! et eau condensée précipitée dans masse d'air saturé : l_m*dM_m/dzdz.dzdz |
---|
[2393] | 4987 | DO j = 1, nl |
---|
| 4988 | DO k = 1, nl |
---|
[1992] | 4989 | DO i = 1, ncum |
---|
[2007] | 4990 | IF (k>=icb(i) .AND. k<=inb(i) .AND. & |
---|
[5117] | 4991 | !!jyg j.ge.k.AND.j.le.inb(i)) THEN |
---|
[2007] | 4992 | !!jyg epm(i,j,k)=1.-(1.-ep(i,j))*clw(i,j)/elij(i,k,j) |
---|
[1992] | 4993 | j>k .AND. j<=inb(i)) THEN |
---|
| 4994 | epm(i, j, k) = 1. - (1.-ep(i,j))*clw(i, j)/max(elij(i,k,j), 1.E-16) |
---|
[2007] | 4995 | !! |
---|
[1992] | 4996 | epm(i, j, k) = max(epm(i,j,k), 0.0) |
---|
| 4997 | END IF |
---|
| 4998 | END DO |
---|
| 4999 | END DO |
---|
| 5000 | END DO |
---|
| 5001 | |
---|
| 5002 | |
---|
[2393] | 5003 | DO j = 1, nl |
---|
| 5004 | DO k = 1, nl |
---|
[1992] | 5005 | DO i = 1, ncum |
---|
| 5006 | IF (k>=icb(i) .AND. k<=inb(i)) THEN |
---|
[2007] | 5007 | eplaMm(i, j) = eplamm(i, j) + & |
---|
| 5008 | ep(i, j)*clw(i, j)*ment(i, j, k)*(1.-sigij(i,j,k)) |
---|
[1992] | 5009 | END IF |
---|
| 5010 | END DO |
---|
| 5011 | END DO |
---|
| 5012 | END DO |
---|
| 5013 | |
---|
[2393] | 5014 | DO j = 1, nl |
---|
[1992] | 5015 | DO k = 1, j - 1 |
---|
| 5016 | DO i = 1, ncum |
---|
| 5017 | IF (k>=icb(i) .AND. k<=inb(i) .AND. j<=inb(i)) THEN |
---|
[2007] | 5018 | epmlmMm(i, j, k) = epm(i, j, k)*elij(i, k, j)*ment(i, k, j) |
---|
[1992] | 5019 | END IF |
---|
| 5020 | END DO |
---|
| 5021 | END DO |
---|
| 5022 | END DO |
---|
| 5023 | |
---|
[2007] | 5024 | ! matrices pour calculer la tendance des concentrations dans cvltr.F90 |
---|
[2393] | 5025 | DO j = 1, nl |
---|
| 5026 | DO k = 1, nl |
---|
[1992] | 5027 | DO i = 1, ncum |
---|
| 5028 | da(i, j) = da(i, j) + (1.-sigij(i,k,j))*ment(i, k, j) |
---|
| 5029 | phi(i, j, k) = sigij(i, k, j)*ment(i, k, j) |
---|
| 5030 | d1a(i, j) = d1a(i, j) + ment(i, k, j)*ep(i, k)*(1.-sigij(i,k,j)) |
---|
| 5031 | IF (k<=j) THEN |
---|
[2007] | 5032 | dam(i, j) = dam(i, j) + ment(i, k, j)*epm(i, k, j)*(1.-ep(i,k))*(1.-sigij(i,k,j)) |
---|
[1992] | 5033 | phi2(i, j, k) = phi(i, j, k)*epm(i, j, k) |
---|
| 5034 | END IF |
---|
| 5035 | END DO |
---|
| 5036 | END DO |
---|
| 5037 | END DO |
---|
| 5038 | |
---|
[5105] | 5039 | |
---|
[1992] | 5040 | END SUBROUTINE cv3_tracer |
---|
[2007] | 5041 | !AC! et !RomP <<< |
---|
[1992] | 5042 | |
---|
[2007] | 5043 | SUBROUTINE cv3_uncompress(nloc, len, ncum, nd, ntra, idcum, & |
---|
| 5044 | iflag, & |
---|
| 5045 | precip, sig, w0, & |
---|
| 5046 | ft, fq, fu, fv, ftra, & |
---|
| 5047 | Ma, upwd, dnwd, dnwd0, qcondc, wd, cape, & |
---|
[2481] | 5048 | epmax_diag, & ! epmax_cape |
---|
[2007] | 5049 | iflag1, & |
---|
| 5050 | precip1, sig1, w01, & |
---|
| 5051 | ft1, fq1, fu1, fv1, ftra1, & |
---|
[2481] | 5052 | Ma1, upwd1, dnwd1, dnwd01, qcondc1, wd1, cape1, & |
---|
| 5053 | epmax_diag1) ! epmax_cape |
---|
[1992] | 5054 | IMPLICIT NONE |
---|
| 5055 | |
---|
| 5056 | include "cv3param.h" |
---|
| 5057 | |
---|
[2007] | 5058 | !inputs: |
---|
[1992] | 5059 | INTEGER len, ncum, nd, ntra, nloc |
---|
| 5060 | INTEGER idcum(nloc) |
---|
| 5061 | INTEGER iflag(nloc) |
---|
| 5062 | REAL precip(nloc) |
---|
| 5063 | REAL sig(nloc, nd), w0(nloc, nd) |
---|
| 5064 | REAL ft(nloc, nd), fq(nloc, nd), fu(nloc, nd), fv(nloc, nd) |
---|
| 5065 | REAL ftra(nloc, nd, ntra) |
---|
| 5066 | REAL ma(nloc, nd) |
---|
| 5067 | REAL upwd(nloc, nd), dnwd(nloc, nd), dnwd0(nloc, nd) |
---|
| 5068 | REAL qcondc(nloc, nd) |
---|
| 5069 | REAL wd(nloc), cape(nloc) |
---|
[2481] | 5070 | REAL epmax_diag(nloc) |
---|
[1992] | 5071 | |
---|
[2007] | 5072 | !outputs: |
---|
[1992] | 5073 | INTEGER iflag1(len) |
---|
| 5074 | REAL precip1(len) |
---|
| 5075 | REAL sig1(len, nd), w01(len, nd) |
---|
| 5076 | REAL ft1(len, nd), fq1(len, nd), fu1(len, nd), fv1(len, nd) |
---|
| 5077 | REAL ftra1(len, nd, ntra) |
---|
| 5078 | REAL ma1(len, nd) |
---|
| 5079 | REAL upwd1(len, nd), dnwd1(len, nd), dnwd01(len, nd) |
---|
| 5080 | REAL qcondc1(nloc, nd) |
---|
| 5081 | REAL wd1(nloc), cape1(nloc) |
---|
[2481] | 5082 | REAL epmax_diag1(len) ! epmax_cape |
---|
[1992] | 5083 | |
---|
[2007] | 5084 | !local variables: |
---|
[1992] | 5085 | INTEGER i, k, j |
---|
| 5086 | |
---|
| 5087 | DO i = 1, ncum |
---|
| 5088 | precip1(idcum(i)) = precip(i) |
---|
| 5089 | iflag1(idcum(i)) = iflag(i) |
---|
| 5090 | wd1(idcum(i)) = wd(i) |
---|
| 5091 | cape1(idcum(i)) = cape(i) |
---|
[2481] | 5092 | epmax_diag1(idcum(i))=epmax_diag(i) ! epmax_cape |
---|
[1992] | 5093 | END DO |
---|
| 5094 | |
---|
| 5095 | DO k = 1, nl |
---|
| 5096 | DO i = 1, ncum |
---|
| 5097 | sig1(idcum(i), k) = sig(i, k) |
---|
| 5098 | w01(idcum(i), k) = w0(i, k) |
---|
| 5099 | ft1(idcum(i), k) = ft(i, k) |
---|
| 5100 | fq1(idcum(i), k) = fq(i, k) |
---|
| 5101 | fu1(idcum(i), k) = fu(i, k) |
---|
| 5102 | fv1(idcum(i), k) = fv(i, k) |
---|
| 5103 | ma1(idcum(i), k) = ma(i, k) |
---|
| 5104 | upwd1(idcum(i), k) = upwd(i, k) |
---|
| 5105 | dnwd1(idcum(i), k) = dnwd(i, k) |
---|
| 5106 | dnwd01(idcum(i), k) = dnwd0(i, k) |
---|
| 5107 | qcondc1(idcum(i), k) = qcondc(i, k) |
---|
| 5108 | END DO |
---|
| 5109 | END DO |
---|
| 5110 | |
---|
| 5111 | DO i = 1, ncum |
---|
| 5112 | sig1(idcum(i), nd) = sig(i, nd) |
---|
| 5113 | END DO |
---|
| 5114 | |
---|
| 5115 | |
---|
[2007] | 5116 | !AC! do 2100 j=1,ntra |
---|
| 5117 | !AC!c oct3 do 2110 k=1,nl |
---|
| 5118 | !AC! do 2110 k=1,nd ! oct3 |
---|
| 5119 | !AC! do 2120 i=1,ncum |
---|
| 5120 | !AC! ftra1(idcum(i),k,j)=ftra(i,k,j) |
---|
| 5121 | !AC! 2120 continue |
---|
| 5122 | !AC! 2110 continue |
---|
| 5123 | !AC! 2100 continue |
---|
[5099] | 5124 | |
---|
[5105] | 5125 | |
---|
[1992] | 5126 | END SUBROUTINE cv3_uncompress |
---|
[2481] | 5127 | |
---|
| 5128 | |
---|
[5103] | 5129 | SUBROUTINE cv3_epmax_fn_cape(nloc,ncum,nd & |
---|
[2481] | 5130 | , ep,hp,icb,inb,clw,nk,t,h,hnk,lv,lf,frac & |
---|
| 5131 | , pbase, p, ph, tv, buoy, sig, w0,iflag & |
---|
| 5132 | , epmax_diag) |
---|
[5113] | 5133 | IMPLICIT NONE |
---|
[2481] | 5134 | |
---|
| 5135 | ! On fait varier epmax en fn de la cape |
---|
[5093] | 5136 | ! Il faut donc recalculer ep, et hp qui a déjà été calculé et |
---|
| 5137 | ! qui en dépend |
---|
| 5138 | ! Toutes les autres variables fn de ep sont calculées plus bas. |
---|
[2481] | 5139 | |
---|
| 5140 | include "cvthermo.h" |
---|
| 5141 | include "cv3param.h" |
---|
| 5142 | include "conema3.h" |
---|
| 5143 | include "cvflag.h" |
---|
| 5144 | |
---|
| 5145 | ! inputs: |
---|
| 5146 | INTEGER, INTENT (IN) :: ncum, nd, nloc |
---|
| 5147 | INTEGER, DIMENSION (nloc), INTENT (IN) :: icb, inb, nk |
---|
| 5148 | REAL, DIMENSION (nloc), INTENT (IN) :: hnk,pbase |
---|
| 5149 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: t, lv, lf, tv, h |
---|
| 5150 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: clw, buoy,frac |
---|
| 5151 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: sig,w0 |
---|
| 5152 | INTEGER, DIMENSION (nloc), INTENT (IN) :: iflag(nloc) |
---|
| 5153 | REAL, DIMENSION (nloc, nd), INTENT (IN) :: p |
---|
| 5154 | REAL, DIMENSION (nloc, nd+1), INTENT (IN) :: ph |
---|
| 5155 | ! inouts: |
---|
| 5156 | REAL, DIMENSION (nloc, nd), INTENT (INOUT) :: ep,hp |
---|
| 5157 | ! outputs |
---|
| 5158 | REAL, DIMENSION (nloc), INTENT (OUT) :: epmax_diag |
---|
| 5159 | |
---|
| 5160 | ! local |
---|
[5117] | 5161 | INTEGER i,k |
---|
[2481] | 5162 | ! real hp_bak(nloc,nd) |
---|
| 5163 | ! real ep_bak(nloc,nd) |
---|
[5117] | 5164 | REAL m_loc(nloc,nd) |
---|
| 5165 | REAL sig_loc(nloc,nd) |
---|
| 5166 | REAL w0_loc(nloc,nd) |
---|
| 5167 | INTEGER iflag_loc(nloc) |
---|
| 5168 | REAL cape(nloc) |
---|
[2481] | 5169 | |
---|
[5117] | 5170 | IF (coef_epmax_cape>1e-12) THEN |
---|
[2481] | 5171 | ! il faut calculer la cape: on fait un calcule simple car tant qu'on ne |
---|
[5093] | 5172 | ! connait pas ep, on ne connait pas les mélanges, ddfts etc... qui sont |
---|
[2481] | 5173 | ! necessaires au calcul de la cape dans la nouvelle physique |
---|
| 5174 | |
---|
[5116] | 5175 | ! WRITE(*,*) 'cv3_routines check 4303' |
---|
[2481] | 5176 | do i=1,ncum |
---|
| 5177 | do k=1,nd |
---|
| 5178 | sig_loc(i,k)=sig(i,k) |
---|
| 5179 | w0_loc(i,k)=w0(i,k) |
---|
| 5180 | iflag_loc(i)=iflag(i) |
---|
| 5181 | ! ep_bak(i,k)=ep(i,k) |
---|
| 5182 | enddo ! do k=1,nd |
---|
| 5183 | enddo !do i=1,ncum |
---|
| 5184 | |
---|
[5116] | 5185 | ! WRITE(*,*) 'cv3_routines check 4311' |
---|
| 5186 | ! WRITE(*,*) 'nl=',nl |
---|
[2481] | 5187 | CALL cv3_closure(nloc, ncum, nd, icb, inb, & ! na->nd |
---|
| 5188 | pbase, p, ph, tv, buoy, & |
---|
| 5189 | sig_loc, w0_loc, cape, m_loc,iflag_loc) |
---|
| 5190 | |
---|
[5116] | 5191 | ! WRITE(*,*) 'cv3_routines check 4316' |
---|
| 5192 | ! WRITE(*,*) 'ep(1,:)=',ep(1,:) |
---|
[2481] | 5193 | do i=1,ncum |
---|
| 5194 | epmax_diag(i)=epmax-coef_epmax_cape*sqrt(cape(i)) |
---|
| 5195 | epmax_diag(i)=amax1(epmax_diag(i),0.0) |
---|
[5116] | 5196 | ! WRITE(*,*) 'i,icb,inb,cape,epmax_diag=', & |
---|
[2481] | 5197 | ! i,icb(i),inb(i),cape(i),epmax_diag(i) |
---|
| 5198 | do k=1,nl |
---|
| 5199 | ep(i,k)=ep(i,k)/epmax*epmax_diag(i) |
---|
| 5200 | ep(i,k)=amax1(ep(i,k),0.0) |
---|
| 5201 | ep(i,k)=amin1(ep(i,k),epmax_diag(i)) |
---|
| 5202 | enddo |
---|
| 5203 | enddo |
---|
[5116] | 5204 | ! WRITE(*,*) 'ep(1,:)=',ep(1,:) |
---|
[2481] | 5205 | |
---|
[5116] | 5206 | !WRITE(*,*) 'cv3_routines check 4326' |
---|
[2481] | 5207 | ! On recalcule hp: |
---|
| 5208 | ! do k=1,nl |
---|
| 5209 | ! do i=1,ncum |
---|
| 5210 | ! hp_bak(i,k)=hp(i,k) |
---|
| 5211 | ! enddo |
---|
| 5212 | ! enddo |
---|
| 5213 | do k=1,nl |
---|
| 5214 | do i=1,ncum |
---|
[3496] | 5215 | hp(i,k)=h(i,k) |
---|
| 5216 | enddo |
---|
[2481] | 5217 | enddo |
---|
| 5218 | |
---|
| 5219 | IF (cvflag_ice) THEN |
---|
| 5220 | |
---|
| 5221 | do k=minorig+1,nl |
---|
| 5222 | do i=1,ncum |
---|
[5117] | 5223 | IF((k>=icb(i)).AND.(k<=inb(i)))THEN |
---|
[2481] | 5224 | hp(i, k) = hnk(i) + (lv(i,k)+(cpd-cpv)*t(i,k)+frac(i,k)*lf(i,k))* & |
---|
| 5225 | ep(i, k)*clw(i, k) |
---|
| 5226 | endif |
---|
| 5227 | enddo |
---|
| 5228 | enddo !do k=minorig+1,n |
---|
| 5229 | ELSE !IF (cvflag_ice) THEN |
---|
| 5230 | |
---|
| 5231 | DO k = minorig + 1, nl |
---|
| 5232 | DO i = 1, ncum |
---|
| 5233 | IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN |
---|
| 5234 | hp(i,k)=hnk(i)+(lv(i,k)+(cpd-cpv)*t(i,k))*ep(i,k)*clw(i,k) |
---|
| 5235 | endif |
---|
| 5236 | enddo |
---|
| 5237 | enddo !do k=minorig+1,n |
---|
| 5238 | |
---|
| 5239 | ENDIF !IF (cvflag_ice) THEN |
---|
[5116] | 5240 | !WRITE(*,*) 'cv3_routines check 4345' |
---|
[2481] | 5241 | ! do i=1,ncum |
---|
| 5242 | ! do k=1,nl |
---|
[5117] | 5243 | ! if ((abs(hp_bak(i,k)-hp(i,k))/hp_bak(i,k).gt.1e-1).OR. & |
---|
| 5244 | ! ((abs(hp_bak(i,k)-hp(i,k))/hp_bak(i,k).gt.1e-4).AND. & |
---|
[5116] | 5245 | ! (ep(i,k)-ep_bak(i,k).lt.1e-4))) THEN |
---|
| 5246 | ! WRITE(*,*) 'i,k=',i,k |
---|
| 5247 | ! WRITE(*,*) 'coef_epmax_cape=',coef_epmax_cape |
---|
| 5248 | ! WRITE(*,*) 'epmax_diag(i)=',epmax_diag(i) |
---|
| 5249 | ! WRITE(*,*) 'ep(i,k)=',ep(i,k) |
---|
| 5250 | ! WRITE(*,*) 'ep_bak(i,k)=',ep_bak(i,k) |
---|
| 5251 | ! WRITE(*,*) 'hp(i,k)=',hp(i,k) |
---|
| 5252 | ! WRITE(*,*) 'hp_bak(i,k)=',hp_bak(i,k) |
---|
| 5253 | ! WRITE(*,*) 'h(i,k)=',h(i,k) |
---|
| 5254 | ! WRITE(*,*) 'nk(i)=',nk(i) |
---|
| 5255 | ! WRITE(*,*) 'h(i,nk(i))=',h(i,nk(i)) |
---|
| 5256 | ! WRITE(*,*) 'lv(i,k)=',lv(i,k) |
---|
| 5257 | ! WRITE(*,*) 't(i,k)=',t(i,k) |
---|
| 5258 | ! WRITE(*,*) 'clw(i,k)=',clw(i,k) |
---|
| 5259 | ! WRITE(*,*) 'cpd,cpv=',cpd,cpv |
---|
[2481] | 5260 | ! stop |
---|
| 5261 | ! endif |
---|
| 5262 | ! enddo !do k=1,nl |
---|
| 5263 | ! enddo !do i=1,ncum |
---|
[5116] | 5264 | endif !if (coef_epmax_cape.gt.1e-12) THEN |
---|
| 5265 | !WRITE(*,*) 'cv3_routines check 4367' |
---|
[2481] | 5266 | |
---|
[5105] | 5267 | |
---|
[5103] | 5268 | END SUBROUTINE cv3_epmax_fn_cape |
---|
[2481] | 5269 | |
---|
| 5270 | |
---|
| 5271 | |
---|