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_calciexn
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,PBOT
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
126 integer ,
private :: TRIGGER_type
127 real(RP),
private :: DELCAPE
128 real(RP),
private :: DEEPLIFETIME
129 real(RP),
private :: SHALLOWLIFETIME
130 real(RP),
private :: DEPTH_USL
131 logical ,
private :: WARMRAIN
132 logical ,
private :: KF_LOG
133 real(RP),
private :: kf_threshold
134 integer ,
private :: prec_type
135 logical,
private :: DO_prec
137 procedure(kf_precipitation),
pointer,
private :: CP_kf_precipitation => null()
139 real(RP),
private,
allocatable :: lifetime (:,:)
140 integer ,
private,
allocatable :: I_convflag(:,:)
142 real(RP),
private,
allocatable :: deltaz (:,:,:)
143 real(RP),
private,
allocatable :: Z (:,:,:)
144 real(RP),
private,
allocatable :: deltax (:,:)
147 integer,
parameter :: hist_vmax = 14
148 integer,
private :: hist_id(hist_vmax,0:1)
149 logical,
private :: hist_flag
150 integer,
parameter :: I_HIST_QV_FC = 1
151 integer,
parameter :: I_HIST_QV_UE = 2
152 integer,
parameter :: I_HIST_QV_DE = 3
153 integer,
parameter :: I_HIST_QV_UD = 4
154 integer,
parameter :: I_HIST_QV_DD = 5
155 integer,
parameter :: I_HIST_QV_NF = 6
156 integer,
parameter :: I_HIST_QC_FC = 7
157 integer,
parameter :: I_HIST_QC_UD = 8
158 integer,
parameter :: I_HIST_QI_FC = 9
159 integer,
parameter :: I_HIST_QI_UD = 10
160 integer,
parameter :: I_HIST_QR_FC = 11
161 integer,
parameter :: I_HIST_QR_RF = 12
162 integer,
parameter :: I_HIST_QS_FC = 13
163 integer,
parameter :: I_HIST_QS_SF = 14
164 integer,
parameter :: I_HIST_D = 0
165 integer,
parameter :: I_HIST_S = 1
167 real(RP),
private,
allocatable :: hist_work(:,:,:,:,:)
176 KA, KS, KE, IA, IS, IE, JA, JS, JE, &
184 integer,
intent(in) ::
ka,
ks,
ke
185 integer,
intent(in) ::
ia,
is,
ie
186 integer,
intent(in) ::
ja,
js,
je
188 real(rp),
intent(in) :: cz(
ka,
ia,
ja)
189 real(rp),
intent(in) :: area(
ia,
ja)
190 logical,
intent(in) :: warmrain_in
193 integer :: atmos_phy_cp_kf_trigger_type = 1
194 integer :: atmos_phy_cp_kf_prec_type = 1
195 real(rp) :: atmos_phy_cp_kf_rate = 0.03_rp
196 logical :: atmos_phy_cp_kf_do_prec = .true.
197 real(rp) :: atmos_phy_cp_kf_dlcape = 0.1_rp
198 real(rp) :: atmos_phy_cp_kf_dlifetime = 1800.0_rp
199 real(rp) :: atmos_phy_cp_kf_slifetime = 2400.0_rp
200 real(rp) :: atmos_phy_cp_kf_depth_usl = 300.0_rp
201 real(rp) :: atmos_phy_cp_kf_thres = 1.e-3_rp
202 logical :: atmos_phy_cp_kf_log = .false.
204 namelist / param_atmos_phy_cp_kf / &
205 atmos_phy_cp_kf_rate, &
206 atmos_phy_cp_kf_trigger_type, &
207 atmos_phy_cp_kf_dlcape, &
208 atmos_phy_cp_kf_dlifetime, &
209 atmos_phy_cp_kf_slifetime, &
210 atmos_phy_cp_kf_depth_usl, &
211 atmos_phy_cp_kf_prec_type, &
212 atmos_phy_cp_kf_do_prec, &
213 atmos_phy_cp_kf_thres, &
222 log_info(
"ATMOS_PHY_CP_kf_setup",*)
'Setup'
223 log_info(
"ATMOS_PHY_CP_kf_setup",*)
'Kain-Fritsch scheme'
225 warmrain = warmrain_in
229 read(
io_fid_conf,nml=param_atmos_phy_cp_kf,iostat=ierr)
231 log_info(
"ATMOS_PHY_CP_kf_setup",*)
'Not found namelist. Default used.'
232 elseif( ierr > 0 )
then
233 log_error(
"ATMOS_PHY_CP_kf_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_CP_KF. Check!'
236 log_nml(param_atmos_phy_cp_kf)
240 call cp_kf_param( atmos_phy_cp_kf_prec_type, &
241 atmos_phy_cp_kf_rate, &
242 atmos_phy_cp_kf_do_prec, &
243 atmos_phy_cp_kf_dlcape, &
244 atmos_phy_cp_kf_dlifetime, &
245 atmos_phy_cp_kf_slifetime, &
246 atmos_phy_cp_kf_depth_usl, &
247 atmos_phy_cp_kf_thres, &
248 atmos_phy_cp_kf_log, &
249 atmos_phy_cp_kf_trigger_type )
253 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Ogura-Cho condense material convert rate : ", atmos_phy_cp_kf_rate
254 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Trigger function type, 1:KF2004 3:NO2007 : ", atmos_phy_cp_kf_trigger_type
255 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"CAPE decrease rate : ", atmos_phy_cp_kf_dlcape
256 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Minimum lifetime scale of deep convection [sec] : ", atmos_phy_cp_kf_dlifetime
257 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Lifetime of shallow convection [sec] : ", atmos_phy_cp_kf_slifetime
258 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Updraft souce layer depth [hPa] : ", atmos_phy_cp_kf_depth_usl
259 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Precipitation type 1:Ogura-Cho(1973) 2:Kessler : ", atmos_phy_cp_kf_prec_type
260 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Kessler type precipitation's threshold : ", atmos_phy_cp_kf_thres
261 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Enable sedimentation (precipitation) ? : ", atmos_phy_cp_kf_do_prec
262 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Warm rain? : ", warmrain
263 log_info(
"ATMOS_PHY_CP_kf_setup",*)
"Output log? : ", atmos_phy_cp_kf_log
266 allocate( lifetime(
ia,
ja) )
267 allocate( i_convflag(
ia,
ja) )
268 lifetime(:,:) = 0.0_rp
274 allocate( deltaz(
ka,
ia,
ja) )
276 deltaz(:,:,:) = 0.0_rp
280 deltaz(
k,i,j) = cz(
k+1,i,j) - cz(
k,i,j)
284 deltaz(
ke,:,:) = 0.0_rp
286 allocate( deltax(
ia,
ja) )
289 deltax(i,j) = sqrt( area(i,j) )
297 'QV tendency due to flux convergence (deep convection) in KF', &
299 hist_id(i_hist_qv_fc,i_hist_d) )
301 'QV tendency due to flux convergence (shallow convection) in KF', &
303 hist_id(i_hist_qv_fc,i_hist_s) )
305 'QV tendency due to entrainment of updraft (deep convection) in KF', &
307 hist_id(i_hist_qv_ue,i_hist_d) )
309 'QV tendency due to entrainment of updraft (shallow convection) in KF', &
311 hist_id(i_hist_qv_ue,i_hist_s) )
313 'QV tendency due to entrainment of downdraft (deep convection) in KF', &
315 hist_id(i_hist_qv_de,i_hist_d) )
317 'QV tendency due to detrainment of updraft (deep convection) in KF', &
319 hist_id(i_hist_qv_ud,i_hist_d) )
321 'QV tendency due to detrainment of updraft (shallow convection) in KF', &
323 hist_id(i_hist_qv_ud,i_hist_s) )
325 'QV tendency due to detrainment of downdraft (deep convection) in KF', &
327 hist_id(i_hist_qv_dd,i_hist_d) )
329 'QV tendency due to negative fixer (deep convection) in KF', &
331 hist_id(i_hist_qv_nf,i_hist_d) )
333 'QV tendency due to negative fixer (shallow convection) in KF', &
335 hist_id(i_hist_qv_nf,i_hist_s) )
338 'QC tendency due to flux convergence (deep convection) in KF', &
340 hist_id(i_hist_qc_fc,i_hist_d) )
342 'QC tendency due to flux convergence (shallow convection) in KF', &
344 hist_id(i_hist_qc_fc,i_hist_s) )
346 'QC tendency due to detrainment of updraft (deep convection) in KF', &
348 hist_id(i_hist_qc_ud,i_hist_d) )
350 'QC tendency due to detrainment of updraft (shallow convection) in KF', &
352 hist_id(i_hist_qc_ud,i_hist_s) )
355 'QI tendency due to flux convergence (deep convection) in KF', &
357 hist_id(i_hist_qi_fc,i_hist_d) )
359 'QI tendency due to flux convergence (shallow convection) in KF', &
361 hist_id(i_hist_qi_fc,i_hist_s) )
363 'QI tendency due to detrainment of updraft (deep convection) in KF', &
365 hist_id(i_hist_qi_ud,i_hist_d) )
367 'QI tendency due to detrainment of updraft (shallow convection) in KF', &
369 hist_id(i_hist_qi_ud,i_hist_s) )
372 'QR tendency due to flux convergence (deep convection) in KF', &
374 hist_id(i_hist_qr_fc,i_hist_d) )
376 'QR tendency due to flux convergence (shallow convection) in KF', &
378 hist_id(i_hist_qr_fc,i_hist_s) )
380 'QR tendency due to rain fall (deep convection) in KF', &
382 hist_id(i_hist_qr_rf,i_hist_d) )
384 'QR tendency due to rain fall (shallow convection) in KF', &
386 hist_id(i_hist_qr_rf,i_hist_s) )
389 'QS tendency due to flux convergence (deep convection) in KF', &
391 hist_id(i_hist_qs_fc,i_hist_d) )
393 'QS tendency due to flux convergence (shallow convection) in KF', &
395 hist_id(i_hist_qs_fc,i_hist_s) )
397 'QS tendency due to snow fall (deep convection) in KF', &
399 hist_id(i_hist_qs_sf,i_hist_d) )
401 'QS tendency due to snow fall (shallow convection) in KF', &
403 hist_id(i_hist_qs_sf,i_hist_s) )
406 if ( hist_id(n,0) > 0 .or. hist_id(n,1) > 0 )
then
407 allocate( hist_work(
ka,
ia,
ja,hist_vmax,0:1) )
408 hist_work(:,:,:,:,:) = 0.0_rp
420 subroutine cp_kf_param( & ! set kf tuning parametres
426 SHALLOWLIFETIME_in, &
434 integer,
intent(in) :: prec_type_in
435 real(rp),
intent(in) :: rate_in
436 logical,
intent(in) :: do_prec_in
437 real(rp),
intent(in) :: delcape_in
438 real(rp),
intent(in) :: deeplifetime_in
439 real(rp),
intent(in) :: shallowlifetime_in
440 real(rp),
intent(in) :: depth_usl_in
441 real(rp),
intent(in) :: kf_threshold_in
442 logical,
intent(in) :: kf_log_in
443 integer,
intent(in) :: trigger_type_in
447 deeplifetime = deeplifetime_in
448 shallowlifetime = shallowlifetime_in
449 depth_usl = depth_usl_in
450 prec_type = prec_type_in
452 kf_threshold = kf_threshold_in
454 trigger_type = trigger_type_in
456 if ( trigger_type /= 1 .and. trigger_type /=3 )
then
457 log_error(
"CP_kf_param",*)
"TRIGGER_type must be 1 or 3 but now : ",trigger_type
461 select case ( prec_type )
463 cp_kf_precipitation => cp_kf_precipitation_oc1973
465 cp_kf_precipitation => cp_kf_precipitation_kessler
467 log_error(
"CP_kf_param",*)
'KF namelist'
468 log_error_cont(*)
'prec_type must be 1 or 2 : ', prec_type
473 end subroutine cp_kf_param
504 file_history_query, &
524 saturation_psat_liq => atmos_saturation_psat_liq
526 integer,
intent(in) ::
ka,
ks,
ke
527 integer,
intent(in) ::
ia,
is,
ie
528 integer,
intent(in) ::
ja,
js,
je
530 real(rp),
intent(in) :: dens (
ka,
ia,
ja)
531 real(rp),
intent(in) :: u (
ka,
ia,
ja)
532 real(rp),
intent(in) :: v (
ka,
ia,
ja)
533 real(rp),
intent(in) :: rhot (
ka,
ia,
ja)
534 real(rp),
intent(in) :: temp (
ka,
ia,
ja)
535 real(rp),
intent(in) :: pres (
ka,
ia,
ja)
536 real(rp),
intent(in) :: qdry (
ka,
ia,
ja)
537 real(rp),
intent(in) :: qv_in(
ka,
ia,
ja)
538 real(rp),
intent(in) :: w0avg(
ka,
ia,
ja)
539 real(rp),
intent(in) :: fz (0:
ka,
ia,
ja)
540 real(
dp),
intent(in) :: kf_dtsecd
542 real(rp),
intent(inout) :: dens_t (
ka,
ia,
ja)
543 real(rp),
intent(inout) :: rhot_t (
ka,
ia,
ja)
544 real(rp),
intent(inout) :: rhoqv_t(
ka,
ia,
ja)
546 real(rp),
intent(inout) :: nca (
ia,
ja)
548 real(rp),
intent(inout) :: sflx_rain(
ia,
ja)
549 real(rp),
intent(inout) :: sflx_snow(
ia,
ja)
550 real(rp),
intent(inout) :: sflx_engi(
ia,
ja)
551 real(rp),
intent(inout) :: cloudtop (
ia,
ja)
552 real(rp),
intent(inout) :: cloudbase (
ia,
ja)
553 real(rp),
intent(inout) :: cldfrac_dp (
ka,
ia,
ja)
554 real(rp),
intent(inout) :: cldfrac_sh (
ka,
ia,
ja)
556 integer ::
k, i, j, iq
561 integer :: k_lc,k_let,k_pbl
566 real(rp) :: qsat (
ka)
568 real(rp) :: deltap(
ka)
570 real(rp) :: cldfrac_kf(
ka,2)
571 real(rp) :: dens_nw(
ka)
572 real(rp) :: time_advec
575 real(rp) :: upent(
ka)
576 real(rp) :: updet(
ka)
578 real(rp) :: temp_u(
ka)
579 real(rp) :: tempv(
ka)
585 real(rp) :: qvdet(
ka)
586 real(rp) :: qcdet(
ka)
587 real(rp) :: qidet(
ka)
588 real(rp) :: flux_qr(
ka)
589 real(rp) :: flux_qs(
ka)
591 real(rp) :: theta_eu(
ka)
592 real(rp) :: theta_ee(
ka)
595 real(rp) :: umfnewdold(
ka)
602 real(rp) :: downent(
ka)
603 real(rp) :: downdet(
ka)
604 real(rp) :: theta_d(
ka)
606 real(rp) :: rain_flux
607 real(rp) :: snow_flux
608 real(rp) :: prec_engi
611 real(rp) :: theta_nw(
ka)
612 real(rp) :: qv_nw(
ka)
613 real(rp) :: qc_nw(
ka)
614 real(rp) :: qi_nw(
ka)
615 real(rp) :: qr_nw(
ka)
616 real(rp) :: qs_nw(
ka)
620 real(rp) :: dqv, dqc, dqi, dqr, dqs
622 real(rp) :: r_convflag(
ia,
ja)
630 log_progress(*)
'atmosphere / physics / cumulus / KF'
631 log_info(
"ATMOS_PHY_CP_kf_tendency",*)
'KF Convection Check '
638 call file_history_query( hist_id(n,0), hist_flag )
639 if ( hist_flag )
exit
640 call file_history_query( hist_id(n,1), hist_flag )
641 if ( hist_flag )
exit
664 nca(i,j) = nca(i,j) - kf_dtsec
667 if ( nca(i,j) .ge. 0.5_rp * kf_dtsec ) cycle
671 rhod(
k) = dens(
k,i,j) * qdry(
k,i,j)
679 psat = aliq*exp((bliq*temp(
k,i,j)-cliq)/(temp(
k,i,j)-dliq))
680 qsat(
k) = epsvap * psat / ( pres(
k,i,j) - psat )
683 qv(
k) = max( kf_eps, min( qsat(
k), qv_in(
k,i,j) / qdry(
k,i,j) ) )
684 rh(
k) = qv(
k) / qsat(
k)
690 deltap(
k) = rhod(
k) * grav * ( fz(
k,i,j) - fz(
k-1,i,j) )
693 call cp_kf_trigger ( &
695 deltaz(:,i,j), z(:,i,j), &
698 deltap(:), deltax(i,j), &
703 temp_u(:), tempv(:), &
704 qv_u(:), qc(:), qi(:), &
705 qvdet(:), qcdet(:), qidet(:), &
706 flux_qr(:), flux_qs(:), &
707 theta_eu(:), theta_ee(:), &
710 upent(:), updet(:), &
711 k_lcl, k_lc, k_pbl, &
712 k_top, k_let, k_ml, &
715 cloudbase(i,j), zmix, &
718 if (i_convflag(i,j) /= 2)
then
721 ems(k_top+1:
ke) = 0._rp
722 emsd(k_top+1:
ke) = 0._rp
724 ems(
k) = deltap(
k) * deltax(i,j)**2 / grav
725 emsd(
k) = 1._rp/ems(
k)
726 umfnewdold(
k) = 1._rp/umfnewdold(
k)
729 call cp_kf_downdraft ( &
732 k_lcl, k_ml, k_top, k_pbl, k_let, k_lc, &
733 z(:,i,j), cloudbase(i,j), &
734 u(:,i,j), v(:,i,j), rh(:), qv(:), pres(:,i,j), &
735 deltap(:), deltax(i,j), &
739 flux_qr(:), flux_qs(:), tempv(:), &
740 wspd(:), dmf(:), downent(:), downdet(:), &
741 theta_d(:), qv_d(:), &
742 rain_flux, snow_flux, prec_engi, &
745 call cp_kf_compensational ( &
747 k_top, k_lc, k_pbl, k_ml, k_lfs, &
748 deltaz(:,i,j), z(:,i,j), pres(:,i,j), deltap(:), deltax(i,j), &
749 temp(:,i,j), qv(:), ems(:), emsd(:), &
750 presmix, zmix, dpthmx, &
752 temp_u(:), qvdet(:), umflcl, &
753 qc(:), qi(:), flux_qr(:), flux_qs(:), &
756 qv_d(:), theta_d(:), &
760 i_convflag(i,j), k_lcl, &
761 umf(:), upent(:), updet(:), &
762 qcdet(:), qidet(:), dmf(:), downent(:), downdet(:), &
763 rain_flux, snow_flux, &
766 qv_nw(:), qc_nw(:), qi_nw(:), qr_nw(:), qs_nw(:), &
767 sflx_rain(i,j), sflx_snow(i,j), sflx_engi(i,j), &
768 cldfrac_kf, lifetime(i,j), time_advec )
772 if (i_convflag(i,j) == 2)
then
774 sflx_rain(i,j) = 0.0_rp
775 sflx_snow(i,j) = 0.0_rp
776 sflx_engi(i,j) = 0.0_rp
777 cldfrac_kf(
ks:
ke,:) = 0.0_rp
778 lifetime(i,j) = 0.0_rp
779 cloudtop(i,j) = 0.0_rp
780 cloudbase(i,j) = 0.0_rp
783 dens_t(
ks:
ke,i,j) = 0.0_rp
784 rhot_t(
ks:
ke,i,j) = 0.0_rp
785 rhoqv_t(
ks:
ke,i,j) = 0.0_rp
787 rhoq_t(
ks:
ke,i,j,iq) = 0.0_rp
790 if ( hist_flag )
then
793 hist_work(:,i,j,n,m) = 0.0_rp
807 if (i_convflag(i,j) == 0)
then
808 if (time_advec < lifetime(i,j)) nic=nint(time_advec/kf_dtsec)
809 nca(i,j) = nic * kf_dtsec
810 elseif (i_convflag(i,j) == 1)
then
811 lifetime(i,j) = max(shallowlifetime, kf_dtsec)
817 dqv = rhod(
k) * ( qv_nw(
k) - qv(
k) )
818 rhoqv_t(
k,i,j) = dqv / lifetime(i,j)
820 dqc = qc_nw(
k) * rhod(
k)
821 dqr = qr_nw(
k) * rhod(
k)
822 rhoq_t(
k,i,j,
i_hc) = dqc / lifetime(i,j)
823 rhoq_t(
k,i,j,
i_hr) = dqr / lifetime(i,j)
825 if ( .not. warmrain )
then
826 dqi = qi_nw(
k) * rhod(
k)
827 dqs = qs_nw(
k) * rhod(
k)
832 rhoq_t(
k,i,j,
i_hi) = dqi / lifetime(i,j)
833 rhoq_t(
k,i,j,
i_hs) = dqs / lifetime(i,j)
835 dens_t(
k,i,j) = rhoqv_t(
k,i,j) &
838 dens_nw(
k) = dens(
k,i,j) + dqv + dqc + dqr + dqi + dqs
843 rhoq_t(
k,i,j,iq) = 0.0_rp
849 rhot_t(
k,i,j) = ( dens_nw(
k) * theta_nw(
k) - rhot(
k,i,j) ) / lifetime(i,j)
853 dens_t(
k,i,j) = 0.0_rp
854 rhot_t(
k,i,j) = 0.0_rp
855 rhoqv_t(
k,i,j) = 0.0_rp
857 rhoq_t(
k,i,j,iq) = 0.0_rp
865 cldfrac_sh(
ks:
ke,i,j) = cldfrac_kf(
ks:
ke,1)
866 cldfrac_dp(
ks:
ke,i,j) = cldfrac_kf(
ks:
ke,2)
873 call file_history_in( lifetime(:,:),
'KF_LIFETIME',
'lifetime of KF scheme',
's' )
874 r_convflag(:,:) = real(i_convflag(:,:),rp)
875 call file_history_in( r_convflag(:,:),
'KF_CONVFLAG',
'CONVECTION FLAG',
'' )
878 call file_history_query( hist_id(n,m), flag )
880 call file_history_put( hist_id(n,m), hist_work(:,:,:,n,m) )
893 subroutine cp_kf_trigger ( &
905 qvdet, qcdet, qidet, &
907 theta_eu, theta_ee, &
911 k_lcl, k_lc, k_pbl, &
912 k_top, k_let, k_ml, &
925 integer,
intent(in) ::
ka,
ks,
ke
926 real(rp),
intent(in) :: dz_kf(
ka),z_kf(
ka)
927 real(rp),
intent(in) :: qv(
ka)
928 real(rp),
intent(in) :: qes(
ka)
929 real(rp),
intent(in) :: pres(
ka)
930 real(rp),
intent(in) :: deltap(
ka)
931 real(rp),
intent(in) :: deltax
932 real(rp),
intent(in) :: temp(
ka)
933 real(rp),
intent(in) :: w0avg(
ka)
935 real(rp),
intent(out) :: umf(
ka)
936 real(rp),
intent(out) :: umflcl
937 real(rp),
intent(out) :: upent(
ka)
938 real(rp),
intent(out) :: updet(
ka)
939 real(rp),
intent(out) :: temp_u(
ka)
940 real(rp),
intent(out) :: tempv(
ka)
941 real(rp),
intent(out) :: qv_u(
ka)
942 real(rp),
intent(out) :: cape
943 real(rp),
intent(out) :: cloudtop
944 real(rp),
intent(out) :: qc(
ka)
945 real(rp),
intent(out) :: qi(
ka)
946 real(rp),
intent(out) :: qvdet(
ka)
947 real(rp),
intent(out) :: qcdet(
ka)
948 real(rp),
intent(out) :: qidet(
ka)
949 real(rp),
intent(out) :: flux_qr(
ka)
950 real(rp),
intent(out) :: flux_qs(
ka)
951 real(rp),
intent(out) :: theta_eu(
ka)
952 real(rp),
intent(out) :: theta_ee(
ka)
953 integer,
intent(out) :: i_convflag
957 integer,
intent(out) :: k_lcl
958 integer,
intent(out) :: k_top
959 integer,
intent(out) :: k_ml
960 real(rp),
intent(out) :: zlcl
961 integer,
intent(out) :: k_lc, k_let, k_pbl
962 real(rp),
intent(out) :: zmix
963 real(rp),
intent(out) :: presmix
964 real(rp),
intent(out) :: umfnewdold(
ka)
965 real(rp),
intent(out) :: dpthmx
968 integer,
parameter :: itr_max = 10000
973 integer :: n_uslcheck
976 integer :: k_check(
ka)
984 real(rp) :: cloudhight
985 real(rp) :: qrout(
ka)
986 real(rp) :: qsout(
ka)
990 real(rp) :: theta_mix
998 real(rp) :: tempv_env
1003 real(rp) :: temp_lcl
1004 real(rp) :: tempv_lcl
1005 real(rp) :: pres_lcl
1012 real(rp) :: umfnew,umfold
1014 real(rp) :: cldhgt(
ka)
1022 pres300 = pres(
ks) - depth_usl*100._rp
1024 tempv(kk) = temp(kk) * ( 1.0_rp + epstvap * qv(kk) )
1029 if (pres(kk) >= pres300) k_llfc = kk
1034 pres15 = pres(
ks) - 15.e2_rp
1037 do kk =
ks+1, k_llfc
1038 if(pres(kk) < pres15 )
then
1039 n_check = n_check + 1
1040 k_check(n_check) = kk
1041 pres15 = pres15 - 15.e2_rp
1053 n_uslcheck = n_uslcheck + 1
1056 if (n_uslcheck > n_check)
then
1057 if (i_convflag == 1)
then
1062 if (cldhgt(nnn) > chmax)
then
1068 n_uslcheck = nuchm - 1
1075 k_lc = k_check(n_uslcheck)
1082 if ( nk + 1 <
ks )
then
1084 log_info(
"CP_kf_trigger",*)
'would go off bottom: cu_kf',pres(
ks),k_lc,nk+1,n_uslcheck
1091 log_info(
"CP_kf_trigger",*)
'would go off top: cu_kf'
1095 dpthmx = dpthmx + deltap(nk)
1096 n_layers = n_layers + 1
1097 if (dpthmx > dpthmin)
then
1102 if (dpthmx < dpthmin)
then
1106 k_pbl = k_lc + n_layers -1
1108 theta_mix = 0._rp; temp_mix = 0._rp; qv_mix = 0._rp; zmix = 0._rp;presmix = 0._rp
1111 temp_mix = temp_mix + deltap(kk)*temp(kk)
1112 qv_mix = qv_mix + deltap(kk)*qv(kk)
1113 zmix = zmix + deltap(kk)*z_kf(kk)
1114 presmix = presmix + deltap(kk)*pres(kk)
1117 temp_mix = temp_mix/dpthmx
1118 qv_mix = qv_mix/dpthmx
1119 presmix = presmix/dpthmx
1121 emix = qv_mix * presmix / ( epsvap + qv_mix )
1125 templog = log(emix/aliq)
1126 temp_dew = (cliq - dliq*templog)/(bliq - templog)
1129 temp_lcl = temp_dew - (0.212_rp + 1.571e-3_rp*(temp_dew - tem00) &
1130 - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - temp_dew)
1131 temp_lcl = min(temp_lcl,temp_mix)
1132 tempv_lcl = temp_lcl * ( 1.0_rp + epstvap * qv_mix )
1133 zlcl = zmix + (temp_lcl - temp_mix)/gdcp
1138 if( zlcl <= z_kf(kk) )
exit
1141 if (zlcl > z_kf(
ke))
then
1146 deltaz = ( zlcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
1147 temp_env = temp(k_lclm1) + ( temp(k_lcl) - temp(k_lclm1) )*deltaz
1148 qvenv = qv(k_lclm1) + ( qv(k_lcl) - qv(k_lclm1) )*deltaz
1149 tempv_env = temp_env * ( 1.0_rp + epstvap * qvenv )
1154 if (zlcl < 2.e3_rp)
then
1156 w_cz = 1.e-5_rp*zlcl
1163 w_g = (w0avg(k_lclm1) + (w0avg(k_lcl) - w0avg(k_lclm1))*deltaz )*deltax/25.e3_rp - w_cz
1164 if ( w_g < 1.e-4_rp)
then
1167 dtvv = 4.64_rp*w_g**0.33_rp
1172 if ( trigger_type == 2 )
then
1173 else if ( trigger_type == 3 )
then
1181 if(u00 < 1._rp)
then
1182 qs_lcl=qes(k_lclm1)+(qes(k_lcl)-qes(k_lclm1))*deltaz
1183 rh_lcl = qvenv/qs_lcl
1184 dqssdt = qv_mix*(cliq-bliq*dliq)/((temp_lcl-dliq)*(temp_lcl-dliq))
1185 if(rh_lcl >= 0.75_rp .and. rh_lcl <=0.95_rp)
then
1186 dtrh = 0.25_rp*(rh_lcl-0.75_rp)*qv_mix/dqssdt
1187 elseif(rh_lcl > 0.95_rp)
then
1188 dtrh = (1._rp/rh_lcl-1._rp)*qv_mix/dqssdt
1196 if (temp_lcl + dtvv + dtrh < temp_env)
then
1204 call cp_kf_envirtht( presmix, temp_mix, qv_mix, &
1207 if (dtvv + dtrh > 1.e-4_rp )
then
1208 w_lcl = 1._rp + 0.5_rp*sqrt(2._rp*grav*(dtvv + dtrh)*500._rp/tempv_env)
1209 w_lcl = min(w_lcl,3._rp)
1215 pres_lcl = pres(k_lclm1) + (pres(k_lcl) - pres(k_lclm1))*deltaz
1218 if (w_g < 0._rp )
then
1220 elseif (w_g > 0.1_rp)
then
1223 radius = 1000._rp + 1000._rp*w_g*10._rp
1226 call cp_kf_updraft ( &
1228 k_lcl, k_pbl, dz_kf(:), z_kf(:), &
1229 w_lcl, temp_lcl, tempv_lcl, pres_lcl, &
1230 qv_mix, qv(:), temp(:), tempv_env, &
1231 zlcl, pres(:), deltap(:), &
1232 deltax, radius, dpthmx, &
1233 k_let, theta_eu(:), &
1236 upent(:), updet(:), &
1237 umfnewdold(:), umfnew, umfold, &
1238 temp_u(:), theta_ee(:), &
1239 cloudhight, cloudtop, &
1240 qv_u(:), qc(:), qi(:), qrout(:), qsout(:), &
1241 qvdet(:), qcdet(:), qidet(:), &
1243 flux_qr(:), flux_qs(:) )
1246 cldhgt(k_lc) = cloudhight
1249 if(temp_lcl > 293._rp)
then
1251 elseif (temp_lcl < 293._rp .and. temp_lcl > 273._rp)
then
1252 d_min = 2.e3_rp + 100._rp*(temp_lcl - tem00)
1258 if ( k_top <= k_lcl .or. &
1259 k_top <= k_pbl .or. &
1260 k_let+1 <= k_pbl )
then
1262 cldhgt(k_lc) = cloudhight
1263 do kk = k_lclm1,k_top
1272 elseif (cloudhight > d_min .and. cape > 1._rp)
then
1281 if(n_uslcheck == nuchm)
then
1284 do kk = k_lclm1,k_top
1297 if ( itr .ge. itr_max )
then
1298 log_error(
"CP_kf_trigger",*)
'iteration max count was reached in the USL loop in the KF scheme'
1303 if (i_convflag == 1)
then
1304 k_start = max(k_pbl,k_lcl)
1310 if (k_let == k_top)
then
1311 updet(k_top) = umf(k_top) + updet(k_top) - upent(k_top)
1312 qcdet(k_top) = qc(k_top)*updet(k_top)*umfnew/umfold
1313 qidet(k_top) = qi(k_top)*updet(k_top)*umfnew/umfold
1314 upent(k_top) = 0._rp
1319 do kk = k_let+1,k_top
1320 dptt = dptt + deltap(kk)
1322 dumfdp = umf(k_let)/dptt
1331 do kk = k_let+1,k_top
1332 if(kk == k_top)
then
1333 updet(kk) = umf(kk-1)
1335 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1336 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1338 umf(kk) = umf(kk-1) - deltap(kk)*dumfdp
1339 upent(kk) = umf(kk)*(1._rp - 1._rp/umfnewdold(kk))
1340 updet(kk) = umf(kk-1) - umf(kk) + upent(kk)
1341 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1342 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1344 if (kk >= k_let+2)
then
1345 flux_qr(kk) = umf(kk-1)*qrout(kk)
1346 flux_qs(kk) = umf(kk-1)*qsout(kk)
1356 if(temp(kk) > tem00) k_ml = kk
1363 if (kk == k_lc)
then
1364 upent(kk) = umflcl*deltap(kk)/dpthmx
1365 umf(kk) = umflcl*deltap(kk)/dpthmx
1366 elseif (kk <= k_pbl)
then
1367 upent(kk) = umflcl*deltap(kk)/dpthmx
1368 umf(kk) = umf(kk-1) + upent(kk)
1374 temp_u(kk) = temp_mix + (z_kf(kk) - zmix)*gdcp
1395 call cp_kf_envirtht( pres(kk), temp(kk), qv(kk), &
1421 end subroutine cp_kf_trigger
1428 subroutine cp_kf_updraft ( &
1430 k_lcl, k_pbl, dz_kf, z_kf, &
1431 w_lcl, temp_lcl, tempv_lcl, pres_lcl, &
1432 qv_mix, qv, temp, tempv_env, &
1433 zlcl, pres, deltap, &
1434 deltax, radius, dpthmx, &
1439 umfnewdold, umfnew,umfold, &
1441 cloudhight, cloudtop, &
1442 qv_u, qc, qi, qrout, qsout, &
1443 qvdet, qcdet, qidet, &
1451 integer,
intent(in) ::
ka,
ks,
ke
1452 integer,
intent(in) :: k_lcl
1453 integer,
intent(in) :: k_pbl
1454 real(rp),
intent(in) :: dz_kf(
ka), z_kf(
ka)
1455 real(rp),
intent(in) :: w_lcl
1456 real(rp),
intent(in) :: temp_lcl
1457 real(rp),
intent(in) :: tempv_lcl
1458 real(rp),
intent(in) :: pres_lcl
1459 real(rp),
intent(in) :: qv_mix
1460 real(rp),
intent(in) :: qv(
ka)
1461 real(rp),
intent(in) :: temp(
ka)
1462 real(rp),
intent(in) :: tempv_env
1463 real(rp),
intent(in) :: zlcl
1464 real(rp),
intent(in) :: pres(
ka)
1465 real(rp),
intent(in) :: deltap(
ka)
1466 real(rp),
intent(in) :: deltax
1467 real(rp),
intent(in) :: radius
1468 real(rp),
intent(in) :: dpthmx
1470 integer,
intent(inout) :: k_let
1471 real(rp),
intent(inout) :: theta_eu(
ka)
1473 integer,
intent(out) :: k_top
1474 real(rp),
intent(out) :: umf(
ka)
1475 real(rp),
intent(out) :: umflcl
1476 real(rp),
intent(out) :: upent(
ka)
1477 real(rp),
intent(out) :: updet(
ka)
1478 real(rp),
intent(out) :: umfnewdold(
ka)
1479 real(rp),
intent(out) :: umfnew,umfold
1480 real(rp),
intent(out) :: temp_u(
ka)
1481 real(rp),
intent(out) :: theta_ee(
ka)
1482 real(rp),
intent(out) :: cloudhight
1483 real(rp),
intent(out) :: cloudtop
1484 real(rp),
intent(out) :: qv_u(
ka)
1485 real(rp),
intent(out) :: qc(
ka)
1486 real(rp),
intent(out) :: qi(
ka)
1487 real(rp),
intent(out) :: qrout(
ka)
1488 real(rp),
intent(out) :: qsout(
ka)
1489 real(rp),
intent(out) :: qvdet(
ka)
1490 real(rp),
intent(out) :: qcdet(
ka)
1491 real(rp),
intent(out) :: qidet(
ka)
1492 real(rp),
intent(out) :: cape
1493 real(rp),
intent(out) :: flux_qr(
ka)
1494 real(rp),
intent(out) :: flux_qs(
ka)
1498 real(rp) :: tempv_u(
ka)
1499 real(rp) :: tempvq_u(
ka)
1501 real(rp) :: ee1,ud1, ee2,ud2
1502 real(rp) :: f_eq(
ka)
1503 real(rp) :: f_mix1,f_mix2
1504 real(rp) :: rei,dilbe
1505 real(rp) :: qcnew,qinew
1507 real(rp) :: f_frozen1
1509 real(rp) :: temptmp_ice
1510 real(rp) :: tempv(
ka)
1516 real(rp) :: theta_tmp
1518 real(rp) :: qvtmp, qctmp, qitmp
1519 real(rp) :: temp_u95, temp_u10
1521 real(rp),
parameter :: temp_frzt = 268.16_rp
1522 real(rp),
parameter :: temp_frzb = 248.16_rp
1548 tempv(kk) = temp(kk) *( 1.0_rp + epstvap * qv(kk) )
1551 umfnewdold(:) = 1._rp
1554 denslcl = pres_lcl/(rdry*tempv_lcl)
1555 umf(k_lclm1) = denslcl*1.e-2_rp*deltax**2
1556 umflcl = umf(k_lclm1)
1560 temp_u(k_lclm1) = temp_lcl
1561 tempv_u(k_lclm1) = tempv_lcl
1562 qv_u(k_lclm1) = qv_mix
1569 temptmp_ice = temp_frzt
1573 do kk = k_lclm1,
ke-1
1577 theta_eu(kkp1) = theta_eu(kk)
1578 qv_u(kkp1) = qv_u(kk)
1585 call cp_kf_tpmix2(pres(kkp1), theta_eu(kkp1), &
1586 qv_u(kkp1), qc(kkp1), qi(kkp1), &
1587 temp_u(kkp1), qcnew, qinew )
1593 if (temp_u(kkp1) <= temp_frzt )
then
1594 if (temp_u(kkp1) > temp_frzb)
then
1595 if (temptmp_ice > temp_frzt) temptmp_ice = temp_frzt
1597 f_frozen1 = (temptmp_ice - temp_u(kkp1))/(temptmp_ice - temp_frzb)
1601 f_frozen1 = min(1._rp, max(0._rp, f_frozen1))
1602 temptmp_ice = temp_u(kkp1)
1604 qfrz = (qc(kkp1) + qcnew)*f_frozen1
1605 qinew = qinew + qcnew*f_frozen1
1606 qcnew = qcnew - qcnew*f_frozen1
1607 qi(kkp1) = qi(kkp1) + qc(kkp1)*f_frozen1
1608 qc(kkp1) = qc(kkp1) - qc(kkp1)*f_frozen1
1611 call cp_kf_dtfrznew( pres(kkp1), qfrz, &
1612 temp_u(kkp1), theta_eu(kkp1), qv_u(kkp1), qi(kkp1) )
1614 tempv_u(kkp1) = temp_u(kkp1) * ( 1.0_rp + epstvap * qv_u(kkp1) )
1616 if (kk == k_lclm1)
then
1617 boeff = (tempv_lcl + tempv_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp
1618 boterm = 2._rp*(z_kf(kkp1) - zlcl)*grav*boeff/1.5_rp
1619 dztmp = z_kf(kkp1) - zlcl
1621 boeff = (tempv_u(kk) + tempv_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp
1622 boterm = 2._rp*(dz_kf(kk) )*grav*boeff/1.5_rp
1626 entterm = 2._rp*rei*wtw/umfold
1628 call cp_kf_precipitation( &
1629 grav, dztmp, boterm, entterm, &
1630 wtw, qc(kkp1), qi(kkp1), qcnew, qinew, qrout(kkp1), qsout(kkp1) )
1636 if (wtw < 1.e-3_rp )
then
1639 wu(kkp1) = sqrt(wtw)
1642 call cp_kf_envirtht( pres(kkp1), temp(kkp1), qv(kkp1), &
1645 rei = umflcl*deltap(kkp1)*0.03_rp/radius
1648 tempvq_u(kkp1) = temp_u(kkp1) * ( 1.0_rp + epstvap * qv_u(kkp1) - qc(kkp1) - qi(kkp1) )
1649 if (kk == k_lclm1) then
1650 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp)*dztmp
1652 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp)*dztmp
1654 if(dilbe > 0._rp) cape = cape + dilbe*grav
1660 if(tempvq_u(kkp1) <= tempv(kkp1))
then
1670 f_mix2 = 1._rp - f_mix1
1671 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1672 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1673 qctmp = f_mix2*qc(kkp1)
1674 qitmp = f_mix2*qi(kkp1)
1676 call cp_kf_tpmix2( pres(kkp1), theta_tmp, &
1677 qvtmp, qctmp, qitmp, &
1678 temptmp, qcnew, qinew )
1680 temp_u95 = temptmp * ( 1.0_rp + epstvap * qvtmp - qctmp - qitmp )
1682 if ( temp_u95 > tempv(kkp1))
then
1688 f_mix2 = 1._rp - f_mix1
1689 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1690 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1691 qctmp = f_mix2*qc(kkp1)
1692 qitmp = f_mix2*qi(kkp1)
1694 call cp_kf_tpmix2( pres(kkp1), theta_tmp, &
1695 qvtmp, qctmp, qitmp, &
1696 temptmp, qcnew, qinew )
1698 temp_u10 = temptmp * (1.0 + epstvap * qvtmp - qctmp - qitmp )
1699 if (abs(temp_u10 - tempvq_u(kkp1)) < 1.e-3_rp )
then
1704 f_eq(kkp1) = (tempv(kkp1) - tempvq_u(kkp1))*f_mix1 &
1705 & /(temp_u10 - tempvq_u(kkp1))
1706 f_eq(kkp1) = max(0._rp,f_eq(kkp1) )
1707 f_eq(kkp1) = min(1._rp,f_eq(kkp1) )
1708 if (f_eq(kkp1) == 1._rp)
then
1711 elseif (f_eq(kkp1) == 0._rp)
then
1717 call cp_kf_prof5( f_eq(kkp1), &
1723 ee2 = max(ee2,0.5_rp)
1726 upent(kkp1) = 0.5_rp*rei*(ee1 + ee2)
1727 updet(kkp1) = 0.5_rp*rei*(ud1 + ud2)
1730 if (umf(kk) - updet(kkp1) < 10._rp)
then
1734 if (dilbe > 0._rp)
then
1735 cape = cape - dilbe*grav
1742 umfold = umf(kk) - updet(kkp1)
1743 umfnew = umfold + upent(kkp1)
1745 umfnewdold(kkp1) = umfnew/umfold
1746 qcdet(kkp1) = qc(kkp1)*updet(kkp1)
1747 qidet(kkp1) = qi(kkp1)*updet(kkp1)
1748 qvdet(kkp1) = qv_u(kkp1)
1749 qold = qv_u(kkp1) + qc(kkp1) + qi(kkp1) + qrout(kkp1) + qsout(kkp1)
1751 qv_u(kkp1) = ( umfold*qv_u(kkp1) + upent(kkp1)*qv(kkp1) ) / umfnew
1752 qc(kkp1) = qc(kkp1)*umfold/umfnew
1753 qi(kkp1) = qi(kkp1)*umfold/umfnew
1754 theta_eu(kkp1) = ( umfold * ( 1.0_rp + qold ) * theta_eu(kkp1) &
1755 + upent(kkp1) * ( 1.0_rp + qv(kkp1) ) * theta_ee(kkp1) &
1756 ) / ( umfnew * ( 1.0_rp + qv_u(kkp1) + qc(kkp1) + qi(kkp1) ) )
1759 flux_qr(kkp1) = qrout(kkp1)*umf(kk)
1760 flux_qs(kkp1) = qsout(kkp1)*umf(kk)
1764 if(kkp1 <= k_pbl ) upent(kkp1) = upent(kkp1) + umflcl*deltap(kkp1)/dpthmx
1769 cloudhight = z_kf(k_top) - zlcl
1770 cloudtop = z_kf(k_top)
1773 end subroutine cp_kf_updraft
1780 subroutine cp_kf_downdraft ( &
1783 k_lcl, k_ml, k_top, k_pbl, k_let, k_lc, &
1785 u, v, rh, qv, pres, &
1790 flux_qr, flux_qs, tempv, &
1791 wspd, dmf, downent, downdet, &
1793 rain_flux, snow_flux, &
1810 atmos_saturation_psat_liq
1814 integer,
intent(in) ::
ka,
ks,
ke
1815 integer,
intent(in) :: i_convflag
1816 integer,
intent(in) :: k_lcl
1817 integer,
intent(in) :: k_top
1818 integer,
intent(in) :: k_pbl
1819 integer,
intent(in) :: k_let
1820 integer,
intent(in) :: k_lc
1821 integer,
intent(in) :: k_ml
1822 real(
rp),
intent(in) :: z_kf(
ka)
1823 real(
rp),
intent(in) :: u(
ka)
1824 real(
rp),
intent(in) :: v(
ka)
1825 real(
rp),
intent(in) :: rh(
ka)
1826 real(
rp),
intent(in) :: qv(
ka)
1827 real(
rp),
intent(in) :: pres(
ka)
1828 real(
rp),
intent(in) :: deltap(
ka)
1829 real(
rp),
intent(in) :: deltax
1830 real(
rp),
intent(in) :: ems(
ka)
1831 real(
rp),
intent(in) :: zlcl
1832 real(
rp),
intent(in) :: umf(
ka)
1833 real(
rp),
intent(in) :: temp_u(
ka)
1834 real(
rp),
intent(in) :: flux_qr(
ka)
1835 real(
rp),
intent(in) :: flux_qs(
ka)
1836 real(
rp),
intent(in) :: tempv(
ka)
1837 real(
rp),
intent(in) :: theta_ee(
ka)
1839 real(
rp),
intent(out) :: wspd(3)
1840 real(
rp),
intent(out) :: dmf(
ka)
1841 real(
rp),
intent(out) :: downent(
ka)
1842 real(
rp),
intent(out) :: downdet(
ka)
1843 real(
rp),
intent(out) :: theta_d(
ka)
1844 real(
rp),
intent(out) :: qv_d(
ka)
1845 real(
rp),
intent(out) :: rain_flux
1846 real(
rp),
intent(out) :: snow_flux
1847 real(
rp),
intent(out) :: prec_engi
1848 integer,
intent(out) :: k_lfs
1859 real(
rp) :: pef_wind
1860 real(
rp) :: pef_cloud
1873 real(
rp) :: temp_d(
ka)
1874 real(
rp) :: tempv_d(
ka)
1875 real(
rp) :: theta_ed(
ka)
1876 real(
rp) :: qvsd(
ka)
1878 real(
rp) :: iexn(
ka)
1883 real(
rp) :: total_prec
1884 real(
rp) :: total_rain
1885 real(
rp) :: total_snow
1886 logical :: flag_rain
1906 if (i_convflag == 2)
return
1910 if (pres(kk) >= pres(
ks)*0.5_rp) k_z5 = kk
1913 wspd(1) = sqrt(u(k_lcl)*u(k_lcl) + v(k_lcl)*v(k_lcl))
1914 wspd(2) = sqrt(u(k_z5)*u(k_z5) + v(k_z5)*v(k_z5))
1915 wspd(3) = sqrt(u(k_top)*u(k_top) + v(k_top)*v(k_top))
1920 if(wspd(3) > wspd(1))
then
1925 vws = (u(k_top) - u(k_lcl))*(u(k_top) - u(k_lcl)) &
1926 + (v(k_top) - v(k_lcl))*(v(k_top) - v(k_lcl))
1928 vws = 1.e3_rp*shsign*sqrt(vws)/(z_kf(k_top) - z_kf(k_lcl))
1931 pef_wind = 1.591_rp + vws*(-0.639_rp + vws*(9.53e-2_rp - vws*4.96e-3_rp) )
1933 pef_wind = max(pef_wind,0.2_rp)
1934 pef_wind = min(pef_wind,0.9_rp)
1938 cbh = (zlcl - z_kf(
ks))*3.281e-3_rp
1939 if( cbh < 3._rp)
then
1942 rcbh = 0.96729352_rp + cbh*(-0.70034167_rp + cbh*(0.162179896_rp + cbh*(- &
1943 1.2569798e-2_rp + cbh*(4.2772e-4_rp - cbh*5.44e-6_rp))))
1945 if(cbh > 25.0_rp) rcbh = 2.4_rp
1946 pef_cloud = 1._rp/(1._rp + rcbh)
1947 pef_cloud = min(pef_cloud,0.9_rp)
1949 pef = 0.5_rp*(pef_wind + pef_cloud)
1954 do kk = k_lcl, k_top
1955 total_rain = total_rain + flux_qr(kk)
1956 total_snow = total_snow + flux_qs(kk)
1960 if(i_convflag == 1)
then
1964 k_dstart = k_pbl + 1
1965 k_lfstmp = k_let - 1
1966 do kk = k_dstart+1,
ke
1967 dpthtmp = pres(k_dstart) - pres(kk)
1968 if(dpthtmp > 150.e2_rp)
then
1973 k_lfstmp = min(k_lfstmp, k_let - 1)
1980 if(pres(k_dstart) - pres(k_lfs) > 50.e2_rp)
then
1981 theta_ed(k_lfs) = theta_ee(k_lfs)
1982 qv_d(k_lfs) = qv(k_lfs)
1984 call cp_kf_tpmix2dd( pres(k_lfs), theta_ed(k_lfs), &
1985 temp_d(k_lfs), qvs_tmp )
1986 call cp_kf_calciexn( pres(k_lfs), qvs_tmp, &
1988 theta_d(k_lfs) = temp_d(k_lfs) * iexn(k_lfs)
1990 tempv_d(k_lfs) = temp_d(k_lfs) * ( 1.0_rp + epstvap * qvs_tmp )
1991 dens_d = pres(k_lfs)/(rdry*tempv_d(k_lfs))
1992 dmf(k_lfs) = -(1._rp - pef)*1.e-2_rp*deltax**2*dens_d
1993 downent(k_lfs) = dmf(k_lfs)
1994 downdet(k_lfs) = 0._rp
1995 rhbar = rh(k_lfs)*deltap(k_lfs)
1996 dpthtmp = deltap(k_lfs)
2000 do kk = k_lfs-1,k_dstart,-1
2002 downent(kk) = downent(k_lfs)*ems(kk)/ems(k_lfs)
2004 dmf(kk) = dmf(kkp1) + downent(kk)
2006 qv_d(kk) = ( qv_d(kkp1)*dmf(kkp1) + qv(kk)*downent(kk) ) / dmf(kk)
2007 theta_ed(kk) = ( theta_ed(kkp1) * dmf(kkp1) * ( 1.0_rp + qvold ) &
2008 + theta_ee(kk) * downent(kk) * ( 1.0_rp + qv(kk) ) &
2009 ) / ( dmf(kk) * ( 1.0_rp + qv_d(kk) ) )
2010 dpthtmp = dpthtmp + deltap(kk)
2011 rhbar = rhbar + rh(kk)*deltap(kk)
2013 rhbar = rhbar/dpthtmp
2014 f_dmf = 2._rp*(1._rp - rhbar)
2016 call cp_kf_tpmix2dd( pres(k_dstart), theta_ed(k_dstart), &
2017 temp_d(k_dstart), qvs_tmp )
2021 do kk = k_lcl, k_top
2022 dq = dq + ( flux_qr(kk) *
cv_water + flux_qs(kk) *
cv_ice ) * ( temp_d(k_dstart) - temp_u(kk) )
2024 temp_d(k_dstart) = temp_d(k_dstart) - dq / ( umf(k_lcl) * cpdry )
2027 if ( k_lc < k_ml )
then
2029 temp_d(k_dstart) = temp_d(k_dstart) - emelt * total_snow / ( umf(k_lcl) * cpdry )
2030 total_rain = total_rain + total_snow
2040 es = aliq*exp((bliq*temp_d(k_dstart)-cliq)/(temp_d(k_dstart)-dliq))
2042 qvs_tmp = epsvap * es / ( pres(k_dstart) - es )
2044 theta_ed(k_dstart) = temp_d(k_dstart)*(pre00/pres(k_dstart))**( ( rdry + rvap * qvs_tmp ) / ( cpdry + cpvap * qvs_tmp ) ) &
2045 * exp((3374.6525_rp/temp_d(k_dstart)-2.5403_rp)*qvs_tmp*(1._rp + 0.81_rp*qvs_tmp))
2046 k_ldt = min(k_lfs-1, k_dstart-1)
2050 dpthdet = dpthdet + deltap(kk)
2051 theta_ed(kk) = theta_ed(k_dstart)
2052 qv_d(kk) = qv_d(k_dstart)
2053 call cp_kf_tpmix2dd( pres(kk), theta_ed(kk), &
2054 temp_d(kk), qvs_tmp )
2059 rhh = 1._rp - 2.e-4_rp*(z_kf(k_dstart) -z_kf(kk) )
2063 if( rhh < 1._rp )
then
2065 dssdt = (cliq - bliq*dliq)/((temp_d(kk) - dliq)*(temp_d(kk) - dliq))
2066 rl = xlv0 - xlv1*temp_d(kk)
2067 dtmp = rl * qvs_tmp * ( 1.0_rp - rhh ) / ( cpdry + rl * rhh * qvs_tmp * dssdt )
2068 t1rh = temp_d(kk) + dtmp
2072 es = aliq*exp((bliq*t1rh-cliq)/(t1rh-dliq))
2075 qsrh = epsvap * es / ( pres(kk) - es )
2076 if(qsrh < qv_d(kk) )
then
2078 t1rh = temp_d(kk) + (qvs_tmp - qsrh) * rl / cpdry
2090 tempv_d(kk) = temp_d(kk) * ( 1.0_rp + epstvap * qvsd(kk) )
2091 if(tempv_d(kk) > tempv(kk) .or. kk ==
ks)
then
2098 if( (pres(k_ldb)-pres(k_lfs)) > 50.e2_rp )
then
2099 do kk = k_ldt,k_ldb,-1
2101 downdet(kk) = -dmf(k_dstart)*deltap(kk)/dpthdet
2103 dmf(kk) = dmf(kkp1) + downdet(kk)
2104 tder = tder + (qvsd(kk) - qv_d(kk))*downdet(kk)
2106 call cp_kf_calciexn( pres(kk), qv_d(kk), &
2108 theta_d(kk) = temp_d(kk)*iexn(kk)
2117 if (tder < 1._rp)
then
2118 rain_flux = total_rain
2119 snow_flux = total_snow
2131 ddinc = -f_dmf*umf(k_lcl)/dmf(k_dstart)
2132 if ( flag_rain )
then
2133 total_prec = total_rain
2135 total_prec = total_snow
2137 if( tder*ddinc > total_prec )
then
2138 ddinc = total_prec / tder
2142 dmf(kk) = dmf(kk)*ddinc
2143 downent(kk) = downent(kk)*ddinc
2144 downdet(kk) = downdet(kk)*ddinc
2147 if ( flag_rain )
then
2148 rain_flux = total_rain - tder
2149 snow_flux = total_snow
2151 rain_flux = total_rain
2152 snow_flux = total_snow - tder
2154 if ( total_prec < kf_eps )
then
2157 pef = ( rain_flux + snow_flux ) / total_prec
2159 prec_engi = rain_flux *
cv_water * temp_d(k_ldb) &
2160 + snow_flux * (
cv_ice * temp_d(k_ldb) -
lhf )
2176 if (k_ldb >
ks)
then
2196 do kk = k_ldt+1,k_lfs-1
2204 end subroutine cp_kf_downdraft
2211 subroutine cp_kf_compensational (&
2213 k_top, k_lc, k_pbl, k_ml, k_lfs, &
2214 dz_kf, z_kf, pres, deltap, deltax, &
2217 presmix, zmix, dpthmx, &
2219 temp_u, qvdet, umflcl, &
2220 qc, qi, flux_qr, flux_qs, &
2227 I_convflag, k_lcl_bf, &
2228 umf, upent, updet, &
2229 qcdet, qidet, dmf, downent, downdet, &
2230 rain_flux, snow_flux, &
2233 qv_g, qc_nw, qi_nw, qr_nw, qs_nw, &
2234 sflx_rain, sflx_snow, sflx_engi, &
2235 cldfrac_KF, timecp, time_advec )
2247 atmos_saturation_psat_liq
2251 integer,
intent(in) ::
ka,
ks,
ke
2252 integer,
intent(in) :: k_top
2253 integer,
intent(in) :: k_lc
2254 integer,
intent(in) :: k_pbl
2255 integer,
intent(in) :: k_ml
2256 integer,
intent(in) :: k_lfs
2257 real(
rp),
intent(in) :: dz_kf(
ka),z_kf(
ka)
2258 real(
rp),
intent(in) :: pres(
ka)
2259 real(
rp),
intent(in) :: deltap(
ka)
2260 real(
rp),
intent(in) :: deltax
2261 real(
rp),
intent(in) :: temp_bf(
ka)
2262 real(
rp),
intent(in) :: qv(
ka)
2263 real(
rp),
intent(in) :: ems(
ka)
2264 real(
rp),
intent(in) :: emsd(
ka)
2265 real(
rp),
intent(in) :: presmix
2266 real(
rp),
intent(in) :: zmix
2267 real(
rp),
intent(in) :: dpthmx
2268 real(
rp),
intent(in) :: cape
2269 real(
rp),
intent(in) :: temp_u(
ka)
2270 real(
rp),
intent(in) :: qvdet(
ka)
2271 real(
rp),
intent(in) :: umflcl
2272 real(
rp),
intent(in) :: qc(
ka)
2273 real(
rp),
intent(in) :: qi(
ka)
2274 real(
rp),
intent(in) :: flux_qr(
ka)
2275 real(
rp),
intent(in) :: flux_qs(
ka)
2276 real(
rp),
intent(in) :: umfnewdold(
ka)
2277 real(
rp),
intent(in) :: wspd(3)
2278 real(
rp),
intent(in) :: qv_d(
ka)
2279 real(
rp),
intent(in) :: theta_d(
ka)
2280 real(
rp),
intent(in) :: prec_engi
2281 real(
rp),
intent(in) :: kf_dtsec
2282 real(
rp),
intent(in) :: rhod(
ka)
2283 integer,
intent(in) :: i, j
2285 integer,
intent(inout) :: i_convflag
2286 integer,
intent(inout) :: k_lcl_bf
2287 real(
rp),
intent(inout) :: umf(
ka)
2288 real(
rp),
intent(inout) :: upent(
ka)
2289 real(
rp),
intent(inout) :: updet(
ka)
2290 real(
rp),
intent(inout) :: qcdet(
ka)
2291 real(
rp),
intent(inout) :: qidet(
ka)
2292 real(
rp),
intent(inout) :: dmf(
ka)
2293 real(
rp),
intent(inout) :: downent(
ka)
2294 real(
rp),
intent(inout) :: downdet(
ka)
2295 real(
rp),
intent(inout) :: rain_flux
2296 real(
rp),
intent(inout) :: snow_flux
2298 integer,
intent(out) :: nic
2301 real(
rp),
intent(out) :: theta_nw(
ka)
2302 real(
rp),
intent(out) :: qv_g(
ka)
2303 real(
rp),
intent(out) :: qc_nw(
ka)
2304 real(
rp),
intent(out) :: qi_nw(
ka)
2305 real(
rp),
intent(out) :: qr_nw(
ka)
2306 real(
rp),
intent(out) :: qs_nw(
ka)
2307 real(
rp),
intent(out) :: sflx_rain
2308 real(
rp),
intent(out) :: sflx_snow
2309 real(
rp),
intent(out) :: sflx_engi
2310 real(
rp),
intent(out) :: cldfrac_kf(
ka,2)
2311 real(
rp),
intent(out) :: timecp
2312 real(
rp),
intent(out) :: time_advec
2315 integer :: ntimecount
2320 integer :: k_lcl, k_lclm1
2322 real(
rp) :: umf2(
ka), dmf2(
ka)
2323 real(
rp) :: upent2(
ka), updet2(
ka)
2324 real(
rp) :: qcdet2(
ka), qidet2(
ka)
2325 real(
rp) :: downent2(
ka), downdet2(
ka)
2326 real(
rp) :: rain_flux2
2327 real(
rp) :: snow_flux2
2330 real(
rp) :: theta(
ka)
2331 real(
rp) :: theta_u(
ka)
2332 real(
rp) :: theta_eu(
ka)
2333 real(
rp) :: theta_eg(
ka)
2334 real(
rp) :: iexn(
ka)
2337 real(
rp) :: qv_gu(
ka)
2338 real(
rp) :: temp_g(
ka)
2339 real(
rp) :: temp_env
2340 real(
rp) :: tempv_env
2341 real(
rp) :: temp_lcl
2342 real(
rp) :: tempv_lcl
2343 real(
rp) :: temp_mix
2344 real(
rp) :: temp_gu(
ka)
2345 real(
rp) :: tempv_g(
ka)
2346 real(
rp) :: tempvq_u(
ka)
2349 real(
rp) :: dq, tdpt, dssdt, emix, rl, tlog
2354 real(
rp) :: theta_g(
ka)
2355 real(
rp) :: qv_nw(
ka)
2360 real(
rp) :: f_cape ,f_capeold
2365 real(
rp) :: tma,tmb,tmm
2367 real(
rp) :: ainc,ainctmp, aincmx,aincold
2373 real(
rp) :: domg_dp(
ka)
2374 real(
rp) :: absomgtc,absomg
2377 real(
rp) :: theta_fx(
ka)
2378 real(
rp) :: qv_fx(
ka)
2379 real(
rp) :: qc_fx(
ka)
2380 real(
rp) :: qi_fx(
ka)
2381 real(
rp) :: qr_fx(
ka)
2382 real(
rp) :: qs_fx(
ka)
2383 real(
rp) :: rainfb(
ka), snowfb(
ka)
2393 real(
rp) :: xcldfrac
2405 if(i_convflag == 2)
return
2407 if ( do_prec .and. i_convflag == 0 )
then
2413 vconv = 0.5_rp*(wspd(1) + wspd(2))
2414 timecp = deltax/vconv
2416 timecp = max(deeplifetime, timecp)
2417 timecp = min(3600._rp, timecp)
2418 if(i_convflag == 1) timecp = shallowlifetime
2419 nic = nint(timecp/kf_dtsec)
2420 timecp = nic * kf_dtsec
2424 k_lmax = max(k_lcl,k_lfs)
2426 if((upent(kk)-downent(kk)) > 1.e-3_rp)
then
2427 ainctmp = ems(kk)/( (upent(kk) -downent(kk))*timecp )
2428 aincmx = min(aincmx,ainctmp)
2433 if(aincmx < ainc ) ainc = aincmx
2435 rain_flux2 = rain_flux
2436 snow_flux2 = snow_flux
2439 upent2(kk) = upent(kk)
2440 updet2(kk) = updet(kk)
2441 qcdet2(kk) = qcdet(kk)
2442 qidet2(kk) = qidet(kk)
2444 downent2(kk) = downent(kk)
2445 downdet2(kk) = downdet(kk)
2448 stab = 1.05_rp - delcape
2450 if (i_convflag == 1)
then
2453 evac = 0.50_rp*tkemax*1.e-1_rp
2454 ainc = evac*dpthmx*deltax**2/( umflcl*grav*timecp)
2455 rain_flux = rain_flux2*ainc
2456 snow_flux = snow_flux2*ainc
2458 umf(kk) = umf2(kk)*ainc
2459 upent(kk) = upent2(kk)*ainc
2460 updet(kk) = updet2(kk)*ainc
2461 qcdet(kk) = qcdet2(kk)*ainc
2462 qidet(kk) = qidet2(kk)*ainc
2463 dmf(kk) = dmf2(kk)*ainc
2464 downent(kk) = downent2(kk)*ainc
2465 downdet(kk) = downdet2(kk)*ainc
2472 call cp_kf_calciexn( pres(kk), qv(kk), &
2474 theta(kk) = temp_bf(kk) * iexn(kk)
2475 call cp_kf_calciexn( pres(kk), qvdet(kk), &
2477 theta_u(kk) = temp_u(kk) * iexn(kk)
2479 temp_g(k_top+1:
ke) = temp_bf(k_top+1:
ke)
2480 qv_g(k_top+1:
ke) = qv(k_top+1:
ke)
2491 domg_dp(kk) = - ( upent(kk) - downent(kk) - updet(kk) - downdet(kk) ) * emsd(kk)
2492 omg(kk) = omg(kk-1) - deltap(kk) * domg_dp(kk)
2493 absomg = abs(omg(kk))
2494 absomgtc = absomg*timecp
2495 f_dp = 0.75_rp*deltap(kk)
2496 if(absomgtc > f_dp)
THEN
2497 dtt_tmp = f_dp/absomg
2498 dtt=min(dtt,dtt_tmp)
2503 theta_nw(kk) = theta(kk)
2507 fxm(kk) = - omg(kk) * deltax**2 / grav
2509 nstep = nint(timecp/dtt + 1)
2510 deltat = timecp/real(nstep,
rp)
2511 if ( hist_flag )
then
2514 hist_work(kk,i,j,i_hist_qv_fc,m) = 0.0_rp
2515 hist_work(kk,i,j,i_hist_qv_ue,m) = 0.0_rp
2516 hist_work(kk,i,j,i_hist_qv_ud,m) = 0.0_rp
2521 hist_work(kk,i,j,i_hist_qv_de,0) = 0.0_rp
2522 hist_work(kk,i,j,i_hist_qv_dd,0) = 0.0_rp
2525 theta_fx(
ks-1) = 0.0_rp
2526 qv_fx(
ks-1) = 0.0_rp
2527 theta_fx(k_top) = 0.0_rp
2528 qv_fx(k_top) = 0.0_rp
2529 do ntimecount = 1, nstep
2534 if( omg(kk) <= 0.0_rp )
then
2535 theta_fx(kk) = fxm(kk) * theta_nw(kk) * ( 1.0_rp + qv_nw(kk) )
2536 qv_fx(kk) = fxm(kk) * qv_nw(kk)
2538 theta_fx(kk) = fxm(kk) * theta_nw(kk+1) * ( 1.0_rp + qv_nw(kk+1) )
2539 qv_fx(kk) = fxm(kk) * qv_nw(kk+1)
2546 qv_nw(kk) = qv_nw(kk) &
2547 + ( - ( qv_fx(kk) - qv_fx(kk-1) ) &
2548 + updet(kk)*qvdet(kk) + downdet(kk)*qv_d(kk) &
2549 - ( upent(kk) - downent(kk) )*qv(kk) )*deltat*emsd(kk)
2550 theta_nw(kk) = ( theta_nw(kk) * ( 1.0_rp + qvold + qc(kk) + qi(kk) ) &
2551 + ( - ( theta_fx(kk) - theta_fx(kk-1) ) &
2552 + updet(kk) * theta_u(kk) * ( 1.0_rp + qvdet(kk) ) &
2553 + downdet(kk) * theta_d(kk) * ( 1.0_rp + qv_d(kk) ) &
2554 - ( upent(kk) - downent(kk) ) * theta(kk) * ( 1.0_rp + qv(kk) ) &
2555 ) * deltat * emsd(kk) &
2556 ) / ( 1.0_rp + qv_nw(kk) + qc(kk) + qi(kk) )
2558 if ( hist_flag )
then
2560 hist_work(kk,i,j,i_hist_qv_fc,i_convflag) = hist_work(kk,i,j,i_hist_qv_fc,i_convflag) &
2561 - ( qv_fx(kk) - qv_fx(kk-1) ) * emsd(kk) * rhod(kk) / nstep
2562 hist_work(kk,i,j,i_hist_qv_ud,i_convflag) = hist_work(kk,i,j,i_hist_qv_ud,i_convflag) &
2563 + updet(kk) * qvdet(kk) * emsd(kk) * rhod(kk) / nstep
2564 hist_work(kk,i,j,i_hist_qv_ue,i_convflag) = hist_work(kk,i,j,i_hist_qv_ue,i_convflag) &
2565 - upent(kk) * qv(kk) * emsd(kk) * rhod(kk) / nstep
2567 if ( i_convflag == 0 )
then
2569 hist_work(kk,i,j,i_hist_qv_dd,0) = hist_work(kk,i,j,i_hist_qv_dd,0) &
2570 + downdet(kk) * qv_d(kk) * emsd(kk) * rhod(kk) / nstep
2571 hist_work(kk,i,j,i_hist_qv_de,0) = hist_work(kk,i,j,i_hist_qv_de,0) &
2572 + downent(kk) * qv(kk) * emsd(kk) * rhod(kk) / nstep
2579 theta_g(kk) = theta_nw(kk)
2580 qv_g(kk) = qv_nw(kk)
2584 if ( qv_g(k_top) < kf_eps )
then
2585 qv_g(k_top-1) = qv_g(k_top-1) + ( qv_g(k_top) - kf_eps ) * ems(k_top) * emsd(k_top-1)
2586 qv_g(k_top) = kf_eps
2588 do kk = k_top-1,
ks+1, -1
2589 if( qv_g(kk) < kf_eps )
then
2590 tma = qv_g(kk+1) * ems(kk+1)
2591 tmb = max( qv_g(kk-1), kf_eps ) * ems(kk-1)
2592 tmm = ( qv_g(kk) - kf_eps ) * ems(kk)
2593 tma = tma * ( 1.0_rp + tmm / ( tma + tmb ) )
2594 tma = max( tma, kf_eps * ems(kk+1) )
2595 qv_g(kk-1) = qv_g(kk-1) + ( qv_g(kk+1) * ems(kk+1) - tma + tmm ) * emsd(kk-1)
2596 qv_g(kk+1) = tma * emsd(kk+1)
2600 if( qv_g(
ks) < kf_eps )
then
2601 log_error(
"CP_kf_compensational",*)
"error qv<0 @ Kain-Fritsch cumulus parameterization"
2604 if ( hist_flag )
then
2606 hist_work(kk,i,j,i_hist_qv_nf,i_convflag) = ( qv_g(kk) - qv_nw(kk) ) * rhod(kk) / timecp
2610 topomg = (updet(k_top) - upent(k_top))*deltap(k_top)*emsd(k_top)
2611 if( abs(topomg - omg(k_top-1)) > 1.e-3_rp)
then
2612 log_error(
"CP_kf_compensational",*)
"KF omega is not consistent",ncount
2613 log_error_cont(*)
"omega error",abs(topomg - omg(k_top-1)),k_top,topomg,omg(k_top-1)
2618 call cp_kf_calciexn( pres(kk), qv_g(kk), &
2620 temp_g(kk) = theta_g(kk) / iexn(kk)
2621 tempv_g(kk) = temp_g(kk) * ( 1.0_rp + epstvap * qv_g(kk) )
2625 if(i_convflag == 1)
then
2631 temp_mix = temp_mix + deltap(kk)*temp_g(kk)
2632 qv_mix = qv_mix + deltap(kk)*qv_g(kk)
2635 temp_mix = temp_mix/dpthmx
2636 qv_mix = qv_mix/dpthmx
2641 es = aliq*exp((bliq*temp_mix-cliq)/(temp_mix-dliq))
2643 qvss = epsvap * es / (presmix -es)
2646 if (qv_mix > qvss)
then
2647 rl = xlv0 -xlv1*temp_mix
2648 cpm = cpdry + ( cpvap - cpdry ) * qv_mix
2649 dssdt = qvss*(cliq-bliq*dliq)/( (temp_mix-dliq)**2)
2650 dq = (qv_mix -qvss)/(1._rp + rl*dssdt/cpm)
2651 temp_mix = temp_mix + rl / cpdry * dq
2652 qv_mix = qv_mix - dq
2655 qv_mix = max(qv_mix,0._rp)
2656 emix = qv_mix * presmix / ( epsvap + qv_mix )
2657 tlog = log(emix/aliq)
2659 tdpt = (cliq - dliq*tlog)/(bliq - tlog)
2660 temp_lcl = tdpt - (0.212_rp + 1.571e-3_rp*(tdpt - tem00) - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - tdpt)
2661 temp_lcl = min(temp_lcl,temp_mix)
2663 tempv_lcl = temp_lcl * ( 1.0_rp + epstvap * qv_mix )
2664 z_lcl = zmix + (temp_lcl - temp_mix)/gdcp
2667 if( z_lcl <= z_kf(kk) )
exit
2672 deltaz = ( z_lcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
2673 temp_env = temp_g(k_lclm1) + ( temp_g(k_lcl) - temp_g(k_lclm1) )*deltaz
2674 qv_env = qv_g(k_lclm1) + ( qv_g(k_lcl) - qv_g(k_lclm1) )*deltaz
2675 tempv_env = temp_env * ( 1.0_rp + epstvap * qv_env )
2677 theta_eu(k_lclm1)=temp_mix*(pre00/presmix)**( ( rdry + rvap * qv_mix ) / ( cpdry + cpvap * qv_mix ) ) &
2678 * exp((3374.6525_rp/temp_lcl-2.5403_rp)*qv_mix*(1._rp + 0.81_rp*qv_mix))
2682 do kk=k_lclm1,k_top-1
2684 theta_eu(kkp1) = theta_eu(kk)
2686 call cp_kf_tpmix2dd( pres(kkp1), theta_eu(kkp1), &
2687 temp_gu(kkp1), qv_gu(kkp1) )
2688 tempvq_u(kkp1) = temp_gu(kkp1) * ( 1.0_rp + epstvap * qv_gu(kkp1) - qc(kkp1)- qi(kkp1) )
2689 if(kk == k_lclm1)
then
2690 dzz = z_kf(k_lcl) - z_lcl
2691 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv_g(kkp1)) - 1._rp)*dzz
2694 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv_g(kk) + tempv_g(kkp1)) - 1._rp)*dzz
2696 if(dilbe > 0._rp) cape_g = cape_g + dilbe*grav
2699 call cp_kf_envirtht( pres(kkp1), temp_g(kkp1), qv_g(kkp1), &
2703 theta_eu(kkp1) = theta_eu(kkp1)*(umfnewdold(kkp1)) + theta_eg(kkp1)*(1._rp - (umfnewdold(kkp1)))
2705 if (noiter == 1)
exit
2706 dcape = max(cape - cape_g,cape*0.1_rp)
2707 f_cape = cape_g/cape
2708 if(f_cape > 1._rp .and. i_convflag == 0)
then
2712 if(ncount /= 1)
then
2713 if(abs(ainc - aincold) < 1.e-4_rp)
then
2718 dfda = (f_cape - f_capeold)/(ainc - aincold)
2719 if (dfda > 0._rp )
then
2731 if (ainc/aincmx > 0.999_rp .and. f_cape > 1.05_rp-stab )
then
2737 if( (f_cape <= 1.05_rp-stab .and. f_cape >= 0.95_rp-stab) .or. ncount == 10)
then
2740 if(ncount > 10)
exit
2741 if(f_cape == 0._rp)
then
2744 if(dcape < 1.e-4)
then
2749 ainc = ainc*stab*cape/max(dcape,kf_eps)
2752 ainc = min(aincmx,ainc)
2754 if (ainc < 0.05_rp)
then
2759 rain_flux = rain_flux2*ainc
2760 snow_flux = snow_flux2*ainc
2762 umf(kk) = umf2(kk)*ainc
2763 upent(kk) = upent2(kk)*ainc
2764 updet(kk) = updet2(kk)*ainc
2765 qcdet(kk) = qcdet2(kk)*ainc
2766 qidet(kk) = qidet2(kk)*ainc
2767 dmf(kk) = dmf2(kk)*ainc
2768 downent(kk) = downent2(kk)*ainc
2769 downdet(kk) = downdet2(kk)*ainc
2778 cldfrac_kf(:,:) = 0._rp
2779 if (i_convflag == 1)
then
2780 do kk = k_lcl-1, k_top
2781 umf_tmp = umf(kk)/(deltax**2)
2782 xcldfrac = 0.07_rp*log(1._rp+(500._rp*umf_tmp))
2783 xcldfrac = max(1.e-2_rp,xcldfrac)
2784 cldfrac_kf(kk,1) = min(2.e-2_rp,xcldfrac)
2787 do kk = k_lcl-1, k_top
2788 umf_tmp = umf(kk)/(deltax**2)
2789 xcldfrac = 0.14_rp*log(1._rp+(500._rp*umf_tmp))
2790 xcldfrac = max(1.e-2_rp,xcldfrac)
2791 cldfrac_kf(kk,2) = min(6.e-1_rp,xcldfrac)
2797 rainfb(kk) = flux_qr(kk) * fbfrc * aincfin
2800 snowfb(kk) = flux_qs(kk) * fbfrc * aincfin
2804 qc_nw(
ks:
ke) = 0._rp
2805 qi_nw(
ks:
ke) = 0._rp
2806 qr_nw(
ks:
ke) = 0._rp
2807 qs_nw(
ks:
ke) = 0._rp
2809 if ( hist_flag )
then
2812 hist_work(kk,i,j,i_hist_qc_fc,m) = 0.0_rp
2813 hist_work(kk,i,j,i_hist_qc_ud,m) = 0.0_rp
2814 hist_work(kk,i,j,i_hist_qi_fc,m) = 0.0_rp
2815 hist_work(kk,i,j,i_hist_qi_ud,m) = 0.0_rp
2816 hist_work(kk,i,j,i_hist_qr_fc,m) = 0.0_rp
2817 hist_work(kk,i,j,i_hist_qr_rf,m) = 0.0_rp
2818 hist_work(kk,i,j,i_hist_qs_fc,m) = 0.0_rp
2819 hist_work(kk,i,j,i_hist_qs_sf,m) = 0.0_rp
2823 qc_fx(
ks-1) = 0.0_rp
2824 qi_fx(
ks-1) = 0.0_rp
2825 qr_fx(
ks-1) = 0.0_rp
2826 qs_fx(
ks-1) = 0.0_rp
2827 qc_fx(k_top) = 0.0_rp
2828 qi_fx(k_top) = 0.0_rp
2829 qr_fx(k_top) = 0.0_rp
2830 qs_fx(k_top) = 0.0_rp
2831 do ntimecount = 1, nstep
2833 if( omg(kk) <= 0.0_rp )
then
2834 qc_fx(kk) = fxm(kk) * qc_nw(kk)
2835 qi_fx(kk) = fxm(kk) * qi_nw(kk)
2836 qr_fx(kk) = fxm(kk) * qr_nw(kk)
2837 qs_fx(kk) = fxm(kk) * qs_nw(kk)
2839 qc_fx(kk) = fxm(kk) * qc_nw(kk+1)
2840 qi_fx(kk) = fxm(kk) * qi_nw(kk+1)
2841 qr_fx(kk) = fxm(kk) * qr_nw(kk+1)
2842 qs_fx(kk) = fxm(kk) * qs_nw(kk+1)
2846 qc_nw(kk) = qc_nw(kk) + ( - ( qc_fx(kk) - qc_fx(kk-1) ) + qcdet(kk) )*deltat*emsd(kk)
2847 qi_nw(kk) = qi_nw(kk) + ( - ( qi_fx(kk) - qi_fx(kk-1) ) + qidet(kk) )*deltat*emsd(kk)
2848 qr_nw(kk) = qr_nw(kk) + ( - ( qr_fx(kk) - qr_fx(kk-1) ) + rainfb(kk) )*deltat*emsd(kk)
2849 qs_nw(kk) = qs_nw(kk) + ( - ( qs_fx(kk) - qs_fx(kk-1) ) + snowfb(kk) )*deltat*emsd(kk)
2851 if ( hist_flag )
then
2853 hist_work(kk,i,j,i_hist_qc_fc,i_convflag) = hist_work(kk,i,j,i_hist_qc_fc,i_convflag) &
2854 - ( qc_fx(kk) - qc_fx(kk-1) ) * emsd(kk) * rhod(kk) / nstep
2855 hist_work(kk,i,j,i_hist_qc_ud,i_convflag) = hist_work(kk,i,j,i_hist_qc_ud,i_convflag) &
2856 + qcdet(kk) * emsd(kk) * rhod(kk) / nstep
2857 hist_work(kk,i,j,i_hist_qi_fc,i_convflag) = hist_work(kk,i,j,i_hist_qi_fc,i_convflag) &
2858 - ( qi_fx(kk) - qi_fx(kk-1) ) * emsd(kk) * rhod(kk) / nstep
2859 hist_work(kk,i,j,i_hist_qi_ud,i_convflag) = hist_work(kk,i,j,i_hist_qi_ud,i_convflag) &
2860 + qidet(kk) * emsd(kk) * rhod(kk) / nstep
2861 hist_work(kk,i,j,i_hist_qr_fc,i_convflag) = hist_work(kk,i,j,i_hist_qr_fc,i_convflag) &
2862 - ( qr_fx(kk) - qr_fx(kk-1) ) * emsd(kk) * rhod(kk) / nstep
2863 hist_work(kk,i,j,i_hist_qr_rf,i_convflag) = hist_work(kk,i,j,i_hist_qr_rf,i_convflag) &
2864 + rainfb(kk) * emsd(kk) * rhod(kk) / nstep
2865 hist_work(kk,i,j,i_hist_qs_fc,i_convflag) = hist_work(kk,i,j,i_hist_qs_fc,i_convflag) &
2866 - ( qs_fx(kk) - qs_fx(kk-1) ) * emsd(kk) * rhod(kk) / nstep
2867 hist_work(kk,i,j,i_hist_qs_sf,i_convflag) = hist_work(kk,i,j,i_hist_qs_sf,i_convflag) &
2868 + snowfb(kk) * emsd(kk) * rhod(kk) / nstep
2877 sflx_rain = rain_flux*(1._rp - fbfrc)/(deltax**2)
2878 sflx_snow = snow_flux*(1._rp - fbfrc)/(deltax**2)
2879 sflx_engi = prec_engi*(1._rp - fbfrc)/(deltax**2)
2887 dpth = dpth + deltap(kk)
2888 qinit = qinit + qv(kk)*ems(kk)
2889 qvfnl = qvfnl + qv_g(kk)*ems(kk)
2890 qhydr = qhydr + (qc_nw(kk) + qi_nw(kk) + qr_nw(kk) + qs_nw(kk))*ems(kk)
2892 qpfnl = (rain_flux+snow_flux)*timecp*(1._rp - fbfrc)
2893 qfinl = qvfnl + qhydr + qpfnl
2894 err = ( qfinl - qinit )*100._rp/qinit
2895 if ( abs(err) > 0.05_rp )
then
2898 log_error(
"CP_kf_compensational",*)
"@KF,MOISTURE i,j=",i,j
2899 log_error_cont(*)
"--------------------------------------"
2900 log_error_cont(
'("vert accum rho*qhyd : ",ES20.12)') qhydr
2901 log_error_cont(
'("vert accum rho*qv : ",ES20.12)') qvfnl-qinit
2902 log_error_cont(
'("precipitation rate : ",ES20.12)') qpfnl
2903 log_error_cont(
'("conserv qhyd + qv : ",ES20.12)') qhydr + qpfnl
2904 log_error_cont(
'("conserv total : ",ES20.12)') qfinl-qinit
2905 log_error_cont(*)
"--------------------------------------"
2920 theta_nw(kk) = theta_nw(kk) - emelt * ( qi_nw(kk) + qs_nw(kk) ) * rhod(kk) / ( cpdry + ( cpvap - cpdry ) * qv_g(kk) ) * iexn(kk)
2921 qc_nw(kk) = qc_nw(kk) + qi_nw(kk)
2922 qr_nw(kk) = qr_nw(kk) + qs_nw(kk)
2927 if ( hist_flag )
then
2929 hist_work(kk,i,j,i_hist_qc_fc,i_convflag) = hist_work(kk,i,j,i_hist_qc_fc,i_convflag) + hist_work(kk,i,j,i_hist_qi_fc,i_convflag)
2930 hist_work(kk,i,j,i_hist_qc_ud,i_convflag) = hist_work(kk,i,j,i_hist_qc_ud,i_convflag) + hist_work(kk,i,j,i_hist_qi_ud,i_convflag)
2931 hist_work(kk,i,j,i_hist_qr_fc,i_convflag) = hist_work(kk,i,j,i_hist_qr_fc,i_convflag) + hist_work(kk,i,j,i_hist_qs_fc,i_convflag)
2932 hist_work(kk,i,j,i_hist_qr_rf,i_convflag) = hist_work(kk,i,j,i_hist_qr_rf,i_convflag) + hist_work(kk,i,j,i_hist_qs_sf,i_convflag)
2965 end subroutine cp_kf_compensational
2972 subroutine cp_kf_calciexn( pres, qv, iexn )
2980 real(
rp),
intent(in) :: pres
2981 real(
rp),
intent(in) :: qv
2982 real(
rp),
intent(out) :: iexn
2984 iexn = (pre00/pres)**( ( rdry + rvap * qv ) / ( cpdry + cpvap * qv ) )
2987 end subroutine cp_kf_calciexn
2998 subroutine cp_kf_precipitation_oc1973( &
2999 G, DZ, BOTERM, ENTERM, &
3000 WTW, QLIQ, QICE, QNEWLQ, QNEWIC, QLQOUT, QICOUT )
3002 real(
rp),
intent(in) :: g
3003 real(
rp),
intent(in) :: dz
3004 real(
rp),
intent(in) :: boterm
3005 real(
rp),
intent(in) :: enterm
3006 real(
rp),
intent(inout) :: qlqout
3007 real(
rp),
intent(inout) :: qicout
3008 real(
rp),
intent(inout) :: wtw
3009 real(
rp),
intent(inout) :: qliq
3010 real(
rp),
intent(inout) :: qice
3011 real(
rp),
intent(inout) :: qnewlq
3012 real(
rp),
intent(inout) :: qnewic
3014 real(
rp) :: qtot,qnew,qest,g1,wavg,conv,ratio3,oldq,ratio4,dq,pptdrg
3022 qest=0.5_rp*(qtot+qnew)
3023 g1=wtw+boterm-enterm-2._rp*g*dz*qest/1.5_rp
3024 IF(g1.LT.0.0)g1=0._rp
3025 wavg=0.5_rp*(sqrt(wtw)+sqrt(g1))
3026 conv=rate*dz/max(wavg,kf_eps)
3032 ratio3=qnewlq/(qnew+1.e-8_rp)
3034 qtot=qtot+0.6_rp*qnew
3036 ratio4=(0.6_rp*qnewlq+qliq)/(qtot+1.e-8_rp)
3037 qtot=qtot*exp(-conv)
3043 qicout=(1._rp-ratio4)*dq
3047 pptdrg=0.5_rp*(oldq+qtot-0.2_rp*qnew)
3048 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
3049 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
3053 qliq=ratio4*qtot+ratio3*0.4_rp*qnew
3054 qice=(1._rp-ratio4)*qtot+(1._rp-ratio3)*0.4_rp*qnew
3058 end subroutine cp_kf_precipitation_oc1973
3064 subroutine cp_kf_precipitation_kessler( &
3065 G, DZ, BOTERM, ENTERM, &
3066 WTW, QLIQ, QICE, QNEWLQ, QNEWIC, QLQOUT, QICOUT )
3068 real(
rp),
intent(in) :: g
3069 real(
rp),
intent(in) :: dz
3070 real(
rp),
intent(in) :: boterm
3071 real(
rp),
intent(in) :: enterm
3072 real(
rp),
intent(inout) :: wtw
3073 real(
rp),
intent(inout) :: qliq
3074 real(
rp),
intent(inout) :: qice
3075 real(
rp),
intent(inout) :: qnewlq
3076 real(
rp),
intent(inout) :: qnewic
3077 real(
rp),
intent(inout) :: qlqout
3078 real(
rp),
intent(inout) :: qicout
3081 real(
rp) :: total_liq, total_ice
3083 real(
rp) :: auto_qc, auto_qi
3084 auto_qc = kf_threshold
3085 auto_qi = kf_threshold
3087 total_liq = qliq + qnewlq
3088 total_ice = qice + qnewic
3091 qlqout = max( total_liq - auto_qc, 0.0_rp )
3092 qicout = max( total_ice - auto_qi, 0.0_rp )
3094 pptdrg = max( 0.5_rp * ( total_liq + total_ice - qlqout - qicout ), 0.0_rp )
3095 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
3096 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
3098 qliq = max( total_liq - qlqout, 0.0_rp )
3099 qlqout = total_liq - qliq
3101 qice = max( total_ice - qicout, 0.0_rp )
3102 qicout = total_ice - qice
3108 end subroutine cp_kf_precipitation_kessler
3113 subroutine cp_kf_tpmix2( p,thes,qu,qliq,qice,tu,qnewlq,qnewic )
3118 real(
rp),
intent(in) :: p, thes
3119 real(
rp),
intent(inout) :: qu, qliq, qice
3120 real(
rp),
intent(out) :: tu, qnewlq, qnewic
3122 real(
rp) :: temp,qs,qnew,dq,qtot,rll,cpp
3125 call cp_kf_tpmix2dd( p, thes, temp, qs )
3149 qliq=qliq-dq*qliq/(qtot+1.e-10_rp)
3150 qice=qice-dq*qice/(qtot+1.e-10_rp)
3154 cpp = cpdry + ( cpvap - cpdry ) * qu
3155 IF(qtot.LT.1.e-10_rp)
THEN
3157 temp=temp+rll*(dq/(1._rp+dq))/cpp
3161 temp=temp+rll*((dq-qtot)/(1._rp+dq-qtot))/cpp
3172 end subroutine cp_kf_tpmix2
3178 subroutine cp_kf_dtfrznew( P, QFRZ, TU, THTEU, QU, QICE )
3193 atmos_saturation_psat_liq
3195 real(
rp),
intent(in) :: p, qfrz
3196 real(
rp),
intent(inout) :: tu, thteu, qu, qice
3198 real(
rp) :: rls,rlf,cpp,a,dtfrz,es,qs,dqevap,pii
3207 cpp = cpdry + ( cpvap - cpdry ) * qu
3211 a=(cliq-bliq*dliq)/((tu-dliq)*(tu-dliq))
3212 dtfrz = rlf*qfrz/(cpp+rls*qu*a)
3216 es = aliq*exp((bliq*tu-cliq)/(tu-dliq))
3217 qs = es * epsvap / ( p - es )
3224 dqevap = max( min(qs-qu, qice), 0.0_rp )
3227 pii=(pre00/p)**( ( rdry + rvap * qu ) / ( cpdry + cpvap * qu ) )
3229 thteu = tu*pii*exp((3374.6525_rp/tu - 2.5403_rp)*qu*(1._rp + 0.81_rp*qu))
3231 end subroutine cp_kf_dtfrznew
3245 subroutine cp_kf_prof5( EQ, EE, UD )
3247 real(
rp),
intent(in) :: eq
3248 real(
rp),
intent(inout) :: ee, ud
3250 real(
rp) :: sqrt2p, a1, a2, a3, p, sigma, fe
3251 real(
rp) :: x, y, ey, e45, t1, t2, c1, c2
3253 DATA sqrt2p,a1,a2,a3,p,sigma,fe/2.506628_rp,0.4361836_rp,-0.1201676_rp, &
3254 0.9372980_rp,0.33267_rp,0.166666667_rp,0.202765151_rp/
3255 x = (eq - 0.5_rp)/sigma
3256 y = 6._rp*eq - 3._rp
3257 ey = exp(y*y/(-2._rp))
3259 t2 = 1._rp/(1._rp + p*abs(y))
3261 c1 = a1*t1+a2*t1*t1+a3*t1*t1*t1
3262 c2 = a1*t2+a2*t2*t2+a3*t2*t2*t2
3264 ee=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*eq*eq/2._rp
3265 ud=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*(0.5_rp+eq*eq/2._rp- &
3268 ee=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*eq*eq/2._rp
3269 ud=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*(0.5_rp+eq* &
3274 end subroutine cp_kf_prof5
3284 subroutine cp_kf_tpmix2dd( p, thes, ts, qs )
3286 real(
rp),
intent(in) :: p, thes
3287 real(
rp),
intent(out) :: ts, qs
3289 real(
rp) :: tp,qq,bth,tth,pp,t00,t10,t01,t11,q00,q10,q01,q11
3290 integer :: iptb, ithtb
3293 tp = ( p - plutop ) * rdpr
3296 if ( iptb < 1 .or. iptb >= kfnp )
then
3297 log_warn(
"CP_kf_tpmix2dd",*)
'OUT OF BOUNDS (p): ', p, plutop, pbot
3298 iptb = min( max( iptb, 1 ), kfnp-1 )
3299 qq = 0.5_rp + sign(0.5_rp, iptb-2.0_rp)
3304 bth = ( the0k(iptb+1) - the0k(iptb) ) * qq + the0k(iptb)
3305 tth = ( thes - bth ) * rdthk
3306 pp = tth - aint(tth)
3308 if ( ithtb < 1 .or. ithtb >= kfnt )
then
3309 log_warn(
"CP_kf_tpmix2dd",*)
'OUT OF BOUNDS (thes): ', thes, p, bth, bth + (kfnt-1) / rdthk
3310 ithtb = min( max( ithtb, 1 ), kfnt-1 )
3311 pp = 0.5_rp + sign(0.5_rp, ithtb-2.0_rp)
3315 t00=ttab(ithtb ,iptb )
3316 t10=ttab(ithtb+1,iptb )
3317 t01=ttab(ithtb ,iptb+1)
3318 t11=ttab(ithtb+1,iptb+1)
3320 q00=qstab(ithtb ,iptb )
3321 q10=qstab(ithtb+1,iptb )
3322 q01=qstab(ithtb ,iptb+1)
3323 q11=qstab(ithtb+1,iptb+1)
3326 ts=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
3327 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
3330 end subroutine cp_kf_tpmix2dd
3342 subroutine cp_kf_envirtht( P1, T1, Q1, THT1 )
3351 real(
rp),
intent(in) :: p1, t1, q1
3352 real(
rp),
intent(out) :: tht1
3354 real(
rp) :: ee,tlog,tdpt,tsat,tht
3355 real(
rp),
parameter :: c1=3374.6525_rp
3356 real(
rp),
parameter :: c2=2.5403_rp
3357 ee = q1 * p1 / ( epsvap + q1 )
3372 tdpt=(cliq-dliq*tlog)/(bliq-tlog)
3374 tsat=tdpt - (0.212_rp+1.571e-3_rp*(tdpt-tem00)-4.36e-4_rp*(t1-tem00))*(t1-tdpt)
3377 tht=t1*(p00/p1)**( ( rdry + rvap * q1 ) / ( cpdry + cpvap * q1 ) )
3378 tht1=tht*exp((c1/tsat-c2)*q1*(1._rp+0.81_rp*q1))
3381 end subroutine cp_kf_envirtht
3389 subroutine cp_kf_lutab
3399 integer :: kp, it, itcnt, i
3400 real(
rp) :: dth = 1._rp
3401 real(
rp) :: tmin = 150._rp
3402 real(
rp) :: toler = 0.001_rp
3403 real(
rp) :: dpr, temp, p, es, qs, pi
3404 real(
rp) :: thes, tgues, thgues, thtgs
3405 real(
rp) :: dt, t1, t0, f0, f1, astrt, ainc, a1
3419 dpr=(pbot-plutop)/real(kfnp-1)
3431 es=aliq*exp((bliq*temp-cliq)/(temp-dliq))
3432 qs = epsvap * es / ( p - es )
3433 pi = (pre00/p)**( ( rdry + rvap * qs ) / ( cpdry + cpvap * qs ) )
3434 the0k(kp)=temp*pi*exp((3374.6525_rp/temp-2.5403_rp)*qs* &
3453 es=aliq*exp((bliq*tgues-cliq)/(tgues-dliq))
3454 qs = epsvap * es / ( p - es )
3455 pi = ( pre00 / p )**( ( rdry + rvap * qs ) / ( cpdry + cpvap * qs ) )
3456 thgues=tgues*pi*exp((3374.6525_rp/tgues-2.5403_rp)*qs* &
3457 (1._rp + 0.81_rp*qs))
3464 es=aliq*exp((bliq*t1-cliq)/(t1-dliq))
3465 qs = epsvap * es / ( p - es )
3466 pi = ( pre00 / p )**( ( rdry + rvap * qs ) / ( cpdry + cpvap * qs ) )
3467 thtgs=t1*pi*exp((3374.6525_rp/t1-2.5403_rp)*qs*(1._rp + 0.81_rp*qs))
3469 if(abs(f1).lt.toler)
then
3473 dt=f1*(t1-t0)/(f1-f0)
3494 gdcp = - grav / cpdry
3496 end subroutine cp_kf_lutab