233subroutine fv_sat_adj_run(mdt, zvir, is, ie, isd, ied, isc1, iec1, isc2, iec2, kmp, km, kmdelz, js, je, jsd, jed, jsc1, jec1, jsc2, jec2, &
234 ng, hydrostatic, fast_mp_consv, te0_2d, te0, ngas, qvi, qv, ql, qi, qr, &
235 qs, qg, hs, peln, delz, delp, pt, pkz, q_con, akap, cappa, area, dtdt, &
236 out_dt, last_step, do_qa, qa, &
237 nthreads, errmsg, errflg)
242 real(kind=kind_dyn),
intent(in) :: mdt
243 real(kind=kind_dyn),
intent(in) :: zvir
244 integer,
intent(in) :: is
245 integer,
intent(in) :: ie
246 integer,
intent(in) :: isd
247 integer,
intent(in) :: ied
248 integer,
intent(in) :: isc1
249 integer,
intent(in) :: iec1
250 integer,
intent(in) :: isc2
251 integer,
intent(in) :: iec2
252 integer,
intent(in) :: kmp
253 integer,
intent(in) :: km
254 integer,
intent(in) :: kmdelz
255 integer,
intent(in) :: js
256 integer,
intent(in) :: je
257 integer,
intent(in) :: jsd
258 integer,
intent(in) :: jed
259 integer,
intent(in) :: jsc1
260 integer,
intent(in) :: jec1
261 integer,
intent(in) :: jsc2
262 integer,
intent(in) :: jec2
263 integer,
intent(in) :: ng
264 logical,
intent(in) :: hydrostatic
265 logical,
intent(in) :: fast_mp_consv
266 real(kind=kind_dyn),
intent(inout) :: te0_2d(is:ie, js:je)
267 real(kind=kind_dyn),
intent( out) :: te0(isd:ied, jsd:jed, 1:km)
269 integer,
intent(in) :: ngas
271 real(kind=kind_dyn),
intent(inout),
optional :: qvi(isd:ied, jsd:jed, 1:km, 1:ngas)
273 real(kind=kind_dyn),
intent(inout),
optional :: qvi(:,:,:,:)
275 real(kind=kind_dyn),
intent(inout) :: qv(isd:ied, jsd:jed, 1:km)
276 real(kind=kind_dyn),
intent(inout) :: ql(isd:ied, jsd:jed, 1:km)
277 real(kind=kind_dyn),
intent(inout) :: qi(isd:ied, jsd:jed, 1:km)
278 real(kind=kind_dyn),
intent(inout) :: qr(isd:ied, jsd:jed, 1:km)
279 real(kind=kind_dyn),
intent(inout) :: qs(isd:ied, jsd:jed, 1:km)
280 real(kind=kind_dyn),
intent(inout) :: qg(isd:ied, jsd:jed, 1:km)
281 real(kind=kind_dyn),
intent(in) :: hs(isd:ied, jsd:jed)
282 real(kind=kind_dyn),
intent(in) :: peln(is:ie, 1:km+1, js:je)
284 real(kind=kind_dyn),
intent(in) :: delz(is:ie, js:je, 1:kmdelz)
285 real(kind=kind_dyn),
intent(in) :: delp(isd:ied, jsd:jed, 1:km)
286 real(kind=kind_dyn),
intent(inout) :: pt(isd:ied, jsd:jed, 1:km)
287 real(kind=kind_dyn),
intent(inout) :: pkz(is:ie, js:je, 1:km)
289 real(kind=kind_dyn),
intent(inout) :: q_con(isd:ied, jsd:jed, 1:km)
291 real(kind=kind_dyn),
intent(inout) :: q_con(isd:isd, jsd:jsd, 1)
293 real(kind=kind_dyn),
intent(in) :: akap
295 real(kind=kind_dyn),
intent(inout) :: cappa(isd:ied, jsd:jed, 1:km)
297 real(kind=kind_dyn),
intent(inout) :: cappa(isd:ied, jsd:jed, 1)
304 real(kind_grid),
intent(in) :: area(isd:ied, jsd:jed)
305 real(kind=kind_dyn),
intent(inout) :: dtdt(is:ie, js:je, 1:km)
306 logical,
intent(in) :: out_dt
307 logical,
intent(in) :: last_step
308 logical,
intent(in) :: do_qa
309 real(kind=kind_dyn),
intent( out) :: qa(isd:ied, jsd:jed, 1:km)
310 integer,
intent(in) :: nthreads
311 character(len=*),
intent( out) :: errmsg
312 integer,
intent( out) :: errflg
315 real(kind=kind_dyn),
dimension(is:ie,js:je) :: dpln
340 dpln(i,j) = peln(i,k+1,j) - peln(i,k,j)
343 if (hydrostatic)
then
348 call fv_sat_adj_work(abs(mdt), zvir, is, ie, js, je, ng, hydrostatic, fast_mp_consv, &
351 qvi(isd,jsd,k,1:ngas), &
355 ql(isd,jsd,k), qi(isd,jsd,k), &
356 qr(isd,jsd,k), qs(isd,jsd,k), qg(isd,jsd,k), &
357 hs, dpln, delz(is:,js:,kdelz), pt(isd,jsd,k), delp(isd,jsd,k),&
358 q_con(isd:,jsd:,k), cappa(isd:,jsd:,k), area, dtdt(is,js,k), &
359 out_dt, last_step, do_qa, qa(isd,jsd,k))
360 if ( .not. hydrostatic )
then
364 pkz(i,j,k) = exp(cappa(i,j,k)*log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
367 pkz(i,j,k) = exp(akap*(virqd(q(i,j,k,1:num_gas))/vicpqd(q(i,j,k,1:num_gas))*log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
369 pkz(i,j,k) = exp(akap*log(rrg*delp(i,j,k)/delz(i,j,k)*pt(i,j,k)))
378 if ( fast_mp_consv )
then
383 te0_2d(i,j) = te0_2d(i,j) + te0(i,j,k)
402subroutine fv_sat_adj_work(mdt, zvir, is, ie, js, je, ng, hydrostatic, consv_te, te0, &
408 ql, qi, qr, qs, qg, hs, dpln, delz, pt, dp, q_con, cappa, &
409 area, dtdt, out_dt, last_step, do_qa, qa)
414 integer,
intent (in) :: is, ie, js, je, ng
415 logical,
intent (in) :: hydrostatic, consv_te, out_dt, last_step, do_qa
416 real(kind=kind_dyn),
intent (in) :: zvir, mdt
417 real(kind=kind_dyn),
intent (in),
dimension (is - ng:ie + ng, js - ng:je + ng) :: dp, hs
418 real(kind=kind_dyn),
intent (in),
dimension (is:ie, js:je) :: dpln, delz
419 real(kind=kind_dyn),
intent (inout),
dimension (is - ng:ie + ng, js - ng:je + ng) :: pt
421 real(kind=kind_dyn),
intent (inout),
dimension (is - ng:ie + ng, js - ng:je + ng, 1:1, 1:num_gas) :: qvi
423 real(kind=kind_dyn),
intent (inout),
dimension (is - ng:ie + ng, js - ng:je + ng) :: qv
425 real(kind=kind_dyn),
intent (inout),
dimension (is - ng:ie + ng, js - ng:je + ng) :: ql, qi, qr, qs, qg
426 real(kind=kind_dyn),
intent (inout),
dimension (is - ng:ie + ng, js - ng:je + ng) :: q_con, cappa
427 real(kind=kind_dyn),
intent (inout),
dimension (is:ie, js:je) :: dtdt
428 real(kind=kind_dyn),
intent (out),
dimension (is - ng:ie + ng, js - ng:je + ng) :: qa, te0
429 real (kind_grid),
intent (in),
dimension (is - ng:ie + ng, js - ng:je + ng) :: area
433 real,
dimension (is - ng:ie + ng, js - ng:je + ng) :: qv
435 real(kind=kind_dyn),
dimension (is:ie) :: wqsat, dq2dt, qpz, cvm, t0, pt1, qstar
436 real(kind=kind_dyn),
dimension (is:ie) :: icp2, lcp2, tcp2, tcp3
437 real(kind=kind_dyn),
dimension (is:ie) :: den, q_liq, q_sol, q_cond, src, sink, hvar
438 real(kind=kind_dyn),
dimension (is:ie) :: mc_air, lhl, lhi
439 real(kind=kind_dyn) :: qsw, rh
440 real(kind=kind_dyn) :: tc, qsi, dqsdt, dq, dq0, pidep, qi_crt, tmp, dtmp
441 real(kind=kind_dyn) :: tin, rqi, q_plus, q_minus
442 real(kind=kind_dyn) :: sdt, dt_bigg, adj_fac
443 real(kind=kind_dyn) :: fac_smlt, fac_r2g, fac_i2s, fac_imlt, fac_l2r, fac_v2l, fac_l2v
444 real(kind=kind_dyn) :: factor, qim, tice0, c_air, c_vap, dw
448 qv(:,:) = qvi(:,:,1,1)
459 fac_i2s = 1. - exp(- mdt / tau_i2s)
460 fac_v2l = 1. - exp(- sdt / tau_v2l)
461 fac_r2g = 1. - exp(- mdt / tau_r2g)
462 fac_l2r = 1. - exp(- mdt / tau_l2r)
464 fac_l2v = 1. - exp(- sdt / tau_l2v)
465 fac_l2v = min(sat_adj0, fac_l2v)
467 fac_imlt = 1. - exp(- sdt / tau_imlt)
468 fac_smlt = 1. - exp(- mdt / tau_smlt)
474 if (hydrostatic)
then
481 d0_vap = c_vap - c_liq
482 lv00 = hlv - d0_vap * tice
489 q_liq(i) = ql(i, j) + qr(i, j)
490 q_sol(i) = qi(i, j) + qs(i, j) + qg(i, j)
491 qpz(i) = q_liq(i) + q_sol(i)
493 pt1(i) = pt(i, j) / virq_qpz(qvi(i,j,1,1:num_gas),qpz(i))
496 pt1(i) = pt(i, j) / ((1 + zvir * qv(i, j)) * (1 - qpz(i)))
498 pt1(i) = pt(i, j) / (1 + zvir * qv(i, j))
502 qpz(i) = qpz(i) + qv(i, j)
509 if (hydrostatic)
then
511 den(i) = dp(i, j) / (dpln(i, j) * rdgas * pt(i, j))
515 den(i) = - dp(i, j) / (grav * delz(i, j))
525 if (hydrostatic)
then
526 c_air = cp_air * vicpqd_qpz(qvi(i,j,1,1:num_gas),qpz(i))
528 c_air = cv_air * vicvqd_qpz(qvi(i,j,1,1:num_gas),qpz(i))
531 mc_air(i) = (1. - qpz(i)) * c_air
532 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
533 lhi(i) = li00 + dc_ice * pt1(i)
534 icp2(i) = lhi(i) / cvm(i)
542 if (hydrostatic)
then
545 c_air = cp_air * vicpqd_qpz(qvi(i,j,1,1:num_gas),qpz(i))
547 te0(i, j) = - c_air * t0(i)
552 te0(i, j) = - cvm(i) * t0(i)
555 c_air = cv_air * vicvqd_qpz(qvi(i,j,1,1:num_gas),qpz(i))
557 te0(i, j) = - c_air * t0(i)
568 if (qi(i, j) < 0.)
then
569 qs(i, j) = qs(i, j) + qi(i, j)
579 if (qi(i, j) > 1.e-8 .and. pt1(i) > tice)
then
580 sink(i) = min(qi(i, j), fac_imlt * (pt1(i) - tice) / icp2(i))
581 qi(i, j) = qi(i, j) - sink(i)
587 ql(i, j) = ql(i, j) + sink(i)
588 q_liq(i) = q_liq(i) + sink(i)
589 q_sol(i) = q_sol(i) - sink(i)
590 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
591 pt1(i) = pt1(i) - sink(i) * lhi(i) / cvm(i)
600 lhi(i) = li00 + dc_ice * pt1(i)
601 icp2(i) = lhi(i) / cvm(i)
609 if (qs(i, j) < 0.)
then
610 qg(i, j) = qg(i, j) + qs(i, j)
612 elseif (qg(i, j) < 0.)
then
613 tmp = min(- qg(i, j), max(0., qs(i, j)))
614 qg(i, j) = qg(i, j) + tmp
615 qs(i, j) = qs(i, j) - tmp
626 if (ql(i, j) < 0.)
then
627 tmp = min(- ql(i, j), max(0., qr(i, j)))
628 ql(i, j) = ql(i, j) + tmp
629 qr(i, j) = qr(i, j) - tmp
630 elseif (qr(i, j) < 0.)
then
631 tmp = min(- qr(i, j), max(0., ql(i, j)))
632 ql(i, j) = ql(i, j) - tmp
633 qr(i, j) = qr(i, j) + tmp
642 dtmp = tice - 48. - pt1(i)
643 if (ql(i, j) > 0. .and. dtmp > 0.)
then
644 sink(i) = min(ql(i, j), dtmp / icp2(i))
645 ql(i, j) = ql(i, j) - sink(i)
646 qi(i, j) = qi(i, j) + sink(i)
647 q_liq(i) = q_liq(i) - sink(i)
648 q_sol(i) = q_sol(i) + sink(i)
649 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
650 pt1(i) = pt1(i) + sink(i) * lhi(i) / cvm(i)
659 lhl(i) = lv00 + d0_vap * pt1(i)
660 lhi(i) = li00 + dc_ice * pt1(i)
661 lcp2(i) = lhl(i) / cvm(i)
662 icp2(i) = lhi(i) / cvm(i)
663 tcp3(i) = lcp2(i) + icp2(i) * min(1., dim(tice, pt1(i)) /48.)
670 call wqs2_vect (is, ie, pt1, den, wqsat, dq2dt)
674 dq0 = (qv(i, j) - wqsat(i)) / (1. + tcp3(i) * dq2dt(i))
676 src(i) = min(adj_fac * dq0, max(ql_gen - ql(i, j), fac_v2l * dq0))
682 factor = - min(1., fac_l2v * 10. * (1. - qv(i, j) / wqsat(i)))
683 src(i) = - min(ql(i, j), factor * dq0)
685 qv(i, j) = qv(i, j) - src(i)
687 qvi(i,j,1,1) = qv(i, j)
689 ql(i, j) = ql(i, j) + src(i)
690 q_liq(i) = q_liq(i) + src(i)
691 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
692 pt1(i) = pt1(i) + src(i) * lhl(i) / cvm(i)
700 lhl(i) = lv00 + d0_vap * pt1(i)
701 lhi(i) = li00 + dc_ice * pt1(i)
702 lcp2(i) = lhl(i) / cvm(i)
703 icp2(i) = lhi(i) / cvm(i)
704 tcp3(i) = lcp2(i) + icp2(i) * min(1., dim(tice, pt1(i)) / 48.)
715 call wqs2_vect (is, ie, pt1, den, wqsat, dq2dt)
718 dq0 = (qv(i, j) - wqsat(i)) / (1. + tcp3(i) * dq2dt(i))
725 factor = - min(1., fac_l2v * 10. * (1. - qv(i, j) / wqsat(i)))
726 src(i) = - min(ql(i, j), factor * dq0)
729 qv(i, j) = qv(i, j) - src(i)
731 qvi(i,j,1,1) = qv(i,j)
733 ql(i, j) = ql(i, j) + src(i)
734 q_liq(i) = q_liq(i) + src(i)
735 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
736 pt1(i) = pt1(i) + src(i) * lhl(i) / cvm(i)
744 lhl(i) = lv00 + d0_vap * pt1(i)
745 lhi(i) = li00 + dc_ice * pt1(i)
746 lcp2(i) = lhl(i) / cvm(i)
747 icp2(i) = lhi(i) / cvm(i)
757 dtmp = t_wfr - pt1(i)
758 if (ql(i, j) > 0. .and. dtmp > 0.)
then
759 sink(i) = min(ql(i, j), ql(i, j) * dtmp * 0.125, dtmp / icp2(i))
760 ql(i, j) = ql(i, j) - sink(i)
761 qi(i, j) = qi(i, j) + sink(i)
762 q_liq(i) = q_liq(i) - sink(i)
763 q_sol(i) = q_sol(i) + sink(i)
764 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
765 pt1(i) = pt1(i) + sink(i) * lhi(i) / cvm(i)
774 lhi(i) = li00 + dc_ice * pt1(i)
775 icp2(i) = lhi(i) / cvm(i)
784 if (ql(i, j) > 0.0 .and. tc > 0.)
then
785 sink(i) = 3.3333e-10 * dt_bigg * (exp(0.66 * tc) - 1.) * den(i) * ql(i, j) ** 2
786 sink(i) = min(ql(i, j), tc / icp2(i), sink(i))
787 ql(i, j) = ql(i, j) - sink(i)
788 qi(i, j) = qi(i, j) + sink(i)
789 q_liq(i) = q_liq(i) - sink(i)
790 q_sol(i) = q_sol(i) + sink(i)
791 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
792 pt1(i) = pt1(i) + sink(i) * lhi(i) / cvm(i)
801 lhi(i) = li00 + dc_ice * pt1(i)
802 icp2(i) = lhi(i) / cvm(i)
810 dtmp = (tice - 0.1) - pt1(i)
811 if (qr(i, j) > 1.e-7 .and. dtmp > 0.)
then
812 tmp = min(1., (dtmp * 0.025) ** 2) * qr(i, j)
813 sink(i) = min(tmp, fac_r2g * dtmp / icp2(i))
814 qr(i, j) = qr(i, j) - sink(i)
815 qg(i, j) = qg(i, j) + sink(i)
816 q_liq(i) = q_liq(i) - sink(i)
817 q_sol(i) = q_sol(i) + sink(i)
818 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
819 pt1(i) = pt1(i) + sink(i) * lhi(i) / cvm(i)
828 lhi(i) = li00 + dc_ice * pt1(i)
829 icp2(i) = lhi(i) / cvm(i)
837 dtmp = pt1(i) - (tice + 0.1)
838 if (qs(i, j) > 1.e-7 .and. dtmp > 0.)
then
839 tmp = min(1., (dtmp * 0.1) ** 2) * qs(i, j)
840 sink(i) = min(tmp, fac_smlt * dtmp / icp2(i))
841 tmp = min(sink(i), dim(qs_mlt, ql(i, j)))
842 qs(i, j) = qs(i, j) - sink(i)
843 ql(i, j) = ql(i, j) + tmp
844 qr(i, j) = qr(i, j) + sink(i) - tmp
846 q_liq(i) = q_liq(i) + sink(i)
847 q_sol(i) = q_sol(i) - sink(i)
848 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
849 pt1(i) = pt1(i) - sink(i) * lhi(i) / cvm(i)
858 if (ql(i, j) > ql0_max)
then
859 sink(i) = fac_l2r * (ql(i, j) - ql0_max)
860 qr(i, j) = qr(i, j) + sink(i)
861 ql(i, j) = ql(i, j) - sink(i)
870 lhi(i) = li00 + dc_ice * pt1(i)
871 lhl(i) = lv00 + d0_vap * pt1(i)
872 lcp2(i) = lhl(i) / cvm(i)
873 icp2(i) = lhi(i) / cvm(i)
874 tcp2(i) = lcp2(i) + icp2(i)
883 if (pt1(i) < t_sub)
then
884 src(i) = dim(qv(i, j), 1.e-6)
885 elseif (pt1(i) < tice0)
then
886 qsi =
iqs2(pt1(i), den(i), dqsdt)
888 sink(i) = adj_fac * dq / (1. + tcp2(i) * dqsdt)
889 if (qi(i, j) > 1.e-8)
then
890 pidep = sdt * dq * 349138.78 * exp(0.875 * log(qi(i, j) * den(i))) &
891 / (qsi * den(i) * lat2 / (0.0243 * rvgas * pt1(i) ** 2) + 4.42478e4)
897 qi_crt = qi_gen * min(qi_lim, 0.1 * tmp) / den(i)
898 src(i) = min(sink(i), max(qi_crt - qi(i, j), pidep), tmp / tcp2(i))
900 pidep = pidep * min(1., dim(pt1(i), t_sub) * 0.2)
901 src(i) = max(pidep, sink(i), - qi(i, j))
904 qv(i, j) = qv(i, j) - src(i)
906 qvi(i,j,1,1) = qv(i,j)
908 qi(i, j) = qi(i, j) + src(i)
909 q_sol(i) = q_sol(i) + src(i)
910 cvm(i) = mc_air(i) + qv(i, j) * c_vap + q_liq(i) * c_liq + q_sol(i) * c_ice
911 pt1(i) = pt1(i) + src(i) * (lhl(i) + lhi(i)) / cvm(i)
920 q_con(i, j) = q_liq(i) + q_sol(i)
922 pt(i, j) = pt1(i) * virq_qpz(qvi(i,j,1,1:num_gas),q_con(i,j))
924 tmp = 1. + zvir * qv(i, j)
925 pt(i, j) = pt1(i) * tmp * (1. - q_con(i, j))
928 cappa(i, j) = tmp / (tmp + cvm(i))
931 q_con(i, j) = q_liq(i) + q_sol(i)
932 pt(i, j) = pt1(i) * virq_qpz(qvi(i,j,1,1:num_gas),q_con(i,j)) * (1. - q_con(i,j))
934 pt(i, j) = pt1(i) * (1. + zvir * qv(i, j))
944 if (qg(i, j) < 0.)
then
945 tmp = min(- qg(i, j), max(0., qi(i, j)))
946 qg(i, j) = qg(i, j) + tmp
947 qi(i, j) = qi(i, j) - tmp
956 qim = qi0_max / den(i)
957 if (qi(i, j) > qim)
then
958 sink(i) = fac_i2s * (qi(i, j) - qim)
959 qi(i, j) = qi(i, j) - sink(i)
960 qs(i, j) = qs(i, j) + sink(i)
966 dtdt(i, j) = dtdt(i, j) + pt1(i) - t0(i)
976 if (hydrostatic)
then
978 c_air = cp_air * vicpqd_qpz(qvi(i,j,1,1:num_gas),qpz(i))
980 te0(i, j) = dp(i, j) * (te0(i, j) + c_air * pt1(i))
983 te0(i, j) = dp(i, j) * (te0(i, j) + cvm(i) * pt1(i))
986 c_air = cv_air * vicvqd_qpz(qvi(i,j,1,1:num_gas),qpz(i))
988 te0(i, j) = dp(i, j) * (te0(i, j) + c_air * pt1(i))
999 lhi(i) = li00 + dc_ice * pt1(i)
1000 lhl(i) = lv00 + d0_vap * pt1(i)
1001 cvm(i) = mc_air(i) + (qv(i, j) + q_liq(i) + q_sol(i)) * c_vap
1002 lcp2(i) = lhl(i) / cvm(i)
1003 icp2(i) = lhi(i) / cvm(i)
1010 if (do_qa .and. last_step)
then
1017 if (rad_graupel)
then
1019 q_sol(i) = qi(i, j) + qs(i, j) + qg(i, j)
1023 q_sol(i) = qi(i, j) + qs(i, j)
1033 q_liq(i) = ql(i, j) + qr(i, j)
1041 q_cond(i) = q_sol(i) + q_liq(i)
1053 tin = pt1(i) - (lcp2(i) * q_cond(i) + icp2(i) * q_sol(i))
1062 if (tin <= t_wfr)
then
1064 qstar(i) =
iqs1(tin, den(i))
1065 elseif (tin >= tice)
then
1067 qstar(i) =
wqs1(tin, den(i))
1070 qsi =
iqs1(tin, den(i))
1071 qsw =
wqs1(tin, den(i))
1072 if (q_cond(i) > 1.e-6)
then
1073 rqi = q_sol(i) / q_cond(i)
1076 rqi = ((tice - tin) / (tice - t_wfr))
1078 qstar(i) = rqi * qsi + (1. - rqi) * qsw
1081 dw = dw_ocean + (dw_land - dw_ocean) * min(1., abs(hs(i, j)) / (10. * grav))
1083 hvar(i) = min(0.2, max(0.01, dw * sqrt(sqrt(area(i, j)) / 100.e3)))
1091 rh = qpz(i) / qstar(i)
1099 if (rh > 0.75 .and. qpz(i) > 1.e-8)
then
1100 dq = hvar(i) * qpz(i)
1101 q_plus = qpz(i) + dq
1102 q_minus = qpz(i) - dq
1103 if (icloud_f == 2)
then
1104 if (qpz(i) > qstar(i))
then
1106 elseif (qstar(i) < q_plus .and. q_cond(i) > 1.e-8)
then
1107 qa(i, j) = ((q_plus - qstar(i)) / dq) ** 2
1108 qa(i, j) = min(1., qa(i, j))
1113 if (qstar(i) < q_minus)
then
1116 if (qstar(i) < q_plus)
then
1117 if (icloud_f == 0)
then
1118 qa(i, j) = (q_plus - qstar(i)) / (dq + dq)
1120 qa(i, j) = (q_plus - qstar(i)) / (2. * dq * (1. - q_cond(i)))
1126 if (q_cond(i) > 1.e-8)
then
1127 qa(i, j) = max(cld_min, qa(i, j))
1129 qa(i, j) = min(1., qa(i, j))