36 #include "inc_openmp.h" 69 private :: cp_kf_trigger, cp_kf_updraft, cp_kf_downdraft, cp_kf_compensational
71 private :: precipitation_oc1973
72 private :: precipitation_kessler
73 private :: tpmix2, dtfrznew, prof5, tpmix2dd, envirtht
76 subroutine precipitation( &
77 QLIQ,QICE,WTW,DZ,BOTERM,ENTERM,QNEWLQ, &
78 QNEWIC,QLQOUT,QICOUT,G)
80 real(RP),
INTENT(IN ) :: g
81 real(RP),
INTENT(IN ) :: dz,boterm,enterm
82 real(RP),
INTENT(INOUT) :: qlqout,qicout,wtw,qliq,qice,qnewlq,qnewic
83 end subroutine precipitation
91 integer,
private,
PARAMETER :: kfnt=250,kfnp=220
92 real(RP),
private,
SAVE :: ttab(kfnt,kfnp),qstab(kfnt,kfnp)
93 real(RP),
private,
SAVE :: the0k(kfnp)
94 real(RP),
private,
SAVE :: alu(200)
95 real(RP),
private,
SAVE :: rdpr,rdthk,plutop
97 real(RP),
private,
SAVE :: gdcp
102 real(RP),
private,
parameter :: aliq=6.112e2_rp
103 real(RP),
private,
parameter :: bliq=17.67_rp
104 real(RP),
private,
parameter :: cliq=bliq*tem00
105 real(RP),
private,
parameter :: dliq=29.65_rp
106 real(RP),
private,
parameter :: xlv1=2370._rp,xlv0=3.15e6_rp
107 real(RP),
private,
parameter :: kf_eps=1.e-12_rp
110 real(RP),
private,
save :: rate = 0.03_rp
111 integer ,
private,
save :: trigger = 3
112 logical ,
private,
save :: flag_qs = .true.
113 logical ,
private,
save :: flag_qi = .true.
114 real(RP),
private,
save :: delcape = 0.1_rp
115 real(RP),
private,
save :: deeplifetime = 1800._rp
116 real(RP),
private,
save :: shallowlifetime = 2400._rp
117 real(RP),
private,
save :: depth_usl = 300._rp
118 logical ,
private,
save :: warmrain = .false.
119 logical ,
private,
save :: kf_log = .false.
120 real(RP),
private,
save :: kf_threshold = 1.e-3_rp
121 integer ,
private,
save :: stepkf
122 integer ,
private,
save :: kf_prec = 1
123 procedure(precipitation),
pointer,
private :: p_precipitation => null()
125 real(RP),
private,
allocatable :: lifetime (:,:)
126 integer ,
private,
allocatable :: i_convflag(:,:)
128 real(RP),
private,
allocatable :: deltaz (:,:,:)
129 real(RP),
private,
allocatable :: z (:,:,:)
134 integer,
private :: time_res_kf
135 integer,
private :: time_dstep_kf
136 logical,
private :: time_dokf
139 logical,
private :: param_atmos_phy_cp_kf_wadapt = .true.
140 integer,
private :: param_atmos_phy_cp_kf_w_time = 16
165 character(len=*),
intent(in) :: cp_type
168 real(RP) :: param_atmos_phy_cp_kf_rate = 0.03_rp
169 integer :: param_atmos_phy_cp_kf_trigger = 1
170 real(DP) :: param_atmos_phy_cp_kf_dt = 5.0_dp
171 real(RP) :: param_atmos_phy_cp_kf_dlcape = 0.1_rp
172 real(RP) :: param_atmos_phy_cp_kf_dlifetime = 1800.0_rp
173 real(RP) :: param_atmos_phy_cp_kf_slifetime = 2400.0_rp
174 real(RP) :: param_atmos_phy_cp_kf_depth_usl = 300.0_rp
175 integer :: param_atmos_phy_cp_kf_prec = 1
176 real(RP) :: param_atmos_phy_cp_kf_thres = 1.e-3_rp
177 logical :: param_atmos_phy_cp_kf_log = .false.
179 namelist / param_atmos_phy_cp_kf / &
180 param_atmos_phy_cp_kf_rate, &
181 param_atmos_phy_cp_kf_trigger, &
182 param_atmos_phy_cp_kf_dt, &
183 param_atmos_phy_cp_kf_dlcape, &
184 param_atmos_phy_cp_kf_dlifetime, &
185 param_atmos_phy_cp_kf_slifetime, &
186 param_atmos_phy_cp_kf_depth_usl, &
187 param_atmos_phy_cp_kf_prec, &
188 param_atmos_phy_cp_kf_thres, &
189 param_atmos_phy_cp_kf_log, &
190 param_atmos_phy_cp_kf_wadapt, &
191 param_atmos_phy_cp_kf_w_time
199 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[CUMULUS] / Categ[ATMOS PHYSICS] / Origin[SCALElib]' 202 if ( cp_type /=
'KF' )
then 203 write(*,*)
'xxx ATMOS_PHY_CP_TYPE is not KF. Check!' 208 write(*,*)
'xxx QV is not registered' 212 write(*,*)
'xxx QC is not registered' 216 write(*,*)
'xxx QR is not registered' 225 write(*,*)
'xxx QI is registerd, but QS is not registered' 231 write(*,*)
'xxx TIME_DTSEC_ATMOS_PHY_CP should be same as TIME_DTSEC for KF scheme. STOP.' 237 read(
io_fid_conf,nml=param_atmos_phy_cp_kf,iostat=ierr)
239 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 240 elseif( ierr > 0 )
then 241 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_CP_KF. Check!' 250 time_dstep_kf = max(time_dstep_kf,1)
255 param_atmos_phy_cp_kf_trigger, &
256 param_atmos_phy_cp_kf_dt, &
257 param_atmos_phy_cp_kf_dlcape, &
258 param_atmos_phy_cp_kf_dlifetime, &
259 param_atmos_phy_cp_kf_slifetime, &
260 param_atmos_phy_cp_kf_depth_usl, &
261 param_atmos_phy_cp_kf_prec, &
262 param_atmos_phy_cp_kf_thres, &
263 param_atmos_phy_cp_kf_log , &
268 if(
io_l )
write(
io_fid_log,*)
"*** Interval for check [step] : ", time_dstep_kf
269 if(
io_l )
write(
io_fid_log,*)
"*** Ogura-Cho condense material convert rate : ", param_atmos_phy_cp_kf_rate
270 if(
io_l )
write(
io_fid_log,*)
"*** Trigger function type, 1:KF2004 3:NO2007 : ", param_atmos_phy_cp_kf_trigger
271 if(
io_l )
write(
io_fid_log,*)
"*** CAPE decrease rate : ", param_atmos_phy_cp_kf_dlcape
272 if(
io_l )
write(
io_fid_log,*)
"*** Minimum lifetime scale of deep convection [sec] : ", param_atmos_phy_cp_kf_dlifetime
273 if(
io_l )
write(
io_fid_log,*)
"*** Lifetime of shallow convection [sec] : ", param_atmos_phy_cp_kf_slifetime
274 if(
io_l )
write(
io_fid_log,*)
"*** Updraft souce layer depth [hPa] : ", param_atmos_phy_cp_kf_depth_usl
275 if(
io_l )
write(
io_fid_log,*)
"*** Precipitation type 1:Ogura-Cho(1973) 2:Kessler : ", param_atmos_phy_cp_kf_prec
276 if(
io_l )
write(
io_fid_log,*)
"*** Kessler type precipitation's threshold : ", param_atmos_phy_cp_kf_thres
278 if(
io_l )
write(
io_fid_log,*)
"*** Use running mean of w in adaptive timestep? : ", param_atmos_phy_cp_kf_wadapt
279 if(
io_l )
write(
io_fid_log,*)
"*** Fixed time scale for running mean of w : ", param_atmos_phy_cp_kf_w_time
280 if(
io_l )
write(
io_fid_log,*)
"*** Output log? : ", param_atmos_phy_cp_kf_log
283 allocate( lifetime(
ia,
ja) )
284 allocate( i_convflag(
ia,
ja) )
285 lifetime(:,:) = 0.0_rp
291 allocate( deltaz(
ka,
ia,
ja) )
293 deltaz(:,:,:) = 0.0_rp
297 deltaz(k,i,j) = cz(k+1,i,j) - cz(k,i,j)
301 deltaz(
ke,:,:) = 0.0_rp
303 deltax = sqrt(
dx*
dy )
337 real(RP),
intent(in) :: dens (
ka,
ia,
ja)
338 real(RP),
intent(in) :: momx (
ka,
ia,
ja)
339 real(RP),
intent(in) :: momy (
ka,
ia,
ja)
340 real(RP),
intent(in) :: momz (
ka,
ia,
ja)
341 real(RP),
intent(in) :: rhot (
ka,
ia,
ja)
342 real(RP),
intent(in) :: qtrc (
ka,
ia,
ja,
qa)
343 real(RP),
intent(inout) :: dens_t_cp (
ka,
ia,
ja)
344 real(RP),
intent(inout) :: momz_t_cp (
ka,
ia,
ja)
345 real(RP),
intent(inout) :: momx_t_cp (
ka,
ia,
ja)
346 real(RP),
intent(inout) :: momy_t_cp (
ka,
ia,
ja)
347 real(RP),
intent(inout) :: rhot_t_cp (
ka,
ia,
ja)
348 real(RP),
intent(inout) :: rhoq_t_cp (
ka,
ia,
ja,
qa_mp)
349 real(RP),
intent(inout) :: mflx_cloudbase(
ia,
ja)
350 real(RP),
intent(inout) :: sflx_convrain (
ia,
ja)
351 real(RP),
intent(inout) :: cloudtop (
ia,
ja)
352 real(RP),
intent(inout) :: cloudbase (
ia,
ja)
353 real(RP),
intent(inout) :: cldfrac_dp (
ka,
ia,
ja)
354 real(RP),
intent(inout) :: cldfrac_sh (
ka,
ia,
ja)
355 real(RP),
intent(inout) :: nca (
ia,
ja)
356 real(RP),
intent(inout) :: w0avg (
ka,
ia,
ja)
358 real(RP) :: cldfrac(
ka,2)
362 if(
io_l )
write(
io_fid_log,*)
'*** Atmos physics step: Cumulus Parameterization(KF)' 369 time_res_kf = time_res_kf + 1
370 if ( time_res_kf == time_dstep_kf )
then 375 if ( time_dokf )
then 391 rhoq_t_cp(:,:,:,:), &
392 sflx_convrain(:,:), &
403 call hist_in( lifetime(:,:),
'KF_LIFETIME',
'lifetime of KF scheme',
's' )
404 call hist_in(
real(I_convflag(:,:),RP),
'KF_CONVFLAG',
'CONVECTION FLAG',
'' )
425 real(RP),
intent(inout) :: W0_avg(KA,IA,JA)
426 real(RP),
intent(in) :: DENS (KA,IA,JA)
427 real(RP),
intent(in) :: MOMZ (KA,IA,JA)
430 real(RP) :: fact_W0_avg, fact_W0
435 if ( param_atmos_phy_cp_kf_wadapt )
then 439 fact_w0_avg =
real(PARAM_ATMOS_PHY_CP_kf_w_time,RP)
446 w0 = 0.5_rp * ( momz(k,i,j) + momz(k-1,i,j) ) / dens(k,i,j)
448 w0_avg(k,i,j) = ( w0_avg(k,i,j) * fact_w0_avg &
449 + w0 * fact_w0 ) / ( fact_w0_avg + fact_w0 )
458 subroutine cp_kf_param( & ! set kf tuning parametres
461 TRIGGER_in, & ! INOUT
465 SHALLOWLIFETIME_in, &
474 real(RP),
intent(in) :: RATE_in
475 integer,
intent(inout) :: TRIGGER_in
476 real(DP),
intent(in) :: KF_DT_in
477 real(RP),
intent(in) :: DELCAPE_in
478 real(RP),
intent(in) :: DEEPLIFETIME_in
479 real(RP),
intent(in) :: SHALLOWLIFETIME_in
480 real(RP),
intent(in) :: DEPTH_USL_in
481 integer,
intent(in) :: KF_prec_in
482 real(RP),
intent(in) :: KF_threshold_in
483 logical,
intent(in) :: KF_LOG_in
484 integer,
intent(in) :: stepkf_in
488 if (trigger_in /= 1 .and. trigger_in /=3)
then 489 if(
io_l )
write(
io_fid_log,*)
"TRIGGER must be 1 or 3 but now :",trigger_in
496 deeplifetime = deeplifetime_in
497 shallowlifetime = shallowlifetime_in
498 depth_usl = depth_usl_in
500 kf_threshold = kf_threshold_in
503 if (kf_prec == 1)
then 504 p_precipitation => precipitation_oc1973
505 elseif( kf_prec == 2)
then 506 p_precipitation => precipitation_kessler
508 write(*,*)
'xxx ERROR at KF namelist' 509 write(*,*)
'KF_prec must be 1 or 2' 557 thermodyn_temp_pres => atmos_thermodyn_temp_pres, &
558 thermodyn_rhoe => atmos_thermodyn_rhoe, &
559 thermodyn_temp_pres_e => atmos_thermodyn_temp_pres_e, &
560 thermodyn_qd => atmos_thermodyn_qd, &
561 thermodyn_pott => atmos_thermodyn_pott
563 saturation_psat_liq => atmos_saturation_psat_liq
566 real(RP),
intent(in) :: DENS(KA,IA,JA)
567 real(RP),
intent(in) :: MOMZ(KA,IA,JA)
568 real(RP),
intent(in) :: MOMX(KA,IA,JA)
569 real(RP),
intent(in) :: MOMY(KA,IA,JA)
570 real(RP),
intent(in) :: RHOT(KA,IA,JA)
571 real(RP),
intent(in) :: QTRC_in(KA,IA,JA,QA)
572 real(RP),
intent(in) :: w0avg(KA,IA,JA)
574 real(RP),
intent(inout) :: nca(IA,JA)
575 real(RP),
intent(inout) :: DT_DENS(KA,IA,JA)
576 real(RP),
intent(inout) :: DT_RHOT(KA,IA,JA)
577 real(RP),
intent(inout) :: DT_RHOQ(KA,IA,JA,QS_MP:QE_MP)
578 real(RP),
intent(inout) :: rainrate_cp(IA,JA)
579 real(RP),
intent(inout) :: cldfrac_sh(KA,IA,JA)
580 real(RP),
intent(inout) :: cldfrac_dp(KA,IA,JA)
581 real(RP),
intent(inout) :: timecp(IA,JA)
582 real(RP),
intent(inout) :: cloudtop(IA,JA)
583 real(RP),
intent(inout) :: zlcl(IA,JA)
584 integer,
intent(inout) :: I_convflag(IA,JA)
592 real(RP) :: temp (KA)
593 real(RP) :: pres (KA)
595 real(RP) :: QDRY (KA)
597 real(RP) :: PSAT (KA)
598 real(RP) :: QSAT (KA)
600 real(RP) :: deltap(KA)
602 real(RP) :: q_hyd(KA,QA_MP-1)
603 real(RP) :: dens_nw(KA)
605 real(RP) :: time_advec
608 real(RP) :: upent(KA)
609 real(RP) :: updet(KA)
611 real(RP) :: temp_u(KA)
612 real(RP) :: tempv(KA)
618 real(RP) :: qvdet(KA)
619 real(RP) :: qcdet(KA)
620 real(RP) :: qidet(KA)
621 real(RP) :: totalprcp
622 real(RP) :: flux_qr(KA)
623 real(RP) :: flux_qs(KA)
625 real(RP) :: theta_eu(KA)
626 real(RP) :: theta_ee(KA)
632 integer :: k_lc,k_let,k_pbl
635 real(RP) :: umfnewdold(KA)
643 real(RP) :: downent(KA)
644 real(RP) :: downdet(KA)
645 real(RP) :: theta_d(KA)
647 real(RP) :: prcp_flux
652 real(RP) :: temp_g(KA)
653 real(RP) :: qv_nw(KA)
654 real(RP) :: qc_nw(KA)
655 real(RP) :: qi_nw(KA)
656 real(RP) :: qr_nw(KA)
657 real(RP) :: qs_nw(KA)
659 real(RP) :: qtrc_nw(KA,QA)
660 real(RP) :: pott_nw(KA)
662 real(RP) :: cldfrac_KF(KA,2)
665 real(RP) :: QV_resd(KA)
668 integer :: k, i, j, iq, iqa, ii
675 nca(i,j) = nca(i,j) -
real(TIME_DSTEP_KF,RP) * dt
678 if ( nca(i,j) .ge. 0.5_dp * dt ) cycle
682 call thermodyn_temp_pres( temp(k), &
691 call thermodyn_qd( qdry(k), qtrc_in(k,i,j,:),
tracer_mass(:) )
692 rhod(k) = dens(k,i,j) * qdry(k)
695 u(k) = 0.5_rp * ( momx(k,i,j) + momx(k,i-1,j) ) / dens(k,i,j)
696 v(k) = 0.5_rp * ( momy(k,i,j) + momy(k,i,j-1) ) / dens(k,i,j)
700 cloudtop(i,j) = 0.0_rp
702 rainrate_cp(i,j)= 0.0_rp
704 cldfrac_kf(:,:) = 0.0_rp
713 umfnewdold(:) = 0.0_rp
745 psat(k) = aliq*exp((bliq*temp(k)-cliq)/(temp(k)-dliq))
746 qsat(k) = 0.622_rp * psat(k) / ( pres(k) - psat(k) )
750 qv(k) = max( kf_eps, min( qsat(k), qtrc_in(k,i,j,
i_qv) / qdry(k) ) )
751 rh(k) = qv(k) / qsat(k)
757 deltap(k) = rhod(k) * grav * ( fz(k+1,i,j) - fz(k,i,j) )
760 cldfrac_kf(
ks:
ke,:) = 0.0_rp
761 rainrate_cp(i,j) = 0.0_rp
763 cloudtop(i,j) = 0.0_rp
766 call cp_kf_trigger ( &
768 deltaz(:,i,j), z(:,i,j), &
816 if(i_convflag(i,j) /= 2)
then 817 ems(k_top+1:
ke) = 0._rp
818 emsd(k_top+1:
ke) = 0._rp
820 ems(k) = deltap(k)*deltax*deltax/grav
821 emsd(k) = 1._rp/ems(k)
822 umfnewdold(k) = 1._rp/umfnewdold(k)
826 call cp_kf_downdraft ( &
828 deltaz(:,i,j), z(:,i,j) ,&
863 call cp_kf_compensational ( &
865 deltaz(:,i,j),z(:,i,j) ,&
927 if(i_convflag(i,j) == 2)
then 928 rainrate_cp(i,j) = 0.0_rp
929 cldfrac_kf(
ks:
ke,:) = 0.0_rp
931 cloudtop(i,j) = 0.0_rp
935 dt_dens(
ks:
ke,i,j) = 0.0_rp
936 dt_rhot(
ks:
ke,i,j) = 0.0_rp
938 dt_rhoq(
ks:
ke,i,j,iq) = 0.0_rp
949 if (i_convflag(i,j) == 0)
then 950 if (time_advec < timecp(i,j)) nic=nint(time_advec/dt)
951 nca(i,j) =
real(nic,RP)*dt
952 elseif (i_convflag(i,j) == 1)
then 953 timecp(i,j) = shallowlifetime
957 dt_rhoq(:,i,j,:) = 0.0_rp
959 dt_rhoq(k,i,j,
i_qv) = ( rhod(k) * ( qv_nw(k) - qv(k) ) ) / timecp(i,j)
960 dt_rhoq(k,i,j,
i_qc) = qc_nw(k) * rhod(k) / timecp(i,j)
961 dt_rhoq(k,i,j,
i_qr) = qr_nw(k) * rhod(k) / timecp(i,j)
962 dt_dens(k,i,j) = dt_rhoq(k,i,j,
i_qv) + dt_rhoq(k,i,j,
i_qc) + dt_rhoq(k,i,j,
i_qr)
964 dt_rhoq(k,i,j,
i_qi) = qi_nw(k) * rhod(k) / timecp(i,j)
965 dt_dens(k,i,j) = dt_dens(k,i,j) + dt_rhoq(k,i,j,
i_qi)
968 dt_rhoq(k,i,j,
i_qs) = qs_nw(k) * rhod(k) / timecp(i,j)
969 dt_dens(k,i,j) = dt_dens(k,i,j) + dt_rhoq(k,i,j,
i_qs)
972 dens_nw(k) = dens(k,i,j) + dt_dens(k,i,j) * timecp(i,j)
975 qtrc_nw(k,iq) = ( qtrc_in(k,i,j,iq) * dens(k,i,j) + dt_rhoq(k,i,j,iq) * timecp(i,j) ) / dens_nw(k)
978 qtrc_nw(k,iq) = qtrc_in(k,i,j,iq) * dens(k,i,j) / dens_nw(k)
980 do iq = qe_mp + 1, qa
981 qtrc_nw(k,iq) = qtrc_in(k,i,j,iq) * dens(k,i,j) / dens_nw(k)
988 qtrc_nw(k,iq) = qtrc_in(k,i,j,iq)
990 dens_nw(k) = dens(k,i,j)
994 call thermodyn_pott(&
996 temp_g(:), pres(:), qtrc_nw(:,:), &
1000 dt_rhot(k,i,j) = ( dens_nw(k)*pott_nw(k) - rhot(k,i,j) ) / timecp(i,j)
1004 dt_dens(k,i,j) = 0.0_rp
1005 dt_rhot(k,i,j) = 0.0_rp
1006 do iq = qs_mp, qe_mp
1007 dt_rhoq(k,i,j,iq) = 0.0_rp
1015 cldfrac_sh(
ks:
ke,i,j) = cldfrac_kf(
ks:
ke,1)
1016 cldfrac_dp(
ks:
ke,i,j) = cldfrac_kf(
ks:
ke,2)
1026 subroutine cp_kf_trigger ( & !> 1d model ! triger function
1028 dz_kf,z_kf ,& ! deltaz and height [m]
1029 qv ,& ! water vapor mixing ratio [kg/kg]
1030 qes ,& ! saturated vapor [kg/kg]
1031 pres ,& ! pressure [Pa]
1032 deltap ,& ! interval of pressure [Pa]
1033 temp ,& ! temperature [K]
1034 w0avg ,& ! running mean w
1036 I_convflag ,& ! convection flag
1037 cloudtop ,& ! cloud top height [m]
1038 temp_u ,& ! updraft temperature
1039 tempv ,& ! virtual temperature
1041 qv_u ,& ! updraft water vapor mixing ratio
1042 qc ,& ! cloud water mixing ratio
1043 qi ,& ! ice mixingratio
1044 qvdet ,& ! updraft detrain vapor
1045 qcdet ,& ! updraft detrain water
1046 qidet ,& ! updraft detrain ice
1047 flux_qr ,& ! rain flux
1048 flux_qs ,& ! snow flux
1049 totalprcp ,& ! total precipitation (rain and snow fall)
1083 real(RP),
intent(in) :: dz_kf(KA),z_kf(KA)
1084 real(RP),
intent(in) :: qv(KA)
1085 real(RP),
intent(in) :: qes(KA)
1086 real(RP),
intent(in) :: pres(KA)
1087 real(RP),
intent(in) :: deltap(KA)
1088 real(RP),
intent(in) :: temp(KA)
1089 real(RP),
intent(in) :: w0avg(KA)
1092 real(RP),
intent(inout) :: umf(KA)
1093 real(RP),
intent(inout) :: umflcl
1094 real(RP),
intent(inout) :: upent(KA)
1095 real(RP),
intent(inout) :: updet(KA)
1097 real(RP),
intent(inout) :: temp_u(KA)
1098 real(RP),
intent(inout) :: tempv(KA)
1100 real(RP),
intent(inout) :: qv_u(KA)
1101 real(RP),
intent(inout) :: totalprcp
1102 real(RP),
intent(inout) :: cape
1103 real(RP),
intent(inout) :: cloudtop
1104 real(RP) :: cloudhight
1106 real(RP),
intent(inout) :: qc(KA)
1107 real(RP),
intent(inout) :: qi(KA)
1108 real(RP) :: qrout(KA)
1109 real(RP) :: qsout(KA)
1110 real(RP),
intent(inout) :: qvdet(KA)
1111 real(RP),
intent(inout) :: qcdet(KA)
1112 real(RP),
intent(inout) :: qidet(KA)
1113 real(RP),
intent(inout) :: flux_qr(KA)
1114 real(RP),
intent(inout) :: flux_qs(KA)
1116 real(RP),
intent(inout) :: theta_eu(KA)
1117 real(RP),
intent(inout) :: theta_ee(KA)
1119 integer,
intent(inout) :: I_convflag
1124 integer,
intent(inout) :: k_lcl
1125 integer,
intent(inout) :: k_top
1126 integer,
intent(inout) :: k_ml
1127 real(RP),
intent(inout) :: zlcl
1128 integer,
intent(inout) :: k_lc,k_let,k_pbl
1129 real(RP),
intent(inout) :: zmix
1130 real(RP),
intent(inout) :: presmix
1131 real(RP),
intent(inout) :: umfnewdold(KA)
1133 real(RP),
intent(inout) :: dpthmx
1136 integer,
parameter :: itr_max = 10000
1144 integer :: n_uslcheck
1148 real(RP) :: theta_mix
1149 real(RP) :: temp_mix
1153 real(RP) :: temp_dew
1156 real(RP) :: temp_env
1157 real(RP) :: tempv_env
1162 real(RP) :: temp_lcl
1163 real(RP) :: tempv_lcl
1164 real(RP) :: pres_lcl
1172 real(RP) :: umfnew,umfold
1175 integer :: k_check(KA)
1182 real(RP) :: CLDHGT(KA)
1194 pres300 = pres(
ks) - depth_usl*100._rp
1196 tempv(kk) = temp(kk)*(1._rp + 0.608_rp*qv(kk))
1201 if (pres(kk) >= pres300) k_llfc = kk
1206 pres15 = pres(
ks) - 15.e2_rp
1209 do kk =
ks+1, k_llfc
1210 if(pres(kk) < pres15 )
then 1211 n_check = n_check + 1
1212 k_check(n_check) = kk
1213 pres15 = pres15 - 15.e2_rp
1226 n_uslcheck = n_uslcheck + 1
1230 if (n_uslcheck > n_check)
then 1231 if (i_convflag == 1)
then 1236 if (cldhgt(nnn) > chmax)
then 1242 n_uslcheck = nuchm - 1
1250 k_lc = k_check(n_uslcheck)
1257 if ( nk + 1 <
ks )
then 1259 if(
io_l )
write(
io_fid_log,*)
'would go off bottom: cu_kf',pres(
ks),k_lc,nk+1,n_uslcheck
1270 dpthmx = dpthmx + deltap(nk)
1271 n_layers = n_layers + 1
1272 if (dpthmx > dpthmin)
then 1277 if (dpthmx < dpthmin)
then 1281 k_pbl = k_lc + n_layers -1
1283 theta_mix = 0._rp; temp_mix = 0._rp; qv_mix = 0._rp; zmix = 0._rp;presmix = 0._rp
1286 temp_mix = temp_mix + deltap(kk)*temp(kk)
1287 qv_mix = qv_mix + deltap(kk)*qv(kk)
1288 zmix = zmix + deltap(kk)*z_kf(kk)
1289 presmix = presmix + deltap(kk)*pres(kk)
1292 temp_mix = temp_mix/dpthmx
1293 qv_mix = qv_mix/dpthmx
1294 presmix = presmix/dpthmx
1296 emix = qv_mix*presmix/(0.622_rp + qv_mix)
1300 templog = log(emix/aliq)
1301 temp_dew = (cliq - dliq*templog)/(bliq - templog)
1304 temp_lcl = temp_dew - (0.212_rp + 1.571e-3_rp*(temp_dew - tem00) &
1305 - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - temp_dew)
1306 temp_lcl = min(temp_lcl,temp_mix)
1307 tempv_lcl = temp_lcl*(1._rp + 0.608_rp*qv_mix)
1308 zlcl = zmix + (temp_lcl - temp_mix)/gdcp
1313 if( zlcl <= z_kf(kk) )
exit 1316 if (zlcl > z_kf(
ke))
then 1321 deltaz = ( zlcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
1322 temp_env = temp(k_lclm1) + ( temp(k_lcl) - temp(k_lclm1) )*deltaz
1323 qvenv = qv(k_lclm1) + ( qv(k_lcl) - qv(k_lclm1) )*deltaz
1324 tempv_env = temp_env*( 1._rp + 0.608_rp*qvenv )
1329 if (zlcl < 2.e3_rp)
then 1331 w_cz = 1.e-5_rp*zlcl
1338 w_g = (w0avg(k_lclm1) + (w0avg(k_lcl) - w0avg(k_lclm1))*deltaz )*deltax/25.e3_rp - w_cz
1339 if ( w_g < 1.e-4_rp)
then 1342 dtvv = 4.64_rp*w_g**0.33_rp
1347 if ( trigger == 2)
then 1348 else if ( trigger == 3)
then 1356 if(u00 < 1._rp)
then 1357 qs_lcl=qes(k_lclm1)+(qes(k_lcl)-qes(k_lclm1))*deltaz
1358 rh_lcl = qvenv/qs_lcl
1359 dqssdt = qv_mix*(cliq-bliq*dliq)/((temp_lcl-dliq)*(temp_lcl-dliq))
1360 if(rh_lcl >= 0.75_rp .and. rh_lcl <=0.95_rp)
then 1361 dtrh = 0.25_rp*(rh_lcl-0.75_rp)*qv_mix/dqssdt
1362 elseif(rh_lcl > 0.95_rp)
then 1363 dtrh = (1._rp/rh_lcl-1._rp)*qv_mix/dqssdt
1370 if (temp_lcl + dtvv + dtrh < temp_env)
then 1378 call envirtht(presmix,temp_mix,qv_mix,theta_eu(k_lclm1))
1380 if (dtvv + dtrh > 1.e-4_rp )
then 1381 w_lcl = 1._rp + 0.5_rp*sqrt(2._rp*grav*(dtvv + dtrh)*500._rp/tempv_env)
1382 w_lcl = min(w_lcl,3._rp)
1388 pres_lcl = pres(k_lclm1) + (pres(k_lcl) - pres(k_lclm1))*deltaz
1391 if (w_g < 0._rp )
then 1393 elseif (w_g > 0.1_rp)
then 1396 radius = 1000._rp + 1000._rp*w_g*10._rp
1401 call cp_kf_updraft ( &
1452 cldhgt(k_lc) = cloudhight
1455 if(temp_lcl > 293._rp)
then 1457 elseif (temp_lcl < 293._rp .and. temp_lcl > 273._rp)
then 1458 d_min = 2.e3_rp + 100._rp*(temp_lcl - tem00)
1464 if ( k_top <= k_lcl .or. &
1465 k_top <= k_pbl .or. &
1466 k_let+1 <= k_pbl )
then 1468 cldhgt(k_lc) = cloudhight
1469 do kk = k_lclm1,k_top
1478 elseif (cloudhight > d_min .and. cape > 1._rp)
then 1487 if(n_uslcheck == nuchm)
then 1490 do kk = k_lclm1,k_top
1503 if ( itr .ge. itr_max )
then 1504 write(*,*)
'xxx iteration max count was reached in the USL loop in the KF scheme' 1509 if (i_convflag == 1)
then 1510 k_start = max(k_pbl,k_lcl)
1517 if (k_let == k_top)
then 1518 updet(k_top) = umf(k_top) + updet(k_top) - upent(k_top)
1519 qcdet(k_top) = qc(k_top)*updet(k_top)*umfnew/umfold
1520 qidet(k_top) = qi(k_top)*updet(k_top)*umfnew/umfold
1521 upent(k_top) = 0._rp
1526 do kk = k_let+1,k_top
1527 dptt = dptt + deltap(kk)
1529 dumfdp = umf(k_let)/dptt
1539 do kk = k_let+1,k_top
1540 if(kk == k_top)
then 1541 updet(kk) = umf(kk-1)
1543 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1544 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1546 umf(kk) = umf(kk-1) - deltap(kk)*dumfdp
1547 upent(kk) = umf(kk)*(1._rp - 1._rp/umfnewdold(kk))
1548 updet(kk) = umf(kk-1) - umf(kk) + upent(kk)
1549 qcdet(kk) = updet(kk)*qc(kk)*umfnewdold(kk)
1550 qidet(kk) = updet(kk)*qi(kk)*umfnewdold(kk)
1552 if (kk >= k_let+2)
then 1553 totalprcp = totalprcp - flux_qr(kk) - flux_qs(kk)
1554 flux_qr(kk) = umf(kk-1)*qrout(kk)
1555 flux_qs(kk) = umf(kk-1)*qsout(kk)
1556 totalprcp = totalprcp + flux_qr(kk) + flux_qs(kk)
1567 if(temp(kk) > tem00) k_ml = kk
1574 if (kk == k_lc)
then 1575 upent(kk) = umflcl*deltap(kk)/dpthmx
1576 umf(kk) = umflcl*deltap(kk)/dpthmx
1577 elseif (kk <= k_pbl)
then 1578 upent(kk) = umflcl*deltap(kk)/dpthmx
1579 umf(kk) = umf(kk-1) + upent(kk)
1585 temp_u(kk) = temp_mix + (z_kf(kk) - zmix)*gdcp
1606 call envirtht(pres(kk),temp(kk),qv(kk),theta_ee(kk))
1631 end subroutine cp_kf_trigger
1635 subroutine cp_kf_updraft (& ! 1d model updraft
1637 umf ,& ! upward mass flux(updraft)
1688 real(RP),
intent(out) :: umf(KA)
1689 real(RP),
intent(out) :: umflcl
1690 real(RP),
intent(out) :: upent(KA)
1691 real(RP),
intent(out) :: updet(KA)
1692 real(RP),
intent(out) :: umfnewdold(KA)
1693 real(RP),
intent(out) :: umfnew,umfold
1694 real(RP),
intent(out) :: temp_u(KA)
1695 real(RP),
intent(out) :: theta_ee(KA)
1696 real(RP),
intent(inout) :: theta_eu(KA)
1697 real(RP),
intent(out) :: cloudhight
1698 real(RP),
intent(out) :: totalprcp
1699 real(RP),
intent(out) :: cloudtop
1700 real(RP),
intent(out) :: qv_u(KA)
1701 real(RP),
intent(out) :: qc(KA)
1702 real(RP),
intent(out) :: qi(KA)
1703 real(RP),
intent(out) :: qrout(KA)
1704 real(RP),
intent(out) :: qsout(KA)
1705 real(RP),
intent(out) :: qvdet(KA)
1706 real(RP),
intent(out) :: qcdet(KA)
1707 real(RP),
intent(out) :: qidet(KA)
1708 real(RP),
intent(out) :: cape
1709 real(RP),
intent(out) :: flux_qr(KA)
1710 real(RP),
intent(out) :: flux_qs(KA)
1711 integer,
intent(out) :: k_top
1712 integer,
intent(inout) :: k_let
1714 real(RP),
intent(in) :: dz_kf(KA),z_kf(KA)
1716 real(RP),
intent(in) :: w_lcl
1717 real(RP),
intent(in) :: temp_lcl
1718 real(RP),
intent(in) :: tempv_lcl
1719 real(RP),
intent(in) :: pres_lcl
1720 real(RP),
intent(in) :: qv_mix
1721 real(RP),
intent(in) :: qv(KA)
1722 real(RP),
intent(in) :: temp(KA)
1723 real(RP),
intent(in) :: tempv_env
1724 real(RP),
intent(in) :: zlcl
1725 real(RP),
intent(in) :: pres(KA)
1726 real(RP),
intent(in) :: deltap(KA)
1727 real(RP),
intent(in) :: radius
1728 real(RP),
intent(in) :: dpthmx
1729 integer ,
intent(in) :: k_lcl
1730 integer ,
intent(in) :: k_pbl
1734 real(RP) :: tempv_u(KA)
1735 real(RP) :: tempvq_u(KA)
1737 real(RP) :: ee1,ud1, ee2,ud2
1738 real(RP) :: f_eq(KA)
1739 real(RP) :: f_mix1,f_mix2
1740 real(RP) :: REI,DILBE
1741 real(RP) :: qcnew,qinew
1743 real(RP) :: f_frozen1
1745 real(RP) :: temptmp_ice
1746 real(RP) :: tempv(KA)
1752 real(RP) :: theta_tmp
1754 real(RP) :: qvtmp, qctmp, qitmp
1755 real(RP) :: temp_u95, temp_u10
1756 real(RP),
parameter :: temp_frzT = 268.16_rp
1757 real(RP),
parameter :: temp_frzB = 248.16_rp
1786 tempv(kk) = temp(kk)*(1._rp + 0.608_rp*qv(kk))
1789 umfnewdold(:) = 1._rp
1792 denslcl = pres_lcl/(r*tempv_lcl)
1793 umf(k_lclm1) = denslcl*1.e-2_rp*deltax*deltax
1794 umflcl = umf(k_lclm1)
1798 temp_u(k_lclm1) = temp_lcl
1799 tempv_u(k_lclm1) = tempv_lcl
1800 qv_u(k_lclm1) = qv_mix
1807 temptmp_ice = temp_frzt
1811 do kk = k_lclm1,
ke-1
1815 temp_u(kkp1) = temp(kkp1)
1816 theta_eu(kkp1) = theta_eu(kk)
1817 qv_u(kkp1) = qv_u(kk)
1824 call tpmix2(pres(kkp1),theta_eu(kkp1),temp_u(kkp1),qv_u(kkp1),qc(kkp1),qi(kkp1),qcnew,qinew)
1830 if (temp_u(kkp1) <= temp_frzt )
then 1831 if (temp_u(kkp1) > temp_frzb)
then 1832 if (temptmp_ice > temp_frzt) temptmp_ice = temp_frzt
1834 f_frozen1 = (temptmp_ice - temp_u(kkp1))/(temptmp_ice - temp_frzb)
1838 f_frozen1 = min(1._rp, max(0._rp, f_frozen1))
1839 temptmp_ice = temp_u(kkp1)
1841 qfrz = (qc(kkp1) + qcnew)*f_frozen1
1842 qinew = qinew + qcnew*f_frozen1
1843 qcnew = qcnew - qcnew*f_frozen1
1844 qi(kkp1) = qi(kkp1) + qc(kkp1)*f_frozen1
1845 qc(kkp1) = qc(kkp1) - qc(kkp1)*f_frozen1
1848 call dtfrznew(temp_u(kkp1), pres(kkp1),theta_eu(kkp1),qv_u(kkp1),qfrz,qi(kkp1) )
1850 tempv_u(kkp1) = temp_u(kkp1)*(1._rp + 0.608_rp*qv_u(kkp1))
1852 if (kk == k_lclm1)
then 1853 boeff = (tempv_lcl + tempv_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp
1854 boterm = 2._rp*(z_kf(kkp1) - zlcl)*grav*boeff/1.5_rp
1855 dztmp = z_kf(kkp1) - zlcl
1857 boeff = (tempv_u(kk) + tempv_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp
1858 boterm = 2._rp*(dz_kf(kk) )*grav*boeff/1.5_rp
1862 entterm = 2._rp*rei*wtw/umfold
1864 call p_precipitation(&
1865 qc(kkp1), qi(kkp1), wtw, dztmp, boterm, entterm, qcnew, qinew, qrout(kkp1), &
1871 if (wtw < 1.e-3_rp )
then 1874 wu(kkp1) = sqrt(wtw)
1877 call envirtht(pres(kkp1),temp(kkp1),qv(kkp1),theta_ee(kkp1))
1879 rei = umflcl*deltap(kkp1)*0.03_rp/radius
1883 tempvq_u(kkp1) = temp_u(kkp1)*(1._rp + 0.608_rp*qv_u(kkp1) - qc(kkp1) - qi(kkp1))
1884 if (kk == k_lclm1) then
1885 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv(kkp1)) - 1._rp)*dztmp
1887 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv(kk) + tempv(kkp1)) - 1._rp)*dztmp
1889 if(dilbe > 0._rp) cape = cape + dilbe*grav
1896 if(tempvq_u(kkp1) <= tempv(kkp1))
then 1903 temptmp = tempvq_u(kkp1)
1907 f_mix2 = 1._rp - f_mix1
1908 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1909 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1910 qctmp = f_mix2*qc(kkp1)
1911 qitmp = f_mix2*qi(kkp1)
1913 call tpmix2(pres(kkp1),theta_tmp,temptmp,qvtmp,qctmp,qitmp,qcnew,qinew)
1915 temp_u95 = temptmp*(1._rp + 0.608_rp*qvtmp - qctmp - qitmp)
1917 if ( temp_u95 > tempv(kkp1))
then 1923 f_mix2 = 1._rp - f_mix1
1924 theta_tmp = f_mix1*theta_ee(kkp1) + f_mix2*theta_eu(kkp1)
1925 qvtmp = f_mix1*qv(kkp1) + f_mix2*qv_u(kkp1)
1926 qctmp = f_mix2*qc(kkp1)
1927 qitmp = f_mix2*qi(kkp1)
1929 call tpmix2(pres(kkp1),theta_tmp,temptmp,qvtmp,qctmp,qitmp,qcnew,qinew)
1931 temp_u10 = temptmp*(1._rp + 0.608_rp*qvtmp - qctmp - qitmp)
1932 if (abs(temp_u10 - tempvq_u(kkp1)) < 1.e-3_rp )
then 1937 f_eq(kkp1) = (tempv(kkp1) - tempvq_u(kkp1))*f_mix1 &
1938 & /(temp_u10 - tempvq_u(kkp1))
1939 f_eq(kkp1) = max(0._rp,f_eq(kkp1) )
1940 f_eq(kkp1) = min(1._rp,f_eq(kkp1) )
1941 if (f_eq(kkp1) == 1._rp)
then 1944 elseif (f_eq(kkp1) == 0._rp)
then 1950 call prof5(f_eq(kkp1),ee2,ud2)
1955 ee2 = max(ee2,0.5_rp)
1958 upent(kkp1) = 0.5_rp*rei*(ee1 + ee2)
1959 updet(kkp1) = 0.5_rp*rei*(ud1 + ud2)
1962 if (umf(kk) - updet(kkp1) < 10._rp)
then 1966 if (dilbe > 0._rp)
then 1967 cape = cape - dilbe*grav
1974 umfold = umf(kk) - updet(kkp1)
1975 umfnew = umfold + upent(kkp1)
1977 umfnewdold(kkp1) = umfnew/umfold
1978 qcdet(kkp1) = qc(kkp1)*updet(kkp1)
1979 qidet(kkp1) = qi(kkp1)*updet(kkp1)
1980 qvdet(kkp1) = qv_u(kkp1)
1982 qv_u(kkp1) = (umfold*qv_u(kkp1) + upent(kkp1)*qv(kkp1))/umfnew
1983 theta_eu(kkp1) = (umfold*theta_eu(kkp1) + upent(kkp1)*theta_ee(kkp1))/umfnew
1986 qc(kkp1) = qc(kkp1)*umfold/umfnew
1987 qi(kkp1) = qi(kkp1)*umfold/umfnew
1990 flux_qr(kkp1) = qrout(kkp1)*umf(kk)
1991 flux_qs(kkp1) = qsout(kkp1)*umf(kk)
1992 totalprcp = totalprcp + flux_qr(kkp1) + flux_qs(kkp1)
1995 if(kkp1 <= k_pbl ) upent(kkp1) = upent(kkp1) + umflcl*deltap(kkp1)/dpthmx
2000 cloudhight = z_kf(k_top) - zlcl
2001 cloudtop = z_kf(k_top)
2004 end subroutine cp_kf_updraft
2008 subroutine cp_kf_downdraft ( &
2011 u ,& ! x-direction wind
2012 v ,& ! meridional wind
2013 zlcl ,& ! lcl_hight [m]
2014 rh ,& ! relative humidity initial make kf_init
2016 pres ,& ! pressure [Pa]
2020 theta_ee ,& ! environment equivalent theta
2021 umf ,& ! upward mass flux
2022 totalprcp ,& ! total precipitation
2025 I_convflag ,& ! convection flag
2034 wspd ,& ! wind speed 1 k_lcl, 2 k_z5,3 k_top
2053 atmos_saturation_psat_liq
2059 real(RP),
intent(in) :: dz_kf(KA),z_kf(KA)
2060 real(RP),
intent(in) :: u(KA)
2061 real(RP),
intent(in) :: v(KA)
2062 real(RP),
intent(in) :: rh(KA)
2063 real(RP),
intent(in) :: deltap(KA)
2064 real(RP),
intent(in) :: pres(KA)
2065 real(RP),
intent(in) :: qv(KA)
2066 real(RP),
intent(in) :: ems(KA)
2067 real(RP),
intent(in) :: emsd(KA)
2069 real(RP),
intent(in) :: zlcl
2070 real(RP),
intent(in) :: umf(KA)
2071 real(RP),
intent(in) :: totalprcp
2072 real(RP),
intent(in) :: flux_qs(KA)
2073 real(RP),
intent(in) :: tempv(KA)
2074 real(RP),
intent(in) :: theta_ee(KA)
2077 integer,
intent(in) :: I_convflag
2078 integer,
intent(in) :: k_lcl
2079 integer,
intent(in) :: k_top
2080 integer,
intent(in) :: k_pbl
2081 integer,
intent(in) :: k_let
2082 integer,
intent(in) :: k_lc
2083 integer,
intent(in) :: k_ml
2085 real(RP),
intent(out) :: wspd(3)
2086 real(RP),
intent(out) :: dmf(KA)
2087 real(RP),
intent(out) :: downent(KA)
2088 real(RP),
intent(out) :: downdet(KA)
2089 real(RP),
intent(out) :: theta_d(KA)
2090 real(RP),
intent(out) :: qv_d(KA)
2091 real(RP),
intent(out) :: prcp_flux
2092 real(RP),
intent(out) :: tder
2093 real(RP),
intent(out) :: CPR
2094 integer,
intent(out) :: k_lfs
2100 real(RP) :: pef_wind
2101 real(RP) :: pef_cloud
2117 real(RP) :: temp_d(KA)
2118 real(RP) :: tempv_d(KA)
2119 real(RP) :: theta_ed(KA)
2120 real(RP) :: qvsd(KA)
2124 real(RP) :: dtempmlt
2150 if (i_convflag == 2)
return 2154 if (pres(kk) >= pres(
ks)*0.5_rp) k_z5 = kk
2157 wspd(1) = sqrt(u(k_lcl)*u(k_lcl) + v(k_lcl)*v(k_lcl))
2158 wspd(2) = sqrt(u(k_z5)*u(k_z5) + v(k_z5)*v(k_z5))
2159 wspd(3) = sqrt(u(k_top)*u(k_top) + v(k_top)*v(k_top))
2164 if(wspd(3) > wspd(1))
then 2169 vws = (u(k_top) - u(k_lcl))*(u(k_top) - u(k_lcl)) &
2170 + (v(k_top) - v(k_lcl))*(v(k_top) - v(k_lcl))
2172 vws = 1.e3_rp*shsign*sqrt(vws)/(z_kf(k_top) - z_kf(k_lcl))
2175 pef_wind = 1.591_rp + vws*(-0.639_rp + vws*(9.53e-2_rp - vws*4.96e-3_rp) )
2177 pef_wind = max(pef_wind,0.2_rp)
2178 pef_wind = min(pef_wind,0.9_rp)
2182 cbh = (zlcl - z_kf(
ks))*3.281e-3_rp
2183 if( cbh < 3._rp)
then 2186 rcbh = 0.96729352_rp + cbh*(-0.70034167_rp + cbh*(0.162179896_rp + cbh*(- &
2187 1.2569798e-2_rp + cbh*(4.2772e-4_rp - cbh*5.44e-6_rp))))
2189 if(cbh > 25.0_rp) rcbh = 2.4_rp
2190 pef_cloud = 1._rp/(1._rp + rcbh)
2191 pef_cloud = min(pef_cloud,0.9_rp)
2193 pef = 0.5_rp*(pef_wind + pef_cloud)
2198 if(i_convflag == 1)
then 2202 k_dstart = k_pbl + 1
2203 k_lfstmp = k_let - 1
2204 do kk = k_dstart+1,
ke 2205 dpthtmp = pres(k_dstart) - pres(kk)
2206 if(dpthtmp > 150.e2_rp)
then 2211 k_lfstmp = min(k_lfstmp, k_let - 1)
2218 if(pres(k_dstart) - pres(k_lfs) > 50.e2_rp)
then 2219 theta_ed(k_lfs) = theta_ee(k_lfs)
2220 qv_d(k_lfs) = qv(k_lfs)
2222 call tpmix2dd(pres(k_lfs),theta_ed(k_lfs),temp_d(k_lfs),qvs_tmp)
2223 call calcexn(pres(k_lfs),qvs_tmp,exn(k_lfs))
2227 theta_d(k_lfs) = temp_d(k_lfs)*exn(k_lfs)
2229 tempv_d(k_lfs) = temp_d(k_lfs)*(1._rp + 0.608_rp*qvs_tmp)
2230 dens_d = pres(k_lfs)/(r*tempv_d(k_lfs))
2231 dmf(k_lfs) = -(1._rp - pef)*1.e-2_rp*deltax*deltax*dens_d
2232 downent(k_lfs) = dmf(k_lfs)
2233 downdet(k_lfs) = 0._rp
2234 rhbar = rh(k_lfs)*deltap(k_lfs)
2235 dpthtmp = deltap(k_lfs)
2239 do kk = k_lfs-1,k_dstart,-1
2241 downent(kk) = downent(k_lfs)*ems(kk)/ems(k_lfs)
2243 dmf(kk) = dmf(kkp1) + downent(kk)
2244 theta_ed(kk) = ( theta_ed(kkp1)*dmf(kkp1) + theta_ee(kk)*downent(kk) )/dmf(kk)
2245 qv_d(kk) = ( qv_d(kkp1)*dmf(kkp1) + qv(kk)*downent(kk) )/dmf(kk)
2246 dpthtmp = dpthtmp + deltap(kk)
2247 rhbar = rhbar + rh(kk)*deltap(kk)
2249 rhbar = rhbar/dpthtmp
2250 f_dmf = 2._rp*(1._rp - rhbar)
2256 prcpmlt = prcpmlt + flux_qs(kk)
2258 if (k_lc < k_ml )
then 2261 dtempmlt = emelt*prcpmlt/(cp*umf(k_lcl))
2265 call tpmix2dd(pres(k_dstart),theta_ed(k_dstart),temp_d(k_dstart),qvs_tmp)
2266 temp_d(k_dstart) = temp_d(k_dstart) - dtempmlt
2271 es = aliq*exp((bliq*temp_d(k_dstart)-cliq)/(temp_d(k_dstart)-dliq))
2273 qvs_tmp = 0.622_rp*es/(pres(k_dstart) - es )
2275 theta_ed(k_dstart) = temp_d(k_dstart)*(pre00/pres(k_dstart))**(0.2854_rp*(1._rp - 0.28_rp*qvs_tmp))* &
2276 & exp((3374.6525_rp/temp_d(k_dstart)-2.5403_rp)*qvs_tmp*(1._rp + 0.81_rp*qvs_tmp))
2277 k_ldt = min(k_lfs-1, k_dstart-1)
2281 dpthdet = dpthdet + deltap(kk)
2282 theta_ed(kk) = theta_ed(k_dstart)
2283 qv_d(kk) = qv_d(k_dstart)
2284 call tpmix2dd(pres(kk),theta_ed(kk),temp_d(kk),qvs_tmp)
2287 rhh = 1._rp - 2.e-4_rp*(z_kf(k_dstart) -z_kf(kk) )
2292 if(rhh < 1._rp)
then 2294 dssdt = (cliq - bliq*dliq)/((temp_d(kk) - dliq)*(temp_d(kk) - dliq))
2295 rl = xlv0 - xlv1*temp_d(kk)
2296 dtmp = rl*qvs_tmp*(1._rp - rhh )/(cp + rl*rhh*qvs_tmp*dssdt )
2297 t1rh = temp_d(kk) + dtmp
2301 es = aliq*exp((bliq*t1rh-cliq)/(t1rh-dliq))
2304 qsrh = 0.622_rp*es/(pres(kk) - es)
2305 if(qsrh < qv_d(kk) )
then 2307 t1rh = temp_d(kk) + (qvs_tmp - qsrh)*rl/cp
2316 tempv_d(kk) = temp_d(kk)*( 1._rp + 0.608_rp*qvsd(kk) )
2317 if(tempv_d(kk) > tempv(kk) .or. kk ==
ks)
then 2323 if((pres(k_ldb)-pres(k_lfs)) > 50.e2_rp )
then 2324 do kk = k_ldt,k_ldb,-1
2326 downdet(kk) = -dmf(k_dstart)*deltap(kk)/dpthdet
2328 dmf(kk) = dmf(kkp1) + downdet(kk)
2329 tder = tder + (qvsd(kk) - qv_d(kk))*downdet(kk)
2331 call calcexn(pres(kk),qv_d(kk),exn(kk))
2332 theta_d(kk) = temp_d(kk)*exn(kk)
2341 if (tder < 1._rp)
then 2342 prcp_flux = totalprcp
2355 ddinc = -f_dmf*umf(k_lcl)/dmf(k_dstart)
2356 if(tder*ddinc > totalprcp)
then 2357 ddinc = totalprcp/tder
2361 dmf(kk) = dmf(kk)*ddinc
2362 downent(kk) = downent(kk)*ddinc
2363 downdet(kk) = downdet(kk)*ddinc
2366 prcp_flux = totalprcp - tder
2367 if ( totalprcp < kf_eps )
then 2370 pef = prcp_flux/totalprcp
2390 if (k_ldb >
ks)
then 2410 do kk = k_ldt+1,k_lfs-1
2418 end subroutine cp_kf_downdraft
2425 subroutine cp_kf_compensational (&
2430 temp_bf ,& ! temperature
2435 presmix ,& ! usl layer pressure depth
2436 zmix ,& ! usl layer pressure depth
2437 dpthmx ,& ! usl layer depth
2439 temp_u ,& ! updraft temperature
2440 qvdet ,& ! updraft water vapor
2441 umflcl ,& ! umf @LCL
2443 upent ,& ! updraft entrainment
2444 updet ,& ! updraft detrainment
2445 qcdet ,& ! updraft detrainment qc
2446 qidet ,& ! updraft detrainment qi
2449 flux_qr ,& ! rain flux
2450 flux_qs ,& ! snow flux
2451 umfnewdold ,& ! 1/(umfnew/umfold ratio)
2492 atmos_saturation_psat_liq
2500 real(RP),
intent(in) :: dz_kf(KA),z_kf(KA)
2501 real(RP),
intent(in) :: pres(KA)
2502 real(RP),
intent(in) :: deltap(KA)
2503 real(RP),
intent(in) :: temp_bf(KA)
2504 real(RP),
intent(in) :: qv(KA)
2505 real(RP),
intent(in) :: ems(KA)
2506 real(RP),
intent(in) :: emsd(KA)
2508 real(RP),
intent(in) :: presmix
2509 real(RP),
intent(in) :: zmix
2510 real(RP),
intent(in) :: dpthmx
2511 real(RP),
intent(in) :: cape
2512 real(RP),
intent(in) :: temp_u(KA)
2513 real(RP),
intent(in) :: qvdet(KA)
2514 real(RP),
intent(in) :: umflcl
2515 real(RP),
intent(inout) :: umf(KA)
2516 real(RP),
intent(inout) :: upent(KA)
2517 real(RP),
intent(inout) :: updet(KA)
2518 real(RP),
intent(inout) :: qcdet(KA)
2519 real(RP),
intent(inout) :: qidet(KA)
2520 real(RP),
intent(in) :: qc(KA)
2521 real(RP),
intent(in) :: qi(KA)
2522 real(RP),
intent(in) :: flux_qr(KA)
2523 real(RP),
intent(in) :: flux_qs(KA)
2524 real(RP),
intent(in) :: umfnewdold(KA)
2526 real(RP),
intent(in) :: wspd(3)
2527 real(RP),
intent(inout) :: dmf(KA)
2528 real(RP),
intent(inout) :: downent(KA)
2529 real(RP),
intent(inout) :: downdet(KA)
2530 real(RP),
intent(in) :: qv_d(KA)
2531 real(RP),
intent(in) :: theta_d(KA)
2532 real(RP),
intent(inout) :: prcp_flux
2533 real(RP),
intent(inout) :: tder
2534 real(RP),
intent(in) :: cpr
2535 integer,
intent(inout) :: I_convflag
2537 integer,
intent(in) :: k_top
2538 integer,
intent(inout) :: k_lcl_bf
2539 integer,
intent(in) :: k_lc
2540 integer,
intent(in) :: k_pbl
2541 integer,
intent(in) :: k_ml
2542 integer,
intent(in) :: k_lfs
2544 real(RP),
intent(out) :: temp_g(KA)
2545 real(RP),
intent(out) :: qv_g(KA)
2546 real(RP),
intent(out) :: qc_nw(KA)
2547 real(RP),
intent(out) :: qi_nw(KA)
2548 real(RP),
intent(out) :: qr_nw(KA)
2549 real(RP),
intent(out) :: qs_nw(KA)
2550 integer,
intent (out) :: nic
2552 real(RP),
intent(out) :: rainrate_cp
2553 real(RP),
intent(out) :: cldfrac_KF(KA,2)
2554 real(RP),
intent(out) :: timecp
2555 real(RP),
intent(out) :: time_advec
2558 real(RP) :: umf2(KA)
2559 real(RP) :: upent2(KA)
2560 real(RP) :: updet2(KA)
2561 real(RP) :: qcdet2(KA)
2562 real(RP) :: qidet2(KA)
2563 real(RP) :: dmf2(KA)
2564 real(RP) :: downent2(KA)
2565 real(RP) :: downdet2(KA)
2566 real(RP) :: prcp_flux2
2571 real(RP) :: theta(KA)
2572 real(RP) :: theta_u(KA)
2573 real(RP) :: theta_eu(KA)
2574 real(RP) :: theta_eg(KA)
2578 real(RP) :: qv_gu(KA)
2579 real(RP) :: temp_env
2580 real(RP) :: tempv_env
2581 real(RP) :: temp_lcl
2582 real(RP) :: tempv_lcl
2583 real(RP) :: temp_mix
2584 real(RP) :: temp_gu(KA)
2585 real(RP) :: tempv_g(KA)
2586 real(RP) :: tempvq_u(KA)
2590 real(RP) :: DQ,TDPT,DSSDT,emix,RL,TLOG
2596 integer :: k_lcl,k_lclm1
2599 real(RP) :: theta_nw(KA)
2600 real(RP) :: theta_g(KA)
2601 real(RP) :: qv_nw(KA)
2606 real(RP) :: f_cape ,f_capeold
2613 integer :: ntimecount
2619 real(RP) :: tma,tmb,tmm
2620 real(RP) :: acoeff,bcoeff
2622 real(RP) :: ainc,ainctmp, aincmx,aincold
2628 real(RP) :: domg_dp(KA)
2629 real(RP) :: absomgtc,absomg
2632 real(RP) :: theta_fxin(KA)
2633 real(RP) :: theta_fxout(KA)
2634 real(RP) :: qv_fxin(KA)
2635 real(RP) :: qv_fxout(KA)
2636 real(RP) :: qc_fxin(KA)
2637 real(RP) :: qc_fxout(KA)
2638 real(RP) :: qi_fxin(KA)
2639 real(RP) :: qi_fxout(KA)
2640 real(RP) :: qr_fxin(KA)
2641 real(RP) :: qr_fxout(KA)
2642 real(RP) :: qs_fxin(KA)
2643 real(RP) :: qs_fxout(KA)
2644 real(RP) :: rainfb(KA)
2645 real(RP) :: snowfb(KA)
2656 real(RP) :: xcldfrac
2662 if(i_convflag == 2)
return 2666 if(i_convflag == 1) fbfrc = 1._rp
2669 vconv = 0.5_rp*(wspd(1) + wspd(2))
2670 timecp = deltax/vconv
2673 timecp = max(deeplifetime, timecp)
2674 timecp = min(3600._rp, timecp)
2675 if(i_convflag == 1) timecp = shallowlifetime
2676 nic = nint(timecp/dt)
2679 timecp =
real( nic,RP )*dt
2683 k_lmax = max(k_lcl,k_lfs)
2685 if((upent(kk)-downent(kk)) > 1.e-3_rp)
then 2686 ainctmp = ems(kk)/( (upent(kk) -downent(kk))*timecp )
2687 aincmx = min(aincmx,ainctmp)
2691 if(aincmx < ainc ) ainc = aincmx
2694 prcp_flux2 = prcp_flux
2697 upent2(kk) = upent(kk)
2698 updet2(kk) = updet(kk)
2699 qcdet2(kk) = qcdet(kk)
2700 qidet2(kk) = qidet(kk)
2702 downent2(kk) = downent(kk)
2703 downdet2(kk) = downdet(kk)
2706 stab = 1.05_rp - delcape
2709 if (i_convflag == 1)
then 2712 evac = 0.50_rp*tkemax*1.e-1_rp
2713 ainc = evac*dpthmx*deltax*deltax/( umflcl*grav*timecp)
2715 prcp_flux = prcp_flux2*ainc
2717 umf(kk) = umf2(kk)*ainc
2718 upent(kk) = upent2(kk)*ainc
2719 updet(kk) = updet2(kk)*ainc
2720 qcdet(kk) = qcdet2(kk)*ainc
2721 qidet(kk) = qidet2(kk)*ainc
2722 dmf(kk) = dmf2(kk)*ainc
2723 downent(kk) = downent2(kk)*ainc
2724 downdet(kk) = downdet2(kk)*ainc
2730 call calcexn(pres(kk),qv(kk),exn(kk))
2731 theta(kk) = temp_bf(kk)*exn(kk)
2732 call calcexn(pres(kk),qvdet(kk),exn(kk))
2733 theta_u(kk) = temp_u(kk)*exn(kk)
2735 temp_g(k_top+1:
ke) = temp_bf(k_top+1:
ke)
2736 qv_g(k_top+1:
ke) = qv(k_top+1:
ke)
2744 domg_dp(kk) = -(upent(kk) - downent(kk) - updet(kk) - downdet(kk))*emsd(kk)
2746 omg(kk) = omg(kk-1) - deltap(kk-1)*domg_dp(kk-1)
2747 absomg = abs(omg(kk))
2748 absomgtc = absomg*timecp
2749 f_dp = 0.75_rp*deltap(kk-1)
2750 if(absomgtc > f_dp)
THEN 2751 dtt_tmp = f_dp/abs(omg(kk))
2752 dtt=min(dtt,dtt_tmp)
2758 theta_nw(kk) = theta(kk)
2760 fxm(kk) = omg(kk)*deltax*deltax/grav
2762 nstep = nint(timecp/dtt + 1)
2763 deltat = timecp/
real(nstep,RP) 2764 do ntimecount = 1, nstep
2769 theta_fxin(kk) = 0._rp
2770 theta_fxout(kk) = 0._rp
2772 qv_fxout(kk) = 0._rp
2775 if(omg(kk) <= 0._rp)
then 2776 theta_fxin(kk) = -fxm(kk)*theta_nw(kk-1)
2777 qv_fxin(kk) = -fxm(kk)*qv_nw(kk-1)
2778 theta_fxout(kk - 1) = theta_fxout(kk-1) + theta_fxin(kk)
2779 qv_fxout(kk - 1) = qv_fxout(kk-1) + qv_fxin(kk)
2781 theta_fxout(kk) = fxm(kk)*theta_nw(kk)
2782 qv_fxout(kk) = fxm(kk)*qv_nw(kk)
2783 theta_fxin(kk - 1) = theta_fxin(kk-1) + theta_fxout(kk)
2784 qv_fxin(kk - 1) = qv_fxin(kk-1) + qv_fxout(kk)
2790 theta_nw(kk) = theta_nw(kk) &
2791 + (theta_fxin(kk) - theta_fxout(kk) &
2792 + updet(kk)*theta_u(kk) + downdet(kk)*theta_d(kk) &
2793 - ( upent(kk) - downent(kk) )*theta(kk) ) *deltat*emsd(kk)
2794 qv_nw(kk) = qv_nw(kk) &
2795 + (qv_fxin(kk) - qv_fxout(kk) &
2796 + updet(kk)*qvdet(kk) + downdet(kk)*qv_d(kk) &
2797 - ( upent(kk) - downent(kk) )*qv(kk) )*deltat*emsd(kk)
2802 theta_g(kk) = theta_nw(kk)
2803 qv_g(kk) = qv_nw(kk)
2808 if(qv_g(kk) < 0._rp )
then 2810 write(*,*)
"error qv<0 @ Kain-Fritsch cumulus parameterization" 2811 write(*,*)
"@sub scale_atmos_phy_cp_kf",__file__,__line__
2815 if(kk == k_top)
then 2818 tma = qv_g(kkp1)*ems(kkp1)
2819 tmb = qv_g(kk-1)*ems(kk-1)
2821 tmm = (qv_g(kk) - kf_eps )*ems(kk)
2822 bcoeff = -tmm/((tma*tma)/tmb + tmb)
2823 acoeff = bcoeff*tma/tmb
2824 tmb = tmb*(1._rp - bcoeff)
2825 tma = tma*(1._rp - acoeff)
2828 qv_g(kkp1) = tma*emsd(kkp1)
2829 qv_g(kk-1) = tmb*emsd(kk-1)
2833 topomg = (updet(k_top) - upent(k_top))*deltap(k_top)*emsd(k_top)
2834 if( abs(topomg - omg(k_top)) > 1.e-3_rp)
then 2836 write(*,*)
"xxxERROR@KF omega is not consistent",ncount
2837 write(*,*)
"omega error",abs(topomg - omg(k_top)),k_top,topomg,omg(k_top)
2842 call calcexn(pres(kk),qv_g(kk),exn(kk))
2843 temp_g(kk) = theta_g(kk)/exn(kk)
2844 tempv_g(kk) = temp_g(kk)*(1._rp + 0.608_rp*qv_g(kk))
2849 if(i_convflag == 1)
then 2855 temp_mix = temp_mix + deltap(kk)*temp_g(kk)
2856 qv_mix = qv_mix + deltap(kk)*qv_g(kk)
2859 temp_mix = temp_mix/dpthmx
2860 qv_mix = qv_mix/dpthmx
2865 es = aliq*exp((bliq*temp_mix-cliq)/(temp_mix-dliq))
2867 qvss = 0.622_rp*es/(presmix -es)
2871 if (qv_mix > qvss)
then 2872 rl = xlv0 -xlv1*temp_mix
2873 cpm = cp*(1._rp + 0.887_rp*qv_mix)
2874 dssdt = qvss*(cliq-bliq*dliq)/( (temp_mix-dliq)**2)
2875 dq = (qv_mix -qvss)/(1._rp + rl*dssdt/cpm)
2876 temp_mix = temp_mix + rl/cp*dq
2877 qv_mix = qv_mix - dq
2880 qv_mix = max(qv_mix,0._rp)
2881 emix = qv_mix*presmix/(0.622_rp + qv_mix)
2882 tlog = log(emix/aliq)
2884 tdpt = (cliq - dliq*tlog)/(bliq - tlog)
2885 temp_lcl = tdpt - (0.212_rp + 1.571e-3_rp*(tdpt - tem00) - 4.36e-4_rp*(temp_mix - tem00))*(temp_mix - tdpt)
2886 temp_lcl = min(temp_lcl,temp_mix)
2888 tempv_lcl = temp_lcl*(1._rp + 0.608_rp*qv_mix)
2889 z_lcl = zmix + (temp_lcl - temp_mix)/gdcp
2892 if( z_lcl <= z_kf(kk) )
exit 2897 deltaz = ( z_lcl - z_kf(k_lclm1) )/( z_kf(k_lcl)- z_kf(k_lclm1 ) )
2898 temp_env = temp_g(k_lclm1) + ( temp_g(k_lcl) - temp_g(k_lclm1) )*deltaz
2899 qv_env = qv_g(k_lclm1) + ( qv_g(k_lcl) - qv_g(k_lclm1) )*deltaz
2900 tempv_env = temp_env*( 1._rp + 0.608_rp*qv_env )
2902 theta_eu(k_lclm1)=temp_mix*(pre00/presmix)**(0.2854_rp*(1._rp - 0.28_rp*qv_mix))* &
2903 exp((3374.6525_rp/temp_lcl-2.5403_rp)*qv_mix*(1._rp + 0.81_rp*qv_mix))
2908 do kk=k_lclm1,k_top-1
2910 theta_eu(kkp1) = theta_eu(kk)
2911 call tpmix2dd(pres(kkp1),theta_eu(kkp1),temp_gu(kkp1),qv_gu(kkp1))
2912 tempvq_u(kkp1) = temp_gu(kkp1)*(1._rp + 0.608_rp*qv_gu(kkp1) - qc(kkp1)- qi(kkp1))
2913 if(kk == k_lclm1)
then 2914 dzz = z_kf(k_lcl) - z_lcl
2915 dilbe = ((tempv_lcl + tempvq_u(kkp1))/(tempv_env + tempv_g(kkp1)) - 1._rp)*dzz
2918 dilbe = ((tempvq_u(kk) + tempvq_u(kkp1))/(tempv_g(kk) + tempv_g(kkp1)) - 1._rp)*dzz
2920 if(dilbe > 0._rp) cape_g = cape_g + dilbe*grav
2924 call envirtht(pres(kkp1),temp_g(kkp1),qv_g(kkp1),theta_eg(kkp1))
2927 theta_eu(kkp1) = theta_eu(kkp1)*(umfnewdold(kkp1)) + theta_eg(kkp1)*(1._rp - (umfnewdold(kkp1)))
2929 if (noiter == 1)
exit 2930 dcape = max(cape - cape_g,cape*0.1_rp)
2931 f_cape = cape_g/cape
2932 if(f_cape > 1._rp .and. i_convflag == 0)
then 2936 if(ncount /= 1)
then 2937 if(abs(ainc - aincold) < 1.e-4_rp)
then 2942 dfda = (f_cape - f_capeold)/(ainc - aincold)
2943 if (dfda > 0._rp )
then 2955 if (ainc/aincmx > 0.999_rp .and. f_cape > 1.05_rp-stab )
then 2961 if( (f_cape <= 1.05_rp-stab .and. f_cape >= 0.95_rp-stab) .or. ncount == 10)
then 2964 if(ncount > 10)
exit 2965 if(f_cape == 0._rp)
then 2968 if(dcape < 1.e-4)
then 2973 ainc = ainc*stab*cape/dcape
2976 ainc = min(aincmx,ainc)
2978 if (ainc < 0.05_rp)
then 2984 prcp_flux = prcp_flux2*ainc
2986 umf(kk) = umf2(kk)*ainc
2987 upent(kk) = upent2(kk)*ainc
2988 updet(kk) = updet2(kk)*ainc
2989 qcdet(kk) = qcdet2(kk)*ainc
2990 qidet(kk) = qidet2(kk)*ainc
2991 dmf(kk) = dmf2(kk)*ainc
2992 downent(kk) = downent2(kk)*ainc
2993 downdet(kk) = downdet2(kk)*ainc
3000 cldfrac_kf(:,:) = 0._rp
3001 if (i_convflag == 1)
then 3002 do kk = k_lcl-1, k_top
3003 umf_tmp = umf(kk)/(deltax*deltax)
3004 xcldfrac = 0.07_rp*log(1._rp+(500._rp*umf_tmp))
3005 xcldfrac = max(1.e-2_rp,xcldfrac)
3006 cldfrac_kf(kk,1) = min(2.e-2_rp,xcldfrac)
3009 do kk = k_lcl-1, k_top
3010 umf_tmp = umf(kk)/(deltax*deltax)
3011 xcldfrac = 0.14_rp*log(1._rp+(500._rp*umf_tmp))
3012 xcldfrac = max(1.e-2_rp,xcldfrac)
3013 cldfrac_kf(kk,2) = min(6.e-1_rp,xcldfrac)
3024 if (cpr > 0._rp)
then 3025 frc2 = prcp_flux/(cpr*ainc)
3030 qc_nw(
ks:
ke) = 0._rp
3031 qi_nw(
ks:
ke) = 0._rp
3032 qr_nw(
ks:
ke) = 0._rp
3033 qs_nw(
ks:
ke) = 0._rp
3035 rainfb(kk) = flux_qr(kk)*ainc*fbfrc*frc2
3036 snowfb(kk) = flux_qs(kk)*ainc*fbfrc*frc2
3039 do ntimecount = 1, nstep
3042 qc_fxout(kk) = 0._rp
3044 qi_fxout(kk) = 0._rp
3046 qr_fxout(kk) = 0._rp
3048 qs_fxout(kk) = 0._rp
3051 if(omg(kk) <= 0._rp)
then 3052 qc_fxin(kk) = -fxm(kk)*qc_nw(kk-1)
3053 qi_fxin(kk) = -fxm(kk)*qi_nw(kk-1)
3054 qr_fxin(kk) = -fxm(kk)*qr_nw(kk-1)
3055 qs_fxin(kk) = -fxm(kk)*qs_nw(kk-1)
3057 qc_fxout(kk-1) = qc_fxout(kk-1) + qc_fxin(kk)
3058 qi_fxout(kk-1) = qi_fxout(kk-1) + qi_fxin(kk)
3059 qr_fxout(kk-1) = qr_fxout(kk-1) + qr_fxin(kk)
3060 qs_fxout(kk-1) = qs_fxout(kk-1) + qs_fxin(kk)
3062 qc_fxout(kk) = fxm(kk)*qc_nw(kk)
3063 qi_fxout(kk) = fxm(kk)*qi_nw(kk)
3064 qr_fxout(kk) = fxm(kk)*qr_nw(kk)
3065 qs_fxout(kk) = fxm(kk)*qs_nw(kk)
3067 qc_fxin(kk-1) = qc_fxin(kk-1) + qc_fxout(kk)
3068 qi_fxin(kk-1) = qi_fxin(kk-1) + qi_fxout(kk)
3069 qr_fxin(kk-1) = qr_fxin(kk-1) + qr_fxout(kk)
3070 qs_fxin(kk-1) = qs_fxin(kk-1) + qs_fxout(kk)
3075 qc_nw(kk) = qc_nw(kk) + (qc_fxin(kk) - qc_fxout(kk) + qcdet(kk) )*deltat*emsd(kk)
3076 qi_nw(kk) = qi_nw(kk) + (qi_fxin(kk) - qi_fxout(kk) + qidet(kk) )*deltat*emsd(kk)
3077 qr_nw(kk) = qr_nw(kk) + (qr_fxin(kk) - qr_fxout(kk) + rainfb(kk) )*deltat*emsd(kk)
3078 qs_nw(kk) = qs_nw(kk) + (qs_fxin(kk) - qs_fxout(kk) + snowfb(kk) )*deltat*emsd(kk)
3084 rainrate_cp = prcp_flux*(1._rp - fbfrc)/(deltax*deltax)
3092 dpth = dpth + deltap(kk)
3093 qinit = qinit + qv(kk)*ems(kk)
3094 qvfnl = qvfnl + qv_g(kk)*ems(kk)
3095 qhydr = qhydr + (qc_nw(kk) + qi_nw(kk) + qr_nw(kk) + qs_nw(kk))*ems(kk)
3097 qfinl = qvfnl + qhydr
3098 qpfnl = prcp_flux*timecp*(1._rp - fbfrc)
3099 qfinl = qfinl + qpfnl
3100 err = (qfinl - qinit )*100._rp/qinit
3101 if (abs(err) > 0.05_rp .and. istop == 0)
then 3105 write(*,*)
"XXXX ERROR@KF,MOISTURE" 3106 write (*,*)
"--------------------------------------" 3107 write (*,
'(" *** vert accum rho*qhyd : ",F20.12)') qhydr
3108 write (*,
'(" *** vert accum rho*qv : ",F20.12)') qvfnl-qinit
3109 write (*,
'(" *** precipitation rate : ",F20.12)') qpfnl
3110 write (*,
'(" *** conserv qhyd + qv : ",F20.12)') qhydr + qpfnl
3111 write (*,
'(" *** conserv total : ",F20.12)') qfinl-qinit
3112 write (*,*)
"--------------------------------------" 3128 cpm = cp*(1._rp + 0.887_rp*qv_g(kk))
3129 temp_g(kk) = temp_g(kk) - (qi_nw(kk) + qs_nw(kk))*emelt/cpm
3130 qc_nw(kk) = qc_nw(kk) + qi_nw(kk)
3131 qr_nw(kk) = qr_nw(kk) + qs_nw(kk)
3168 end subroutine cp_kf_compensational
3171 subroutine calcexn( pres,qv,exn)
3177 real(RP),
intent(in) :: pres
3178 real(RP),
intent(in) :: qv
3179 real(RP),
intent(out) :: exn
3180 exn = (pre00/pres)**(0.2854_rp*(1._rp - 0.28_rp*qv ))
3184 end subroutine calcexn
3188 subroutine precipitation_oc1973( &
3189 QLIQ,QICE,WTW,DZ,BOTERM,ENTERM,QNEWLQ, &
3190 QNEWIC,QLQOUT,QICOUT,G)
3200 real(RP),
intent(in) :: G
3201 real(RP),
intent(in) :: DZ,BOTERM,ENTERM
3202 real(RP),
intent(inout) :: QLQOUT,QICOUT,WTW,QLIQ,QICE,QNEWLQ,QNEWIC
3204 real(RP) :: QTOT,QNEW,QEST,G1,WAVG,CONV,RATIO3,OLDQ,RATIO4,DQ,PPTDRG
3213 qest=0.5_rp*(qtot+qnew)
3214 g1=wtw+boterm-enterm-2._rp*g*dz*qest/1.5_rp
3215 IF(g1.LT.0.0)g1=0._rp
3216 wavg=0.5_rp*(sqrt(wtw)+sqrt(g1))
3217 conv=rate*dz/max(wavg,kf_eps)
3225 ratio3=qnewlq/(qnew+1.e-8_rp)
3227 qtot=qtot+0.6_rp*qnew
3229 ratio4=(0.6_rp*qnewlq+qliq)/(qtot+1.e-8_rp)
3230 qtot=qtot*exp(-conv)
3237 qicout=(1._rp-ratio4)*dq
3242 pptdrg=0.5_rp*(oldq+qtot-0.2_rp*qnew)
3243 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
3244 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
3249 qliq=ratio4*qtot+ratio3*0.4_rp*qnew
3250 qice=(1._rp-ratio4)*qtot+(1._rp-ratio3)*0.4_rp*qnew
3254 end subroutine precipitation_oc1973
3257 subroutine precipitation_kessler( &
3258 QLIQ,QICE,WTW,DZ,BOTERM,ENTERM,QNEWLQ, &
3259 QNEWIC,QLQOUT,QICOUT,G)
3263 real(RP),
intent(in ) :: G
3264 real(RP),
intent(in ) :: DZ,BOTERM,ENTERM
3265 real(RP),
intent(inout) :: QLQOUT,QICOUT,WTW,QLIQ,QICE,QNEWLQ,QNEWIC
3267 real(RP) :: total_liq, total_ice
3269 real(RP) :: auto_qc, auto_qi
3270 auto_qc = kf_threshold
3271 auto_qi = kf_threshold
3273 total_liq = qliq + qnewlq
3274 total_ice = qice + qnewic
3277 qlqout = max( total_liq - auto_qc, 0.0_rp )
3278 qicout = max( total_ice - auto_qi, 0.0_rp )
3280 pptdrg = max( 0.5_rp * ( total_liq + total_ice - qlqout - qicout ), 0.0_rp )
3281 wtw=wtw+boterm-enterm-2._rp*g*dz*pptdrg/1.5_rp
3282 IF(abs(wtw).LT.1.e-4_rp)wtw=1.e-4_rp
3284 qliq = max( total_liq - qlqout, 0.0_rp )
3285 qlqout = total_liq - qliq
3287 qice = max( total_ice - qicout, 0.0_rp )
3288 qicout = total_ice - qice
3294 end subroutine precipitation_kessler
3297 subroutine tpmix2(p,thes,tu,qu,qliq,qice,qnewlq,qnewic )
3309 real(RP),
intent(in) :: P,THES
3310 real(RP),
intent(out) :: QNEWLQ,QNEWIC
3311 real(RP),
intent(inout) :: TU,QU,QLIQ,QICE
3313 real(RP) :: TP,QQ,BTH,TTH,PP,T00,T10,T01,T11,Q00,Q10,Q01,Q11
3314 real(RP) :: TEMP,QS,QNEW,DQ,QTOT,RLL,CPP
3315 integer :: IPTB,ITHTB
3339 bth=(the0k(iptb+1)-the0k(iptb))*qq+the0k(iptb)
3340 tth=(thes-bth)*rdthk
3344 IF(iptb.GE.kfnp .OR. iptb.LE.1 .OR. ithtb.GE.250 .OR. ithtb.LE.1)
THEN 3346 write(*,*)
'**** OUT OF BOUNDS *********',iptb,ithtb,p,thes
3350 t00=ttab(ithtb ,iptb )
3351 t10=ttab(ithtb+1,iptb )
3352 t01=ttab(ithtb ,iptb+1)
3353 t11=ttab(ithtb+1,iptb+1)
3355 q00=qstab(ithtb ,iptb )
3356 q10=qstab(ithtb+1,iptb )
3357 q01=qstab(ithtb ,iptb+1)
3358 q11=qstab(ithtb+1,iptb+1)
3364 temp=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
3366 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
3393 qliq=qliq-dq*qliq/(qtot+1.e-10_rp)
3394 qice=qice-dq*qice/(qtot+1.e-10_rp)
3398 cpp=1004.5_rp*(1._rp+0.89_rp*qu)
3399 IF(qtot.LT.1.e-10_rp)
THEN 3402 temp=temp+rll*(dq/(1._rp+dq))/cpp
3408 temp=temp+rll*((dq-qtot)/(1._rp+dq-qtot))/cpp
3420 end subroutine tpmix2
3422 subroutine dtfrznew(TU,P,THTEU,QU,QFRZ,QICE)
3426 atmos_saturation_psat_liq
3429 real(RP),
intent(in) :: P,QFRZ
3430 real(RP),
intent(inout) :: TU,THTEU,QU,QICE
3432 real(RP) :: RLC,RLS,RLF,CPP,A,DTFRZ,ES,QS,DQEVAP,PII
3442 rlc=2.5e6_rp-2369.276_rp*(tu-273.16_rp)
3444 rls=2833922._rp-259.532_rp*(tu-273.16_rp)
3447 cpp=1004.5_rp*(1._rp+0.89_rp*qu)
3452 a=(cliq-bliq*dliq)/((tu-dliq)*(tu-dliq))
3453 dtfrz = rlf*qfrz/(cpp+rls*qu*a)
3458 es = aliq*exp((bliq*tu-cliq)/(tu-dliq))
3459 qs = es*0.622_rp/(p-es)
3467 dqevap = min(qs-qu, qice)
3470 pii=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qu))
3473 thteu = tu*pii*exp((3374.6525_rp/tu - 2.5403_rp)*qu*(1._rp + 0.81_rp*qu))
3475 end subroutine dtfrznew
3477 subroutine prof5(EQ,EE,UD)
3495 real(RP),
intent(in) :: EQ
3496 real(RP),
intent(inout) :: EE,UD
3498 real(RP) :: SQRT2P,A1,A2,A3,P,SIGMA,FE
3499 real(RP) :: X,Y,EY,E45,T1,T2,C1,C2
3501 DATA sqrt2p,a1,a2,a3,p,sigma,fe/2.506628_rp,0.4361836_rp,-0.1201676_rp, &
3502 0.9372980_rp,0.33267_rp,0.166666667_rp,0.202765151_rp/
3503 x = (eq - 0.5_rp)/sigma
3504 y = 6._rp*eq - 3._rp
3505 ey = exp(y*y/(-2._rp))
3507 t2 = 1._rp/(1._rp + p*abs(y))
3509 c1 = a1*t1+a2*t1*t1+a3*t1*t1*t1
3510 c2 = a1*t2+a2*t2*t2+a3*t2*t2*t2
3512 ee=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*eq*eq/2._rp
3513 ud=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*(0.5_rp+eq*eq/2._rp- &
3516 ee=sigma*(0.5_rp*(ey*c2-e45*c1)+sigma*(e45-ey))-e45*eq*eq/2._rp
3517 ud=sigma*(0.5_rp*(sqrt2p-e45*c1-ey*c2)+sigma*(e45-ey))-e45*(0.5_rp+eq* &
3522 end subroutine prof5
3524 subroutine tpmix2dd(p,thes,ts,qs)
3536 real(RP),
intent(in) :: P,THES
3537 real(RP),
intent(inout) :: TS,QS
3539 real(RP) :: TP,QQ,BTH,TTH,PP,T00,T10,T01,T11,Q00,Q10,Q01,Q11
3540 integer :: IPTB,ITHTB
3564 bth=(the0k(iptb+1)-the0k(iptb))*qq+the0k(iptb)
3565 tth=(thes-bth)*rdthk
3569 t00=ttab(ithtb ,iptb )
3570 t10=ttab(ithtb+1,iptb )
3571 t01=ttab(ithtb ,iptb+1)
3572 t11=ttab(ithtb+1,iptb+1)
3574 q00=qstab(ithtb ,iptb )
3575 q10=qstab(ithtb+1,iptb )
3576 q01=qstab(ithtb ,iptb+1)
3577 q11=qstab(ithtb+1,iptb+1)
3583 ts=(t00+(t10-t00)*pp+(t01-t00)*qq+(t00-t10-t01+t11)*pp*qq)
3585 qs=(q00+(q10-q00)*pp+(q01-q00)*qq+(q00-q10-q01+q11)*pp*qq)
3588 end subroutine tpmix2dd
3590 subroutine envirtht(P1,T1,Q1,THT1)
3599 real(RP),
intent(in) :: P1,T1,Q1
3600 real(RP),
intent(out) :: THT1
3602 real(RP) :: EE,TLOG,ASTRT,AINC,A1,TP,
VALUE,AINTRP,TDPT,TSAT,THT
3604 real(RP),
parameter :: C1=3374.6525_rp
3605 real(RP),
parameter :: C2=2.5403_rp
3615 ee=q1*p1/(0.622_rp+q1)
3630 tdpt=(cliq-dliq*tlog)/(bliq-tlog)
3632 tsat=tdpt - (0.212_rp+1.571e-3_rp*(tdpt-tem00)-4.36e-4_rp*(t1-tem00))*(t1-tdpt)
3635 tht=t1*(p00/p1)**(0.2854_rp*(1._rp-0.28_rp*q1))
3636 tht1=tht*exp((c1/tsat-c2)*q1*(1._rp+0.81_rp*q1))
3639 end subroutine envirtht
3663 integer :: KP,IT,ITCNT,I
3664 real(RP) :: DTH=1._rp,tmin=150._rp,toler=0.001_rp
3665 real(RP) :: PBOT,DPR, &
3666 TEMP,P,ES,QS,PI,THES,TGUES,THGUES,F0,T1,T0,THGS,F1,DT, &
3696 dpr=(pbot-plutop)/
REAL(KFNP-1)
3709 es=aliq*exp((bliq*temp-cliq)/(temp-dliq))
3710 qs=0.622_rp*es/(p-es)
3711 pi=(1.e5_rp/p)**(0.2854_rp*(1.-0.28_rp*qs))
3712 the0k(kp)=temp*pi*exp((3374.6525_rp/temp-2.5403_rp)*qs* &
3732 es=aliq*exp((bliq*tgues-cliq)/(tgues-dliq))
3733 qs=0.622_rp*es/(p-es)
3734 pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3735 thgues=tgues*pi*exp((3374.6525_rp/tgues-2.5403_rp)*qs* &
3736 (1._rp + 0.81_rp*qs))
3743 es=aliq*exp((bliq*t1-cliq)/(t1-dliq))
3744 qs=0.622_rp*es/(p-es)
3745 pi=(1.e5_rp/p)**(0.2854_rp*(1._rp-0.28_rp*qs))
3746 thtgs=t1*pi*exp((3374.6525_rp/t1-2.5403_rp)*qs*(1._rp + 0.81_rp*qs))
3748 if(abs(f1).lt.toler)
then 3752 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.
real(dp), save, public kf_dtsec
real(rp), dimension(qa_max), public tracer_r
real(rp), public dx
length in the main region [m]: x
logical, public io_l
output log or not? (this process)
module ATMOSPHERE / Physics Cloud Microphysics
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)
subroutine cp_kf_param(RATE_in, TRIGGER_in, KF_DT_in, DELCAPE_in, DEEPLIFETIME_in, SHALLOWLIFETIME_in, DEPTH_USL_in, KF_prec_in, KF_threshold_in, KF_LOG_in, stepkf_in)
real(rp), dimension(qa_max), public tracer_cv
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
logical, public io_nml
output log or not? (for namelist, this process)
integer, public ia
of whole cells: x, local, with HALO
real(dp), public time_dtsec
time interval of model [sec]
integer, public ka
of whole cells: z, local, with HALO
real(rp), public const_pre00
pressure reference [Pa]
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public js
start point of inner domain: y, local
subroutine cp_kf_main(dens, MOMZ, MOMX, MOMY, RHOT, QTRC_in, w0avg, nca, DT_DENS, DT_RHOT, DT_RHOQ, rainrate_cp, cldfrac_sh, cldfrac_dp, timecp, cloudtop, zlcl, I_convflag)
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, public io_fid_nml
Log file ID (only for output namelist)
real(rp), dimension(qa_max), public tracer_mass
integer, public ja
of whole cells: y, local, with HALO