73 subroutine tempo_main(tempo_cfgs, &
74 qv1d, qc1d, qi1d, qr1d, qs1d, qg1d, qb1d, ni1d, nr1d, nc1d, ng1d, &
75 nwfa1d, nifa1d, t1d, p1d, w1d, dz1d, land1d, &
76 qcfrac1d, qifrac1d, qc_bl1d, qcfrac_bl1d, &
77 thten_bl1d, qvten_bl1d, qcten_bl1d, qiten_bl1d, &
78 thten_lwrad1d, thten_swrad1d, &
79 kts, kte, dt, ii, jj, tempo_main_diags)
86 integer,
intent(in) :: kts, kte, ii, jj
87 real(wp),
intent(in) :: dt
88 real(wp),
dimension(kts:kte),
intent(inout) :: t1d
89 real(wp),
dimension(kts:kte),
intent(in) :: p1d
90 real(wp),
dimension(kts:kte),
intent(inout) :: qv1d
91 real(wp),
dimension(kts:kte),
intent(inout) :: qc1d
92 real(wp),
dimension(kts:kte),
intent(inout) :: qr1d
93 real(wp),
dimension(kts:kte),
intent(inout) :: qi1d
94 real(wp),
dimension(kts:kte),
intent(inout) :: qs1d
95 real(wp),
dimension(kts:kte),
intent(inout) :: qg1d
96 real(wp),
dimension(kts:kte),
intent(inout) :: ni1d
97 real(wp),
dimension(kts:kte),
intent(inout) :: nr1d
98 real(wp),
dimension(:),
intent(inout),
optional :: nc1d
99 real(wp),
dimension(:),
intent(inout),
optional :: nwfa1d
100 real(wp),
dimension(:),
intent(inout),
optional :: nifa1d
101 real(wp),
dimension(:),
intent(inout),
optional :: qb1d
102 real(wp),
dimension(:),
intent(inout),
optional :: ng1d
103 real(wp),
dimension(kts:kte),
intent(in) :: w1d
104 real(wp),
dimension(kts:kte),
intent(in) :: dz1d
105 integer,
intent(in),
optional :: land1d
108 real(wp),
dimension(:),
intent(inout),
optional :: qcfrac1d
109 real(wp),
dimension(:),
intent(inout),
optional :: qifrac1d
110 real(wp),
dimension(:),
intent(in),
optional :: qc_bl1d
111 real(wp),
dimension(:),
intent(in),
optional :: qcfrac_bl1d
112 real(wp),
dimension(:),
intent(in),
optional :: thten_bl1d
113 real(wp),
dimension(:),
intent(in),
optional :: qvten_bl1d
114 real(wp),
dimension(:),
intent(in),
optional :: qcten_bl1d
115 real(wp),
dimension(:),
intent(in),
optional :: qiten_bl1d
116 real(wp),
dimension(:),
intent(in),
optional :: thten_lwrad1d
117 real(wp),
dimension(:),
intent(in),
optional :: thten_swrad1d
119 real(wp),
dimension(kts:kte) :: tten, qvten, qcten, qiten, qrten, qsten, &
120 qgten, qbten, niten, nrten, ncten, ngten, nwfaten, nifaten
122 logical,
dimension(kts:kte) :: l_qc, l_qi, l_qr, l_qs, l_qg
123 integer,
dimension(kts:kte) :: idx_bg
126 real(wp),
dimension(kts:kte) :: temp, pres, qv
127 real(wp),
dimension(kts:kte) :: rho, rhof, rhof2
128 real(wp),
dimension(kts:kte) :: qvs, qvsi, delqvs
129 real(wp),
dimension(kts:kte) :: satw, sati, ssatw, ssati
130 real(wp),
dimension(kts:kte) :: diffu, visco, vsc2, tcond, lvap, ocp, lvt2
132 real(wp),
dimension(kts:kte) :: rc, ri, rr, rs, rg, rb
133 real(wp),
dimension(kts:kte) :: ni, nr, nc, ng, nwfa, nifa
135 real(dp),
dimension(kts:kte) :: ilamc, ilami, ilamr, ilamg
136 real(wp),
dimension(kts:kte) :: mvd_r, mvd_c, mvd_g
137 real(dp),
dimension(kts:kte) :: smob, smo2, smo1, smo0, smoc, smoe, smof, smog, ns, smoz
139 real(wp),
dimension(kts:kte) :: xrx, xnx
140 real(wp),
dimension(:),
allocatable :: xncx, xngx, xqbx, ncsave
142 real(wp),
dimension(kts:kte+1) :: vtrr, vtnr, vtrs, vtri, vtni, vtrg, vtng, vtrc, vtnc
143 real(wp),
dimension(kts:kte) :: vtboost
144 integer :: substeps_sedi, ktop_sedi, n
145 real(wp) :: semi_sedi_factor
147 real(dp),
target,
dimension(kts:kte, 74) :: tend_work
150 real(wp) :: tempc, tc0, odt
151 logical :: do_micro, supersaturated
152 logical,
save :: first_call_main = .true.
157 supersaturated = .false.
164 tend%prr_wau => tend_work(:, 1)
165 tend%pnr_wau => tend_work(:, 2)
166 tend%pnc_wau => tend_work(:, 3)
167 tend%prr_rcw => tend_work(:, 4)
168 tend%pnc_rcw => tend_work(:, 5)
169 tend%pnr_rcr => tend_work(:, 6)
172 tend%prs_scw => tend_work(:, 7)
173 tend%pnc_scw => tend_work(:, 8)
174 tend%png_scw => tend_work(:, 9)
175 tend%pbg_scw => tend_work(:, 10)
176 tend%prg_gcw => tend_work(:, 11)
177 tend%pnc_gcw => tend_work(:, 12)
178 tend%pbg_gcw => tend_work(:, 13)
179 tend%pri_ihm => tend_work(:, 14)
180 tend%pni_ihm => tend_work(:, 15)
181 tend%prs_ihm => tend_work(:, 16)
182 tend%prg_ihm => tend_work(:, 17)
183 tend%prg_scw => tend_work(:, 18)
186 tend%prr_rcs => tend_work(:, 19)
187 tend%pnr_rcs => tend_work(:, 20)
188 tend%prg_rcs => tend_work(:, 21)
189 tend%png_rcs => tend_work(:, 22)
190 tend%prs_rcs => tend_work(:, 23)
191 tend%pbg_rcs => tend_work(:, 24)
194 tend%prr_rcg => tend_work(:, 25)
195 tend%pnr_rcg => tend_work(:, 26)
196 tend%prg_rcg => tend_work(:, 27)
197 tend%png_rcg => tend_work(:, 28)
198 tend%pbg_rcg => tend_work(:, 29)
201 tend%pri_inu => tend_work(:, 30)
202 tend%pni_inu => tend_work(:, 31)
203 tend%pri_iha => tend_work(:, 32)
204 tend%pni_iha => tend_work(:, 33)
207 tend%pri_wfz => tend_work(:, 34)
208 tend%pni_wfz => tend_work(:, 35)
211 tend%prg_rfz => tend_work(:, 36)
212 tend%png_rfz => tend_work(:, 37)
213 tend%pnr_rfz => tend_work(:, 38)
214 tend%pri_rfz => tend_work(:, 39)
215 tend%pni_rfz => tend_work(:, 40)
216 tend%pbg_rfz => tend_work(:, 41)
219 tend%prs_sde => tend_work(:, 42)
220 tend%pri_ide => tend_work(:, 43)
221 tend%pni_ide => tend_work(:, 44)
222 tend%prs_ide => tend_work(:, 45)
223 tend%prg_gde => tend_work(:, 46)
224 tend%png_gde => tend_work(:, 47)
227 tend%pni_iau => tend_work(:, 48)
228 tend%prs_iau => tend_work(:, 49)
231 tend%prr_sml => tend_work(:, 50)
232 tend%prr_gml => tend_work(:, 51)
233 tend%pbg_sml => tend_work(:, 52)
234 tend%pbg_gml => tend_work(:, 53)
235 tend%pnr_sml => tend_work(:, 54)
236 tend%pnr_gml => tend_work(:, 55)
239 tend%prr_rci => tend_work(:, 56)
240 tend%pnr_rci => tend_work(:, 57)
241 tend%pri_rci => tend_work(:, 58)
242 tend%pni_rci => tend_work(:, 59)
243 tend%prg_rci => tend_work(:, 60)
244 tend%png_rci => tend_work(:, 61)
245 tend%pbg_rci => tend_work(:, 62)
248 tend%pni_sci => tend_work(:, 63)
249 tend%prs_sci => tend_work(:, 64)
252 tend%prw_vcd => tend_work(:, 65)
253 tend%pnc_wcd => tend_work(:, 66)
254 tend%prv_rev => tend_work(:, 67)
255 tend%pnr_rev => tend_work(:, 68)
258 tend%pna_rca => tend_work(:, 69)
259 tend%pna_sca => tend_work(:, 70)
260 tend%pna_gca => tend_work(:, 71)
261 tend%pnd_rcd => tend_work(:, 72)
262 tend%pnd_scd => tend_work(:, 73)
263 tend%pnd_gcd => tend_work(:, 74)
310 tempo_main_diags%rain_precip = 0._wp
311 tempo_main_diags%cloud_precip = 0._wp
312 tempo_main_diags%ice_liquid_equiv_precip = 0._wp
313 tempo_main_diags%snow_liquid_equiv_precip = 0._wp
314 tempo_main_diags%graupel_liquid_equiv_precip = 0._wp
315 tempo_main_diags%frz_rain_precip = 0._wp
320 qv(k) = max(min_qv, qv1d(k))
322 rho(k) = roverrv*pres(k)/(rdry*temp(k)*(qv(k)+roverrv))
325 if (
present(nwfa1d))
then
326 if (first_call_main)
then
327 if (sum(nwfa1d) < eps)
call init_water_friendly_aerosols(dz1d, nwfa)
330 call init_water_friendly_aerosols(dz1d, nwfa)
333 if (
present(nifa1d))
then
334 if (first_call_main)
then
335 if (sum(nifa1d) < eps)
call init_ice_friendly_aerosols(dz1d, nifa)
338 call init_ice_friendly_aerosols(dz1d, nifa)
341 call aerosol_check_and_update(rho=rho, nwfa1d=nwfa1d, nifa1d=nifa1d, &
342 nwfa=nwfa, nifa=nifa, nwfaten=nwfaten, nifaten=nifaten, dt=dt)
344 call rain_check_and_update(rho, l_qr, qr1d, nr1d, rr, nr, qrten, nrten, ilamr, mvd_r, dt, odt)
346 call ice_check_and_update(rho, l_qi, qi1d, ni1d, ri, ni, qiten, niten, ilami, dt, odt)
348 call snow_check_and_update(rho, l_qs, qs1d, rs, qsten, dt, odt)
352 tc0 = min(-0.1, temp(k)-t0)
353 call snow_moments(rs=rs(k), tc=tc0, &
354 smob=smob(k), smoc=smoc(k), ns=ns(k), &
355 smo0=smo0(k), smo1=smo1(k), smo2=smo2(k), &
356 smoe=smoe(k), smof=smof(k), smog=smog(k))
361 if (.not.
present(nc1d))
then
362 if (tempo_cfgs%ml_for_nc_flag)
then
364 where(xrx <= 1.e-12_wp) xrx = 0._wp
370 if (
present(land1d))
then
373 nc = tempo_cfgs%get_nc_val(val_land=nt_c_l, val_ocean=nt_c_o)
376 allocate(ncsave(nz), source=nc)
379 call cloud_check_and_update(rho=rho, l_qc=l_qc, qc1d=qc1d, nc1d=nc1d, &
380 ncsave=ncsave, rc=rc, nc=nc, qcten=qcten, ncten=ncten, ilamc=ilamc, mvd_c=mvd_c, &
384 if (first_call_main)
then
385 if (
present(ng1d) .and.
present(qb1d))
then
386 if (sum(qg1d) > r1 .and. sum(ng1d) < eps .and. sum(qb1d) < eps)
then
387 call graupel_init(rho, qg1d, ng1d, qb1d)
391 call graupel_check_and_update(rho=rho, l_qg=l_qg, qg1d=qg1d, ng1d=ng1d, &
392 qb1d=qb1d, rg=rg, ng=ng, rb=rb, idx=idx_bg, qgten=qgten, ngten=ngten, &
393 qbten=qbten, ilamg=ilamg, mvd_g=mvd_g, dt=dt, odt=odt)
409 call thermo_vars(qv, temp, pres, rho, rhof, rhof2, qvs, delqvs, qvsi, &
410 satw, sati, ssatw, ssati, diffu, visco, vsc2, ocp, lvap, tcond, lvt2, &
413 if (first_call_main) first_call_main = .false.
416 do_micro = any(l_qc) .or. any(l_qr) .or. any(l_qi) .or. any(l_qs) .or. any(l_qg)
417 if (.not. do_micro .and. .not. supersaturated)
return
420 if (.not. tempo_cfgs%turn_off_micro_flag)
then
421 call warm_rain(rhof, l_qc, rc, nc, ilamc, mvd_c, l_qr, rr, nr, mvd_r, tend, odt)
423 if (.not. tempo_cfgs%turn_off_micro_flag)
then
424 call rain_snow_rain_graupel(temp, l_qr, rr, nr, ilamr, l_qs, rs, &
425 l_qg, rg, ng, ilamg, idx_bg, tend, odt)
427 if (.not. tempo_cfgs%turn_off_micro_flag)
then
428 call ice_nucleation(temp, rho, w1d, qv, qvsi, ssati, ssatw, &
429 nwfa1d, nifa1d, nwfa, nifa, ni, smo0, rc, nc, rr, nr, ilamr, tend, dt, odt)
431 if (.not. tempo_cfgs%turn_off_micro_flag)
then
432 call ice_processes(rhof, rhof2, rho, w1d, temp, qv, qvsi, tcond, diffu, &
433 vsc2, ssati, l_qi, ri, ni, ilami, l_qs, rs, smoe, smof, smo1, rr, nr, &
434 ilamr, mvd_r, l_qg, rg, ng, ilamg, idx_bg, tend, odt)
436 if (.not. tempo_cfgs%turn_off_micro_flag)
then
437 call riming(temp, rhof, visco, l_qc, rc, nc, ilamc, mvd_c, l_qs, rs, &
438 smo0, smob, smoc, smoe, vtboost, l_qg, rg, ng, ilamg, idx_bg, tend, odt)
440 if (.not. tempo_cfgs%turn_off_micro_flag)
then
441 call melting(rhof2, rho, temp, qvsi, tcond, diffu, vsc2, ssati, delqvs, &
442 l_qs, rs, smof, smo0, smo1, l_qg, rg, ng, ilamg, idx_bg, tend, dt, odt)
444 if (.not. tempo_cfgs%turn_off_micro_flag)
then
445 if (
present(nwfa1d) .or.
present(nifa1d))
then
446 call aerosol_scavenging(temp, rho, rhof, visco, nwfa, nifa, l_qr, nr, ilamr, &
447 mvd_r, l_qs, rs, smob, smoc, smoe, l_qg, rg, ng, ilamg, idx_bg, tend, odt)
452 call check_over_depletion(rho, temp, qvsi, qv, l_qc, rc, l_qi, ri, &
453 l_qr, rr, l_qs, rs, l_qg, rg, tend, odt)
455 call sum_tendencies(rho, temp, idx_bg, lvap, ocp, tend, tten, qvten, qcten, &
456 ncten, qiten, niten, qsten, qrten, nrten, qgten, ngten, qbten)
460 temp(k) = t1d(k) + tten(k)*dt
462 qv(k) = max(min_qv, qv1d(k) + qvten(k)*dt)
463 rho(k) = roverrv*pres(k)/(rdry*temp(k)*(qv(k)+roverrv))
464 nwfaten(k) = nwfaten(k) - (tend%pna_rca(k) + tend%pna_sca(k) + tend%pna_gca(k) + &
465 tend%pni_iha(k)) / rho(k)
466 nifaten(k) = nifaten(k) - (tend%pnd_rcd(k) + tend%pnd_scd(k) + tend%pnd_gcd(k)) / rho(k)
470 call aerosol_check_and_update(rho=rho, nwfa1d=nwfa1d, nifa1d=nifa1d, &
471 nwfa=nwfa, nifa=nifa, nwfaten=nwfaten, nifaten=nifaten, dt=dt)
475 if (
present(nc1d))
then
476 if (.not.
allocated(xncx))
allocate(xncx(nz), source=0._wp)
479 call cloud_check_and_update(rho=rho, l_qc=l_qc, qc1d=xrx, nc1d=xncx, &
480 ncsave=ncsave, rc=rc, nc=nc, qcten=qcten, ncten=ncten, ilamc=ilamc, mvd_c=mvd_c, &
485 call rain_check_and_update(rho, l_qr, xrx, xnx, rr, nr, qrten, nrten, ilamr, mvd_r, dt, odt)
489 call ice_check_and_update(rho, l_qi, xrx, xnx, ri, ni, qiten, niten, ilami, dt, odt)
492 call snow_check_and_update(rho, l_qs, xrx, rs, qsten, dt, odt)
505 tc0 = min(-0.1, temp(k)-t0)
506 call snow_moments(rs=rs(k), tc=tc0, &
507 smob=smob(k), smoc=smoc(k), &
513 if (
present(ng1d) .and.
present(qb1d))
then
514 if (.not.
allocated(xngx))
allocate(xngx(nz), source=0._wp)
515 if (.not.
allocated(xqbx))
allocate(xqbx(nz), source=0._wp)
519 call graupel_check_and_update(rho=rho, l_qg=l_qg, qg1d=xrx, ng1d=xngx, &
520 qb1d=xqbx, rg=rg, ng=ng, rb=rb, idx=idx_bg, qgten=qgten, ngten=ngten, &
521 qbten=qbten, ilamg=ilamg, mvd_g=mvd_g, dt=dt, odt=odt)
523 call thermo_vars(qv, temp, pres, rho, rhof, rhof2, qvs, delqvs, qvsi, &
524 satw, sati, ssatw, ssati, diffu, visco, vsc2, ocp, lvap, tcond, lvt2, &
529 if (.not. tempo_cfgs%turn_off_micro_flag .and. tempo_cfgs%cloud_condensation_flag)
then
530 call cloud_condensation(rho, temp, w1d, ssatw, lvap, tcond, diffu, lvt2, &
531 nwfa1d, nwfa, ncsave, qv, qvs, l_qc, rc, nc, tend, dt, odt)
534 qvten(k) = qvten(k) - tend%prw_vcd(k)
535 qcten(k) = qcten(k) + tend%prw_vcd(k)
536 ncten(k) = ncten(k) + tend%pnc_wcd(k)
537 nwfaten(k) = nwfaten(k) - tend%pnc_wcd(k)
538 tten(k) = tten(k) + lvap(k)*ocp(k)*tend%prw_vcd(k)
542 if (
present(nc1d))
then
543 if (.not.
allocated(xncx))
allocate(xncx(nz), source=0._wp)
546 call cloud_check_and_update(rho=rho, l_qc=l_qc, qc1d=xrx, nc1d=xncx, &
547 ncsave=ncsave, rc=rc, nc=nc, qcten=qcten, ncten=ncten, ilamc=ilamc, mvd_c=mvd_c, &
551 qv(k) = max(min_qv, qv1d(k) + qvten(k)*dt)
552 temp(k) = t1d(k) + tten(k)*dt
553 rho(k) = roverrv*pres(k)/(rdry*temp(k)*(qv(k)+roverrv))
556 call thermo_vars(qv, temp, pres, rho, rhof, rhof2, qvs, delqvs, qvsi, &
557 satw, sati, ssatw, ssati, diffu, visco, vsc2, ocp, lvap, tcond, lvt2, &
562 if (.not. tempo_cfgs%turn_off_micro_flag)
then
563 call rain_evaporation(rho, temp, ssatw, lvap, tcond, diffu, vsc2, rhof2, &
564 qv, qvs, l_qr, rr, nr, ilamr, tend, odt)
567 qrten(k) = qrten(k) - tend%prv_rev(k)
568 qvten(k) = qvten(k) + tend%prv_rev(k)
569 nrten(k) = nrten(k) - tend%pnr_rev(k)
570 nwfaten(k) = nwfaten(k) + tend%pnr_rev(k)
571 tten(k) = tten(k) - lvap(k)*ocp(k)*tend%prv_rev(k)
576 call rain_check_and_update(rho, l_qr, xrx, xnx, rr, nr, qrten, nrten, ilamr, mvd_r, dt, odt)
579 qv(k) = max(min_qv, qv1d(k) + qvten(k)*dt)
580 temp(k) = t1d(k) + tten(k)*dt
581 rho(k) = roverrv*pres(k)/(rdry*temp(k)*(qv(k)+roverrv))
584 call thermo_vars(qv, temp, pres, rho, rhof, rhof2, qvs, delqvs, qvsi, &
585 satw, sati, ssatw, ssati, diffu, visco, vsc2, ocp, lvap, tcond, lvt2, &
594 semi_sedi_factor = 10._wp
596 call rain_fallspeed(rhof=rhof, l_qr=l_qr, rr=rr, ilamr=ilamr, dz1d=dz1d, &
597 vt=vtrr, vtn=vtnr, substeps_sedi=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
599 if (tempo_cfgs%semi_sedi_flag)
then
600 substeps_sedi = max(int(substeps_sedi/semi_sedi_factor) + 1, 1)
601 do n = 1, substeps_sedi
602 call semilagrangian_sedimentation(dz1d=dz1d, rho=rho, xr=rr, xten=qrten, &
603 vt=vtrr, steps=substeps_sedi, limit=r1, precip=tempo_main_diags%rain_precip, dt=dt, odt=odt)
604 call semilagrangian_sedimentation(dz1d=dz1d, rho=rho, xr=nr, xten=nrten, &
605 vt=vtnr, steps=substeps_sedi, limit=r2, dt=dt, odt=odt)
610 call rain_check_and_update(rho, l_qr, xrx, xnx, rr, nr, qrten, nrten, ilamr, mvd_r, dt, odt)
611 call rain_fallspeed(rhof=rhof, l_qr=l_qr, rr=rr, ilamr=ilamr, dz1d=dz1d, &
612 vt=vtrr, vtn=vtnr, dt=dt)
615 do n = 1, substeps_sedi
616 call sedimentation(xr=rr, vt=vtrr, dz1d=dz1d, rho=rho, xten=qrten, limit=r1, &
617 steps=substeps_sedi, ktop_sedi=ktop_sedi, precip=tempo_main_diags%rain_precip, dt=dt)
618 call sedimentation(xr=nr, vt=vtnr, dz1d=dz1d, rho=rho, xten=nrten, limit=r2, &
619 steps=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
634 semi_sedi_factor = 10._wp
636 call graupel_fallspeed(rhof=rhof, rho=rho, visco=visco, &
637 l_qg=l_qg, rg=rg, rb=rb, qb1d=qb1d, idx=idx_bg, ilamg=ilamg, dz1d=dz1d, &
638 vt=vtrg, vtn=vtng, substeps_sedi=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
640 if (tempo_cfgs%semi_sedi_flag)
then
641 substeps_sedi = max(int(substeps_sedi/semi_sedi_factor) + 1, 1)
642 do n = 1, substeps_sedi
643 call semilagrangian_sedimentation(dz1d=dz1d, rho=rho, xr=rg, xten=qgten, &
644 vt=vtrg, steps=substeps_sedi, limit=r1, precip=tempo_main_diags%graupel_liquid_equiv_precip, &
646 call semilagrangian_sedimentation(dz1d=dz1d, rho=rho, xr=ng, xten=ngten, &
647 vt=vtng, steps=substeps_sedi, limit=r2, dt=dt, odt=odt)
648 call semilagrangian_sedimentation(dz1d=dz1d, rho=rho, xr=rb, xten=qbten, &
649 vt=vtrg, steps=substeps_sedi, limit=meters3_to_liters*r1/rho_g(nrhg), dt=dt, odt=odt)
653 if (
present(ng1d) .and.
present(qb1d))
then
654 if (.not.
allocated(xngx))
allocate(xngx(nz), source=0._wp)
655 if (.not.
allocated(xqbx))
allocate(xqbx(nz), source=0._wp)
659 call graupel_check_and_update(rho=rho, l_qg=l_qg, qg1d=xrx, ng1d=xngx, &
660 qb1d=xqbx, rg=rg, ng=ng, rb=rb, idx=idx_bg, qgten=qgten, ngten=ngten, &
661 qbten=qbten, ilamg=ilamg, mvd_g=mvd_g, dt=dt, odt=odt)
662 call graupel_fallspeed(rhof=rhof, rho=rho, visco=visco, &
663 l_qg=l_qg, rg=rg, rb=rb, qb1d=qb1d, idx=idx_bg, ilamg=ilamg, dz1d=dz1d, &
664 vt=vtrg, vtn=vtng, dt=dt)
667 do n = 1, substeps_sedi
668 call sedimentation(xr=rg, vt=vtrg, dz1d=dz1d, rho=rho, xten=qgten, limit=r1, &
669 steps=substeps_sedi, ktop_sedi=ktop_sedi, precip=tempo_main_diags%graupel_liquid_equiv_precip, dt=dt)
670 call sedimentation(xr=ng, vt=vtng, dz1d=dz1d, rho=rho, xten=ngten, limit=r2, &
671 steps=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
672 call sedimentation(xr=rb, vt=vtrg, dz1d=dz1d, rho=rho, xten=qbten, &
673 limit=meters3_to_liters*r1/rho_g(nrhg), steps=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
697 call snow_fallspeed(rhof=rhof, l_qs=l_qs, rs=rs, prr_sml=tend%prr_sml, smob=smob, smoc=smoc, &
698 rr=rr, vtrr=vtrr, dz1d=dz1d, vt=vtrs, vtboost=vtboost, substeps_sedi=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
699 do n = 1, substeps_sedi
700 call sedimentation(xr=rs, vt=vtrs, dz1d=dz1d, rho=rho, xten=qsten, limit=r1, &
701 steps=substeps_sedi, ktop_sedi=ktop_sedi, precip=tempo_main_diags%snow_liquid_equiv_precip, dt=dt)
709 call ice_fallspeed(rhof, l_qi, ri, ilami, dz1d, vtri, vtni, &
710 substeps_sedi, ktop_sedi, dt=dt)
711 call sedimentation(xr=ri, vt=vtri, dz1d=dz1d, rho=rho, xten=qiten, limit=r1, &
712 steps=substeps_sedi, ktop_sedi=ktop_sedi, precip=tempo_main_diags%ice_liquid_equiv_precip, dt=dt)
713 call sedimentation(xr=ni, vt=vtni, dz1d=dz1d, rho=rho, xten=niten, limit=r2, &
714 steps=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
721 call cloud_fallspeed(rhof, w1d, l_qc, rc, nc, ilamc, dz1d, vtrc, vtnc, ktop_sedi)
722 call sedimentation(xr=rc, vt=vtrc, dz1d=dz1d, rho=rho, xten=qcten, limit=r1, &
723 steps=substeps_sedi, ktop_sedi=ktop_sedi, precip=tempo_main_diags%cloud_precip, dt=dt)
724 call sedimentation(xr=nc, vt=vtnc, dz1d=dz1d, rho=rho, xten=ncten, limit=r2, &
725 steps=substeps_sedi, ktop_sedi=ktop_sedi, dt=dt)
730 if (.not. tempo_cfgs%turn_off_micro_flag)
then
731 call freeze_cloud_melt_ice(temp=temp, rho=rho, ocp=ocp, lvap=lvap, &
732 qi1d=qi1d, ni1d=ni1d, qiten=qiten, niten=niten, qc1d=qc1d, nc1d=nc1d, &
733 qcten=qcten, ncten=ncten, tten=tten, ncsave=ncsave, dt=dt, odt=odt)
738 t1d(k) = t1d(k) + tten(k)*dt
739 qv1d(k) = max(min_qv, (qv1d(k) + qvten(k)*dt))
740 rho(k) = roverrv*pres(k)/(rdry*temp(k)*(qv(k)+roverrv))
741 if (
present(nwfa1d))
then
742 nwfa1d(k) = max(nwfa_default, min(aero_max, (nwfa1d(k)+nwfaten(k)*dt)))
744 if (
present(nifa1d))
then
745 nifa1d(k) = max(nifa_default, min(aero_max, (nifa1d(k)+nifaten(k)*dt)))
749 call cloud_check_and_update(rho=rho, l_qc=l_qc, qc1d=qc1d, nc1d=nc1d, &
750 ncsave=ncsave, rc=rc, nc=nc, qcten=qcten, ncten=ncten, ilamc=ilamc, mvd_c=mvd_c, &
753 call rain_check_and_update(rho, l_qr, qr1d, nr1d, rr, nr, qrten, nrten, ilamr, mvd_r, dt, odt)
755 call ice_check_and_update(rho, l_qi, qi1d, ni1d, ri, ni, qiten, niten, ilami, dt, odt)
757 call snow_check_and_update(rho, l_qs, qs1d, rs, qsten, dt, odt)
771 tc0 = min(-0.1, temp(k)-t0)
772 call snow_moments(rs=rs(k), tc=tc0, &
773 smob=smob(k), smoc=smoc(k), &
774 smo2=smo2(k), smoz=smoz(k))
778 call graupel_check_and_update(rho=rho, l_qg=l_qg, qg1d=qg1d, ng1d=ng1d, &
779 qb1d=qb1d, rg=rg, ng=ng, rb=rb, idx=idx_bg, qgten=qgten, ngten=ngten, &
780 qbten=qbten, ilamg=ilamg, mvd_g=mvd_g, dt=dt, odt=odt)
784 tempo_main_diags%frozen_fraction = &
785 (tempo_main_diags%ice_liquid_equiv_precip + tempo_main_diags%snow_liquid_equiv_precip + &
786 tempo_main_diags%graupel_liquid_equiv_precip) / &
787 (tempo_main_diags%ice_liquid_equiv_precip + tempo_main_diags%snow_liquid_equiv_precip + &
788 tempo_main_diags%graupel_liquid_equiv_precip + tempo_main_diags%rain_precip + r1)
791 call freezing_rain(temp=temp(1), rain_precip=tempo_main_diags%rain_precip, &
792 cloud_precip=tempo_main_diags%cloud_precip, &
793 frz_rain=tempo_main_diags%frz_rain_precip)
795 if (tempo_cfgs%cloud_number_mixing_ratio_flag)
then
796 allocate(tempo_main_diags%cloud_number_mixing_ratio(nz), source=nc*rho)
800 if (tempo_cfgs%rain_med_vol_diam_flag)
then
801 allocate(tempo_main_diags%rain_med_vol_diam(nz), source=0._wp)
802 tempo_main_diags%rain_med_vol_diam = mvd_r
804 if (tempo_cfgs%graupel_med_vol_diam_flag)
then
805 allocate(tempo_main_diags%graupel_med_vol_diam(nz), source=0._wp)
806 tempo_main_diags%graupel_med_vol_diam = mvd_g
810 if (tempo_cfgs%max_hail_diameter_flag)
then
811 allocate(tempo_main_diags%max_hail_diameter(nz), source=0._wp)
812 call max_hail_diam(rho, rg, ng, ilamg, idx_bg, &
813 tempo_main_diags%max_hail_diameter)
817 if (tempo_cfgs%refl10cm_flag)
then
818 allocate(tempo_main_diags%refl10cm(nz), source=-35._wp)
819 call reflectivity_10cm(tempo_cfgs%refl10cm_from_melting_flag, &
820 temp, l_qr, rr, nr, ilamr, &
821 l_qs, rs, smoc, smob, smoz, l_qg, rg, ng, idx_bg, ilamg, &
822 tempo_main_diags%refl10cm)
826 if ((tempo_cfgs%re_cloud_flag) .and. (tempo_cfgs%re_ice_flag) .and. (tempo_cfgs%re_snow_flag))
then
827 allocate(tempo_main_diags%re_cloud(nz), source=0._wp)
828 allocate(tempo_main_diags%re_ice(nz), source=0._wp)
829 allocate(tempo_main_diags%re_snow(nz), source=0._wp)
838 if (
present(qc_bl1d) .and.
present(qcfrac_bl1d))
then
840 if (.not.
allocated(xncx))
allocate(xncx(nz), source=0._wp)
843 if ((xrx(k) <= r1) .and. &
844 (qc_bl1d(k) > 1.e-9_wp) .and. (qcfrac_bl1d(k) > 0._wp))
then
845 xrx(k) = xrx(k) + qc_bl1d(k) / qcfrac_bl1d(k)
848 where(xrx <= 1.e-12_wp) xrx = 0._wp
856 call cloud_check_and_update(rho=rho, l_qc=l_qc, qc1d=xrx, nc1d=xncx, &
857 rc=rc, nc=nc, qcten=qcten, ncten=ncten, ilamc=ilamc, mvd_c=mvd_c, &
860 call effective_radius(temp, l_qc, nc, ilamc, l_qi, ilami, l_qs, rs, &
861 tempo_main_diags%re_cloud, tempo_main_diags%re_ice, tempo_main_diags%re_snow)