24 #include "inc_openmp.h" 51 real(RP),
public,
save ::
kf_dt = 5._rp
57 private :: cp_kf_trigger, cp_kf_updraft, cp_kf_downdraft, cp_kf_compensational
59 private :: precipitation_oc1973
60 private :: precipitation_kessler
61 private :: tpmix2, dtfrznew, prof5, tpmix2dd, envirtht
64 subroutine precipitation( &
65 QLIQ,QICE,WTW,DZ,BOTERM,ENTERM,QNEWLQ, &
66 QNEWIC,QLQOUT,QICOUT,G)
68 real(RP),
INTENT(IN ) :: g
69 real(RP),
INTENT(IN ) :: dz,boterm,enterm
70 real(RP),
INTENT(INOUT) :: qlqout,qicout,wtw,qliq,qice,qnewlq,qnewic
71 end subroutine precipitation
79 integer,
private,
PARAMETER :: kfnt=250,kfnp=220
80 real(RP),
private,
SAVE :: ttab(kfnt,kfnp),qstab(kfnt,kfnp)
81 real(RP),
private,
SAVE :: the0k(kfnp)
82 real(RP),
private,
SAVE :: alu(200)
83 real(RP),
private,
SAVE :: rdpr,rdthk,plutop
85 real(RP),
private,
SAVE :: gdcp
90 real(RP),
private,
parameter :: aliq=6.112e2_rp
91 real(RP),
private,
parameter :: bliq=17.68_rp
92 real(RP),
private,
parameter :: cliq=bliq*tem00
93 real(RP),
private,
parameter :: dliq=29.65_rp
94 real(RP),
private,
parameter :: xlv1=2370._rp,xlv0=3.15e6_rp
97 real(RP),
private,
save :: rate = 0.03_rp
98 integer ,
private,
save :: trigger = 3
99 logical ,
private,
save :: flag_qs = .true.
100 logical ,
private,
save :: flag_qi = .true.
101 real(RP),
private,
save :: delcape = 0.1_rp
102 real(RP),
private,
save :: deeplifetime = 1800._rp
103 real(RP),
private,
save :: shallowlifetime = 2400._rp
104 real(RP),
private,
save :: depth_usl = 300._rp
105 logical ,
private,
save :: warmrain = .false.
106 logical ,
private,
save :: kf_log = .false.
107 real(RP),
private,
save :: kf_threshold = 1.e-3_rp
108 integer ,
private,
save :: stepkf
109 integer ,
private,
save :: kf_prec = 1
110 procedure(precipitation),
pointer,
private :: p_precipitation => null()
112 real(RP),
private,
allocatable :: lifetime (:,:)
113 integer ,
private,
allocatable :: i_convflag(:,:)
115 real(RP),
private,
allocatable :: deltaz (:,:,:)
116 real(RP),
private,
allocatable :: z (:,:,:)
121 integer,
private :: time_res_kf
122 integer,
private :: time_dstep_kf
123 logical,
private :: time_dokf
126 logical,
private :: param_atmos_phy_cp_kf_wadapt = .true.
127 integer,
private :: param_atmos_phy_cp_kf_w_time = 16
146 character(len=*),
intent(in) :: CP_TYPE
149 real(RP) :: PARAM_ATMOS_PHY_CP_kf_rate = 0.03_rp
150 integer :: PARAM_ATMOS_PHY_CP_kf_trigger = 1
151 logical :: PARAM_ATMOS_PHY_CP_kf_qs = .true.
152 logical :: PARAM_ATMOS_PHY_CP_kf_qi = .true.
153 real(DP) :: PARAM_ATMOS_PHY_CP_kf_dt = 5.0_dp
154 real(RP) :: PARAM_ATMOS_PHY_CP_kf_dlcape = 0.1_rp
155 real(RP) :: PARAM_ATMOS_PHY_CP_kf_dlifetime = 1800.0_rp
156 real(RP) :: PARAM_ATMOS_PHY_CP_kf_slifetime = 2400.0_rp
157 real(RP) :: PARAM_ATMOS_PHY_CP_kf_DEPTH_USL = 300.0_rp
158 integer :: PARAM_ATMOS_PHY_CP_kf_prec = 1
159 real(RP) :: PARAM_ATMOS_PHY_CP_kf_thres = 1.e-3_rp
160 logical :: PARAM_ATMOS_PHY_CP_kf_warmrain = .false.
161 logical :: PARAM_ATMOS_PHY_CP_kf_LOG = .false.
163 namelist / param_atmos_phy_cp_kf / &
164 param_atmos_phy_cp_kf_rate, &
165 param_atmos_phy_cp_kf_trigger, &
166 param_atmos_phy_cp_kf_qs, &
167 param_atmos_phy_cp_kf_qi, &
168 param_atmos_phy_cp_kf_dt, &
169 param_atmos_phy_cp_kf_dlcape, &
170 param_atmos_phy_cp_kf_dlifetime, &
171 param_atmos_phy_cp_kf_slifetime, &
172 param_atmos_phy_cp_kf_depth_usl, &
173 param_atmos_phy_cp_kf_prec, &
174 param_atmos_phy_cp_kf_thres, &
175 param_atmos_phy_cp_kf_warmrain, &
176 param_atmos_phy_cp_kf_log, &
177 param_atmos_phy_cp_kf_wadapt, &
178 param_atmos_phy_cp_kf_w_time
185 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[CUMULUS] / Categ[ATMOS PHYSICS] / Origin[SCALElib]' 188 if ( cp_type /=
'KF' )
then 189 write(*,*)
'xxx ATMOS_PHY_CP_TYPE is not KF. Check!' 194 write(*,*)
'xxx TIME_DTSEC_ATMOS_PHY_CP should be same as TIME_DTSEC for KF scheme. STOP.' 200 read(
io_fid_conf,nml=param_atmos_phy_cp_kf,iostat=ierr)
202 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 203 elseif( ierr > 0 )
then 204 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_CP_KF. Check!' 213 time_dstep_kf = max(time_dstep_kf,1)
218 param_atmos_phy_cp_kf_trigger, &
219 param_atmos_phy_cp_kf_qs, &
220 param_atmos_phy_cp_kf_qi, &
221 param_atmos_phy_cp_kf_dt, &
222 param_atmos_phy_cp_kf_dlcape, &
223 param_atmos_phy_cp_kf_dlifetime, &
224 param_atmos_phy_cp_kf_slifetime, &
225 param_atmos_phy_cp_kf_depth_usl, &
226 param_atmos_phy_cp_kf_prec, &
227 param_atmos_phy_cp_kf_thres, &
228 param_atmos_phy_cp_kf_warmrain, &
229 param_atmos_phy_cp_kf_log , &
234 if(
io_l )
write(
io_fid_log,*)
"*** Interval for check [step] : ", time_dstep_kf
235 if(
io_l )
write(
io_fid_log,*)
"*** Ogura-Cho condense material convert rate : ", param_atmos_phy_cp_kf_rate
236 if(
io_l )
write(
io_fid_log,*)
"*** Trigger function type, 1:KF2004 3:NO2007 : ", param_atmos_phy_cp_kf_trigger
237 if(
io_l )
write(
io_fid_log,*)
"*** Exist qi? : ", param_atmos_phy_cp_kf_qi
238 if(
io_l )
write(
io_fid_log,*)
"*** Exist qs? : ", param_atmos_phy_cp_kf_qs
239 if(
io_l )
write(
io_fid_log,*)
"*** CAPE decrease rate : ", param_atmos_phy_cp_kf_dlcape
240 if(
io_l )
write(
io_fid_log,*)
"*** Minimum lifetime scale of deep convection [sec] : ", param_atmos_phy_cp_kf_dlifetime
241 if(
io_l )
write(
io_fid_log,*)
"*** Lifetime of shallow convection [sec] : ", param_atmos_phy_cp_kf_slifetime
242 if(
io_l )
write(
io_fid_log,*)
"*** Updraft souce layer depth [hPa] : ", param_atmos_phy_cp_kf_depth_usl
243 if(
io_l )
write(
io_fid_log,*)
"*** Precipitation type 1:Ogura-Cho(1973) 2:Kessler : ", param_atmos_phy_cp_kf_prec
244 if(
io_l )
write(
io_fid_log,*)
"*** Kessler type precipitation's threshold : ", param_atmos_phy_cp_kf_thres
245 if(
io_l )
write(
io_fid_log,*)
"*** Warm rain? : ", param_atmos_phy_cp_kf_warmrain
246 if(
io_l )
write(
io_fid_log,*)
"*** Use running mean of w in adaptive timestep? : ", param_atmos_phy_cp_kf_wadapt
247 if(
io_l )
write(
io_fid_log,*)
"*** Fixed time scale for running mean of w : ", param_atmos_phy_cp_kf_w_time
248 if(
io_l )
write(
io_fid_log,*)
"*** Output log? : ", param_atmos_phy_cp_kf_log
251 allocate( lifetime(
ia,
ja) )
252 allocate( i_convflag(
ia,
ja) )
253 lifetime(:,:) = 0.0_rp
259 allocate( deltaz(
ka,
ia,
ja) )
261 deltaz(:,:,:) = 0.0_rp
265 deltaz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
269 deltaz(
ke,:,:) = 0.0_rp
271 deltax = sqrt(
dx*
dy )
305 real(RP),
intent(in) :: DENS (
ka,
ia,
ja)
306 real(RP),
intent(in) :: MOMX (
ka,
ia,
ja)
307 real(RP),
intent(in) :: MOMY (
ka,
ia,
ja)
308 real(RP),
intent(in) :: MOMZ (
ka,
ia,
ja)
309 real(RP),
intent(in) :: RHOT (
ka,
ia,
ja)
310 real(RP),
intent(in) :: QTRC (
ka,
ia,
ja,qa)
311 real(RP),
intent(inout) :: DENS_t_CP (
ka,
ia,
ja)
312 real(RP),
intent(inout) :: MOMZ_t_CP (
ka,
ia,
ja)
313 real(RP),
intent(inout) :: MOMX_t_CP (
ka,
ia,
ja)
314 real(RP),
intent(inout) :: MOMY_t_CP (
ka,
ia,
ja)
315 real(RP),
intent(inout) :: RHOT_t_CP (
ka,
ia,
ja)
316 real(RP),
intent(inout) :: RHOQ_t_CP (
ka,
ia,
ja,qa)
317 real(RP),
intent(inout) :: MFLX_cloudbase(
ia,
ja)
318 real(RP),
intent(inout) :: SFLX_convrain (
ia,
ja)
319 real(RP),
intent(inout) :: cloudtop (
ia,
ja)
320 real(RP),
intent(inout) :: cloudbase (
ia,
ja)
321 real(RP),
intent(inout) :: cldfrac_dp (
ka,
ia,
ja)
322 real(RP),
intent(inout) :: cldfrac_sh (
ka,
ia,
ja)
323 real(RP),
intent(inout) :: nca (
ia,
ja)
324 real(RP),
intent(inout) :: w0avg (
ka,
ia,
ja)
326 real(RP) :: cldfrac(
ka,2)
330 if(
io_l )
write(
io_fid_log,*)
'*** Physics step: Cumulus Parameterization(KF)' 337 time_res_kf = time_res_kf + 1
338 if ( time_res_kf == time_dstep_kf )
then 343 if ( time_dokf )
then 359 rhoq_t_cp(:,:,:,:), &
360 sflx_convrain(:,:), &
371 call hist_in( lifetime(:,:),
'KF_LIFETIME',
'lifetime of KF scheme',
's' )
372 call hist_in(
real(I_convflag(:,:),RP),
'KF_CONVFLAG',
'CONVECTION FLAG',
'' )
393 real(RP),
intent(inout) :: W0_avg(
ka,
ia,
ja)
394 real(RP),
intent(in) :: DENS (
ka,
ia,
ja)
395 real(RP),
intent(in) :: MOMZ (
ka,
ia,
ja)
398 real(RP) :: fact_W0_avg, fact_W0
403 if ( param_atmos_phy_cp_kf_wadapt )
then 407 fact_w0_avg =
real(param_atmos_phy_cp_kf_w_time,
rp)
414 w0 = 0.5_rp * ( momz(k,i,j) + momz(k-1,i,j) ) / dens(k,i,j)
416 w0_avg(k,i,j) = ( w0_avg(k,i,j) * fact_w0_avg &
417 + w0 * fact_w0 ) / ( fact_w0_avg + fact_w0 )
426 subroutine cp_kf_param( & ! set kf tuning parametres
429 TRIGGER_in, & ! INOUT
435 SHALLOWLIFETIME_in, &
445 real(RP),
intent(in) :: RATE_in
446 integer,
intent(inout) :: TRIGGER_in
447 logical,
intent(in) :: FLAG_QS_in,FLAG_QI_in
448 real(RP),
intent(in) :: KF_DT_in
449 real(RP),
intent(in) :: DELCAPE_in
450 real(RP),
intent(in) :: DEEPLIFETIME_in
451 real(RP),
intent(in) :: SHALLOWLIFETIME_in
452 real(RP),
intent(in) :: DEPTH_USL_in
453 integer,
intent(in) :: KF_prec_in
454 real(RP),
intent(in) :: KF_threshold_in
455 logical,
intent(in) :: WARMRAIN_in
456 logical,
intent(in) :: KF_LOG_in
457 integer,
intent(in) :: stepkf_in
461 if (trigger_in /= 1 .and. trigger_in /=3)
then 462 if (
io_l)
write(
io_fid_log,*)
"TRIGGER must be 1 or 3 but now :",trigger_in
471 deeplifetime = deeplifetime_in
472 shallowlifetime = shallowlifetime_in
473 depth_usl = depth_usl_in
474 warmrain = warmrain_in
476 kf_threshold = kf_threshold_in
479 if (kf_prec == 1)
then 480 p_precipitation => precipitation_oc1973
481 elseif( kf_prec == 2)
then 482 p_precipitation => precipitation_kessler
484 write(*,*)
'xxx ERROR at KF namelist' 485 write(*,*)
'KF_prec must be 1 or 2' 524 thermodyn_temp_pres => atmos_thermodyn_temp_pres, &
525 thermodyn_rhoe => atmos_thermodyn_rhoe, &
526 thermodyn_temp_pres_e => atmos_thermodyn_temp_pres_e, &
527 thermodyn_qd => atmos_thermodyn_qd, &
528 thermodyn_pott => atmos_thermodyn_pott
530 saturation_psat_liq => atmos_saturation_psat_liq
533 real(RP),
intent(in) :: DENS(
ka,
ia,
ja)
534 real(RP),
intent(in) :: MOMZ(
ka,
ia,
ja)
535 real(RP),
intent(in) :: MOMX(
ka,
ia,
ja)
536 real(RP),
intent(in) :: MOMY(
ka,
ia,
ja)
537 real(RP),
intent(in) :: RHOT(
ka,
ia,
ja)
538 real(RP),
intent(in) :: QTRC(
ka,
ia,
ja,
qa)
539 real(RP),
intent(in) :: w0avg(
ka,
ia,
ja)
541 real(RP),
intent(inout) :: nca(
ia,
ja)
542 real(RP),
intent(out) :: DENS_t_CP(
ka,
ia,
ja)
543 real(RP),
intent(out) :: DT_RHOT(
ka,
ia,
ja)
544 real(RP),
intent(out) :: DT_RHOQ(
ka,
ia,
ja,
qa)
545 real(RP),
intent(out) :: rainrate_cp(
ia,
ja)
546 real(RP),
intent(out) :: cldfrac_sh(
ka,
ia,
ja)
547 real(RP),
intent(out) :: cldfrac_dp(
ka,
ia,
ja)
548 real(RP),
intent(out) :: timecp(
ia,
ja)
549 real(RP),
intent(out) :: cloudtop(
ia,
ja)
550 real(RP),
intent(out) :: zlcl(
ia,
ja)
551 integer,
intent(out) :: I_convflag(
ia,
ja)
559 real(RP) :: temp (
ka)
560 real(RP) :: pres (
ka)
562 real(RP) :: QDRY (
ka)
564 real(RP) :: PSAT (
ka)
565 real(RP) :: QSAT (
ka)
567 real(RP) :: deltap(
ka)
570 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) :: totalprcp
589 real(RP) :: flux_qr(
ka)
590 real(RP) :: flux_qs(
ka)
592 real(RP) :: theta_eu(
ka)
593 real(RP) :: theta_ee(
ka)
599 integer :: k_lc,k_let,k_pbl
602 real(RP) :: umfnewdold(
ka)
610 real(RP) :: downent(
ka)
611 real(RP) :: downdet(
ka)
612 real(RP) :: theta_d(
ka)
614 real(RP) :: prcp_flux
619 real(RP) :: temp_g(
ka)
621 real(RP) :: qc_nw(
ka)
622 real(RP) :: qi_nw(
ka)
623 real(RP) :: qr_nw(
ka)
624 real(RP) :: qs_nw(
ka)
626 real(RP) :: rhot_nw(
ka)
627 real(RP) :: qtrc_nw(
ka,
qa)
628 real(RP) :: pott_nw(
ka)
630 real(RP) :: cldfrac_KF(
ka,2)
634 integer :: k, i, j, iq
640 nca(i,j) = nca(i,j) -
real(TIME_DSTEP_KF,RP) * dt
643 if ( nca(i,j) .ge. 0.5_dp * dt ) cycle
650 u(k) = 0.5_rp * ( momx(k,i,j) + momx(k,i-1,j) ) / dens(k,i,j)
651 v(k) = 0.5_rp * ( momy(k,i,j) + momy(k,i,j-1) ) / dens(k,i,j)
655 call thermodyn_temp_pres( temp(k), &
662 call thermodyn_qd( qdry(k), qtrc(k,i,j,:) )
664 call saturation_psat_liq( psat(k), temp(k) )
666 qsat(k) = 0.622_rp * psat(k) / ( pres(k) - ( 1.0_rp-0.622_rp ) * psat(k) )
667 qv(k) = qtrc(k,i,j,
i_qv) / qdry(k)
668 qv(k) = max( 0.000001_rp, min( qsat(k), qv(k) ) )
669 rh(k) = qv(k) / qsat(k)
675 deltap(k) = dens(k,i,j) * grav * ( fz(k+1,i,j) - fz(k,i,j) )
679 dens_t_cp(
ks:
ke,i,j) = 0.0_rp
680 dt_rhot(
ks:
ke,i,j) = 0.0_rp
682 dt_rhoq(
ks:
ke,i,j,iq) = 0.0_rp
684 cldfrac_kf(
ks:
ke,:) = 0.0_rp
685 rainrate_cp(i,j) = 0.0_rp
687 cloudtop(i,j) = 0.0_rp
692 q_hyd(k,iq) = qtrc(k,i,j,
i_mp2all(iq)) / qdry(k)
697 call cp_kf_trigger ( &
699 deltaz(:,i,j), z(:,i,j), &
746 if(i_convflag(i,j) /= 2)
then 747 ems(k_top+1:
ke) = 0._rp
748 emsd(k_top+1:
ke) = 0._rp
750 ems(k) = deltap(k)*deltax*deltax/grav
751 emsd(k) = 1._rp/ems(k)
752 umfnewdold(k) = 1._rp/umfnewdold(k)
756 call cp_kf_downdraft ( &
758 deltaz(:,i,j), z(:,i,j) ,&
793 call cp_kf_compensational ( &
795 deltaz(:,i,j),z(:,i,j) ,&
857 if(i_convflag(i,j) == 2)
then 858 rainrate_cp(i,j) = 0.0_rp
859 cldfrac_kf(
ks:
ke,:) = 0.0_rp
861 cloudtop(i,j) = 0.0_rp
871 if (i_convflag(i,j) == 0)
then 872 if (time_advec < timecp(i,j)) nic=nint(time_advec/dt)
873 nca(i,j) =
real(nic,
rp)*dt
874 elseif (i_convflag(i,j) == 1)
then 875 timecp(i,j) = shallowlifetime
876 nca(i,j) =
kf_dt*60._rp
884 qd(
ks:
ke) = 1._rp / ( 1._rp + qv_g(
ks:
ke) + sum(q_hyd(
ks:
ke,:),2))
900 qd(
ks:
ke) = 1._rp / ( 1._rp + qv_g(
ks:
ke) + sum(q_hyd(
ks:
ke,:),2))
913 call thermodyn_pott(&
915 temp_g(:),pres(:),qtrc_nw(:,:))
919 dens_t_cp(
ks:
ke,i,j) = (dens_nw(
ks:
ke) - dens(
ks:
ke,i,j))/timecp(i,j)
920 dt_rhot(
ks:
ke,i,j) = (rhot_nw(
ks:
ke) - rhot(
ks:
ke,i,j))/timecp(i,j)
922 dt_rhoq(
ks:
ke,i,j,iq) = (dens_nw(
ks:
ke)*qtrc_nw(
ks:
ke,iq) - dens(
ks:
ke,i,j)*qtrc(
ks:
ke,i,j,iq))/timecp(i,j)
927 cldfrac_sh(
ks:
ke,i,j) = cldfrac_kf(
ks:
ke,1)
928 cldfrac_dp(
ks:
ke,i,j) = cldfrac_kf(
ks:
ke,2)
938 subroutine cp_kf_trigger ( & !> 1d model ! triger function
940 dz_kf,z_kf ,& ! deltaz and height [m]
941 qv ,& ! water vapor mixing ratio [kg/kg]
942 qes ,& ! saturated vapor [kg/kg]
943 pres ,& ! pressure [Pa]
944 deltap ,& ! interval of pressure [Pa]
945 temp ,& ! temperature [K]
946 w0avg ,& ! running mean w
948 I_convflag ,& ! convection flag
949 cloudtop ,& ! cloud top height [m]
950 temp_u ,& ! updraft temperature
951 tempv ,& ! virtual temperature
953 qv_u ,& ! updraft water vapor mixing ratio
954 qc ,& ! cloud water mixing ratio
955 qi ,& ! ice mixingratio
956 qvdet ,& ! updraft detrain vapor
957 qcdet ,& ! updraft detrain water
958 qidet ,& ! updraft detrain ice
959 flux_qr ,& ! rain flux
960 flux_qs ,& ! snow flux
961 totalprcp ,& ! total precipitation (rain and snow fall)
995 real(RP),
intent(in) :: dz_kf(
ka),z_kf(
ka)
996 real(RP),
intent(in) :: qv(
ka)
997 real(RP),
intent(in) :: qes(
ka)
998 real(RP),
intent(in) :: pres(
ka)
999 real(RP),
intent(in) :: deltap(
ka)
1000 real(RP),
intent(in) :: temp(
ka)
1001 real(RP),
intent(in) :: w0avg(
ka)
1004 real(RP),
intent(out) :: umf(
ka)
1005 real(RP),
intent(out) :: umflcl
1006 real(RP),
intent(out) :: upent(
ka)
1007 real(RP),
intent(out) :: updet(
ka)
1009 real(RP),
intent(out) :: temp_u(
ka)
1010 real(RP),
intent(out) :: tempv(
ka)
1012 real(RP),
intent(out) :: qv_u(
ka)
1013 real(RP),
intent(out) :: totalprcp
1014 real(RP),
intent(out) :: cape
1015 real(RP),
intent(out) :: cloudtop
1016 real(RP) :: cloudhight
1018 real(RP),
intent(out) :: qc(
ka)
1019 real(RP),
intent(out) :: qi(
ka)
1020 real(RP) :: qrout(
ka)
1021 real(RP) :: qsout(
ka)
1022 real(RP),
intent(out) :: qvdet(
ka)
1023 real(RP),
intent(out) :: qcdet(
ka)
1024 real(RP),
intent(out) :: qidet(
ka)
1025 real(RP),
intent(out) :: flux_qr(
ka)
1026 real(RP),
intent(out) :: flux_qs(
ka)
1028 real(RP),
intent(out) :: theta_eu(
ka)
1029 real(RP),
intent(out) :: theta_ee(
ka)
1031 integer,
intent(out) :: I_convflag
1036 integer,
intent(out) :: k_lcl
1037 integer,
intent(out) :: k_top
1038 integer,
intent(out) :: k_ml
1039 real(RP),
intent(out) :: zlcl
1040 integer,
intent(out) :: k_lc,k_let,k_pbl
1041 real(RP),
intent(out) :: zmix
1042 real(RP),
intent(out) :: presmix
1043 real(RP),
intent(out) :: umfnewdold(
ka)
1045 real(RP),
intent(out) :: dpthmx
1048 integer,
parameter :: itr_max = 10000
1056 integer :: n_uslcheck
1060 real(RP) :: theta_mix
1061 real(RP) :: temp_mix
1065 real(RP) :: temp_dew
1068 real(RP) :: temp_env
1069 real(RP) :: tempv_env
1074 real(RP) :: temp_lcl
1075 real(RP) :: tempv_lcl
1076 real(RP) :: pres_lcl
1084 real(RP) :: umfnew,umfold
1087 integer :: k_check(
ka)
1094 real(RP) :: CLDHGT(
ka)
1106 pres300 = pres(
ks) - depth_usl*100._rp
1107 tempv(:) = temp(:)*(1._rp + 0.608_rp*qv(:))
1110 if (pres(kk) >= pres300) k_llfc = kk
1115 pres15 = pres(
ks) - 15.e2_rp
1118 do kk =
ks+1, k_llfc
1119 if(pres(kk) < pres15 )
then 1120 n_check = n_check + 1
1121 k_check(n_check) = kk
1122 pres15 = pres15 - 15.e2_rp
1135 n_uslcheck = n_uslcheck + 1
1139 if (n_uslcheck > n_check)
then 1140 if (i_convflag == 1)
then 1145 if (cldhgt(nnn) > chmax)
then 1151 n_uslcheck = nuchm - 1
1159 k_lc = k_check(n_uslcheck)
1166 if ( nk + 1 <
ks )
then 1168 if(
io_l)
write(
io_fid_log,*)
'would go off bottom: cu_kf',pres(
ks),k_lc,nk+1,n_uslcheck
1179 dpthmx = dpthmx + deltap(nk)
1180 n_layers = n_layers + 1
1181 if (dpthmx > dpthmin)
then 1186 if (dpthmx < dpthmin)
then 1190 k_pbl = k_lc + n_layers -1
1192 theta_mix = 0._rp; temp_mix = 0._rp; qv_mix = 0._rp; zmix = 0._rp;presmix = 0._rp
1195 temp_mix = temp_mix + deltap(kk)*temp(kk)
1196 qv_mix = qv_mix + deltap(kk)*qv(kk)
1197 zmix = zmix + deltap(kk)*z_kf(kk)
1198 presmix = presmix + deltap(kk)*pres(kk)
1201 temp_mix = temp_mix/dpthmx
1202 qv_mix = qv_mix/dpthmx
1203 presmix = presmix/dpthmx
1205 emix = qv_mix*presmix/(0.622_rp + qv_mix)
1209 templog =
log(emix/aliq)
1210 temp_dew = (cliq - dliq*templog)/(bliq - templog)
1213 temp_lcl = temp_dew - (0.212_rp + 1.571e-3_rp*(temp_dew - tem00) &
1214 - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - temp_dew)
1215 temp_lcl = min(temp_lcl,temp_mix)
1216 tempv_lcl = temp_lcl*(1._rp + 0.608_rp*qv_mix)
1217 zlcl = zmix + (temp_lcl - temp_mix)/gdcp
1222 if( zlcl <= z_kf(kk) )
exit 1225 if (zlcl > z_kf(
ke))
then 1230 deltaz = ( zlcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
1231 temp_env = temp(k_lclm1) + ( temp(k_lcl) - temp(k_lclm1) )*deltaz
1232 qvenv = qv(k_lclm1) + ( qv(k_lcl) - qv(k_lclm1) )*deltaz
1233 tempv_env = temp_env*( 1._rp + 0.608_rp*qvenv )
1238 if (zlcl < 2.e3_rp)
then 1240 w_cz = 1.e-5_rp*zlcl
1247 w_g = (w0avg(k_lclm1) + (w0avg(k_lcl) - w0avg(k_lclm1))*deltaz )*deltax/25.e3_rp - w_cz
1248 if ( w_g < 1.e-4_rp)
then 1251 dtvv = 4.64_rp*w_g**0.33_rp
1256 if ( trigger == 2)
then 1257 else if ( trigger == 3)
then 1265 if(u00 < 1._rp)
then 1266 qs_lcl=qes(k_lclm1)+(qes(k_lcl)-qes(k_lclm1))*deltaz
1267 rh_lcl = qvenv/qs_lcl
1268 dqssdt = qv_mix*(cliq-bliq*dliq)/((temp_lcl-dliq)*(temp_lcl-dliq))
1269 if(rh_lcl >= 0.75_rp .and. rh_lcl <=0.95_rp)
then 1270 dtrh = 0.25*(rh_lcl-0.75)*qv_mix/dqssdt
1271 elseif(rh_lcl > 0.95_rp)
then 1272 dtrh = (1._rp/rh_lcl-1._rp)*qv_mix/dqssdt
1279 if (temp_lcl + dtvv + dtrh < temp_env)
then 1287 call envirtht(presmix,temp_mix,qv_mix,theta_eu(k_lclm1))
1289 if (dtvv + dtrh > 1.e-4_rp )
then 1290 w_lcl = 1._rp + 0.5_rp*sqrt(2._rp*grav*(dtvv + dtrh)*500._rp/tempv_env)
1291 w_lcl = min(w_lcl,3._rp)
1297 pres_lcl = pres(k_lclm1) + (pres(k_lcl) - pres(k_lclm1))*deltaz
1302 elseif (w_g > 0.1_rp)
then 1305 radius = 1000._rp + 1000._rp*w_g*10._rp
1310 call cp_kf_updraft ( &
1361 cldhgt(k_lc) = cloudhight
1364 if(temp_lcl > 293._rp)
then 1366 elseif (temp_lcl < 293._rp .and. temp_lcl > 273._rp)
then 1367 d_min = 2.e3_rp + 100._rp*(temp_lcl - tem00)
1373 if ( k_top <= k_lcl .or. &
1374 k_top <= k_pbl .or. &
1375 k_let+1 <= k_pbl )
then 1377 cldhgt(k_lc) = cloudhight
1378 do kk = k_lclm1,k_top
1387 elseif (cloudhight > d_min .and. cape > 1._rp)
then 1396 if(n_uslcheck == nuchm)
then 1399 do kk = k_lclm1,k_top
1412 if ( itr .ge. itr_max )
then 1413 write(*,*)
'xxx iteration max count was reached in the USL loop in the KF scheme' 1418 if (i_convflag == 1)
then 1419 k_start = max(k_pbl,k_lcl)
1426 if (k_let == k_top)
then 1427 updet(k_top) = umf(k_top) + updet(k_top) - upent(k_top)
1428 qcdet(k_top) = qc(k_top)*updet(k_top)*umfnew/umfold
1429 qidet(k_top) = qi(k_top)*updet(k_top)*umfnew/umfold
1430 upent(k_top) = 0._rp
1435 do kk = k_let+1,k_top
1436 dptt = dptt + deltap(kk)
1438 dumfdp = umf(k_let)/dptt
1448 do kk = k_let+1,k_top
1449 if(kk == k_top)
then 1450 updet(kk) = umf(kk-1)
1452 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1453 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1455 umf(kk) = umf(kk-1) - deltap(kk)*dumfdp
1456 upent(kk) = umf(kk)*(1._rp - 1._rp/umfnewdold(kk))
1457 updet(kk) = umf(kk-1) - umf(kk) + upent(kk)
1458 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1459 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1461 if (kk >= k_let+2)
then 1462 totalprcp = totalprcp - flux_qr(kk) - flux_qs(kk)
1463 flux_qr(kk) = umf(kk-1)*qrout(kk)
1464 flux_qs(kk) = umf(kk-1)*qsout(kk)
1465 totalprcp = totalprcp + flux_qr(kk) + flux_qs(kk)
1476 if(temp(kk) > tem00) k_ml = kk
1483 if (kk == k_lc)
then 1484 upent(kk) = umflcl*deltap(kk)/dpthmx
1485 umf(kk) = umflcl*deltap(kk)/dpthmx
1486 elseif (kk <= k_pbl)
then 1487 upent(kk) = umflcl*deltap(kk)/dpthmx
1488 umf(kk) = umf(kk-1) + upent(kk)
1494 temp_u(kk) = temp_mix + (z_kf(kk) - zmix)*gdcp
1515 call envirtht(pres(kk),temp(kk),qv(kk),theta_ee(kk))
1540 end subroutine cp_kf_trigger
1544 subroutine cp_kf_updraft (& ! 1d model updraft
1546 umf ,& ! upward mass flux(updraft)
1597 real(RP),
intent(out) :: umf(
ka)
1598 real(RP),
intent(out) :: umflcl
1599 real(RP),
intent(out) :: upent(
ka)
1600 real(RP),
intent(out) :: updet(
ka)
1601 real(RP),
intent(out) :: umfnewdold(
ka)
1602 real(RP),
intent(out) :: umfnew,umfold
1603 real(RP),
intent(out) :: temp_u(
ka)
1604 real(RP),
intent(out) :: theta_ee(
ka)
1605 real(RP),
intent(inout) :: theta_eu(
ka)
1606 real(RP),
intent(out) :: cloudhight
1607 real(RP),
intent(out) :: totalprcp
1608 real(RP),
intent(out) :: cloudtop
1609 real(RP),
intent(out) :: qv_u(
ka)
1610 real(RP),
intent(out) :: qc(
ka)
1611 real(RP),
intent(out) :: qi(
ka)
1612 real(RP),
intent(out) :: qrout(
ka)
1613 real(RP),
intent(out) :: qsout(
ka)
1614 real(RP),
intent(out) :: qvdet(
ka)
1615 real(RP),
intent(out) :: qcdet(
ka)
1616 real(RP),
intent(out) :: qidet(
ka)
1617 real(RP),
intent(out) :: cape
1618 real(RP),
intent(out) :: flux_qr(
ka)
1619 real(RP),
intent(out) :: flux_qs(
ka)
1620 integer,
intent(out) :: k_top
1621 integer,
intent(inout) :: k_let
1623 real(RP),
intent(in) :: dz_kf(
ka),z_kf(
ka)
1625 real(RP),
intent(in) :: w_lcl
1626 real(RP),
intent(in) :: temp_lcl
1627 real(RP),
intent(in) :: tempv_lcl
1628 real(RP),
intent(in) :: pres_lcl
1629 real(RP),
intent(in) :: qv_mix
1630 real(RP),
intent(in) :: qv(
ka)
1631 real(RP),
intent(in) :: temp(
ka)
1632 real(RP),
intent(in) :: tempv_env
1633 real(RP),
intent(in) :: zlcl
1634 real(RP),
intent(in) :: pres(
ka)
1635 real(RP),
intent(in) :: deltap(
ka)
1636 real(RP),
intent(in) :: radius
1637 real(RP),
intent(in) :: dpthmx
1638 integer ,
intent(in) :: k_lcl
1639 integer ,
intent(in) :: k_pbl
1643 real(RP) :: tempv_u(
ka)
1644 real(RP) :: tempvq_u(
ka)
1646 real(RP) :: ee1,ud1, ee2,ud2
1647 real(RP) :: f_eq(
ka)
1648 real(RP) :: f_mix1,f_mix2
1649 real(RP) :: REI,DILBE
1650 real(RP) :: qcnew,qinew
1652 real(RP) :: f_frozen1
1654 real(RP) :: temptmp_ice
1655 real(RP) :: tempv(
ka)
1661 real(RP) :: theta_tmp
1663 real(RP) :: qvtmp, qctmp, qitmp
1664 real(RP) :: temp_u95, temp_u10
1665 real(RP),
parameter :: temp_frzT = 268.16_rp
1666 real(RP),
parameter :: temp_frzB = 248.16_rp
1670 tempv = temp*(1._rp + 0.608_rp*qv)
1672 umfnewdold(:) = 1._rp
1675 denslcl = pres_lcl/(r*tempv_lcl)
1676 umf(k_lclm1) = denslcl*1.e-2_rp*deltax*deltax
1677 umflcl = umf(k_lclm1)
1681 temp_u(k_lclm1) = temp_lcl
1682 tempv_u(k_lclm1) = tempv_lcl
1683 qv_u(k_lclm1) = qv_mix
1686 f_eq(k_lclm1) = 0._rp
1690 qrout(k_lclm1) = 0._rp
1691 qsout(k_lclm1) = 0._rp
1692 qcdet(k_lclm1) = 0._rp
1693 qidet(k_lclm1) = 0._rp
1708 temptmp_ice = temp_frzt
1712 do kk = k_lclm1,
ke-1
1716 temp_u(kkp1) = temp(kkp1)
1717 theta_eu(kkp1) = theta_eu(kk)
1718 qv_u(kkp1) = qv_u(kk)
1725 call tpmix2(pres(kkp1),theta_eu(kkp1),temp_u(kkp1),qv_u(kkp1),qc(kkp1),qi(kkp1),qcnew,qinew)
1731 if (temp_u(kkp1) <= temp_frzt )
then 1732 if (temp_u(kkp1) > temp_frzb)
then 1733 if (temptmp_ice > temp_frzt) temptmp_ice = temp_frzt
1735 f_frozen1 = (temptmp_ice - temp_u(kkp1))/(temptmp_ice - temp_frzb)
1739 temptmp_ice = temp_u(kkp1)
1741 qfrz = (qc(kkp1) + qcnew)*f_frozen1
1742 qinew = qinew + qcnew*f_frozen1
1743 qcnew = qcnew - qcnew*f_frozen1
1744 qi(kkp1) = qi(kkp1) + qc(kkp1)*f_frozen1
1745 qc(kkp1) = qc(kkp1) - qc(kkp1)*f_frozen1
1748 call dtfrznew(temp_u(kkp1), pres(kkp1),theta_eu(kkp1),qv_u(kkp1),qfrz,qi(kkp1) )
1750 tempv_u(kkp1) = temp_u(kkp1)*(1._rp + 0.608_rp*qv_u(kkp1))
1752 if (kk == k_lclm1)
then 1753 boeff = (tempv_lcl + tempv_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp
1754 boterm = 2._rp*(z_kf(kkp1) - zlcl)*grav*boeff/1.5_rp
1755 dztmp = z_kf(kkp1) - zlcl
1757 boeff = (tempv_u(kk) + tempv_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp
1758 boterm = 2._rp*(dz_kf(kk) )*grav*boeff/1.5_rp
1762 entterm = 2._rp*rei*wtw/umfold
1764 call p_precipitation(&
1765 qc(kkp1), qi(kkp1), wtw, dztmp, boterm, entterm, qcnew, qinew, qrout(kkp1), &
1771 if (wtw < 1.e-3_rp )
then 1774 wu(kkp1) = sqrt(wtw)
1777 call envirtht(pres(kkp1),temp(kkp1),qv(kkp1),theta_ee(kkp1))
1779 rei = umflcl*deltap(kkp1)*0.03_rp/radius
1783 tempvq_u(kkp1) = temp_u(kkp1)*(1._rp + 0.608_rp*qv_u(kkp1) - qc(kkp1) - qi(kkp1))
1784 if (kk == k_lclm1) then
1785 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp)*dztmp
1787 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp)*dztmp
1789 if(dilbe > 0._rp) cape = cape + dilbe*grav
1796 if(tempvq_u(kkp1) <= tempv(kkp1))
then 1803 temptmp = tempvq_u(kkp1)
1807 f_mix2 = 1._rp - f_mix1
1808 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1809 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1810 qctmp = f_mix2*qc(kkp1)
1811 qitmp = f_mix2*qi(kkp1)
1813 call tpmix2(pres(kkp1),theta_tmp,temptmp,qvtmp,qctmp,qitmp,qcnew,qinew)
1815 temp_u95 = temptmp*(1._rp + 0.608_rp*qvtmp - qctmp - qitmp)
1817 if ( temp_u95 > tempv(kkp1))
then 1823 f_mix2 = 1._rp - f_mix1
1824 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1825 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1826 qctmp = f_mix2*qc(kkp1)
1827 qitmp = f_mix2*qi(kkp1)
1829 call tpmix2(pres(kkp1),theta_tmp,temptmp,qvtmp,qctmp,qitmp,qcnew,qinew)
1831 temp_u10 = temptmp*(1._rp + 0.608_rp*qvtmp - qctmp - qitmp)
1832 if (abs(temp_u10 - tempvq_u(kkp1)) < 1.e-3_rp )
then 1837 f_eq(kkp1) = (tempv(kkp1) - tempvq_u(kkp1))*f_mix1 &
1838 & /(temp_u10 - tempvq_u(kkp1))
1839 f_eq(kkp1) = max(0._rp,f_eq(kkp1) )
1840 f_eq(kkp1) = min(1._rp,f_eq(kkp1) )
1841 if (f_eq(kkp1) == 1._rp)
then 1844 elseif (f_eq(kkp1) == 0._rp)
then 1850 call prof5(f_eq(kkp1),ee2,ud2)
1855 ee2 = max(ee2,0.5_rp)
1858 upent(kkp1) = 0.5*rei*(ee1 + ee2)
1859 updet(kkp1) = 0.5*rei*(ud1 + ud2)
1862 if (umf(kk) - updet(kkp1) < 10._rp)
then 1866 if (dilbe > 0._rp)
then 1867 cape = cape - dilbe*grav
1874 umfold = umf(kk) - updet(kkp1)
1875 umfnew = umfold + upent(kkp1)
1877 umfnewdold(kkp1) = umfnew/umfold
1878 qcdet(kkp1) = qc(kkp1)*updet(kkp1)
1879 qidet(kkp1) = qi(kkp1)*updet(kkp1)
1880 qvdet(kkp1) = qv_u(kkp1)
1882 qv_u(kkp1) = (umfold*qv_u(kkp1) + upent(kkp1)*qv(kkp1))/umfnew
1883 theta_eu(kkp1) = (umfold*theta_eu(kkp1) + upent(kkp1)*theta_ee(kkp1))/umfnew
1886 qc(kkp1) = qc(kkp1)*umfold/umfnew
1887 qi(kkp1) = qi(kkp1)*umfold/umfnew
1890 flux_qr(kkp1) = qrout(kkp1)*umf(kk)
1891 flux_qs(kkp1) = qsout(kkp1)*umf(kk)
1892 totalprcp = totalprcp + flux_qr(kkp1) + flux_qs(kkp1)
1895 if(kkp1 <= k_pbl ) upent(kkp1) = upent(kkp1) + umflcl*deltap(kkp1)/dpthmx
1900 cloudhight = z_kf(k_top) - zlcl
1901 cloudtop = z_kf(k_top)
1903 end subroutine cp_kf_updraft
1907 subroutine cp_kf_downdraft ( &
1910 u ,& ! x-direction wind
1911 v ,& ! meridional wind
1912 zlcl ,& ! lcl_hight [m]
1913 rh ,& ! relative humidity initial make kf_init
1915 pres ,& ! pressure [Pa]
1919 theta_ee ,& ! environment equivalent theta
1920 umf ,& ! upward mass flux
1921 totalprcp ,& ! total precipitation
1924 I_convflag ,& ! convection flag
1933 wspd ,& ! wind speed 1 k_lcl, 2 k_z5,3 k_top
1952 atmos_saturation_psat_liq
1958 real(RP),
intent(in) :: dz_kf(
ka),z_kf(
ka)
1959 real(RP),
intent(in) :: u(
ka)
1960 real(RP),
intent(in) :: v(
ka)
1961 real(RP),
intent(in) :: rh(
ka)
1962 real(RP),
intent(in) :: deltap(
ka)
1963 real(RP),
intent(in) :: pres(
ka)
1964 real(RP),
intent(in) :: qv(
ka)
1965 real(RP),
intent(in) :: ems(
ka)
1966 real(RP),
intent(in) :: emsd(
ka)
1968 real(RP),
intent(in) :: zlcl
1969 real(RP),
intent(in) :: umf(
ka)
1970 real(RP),
intent(in) :: totalprcp
1971 real(RP),
intent(in) :: flux_qs(
ka)
1972 real(RP),
intent(in) :: tempv(
ka)
1973 real(RP),
intent(in) :: theta_ee(
ka)
1976 integer,
intent(in) :: I_convflag
1977 integer,
intent(in) :: k_lcl
1978 integer,
intent(in) :: k_top
1979 integer,
intent(in) :: k_pbl
1980 integer,
intent(in) :: k_let
1981 integer,
intent(in) :: k_lc
1982 integer,
intent(in) :: k_ml
1984 real(RP),
intent(out) :: wspd(3)
1985 real(RP),
intent(out) :: dmf(
ka)
1986 real(RP),
intent(out) :: downent(
ka)
1987 real(RP),
intent(out) :: downdet(
ka)
1988 real(RP),
intent(out) :: theta_d(
ka)
1989 real(RP),
intent(out) :: qv_d(
ka)
1990 real(RP),
intent(out) :: prcp_flux
1991 real(RP),
intent(out) :: tder
1992 real(RP),
intent(out) :: CPR
1993 integer,
intent(out) :: k_lfs
1999 real(RP) :: pef_wind
2000 real(RP) :: pef_cloud
2016 real(RP) :: temp_d(
ka)
2017 real(RP) :: tempv_d(
ka)
2018 real(RP) :: theta_ed(
ka)
2019 real(RP) :: qvsd(
ka)
2023 real(RP) :: dtempmlt
2036 if (i_convflag == 2)
return 2039 if (pres(kk) >= pres(
ks)*0.5_rp) k_z5 = kk
2042 wspd(1) = sqrt(u(k_lcl)*u(k_lcl) + v(k_lcl)*v(k_lcl))
2043 wspd(2) = sqrt(u(k_z5)*u(k_z5) + v(k_z5)*v(k_z5))
2044 wspd(3) = sqrt(u(k_top)*u(k_top) + v(k_top)*v(k_top))
2049 if(wspd(3) > wspd(1))
then 2054 vws = (u(k_top) - u(k_lcl))*(u(k_top) - u(k_lcl)) &
2055 + (v(k_top) - v(k_lcl))*(v(k_top) - v(k_lcl))
2057 vws = 1.e3_rp*shsign*sqrt(vws)/(z_kf(k_top) - z_kf(k_lcl))
2060 pef_wind = 1.591_rp + vws*(-0.639_rp + vws*(9.53e-2_rp - vws*4.96e-3_rp) )
2062 pef_wind = max(pef_wind,0.2_rp)
2063 pef_wind = min(pef_wind,0.9_rp)
2067 cbh = (zlcl - z_kf(
ks))*3.281e-3_rp
2068 if( cbh < 3._rp)
then 2071 rcbh = 0.96729352_rp + cbh*(-0.70034167_rp + cbh*(0.162179896_rp + cbh*(- &
2072 1.2569798e-2_rp + cbh*(4.2772e-4_rp - cbh*5.44e-6_rp))))
2074 if(cbh > 0.25) rcbh = 2.4_rp
2075 pef_cloud = 1._rp/(1._rp + rcbh)
2076 pef_cloud = min(pef_cloud,0.9_rp)
2078 pef = 0.5_rp*(pef_wind + pef_cloud)
2083 if(i_convflag == 1)
then 2087 k_dstart = k_pbl + 1
2088 k_lfstmp = k_let - 1
2089 do kk = k_dstart+1,
ke 2090 dpthtmp = pres(k_dstart) - pres(kk)
2091 if(dpthtmp > 150.e2_rp)
then 2096 k_lfstmp = min(k_lfstmp, k_let - 1)
2103 if(pres(k_dstart) - pres(k_lfs) > 50.e2_rp)
then 2104 theta_ed(k_lfs) = theta_ee(k_lfs)
2105 qv_d(k_lfs) = qv(k_lfs)
2107 call tpmix2dd(pres(k_lfs),theta_ed(k_lfs),temp_d(k_lfs),qvs_tmp)
2108 call calcexn(pres(k_lfs),qvs_tmp,exn(k_lfs))
2112 theta_d(k_lfs) = temp_d(k_lfs)*exn(k_lfs)
2114 tempv_d(k_lfs) = temp_d(k_lfs)*(1._rp + 0.608_rp*qvs_tmp)
2115 dens_d = pres(k_lfs)/(r*tempv_d(k_lfs))
2116 dmf(k_lfs) = -(1._rp - pef)*1.e-2_rp*deltax*deltax*dens_d
2117 downent(k_lfs) = dmf(k_lfs)
2118 downdet(k_lfs) = 0._rp
2119 rhbar = rh(k_lfs)*deltap(k_lfs)
2120 dpthtmp = deltap(k_lfs)
2124 do kk = k_lfs-1,k_dstart,-1
2126 downent(kk) = downent(k_lfs)*ems(kk)/ems(k_lfs)
2128 dmf(kk) = dmf(kkp1) + downent(kk)
2129 theta_ed(kk) = ( theta_ed(kkp1)*dmf(kkp1) + theta_ee(kk)*downent(kk) )/dmf(kk)
2130 qv_d(kk) = ( qv_d(kkp1)*dmf(kkp1) + qv(kk)*downent(kk) )/dmf(kk)
2131 dpthtmp = dpthtmp + deltap(kk)
2132 rhbar = rhbar + rh(kk)*deltap(kk)
2134 rhbar = rhbar/dpthtmp
2135 f_dmf = 2._rp*(1._rp - rhbar)
2141 prcpmlt = prcpmlt + flux_qs(kk)
2143 if (k_lc < k_ml )
then 2146 dtempmlt = emelt*prcpmlt/(cp*umf(k_lcl))
2150 call tpmix2dd(pres(k_dstart),theta_ed(k_dstart),temp_d(k_dstart),qvs_tmp)
2151 temp_d(k_dstart) = temp_d(k_dstart) - dtempmlt
2153 call atmos_saturation_psat_liq(es,temp_d(k_dstart))
2154 qvs_tmp = 0.622_rp*es/(pres(k_dstart) - es )
2156 theta_ed(k_dstart) = temp_d(k_dstart)*(pre00/pres(k_dstart))**(0.2854_rp*(1._rp - 0.28_rp*qvs_tmp))* &
2157 & exp((3374.6525_rp/temp_d(k_dstart)-2.5403_rp)*qvs_tmp*(1._rp + 0.81_rp*qvs_tmp))
2158 k_ldt = min(k_lfs-1, k_dstart-1)
2162 dpthdet = dpthdet + deltap(kk)
2163 theta_ed(kk) = theta_ed(k_dstart)
2164 qv_d(kk) = qv_d(k_dstart)
2165 call tpmix2dd(pres(kk),theta_ed(kk),temp_d(kk),qvs_tmp)
2168 rhh = 1._rp - 2.e-4_rp*(z_kf(k_dstart) -z_kf(kk) )
2173 if(rhh < 1._rp)
then 2175 dssdt = (cliq - bliq*dliq)/((temp_d(kk) - dliq)*(temp_d(kk) - dliq))
2176 rl = xlv0 - xlv1*temp_d(kk)
2177 dtmp = rl*qvs_tmp*(1._rp - rhh )/(cp + rl*rhh*qvs_tmp*dssdt )
2178 t1rh = temp_d(kk) + dtmp
2179 call atmos_saturation_psat_liq(es,t1rh)
2181 qsrh = 0.622_rp*es/(pres(kk) - es)
2182 if(qsrh < qv_d(kk) )
then 2184 t1rh = temp_d(kk) + (qvs_tmp - qsrh)*rl/cp
2193 tempv_d(kk) = temp_d(kk)*( 1._rp + 0.608_rp*qvsd(kk) )
2194 if(tempv_d(kk) > tempv(kk) .or. kk ==
ks)
then 2200 if((pres(k_ldb)-pres(k_lfs)) > 50.e2_rp )
then 2201 do kk = k_ldt,k_ldb,-1
2203 downdet(kk) = -dmf(k_dstart)*deltap(kk)/dpthdet
2205 dmf(kk) = dmf(kkp1) + downdet(kk)
2206 tder = tder + (qvsd(kk) - qv_d(kk))*downdet(kk)
2208 call calcexn(pres(kk),qv_d(kk),exn(kk))
2209 theta_d(kk) = temp_d(kk)*exn(kk)
2218 if (tder < 1._rp)
then 2219 prcp_flux = totalprcp
2232 ddinc = -f_dmf*umf(k_lcl)/dmf(k_dstart)
2233 if(tder*ddinc > totalprcp)
then 2234 ddinc = totalprcp/tder
2238 dmf(kk) = dmf(kk)*ddinc
2239 downent(kk) = downent(kk)*ddinc
2240 downdet(kk) = downdet(kk)*ddinc
2243 prcp_flux = totalprcp - tder
2244 pef = prcp_flux/totalprcp
2263 if (k_ldb >
ks)
then 2283 do kk = k_ldt+1,k_lfs-1
2291 end subroutine cp_kf_downdraft
2298 subroutine cp_kf_compensational (&
2303 temp_bf ,& ! temperature
2308 presmix ,& ! usl layer pressure depth
2309 zmix ,& ! usl layer pressure depth
2310 dpthmx ,& ! usl layer depth
2312 temp_u ,& ! updraft temperature
2313 qvdet ,& ! updraft water vapor
2314 umflcl ,& ! umf @LCL
2316 upent ,& ! updraft entrainment
2317 updet ,& ! updraft detrainment
2318 qcdet ,& ! updraft detrainment qc
2319 qidet ,& ! updraft detrainment qi
2322 flux_qr ,& ! rain flux
2323 flux_qs ,& ! snow flux
2324 umfnewdold ,& ! 1/(umfnew/umfold ratio)
2365 atmos_saturation_psat_liq
2373 real(RP),
intent(in) :: dz_kf(
ka),z_kf(
ka)
2374 real(RP),
intent(in) :: pres(
ka)
2375 real(RP),
intent(in) :: deltap(
ka)
2376 real(RP),
intent(in) :: temp_bf(
ka)
2377 real(RP),
intent(in) :: qv(
ka)
2378 real(RP),
intent(in) :: ems(
ka)
2379 real(RP),
intent(in) :: emsd(
ka)
2381 real(RP),
intent(in) :: presmix
2382 real(RP),
intent(in) :: zmix
2383 real(RP),
intent(in) :: dpthmx
2384 real(RP),
intent(in) :: cape
2385 real(RP),
intent(in) :: temp_u(
ka)
2386 real(RP),
intent(in) :: qvdet(
ka)
2387 real(RP),
intent(in) :: umflcl
2388 real(RP),
intent(inout) :: umf(
ka)
2389 real(RP),
intent(inout) :: upent(
ka)
2390 real(RP),
intent(inout) :: updet(
ka)
2391 real(RP),
intent(inout) :: qcdet(
ka)
2392 real(RP),
intent(inout) :: qidet(
ka)
2393 real(RP),
intent(in) :: qc(
ka)
2394 real(RP),
intent(in) :: qi(
ka)
2395 real(RP),
intent(in) :: flux_qr(
ka)
2396 real(RP),
intent(in) :: flux_qs(
ka)
2397 real(RP),
intent(in) :: umfnewdold(
ka)
2399 real(RP),
intent(in) :: wspd(3)
2400 real(RP),
intent(inout) :: dmf(
ka)
2401 real(RP),
intent(inout) :: downent(
ka)
2402 real(RP),
intent(inout) :: downdet(
ka)
2403 real(RP),
intent(in) :: qv_d(
ka)
2404 real(RP),
intent(in) :: theta_d(
ka)
2405 real(RP),
intent(inout) :: prcp_flux
2406 real(RP),
intent(inout) :: tder
2407 real(RP),
intent(in) :: cpr
2408 integer,
intent(inout) :: I_convflag
2410 integer,
intent(in) :: k_top
2411 integer,
intent(inout) :: k_lcl_bf
2412 integer,
intent(in) :: k_lc
2413 integer,
intent(in) :: k_pbl
2414 integer,
intent(in) :: k_ml
2415 integer,
intent(in) :: k_lfs
2417 real(RP),
intent(out) :: temp_g(
ka)
2418 real(RP),
intent(out) :: qv_g(
ka)
2419 real(RP),
intent(out) :: qc_nw(
ka)
2420 real(RP),
intent(out) :: qi_nw(
ka)
2421 real(RP),
intent(out) :: qr_nw(
ka)
2422 real(RP),
intent(out) :: qs_nw(
ka)
2423 integer,
intent (out) :: nic
2425 real(RP),
intent(out) :: rainrate_cp
2426 real(RP),
intent(out) :: cldfrac_KF(
ka,2)
2427 real(RP),
intent(out) :: timecp
2428 real(RP),
intent(out) :: time_advec
2431 real(RP) :: umf2(
ka)
2432 real(RP) :: upent2(
ka)
2433 real(RP) :: updet2(
ka)
2434 real(RP) :: qcdet2(
ka)
2435 real(RP) :: qidet2(
ka)
2436 real(RP) :: dmf2(
ka)
2437 real(RP) :: downent2(
ka)
2438 real(RP) :: downdet2(
ka)
2439 real(RP) :: prcp_flux2
2444 real(RP) :: theta(
ka)
2445 real(RP) :: theta_u(
ka)
2446 real(RP) :: theta_eu(
ka)
2447 real(RP) :: theta_eg(
ka)
2451 real(RP) :: qv_gu(
ka)
2452 real(RP) :: temp_env
2453 real(RP) :: tempv_env
2454 real(RP) :: temp_lcl
2455 real(RP) :: tempv_lcl
2456 real(RP) :: temp_mix
2457 real(RP) :: temp_gu(
ka)
2458 real(RP) :: tempv_g(
ka)
2459 real(RP) :: tempvq_u(
ka)
2463 real(RP) :: DQ,TDPT,DSSDT,emix,RL,TLOG
2469 integer :: k_lcl,k_lclm1
2472 real(RP) :: theta_nw(
ka)
2473 real(RP) :: theta_g(
ka)
2474 real(RP) :: qv_nw(
ka)
2479 real(RP) :: f_cape ,f_capeold
2486 integer :: ntimecount
2492 real(RP) :: tma,tmb,tmm
2493 real(RP) :: acoeff,bcoeff
2495 real(RP) :: ainc,ainctmp, aincmx,aincold
2501 real(RP) :: domg_dp(
ka)
2502 real(RP) :: absomgtc,absomg
2505 real(RP) :: theta_fxin(
ka)
2506 real(RP) :: theta_fxout(
ka)
2507 real(RP) :: qv_fxin(
ka)
2508 real(RP) :: qv_fxout(
ka)
2509 real(RP) :: qc_fxin(
ka)
2510 real(RP) :: qc_fxout(
ka)
2511 real(RP) :: qi_fxin(
ka)
2512 real(RP) :: qi_fxout(
ka)
2513 real(RP) :: qr_fxin(
ka)
2514 real(RP) :: qr_fxout(
ka)
2515 real(RP) :: qs_fxin(
ka)
2516 real(RP) :: qs_fxout(
ka)
2517 real(RP) :: rainfb(
ka)
2518 real(RP) :: snowfb(
ka)
2526 real(RP) :: xcldfrac
2532 if(i_convflag == 2)
return 2536 if(i_convflag == 1) fbfrc = 1._rp
2539 vconv = 0.5_rp*(wspd(1) + wspd(2))
2540 timecp = deltax/vconv
2543 timecp = max(deeplifetime, timecp)
2544 timecp = min(3600._rp, timecp)
2545 if(i_convflag == 1) timecp = shallowlifetime
2546 nic = nint(timecp/dt)
2549 timecp =
real( nic,
rp )*dt
2553 k_lmax = max(k_lcl,k_lfs)
2555 if((upent(kk)-downent(kk)) > 1.e-3_rp)
then 2556 ainctmp = ems(kk)/( (upent(kk) -downent(kk))*timecp )
2557 aincmx = min(aincmx,ainctmp)
2561 if(aincmx < ainc ) ainc = aincmx
2564 prcp_flux2 = prcp_flux
2567 upent2(kk) = upent(kk)
2568 updet2(kk) = updet(kk)
2569 qcdet2(kk) = qcdet(kk)
2570 qidet2(kk) = qidet(kk)
2572 downent2(kk) = downent(kk)
2573 downdet2(kk) = downdet(kk)
2576 stab = 1.05_rp - delcape
2579 if (i_convflag == 1)
then 2582 evac = 0.50_rp*tkemax*1.e-1_rp
2583 ainc = evac*dpthmx*deltax*deltax/( umflcl*grav*timecp)
2585 prcp_flux = prcp_flux2*ainc
2587 umf(kk) = umf2(kk)*ainc
2588 upent(kk) = upent2(kk)*ainc
2589 updet(kk) = updet2(kk)*ainc
2590 qcdet(kk) = qcdet2(kk)*ainc
2591 qidet(kk) = qidet2(kk)*ainc
2592 dmf(kk) = dmf2(kk)*ainc
2593 downent(kk) = downent2(kk)*ainc
2594 downdet(kk) = downdet2(kk)*ainc
2600 call calcexn(pres(kk),qv(kk),exn(kk))
2601 theta(kk) = temp_bf(kk)*exn(kk)
2602 call calcexn(pres(kk),qvdet(kk),exn(kk))
2603 theta_u(kk) = temp_u(kk)*exn(kk)
2605 temp_g(k_top+1:
ke) = temp_bf(k_top+1:
ke)
2606 qv_g(k_top+1:
ke) = qv(k_top+1:
ke)
2613 domg_dp(kk) = -(upent(kk) - downent(kk) - updet(kk) - downdet(kk))*emsd(kk)
2615 omg(kk) = omg(kk-1) - deltap(kk-1)*domg_dp(kk-1)
2616 absomg = abs(omg(kk))
2617 absomgtc = absomg*timecp
2618 f_dp = 0.75*deltap(kk-1)
2619 if(absomgtc > f_dp)
THEN 2620 dtt_tmp = f_dp/abs(omg(kk))
2621 dtt=min(dtt,dtt_tmp)
2627 theta_nw(kk) = theta(kk)
2629 fxm(kk) = omg(kk)*deltax*deltax/grav
2631 nstep = nint(timecp/dtt + 1)
2632 deltat = timecp/
real(nstep,RP) 2633 do ntimecount = 1, nstep
2638 theta_fxin(kk) = 0._rp
2639 theta_fxout(kk) = 0._rp
2641 qv_fxout(kk) = 0._rp
2644 if(omg(kk) <= 0._rp)
then 2645 theta_fxin(kk) = -fxm(kk)*theta_nw(kk-1)
2646 qv_fxin(kk) = -fxm(kk)*qv_nw(kk-1)
2647 theta_fxout(kk - 1) = theta_fxout(kk-1) + theta_fxin(kk)
2648 qv_fxout(kk - 1) = qv_fxout(kk-1) + qv_fxin(kk)
2650 theta_fxout(kk) = fxm(kk)*theta_nw(kk)
2651 qv_fxout(kk) = fxm(kk)*qv_nw(kk)
2652 theta_fxin(kk - 1) = theta_fxin(kk-1) + theta_fxout(kk)
2653 qv_fxin(kk - 1) = qv_fxin(kk-1) + qv_fxout(kk)
2659 theta_nw(kk) = theta_nw(kk) &
2660 + (theta_fxin(kk) - theta_fxout(kk) &
2661 + updet(kk)*theta_u(kk) + downdet(kk)*theta_d(kk) &
2662 - ( upent(kk) - downent(kk) )*theta(kk) ) *deltat*emsd(kk)
2663 qv_nw(kk) = qv_nw(kk) &
2664 + (qv_fxin(kk) - qv_fxout(kk) &
2665 + updet(kk)*qvdet(kk) + downdet(kk)*qv_d(kk) &
2666 - ( upent(kk) - downent(kk) )*qv(kk) )*deltat*emsd(kk)
2671 theta_g(kk) = theta_nw(kk)
2672 qv_g(kk) = qv_nw(kk)
2677 if(qv_g(kk) < 0._rp )
then 2679 write(*,*)
"error qv<0 @ Kain-Fritsch cumulus parameterization" 2680 write(*,*)
"@sub scale_atmos_phy_cp_kf",__file__,__line__
2684 if(kk == k_top)
then 2687 tma = qv_g(kkp1)*ems(kkp1)
2688 tmb = qv_g(kk-1)*ems(kk-1)
2689 tmm = (qv_g(kk) - 1.e-9_rp )*ems(kk)
2690 bcoeff = -tmm/((tma*tma)/tmb + tmb)
2691 acoeff = bcoeff*tma/tmb
2692 tmb = tmb*(1._rp - bcoeff)
2693 tma = tma*(1._rp - acoeff)
2695 qv_g(kkp1) = tma*emsd(kkp1)
2696 qv_g(kk-1) = tmb*emsd(kk-1)
2700 topomg = (updet(k_top) - upent(k_top))*deltap(k_top)*emsd(k_top)
2701 if( abs(topomg - omg(k_top)) > 1.e-3_rp)
then 2703 write(*,*)
"xxxERROR@KF omega is not consistent",ncount
2704 write(*,*)
"omega error",abs(topomg - omg(k_top)),k_top,topomg,omg(k_top)
2709 call calcexn(pres(kk),qv_g(kk),exn(kk))
2710 temp_g(kk) = theta_g(kk)/exn(kk)
2711 tempv_g(kk) = temp_g(kk)*(1._rp + 0.608_rp*qv_g(kk))
2716 if(i_convflag == 1)
then 2722 temp_mix = temp_mix + deltap(kk)*temp_g(kk)
2723 qv_mix = qv_mix + deltap(kk)*qv_g(kk)
2726 temp_mix = temp_mix/dpthmx
2727 qv_mix = qv_mix/dpthmx
2729 call atmos_saturation_psat_liq(es,temp_mix)
2730 qvss = 0.622_rp*es/(presmix -es)
2734 if (qv_mix > qvss)
then 2735 rl = xlv0 -xlv1*temp_mix
2736 cpm = cp*(1._rp + 0.887_rp*qv_mix)
2737 dssdt = qvss*(cliq-bliq*dliq)/( (temp_mix-dliq)**2)
2738 dq = (qv_mix -qvss)/(1._rp + rl*dssdt/cpm)
2739 temp_mix = temp_mix + rl/cp*dq
2740 qv_mix = qv_mix - dq
2743 qv_mix = max(qv_mix,0._rp)
2744 emix = qv_mix*presmix/(0.6222_rp + qv_mix)
2745 tlog =
log(emix/aliq)
2747 tdpt = (cliq - dliq*tlog)/(bliq - tlog)
2748 temp_lcl = tdpt - (0.212_rp + 1.57e-3_rp*(tdpt - tem00) - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - tdpt)
2749 temp_lcl = min(temp_lcl,temp_mix)
2751 tempv_lcl = temp_lcl*(1._rp + 0.608_rp*qv_mix)
2752 z_lcl = zmix + (temp_lcl - temp_mix)/gdcp
2755 if( z_lcl <= z_kf(kk) )
exit 2760 deltaz = ( z_lcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
2761 temp_env = temp_g(k_lclm1) + ( temp_g(k_lcl) - temp_g(k_lclm1) )*deltaz
2762 qv_env = qv_g(k_lclm1) + ( qv_g(k_lcl) - qv_g(k_lclm1) )*deltaz
2763 tempv_env = temp_env*( 1._rp + 0.608_rp*qv_env )
2765 theta_eu(k_lclm1)=temp_mix*(pre00/presmix)**(0.2854_rp*(1._rp - 0.28_rp*qv_mix))* &
2766 exp((3374.6525_rp/temp_lcl-2.5403_rp)*qv_mix*(1._rp + 0.81_rp*qv_mix))
2771 do kk=k_lclm1,k_top-1
2773 theta_eu(kkp1) = theta_eu(kk)
2774 call tpmix2dd(pres(kkp1),theta_eu(kkp1),temp_gu(kkp1),qv_gu(kkp1))
2775 tempvq_u(kkp1) = temp_gu(kkp1)*(1._rp + 0.608_rp*qv_gu(kkp1) - qc(kkp1)- qi(kkp1))
2776 if(kk == k_lclm1)
then 2777 dzz = z_kf(k_lcl) - z_lcl
2778 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv_g(kkp1)) - 1._rp)*dzz
2781 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv_g(kk) + tempv_g(kkp1)) - 1._rp)*dzz
2783 if(dilbe > 0._rp) cape_g = cape_g + dilbe*grav
2787 call envirtht(pres(kkp1),temp_g(kkp1),qv_g(kkp1),theta_eg(kkp1))
2790 theta_eu(kkp1) = theta_eu(kkp1)*(umfnewdold(kkp1)) + theta_eg(kkp1)*(1._rp - (umfnewdold(kkp1)))
2792 if (noiter == 1)
exit 2793 dcape = max(cape - cape_g,cape*0.1_rp)
2794 f_cape = cape_g/cape
2795 if(f_cape > 1._rp .and. i_convflag == 0)
then 2799 if(ncount /= 1)
then 2800 if(abs(ainc - aincold) < 1.e-4_rp)
then 2805 dfda = (f_cape - f_capeold)/(ainc - aincold)
2806 if (dfda > 0._rp )
then 2818 if (ainc/aincmx > 0.999 .and. f_cape > 1.05-stab )
then 2824 if( (f_cape <= 1.05-stab .and. f_cape >= 0.95-stab) .or. ncount == 10)
then 2827 if(ncount > 10)
exit 2828 if(f_cape == 0._rp)
then 2831 if(dcape < 1.e-4)
then 2836 ainc = ainc*stab*cape/dcape
2839 ainc = min(aincmx,ainc)
2841 if (ainc < 0.05)
then 2847 prcp_flux = prcp_flux2*ainc
2849 umf(kk) = umf2(kk)*ainc
2850 upent(kk) = upent2(kk)*ainc
2851 updet(kk) = updet2(kk)*ainc
2852 qcdet(kk) = qcdet2(kk)*ainc
2853 qidet(kk) = qidet2(kk)*ainc
2854 dmf(kk) = dmf2(kk)*ainc
2855 downent(kk) = downent2(kk)*ainc
2856 downdet(kk) = downdet2(kk)*ainc
2863 cldfrac_kf(:,:) = 0._rp
2864 if (i_convflag == 1)
then 2865 do kk = k_lcl-1, k_top
2866 umf_tmp = umf(kk)/(deltax*deltax)
2867 xcldfrac = 0.07*
log(1._rp+(500._rp*umf_tmp))
2868 xcldfrac = max(1.e-2_rp,xcldfrac)
2869 cldfrac_kf(kk,1) = min(2.e-2_rp,xcldfrac)
2872 do kk = k_lcl-1, k_top
2873 umf_tmp = umf(kk)/(deltax*deltax)
2874 xcldfrac = 0.14*
log(1._rp+(500._rp*umf_tmp))
2875 xcldfrac = max(1.e-2_rp,xcldfrac)
2876 cldfrac_kf(kk,2) = min(6.e-1_rp,xcldfrac)
2887 if (cpr > 0._rp)
then 2888 frc2 = prcp_flux/(cpr*ainc)
2893 qc_nw(
ks:
ke) = 0._rp
2894 qi_nw(
ks:
ke) = 0._rp
2895 qr_nw(
ks:
ke) = 0._rp
2896 qs_nw(
ks:
ke) = 0._rp
2898 rainfb(kk) = flux_qr(kk)*ainc*fbfrc*frc2
2899 snowfb(kk) = flux_qs(kk)*ainc*fbfrc*frc2
2902 do ntimecount = 1, nstep
2905 qc_fxout(kk) = 0._rp
2907 qi_fxout(kk) = 0._rp
2909 qr_fxout(kk) = 0._rp
2911 qs_fxout(kk) = 0._rp
2914 if(omg(kk) <= 0._rp)
then 2915 qc_fxin(kk) = -fxm(kk)*qc_nw(kk-1)
2916 qi_fxin(kk) = -fxm(kk)*qi_nw(kk-1)
2917 qr_fxin(kk) = -fxm(kk)*qr_nw(kk-1)
2918 qs_fxin(kk) = -fxm(kk)*qs_nw(kk-1)
2920 qc_fxout(kk-1) = qc_fxout(kk-1) + qc_fxin(kk)
2921 qi_fxout(kk-1) = qi_fxout(kk-1) + qi_fxin(kk)
2922 qr_fxout(kk-1) = qr_fxout(kk-1) + qr_fxin(kk)
2923 qs_fxout(kk-1) = qs_fxout(kk-1) + qs_fxin(kk)
2925 qc_fxout(kk) = fxm(kk)*qc_nw(kk)
2926 qi_fxout(kk) = fxm(kk)*qi_nw(kk)
2927 qr_fxout(kk) = fxm(kk)*qr_nw(kk)
2928 qs_fxout(kk) = fxm(kk)*qs_nw(kk)
2930 qc_fxin(kk-1) = qc_fxin(kk-1) + qc_fxout(kk)
2931 qi_fxin(kk-1) = qi_fxin(kk-1) + qi_fxout(kk)
2932 qr_fxin(kk-1) = qr_fxin(kk-1) + qr_fxout(kk)
2933 qs_fxin(kk-1) = qs_fxin(kk-1) + qs_fxout(kk)
2938 qc_nw(kk) = qc_nw(kk) + (qc_fxin(kk) - qc_fxout(kk) + qcdet(kk) )*deltat*emsd(kk)
2939 qi_nw(kk) = qi_nw(kk) + (qi_fxin(kk) - qi_fxout(kk) + qidet(kk) )*deltat*emsd(kk)
2940 qr_nw(kk) = qr_nw(kk) + (qr_fxin(kk) - qr_fxout(kk) + rainfb(kk) )*deltat*emsd(kk)
2941 qs_nw(kk) = qs_nw(kk) + (qs_fxin(kk) - qs_fxout(kk) + snowfb(kk) )*deltat*emsd(kk)
2947 rainrate_cp = prcp_flux*(1._rp - fbfrc)/(deltax*deltax)
2953 dpth = dpth + deltap(kk)
2954 qinit = qinit + qv(kk)*ems(kk)
2955 qfinl = qfinl + qv_g(kk)*ems(kk)
2956 qfinl = qfinl + (qc_nw(kk) + qi_nw(kk) + qr_nw(kk) + qs_nw(kk))*ems(kk)
2958 qfinl = qfinl + prcp_flux*timecp*(1._rp - fbfrc)
2959 err = (qfinl - qinit )*100._rp/qinit
2960 if (abs(err) > 0.05_rp .and. istop == 0)
then 2964 write(*,*)
"XXXX ERROR@KF,MOISTURE" 2980 cpm = cp*(1._rp + 0.887_rp*qv_g(kk))
2981 temp_g(kk) = temp_g(kk) - (qi_nw(kk) + qs_nw(kk))*emelt/cpm
2982 qc_nw(kk) = qc_nw(kk) + qi_nw(kk)
2983 qr_nw(kk) = qr_nw(kk) + qs_nw(kk)
2988 elseif(.not. flag_qs )
then 2994 cpm = cp*(1._rp + 0.887*qv_g(kk))
2996 temp_g(kk) = temp_g(kk) - (qi_nw(kk) + qs_nw(kk))*emelt/cpm
2997 elseif(kk > k_ml) then
2998 temp_g(kk) = temp_g(kk) + (qi_nw(kk) + qs_nw(kk))*emelt/cpm
3000 qc_nw(kk) = qc_nw(kk) + qi_nw(kk)
3001 qr_nw(kk) = qr_nw(kk) + qs_nw(kk)
3010 elseif( flag_qs )
then 3011 if(.not.flag_qi)
then 3013 qs_nw(kk) = qs_nw(kk) + qi_nw(kk)
3018 write(*,*)
"xxx ERROR@KF,NOTallow namelist" 3019 write(*,*)
"!!!!!Moiture setting error in KF check namelist" 3023 end subroutine cp_kf_compensational
3025 subroutine calcexn( pres,qv,exn)
3031 real(RP),
intent(in) :: pres
3032 real(RP),
intent(in) :: qv
3033 real(RP),
intent(out) :: exn
3034 exn = (pre00/pres)**(0.2854_rp*(1._rp - 0.28_rp*qv ))
3038 end subroutine calcexn
3042 subroutine precipitation_oc1973( &
3043 QLIQ,QICE,WTW,DZ,BOTERM,ENTERM,QNEWLQ, &
3044 QNEWIC,QLQOUT,QICOUT,G)
3054 real(RP),
intent(in) :: G
3055 real(RP),
intent(in) :: DZ,BOTERM,ENTERM
3056 real(RP),
intent(inout) :: QLQOUT,QICOUT,WTW,QLIQ,QICE,QNEWLQ,QNEWIC
3058 real(RP) :: QTOT,QNEW,QEST,G1,WAVG,CONV,RATIO3,OLDQ,RATIO4,DQ,PPTDRG
3067 qest=0.5_rp*(qtot+qnew)
3068 g1=wtw+boterm-enterm-2._rp*g*dz*qest/1.5_rp
3069 IF(g1.LT.0.0)g1=0._rp
3070 wavg=0.5_rp*(sqrt(wtw)+sqrt(g1))
3079 ratio3=qnewlq/(qnew+1.e-8_rp)
3081 qtot=qtot+0.6_rp*qnew
3083 ratio4=(0.6_rp*qnewlq+qliq)/(qtot+1.e-8_rp)
3084 qtot=qtot*exp(-conv)
3091 qicout=(1._rp-ratio4)*dq
3096 pptdrg=0.5_rp*(oldq+qtot-0.2_rp*qnew)
3097 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
3098 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
3103 qliq=ratio4*qtot+ratio3*0.4_rp*qnew
3104 qice=(1._rp-ratio4)*qtot+(1._rp-ratio3)*0.4_rp*qnew
3108 end subroutine precipitation_oc1973
3111 subroutine precipitation_kessler( &
3112 QLIQ,QICE,WTW,DZ,BOTERM,ENTERM,QNEWLQ, &
3113 QNEWIC,QLQOUT,QICOUT,G)
3117 real(RP),
intent(in ) :: G
3118 real(RP),
intent(in ) :: DZ,BOTERM,ENTERM
3119 real(RP),
intent(inout) :: QLQOUT,QICOUT,WTW,QLIQ,QICE,QNEWLQ,QNEWIC
3121 real(RP) :: total_liq, total_ice
3123 real(RP) :: auto_qc, auto_qi
3124 auto_qc = kf_threshold
3125 auto_qi = kf_threshold
3127 total_liq = qliq + qnewlq
3128 total_ice = qice + qnewic
3131 qlqout = max( total_liq - auto_qc, 0.0_rp )
3132 qicout = max( total_ice - auto_qi, 0.0_rp )
3134 pptdrg = max( 0.5_rp * ( total_liq + total_ice - qlqout - qicout ), 0.0_rp )
3135 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
3136 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
3138 qliq = max( total_liq - qlqout, 0.0_rp )
3139 qlqout = total_liq - qliq
3141 qice = max( total_ice - qicout, 0.0_rp )
3142 qicout = total_ice - qice
3148 end subroutine precipitation_kessler
3151 subroutine tpmix2(p,thes,tu,qu,qliq,qice,qnewlq,qnewic )
3163 real(RP),
intent(in) :: P,THES
3164 real(RP),
intent(out) :: QNEWLQ,QNEWIC
3165 real(RP),
intent(inout) :: TU,QU,QLIQ,QICE
3167 real(RP) :: TP,QQ,BTH,TTH,PP,T00,T10,T01,T11,Q00,Q10,Q01,Q11
3168 real(RP) :: TEMP,QS,QNEW,DQ,QTOT,RLL,CPP
3169 integer :: IPTB,ITHTB
3193 bth=(the0k(iptb+1)-the0k(iptb))*qq+the0k(iptb)
3194 tth=(thes-bth)*rdthk
3198 IF(iptb.GE.kfnp .OR. iptb.LE.1 .OR. ithtb.GE.250 .OR. ithtb.LE.1)
THEN 3200 write(*,*)
'**** OUT OF BOUNDS *********',iptb,ithtb,p,thes
3204 t00=ttab(ithtb ,iptb )
3205 t10=ttab(ithtb+1,iptb )
3206 t01=ttab(ithtb ,iptb+1)
3207 t11=ttab(ithtb+1,iptb+1)
3209 q00=qstab(ithtb ,iptb )
3210 q10=qstab(ithtb+1,iptb )
3211 q01=qstab(ithtb ,iptb+1)
3212 q11=qstab(ithtb+1,iptb+1)
3218 temp=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
3220 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
3247 qliq=qliq-dq*qliq/(qtot+1.e-10_rp)
3248 qice=qice-dq*qice/(qtot+1.e-10_rp)
3252 cpp=1004.5_rp*(1._rp+0.89_rp*qu)
3253 IF(qtot.LT.1.e-10_rp)
THEN 3256 temp=temp+rll*(dq/(1._rp+dq))/cpp
3262 temp=temp+rll*((dq-qtot)/(1._rp+dq-qtot))/cpp
3274 end subroutine tpmix2
3276 subroutine dtfrznew(TU,P,THTEU,QU,QFRZ,QICE)
3280 atmos_saturation_psat_liq
3283 real(RP),
intent(in) :: P,QFRZ
3284 real(RP),
intent(inout) :: TU,THTEU,QU,QICE
3286 real(RP) :: RLC,RLS,RLF,CPP,A,DTFRZ,ES,QS,DQEVAP,PII
3297 rlc=2.5e6_rp-2369.276_rp*(tu-273.16_rp)
3299 rls=2833922._rp-259.532_rp*(tu-273.16_rp)
3302 cpp=1004.5_rp*(1._rp+0.89_rp*qu)
3307 a=(cliq-bliq*dliq)/((tu-dliq)*(tu-dliq))
3308 dtfrz = rlf*qfrz/(cpp+rls*qu*a)
3312 es = aliq*exp((bliq*tu-cliq)/(tu-dliq))
3313 qs = es*0.622_rp/(p-es)
3324 pii=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qu))
3327 thteu = tu*pii*exp((3374.6525_rp/tu - 2.5403_rp)*qu*(1._rp + 0.81_rp*qu))
3329 end subroutine dtfrznew
3331 subroutine prof5(EQ,EE,UD)
3349 real(RP),
intent(in) :: EQ
3350 real(RP),
intent(inout) :: EE,UD
3352 real(RP) :: SQRT2P,A1,A2,A3,P,SIGMA,FE
3353 real(RP) :: X,Y,EY,E45,T1,T2,C1,C2
3355 DATA sqrt2p,a1,a2,a3,p,sigma,fe/2.506628_rp,0.4361836_rp,-0.1201676_rp, &
3356 0.9372980_rp,0.33267_rp,0.166666667_rp,0.202765151_rp/
3357 x = (eq - 0.5_rp)/sigma
3358 y = 6._rp*eq - 3._rp
3359 ey = exp(y*y/(-2._rp))
3361 t2 = 1._rp/(1._rp + p*abs(y))
3363 c1 = a1*t1+a2*t1*t1+a3*t1*t1*t1
3364 c2 = a1*t2+a2*t2*t2+a3*t2*t2*t2
3366 ee=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*eq*eq/2._rp
3367 ud=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*(0.5_rp+eq*eq/2._rp- &
3370 ee=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*eq*eq/2._rp
3371 ud=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*(0.5_rp+eq* &
3376 end subroutine prof5
3378 subroutine tpmix2dd(p,thes,ts,qs)
3390 real(RP),
intent(in) :: P,THES
3391 real(RP),
intent(inout) :: TS,QS
3393 real(RP) :: TP,QQ,BTH,TTH,PP,T00,T10,T01,T11,Q00,Q10,Q01,Q11
3394 integer :: IPTB,ITHTB
3418 bth=(the0k(iptb+1)-the0k(iptb))*qq+the0k(iptb)
3419 tth=(thes-bth)*rdthk
3423 t00=ttab(ithtb ,iptb )
3424 t10=ttab(ithtb+1,iptb )
3425 t01=ttab(ithtb ,iptb+1)
3426 t11=ttab(ithtb+1,iptb+1)
3428 q00=qstab(ithtb ,iptb )
3429 q10=qstab(ithtb+1,iptb )
3430 q01=qstab(ithtb ,iptb+1)
3431 q11=qstab(ithtb+1,iptb+1)
3437 ts=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
3439 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
3442 end subroutine tpmix2dd
3444 subroutine envirtht(P1,T1,Q1,THT1)
3453 real(RP),
intent(in) :: P1,T1,Q1
3454 real(RP),
intent(out) :: THT1
3456 real(RP) :: EE,TLOG,ASTRT,AINC,A1,TP,
VALUE,AINTRP,TDPT,TSAT,THT
3458 real(RP),
parameter :: C1=3374.6525_rp
3459 real(RP),
parameter :: C2=2.5403_rp
3469 ee=q1*p1/(0.622_rp+q1)
3484 tdpt=(cliq-dliq*tlog)/(bliq-tlog)
3486 tsat=tdpt - (0.212_rp+1.571e-3_rp*(tdpt-tem00)-4.36e-4_rp*(t1-tem00))*(t1-tdpt)
3489 tht=t1*(p00/p1)**(0.2854_rp*(1._rp-0.28_rp*q1))
3490 tht1=tht*exp((c1/tsat-c2)*q1*(1._rp+0.81_rp*q1))
3493 end subroutine envirtht
3517 integer :: KP,IT,ITCNT,I
3518 real(RP) :: DTH=1._rp,tmin=150._rp,toler=0.001_rp
3519 real(RP) :: PBOT,DPR, &
3520 TEMP,P,ES,QS,PI,THES,TGUES,THGUES,F0,T1,T0,THGS,F1,DT, &
3550 dpr=(pbot-plutop)/
REAL(kfnp-1)
3563 es=aliq*exp((bliq*temp-cliq)/(temp-dliq))
3564 qs=0.622_rp*es/(p-es)
3565 pi=(1.e5_rp/p)**(0.2854_rp*(1.-0.28_rp*qs))
3566 the0k(kp)=temp*pi*exp((3374.6525_rp/temp-2.5403_rp)*qs* &
3586 es=aliq*exp((bliq*tgues-cliq)/(tgues-dliq))
3587 qs=0.622_rp*es/(p-es)
3588 pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3589 thgues=tgues*pi*exp((3374.6525_rp/tgues-2.5403_rp)*qs* &
3590 (1._rp + 0.81_rp*qs))
3597 es=aliq*exp((bliq*t1-cliq)/(t1-dliq))
3598 qs=0.622_rp*es/(p-es)
3599 pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3600 thtgs=t1*pi*exp((3374.6525_rp/t1-2.5403_rp)*qs*(1._rp + 0.81_rp*qs))
3602 if(abs(f1).lt.toler)
then 3606 dt=f1*(t1-t0)/(f1-f0)
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
real(rp), public dy
length in the main region [m]: y
module ATMOSPHERE / Saturation adjustment
subroutine, public prc_mpistop
Abort MPI.
subroutine cp_kf_main(dens, MOMZ, MOMX, MOMY, RHOT, QTRC, w0avg, nca, DENS_t_CP, DT_RHOT, DT_RHOQ, rainrate_cp, cldfrac_sh, cldfrac_dp, timecp, cloudtop, zlcl, I_convflag)
real(rp), public dx
length in the main region [m]: x
logical, public io_l
output log or not? (this process)
subroutine, public atmos_phy_cp_kf_setup(CP_TYPE)
Setup.
integer, public ke
end point of inner domain: z, local
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
real(rp), dimension(:,:,:), allocatable, public real_cz
geopotential height [m] (cell center)
real(rp), save, public kf_dt
subroutine cp_kf_param(RATE_in, TRIGGER_in, FLAG_QS_in, FLAG_QI_in, KF_DT_in, DELCAPE_in, DEEPLIFETIME_in, SHALLOWLIFETIME_in, DEPTH_USL_in, KF_prec_in, KF_threshold_in, WARMRAIN_in, KF_LOG_in, stepkf_in)
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
integer, public ia
of x whole cells (local, with HALO)
real(dp), public time_dtsec
time interval of model [sec]
integer, public ka
of z whole cells (local, with HALO)
real(rp), public const_pre00
pressure reference [Pa]
integer, dimension(:), allocatable, public i_mp2all
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public js
start point of inner domain: y, local
subroutine, public log(type, message)
integer, public ks
start point of inner domain: z, local
module ATMOSPHERE / Physics Cumulus Parameterization
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.
integer, public ie
end point of inner domain: x, local
module ATMOSPHERE / Thermodynamics
subroutine, public atmos_phy_cp_kf(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, DENS_t_CP, MOMZ_t_CP, MOMX_t_CP, MOMY_t_CP, RHOT_t_CP, RHOQ_t_CP, MFLX_cloudbase, SFLX_convrain, cloudtop, cloudbase, cldfrac_dp, cldfrac_sh, nca, w0avg)
subroutine kf_wmean(W0_avg, DENS, MOMZ)
running mean vertical wind speed
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, parameter, public rp
integer, public ja
of y whole cells (local, with HALO)