75 private :: cp_kf_param
76 private :: cp_kf_trigger
77 private :: cp_kf_updraft
78 private :: cp_kf_downdraft
79 private :: cp_kf_compensational
80 private :: cp_kf_calcexn
81 private :: cp_kf_precipitation_oc1973
82 private :: cp_kf_precipitation_kessler
83 private :: cp_kf_tpmix2
84 private :: cp_kf_dtfrznew
85 private :: cp_kf_prof5
86 private :: cp_kf_tpmix2dd
87 private :: cp_kf_envirtht
88 private :: cp_kf_lutab
91 subroutine kf_precipitation( &
92 G, DZ, BOTERM, ENTERM, &
93 WTW, QLIQ, QICE, QNEWLQ, QNEWIC, QLQOUT, QICOUT )
95 real(RP),
INTENT(IN ) :: g, dz,boterm,enterm
96 real(RP),
INTENT(INOUT) :: wtw, qliq, qice, qnewlq, qnewic, qlqout, qicout
97 end subroutine kf_precipitation
105 integer,
private,
parameter :: kfnt=250,kfnp=220
106 real(RP),
private :: ttab(kfnt,kfnp),qstab(kfnt,kfnp)
107 real(RP),
private :: the0k(kfnp)
108 real(RP),
private :: alu(200)
109 real(RP),
private :: rdpr,rdthk,plutop
110 real(RP),
private :: gdcp
115 real(RP),
private,
parameter :: aliq = 6.112e2_rp
116 real(RP),
private,
parameter :: bliq = 17.67_rp
117 real(RP),
private,
parameter :: cliq = bliq*tem00
118 real(RP),
private,
parameter :: dliq = 29.65_rp
119 real(RP),
private,
parameter :: xlv0 = 3.15e6_rp
120 real(RP),
private,
parameter :: xlv1 = 2370._rp
121 real(RP),
private,
parameter :: kf_eps = 1.e-12_rp
124 real(RP),
private :: rate = 0.03_rp
126 integer ,
private :: trigger = 3
127 logical ,
private :: flag_qs = .true.
128 logical ,
private :: flag_qi = .true.
129 real(RP),
private :: delcape = 0.1_rp
130 real(RP),
private :: deeplifetime = 1800._rp
131 real(RP),
private :: shallowlifetime = 2400._rp
132 real(RP),
private :: depth_usl = 300._rp
133 logical ,
private :: warmrain = .false.
134 logical ,
private :: kf_log = .false.
135 real(RP),
private :: kf_threshold = 1.e-3_rp
136 integer ,
private :: stepkf
137 integer ,
private :: kf_prec = 1
138 procedure(kf_precipitation),
pointer,
private :: cp_kf_precipitation => null()
140 real(RP),
private,
allocatable :: lifetime (:,:)
141 integer ,
private,
allocatable :: i_convflag(:,:)
143 real(RP),
private,
allocatable :: deltaz (:,:,:)
144 real(RP),
private,
allocatable :: z (:,:,:)
145 real(RP),
private,
allocatable :: deltax (:,:)
154 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
156 TIME_DTSEC, KF_DTSEC, &
161 integer,
intent(in) :: KA, KS, KE
162 integer,
intent(in) :: IA, IS, IE
163 integer,
intent(in) :: JA, JS, JE
165 real(RP),
intent(in) :: CZ(ka,ia,ja)
166 real(RP),
intent(in) :: AREA(ia,ja)
167 real(DP),
intent(in) :: TIME_DTSEC
168 real(DP),
intent(in) :: KF_DTSEC
169 logical,
intent(in) :: WARMRAIN_in
172 integer :: PARAM_ATMOS_PHY_CP_kf_trigger = 1
173 integer :: PARAM_ATMOS_PHY_CP_kf_prec = 1
174 real(RP) :: PARAM_ATMOS_PHY_CP_kf_rate = 0.03_rp
175 real(RP) :: PARAM_ATMOS_PHY_CP_kf_dlcape = 0.1_rp
176 real(RP) :: PARAM_ATMOS_PHY_CP_kf_dlifetime = 1800.0_rp
177 real(RP) :: PARAM_ATMOS_PHY_CP_kf_slifetime = 2400.0_rp
178 real(RP) :: PARAM_ATMOS_PHY_CP_kf_DEPTH_USL = 300.0_rp
179 real(RP) :: PARAM_ATMOS_PHY_CP_kf_thres = 1.e-3_rp
180 logical :: PARAM_ATMOS_PHY_CP_kf_LOG = .false.
182 namelist / param_atmos_phy_cp_kf / &
183 param_atmos_phy_cp_kf_rate, &
184 param_atmos_phy_cp_kf_trigger, &
185 param_atmos_phy_cp_kf_dlcape, &
186 param_atmos_phy_cp_kf_dlifetime, &
187 param_atmos_phy_cp_kf_slifetime, &
188 param_atmos_phy_cp_kf_depth_usl, &
189 param_atmos_phy_cp_kf_prec, &
190 param_atmos_phy_cp_kf_thres, &
191 param_atmos_phy_cp_kf_log
198 log_info(
"ATMOS_PHY_CP_kf_setup",*)
'Setup' 199 log_info(
"ATMOS_PHY_CP_kf_setup",*)
'Kain-Fritsch scheme' 201 warmrain = warmrain_in
205 read(
io_fid_conf,nml=param_atmos_phy_cp_kf,iostat=ierr)
207 log_info(
"ATMOS_PHY_CP_kf_setup",*)
'Not found namelist. Default used.' 208 elseif( ierr > 0 )
then 209 log_error(
"ATMOS_PHY_CP_kf_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_CP_KF. Check!' 212 log_nml(param_atmos_phy_cp_kf)
216 call cp_kf_param( param_atmos_phy_cp_kf_prec, &
217 param_atmos_phy_cp_kf_rate, &
218 param_atmos_phy_cp_kf_dlcape, &
219 param_atmos_phy_cp_kf_dlifetime, &
220 param_atmos_phy_cp_kf_slifetime, &
221 param_atmos_phy_cp_kf_depth_usl, &
222 param_atmos_phy_cp_kf_thres, &
223 param_atmos_phy_cp_kf_log, &
224 param_atmos_phy_cp_kf_trigger )
228 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Ogura-Cho condense material convert rate : ", param_atmos_phy_cp_kf_rate
229 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Trigger function type, 1:KF2004 3:NO2007 : ", param_atmos_phy_cp_kf_trigger
230 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"CAPE decrease rate : ", param_atmos_phy_cp_kf_dlcape
231 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Minimum lifetime scale of deep convection [sec] : ", param_atmos_phy_cp_kf_dlifetime
232 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Lifetime of shallow convection [sec] : ", param_atmos_phy_cp_kf_slifetime
233 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Updraft souce layer depth [hPa] : ", param_atmos_phy_cp_kf_depth_usl
234 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Precipitation type 1:Ogura-Cho(1973) 2:Kessler : ", param_atmos_phy_cp_kf_prec
235 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Kessler type precipitation's threshold : ", param_atmos_phy_cp_kf_thres
236 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Warm rain? : ", warmrain
237 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Output log? : ", param_atmos_phy_cp_kf_log
240 allocate( lifetime(ia,ja) )
241 allocate( i_convflag(ia,ja) )
242 lifetime(:,:) = 0.0_rp
245 allocate( z(ka,ia,ja) )
248 allocate( deltaz(ka,ia,ja) )
250 deltaz(:,:,:) = 0.0_rp
254 deltaz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
258 deltaz(ke,:,:) = 0.0_rp
260 allocate( deltax(ia,ja) )
263 deltax(i,j) = sqrt( area(i,j) )
274 subroutine cp_kf_param( & ! set kf tuning parametres
279 SHALLOWLIFETIME_in, &
287 integer,
intent(in) :: KF_prec_in
288 real(RP),
intent(in) :: RATE_in
289 real(RP),
intent(in) :: DELCAPE_in
290 real(RP),
intent(in) :: DEEPLIFETIME_in
291 real(RP),
intent(in) :: SHALLOWLIFETIME_in
292 real(RP),
intent(in) :: DEPTH_USL_in
293 real(RP),
intent(in) :: KF_threshold_in
294 logical,
intent(in) :: KF_LOG_in
295 integer,
intent(inout) :: TRIGGER_in
299 if (trigger_in /= 1 .and. trigger_in /=3)
then 300 log_info(
"CP_kf_param",*)
"TRIGGER must be 1 or 3 but now :",trigger_in
301 log_info(
"CP_kf_param",*)
"CHAGNGE ",trigger_in,
" to 3" 306 deeplifetime = deeplifetime_in
307 shallowlifetime = shallowlifetime_in
308 depth_usl = depth_usl_in
310 kf_threshold = kf_threshold_in
312 if (kf_prec == 1)
then 313 cp_kf_precipitation => cp_kf_precipitation_oc1973
314 elseif( kf_prec == 2)
then 315 cp_kf_precipitation => cp_kf_precipitation_kessler
317 log_error(
"CP_kf_param",*)
'KF namelist' 318 log_error_cont(*)
'KF_prec must be 1 or 2' 322 end subroutine cp_kf_param
368 saturation_psat_liq => atmos_saturation_psat_liq
370 integer,
intent(in) :: KA, KS, KE
371 integer,
intent(in) :: IA, IS, IE
372 integer,
intent(in) :: JA, JS, JE
374 real(RP),
intent(in) :: DENS (ka,ia,ja)
375 real(RP),
intent(in) :: U (ka,ia,ja)
376 real(RP),
intent(in) :: V (ka,ia,ja)
377 real(RP),
intent(in) :: RHOT (ka,ia,ja)
378 real(RP),
intent(in) :: TEMP (ka,ia,ja)
379 real(RP),
intent(in) :: PRES (ka,ia,ja)
380 real(RP),
intent(in) :: QDRY (ka,ia,ja)
381 real(RP),
intent(in) :: QV_in(ka,ia,ja)
382 real(RP),
intent(in) :: Rtot (ka,ia,ja)
383 real(RP),
intent(in) :: CPtot(ka,ia,ja)
384 real(RP),
intent(in) :: w0avg(ka,ia,ja)
385 real(RP),
intent(in) :: FZ (0:ka,ia,ja)
386 real(DP),
intent(in) :: KF_DTSEC
388 real(RP),
intent(inout) :: DENS_t_CP (ka,ia,ja)
389 real(RP),
intent(inout) :: RHOT_t_CP (ka,ia,ja)
390 real(RP),
intent(inout) :: RHOQV_t_CP (ka,ia,ja)
391 real(RP),
intent(inout) :: RHOQ_t_CP (ka,ia,ja,
n_hyd)
393 real(RP),
intent(out) :: SFLX_convrain(ia,ja)
394 real(RP),
intent(out) :: cloudtop (ia,ja)
395 real(RP),
intent(out) :: cloudbase (ia,ja)
396 real(RP),
intent(out) :: cldfrac_dp (ka,ia,ja)
397 real(RP),
intent(out) :: cldfrac_sh (ka,ia,ja)
398 real(RP),
intent(out) :: nca (ia,ja)
400 integer :: k, i, j, iq
405 integer :: k_lc,k_let,k_pbl
409 real(RP) :: PSAT (ka)
410 real(RP) :: QSAT (ka)
412 real(RP) :: deltap(ka)
414 real(RP) :: cldfrac_KF(ka,2)
415 real(RP) :: dens_nw(ka)
416 real(RP) :: time_advec
419 real(RP) :: upent(ka)
420 real(RP) :: updet(ka)
422 real(RP) :: temp_u(ka)
423 real(RP) :: tempv(ka)
429 real(RP) :: qvdet(ka)
430 real(RP) :: qcdet(ka)
431 real(RP) :: qidet(ka)
432 real(RP) :: totalprcp
433 real(RP) :: flux_qr(ka)
434 real(RP) :: flux_qs(ka)
436 real(RP) :: theta_eu(ka)
437 real(RP) :: theta_ee(ka)
440 real(RP) :: umfnewdold(ka)
447 real(RP) :: downent(ka)
448 real(RP) :: downdet(ka)
449 real(RP) :: theta_d(ka)
451 real(RP) :: prcp_flux
455 real(RP) :: temp_g(ka)
456 real(RP) :: qv_nw(ka)
457 real(RP) :: qc_nw(ka)
458 real(RP) :: qi_nw(ka)
459 real(RP) :: qr_nw(ka)
460 real(RP) :: qs_nw(ka)
462 real(RP) :: dQV, dQC, dQI, dQR, dQS
464 real(RP) :: Rtot_nw(ka)
465 real(RP) :: CPtot_nw(ka)
468 real(RP) :: pott_nw(ka)
471 real(RP) :: R_convflag(ia,ja)
474 log_progress(*)
'atmosphere / physics / cumulus / KF' 475 log_info(
"ATMOS_PHY_CP_kf_tendency",*)
'KF Convection Check ' 484 nca(i,j) = nca(i,j) - kf_dtsec
487 if ( nca(i,j) .ge. 0.5_dp * kf_dtsec ) cycle
491 rhod(k) = dens(k,i,j) * qdry(k,i,j)
495 cloudtop(i,j) = 0.0_rp
496 cloudbase(i,j) = 0.0_rp
497 sflx_convrain(i,j) = 0.0_rp
498 lifetime(i,j) = 0.0_rp
499 cldfrac_kf(:,:) = 0.0_rp
508 umfnewdold(:) = 0.0_rp
540 psat(k) = aliq*exp((bliq*temp(k,i,j)-cliq)/(temp(k,i,j)-dliq))
541 qsat(k) = 0.622_rp * psat(k) / ( pres(k,i,j) - psat(k) )
545 qv(k) = max( kf_eps, min( qsat(k), qv_in(k,i,j) / qdry(k,i,j) ) )
546 rh(k) = qv(k) / qsat(k)
552 deltap(k) = rhod(k) * grav * ( fz(k,i,j) - fz(k-1,i,j) )
555 cldfrac_kf(ks:ke,:) = 0.0_rp
556 sflx_convrain(i,j) = 0.0_rp
557 lifetime(i,j) = 0.0_rp
558 cloudtop(i,j) = 0.0_rp
559 cloudbase(i,j) = 0.0_rp
561 call cp_kf_trigger ( &
563 deltaz(:,i,j), z(:,i,j), &
566 deltap(:), deltax(i,j), &
571 temp_u(:), tempv(:), &
572 qv_u(:), qc(:), qi(:), &
573 qvdet(:), qcdet(:), qidet(:), &
574 flux_qr(:), flux_qs(:), &
576 theta_eu(:), theta_ee(:), &
579 upent(:), updet(:), &
580 k_lcl, k_lc, k_pbl, &
581 k_top, k_let, k_ml, &
584 cloudbase(i,j), zmix, &
588 if(i_convflag(i,j) /= 2)
then 589 ems(k_top+1:ke) = 0._rp
590 emsd(k_top+1:ke) = 0._rp
592 ems(k) = deltap(k) * deltax(i,j)**2 / grav
593 emsd(k) = 1._rp/ems(k)
594 umfnewdold(k) = 1._rp/umfnewdold(k)
598 call cp_kf_downdraft ( &
601 k_lcl, k_ml, k_top, k_pbl, k_let, k_lc, &
602 deltaz(:,i,j), z(:,i,j), cloudbase(i,j), &
603 u(:,i,j), v(:,i,j), rh(:), qv(:), pres(:,i,j), &
604 deltap(:), deltax(i,j), &
608 totalprcp, flux_qs(:), tempv(:), &
609 wspd(:), dmf(:), downent(:), downdet(:), &
610 theta_d(:), qv_d(:), prcp_flux, k_lfs, &
614 call cp_kf_compensational ( &
616 k_top, k_lc, k_pbl, k_ml, k_lfs, &
617 deltaz(:,i,j), z(:,i,j), pres(:,i,j), deltap(:), deltax(i,j), &
618 temp(:,i,j), qv(:), ems(:), emsd(:), &
619 presmix, zmix, dpthmx, &
621 temp_u(:), qvdet(:), umflcl, &
622 qc(:), qi(:), flux_qr(:), flux_qs(:), &
625 qv_d(:), theta_d(:), &
627 i_convflag(i,j), k_lcl, &
628 umf(:), upent(:), updet(:), &
629 qcdet(:), qidet(:), dmf(:), downent(:), downdet(:), &
632 temp_g(:), qv_nw(:), qc_nw(:), qi_nw(:), qr_nw(:), qs_nw(:), &
633 sflx_convrain(i,j), cldfrac_kf, &
634 lifetime(i,j), time_advec )
639 rtot_nw(k) = rtot(k,i,j) * dens(k,i,j)
640 cptot_nw(k) = cptot(k,i,j) * dens(k,i,j)
643 if(i_convflag(i,j) == 2)
then 644 sflx_convrain(i,j) = 0.0_rp
645 cldfrac_kf(ks:ke,:) = 0.0_rp
646 lifetime(i,j) = 0.0_rp
647 cloudtop(i,j) = 0.0_rp
648 cloudbase(i,j) = 0.0_rp
651 dens_t_cp(ks:ke,i,j) = 0.0_rp
652 rhot_t_cp(ks:ke,i,j) = 0.0_rp
653 rhoqv_t_cp(ks:ke,i,j) = 0.0_rp
655 rhoq_t_cp(ks:ke,i,j,iq) = 0.0_rp
664 if (i_convflag(i,j) == 0)
then 665 if (time_advec < lifetime(i,j)) nic=nint(time_advec/kf_dtsec)
666 nca(i,j) =
real(nic,
rp)*KF_DTSEC
667 elseif (i_convflag(i,j) == 1)
then 668 lifetime(i,j) = shallowlifetime
674 dqv = rhod(k) * ( qv_nw(k) - qv(k) )
675 rhoqv_t_cp(k,i,j) = dqv / lifetime(i,j)
676 rtot_nw(k) = rtot_nw(k) + dqv * rvap
677 cptot_nw(k) = cptot_nw(k) + dqv *
cp_vapor 679 dqc = qc_nw(k) * rhod(k)
680 dqr = qr_nw(k) * rhod(k)
681 rhoq_t_cp(k,i,j,
i_hc) = dqc / lifetime(i,j)
682 rhoq_t_cp(k,i,j,
i_hr) = dqr / lifetime(i,j)
683 cptot_nw(k) = cptot_nw(k) + ( dqc + dqr ) *
cp_water 685 if ( .not. warmrain )
then 686 dqi = qi_nw(k) * rhod(k)
687 dqs = qs_nw(k) * rhod(k)
692 rhoq_t_cp(k,i,j,
i_hi) = dqi / lifetime(i,j)
693 rhoq_t_cp(k,i,j,
i_hs) = dqs / lifetime(i,j)
694 cptot_nw(k) = cptot_nw(k) + ( dqi + dqs ) *
cp_ice 696 dens_t_cp(k,i,j) = rhoqv_t_cp(k,i,j) &
697 + rhoq_t_cp(k,i,j,
i_hc) + rhoq_t_cp(k,i,j,
i_hr) &
698 + rhoq_t_cp(k,i,j,
i_hi) + rhoq_t_cp(k,i,j,
i_hs)
699 dens_nw(k) = dens(k,i,j) + dqv + dqc + dqr + dqi + dqs
700 rtot_nw(k) = rtot_nw(k) / dens_nw(k)
701 cptot_nw(k) = cptot_nw(k) / dens_nw(k)
705 rhoq_t_cp(k,i,j,iq) = 0.0_rp
711 pott_nw(k) = temp_g(k) * ( pre00 / pres(k,i,j) )**( rtot_nw(k) / cptot_nw(k) )
715 rhot_t_cp(k,i,j) = ( dens_nw(k)*pott_nw(k) - rhot(k,i,j) ) / lifetime(i,j)
719 dens_t_cp(k,i,j) = 0.0_rp
720 rhot_t_cp(k,i,j) = 0.0_rp
721 rhoqv_t_cp(k,i,j) = 0.0_rp
723 rhoq_t_cp(k,i,j,iq) = 0.0_rp
731 cldfrac_sh(ks:ke,i,j) = cldfrac_kf(ks:ke,1)
732 cldfrac_dp(ks:ke,i,j) = cldfrac_kf(ks:ke,2)
738 call file_history_in( lifetime(:,:),
'KF_LIFETIME',
'lifetime of KF scheme',
's' )
739 r_convflag(:,:) =
real(I_convflag(:,:),RP)
740 call file_history_in( r_convflag(:,:),
'KF_CONVFLAG',
'CONVECTION FLAG',
'' )
749 subroutine cp_kf_trigger ( &
761 qvdet, qcdet, qidet, &
764 theta_eu, theta_ee, &
768 k_lcl, k_lc, k_pbl, &
769 k_top, k_let, k_ml, &
783 integer,
intent(in) :: KA, KS, KE
784 real(RP),
intent(in) :: dz_kf(ka),z_kf(ka)
785 real(RP),
intent(in) :: qv(ka)
786 real(RP),
intent(in) :: qes(ka)
787 real(RP),
intent(in) :: pres(ka)
788 real(RP),
intent(in) :: deltap(ka)
789 real(RP),
intent(in) :: deltax
790 real(RP),
intent(in) :: temp(ka)
791 real(RP),
intent(in) :: w0avg(ka)
793 real(RP),
intent(inout) :: umf(ka)
794 real(RP),
intent(inout) :: umflcl
795 real(RP),
intent(inout) :: upent(ka)
796 real(RP),
intent(inout) :: updet(ka)
797 real(RP),
intent(inout) :: temp_u(ka)
798 real(RP),
intent(inout) :: tempv(ka)
799 real(RP),
intent(inout) :: qv_u(ka)
800 real(RP),
intent(inout) :: totalprcp
801 real(RP),
intent(inout) :: cape
802 real(RP),
intent(inout) :: cloudtop
803 real(RP),
intent(inout) :: qc(ka)
804 real(RP),
intent(inout) :: qi(ka)
805 real(RP),
intent(inout) :: qvdet(ka)
806 real(RP),
intent(inout) :: qcdet(ka)
807 real(RP),
intent(inout) :: qidet(ka)
808 real(RP),
intent(inout) :: flux_qr(ka)
809 real(RP),
intent(inout) :: flux_qs(ka)
810 real(RP),
intent(inout) :: theta_eu(ka)
811 real(RP),
intent(inout) :: theta_ee(ka)
812 integer,
intent(inout) :: I_convflag
816 integer,
intent(inout) :: k_lcl
817 integer,
intent(inout) :: k_top
818 integer,
intent(inout) :: k_ml
819 real(RP),
intent(inout) :: zlcl
820 integer,
intent(inout) :: k_lc, k_let, k_pbl
821 real(RP),
intent(inout) :: zmix
822 real(RP),
intent(inout) :: presmix
823 real(RP),
intent(inout) :: umfnewdold(ka)
824 real(RP),
intent(inout) :: dpthmx
827 integer,
parameter :: itr_max = 10000
832 integer :: n_uslcheck
835 integer :: k_check(ka)
844 real(RP) :: cloudhight
845 real(RP) :: qrout(ka)
846 real(RP) :: qsout(ka)
850 real(RP) :: theta_mix
858 real(RP) :: tempv_env
864 real(RP) :: tempv_lcl
872 real(RP) :: umfnew,umfold
874 real(RP) :: CLDHGT(ka)
882 pres300 = pres(ks) - depth_usl*100._rp
884 tempv(kk) = temp(kk)*(1._rp + 0.608_rp*qv(kk))
889 if (pres(kk) >= pres300) k_llfc = kk
894 pres15 = pres(ks) - 15.e2_rp
898 if(pres(kk) < pres15 )
then 899 n_check = n_check + 1
900 k_check(n_check) = kk
901 pres15 = pres15 - 15.e2_rp
914 n_uslcheck = n_uslcheck + 1
917 if (n_uslcheck > n_check)
then 918 if (i_convflag == 1)
then 923 if (cldhgt(nnn) > chmax)
then 929 n_uslcheck = nuchm - 1
937 k_lc = k_check(n_uslcheck)
944 if ( nk + 1 < ks )
then 946 log_info(
"CP_kf_trigger",*)
'would go off bottom: cu_kf',pres(ks),k_lc,nk+1,n_uslcheck
953 log_info(
"CP_kf_trigger",*)
'would go off top: cu_kf' 957 dpthmx = dpthmx + deltap(nk)
958 n_layers = n_layers + 1
959 if (dpthmx > dpthmin)
then 964 if (dpthmx < dpthmin)
then 968 k_pbl = k_lc + n_layers -1
970 theta_mix = 0._rp; temp_mix = 0._rp; qv_mix = 0._rp; zmix = 0._rp;presmix = 0._rp
973 temp_mix = temp_mix + deltap(kk)*temp(kk)
974 qv_mix = qv_mix + deltap(kk)*qv(kk)
975 zmix = zmix + deltap(kk)*z_kf(kk)
976 presmix = presmix + deltap(kk)*pres(kk)
979 temp_mix = temp_mix/dpthmx
980 qv_mix = qv_mix/dpthmx
981 presmix = presmix/dpthmx
983 emix = qv_mix*presmix/(0.622_rp + qv_mix)
987 templog = log(emix/aliq)
988 temp_dew = (cliq - dliq*templog)/(bliq - templog)
991 temp_lcl = temp_dew - (0.212_rp + 1.571e-3_rp*(temp_dew - tem00) &
992 - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - temp_dew)
993 temp_lcl = min(temp_lcl,temp_mix)
994 tempv_lcl = temp_lcl*(1._rp + 0.608_rp*qv_mix)
995 zlcl = zmix + (temp_lcl - temp_mix)/gdcp
1000 if( zlcl <= z_kf(kk) )
exit 1003 if (zlcl > z_kf(ke))
then 1008 deltaz = ( zlcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
1009 temp_env = temp(k_lclm1) + ( temp(k_lcl) - temp(k_lclm1) )*deltaz
1010 qvenv = qv(k_lclm1) + ( qv(k_lcl) - qv(k_lclm1) )*deltaz
1011 tempv_env = temp_env*( 1._rp + 0.608_rp*qvenv )
1016 if (zlcl < 2.e3_rp)
then 1018 w_cz = 1.e-5_rp*zlcl
1025 w_g = (w0avg(k_lclm1) + (w0avg(k_lcl) - w0avg(k_lclm1))*deltaz )*deltax/25.e3_rp - w_cz
1026 if ( w_g < 1.e-4_rp)
then 1029 dtvv = 4.64_rp*w_g**0.33_rp
1034 if ( trigger == 2)
then 1035 else if ( trigger == 3)
then 1043 if(u00 < 1._rp)
then 1044 qs_lcl=qes(k_lclm1)+(qes(k_lcl)-qes(k_lclm1))*deltaz
1045 rh_lcl = qvenv/qs_lcl
1046 dqssdt = qv_mix*(cliq-bliq*dliq)/((temp_lcl-dliq)*(temp_lcl-dliq))
1047 if(rh_lcl >= 0.75_rp .and. rh_lcl <=0.95_rp)
then 1048 dtrh = 0.25_rp*(rh_lcl-0.75_rp)*qv_mix/dqssdt
1049 elseif(rh_lcl > 0.95_rp)
then 1050 dtrh = (1._rp/rh_lcl-1._rp)*qv_mix/dqssdt
1058 if (temp_lcl + dtvv + dtrh < temp_env)
then 1066 call cp_kf_envirtht( presmix, temp_mix, qv_mix, &
1069 if (dtvv + dtrh > 1.e-4_rp )
then 1070 w_lcl = 1._rp + 0.5_rp*sqrt(2._rp*grav*(dtvv + dtrh)*500._rp/tempv_env)
1071 w_lcl = min(w_lcl,3._rp)
1077 pres_lcl = pres(k_lclm1) + (pres(k_lcl) - pres(k_lclm1))*deltaz
1080 if (w_g < 0._rp )
then 1082 elseif (w_g > 0.1_rp)
then 1085 radius = 1000._rp + 1000._rp*w_g*10._rp
1088 call cp_kf_updraft ( &
1090 k_lcl, k_pbl, dz_kf(:), z_kf(:), &
1091 w_lcl, temp_lcl, tempv_lcl, pres_lcl, &
1092 qv_mix, qv(:), temp(:), tempv_env, &
1093 zlcl, pres(:), deltap(:), &
1094 deltax, radius, dpthmx, &
1095 k_let, theta_eu(:), &
1098 upent(:), updet(:), &
1099 umfnewdold(:), umfnew, umfold, &
1100 temp_u(:), theta_ee(:), &
1101 cloudhight, totalprcp, cloudtop, &
1102 qv_u(:), qc(:), qi(:), qrout(:), qsout(:), &
1103 qvdet(:), qcdet(:), qidet(:), &
1105 flux_qr(:), flux_qs(:) )
1108 cldhgt(k_lc) = cloudhight
1111 if(temp_lcl > 293._rp)
then 1113 elseif (temp_lcl < 293._rp .and. temp_lcl > 273._rp)
then 1114 d_min = 2.e3_rp + 100._rp*(temp_lcl - tem00)
1120 if ( k_top <= k_lcl .or. &
1121 k_top <= k_pbl .or. &
1122 k_let+1 <= k_pbl )
then 1124 cldhgt(k_lc) = cloudhight
1125 do kk = k_lclm1,k_top
1134 elseif (cloudhight > d_min .and. cape > 1._rp)
then 1143 if(n_uslcheck == nuchm)
then 1146 do kk = k_lclm1,k_top
1159 if ( itr .ge. itr_max )
then 1160 log_error(
"CP_kf_trigger",*)
'iteration max count was reached in the USL loop in the KF scheme' 1165 if (i_convflag == 1)
then 1166 k_start = max(k_pbl,k_lcl)
1172 if (k_let == k_top)
then 1173 updet(k_top) = umf(k_top) + updet(k_top) - upent(k_top)
1174 qcdet(k_top) = qc(k_top)*updet(k_top)*umfnew/umfold
1175 qidet(k_top) = qi(k_top)*updet(k_top)*umfnew/umfold
1176 upent(k_top) = 0._rp
1181 do kk = k_let+1,k_top
1182 dptt = dptt + deltap(kk)
1184 dumfdp = umf(k_let)/dptt
1193 do kk = k_let+1,k_top
1194 if(kk == k_top)
then 1195 updet(kk) = umf(kk-1)
1197 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1198 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1200 umf(kk) = umf(kk-1) - deltap(kk)*dumfdp
1201 upent(kk) = umf(kk)*(1._rp - 1._rp/umfnewdold(kk))
1202 updet(kk) = umf(kk-1) - umf(kk) + upent(kk)
1203 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1204 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1206 if (kk >= k_let+2)
then 1207 totalprcp = totalprcp - flux_qr(kk) - flux_qs(kk)
1208 flux_qr(kk) = umf(kk-1)*qrout(kk)
1209 flux_qs(kk) = umf(kk-1)*qsout(kk)
1210 totalprcp = totalprcp + flux_qr(kk) + flux_qs(kk)
1220 if(temp(kk) > tem00) k_ml = kk
1227 if (kk == k_lc)
then 1228 upent(kk) = umflcl*deltap(kk)/dpthmx
1229 umf(kk) = umflcl*deltap(kk)/dpthmx
1230 elseif (kk <= k_pbl)
then 1231 upent(kk) = umflcl*deltap(kk)/dpthmx
1232 umf(kk) = umf(kk-1) + upent(kk)
1238 temp_u(kk) = temp_mix + (z_kf(kk) - zmix)*gdcp
1259 call cp_kf_envirtht( pres(kk), temp(kk), qv(kk), &
1285 end subroutine cp_kf_trigger
1291 subroutine cp_kf_updraft ( &
1293 k_lcl, k_pbl, dz_kf, z_kf, &
1294 w_lcl, temp_lcl, tempv_lcl, pres_lcl, &
1295 qv_mix, qv, temp, tempv_env, &
1296 zlcl, pres, deltap, &
1297 deltax, radius, dpthmx, &
1302 umfnewdold, umfnew,umfold, &
1304 cloudhight, totalprcp, cloudtop, &
1305 qv_u, qc, qi, qrout, qsout, &
1306 qvdet, qcdet, qidet, &
1316 integer,
intent(in) :: KA, KS, KE
1317 integer,
intent(in) :: k_lcl
1318 integer,
intent(in) :: k_pbl
1319 real(RP),
intent(in) :: dz_kf(ka), z_kf(ka)
1320 real(RP),
intent(in) :: w_lcl
1321 real(RP),
intent(in) :: temp_lcl
1322 real(RP),
intent(in) :: tempv_lcl
1323 real(RP),
intent(in) :: pres_lcl
1324 real(RP),
intent(in) :: qv_mix
1325 real(RP),
intent(in) :: qv(ka)
1326 real(RP),
intent(in) :: temp(ka)
1327 real(RP),
intent(in) :: tempv_env
1328 real(RP),
intent(in) :: zlcl
1329 real(RP),
intent(in) :: pres(ka)
1330 real(RP),
intent(in) :: deltap(ka)
1331 real(RP),
intent(in) :: deltax
1332 real(RP),
intent(in) :: radius
1333 real(RP),
intent(in) :: dpthmx
1335 integer,
intent(inout) :: k_let
1336 real(RP),
intent(inout) :: theta_eu(ka)
1338 integer,
intent(out) :: k_top
1339 real(RP),
intent(out) :: umf(ka)
1340 real(RP),
intent(out) :: umflcl
1341 real(RP),
intent(out) :: upent(ka)
1342 real(RP),
intent(out) :: updet(ka)
1343 real(RP),
intent(out) :: umfnewdold(ka)
1344 real(RP),
intent(out) :: umfnew,umfold
1345 real(RP),
intent(out) :: temp_u(ka)
1346 real(RP),
intent(out) :: theta_ee(ka)
1347 real(RP),
intent(out) :: cloudhight
1348 real(RP),
intent(out) :: totalprcp
1349 real(RP),
intent(out) :: cloudtop
1350 real(RP),
intent(out) :: qv_u(ka)
1351 real(RP),
intent(out) :: qc(ka)
1352 real(RP),
intent(out) :: qi(ka)
1353 real(RP),
intent(out) :: qrout(ka)
1354 real(RP),
intent(out) :: qsout(ka)
1355 real(RP),
intent(out) :: qvdet(ka)
1356 real(RP),
intent(out) :: qcdet(ka)
1357 real(RP),
intent(out) :: qidet(ka)
1358 real(RP),
intent(out) :: cape
1359 real(RP),
intent(out) :: flux_qr(ka)
1360 real(RP),
intent(out) :: flux_qs(ka)
1364 real(RP) :: tempv_u(ka)
1365 real(RP) :: tempvq_u(ka)
1367 real(RP) :: ee1,ud1, ee2,ud2
1368 real(RP) :: f_eq(ka)
1369 real(RP) :: f_mix1,f_mix2
1370 real(RP) :: REI,DILBE
1371 real(RP) :: qcnew,qinew
1373 real(RP) :: f_frozen1
1375 real(RP) :: temptmp_ice
1376 real(RP) :: tempv(ka)
1382 real(RP) :: theta_tmp
1384 real(RP) :: qvtmp, qctmp, qitmp
1385 real(RP) :: temp_u95, temp_u10
1386 real(RP),
parameter :: temp_frzT = 268.16_rp
1387 real(RP),
parameter :: temp_frzB = 248.16_rp
1414 tempv(kk) = temp(kk)*(1._rp + 0.608_rp*qv(kk))
1417 umfnewdold(:) = 1._rp
1420 denslcl = pres_lcl/(r*tempv_lcl)
1421 umf(k_lclm1) = denslcl*1.e-2_rp*deltax**2
1422 umflcl = umf(k_lclm1)
1426 temp_u(k_lclm1) = temp_lcl
1427 tempv_u(k_lclm1) = tempv_lcl
1428 qv_u(k_lclm1) = qv_mix
1435 temptmp_ice = temp_frzt
1439 do kk = k_lclm1,ke-1
1443 temp_u(kkp1) = temp(kkp1)
1444 theta_eu(kkp1) = theta_eu(kk)
1445 qv_u(kkp1) = qv_u(kk)
1452 call cp_kf_tpmix2(pres(kkp1), theta_eu(kkp1), &
1453 temp_u(kkp1), qv_u(kkp1), qc(kkp1), qi(kkp1), &
1460 if (temp_u(kkp1) <= temp_frzt )
then 1461 if (temp_u(kkp1) > temp_frzb)
then 1462 if (temptmp_ice > temp_frzt) temptmp_ice = temp_frzt
1464 f_frozen1 = (temptmp_ice - temp_u(kkp1))/(temptmp_ice - temp_frzb)
1468 f_frozen1 = min(1._rp, max(0._rp, f_frozen1))
1469 temptmp_ice = temp_u(kkp1)
1471 qfrz = (qc(kkp1) + qcnew)*f_frozen1
1472 qinew = qinew + qcnew*f_frozen1
1473 qcnew = qcnew - qcnew*f_frozen1
1474 qi(kkp1) = qi(kkp1) + qc(kkp1)*f_frozen1
1475 qc(kkp1) = qc(kkp1) - qc(kkp1)*f_frozen1
1478 call cp_kf_dtfrznew( pres(kkp1), qfrz, &
1479 temp_u(kkp1), theta_eu(kkp1), qv_u(kkp1), qi(kkp1) )
1481 tempv_u(kkp1) = temp_u(kkp1)*(1._rp + 0.608_rp*qv_u(kkp1))
1483 if (kk == k_lclm1)
then 1484 boeff = (tempv_lcl + tempv_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp
1485 boterm = 2._rp*(z_kf(kkp1) - zlcl)*grav*boeff/1.5_rp
1486 dztmp = z_kf(kkp1) - zlcl
1488 boeff = (tempv_u(kk) + tempv_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp
1489 boterm = 2._rp*(dz_kf(kk) )*grav*boeff/1.5_rp
1493 entterm = 2._rp*rei*wtw/umfold
1495 call cp_kf_precipitation( &
1496 grav, dztmp, boterm, entterm, &
1497 wtw, qc(kkp1), qi(kkp1), qcnew, qinew, qrout(kkp1), qsout(kkp1) )
1503 if (wtw < 1.e-3_rp )
then 1506 wu(kkp1) = sqrt(wtw)
1509 call cp_kf_envirtht( pres(kkp1), temp(kkp1), qv(kkp1), &
1512 rei = umflcl*deltap(kkp1)*0.03_rp/radius
1515 tempvq_u(kkp1) = temp_u(kkp1)*(1._rp + 0.608_rp*qv_u(kkp1) - qc(kkp1) - qi(kkp1))
1516 if (kk == k_lclm1) then
1517 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp)*dztmp
1519 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp)*dztmp
1521 if(dilbe > 0._rp) cape = cape + dilbe*grav
1527 if(tempvq_u(kkp1) <= tempv(kkp1))
then 1534 temptmp = tempvq_u(kkp1)
1538 f_mix2 = 1._rp - f_mix1
1539 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1540 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1541 qctmp = f_mix2*qc(kkp1)
1542 qitmp = f_mix2*qi(kkp1)
1544 call cp_kf_tpmix2( pres(kkp1), theta_tmp, &
1545 temptmp, qvtmp, qctmp, qitmp, &
1548 temp_u95 = temptmp*(1._rp + 0.608_rp*qvtmp - qctmp - qitmp)
1550 if ( temp_u95 > tempv(kkp1))
then 1556 f_mix2 = 1._rp - f_mix1
1557 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1558 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1559 qctmp = f_mix2*qc(kkp1)
1560 qitmp = f_mix2*qi(kkp1)
1562 call cp_kf_tpmix2( pres(kkp1), theta_tmp, &
1563 temptmp, qvtmp, qctmp, qitmp, &
1566 temp_u10 = temptmp*(1._rp + 0.608_rp*qvtmp - qctmp - qitmp)
1567 if (abs(temp_u10 - tempvq_u(kkp1)) < 1.e-3_rp )
then 1572 f_eq(kkp1) = (tempv(kkp1) - tempvq_u(kkp1))*f_mix1 &
1573 & /(temp_u10 - tempvq_u(kkp1))
1574 f_eq(kkp1) = max(0._rp,f_eq(kkp1) )
1575 f_eq(kkp1) = min(1._rp,f_eq(kkp1) )
1576 if (f_eq(kkp1) == 1._rp)
then 1579 elseif (f_eq(kkp1) == 0._rp)
then 1585 call cp_kf_prof5( f_eq(kkp1), &
1591 ee2 = max(ee2,0.5_rp)
1594 upent(kkp1) = 0.5_rp*rei*(ee1 + ee2)
1595 updet(kkp1) = 0.5_rp*rei*(ud1 + ud2)
1598 if (umf(kk) - updet(kkp1) < 10._rp)
then 1602 if (dilbe > 0._rp)
then 1603 cape = cape - dilbe*grav
1610 umfold = umf(kk) - updet(kkp1)
1611 umfnew = umfold + upent(kkp1)
1613 umfnewdold(kkp1) = umfnew/umfold
1614 qcdet(kkp1) = qc(kkp1)*updet(kkp1)
1615 qidet(kkp1) = qi(kkp1)*updet(kkp1)
1616 qvdet(kkp1) = qv_u(kkp1)
1618 qv_u(kkp1) = (umfold*qv_u(kkp1) + upent(kkp1)*qv(kkp1))/umfnew
1619 theta_eu(kkp1) = (umfold*theta_eu(kkp1) + upent(kkp1)*theta_ee(kkp1))/umfnew
1622 qc(kkp1) = qc(kkp1)*umfold/umfnew
1623 qi(kkp1) = qi(kkp1)*umfold/umfnew
1626 flux_qr(kkp1) = qrout(kkp1)*umf(kk)
1627 flux_qs(kkp1) = qsout(kkp1)*umf(kk)
1628 totalprcp = totalprcp + flux_qr(kkp1) + flux_qs(kkp1)
1631 if(kkp1 <= k_pbl ) upent(kkp1) = upent(kkp1) + umflcl*deltap(kkp1)/dpthmx
1636 cloudhight = z_kf(k_top) - zlcl
1637 cloudtop = z_kf(k_top)
1640 end subroutine cp_kf_updraft
1646 subroutine cp_kf_downdraft ( &
1649 k_lcl, k_ml, k_top, k_pbl, k_let, k_lc, &
1650 dz_kf, z_kf, zlcl, &
1651 u, v, rh, qv, pres, &
1656 totalprcp, flux_qs, tempv, &
1657 wspd, dmf, downent, downdet, &
1658 theta_d, qv_d, prcp_flux, k_lfs, &
1669 atmos_saturation_psat_liq
1673 integer,
intent(in) :: KA, KS, KE
1674 integer,
intent(in) :: I_convflag
1675 integer,
intent(in) :: k_lcl
1676 integer,
intent(in) :: k_top
1677 integer,
intent(in) :: k_pbl
1678 integer,
intent(in) :: k_let
1679 integer,
intent(in) :: k_lc
1680 integer,
intent(in) :: k_ml
1681 real(RP),
intent(in) :: dz_kf(ka), z_kf(ka)
1682 real(RP),
intent(in) :: u(ka)
1683 real(RP),
intent(in) :: v(ka)
1684 real(RP),
intent(in) :: rh(ka)
1685 real(RP),
intent(in) :: qv(ka)
1686 real(RP),
intent(in) :: pres(ka)
1687 real(RP),
intent(in) :: deltap(ka)
1688 real(RP),
intent(in) :: deltax
1689 real(RP),
intent(in) :: ems(ka)
1690 real(RP),
intent(in) :: emsd(ka)
1691 real(RP),
intent(in) :: zlcl
1692 real(RP),
intent(in) :: umf(ka)
1693 real(RP),
intent(in) :: totalprcp
1694 real(RP),
intent(in) :: flux_qs(ka)
1695 real(RP),
intent(in) :: tempv(ka)
1696 real(RP),
intent(in) :: theta_ee(ka)
1698 real(RP),
intent(out) :: wspd(3)
1699 real(RP),
intent(out) :: dmf(ka)
1700 real(RP),
intent(out) :: downent(ka)
1701 real(RP),
intent(out) :: downdet(ka)
1702 real(RP),
intent(out) :: theta_d(ka)
1703 real(RP),
intent(out) :: qv_d(ka)
1704 real(RP),
intent(out) :: prcp_flux
1705 real(RP),
intent(out) :: tder
1706 real(RP),
intent(out) :: CPR
1707 integer,
intent(out) :: k_lfs
1718 real(RP) :: pef_wind
1719 real(RP) :: pef_cloud
1732 real(RP) :: temp_d(ka)
1733 real(RP) :: tempv_d(ka)
1734 real(RP) :: theta_ed(ka)
1735 real(RP) :: qvsd(ka)
1739 real(RP) :: dtempmlt
1758 if (i_convflag == 2)
return 1762 if (pres(kk) >= pres(ks)*0.5_rp) k_z5 = kk
1765 wspd(1) = sqrt(u(k_lcl)*u(k_lcl) + v(k_lcl)*v(k_lcl))
1766 wspd(2) = sqrt(u(k_z5)*u(k_z5) + v(k_z5)*v(k_z5))
1767 wspd(3) = sqrt(u(k_top)*u(k_top) + v(k_top)*v(k_top))
1772 if(wspd(3) > wspd(1))
then 1777 vws = (u(k_top) - u(k_lcl))*(u(k_top) - u(k_lcl)) &
1778 + (v(k_top) - v(k_lcl))*(v(k_top) - v(k_lcl))
1780 vws = 1.e3_rp*shsign*sqrt(vws)/(z_kf(k_top) - z_kf(k_lcl))
1783 pef_wind = 1.591_rp + vws*(-0.639_rp + vws*(9.53e-2_rp - vws*4.96e-3_rp) )
1785 pef_wind = max(pef_wind,0.2_rp)
1786 pef_wind = min(pef_wind,0.9_rp)
1790 cbh = (zlcl - z_kf(ks))*3.281e-3_rp
1791 if( cbh < 3._rp)
then 1794 rcbh = 0.96729352_rp + cbh*(-0.70034167_rp + cbh*(0.162179896_rp + cbh*(- &
1795 1.2569798e-2_rp + cbh*(4.2772e-4_rp - cbh*5.44e-6_rp))))
1797 if(cbh > 25.0_rp) rcbh = 2.4_rp
1798 pef_cloud = 1._rp/(1._rp + rcbh)
1799 pef_cloud = min(pef_cloud,0.9_rp)
1801 pef = 0.5_rp*(pef_wind + pef_cloud)
1804 if(i_convflag == 1)
then 1808 k_dstart = k_pbl + 1
1809 k_lfstmp = k_let - 1
1810 do kk = k_dstart+1, ke
1811 dpthtmp = pres(k_dstart) - pres(kk)
1812 if(dpthtmp > 150.e2_rp)
then 1817 k_lfstmp = min(k_lfstmp, k_let - 1)
1824 if(pres(k_dstart) - pres(k_lfs) > 50.e2_rp)
then 1825 theta_ed(k_lfs) = theta_ee(k_lfs)
1826 qv_d(k_lfs) = qv(k_lfs)
1828 call cp_kf_tpmix2dd( pres(k_lfs), theta_ed(k_lfs), &
1829 temp_d(k_lfs), qvs_tmp )
1830 call cp_kf_calcexn( pres(k_lfs), qvs_tmp, &
1835 theta_d(k_lfs) = temp_d(k_lfs)*exn(k_lfs)
1837 tempv_d(k_lfs) = temp_d(k_lfs)*(1._rp + 0.608_rp*qvs_tmp)
1838 dens_d = pres(k_lfs)/(r*tempv_d(k_lfs))
1839 dmf(k_lfs) = -(1._rp - pef)*1.e-2_rp*deltax**2*dens_d
1840 downent(k_lfs) = dmf(k_lfs)
1841 downdet(k_lfs) = 0._rp
1842 rhbar = rh(k_lfs)*deltap(k_lfs)
1843 dpthtmp = deltap(k_lfs)
1847 do kk = k_lfs-1,k_dstart,-1
1849 downent(kk) = downent(k_lfs)*ems(kk)/ems(k_lfs)
1851 dmf(kk) = dmf(kkp1) + downent(kk)
1852 theta_ed(kk) = ( theta_ed(kkp1)*dmf(kkp1) + theta_ee(kk)*downent(kk) )/dmf(kk)
1853 qv_d(kk) = ( qv_d(kkp1)*dmf(kkp1) + qv(kk)*downent(kk) )/dmf(kk)
1854 dpthtmp = dpthtmp + deltap(kk)
1855 rhbar = rhbar + rh(kk)*deltap(kk)
1857 rhbar = rhbar/dpthtmp
1858 f_dmf = 2._rp*(1._rp - rhbar)
1864 prcpmlt = prcpmlt + flux_qs(kk)
1866 if (k_lc < k_ml )
then 1869 dtempmlt = emelt*prcpmlt/(cp*umf(k_lcl))
1873 call cp_kf_tpmix2dd( pres(k_dstart), theta_ed(k_dstart), &
1874 temp_d(k_dstart), qvs_tmp )
1875 temp_d(k_dstart) = temp_d(k_dstart) - dtempmlt
1880 es = aliq*exp((bliq*temp_d(k_dstart)-cliq)/(temp_d(k_dstart)-dliq))
1882 qvs_tmp = 0.622_rp*es/(pres(k_dstart) - es )
1884 theta_ed(k_dstart) = temp_d(k_dstart)*(pre00/pres(k_dstart))**(0.2854_rp*(1._rp - 0.28_rp*qvs_tmp))* &
1885 & exp((3374.6525_rp/temp_d(k_dstart)-2.5403_rp)*qvs_tmp*(1._rp + 0.81_rp*qvs_tmp))
1886 k_ldt = min(k_lfs-1, k_dstart-1)
1890 dpthdet = dpthdet + deltap(kk)
1891 theta_ed(kk) = theta_ed(k_dstart)
1892 qv_d(kk) = qv_d(k_dstart)
1893 call cp_kf_tpmix2dd( pres(kk), theta_ed(kk), &
1894 temp_d(kk), qvs_tmp )
1897 rhh = 1._rp - 2.e-4_rp*(z_kf(k_dstart) -z_kf(kk) )
1901 if(rhh < 1._rp)
then 1903 dssdt = (cliq - bliq*dliq)/((temp_d(kk) - dliq)*(temp_d(kk) - dliq))
1904 rl = xlv0 - xlv1*temp_d(kk)
1905 dtmp = rl*qvs_tmp*(1._rp - rhh )/(cp + rl*rhh*qvs_tmp*dssdt )
1906 t1rh = temp_d(kk) + dtmp
1910 es = aliq*exp((bliq*t1rh-cliq)/(t1rh-dliq))
1913 qsrh = 0.622_rp*es/(pres(kk) - es)
1914 if(qsrh < qv_d(kk) )
then 1916 t1rh = temp_d(kk) + (qvs_tmp - qsrh)*rl/cp
1925 tempv_d(kk) = temp_d(kk)*( 1._rp + 0.608_rp*qvsd(kk) )
1926 if(tempv_d(kk) > tempv(kk) .or. kk == ks)
then 1932 if((pres(k_ldb)-pres(k_lfs)) > 50.e2_rp )
then 1933 do kk = k_ldt,k_ldb,-1
1935 downdet(kk) = -dmf(k_dstart)*deltap(kk)/dpthdet
1937 dmf(kk) = dmf(kkp1) + downdet(kk)
1938 tder = tder + (qvsd(kk) - qv_d(kk))*downdet(kk)
1940 call cp_kf_calcexn( pres(kk), qv_d(kk), &
1942 theta_d(kk) = temp_d(kk)*exn(kk)
1951 if (tder < 1._rp)
then 1952 prcp_flux = totalprcp
1965 ddinc = -f_dmf*umf(k_lcl)/dmf(k_dstart)
1966 if(tder*ddinc > totalprcp)
then 1967 ddinc = totalprcp/tder
1971 dmf(kk) = dmf(kk)*ddinc
1972 downent(kk) = downent(kk)*ddinc
1973 downdet(kk) = downdet(kk)*ddinc
1976 prcp_flux = totalprcp - tder
1977 if ( totalprcp < kf_eps )
then 1980 pef = prcp_flux/totalprcp
1996 if (k_ldb > ks)
then 2016 do kk = k_ldt+1,k_lfs-1
2024 end subroutine cp_kf_downdraft
2030 subroutine cp_kf_compensational (&
2032 k_top, k_lc, k_pbl, k_ml, k_lfs, &
2033 dz_kf, z_kf, pres, deltap, deltax, &
2036 presmix, zmix, dpthmx, &
2038 temp_u, qvdet, umflcl, &
2039 qc, qi, flux_qr, flux_qs, &
2044 I_convflag, k_lcl_bf, &
2045 umf, upent, updet, &
2046 qcdet, qidet, dmf, downent, downdet, &
2049 temp_g, qv_g, qc_nw, qi_nw, qr_nw, qs_nw, &
2050 rainrate_cp, cldfrac_KF, &
2051 timecp, time_advec )
2059 atmos_saturation_psat_liq
2065 integer,
intent(in) :: KA, KS, KE
2066 integer,
intent(in) :: k_top
2067 integer,
intent(in) :: k_lc
2068 integer,
intent(in) :: k_pbl
2069 integer,
intent(in) :: k_ml
2070 integer,
intent(in) :: k_lfs
2071 real(RP),
intent(in) :: dz_kf(ka),z_kf(ka)
2072 real(RP),
intent(in) :: pres(ka)
2073 real(RP),
intent(in) :: deltap(ka)
2074 real(RP),
intent(in) :: deltax
2075 real(RP),
intent(in) :: temp_bf(ka)
2076 real(RP),
intent(in) :: qv(ka)
2077 real(RP),
intent(in) :: ems(ka)
2078 real(RP),
intent(in) :: emsd(ka)
2079 real(RP),
intent(in) :: presmix
2080 real(RP),
intent(in) :: zmix
2081 real(RP),
intent(in) :: dpthmx
2082 real(RP),
intent(in) :: cape
2083 real(RP),
intent(in) :: temp_u(ka)
2084 real(RP),
intent(in) :: qvdet(ka)
2085 real(RP),
intent(in) :: umflcl
2086 real(RP),
intent(in) :: qc(ka)
2087 real(RP),
intent(in) :: qi(ka)
2088 real(RP),
intent(in) :: flux_qr(ka)
2089 real(RP),
intent(in) :: flux_qs(ka)
2090 real(RP),
intent(in) :: umfnewdold(ka)
2091 real(RP),
intent(in) :: wspd(3)
2092 real(RP),
intent(in) :: qv_d(ka)
2093 real(RP),
intent(in) :: theta_d(ka)
2094 real(RP),
intent(in) :: cpr
2096 integer,
intent(inout) :: I_convflag
2097 integer,
intent(inout) :: k_lcl_bf
2098 real(RP),
intent(inout) :: umf(ka)
2099 real(RP),
intent(inout) :: upent(ka)
2100 real(RP),
intent(inout) :: updet(ka)
2101 real(RP),
intent(inout) :: qcdet(ka)
2102 real(RP),
intent(inout) :: qidet(ka)
2103 real(RP),
intent(inout) :: dmf(ka)
2104 real(RP),
intent(inout) :: downent(ka)
2105 real(RP),
intent(inout) :: downdet(ka)
2106 real(RP),
intent(inout) :: prcp_flux
2107 real(RP),
intent(inout) :: tder
2109 integer,
intent (out) :: nic
2112 real(RP),
intent(out) :: temp_g(ka)
2113 real(RP),
intent(out) :: qv_g(ka)
2114 real(RP),
intent(out) :: qc_nw(ka)
2115 real(RP),
intent(out) :: qi_nw(ka)
2116 real(RP),
intent(out) :: qr_nw(ka)
2117 real(RP),
intent(out) :: qs_nw(ka)
2118 real(RP),
intent(out) :: rainrate_cp
2119 real(RP),
intent(out) :: cldfrac_KF(ka,2)
2120 real(RP),
intent(out) :: timecp
2121 real(RP),
intent(out) :: time_advec
2125 integer :: ntimecount
2130 integer :: k_lcl, k_lclm1
2132 real(RP) :: umf2(ka), dmf2(ka)
2133 real(RP) :: upent2(ka), updet2(ka)
2134 real(RP) :: qcdet2(ka), qidet2(ka)
2135 real(RP) :: downent2(ka), downdet2(ka)
2136 real(RP) :: prcp_flux2
2140 real(RP) :: theta(ka)
2141 real(RP) :: theta_u(ka)
2142 real(RP) :: theta_eu(ka)
2143 real(RP) :: theta_eg(ka)
2147 real(RP) :: qv_gu(ka)
2148 real(RP) :: temp_env
2149 real(RP) :: tempv_env
2150 real(RP) :: temp_lcl
2151 real(RP) :: tempv_lcl
2152 real(RP) :: temp_mix
2153 real(RP) :: temp_gu(ka)
2154 real(RP) :: tempv_g(ka)
2155 real(RP) :: tempvq_u(ka)
2158 real(RP) :: DQ, TDPT, DSSDT, emix, RL, TLOG
2163 real(RP) :: theta_nw(ka)
2164 real(RP) :: theta_g(ka)
2165 real(RP) :: qv_nw(ka)
2170 real(RP) :: f_cape ,f_capeold
2175 real(RP) :: tma,tmb,tmm
2176 real(RP) :: acoeff,bcoeff
2178 real(RP) :: ainc,ainctmp, aincmx,aincold
2184 real(RP) :: domg_dp(ka)
2185 real(RP) :: absomgtc,absomg
2188 real(RP) :: theta_fxin(ka), theta_fxout(ka)
2189 real(RP) :: qv_fxin(ka), qv_fxout(ka)
2190 real(RP) :: qc_fxin(ka), qc_fxout(ka)
2191 real(RP) :: qi_fxin(ka), qi_fxout(ka)
2192 real(RP) :: qr_fxin(ka), qr_fxout(ka)
2193 real(RP) :: qs_fxin(ka), qs_fxout(ka)
2194 real(RP) :: rainfb(ka), snowfb(ka)
2204 real(RP) :: xcldfrac
2207 if(i_convflag == 2)
return 2210 if(i_convflag == 1) fbfrc = 1._rp
2212 vconv = 0.5_rp*(wspd(1) + wspd(2))
2213 timecp = deltax/vconv
2215 timecp = max(deeplifetime, timecp)
2216 timecp = min(3600._rp, timecp)
2217 if(i_convflag == 1) timecp = shallowlifetime
2218 nic = nint(timecp/kf_dtsec)
2219 timecp =
real( nic,
rp )*KF_DTSEC
2223 k_lmax = max(k_lcl,k_lfs)
2225 if((upent(kk)-downent(kk)) > 1.e-3_rp)
then 2226 ainctmp = ems(kk)/( (upent(kk) -downent(kk))*timecp )
2227 aincmx = min(aincmx,ainctmp)
2231 if(aincmx < ainc ) ainc = aincmx
2234 prcp_flux2 = prcp_flux
2237 upent2(kk) = upent(kk)
2238 updet2(kk) = updet(kk)
2239 qcdet2(kk) = qcdet(kk)
2240 qidet2(kk) = qidet(kk)
2242 downent2(kk) = downent(kk)
2243 downdet2(kk) = downdet(kk)
2246 stab = 1.05_rp - delcape
2249 if (i_convflag == 1)
then 2252 evac = 0.50_rp*tkemax*1.e-1_rp
2253 ainc = evac*dpthmx*deltax**2/( umflcl*grav*timecp)
2255 prcp_flux = prcp_flux2*ainc
2257 umf(kk) = umf2(kk)*ainc
2258 upent(kk) = upent2(kk)*ainc
2259 updet(kk) = updet2(kk)*ainc
2260 qcdet(kk) = qcdet2(kk)*ainc
2261 qidet(kk) = qidet2(kk)*ainc
2262 dmf(kk) = dmf2(kk)*ainc
2263 downent(kk) = downent2(kk)*ainc
2264 downdet(kk) = downdet2(kk)*ainc
2270 call cp_kf_calcexn( pres(kk), qv(kk), &
2272 theta(kk) = temp_bf(kk)*exn(kk)
2273 call cp_kf_calcexn( pres(kk), qvdet(kk), &
2275 theta_u(kk) = temp_u(kk)*exn(kk)
2277 temp_g(k_top+1:ke) = temp_bf(k_top+1:ke)
2278 qv_g(k_top+1:ke) = qv(k_top+1:ke)
2286 domg_dp(kk) = -(upent(kk) - downent(kk) - updet(kk) - downdet(kk))*emsd(kk)
2288 omg(kk) = omg(kk-1) - deltap(kk-1)*domg_dp(kk-1)
2289 absomg = abs(omg(kk))
2290 absomgtc = absomg*timecp
2291 f_dp = 0.75_rp*deltap(kk-1)
2292 if(absomgtc > f_dp)
THEN 2293 dtt_tmp = f_dp/abs(omg(kk))
2294 dtt=min(dtt,dtt_tmp)
2300 theta_nw(kk) = theta(kk)
2302 fxm(kk) = omg(kk)*deltax**2/grav
2304 nstep = nint(timecp/dtt + 1)
2305 deltat = timecp/
real(nstep,RP) 2306 do ntimecount = 1, nstep
2311 theta_fxin(kk) = 0._rp
2312 theta_fxout(kk) = 0._rp
2314 qv_fxout(kk) = 0._rp
2317 if(omg(kk) <= 0._rp)
then 2318 theta_fxin(kk) = -fxm(kk)*theta_nw(kk-1)
2319 qv_fxin(kk) = -fxm(kk)*qv_nw(kk-1)
2320 theta_fxout(kk - 1) = theta_fxout(kk-1) + theta_fxin(kk)
2321 qv_fxout(kk - 1) = qv_fxout(kk-1) + qv_fxin(kk)
2323 theta_fxout(kk) = fxm(kk)*theta_nw(kk)
2324 qv_fxout(kk) = fxm(kk)*qv_nw(kk)
2325 theta_fxin(kk - 1) = theta_fxin(kk-1) + theta_fxout(kk)
2326 qv_fxin(kk - 1) = qv_fxin(kk-1) + qv_fxout(kk)
2332 theta_nw(kk) = theta_nw(kk) &
2333 + (theta_fxin(kk) - theta_fxout(kk) &
2334 + updet(kk)*theta_u(kk) + downdet(kk)*theta_d(kk) &
2335 - ( upent(kk) - downent(kk) )*theta(kk) ) *deltat*emsd(kk)
2336 qv_nw(kk) = qv_nw(kk) &
2337 + (qv_fxin(kk) - qv_fxout(kk) &
2338 + updet(kk)*qvdet(kk) + downdet(kk)*qv_d(kk) &
2339 - ( upent(kk) - downent(kk) )*qv(kk) )*deltat*emsd(kk)
2344 theta_g(kk) = theta_nw(kk)
2345 qv_g(kk) = qv_nw(kk)
2350 if(qv_g(kk) < kf_eps )
then 2352 log_error(
"CP_kf_compensational",*)
"error qv<0 @ Kain-Fritsch cumulus parameterization" 2356 if(kk == k_top)
then 2359 tma = qv_g(kkp1)*ems(kkp1)
2360 tmb = qv_g(kk-1)*ems(kk-1)
2362 tmm = (qv_g(kk) - kf_eps )*ems(kk)
2363 bcoeff = -tmm/((tma*tma)/tmb + tmb)
2364 acoeff = bcoeff*tma/tmb
2365 tmb = tmb*(1._rp - bcoeff)
2366 tma = tma*(1._rp - acoeff)
2369 qv_g(kkp1) = tma*emsd(kkp1)
2370 qv_g(kk-1) = tmb*emsd(kk-1)
2374 if ( qv_g(kk) < kf_eps ) qv_g(kk) = kf_eps
2377 topomg = (updet(k_top) - upent(k_top))*deltap(k_top)*emsd(k_top)
2378 if( abs(topomg - omg(k_top)) > 1.e-3_rp)
then 2380 log_error(
"CP_kf_compensational",*)
"KF omega is not consistent",ncount
2381 log_error_cont(*)
"omega error",abs(topomg - omg(k_top)),k_top,topomg,omg(k_top)
2386 call cp_kf_calcexn( pres(kk), qv_g(kk), &
2388 temp_g(kk) = theta_g(kk)/exn(kk)
2389 tempv_g(kk) = temp_g(kk)*(1._rp + 0.608_rp*qv_g(kk))
2393 if(i_convflag == 1)
then 2399 temp_mix = temp_mix + deltap(kk)*temp_g(kk)
2400 qv_mix = qv_mix + deltap(kk)*qv_g(kk)
2403 temp_mix = temp_mix/dpthmx
2404 qv_mix = qv_mix/dpthmx
2409 es = aliq*exp((bliq*temp_mix-cliq)/(temp_mix-dliq))
2411 qvss = 0.622_rp*es/(presmix -es)
2414 if (qv_mix > qvss)
then 2415 rl = xlv0 -xlv1*temp_mix
2416 cpm = cp*(1._rp + 0.887_rp*qv_mix)
2417 dssdt = qvss*(cliq-bliq*dliq)/( (temp_mix-dliq)**2)
2418 dq = (qv_mix -qvss)/(1._rp + rl*dssdt/cpm)
2419 temp_mix = temp_mix + rl/cp*dq
2420 qv_mix = qv_mix - dq
2423 qv_mix = max(qv_mix,0._rp)
2424 emix = qv_mix*presmix/(0.622_rp + qv_mix)
2425 tlog = log(emix/aliq)
2427 tdpt = (cliq - dliq*tlog)/(bliq - tlog)
2428 temp_lcl = tdpt - (0.212_rp + 1.571e-3_rp*(tdpt - tem00) - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - tdpt)
2429 temp_lcl = min(temp_lcl,temp_mix)
2431 tempv_lcl = temp_lcl*(1._rp + 0.608_rp*qv_mix)
2432 z_lcl = zmix + (temp_lcl - temp_mix)/gdcp
2435 if( z_lcl <= z_kf(kk) )
exit 2440 deltaz = ( z_lcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
2441 temp_env = temp_g(k_lclm1) + ( temp_g(k_lcl) - temp_g(k_lclm1) )*deltaz
2442 qv_env = qv_g(k_lclm1) + ( qv_g(k_lcl) - qv_g(k_lclm1) )*deltaz
2443 tempv_env = temp_env*( 1._rp + 0.608_rp*qv_env )
2445 theta_eu(k_lclm1)=temp_mix*(pre00/presmix)**(0.2854_rp*(1._rp - 0.28_rp*qv_mix))* &
2446 exp((3374.6525_rp/temp_lcl-2.5403_rp)*qv_mix*(1._rp + 0.81_rp*qv_mix))
2450 do kk=k_lclm1,k_top-1
2452 theta_eu(kkp1) = theta_eu(kk)
2454 call cp_kf_tpmix2dd( pres(kkp1), theta_eu(kkp1), &
2455 temp_gu(kkp1), qv_gu(kkp1) )
2456 tempvq_u(kkp1) = temp_gu(kkp1)*(1._rp + 0.608_rp*qv_gu(kkp1) - qc(kkp1)- qi(kkp1))
2457 if(kk == k_lclm1)
then 2458 dzz = z_kf(k_lcl) - z_lcl
2459 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv_g(kkp1)) - 1._rp)*dzz
2462 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv_g(kk) + tempv_g(kkp1)) - 1._rp)*dzz
2464 if(dilbe > 0._rp) cape_g = cape_g + dilbe*grav
2467 call cp_kf_envirtht( pres(kkp1), temp_g(kkp1), qv_g(kkp1), &
2471 theta_eu(kkp1) = theta_eu(kkp1)*(umfnewdold(kkp1)) + theta_eg(kkp1)*(1._rp - (umfnewdold(kkp1)))
2473 if (noiter == 1)
exit 2474 dcape = max(cape - cape_g,cape*0.1_rp)
2475 f_cape = cape_g/cape
2476 if(f_cape > 1._rp .and. i_convflag == 0)
then 2480 if(ncount /= 1)
then 2481 if(abs(ainc - aincold) < 1.e-4_rp)
then 2486 dfda = (f_cape - f_capeold)/(ainc - aincold)
2487 if (dfda > 0._rp )
then 2499 if (ainc/aincmx > 0.999_rp .and. f_cape > 1.05_rp-stab )
then 2505 if( (f_cape <= 1.05_rp-stab .and. f_cape >= 0.95_rp-stab) .or. ncount == 10)
then 2508 if(ncount > 10)
exit 2509 if(f_cape == 0._rp)
then 2512 if(dcape < 1.e-4)
then 2517 ainc = ainc*stab*cape/dcape
2520 ainc = min(aincmx,ainc)
2522 if (ainc < 0.05_rp)
then 2528 prcp_flux = prcp_flux2*ainc
2530 umf(kk) = umf2(kk)*ainc
2531 upent(kk) = upent2(kk)*ainc
2532 updet(kk) = updet2(kk)*ainc
2533 qcdet(kk) = qcdet2(kk)*ainc
2534 qidet(kk) = qidet2(kk)*ainc
2535 dmf(kk) = dmf2(kk)*ainc
2536 downent(kk) = downent2(kk)*ainc
2537 downdet(kk) = downdet2(kk)*ainc
2544 cldfrac_kf(:,:) = 0._rp
2545 if (i_convflag == 1)
then 2546 do kk = k_lcl-1, k_top
2547 umf_tmp = umf(kk)/(deltax**2)
2548 xcldfrac = 0.07_rp*log(1._rp+(500._rp*umf_tmp))
2549 xcldfrac = max(1.e-2_rp,xcldfrac)
2550 cldfrac_kf(kk,1) = min(2.e-2_rp,xcldfrac)
2553 do kk = k_lcl-1, k_top
2554 umf_tmp = umf(kk)/(deltax**2)
2555 xcldfrac = 0.14_rp*log(1._rp+(500._rp*umf_tmp))
2556 xcldfrac = max(1.e-2_rp,xcldfrac)
2557 cldfrac_kf(kk,2) = min(6.e-1_rp,xcldfrac)
2566 if (cpr > 0._rp)
then 2567 frc2 = prcp_flux/(cpr*ainc)
2572 qc_nw(ks:ke) = 0._rp
2573 qi_nw(ks:ke) = 0._rp
2574 qr_nw(ks:ke) = 0._rp
2575 qs_nw(ks:ke) = 0._rp
2577 rainfb(kk) = flux_qr(kk)*ainc*fbfrc*frc2
2578 snowfb(kk) = flux_qs(kk)*ainc*fbfrc*frc2
2581 do ntimecount = 1, nstep
2584 qc_fxout(kk) = 0._rp
2586 qi_fxout(kk) = 0._rp
2588 qr_fxout(kk) = 0._rp
2590 qs_fxout(kk) = 0._rp
2593 if(omg(kk) <= 0._rp)
then 2594 qc_fxin(kk) = -fxm(kk)*qc_nw(kk-1)
2595 qi_fxin(kk) = -fxm(kk)*qi_nw(kk-1)
2596 qr_fxin(kk) = -fxm(kk)*qr_nw(kk-1)
2597 qs_fxin(kk) = -fxm(kk)*qs_nw(kk-1)
2599 qc_fxout(kk-1) = qc_fxout(kk-1) + qc_fxin(kk)
2600 qi_fxout(kk-1) = qi_fxout(kk-1) + qi_fxin(kk)
2601 qr_fxout(kk-1) = qr_fxout(kk-1) + qr_fxin(kk)
2602 qs_fxout(kk-1) = qs_fxout(kk-1) + qs_fxin(kk)
2604 qc_fxout(kk) = fxm(kk)*qc_nw(kk)
2605 qi_fxout(kk) = fxm(kk)*qi_nw(kk)
2606 qr_fxout(kk) = fxm(kk)*qr_nw(kk)
2607 qs_fxout(kk) = fxm(kk)*qs_nw(kk)
2609 qc_fxin(kk-1) = qc_fxin(kk-1) + qc_fxout(kk)
2610 qi_fxin(kk-1) = qi_fxin(kk-1) + qi_fxout(kk)
2611 qr_fxin(kk-1) = qr_fxin(kk-1) + qr_fxout(kk)
2612 qs_fxin(kk-1) = qs_fxin(kk-1) + qs_fxout(kk)
2617 qc_nw(kk) = qc_nw(kk) + (qc_fxin(kk) - qc_fxout(kk) + qcdet(kk) )*deltat*emsd(kk)
2618 qi_nw(kk) = qi_nw(kk) + (qi_fxin(kk) - qi_fxout(kk) + qidet(kk) )*deltat*emsd(kk)
2619 qr_nw(kk) = qr_nw(kk) + (qr_fxin(kk) - qr_fxout(kk) + rainfb(kk) )*deltat*emsd(kk)
2620 qs_nw(kk) = qs_nw(kk) + (qs_fxin(kk) - qs_fxout(kk) + snowfb(kk) )*deltat*emsd(kk)
2626 rainrate_cp = prcp_flux*(1._rp - fbfrc)/(deltax**2)
2634 dpth = dpth + deltap(kk)
2635 qinit = qinit + qv(kk)*ems(kk)
2636 qvfnl = qvfnl + qv_g(kk)*ems(kk)
2637 qhydr = qhydr + (qc_nw(kk) + qi_nw(kk) + qr_nw(kk) + qs_nw(kk))*ems(kk)
2639 qfinl = qvfnl + qhydr
2640 qpfnl = prcp_flux*timecp*(1._rp - fbfrc)
2641 qfinl = qfinl + qpfnl
2642 err = (qfinl - qinit )*100._rp/qinit
2643 if (abs(err) > 0.05_rp .and. istop == 0)
then 2647 log_error(
"CP_kf_compensational",*)
"@KF,MOISTURE" 2648 log_error_cont(*)
"--------------------------------------" 2649 log_error_cont(
'("vert accum rho*qhyd : ",F20.12)') qhydr
2650 log_error_cont(
'("vert accum rho*qv : ",F20.12)') qvfnl-qinit
2651 log_error_cont(
'("precipitation rate : ",F20.12)') qpfnl
2652 log_error_cont(
'("conserv qhyd + qv : ",F20.12)') qhydr + qpfnl
2653 log_error_cont(
'("conserv total : ",F20.12)') qfinl-qinit
2654 log_error_cont(*)
"--------------------------------------" 2668 cpm = cp*(1._rp + 0.887_rp*qv_g(kk))
2669 temp_g(kk) = temp_g(kk) - (qi_nw(kk) + qs_nw(kk))*emelt/cpm
2670 qc_nw(kk) = qc_nw(kk) + qi_nw(kk)
2671 qr_nw(kk) = qr_nw(kk) + qs_nw(kk)
2704 end subroutine cp_kf_compensational
2711 subroutine cp_kf_calcexn( pres, qv, exn )
2717 real(RP),
intent(in) :: pres
2718 real(RP),
intent(in) :: qv
2719 real(RP),
intent(out) :: exn
2720 exn = (pre00/pres)**(0.2854_rp*(1._rp - 0.28_rp*qv ))
2724 end subroutine cp_kf_calcexn
2735 subroutine cp_kf_precipitation_oc1973( &
2736 G, DZ, BOTERM, ENTERM, &
2737 WTW, QLIQ, QICE, QNEWLQ, QNEWIC, QLQOUT, QICOUT )
2740 real(RP),
intent(in) :: G
2741 real(RP),
intent(in) :: DZ
2742 real(RP),
intent(in) :: BOTERM
2743 real(RP),
intent(in) :: ENTERM
2744 real(RP),
intent(inout) :: QLQOUT
2745 real(RP),
intent(inout) :: QICOUT
2746 real(RP),
intent(inout) :: WTW
2747 real(RP),
intent(inout) :: QLIQ
2748 real(RP),
intent(inout) :: QICE
2749 real(RP),
intent(inout) :: QNEWLQ
2750 real(RP),
intent(inout) :: QNEWIC
2752 real(RP) :: QTOT,QNEW,QEST,G1,WAVG,CONV,RATIO3,OLDQ,RATIO4,DQ,PPTDRG
2760 qest=0.5_rp*(qtot+qnew)
2761 g1=wtw+boterm-enterm-2._rp*g*dz*qest/1.5_rp
2762 IF(g1.LT.0.0)g1=0._rp
2763 wavg=0.5_rp*(sqrt(wtw)+sqrt(g1))
2764 conv=rate*dz/max(wavg,kf_eps)
2770 ratio3=qnewlq/(qnew+1.e-8_rp)
2772 qtot=qtot+0.6_rp*qnew
2774 ratio4=(0.6_rp*qnewlq+qliq)/(qtot+1.e-8_rp)
2775 qtot=qtot*exp(-conv)
2781 qicout=(1._rp-ratio4)*dq
2785 pptdrg=0.5_rp*(oldq+qtot-0.2_rp*qnew)
2786 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
2787 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
2791 qliq=ratio4*qtot+ratio3*0.4_rp*qnew
2792 qice=(1._rp-ratio4)*qtot+(1._rp-ratio3)*0.4_rp*qnew
2796 end subroutine cp_kf_precipitation_oc1973
2802 subroutine cp_kf_precipitation_kessler( &
2803 G, DZ, BOTERM, ENTERM, &
2804 WTW, QLIQ, QICE, QNEWLQ, QNEWIC, QLQOUT, QICOUT )
2807 real(RP),
intent(in) :: G
2808 real(RP),
intent(in) :: DZ
2809 real(RP),
intent(in) :: BOTERM
2810 real(RP),
intent(in) :: ENTERM
2811 real(RP),
intent(inout) :: WTW
2812 real(RP),
intent(inout) :: QLIQ
2813 real(RP),
intent(inout) :: QICE
2814 real(RP),
intent(inout) :: QNEWLQ
2815 real(RP),
intent(inout) :: QNEWIC
2816 real(RP),
intent(inout) :: QLQOUT
2817 real(RP),
intent(inout) :: QICOUT
2820 real(RP) :: total_liq, total_ice
2822 real(RP) :: auto_qc, auto_qi
2823 auto_qc = kf_threshold
2824 auto_qi = kf_threshold
2826 total_liq = qliq + qnewlq
2827 total_ice = qice + qnewic
2830 qlqout = max( total_liq - auto_qc, 0.0_rp )
2831 qicout = max( total_ice - auto_qi, 0.0_rp )
2833 pptdrg = max( 0.5_rp * ( total_liq + total_ice - qlqout - qicout ), 0.0_rp )
2834 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
2835 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
2837 qliq = max( total_liq - qlqout, 0.0_rp )
2838 qlqout = total_liq - qliq
2840 qice = max( total_ice - qicout, 0.0_rp )
2841 qicout = total_ice - qice
2847 end subroutine cp_kf_precipitation_kessler
2857 subroutine cp_kf_tpmix2( p,thes,tu,qu,qliq,qice,qnewlq,qnewic )
2859 real(RP),
intent(in) :: P, THES
2860 real(RP),
intent(inout) :: TU, QU, QLIQ, QICE
2861 real(RP),
intent(out) :: QNEWLQ, QNEWIC
2863 real(RP) :: TP,QQ,BTH,TTH,PP,T00,T10,T01,T11,Q00,Q10,Q01,Q11
2864 real(RP) :: TEMP,QS,QNEW,DQ,QTOT,RLL,CPP
2865 integer :: IPTB,ITHTB
2872 bth=(the0k(iptb+1)-the0k(iptb))*qq+the0k(iptb)
2873 tth=(thes-bth)*rdthk
2877 IF(iptb.GE.kfnp .OR. iptb.LE.1 .OR. ithtb.GE.250 .OR. ithtb.LE.1)
THEN 2879 log_warn(
"CP_kf_tpmix2",*)
'OUT OF BOUNDS',iptb,ithtb,p,thes
2883 t00=ttab(ithtb ,iptb )
2884 t10=ttab(ithtb+1,iptb )
2885 t01=ttab(ithtb ,iptb+1)
2886 t11=ttab(ithtb+1,iptb+1)
2888 q00=qstab(ithtb ,iptb )
2889 q10=qstab(ithtb+1,iptb )
2890 q01=qstab(ithtb ,iptb+1)
2891 q11=qstab(ithtb+1,iptb+1)
2894 temp=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
2895 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
2919 qliq=qliq-dq*qliq/(qtot+1.e-10_rp)
2920 qice=qice-dq*qice/(qtot+1.e-10_rp)
2924 cpp=1004.5_rp*(1._rp+0.89_rp*qu)
2925 IF(qtot.LT.1.e-10_rp)
THEN 2927 temp=temp+rll*(dq/(1._rp+dq))/cpp
2931 temp=temp+rll*((dq-qtot)/(1._rp+dq-qtot))/cpp
2943 end subroutine cp_kf_tpmix2
2949 subroutine cp_kf_dtfrznew( P, QFRZ, TU, THTEU, QU, QICE )
2952 atmos_saturation_psat_liq
2954 real(RP),
intent(in) :: P, QFRZ
2955 real(RP),
intent(inout) :: TU, THTEU, QU, QICE
2957 real(RP) :: RLC,RLS,RLF,CPP,A,DTFRZ,ES,QS,DQEVAP,PII
2964 rlc=2.5e6_rp-2369.276_rp*(tu-273.16_rp)
2966 rls=2833922._rp-259.532_rp*(tu-273.16_rp)
2969 cpp=1004.5_rp*(1._rp+0.89_rp*qu)
2973 a=(cliq-bliq*dliq)/((tu-dliq)*(tu-dliq))
2974 dtfrz = rlf*qfrz/(cpp+rls*qu*a)
2978 es = aliq*exp((bliq*tu-cliq)/(tu-dliq))
2979 qs = es*0.622_rp/(p-es)
2986 dqevap = min(qs-qu, qice)
2989 pii=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qu))
2992 thteu = tu*pii*exp((3374.6525_rp/tu - 2.5403_rp)*qu*(1._rp + 0.81_rp*qu))
2994 end subroutine cp_kf_dtfrznew
3008 subroutine cp_kf_prof5( EQ, EE, UD )
3010 real(RP),
intent(in) :: EQ
3011 real(RP),
intent(inout) :: EE, UD
3013 real(RP) :: SQRT2P, A1, A2, A3, P, SIGMA, FE
3014 real(RP) :: X, Y, EY, E45, T1, T2, C1, C2
3016 DATA sqrt2p,a1,a2,a3,p,sigma,fe/2.506628_rp,0.4361836_rp,-0.1201676_rp, &
3017 0.9372980_rp,0.33267_rp,0.166666667_rp,0.202765151_rp/
3018 x = (eq - 0.5_rp)/sigma
3019 y = 6._rp*eq - 3._rp
3020 ey = exp(y*y/(-2._rp))
3022 t2 = 1._rp/(1._rp + p*abs(y))
3024 c1 = a1*t1+a2*t1*t1+a3*t1*t1*t1
3025 c2 = a1*t2+a2*t2*t2+a3*t2*t2*t2
3027 ee=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*eq*eq/2._rp
3028 ud=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*(0.5_rp+eq*eq/2._rp- &
3031 ee=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*eq*eq/2._rp
3032 ud=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*(0.5_rp+eq* &
3037 end subroutine cp_kf_prof5
3047 subroutine cp_kf_tpmix2dd( p, thes, ts, qs )
3049 real(RP),
intent(in) :: P, THES
3050 real(RP),
intent(inout) :: TS, QS
3052 real(RP) :: TP,QQ,BTH,TTH,PP,T00,T10,T01,T11,Q00,Q10,Q01,Q11
3053 integer :: IPTB,ITHTB
3060 bth=(the0k(iptb+1)-the0k(iptb))*qq+the0k(iptb)
3061 tth=(thes-bth)*rdthk
3065 t00=ttab(ithtb ,iptb )
3066 t10=ttab(ithtb+1,iptb )
3067 t01=ttab(ithtb ,iptb+1)
3068 t11=ttab(ithtb+1,iptb+1)
3070 q00=qstab(ithtb ,iptb )
3071 q10=qstab(ithtb+1,iptb )
3072 q01=qstab(ithtb ,iptb+1)
3073 q11=qstab(ithtb+1,iptb+1)
3076 ts=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
3077 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
3080 end subroutine cp_kf_tpmix2dd
3092 subroutine cp_kf_envirtht( P1, T1, Q1, THT1 )
3097 real(RP),
intent(in) :: P1, T1, Q1
3098 real(RP),
intent(out) :: THT1
3100 real(RP) :: EE,TLOG,TDPT,TSAT,THT
3101 real(RP),
parameter :: C1=3374.6525_rp
3102 real(RP),
parameter :: C2=2.5403_rp
3103 ee=q1*p1/(0.622_rp+q1)
3118 tdpt=(cliq-dliq*tlog)/(bliq-tlog)
3120 tsat=tdpt - (0.212_rp+1.571e-3_rp*(tdpt-tem00)-4.36e-4_rp*(t1-tem00))*(t1-tdpt)
3123 tht=t1*(p00/p1)**(0.2854_rp*(1._rp-0.28_rp*q1))
3124 tht1=tht*exp((c1/tsat-c2)*q1*(1._rp+0.81_rp*q1))
3127 end subroutine cp_kf_envirtht
3135 subroutine cp_kf_lutab
3141 integer :: KP, IT, ITCNT, I
3142 real(RP) :: DTH = 1._rp
3143 real(RP) :: TMIN = 150._rp
3144 real(RP) :: TOLER = 0.001_rp
3145 real(RP) :: PBOT, DPR, TEMP, P, ES, QS, PI
3146 real(RP) :: THES, TGUES, THGUES, THTGS
3147 real(RP) :: DT, T1, T0, F0, F1, ASTRT, AINC, A1
3161 dpr=(pbot-plutop)/
REAL(kfnp-1)
3173 es=aliq*exp((bliq*temp-cliq)/(temp-dliq))
3174 qs=0.622_rp*es/(p-es)
3175 pi=(1.e5_rp/p)**(0.2854_rp*(1.-0.28_rp*qs))
3176 the0k(kp)=temp*pi*exp((3374.6525_rp/temp-2.5403_rp)*qs* &
3195 es=aliq*exp((bliq*tgues-cliq)/(tgues-dliq))
3196 qs=0.622_rp*es/(p-es)
3197 pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3198 thgues=tgues*pi*exp((3374.6525_rp/tgues-2.5403_rp)*qs* &
3199 (1._rp + 0.81_rp*qs))
3206 es=aliq*exp((bliq*t1-cliq)/(t1-dliq))
3207 qs=0.622_rp*es/(p-es)
3208 pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3209 thtgs=t1*pi*exp((3374.6525_rp/t1-2.5403_rp)*qs*(1._rp + 0.81_rp*qs))
3211 if(abs(f1).lt.toler)
then 3215 dt=f1*(t1-t0)/(f1-f0)
3238 end subroutine cp_kf_lutab
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
module atmosphere / saturation
real(rp), public cp_ice
CP for ice [J/kg/K].
integer, parameter, public i_hs
snow
integer, parameter, public i_hr
liquid water rain
integer, parameter, public i_hi
ice water cloud
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
integer, public io_fid_conf
Config file ID.
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
subroutine, public atmos_phy_cp_kf_setup(KA, KS, KE, IA, IS, IE, JA, JS, JE, CZ, AREA, TIME_DTSEC, KF_DTSEC, WARMRAIN_in)
Setup initial setup for Kain-Fritsch Cumulus Parameterization.
module atmosphere / hydrometeor
real(rp), public const_pre00
pressure reference [Pa]
real(rp), public const_grav
standard acceleration of gravity [m/s2]
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
subroutine, public prc_abort
Abort Process.
integer, parameter, public i_hc
liquid water cloud
module atmosphere / physics / cumulus / Kain-Fritsch
real(dp), public time_dtsec_atmos_phy_cp
time interval of physics(cumulus ) [sec]
real(rp), parameter, public const_emelt
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
subroutine, public atmos_phy_cp_kf_tendency(KA, KS, KE, IA, IS, IE, JA, JS, JE, DENS, U, V, RHOT, TEMP, PRES, QDRY, QV_in, Rtot, CPtot, w0avg, FZ, KF_DTSEC, DENS_t_CP, RHOT_t_CP, RHOQV_t_CP, RHOQ_t_CP, SFLX_convrain, cloudtop, cloudbase, cldfrac_dp, cldfrac_sh, nca)
ATMOS_PHY_CP_kf calculate Kain-Fritsch Cumulus Parameterization.
integer, parameter, public n_hyd
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
real(rp), public cp_vapor
CP for vapor [J/kg/K].
integer, parameter, public rp
real(rp), public cp_water
CP for water [J/kg/K].