8 use mpp_mod,
only: stdlog, mpp_pe, mpp_root_pe, mpp_clock_id, &
9 mpp_clock_begin, mpp_clock_end, clock_routine, &
14 use fms_mod,
only: write_version_number, open_namelist_file, &
28 character(len=17) ::
mod_name =
'lin_cld_microphys' 45 real,
parameter::
e00 = 610.71
56 real,
parameter::
hlv0 = 2.501e6
57 real,
parameter::
hlf0 = 3.337e5
58 real,
parameter::
t_ice = 273.16
66 real,
parameter ::
qrmin = 1.e-9
67 real,
parameter ::
qvmin = 1.e-22
68 real,
parameter ::
qcmin = 1.e-12
70 real,
parameter ::
vmin = 1.e-3
71 real,
parameter ::
rhor = 1.0e3
230 qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt, qa_dt, &
231 pt_dt, pt, w, uin, vin, udt, vdt, dz, delp, area, dt_in, &
232 land, rain, snow, ice, graupel, &
233 hydrostatic, phys_hydrostatic, &
234 iis,iie, jjs,jje, kks,kke, ktop, kbot, time)
237 logical,
intent(in):: hydrostatic, phys_hydrostatic
238 integer,
intent(in):: iis,iie, jjs,jje
239 integer,
intent(in):: kks,kke
240 integer,
intent(in):: ktop, kbot
241 real,
intent(in):: dt_in
243 real,
intent(in ),
dimension(:,:) :: area
244 real,
intent(in ),
dimension(:,:) :: land
245 real,
intent(out ),
dimension(:,:) :: rain, snow, ice, graupel
246 real,
intent(in ),
dimension(:,:,:):: delp, dz, uin, vin
247 real,
intent(in ),
dimension(:,:,:):: pt, qv, ql, qr,
qg, qa, qn
248 real,
intent(inout),
dimension(:,:,:):: qi, qs
249 real,
intent(inout),
dimension(:,:,:):: pt_dt, qa_dt, udt, vdt, w
250 real,
intent(inout),
dimension(:,:,:):: qv_dt, ql_dt, qr_dt, qi_dt, &
256 real :: mpdt, rdt, dts, convt, tot_prec
258 integer :: is,ie, js,je
260 integer :: seconds, days, ntimes
262 real,
dimension(iie-iis+1,jje-jjs+1) :: prec1, prec_mp, cond, w_var, rh0, maxdbz
263 real,
dimension(iie-iis+1,jje-jjs+1,kke-kks+1) :: vt_r, vt_s, vt_g, vt_i, qn2, dbz
264 real,
dimension(size(pt,1), size(pt,3)) :: m2_rain, m2_sol
277 if ( phys_hydrostatic .or. hydrostatic )
then 299 ntimes = nint( dt_in/mpdt )
301 dts = dt_in /
real(ntimes)
316 call mpdrv( hydrostatic, uin, vin, w, delp, pt, qv, ql, qr, qi, qs,
qg, qa, qn, dz, &
317 is, ie, js, je, ks, ke, ktop, kbot, j, dt_in, &
318 ntimes, rain(:,j), snow(:,j), graupel(:,j), &
319 ice(:,j), m2_rain, m2_sol, cond(:,j), area(:,j), land(:,j), &
320 udt, vdt, pt_dt, qv_dt, ql_dt, qr_dt, qi_dt, &
321 qs_dt, qg_dt, qa_dt, &
322 w_var, vt_r, vt_s, vt_g, vt_i, qn2 )
327 if ( ks < ktop )
then 338 qa_dt(i,j,k) = -qa(i,j,k) * rdt
372 convt = 86400.*rdt*
rgrav 375 rain(i,j) = rain(i,j) * convt
376 snow(i,j) = snow(i,j) * convt
377 ice(i,j) = ice(i,j) * convt
378 graupel(i,j) = graupel(i,j) * convt
379 prec_mp(i,j) = rain(i,j) + snow(i,j) + ice(i,j) + graupel(i,j)
387 cond(i,j) = cond(i,j)*
rgrav 396 if (
mp_print .and. seconds==0 )
then 397 tot_prec =
g_sum(snow, is, ie, js, je, area, 1)
398 if(
master)
write(*,*)
'mean snow=', tot_prec
405 if (
mp_print .and. seconds==0 )
then 406 tot_prec =
g_sum(graupel, is, ie, js, je, area, 1)
407 if(
master)
write(*,*)
'mean graupel=', tot_prec
414 if (
mp_print .and. seconds==0 )
then 415 tot_prec =
g_sum(ice, is, ie, js, je, area, 1)
416 if(
master)
write(*,*)
'mean ice_mp=', tot_prec
423 if (
mp_print .and. seconds==0 )
then 424 tot_prec =
g_sum(rain, is, ie, js, je, area, 1)
425 if(
master)
write(*,*)
'mean rain=', tot_prec
441 call dbzcalc(qv, qr, qs,
qg, pt, delp, dz, &
442 dbz, maxdbz, allmax, is, ie, js, je, ks, ke, .true., .true., .true., .true.)
454 maxdbz(i,j) = dbz(i,j,ke)
460 if (
mp_print .and. seconds == 0)
then 462 if (
master)
write(*,*)
'max reflectivity = ', allmax,
' dBZ' 470 prec1(:,:) = prec1(:,:) + prec_mp(:,:)
471 if ( seconds==0 )
then 472 prec1(:,:) = prec1(:,:)*dt_in/86400.
473 tot_prec =
g_sum(prec1, is, ie, js, je, area, 1)
474 if(
master)
write(*,*)
'Daily prec_mp=', tot_prec
488 subroutine mpdrv( hydrostatic, uin, vin, w, delp, pt, qv, ql, qr, qi, qs, qg, qa, qn, dz, &
489 is, ie, js, je, ks, ke, ktop, kbot, j, dt_in, ntimes, &
490 rain, snow, graupel, ice, m2_rain, m2_sol, &
491 cond, area1, land, u_dt, v_dt, pt_dt, qv_dt, ql_dt, qr_dt, qi_dt, &
492 qs_dt, qg_dt, qa_dt, &
493 w_var, vt_r, vt_s, vt_g, vt_i, qn2 )
510 logical,
intent(in):: hydrostatic
511 integer,
intent(in):: j, is,ie, js,je, ks,ke
512 integer,
intent(in):: ntimes, ktop, kbot
513 real,
intent(in):: dt_in
515 real,
intent(in),
dimension(is:):: area1, land
516 real,
intent(in),
dimension(is:,js:,ks:):: uin, vin, delp, pt, qv, ql, qr, qg, qa, qn, dz
517 real,
intent(inout),
dimension(is:,js:,ks:):: qi, qs
518 real,
intent(inout),
dimension(is:,js:,ks:):: u_dt, v_dt, w, pt_dt, qa_dt, &
519 qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt
520 real,
intent(inout),
dimension(is:):: rain, snow, ice, graupel, cond
521 real,
intent(out),
dimension(is:,js:) :: w_var
522 real,
intent(out),
dimension(is:,js:,ks:) :: vt_r, vt_s, vt_g, vt_i, qn2
523 real,
intent(out),
dimension(is:,ks:):: m2_rain, m2_sol
528 real,
dimension(ktop:kbot):: qvz, qlz, qrz, qiz, qsz, qgz, qaz, &
529 vtiz, vtsz, vtgz, vtrz, dp0, &
530 dp1, qv0, ql0, qr0, qi0, qs0, qg0, qa0, t0, den, &
531 den0, tz, p1, dz0, dz1, denfac
532 real,
dimension(ktop:kbot):: ccn, c_praut, m1_rain, m1_sol, m1, u0, v0, u1, v1, w1
533 real :: cpaut, rh_adj, rh_rain
534 real :: r1, s1, i1, g1, rdt, ccn0
535 real :: dt_rain, dts, fac_sno, fac_gra
536 real :: s_leng, t_land, t_ocean, h_var
537 real :: cvm, tmp, omq
538 real :: dqi, qio, qin
541 dts = dt_in /
real(ntimes)
544 fac_sno = 1. - exp( -0.5*dts/
tau_s )
545 fac_gra = 1. - exp( -0.5*dts/
tau_g )
560 qio = qiz(k) - dt_in*qi_dt(i,j,k)
562 if ( qiz(k) > qin )
then 563 qsz(k) = qsz(k) + qiz(k) - qin
565 dqi = (qin - qio)*rdt
566 qs_dt(i,j,k) = qs_dt(i,j,k) + qi_dt(i,j,k) - dqi
585 dp1(k) = dp1(k)*(1. -(qvz(k)+qlz(k)+qrz(k)+qiz(k)+qsz(k)+qgz(k)))
587 omq = dp0(k) / dp1(k)
599 den0(k) = -dp1(k)/(
grav*dz0(k))
600 p1(k) = den0(k)*
rdgas*t0(k)
628 ccn(k) = qn(i,j,k) * 1.e6
629 c_praut(k) = cpaut * (ccn(k)*
rhor)**(-1./3.)
633 ccn0 = (
ccn_l*land(i) +
ccn_o*(1.-land(i))) * 1.e6
636 ccn0 = ccn0 *
rdgas*tz(kbot)/p1(kbot)
638 tmp = cpaut * (ccn0*
rhor)**(-1./3.)
649 s_leng = sqrt(sqrt(area1(i)/1.e10))
652 h_var = t_land*land(i) + t_ocean*(1.-land(i))
653 h_var =
min(0.20,
max(0.01, h_var))
654 if (
id_var>0 ) w_var(i,j) = h_var
656 rh_adj = 1. - h_var -
rh_inc 664 call neg_adj(ktop, kbot, p1, tz, dp1, qvz, qlz, qrz, qiz, qsz, qgz)
674 denfac(k) = sqrt(
sfcrho/den(k))
678 dz1(k) = dz0(k)*tz(k)/t0(k)
679 den(k) = den0(k)*dz0(k)/dz1(k)
680 denfac(k) = sqrt(
sfcrho/den(k))
687 call warm_rain(dt_rain, ktop, kbot, p1, dp1, dz1, tz, qvz, qlz, qrz, qiz, qsz, qgz, p1, den, denfac, ccn, &
688 c_praut, rh_rain, vtrz, r1, m1_rain, w1, h_var)
689 rain(i) = rain(i) + r1
691 m2_rain(i,k) = m2_rain(i,k) + m1_rain(k)
692 m1(k) = m1(k) + m1_rain(k)
698 call fall_speed(ktop, kbot, den, qsz, qiz, qgz, qlz, tz, vtsz, vtiz, vtgz)
700 call terminal_fall ( dts, ktop, kbot, tz, qvz, qlz, qrz, qgz, qsz, qiz, p1, &
701 dz1, dp1, den, vtgz, vtsz, vtiz, fac_sno, fac_gra, &
702 r1, g1, s1, i1, m1_sol, w1 )
704 rain(i) = rain(i) + r1
705 snow(i) = snow(i) + s1
706 graupel(i) = graupel(i) + g1
709 call sedi_heat(ktop, kbot, dp1, m1_sol, dz1, tz, qvz, qlz, qrz, qiz, qsz, qgz,
c_ice)
714 call warm_rain(dt_rain, ktop, kbot, p1, dp1, dz1, tz, qvz, qlz, qrz, qiz, qsz, qgz, p1, den, denfac, ccn, &
715 c_praut, rh_rain, vtrz, r1, m1_rain, w1, h_var)
716 rain(i) = rain(i) + r1
718 m2_rain(i,k) = m2_rain(i,k) + m1_rain(k)
719 m2_sol(i,k) = m2_sol(i,k) + m1_sol(k)
720 m1(k) = m1(k) + m1_rain(k) + m1_sol(k)
727 call icloud( ktop, kbot, tz, p1, qvz, qlz, qrz, qiz, qsz, qgz, &
728 dp1, den, denfac, vtsz, vtgz, vtrz, qaz, rh_adj, rh_rain, dts, fac_sno, fac_gra, h_var )
734 u1(k) = (dp0(k)*u1(k) + m1(k-1)*u1(k-1))/(dp0(k)+m1(k-1))
735 v1(k) = (dp0(k)*v1(k) + m1(k-1)*v1(k-1))/(dp0(k)+m1(k-1))
736 u_dt(i,j,k) = u_dt(i,j,k) + (u1(k)-u0(k))*rdt
737 v_dt(i,j,k) = v_dt(i,j,k) + (v1(k)-v0(k))*rdt
749 omq = dp1(k) / dp0(k)
750 qv_dt(i,j,k) = qv_dt(i,j,k) + rdt*(qvz(k)-qv0(k))*omq
751 ql_dt(i,j,k) = ql_dt(i,j,k) + rdt*(qlz(k)-ql0(k))*omq
752 qr_dt(i,j,k) = qr_dt(i,j,k) + rdt*(qrz(k)-qr0(k))*omq
753 qi_dt(i,j,k) = qi_dt(i,j,k) + rdt*(qiz(k)-qi0(k))*omq
754 qs_dt(i,j,k) = qs_dt(i,j,k) + rdt*(qsz(k)-qs0(k))*omq
755 qg_dt(i,j,k) = qg_dt(i,j,k) + rdt*(qgz(k)-qg0(k))*omq
757 pt_dt(i,j,k) = pt_dt(i,j,k) + rdt*(tz(k)- t0(k))*cvm/
cp_air 764 qa_dt(i,j,k) = qa_dt(i,j,k) + rdt*( qaz(k)/
real(ntimes)-qa0(k))
774 cond(i) = cond(i) + dp1(k)*(qlz(k)+qrz(k)+qsz(k)+qiz(k)+qgz(k))
780 vt_r(i,j,k) = vtrz(k)
785 vt_s(i,j,k) = vtsz(k)
790 vt_g(i,j,k) = vtgz(k)
795 vt_i(i,j,k) = vtiz(k)
811 subroutine sedi_heat(ktop, kbot, dm, m1, dz, tz, qv, ql, qr, qi, qs, qg, cw)
812 integer,
intent(in):: ktop, kbot
814 real,
intent(in ),
dimension(ktop:kbot):: dm, m1, dz, qv, ql, qr, qi, qs, qg
815 real,
intent(inout),
dimension(ktop:kbot):: tz
816 real,
intent(in):: cw
818 real,
dimension(ktop:kbot):: dgz, cvm, cvn
824 dgz(k) = -0.5*
grav*dz(k)
836 tmp = cvn(k) + m1(k)*cw
837 tz(k) = (tmp*tz(k) + m1(k)*dgz(k) ) / tmp
840 tz(k) = ( (cvn(k)+cw*(m1(k)-m1(k-1)))*tz(k) + m1(k-1)*cw*tz(k-1) + dgz(k)*(m1(k-1)+m1(k)) ) &
841 / ( cvn(k)+cw*m1(k) )
847 subroutine warm_rain( dt, ktop, kbot, p1, dp, dz, tz, qv, ql, qr, qi, qs, qg, pm, &
848 den, denfac, ccn, c_praut, rh_rain, vtr, r1, m1_rain, w1, h_var)
850 integer,
intent(in):: ktop, kbot
851 real,
intent(in):: dt
852 real,
intent(in),
dimension(ktop:kbot):: dp, p1, dz, pm, den, denfac, ccn, c_praut
853 real,
intent(in):: rh_rain, h_var
854 real,
intent(inout),
dimension(ktop:kbot):: tz, qv, ql, qr, qi, qs, qg, vtr
855 real,
intent(out):: r1
856 real,
intent(inout),
dimension(ktop:kbot):: m1_rain, w1
859 real,
parameter:: so3 = 7./3.
860 real,
dimension(ktop:kbot):: dl, dm
861 real,
dimension(ktop:kbot+1):: ze, zt
862 real :: sink, dq, qc0, qc
870 real,
parameter :: vconr = 2503.23638966667
871 real,
parameter :: normr = 25132741228.7183
872 real,
parameter :: thr=1.e-10
901 if ( qr(k) < thr )
then 904 vtr(k) =
max(
vmin,
vr_fac*vconr*sqrt(
min(10., rho0/den(k)))*exp(0.2*log(qden/normr)))
910 ze(k) = ze(k+1) - dz(k)
916 zt(k) = ze(k) - dt5*(vtr(k-1)+vtr(k))
918 zt(kbot+1) = zs - dt*vtr(kbot)
921 if( zt(k+1)>=zt(k) ) zt(k+1) = zt(k) -
dz_min 926 call revap_racc( ktop, kbot, dt5, tz, qv, ql, qr, qi, qs,
qg, den, denfac, rh_rain, h_var )
930 dm(k) = dp(k)*(1.+qv(k)+ql(k)+qr(k)+qi(k)+qs(k)+
qg(k))
941 w1(ktop) = (dm(ktop)*w1(ktop)+m1_rain(ktop)*vtr(ktop)) /(dm(ktop)-m1_rain(ktop))
943 w1(k) = (dm(k)*w1(k)-m1_rain(k-1)*vtr(k-1)+m1_rain(k)*vtr(k)) &
944 / (dm(k) +m1_rain(k-1) -m1_rain(k))
948 call sedi_heat(ktop, kbot, dp, m1_rain, dz, tz, qv, ql, qr, qi, qs,
qg,
c_liq)
950 call revap_racc( ktop, kbot, dt5, tz, qv, ql, qr, qi, qs,
qg, den, denfac, rh_rain, h_var )
967 dl(k) =
min(
max(1.e-5, dl(k)), 0.5*ql(k))
979 dq = 0.5*(ql(k) + dl(k) - qc)
983 sink =
min(1.,dq/dl(k)) * dt*c_praut(k)*den(k)*exp(so3*log(ql(k)))
993 subroutine revap_racc( ktop, kbot, dt, tz, qv, ql, qr, qi, qs, qg, den, denfac, rh_rain, h_var)
994 integer,
intent(in):: ktop, kbot
995 real,
intent(in):: dt
996 real,
intent(in),
dimension(ktop:kbot):: den, denfac
997 real,
intent(in) :: rh_rain, h_var
998 real,
intent(inout),
dimension(ktop:kbot):: tz, qv, qr, ql, qi, qs, qg
1000 real :: dqv, qsat, dqsdt, evap, t2, qden, q_plus, q_minus, sink
1001 real :: qpz, dq, dqh, tin, lcpk
1005 if ( tz(k) >
t_wfr .and. qr(k) >
qrmin )
then 1010 tin = tz(k) - lcpk*ql(k)
1012 qsat =
wqs2(tin, den(k), dqsdt)
1024 if ( dqv>
qvmin .and. qsat > q_minus )
then 1025 if ( qsat > q_plus )
then 1030 dq = 0.25*(q_minus-qsat)**2 / dqh
1034 evap =
crevp(1)*t2*dq*(
crevp(2)*sqrt(qden)+
crevp(3)*exp(0.725*log(qden))) &
1036 evap =
min( qr(k), dt*evap, dqv/(1.+lcpk*dqsdt) )
1038 sink =
min( qr(k), dim(rh_rain*qsat, qv(k))/(1.+lcpk*dqsdt) )
1039 evap =
max( evap, sink )
1040 qr(k) = qr(k) - evap
1041 qv(k) = qv(k) + evap
1042 tz(k) = tz(k) - evap*lcpk
1045 if ( qr(k)>
qrmin .and. ql(k)>1.e-8 .and. qsat<q_plus )
then 1049 sink = dt*denfac(k)*
cracw * exp(0.95*log(qr(k)*den(k)))
1050 sink = sink/(1.+sink)*ql(k)
1051 ql(k) = ql(k) - sink
1052 qr(k) = qr(k) + sink
1061 subroutine linear_prof(km, p1, q, dm, z_var, h_var)
1065 integer,
intent(in):: km
1066 real,
intent(in ):: p1(km), q(km), h_var
1067 real,
intent(out):: dm(km)
1068 logical,
intent(in):: z_var
1075 dq(k) = 0.5*(q(k) - q(k-1))
1080 dm(k) = 0.5*
min(abs(dq(k) + dq(k+1)), 0.5*q(k))
1081 if ( dq(k)*dq(k+1) <= 0. )
then 1082 if ( dq(k) > 0. )
then 1083 dm(k) =
min( dm(k), dq(k), -dq(k+1) )
1092 dm(k) =
max( dm(k),
qvmin, h_var*q(k) )
1103 subroutine icloud(ktop, kbot, tzk, p1, qvk, qlk, qrk, qik, qsk, qgk, dp1, &
1104 den, denfac, vts, vtg, vtr, qak, rh_adj, rh_rain, dts, fac_sno, fac_gra, h_var)
1113 integer,
intent(in) :: ktop, kbot
1114 real,
intent(in),
dimension(ktop:kbot):: p1, dp1, den, denfac, vts, vtg, vtr
1115 real,
intent(inout),
dimension(ktop:kbot):: tzk, qvk, qlk, qrk, qik, qsk, qgk, qak
1116 real,
intent(in) :: rh_adj, rh_rain, dts, fac_sno, fac_gra, h_var
1118 real,
parameter:: rhos = 0.1e3
1119 real,
dimension(2*(kbot-ktop-1)):: p2, den2, tz2, qv2, ql2, qr2, qi2, qs2, qg2, qa2
1120 real,
dimension(ktop:kbot) :: lcpk, icpk, tcpk, di
1122 real :: rdts, fac_g2v, fac_v2g, fac_i2s
1123 real :: tz, qv, ql, qr, qi, qs, qg, melt
1124 real :: pracw, pracs, psacw, pgacw, pgmlt, &
1125 psmlt, prevp, psacr, pgacr, pgfr, pgacs, &
1126 pgaut, pgaci, praci, psaut, psaci, piacr, pgsub
1127 real :: tc, tsq, dqs0, qden, qim, qsm, pssub
1128 real :: factor, sink
1129 real :: tmp1, qsw, qsi, dqsdt, dq
1130 real :: dtmp, qc, q_plus, q_minus, cvm
1132 integer:: i, j, k, k1
1137 fac_i2s = 1. - exp( -dts/
tau_i2s )
1138 fac_g2v = 1. - exp( -dts/
tau_g2v )
1139 fac_v2g = 1. - exp( -dts/
tau_v2g )
1147 tcpk(k) = lcpk(k) + icpk(k)
1160 if( tzk(k) >
tice .and. qik(k) >
qcmin )
then 1161 melt =
min( qik(k), (tzk(k)-
tice)/icpk(k) )
1163 qlk(k) = qlk(k) + tmp1
1164 qrk(k) = qrk(k) + melt - tmp1
1165 qik(k) = qik(k) - melt
1166 tzk(k) = tzk(k) - melt*icpk(k)
1172 do 3000 k=ktop, kbot
1174 if( tzk(k) <
t_min .or. p1(k) <
p_min )
goto 3000
1197 dqs0 =
ces0/p1(k) - qv
1200 if ( qs>
qvmin )
then 1203 sink =
min( fac_sno*qs, factor*tc/icpk(k) )
1206 tz = tz - sink*icpk(k)
1215 factor = denfac(k)*
csacw*exp(0.8125*log(qs*den(k)))
1216 psacw = factor/(1.+dts*factor)*ql
1221 if ( qr>
qrmin )
then 1233 psmlt =
max(0.,
smlt(tc, dqs0, qs*den(k), psacw, psacr,
csmlt, den(k), denfac(k)))
1234 sink =
min(qs, dts*(psmlt+pracs), tc/icpk(k))
1238 tz = tz - sink*icpk(k)
1242 if (
qg>
qcmin .and. tc>0. )
then 1246 sink =
min( fac_gra*
qg, factor*tc/icpk(k) )
1249 tz = tz - sink*icpk(k)
1252 if ( qr>
qrmin )
then 1261 factor =
cgacw*qden/sqrt(den(k)*sqrt(sqrt(qden)))
1262 pgacw = factor/(1.+dts*factor) * ql
1266 pgmlt = dts*
gmlt(tc, dqs0, qden, pgacw, pgacr,
cgmlt, den(k))
1267 pgmlt =
min(
max(0., pgmlt),
qg, tc/icpk(k) )
1270 tz = tz - pgmlt*icpk(k)
1274 elseif( tc < 0.0 )
then 1279 if ( qi>1.e-8 )
then 1284 if ( qs>1.e-8 )
then 1289 factor = dts*denfac(k)*
csaci*exp(0.05*tc + 0.8125*log(qs*den(k)))
1290 psaci = factor/(1.+factor) * qi
1306 if ( q_plus > (qim+
qrmin) )
then 1307 if ( qim > (qi - di(k)) )
then 1308 dq = 0.25*(q_plus-qim)**2 / di(k)
1315 psaut = fac_i2s * dq
1320 sink =
min( qi, psaci+psaut )
1327 if (
qg>
qrmin .and. qi>1.e-7 )
then 1331 factor = dts*
cgaci/sqrt(den(k))*exp(0.025*tc + 0.875*log(
qg*den(k)))
1333 pgaci = factor/(1.+factor)*qi
1343 if ( qs>
qrmin )
then 1344 qsi =
iqs2(tz, den(k), dqsdt)
1346 tmp1 = exp(0.65625*log(qden))
1348 dq = (qsi-qv)/(1.+tcpk(k)*dqsdt)
1349 pssub =
cssub(1)*tsq*(
cssub(2)*sqrt(qden) +
cssub(3)*tmp1*sqrt(denfac(k))) &
1351 pssub = (qsi-qv)*dts*pssub
1352 if ( pssub > 0. )
then 1358 if ( tz >
tice )
then 1361 pssub =
max( pssub, 0.05*dq, (tz-
tice)/tcpk(k) )
1366 tz = tz - pssub*tcpk(k)
1376 if ( qr>
qrmin .and. tc < 0. )
then 1378 #ifndef NOT_USE_PRACI 1383 if ( qi > 1.e-5 )
then 1384 factor = dts*denfac(k)*
craci*exp(0.95*log(qr*den(k)))
1385 praci = factor/(1.+factor)*qi
1401 if ( qs > 1.e-8 )
then 1402 psacr = dts*
acr3d(vts(k), vtr(k), qr, qs,
csacr,
acco(1,2), den(k))
1412 if ( qi >
qrmin )
then 1413 factor = dts*denfac(k)*qi *
c_piacr 1414 piacr = factor/(1.+factor)*qr
1422 pgfr = dts*
cgfr(1)/den(k)*(exp(-
cgfr(2)*tc)-1.)*exp( 1.75*log(qr*den(k)) )
1425 sink = psacr + piacr + pgfr
1426 factor =
min( sink, qr, -tc/icpk(k) ) /
max( sink,
qrmin )
1428 psacr = factor * psacr
1429 piacr = factor * piacr
1430 pgfr = factor * pgfr
1432 sink = psacr + piacr + pgfr
1433 tz = tz + sink*icpk(k)
1450 if( dtmp > 0. )
then 1452 sink =
min( ql*factor, dtmp/icpk(k) )
1455 tz = tz + sink*icpk(k)
1461 if( qs>1.e-8 .and. ql>1.e-8 .and. tc<-0.01 )
then 1463 factor = dts*denfac(k)*
csacw*exp(0.8125*log(qs*den(k)))
1464 psacw =
min( factor/(1.+factor)*ql, -tc/icpk(k) )
1467 tz = tz + psacw*icpk(k)
1477 if( qs >
qrmin )
then 1486 if ( qs > qsm )
then 1488 factor = dts*1.e-3*exp(0.09*(tz-
tice))
1489 sink = sink + factor/(1.+factor)*(qs-qsm)
1491 sink =
min( qs, sink )
1503 factor = dts*
cgacw*qden/sqrt(den(k)*sqrt(sqrt(qden)))
1504 pgacw = factor/(1.+factor)*ql
1510 if ( qr>
qrmin )
then 1516 sink = pgacr + pgacw
1518 pgacr = factor * pgacr
1519 pgacw = factor * pgacw
1521 sink = pgacr + pgacw
1522 tz = tz + sink*icpk(k)
1530 qsi =
iqs2(tz, den(k), dqsdt)
1532 pgsub = (qv/qsi-1.) *
qg 1533 if ( pgsub > 0. )
then 1534 pgsub =
min( fac_v2g*pgsub, 0.01*dq, dim(
tice,tz)/tcpk(k) )
1536 pgsub =
max( fac_g2v*pgsub, dq/(1.+tcpk(k)*dqsdt) )*
min(1.,dim(tz,
t_sub)*0.1)
1543 tz = tz + pgsub*tcpk(k)
1551 qsw =
wqs2(tz, den(k), dqsdt)
1552 sink =
min(qr, dim(rh_rain*qsw, qv)/(1.+lcpk(k)*dqsdt))
1555 tz = tz - sink*lcpk(k)
1574 kn = kbot - ktop + 1
1575 km = 2*(kbot-ktop-1)
1581 p2(k ) = p1(k1) - 0.25*dp1(k1)
1582 p2(k+1) = p1(k1) + 0.25*dp1(k1)
1586 if (k1 /= (kbot-2))
then 1587 write(*,*)
'FATAL: k1=', k1
1588 call error_mesg (
'LIN_CLD_MICROPHYS:',
'DO_MAP2_SAT', fatal)
1592 p2(km-1) = p1(kbot-1)
1595 call remap2(ktop, kbot, kn, km, dp1, tzk, tz2, 1)
1596 call remap2(ktop, kbot, kn, km, dp1, qvk, qv2, 1)
1597 call remap2(ktop, kbot, kn, km, dp1, qlk, ql2, 1)
1598 call remap2(ktop, kbot, kn, km, dp1, qik, qi2, 1)
1601 call remap2(ktop, kbot, kn, km, dp1, qrk, qr2, 1)
1602 call remap2(ktop, kbot, kn, km, dp1, qsk, qs2, 1)
1609 den2(k) = p2(k)/(
rdgas*tz2(k))
1614 call subgrid_z_proc(1, km, p2, den2, dts, rh_adj, tz2, qv2, ql2, qr2, qi2, qs2, qg2, qa2, h_var)
1617 qak(ktop ) = qak(ktop ) + qa2(1)
1618 qak(ktop+1) = qak(ktop+1) + qa2(2)
1621 tzk(ktop+1) = tz2(2)
1624 qvk(ktop+1) = qv2(2)
1627 qlk(ktop+1) = ql2(2)
1630 qik(ktop+1) = qi2(2)
1634 qrk(ktop+1) = qr2(2)
1637 qsk(ktop+1) = qs2(2)
1642 qak(k1) = qak(k1) +
max(qa2(k), qa2(k+1))
1650 tzk(k1) = 0.5*(tz2(k) + tz2(k+1))
1651 qvk(k1) = 0.5*(qv2(k) + qv2(k+1))
1652 qlk(k1) = 0.5*(ql2(k) + ql2(k+1))
1653 qik(k1) = 0.5*(qi2(k) + qi2(k+1))
1656 qak(kbot-1) = qak(kbot-1) + qa2(km-1)
1657 qak(kbot ) = qak(kbot ) + qa2(km )
1659 tzk(kbot-1) = tz2(km-1)
1660 tzk(kbot ) = tz2(km )
1662 qvk(kbot-1) = qv2(km-1)
1663 qvk(kbot ) = qv2(km )
1665 qlk(kbot-1) = ql2(km-1)
1666 qlk(kbot ) = ql2(km )
1668 qik(kbot-1) = qi2(km-1)
1669 qik(kbot ) = qi2(km )
1672 call subgrid_z_proc(ktop, kbot, p1, den, dts, rh_adj, tzk, qvk, qlk, qrk, qik, qsk, qgk, qak, h_var)
1678 subroutine remap2(ktop, kbot, kn, km, dp, q1, q2, id)
1679 integer,
intent(in):: ktop, kbot, kn, km , id
1681 real,
intent(in),
dimension(ktop:kbot):: q1, dp
1682 real,
intent(out):: q2(km)
1684 real :: a4(4,ktop:kbot)
1700 q2(k ) =
min( 2.*q1(k1),
max(
qvmin, a4(1,k1) + 0.25*(a4(2,k1)-a4(3,k1)) ) )
1701 q2(k+1) = 2.*q1(k1) - q2(k)
1712 q2(km-1) = q1(kbot-1)
1719 subroutine subgrid_z_proc(ktop, kbot, p1, den, dts, rh_adj, tz, qv, ql, qr, qi, qs, qg, qa, h_var)
1723 integer,
intent(in):: ktop, kbot
1724 real,
intent(in),
dimension(ktop:kbot):: p1, den
1725 real,
intent(in) :: dts, rh_adj, h_var
1726 real,
intent(inout),
dimension(ktop:kbot):: tz, qv, ql, qr, qi, qs, qg, qa
1728 real,
dimension(ktop:kbot):: lcpk, icpk, tcpk, tcp3
1729 real :: fac_v2l, fac_l2v
1730 real :: pidep, qi_crt
1733 real :: rh, clouds, rqi, tin, qsw, qsi, qpz, qstar
1734 real :: dqsdt, dwsdt, dq, dq0, cond0, factor, tmp, cvm
1735 real :: q_plus, q_minus, dt_pisub
1736 real :: evap, sink, tc, pisub, iwt, q_adj, dtmp, lat2
1739 fac_v2l = 1. - exp( -0.5*dts/
tau_v2l )
1740 fac_l2v = 1. - exp( -0.5*dts/
tau_l2v )
1749 tcpk(k) = lcpk(k) + icpk(k)
1755 if ( p1(k) <
p_min )
goto 4000
1757 if ( tz(k) <
t_min )
then 1758 sink = dim(qv(k), 1.e-7)
1759 qv(k) = qv(k) - sink
1760 qi(k) = qi(k) + sink
1761 tz(k) = tz(k) + sink*tcpk(k)
1762 if ( .not.
do_qa ) qa(k) = qa(k) + 1.
1768 clouds = ql(k) + iwt
1770 tin = tz(k) - ( lcpk(k)*clouds + icpk(k)*iwt )
1771 if ( tin>
t_sub+6. )
then 1772 qpz = qv(k) + clouds
1773 rh = qpz /
iqs1(tin, den(k))
1775 if ( rh < rh_adj )
then 1785 qsw =
wqs2(tz(k), den(k), dwsdt)
1787 if ( dq0 > 0. )
then 1788 evap =
min( ql(k), fac_l2v*dq0/(1.+tcp3(k)*dwsdt) )
1791 evap = dq0/(1.+tcp3(k)*dwsdt)
1793 qv(k) = qv(k) + evap
1794 ql(k) = ql(k) - evap
1795 tz(k) = tz(k) - evap*lcpk(k)
1798 dtmp =
t_wfr - tz(k)
1799 if( dtmp>0. .and. ql(k) >
qcmin )
then 1800 sink =
min( ql(k), ql(k)*dtmp*0.125, dtmp/icpk(k) )
1801 ql(k) = ql(k) - sink
1802 qi(k) = qi(k) + sink
1803 tz(k) = tz(k) + sink*icpk(k)
1811 if( ql(k) >
qcmin .and. tc> 0.1 )
then 1813 sink = dts*3.3333e-10*(exp(0.66*tc)-1.)*den(k)*ql(k)*ql(k)
1814 sink =
min(ql(k), tc/icpk(k), sink)
1815 ql(k) = ql(k) - sink
1816 qi(k) = qi(k) + sink
1817 tz(k) = tz(k) + sink*icpk(k)
1824 tcpk(k) = lcpk(k) + icpk(k)
1828 if ( tz(k) <
tice )
then 1829 qsi =
iqs2(tz(k), den(k), dqsdt)
1831 sink = dq/(1.+tcpk(k)*dqsdt)
1833 if ( qi(k) >
qrmin )
then 1836 pidep = dt_pisub*dq*349138.78*exp(0.875*log(qi(k)*den(k))) &
1837 / (qsi*den(k)*lat2/(0.0243*
rvgas*tz(k)**2) + 4.42478e4)
1845 sink =
min(sink,
max(qi_crt-qi(k),pidep), tmp/tcpk(k))
1847 pidep = pidep *
min(1., dim(tz(k),
t_sub)*0.2)
1848 sink =
max(pidep, sink, -qi(k))
1850 qv(k) = qv(k) - sink
1851 qi(k) = qi(k) + sink
1852 tz(k) = tz(k) + sink*tcpk(k)
1855 if (
do_qa )
goto 4000
1863 clouds = ql(k) + qr(k) + iwt
1865 clouds = ql(k) + iwt
1868 qpz = qv(k) + clouds
1869 tin = tz(k) - ( lcpk(k)*clouds + icpk(k)*iwt )
1875 if( tin <=
t_wfr )
then 1876 qstar =
iqs1(tin, den(k))
1877 elseif ( tin >=
tice )
then 1878 qstar =
wqs1(tin, den(k))
1881 qsi =
iqs1(tin, den(k))
1882 qsw =
wqs1(tin, den(k))
1883 if( clouds > 3.e-6 )
then 1889 qstar = rqi*qsi + (1.-rqi)*qsw
1898 if ( qpz >
qrmin )
then 1903 if ( qstar < q_minus )
then 1905 elseif ( qstar<q_plus .and. clouds>
qc_crt )
then 1906 qa(k) = qa(k) + (q_plus-qstar)/(dq+dq)
1915 subroutine sat_adj2(mdt, is, ie, js, je, ng, hydrostatic, consv_te, &
1916 te0, qv, ql, qi, qr, qs, qg, qa, area, dpeln, delz, pt, dp, &
1921 dtdt, out_dt, last_step)
1924 real,
intent(in):: mdt
1925 integer,
intent(in):: is, ie, js, je, ng
1926 logical,
intent(in):: hydrostatic, last_step, consv_te, out_dt
1927 real,
intent(in),
dimension(is-ng:ie+ng,js-ng:je+ng):: dp, area, delz
1929 real,
intent(in):: dpeln(is:ie,js:je)
1930 real,
intent(inout),
dimension(is-ng:ie+ng,js-ng:je+ng):: pt, qv, ql, qi, qr, qs,
qg, qa
1931 real,
intent(inout),
dimension(is-ng:,js-ng:):: q_con
1933 real,
intent(inout),
dimension(is-ng:,js-ng:):: cappa
1935 real,
intent(inout)::dtdt(is:ie,js:je)
1936 real,
intent(out):: te0(is:ie,js:je)
1938 real,
dimension(is:ie):: cpm, t0, pt1, icp2, lcp2, tcp2, tcp3, den, q_liq, q_sol, hvar, src, p1
1939 real :: sink, qsw, rh, fac_v2l, fac_l2v, cond0
1940 real :: tc, qsi, dqsdt, dq, dq0, pidep, qi_crt, tmp, dtmp, lat2
1941 real :: condensates, qpz, tin, qstar, rqi, q_plus, q_minus
1942 real :: sdt, rh_ql, adj_fac, fac_s, fac_r, fac_i2s
1943 real :: factor, psacw, qim
1948 fac_i2s = 1. - exp( -mdt/
tau_i2s )
1949 fac_v2l = 1. - exp( -sdt/
tau_v2l )
1950 fac_l2v = 1. - exp( -sdt/
tau_l2v )
1952 fac_r = 1. - exp( -sdt/
tau_r )
1953 fac_s = 1. - exp( -sdt/
tau_s )
1964 q_con(i,j) = ql(i,j) + qr(i,j) + qi(i,j) + qs(i,j) +
qg(i,j)
1965 pt1(i) = pt(i,j) / ((1.+
zvir*qv(i,j))*(1-q_con(i,j)))
1967 pt1(i) = pt(i,j) / (1.+
zvir*qv(i,j))
1970 q_liq(i) = ql(i,j) + qr(i,j)
1971 q_sol(i) = qi(i,j) + qs(i,j) +
qg(i,j)
1972 hvar(i) =
min(0.2,
max(0.01,
dw_ocean*sqrt(sqrt(area(i,j)/1.e10))) )
1976 if ( hydrostatic )
then 1979 den(i) = dp(i,j)/(dpeln(i,j)*
rdgas*pt(i,j))
1980 cpm(i) = (1.-(qv(i,j)+q_liq(i)+q_sol(i)))*
cp_air + qv(i,j)*
cp_vap + &
1988 den(i) = -dp(i,j)/(
grav*delz(i,j))
1989 cpm(i) = (1.-(qv(i,j)+q_liq(i)+q_sol(i)))*
cv_air + qv(i,j)*
cv_vap + &
1997 tcp2(i) = lcp2(i) + icp2(i)
1999 tcp3(i) = lcp2(i) + icp2(i)*
min(1., dim(
tice,t0(i))/40.)
2002 if ( consv_te )
then 2003 if ( hydrostatic )
then 2005 te0(i,j) = -
cp_air*dp(i,j)*t0(i)*(1.+
zvir*qv(i,j))
2009 #if defined(USE_COND) && defined(MOIST_CAPPA) 2010 te0(i,j) = -cpm(i)*dp(i,j)*t0(i)
2012 te0(i,j) = -
cv_air*dp(i,j)*t0(i)
2022 if( qi(i,j) < 0. )
then 2024 qs(i,j) = qs(i,j) + qi(i,j)
2026 elseif ( qi(i,j)>
qcmin .and. pt1(i) >
tice )
then 2029 sink =
min( qi(i,j), (pt1(i)-
tice)/icp2(i) )
2032 ql(i,j) = ql(i,j) + tmp
2033 qr(i,j) = qr(i,j) + sink - tmp
2034 qi(i,j) = qi(i,j) - sink
2035 pt1(i) = pt1(i) - sink*icp2(i)
2040 dtmp = pt1(i) - (
tice + 1.)
2041 if ( qs(i,j)>
qcmin .and. dtmp>0. )
then 2042 tmp =
min( 1., fac_s*(dtmp*0.2)**2 ) * qs(i,j)
2043 sink =
min( tmp, dtmp/icp2(i) )
2044 qr(i,j) = qr(i,j) + sink
2045 qs(i,j) = qs(i,j) - sink
2046 pt1(i) = pt1(i) - sink*icp2(i)
2051 if( qs(i,j) < 0. )
then 2053 qg(i,j) =
qg(i,j) + qs(i,j)
2055 elseif(
qg(i,j) < 0. )
then 2057 tmp =
min( -
qg(i,j),
max(0., qs(i,j)) )
2058 qg(i,j) =
qg(i,j) + tmp
2059 qs(i,j) = qs(i,j) - tmp
2065 if( ql(i,j) < 0. )
then 2067 tmp =
min( -ql(i,j),
max(0., qr(i,j)) )
2068 ql(i,j) = ql(i,j) + tmp
2069 qr(i,j) = qr(i,j) - tmp
2070 elseif( qr(i,j) < 0. )
then 2072 tmp =
min( -qr(i,j),
max(0., ql(i,j)) )
2073 ql(i,j) = ql(i,j) - tmp
2074 qr(i,j) = qr(i,j) + tmp
2081 dtmp =
tice - 48. - pt1(i)
2082 if( ql(i,j)>0. .and. dtmp > 0. )
then 2083 sink =
min( ql(i,j), dtmp/icp2(i) )
2084 ql(i,j) = ql(i,j) - sink
2085 qi(i,j) = qi(i,j) + sink
2086 pt1(i) = pt1(i) + sink*icp2(i)
2089 if ( last_step )
then 2092 qsw =
wqs2(pt1(i), den(i), dqsdt)
2094 if ( dq0 > 0. )
then 2096 src(i) = dq0/(1.+tcp3(i)*dqsdt)
2099 src(i) = -
min( ql(i,j), -fac_l2v*dq0/(1.+tcp3(i)*dqsdt) )
2106 qsw =
wqs2(pt1(i), den(i), dqsdt)
2108 if ( dq0 > 0. )
then 2109 tmp = dq0/(1.+tcp3(i)*dqsdt)
2110 src(i) =
min(adj_fac*tmp,
max(
ql_gen-ql(i,j), fac_v2l*tmp))
2114 src(i) = -
min( ql(i,j), -fac_l2v*dq0/(1.+tcp3(i)*dqsdt) )
2120 qv(i,j) = qv(i,j) - src(i)
2121 ql(i,j) = ql(i,j) + src(i)
2122 pt1(i) = pt1(i) + src(i)*lcp2(i)
2128 dtmp =
t_wfr - pt1(i)
2129 if( ql(i,j)>0. .and. dtmp > 0. )
then 2130 sink =
min( ql(i,j), ql(i,j)*dtmp*0.125, dtmp/icp2(i) )
2131 ql(i,j) = ql(i,j) - sink
2132 qi(i,j) = qi(i,j) + sink
2133 pt1(i) = pt1(i) + sink*icp2(i)
2138 if( ql(i,j)>
qcmin .and. tc > 0. )
then 2140 sink = mdt*3.3333e-10*(exp(0.66*tc)-1.)*den(i)*ql(i,j)*ql(i,j)
2141 sink =
min(ql(i,j), tc/icp2(i), sink)
2142 ql(i,j) = ql(i,j) - sink
2143 qi(i,j) = qi(i,j) + sink
2144 pt1(i) = pt1(i) + sink*icp2(i)
2149 dtmp = (
tice - 1.) - pt1(i)
2150 if( qr(i,j)>
qcmin .and. dtmp > 0. )
then 2151 tmp =
min( 1., fac_r*(dtmp*0.025)**2 ) * qr(i,j)
2152 sink =
min( tmp, dtmp/icp2(i) )
2153 qr(i,j) = qr(i,j) - sink
2154 qg(i,j) =
qg(i,j) + sink
2155 pt1(i) = pt1(i) + sink*icp2(i)
2161 q_liq(i) =
max(0., ql(i,j) + qr(i,j))
2162 q_sol(i) =
max(0., qi(i,j) + qs(i,j) +
qg(i,j))
2173 if ( hydrostatic )
then 2175 cpm(i) = (1.-(qv(i,j)+q_liq(i)+q_sol(i)))*
cp_air + qv(i,j)*
cp_vap + &
2182 cpm(i) = (1.-(qv(i,j)+q_liq(i)+q_sol(i)))*
cv_air + qv(i,j)*
cv_vap + &
2190 tcp2(i) = lcp2(i) + icp2(i)
2199 p1(i) = dp(i,j)/dpeln(i,j)
2200 if ( p1(i) >
p_min )
then 2201 if ( pt1(i) <
t_min )
then 2202 src(i) = dim(qv(i,j), 1.e-7 )
2203 elseif ( pt1(i) <
tice0 )
then 2204 qsi =
iqs2(pt1(i), den(i), dqsdt)
2206 sink = adj_fac*dq/(1.+tcp2(i)*dqsdt)
2207 if ( qi(i,j) >
qrmin )
then 2209 pidep = sdt*dq*349138.78*exp(0.875*log(qi(i,j)*den(i))) &
2210 / (qsi*den(i)*lat2/(0.0243*
rvgas*pt1(i)**2) + 4.42478e4)
2217 src(i) =
min(sink,
max(qi_crt-qi(i,j),pidep), tmp/tcp2(i))
2219 pidep = pidep *
min(1., dim(pt1(i),
t_sub)*0.2)
2220 src(i) =
max(pidep, sink, -qi(i,j))
2226 qv(i,j) = qv(i,j) - src(i)
2227 qi(i,j) = qi(i,j) + src(i)
2228 pt1(i) = pt1(i) + src(i)*tcp2(i)
2234 if ( qi(i,j) > qim )
then 2235 sink = fac_i2s*(qi(i,j)-qim)
2236 qi(i,j) = qi(i,j) - sink
2237 qs(i,j) = qs(i,j) + sink
2244 if( tc<-1.0 .and. qs(i,j)>1.e-7 .and. ql(i,j)>1.e-7 )
then 2245 factor = mdt*sqrt(
sfcrho/den(i))*
csacw*exp(0.8125*log(qs(i,j)*den(i)))
2246 psacw =
min( factor/(1.+factor)*ql(i,j), -tc/icp2(i) )
2247 qs(i,j) = qs(i,j) + psacw
2248 ql(i,j) = ql(i,j) - psacw
2249 pt1(i) = pt1(i) + psacw*icp2(i)
2254 if(
qg(i,j) < 0. )
then 2256 tmp =
min( -
qg(i,j),
max(0., qi(i,j)) )
2257 qg(i,j) =
qg(i,j) + tmp
2258 qi(i,j) = qi(i,j) - tmp
2264 call revap_rac1(hydrostatic, is, ie, sdt, pt1, qv(is,j), ql(is,j), qr(is,j), qi(is,j), qs(is,j),
qg(is,j), den, hvar)
2269 q_liq(i) = ql(i,j) + qr(i,j)
2270 q_sol(i) = qi(i,j) + qs(i,j) +
qg(i,j)
2271 q_con(i,j) = q_liq(i) + q_sol(i)
2272 pt(i,j) = pt1(i)*(1.+
zvir*qv(i,j))*(1.-q_con(i,j))
2278 pt(i,j) = pt1(i)*(1.+
zvir*qv(i,j))
2284 dtdt(i,j) = dtdt(i,j) + pt1(i) - t0(i)
2288 if ( consv_te )
then 2289 if ( hydrostatic )
then 2291 te0(i,j) = te0(i,j) +
cp_air*dp(i,j)*pt1(i)*(1.+
zvir*qv(i,j))
2295 #if defined(USE_COND) && defined(MOIST_CAPPA) 2296 te0(i,j) = te0(i,j) + cpm(i)*dp(i,j)*pt1(i)
2298 te0(i,j) = te0(i,j) +
cv_air*dp(i,j)*pt1(i)
2304 if (
do_qa .and. last_step )
then 2313 q_sol(i) = qi(i,j) + qs(i,j) +
qg(i,j)
2317 q_sol(i) = qi(i,j) + qs(i,j)
2327 if ( p1(i) >
p_min )
then 2329 condensates = q_sol(i) + ql(i,j) + qr(i,j)
2331 condensates = q_sol(i) + ql(i,j)
2333 qpz = qv(i,j) + condensates
2335 tin = pt1(i) - ( lcp2(i)*condensates + icp2(i)*q_sol(i) )
2336 if( tin <=
t_wfr )
then 2337 qstar =
iqs1(tin, den(i))
2338 elseif ( tin >
tice )
then 2339 qstar =
wqs1(tin, den(i))
2342 qsi =
iqs1(tin, den(i))
2343 qsw =
wqs1(tin, den(i))
2344 if( condensates > 3.e-6 )
then 2345 rqi = q_sol(i) / condensates
2350 qstar = rqi*qsi + (1.-rqi)*qsw
2358 if ( rh > 0.75 .and. qpz >
qrmin )
then 2362 if ( qstar < q_minus )
then 2365 if ( qstar<q_plus )
then 2366 qa(i,j) = (q_plus-qstar)/(dq+dq)
2369 if ( condensates > 1.0e-6 ) qa(i,j) =
max(
cld_min, qa(i,j))
2381 subroutine revap_rac1(hydrostatic, is, ie, dt, tz, qv, ql, qr, qi, qs, qg, den, hvar)
2382 logical,
intent(in):: hydrostatic
2383 integer,
intent(in):: is, ie
2384 real,
intent(in):: dt
2385 real,
intent(in),
dimension(is:ie):: den, hvar, qi, qs, qg
2386 real,
intent(inout),
dimension(is:ie):: tz, qv, qr, ql
2388 real,
dimension(is:ie):: lcp2, denfac
2389 real :: dqv, qsat, dqsdt, evap, qden, q_plus, q_minus, sink
2390 real :: tin, t2, qpz, dq, dqh, q_liq, q_sol
2393 if ( hydrostatic )
then 2395 q_liq = ql(i) + qr(i)
2396 q_sol = qi(i) + qs(i) +
qg(i)
2402 q_liq = ql(i) + qr(i)
2403 q_sol = qi(i) + qs(i) +
qg(i)
2410 if ( qr(i) >
qrmin .and. tz(i) >
t_wfr )
then 2412 tin = tz(i) - lcp2(i)*ql(i)
2413 qsat =
wqs2(tin, den(i), dqsdt)
2425 if ( dqv >
qvmin .and. qsat > q_minus )
then 2426 if ( qsat > q_plus )
then 2431 dq = 0.25*(q_minus-qsat)**2 / dqh
2435 evap =
crevp(1)*t2*dq*(
crevp(2)*sqrt(qden)+
crevp(3)*exp(0.725*log(qden))) &
2437 evap =
min( qr(i), dt*evap, dqv/(1.+lcp2(i)*dqsdt) )
2438 qr(i) = qr(i) - evap
2439 qv(i) = qv(i) + evap
2440 tz(i) = tz(i) - evap*lcp2(i)
2443 if ( qr(i)>
qrmin .and. ql(i)>1.e-8 .and. qsat<q_plus )
then 2447 denfac(i) = sqrt(
sfcrho/den(i))
2448 sink = dt*denfac(i)*
cracw*exp(0.95*log(qr(i)*den(i)))
2449 sink = sink/(1.+sink)*ql(i)
2450 ql(i) = ql(i) - sink
2451 qr(i) = qr(i) + sink
2458 subroutine terminal_fall(dtm, ktop, kbot, tz, qv, ql, qr, qg, qs, qi, pm, dz, dp, &
2459 den, vtg, vts, vti, fac_sno, fac_gra, r1, g1, s1, i1, m1_sol, w1)
2463 real,
intent(in):: dtm
2464 integer,
intent(in):: ktop, kbot
2465 real,
intent(in):: fac_sno, fac_gra
2466 real,
intent(in),
dimension(ktop:kbot):: vtg, vts, vti, pm, den, dp, dz
2467 real,
intent(inout),
dimension(ktop:kbot):: qv, ql, qr, qg, qs, qi, tz, m1_sol, w1
2468 real,
intent(out):: r1, g1, s1, i1
2470 real,
dimension(ktop:kbot+1):: ze, zt
2471 real :: qsat, dqsdt, dt5, melt, evap, dtime
2472 real :: factor, frac
2473 real :: tmp1, precip, tc, sink
2474 real,
dimension(ktop:kbot):: lcpk, icpk
2475 real,
dimension(ktop:kbot):: m1, dm
2497 if ( tz(k) >
tice )
then 2509 if( qi(k) >
qcmin .and. tc>0. )
then 2510 melt =
min( qi(k), tc/icpk(k) )
2512 ql(k) = ql(k) + tmp1
2513 qr(k) = qr(k) + melt - tmp1
2514 qi(k) = qi(k) - melt
2515 tz(k) = tz(k) - melt*icpk(k)
2522 if ( qs(k)>
qvmin .and. tc>0. )
then 2524 sink =
min(fac_sno*qs(k), factor*tc/icpk(k))
2525 qs(k) = qs(k) - sink
2526 qr(k) = qr(k) + sink
2527 tz(k) = tz(k) - sink*icpk(k)
2534 if (
qg(k)>
qcmin .and. tc>0.01 )
then 2536 sink =
min( fac_gra*
qg(k), factor*tc/icpk(k) )
2537 qg(k) =
qg(k) - sink
2538 qr(k) = qr(k) + sink
2539 tz(k) = tz(k) - sink*icpk(k)
2544 if ( dtm < 60. ) k0 = kbot
2553 ze(k) = ze(k+1) - dz(k)
2560 if (
vi_fac < 1.e-5 .or. no_fall )
then 2565 zt(k) = ze(k) - dt5*(vti(k-1)+vti(k))
2567 zt(kbot+1) = zs - dtm*vti(kbot)
2570 if( zt(k+1)>=zt(k) ) zt(k+1) = zt(k) -
dz_min 2573 if ( k0 < kbot )
then 2575 if ( qi(k) >
qrmin )
then 2577 if ( zt(k+1)>=ze(m) )
exit 2578 if ( zt(k)<ze(m+1) .and. tz(m)>
tice )
then 2580 melt =
min( qi(k)*dp(k)/dp(m), dtime*(tz(m)-
tice)/icpk(m) )
2582 ql(m) = ql(m) + tmp1
2583 qr(m) = qr(m) - tmp1 + melt
2584 tz(m) = tz(m) - melt*icpk(m)
2585 qi(k) = qi(k) - melt*dp(m)/dp(k)
2594 dm(k) = dp(k)*(1.+qv(k)+ql(k)+qr(k)+qi(k)+qs(k)+
qg(k))
2604 w1(ktop) = (dm(ktop)*w1(ktop)+m1_sol(ktop)*vti(ktop)) /(dm(ktop)-m1_sol(ktop))
2606 w1(k) = (dm(k)*w1(k)-m1_sol(k-1)*vti(k-1)+m1_sol(k)*vti(k)) &
2607 / (dm(k) +m1_sol(k-1) -m1_sol(k))
2625 zt(k) = ze(k) - dt5*(vts(k-1)+vts(k))
2627 zt(kbot+1) = zs - dtm*vts(kbot)
2630 if( zt(k+1)>=zt(k) ) zt(k+1) = zt(k) -
dz_min 2633 if ( k0 < kbot )
then 2635 if ( qs(k) >
qrmin )
then 2637 if ( zt(k+1)>=ze(m) )
exit 2638 dtime =
min( dtm, (ze(m)-ze(m+1))/(
vmin+vts(k)) )
2639 if ( zt(k)<ze(m+1) .and. tz(m)>
tice )
then 2641 melt =
min(qs(k)*dp(k)/dp(m), dtime*(tz(m)-
tice)/icpk(m))
2642 tz(m) = tz(m) - melt*icpk(m)
2643 qs(k) = qs(k) - melt*dp(m)/dp(k)
2644 if ( zt(k)<zs )
then 2645 r1 = r1 + melt*dp(m)
2648 qr(m) = qr(m) + melt
2651 if ( qs(k) <
qrmin )
exit 2659 dm(k) = dp(k)*(1.+qv(k)+ql(k)+qr(k)+qi(k)+qs(k)+
qg(k))
2668 m1_sol(k) = m1_sol(k) + m1(k)
2671 w1(ktop) = (dm(ktop)*w1(ktop)+m1(ktop)*vts(ktop)) /(dm(ktop)-m1(ktop))
2673 w1(k) = (dm(k)*w1(k) - m1(k-1)*vts(k-1) + m1(k)*vts(k)) &
2674 / (dm(k) + m1(k-1) - m1(k))
2689 zt(k) = ze(k) - dt5*(vtg(k-1)+vtg(k))
2691 zt(kbot+1) = zs - dtm*vtg(kbot)
2694 if( zt(k+1)>=zt(k) ) zt(k+1) = zt(k) -
dz_min 2697 if ( k0 < kbot )
then 2701 if ( zt(k+1)>=ze(m) )
exit 2702 dtime =
min( dtm, (ze(m)-ze(m+1))/vtg(k) )
2703 if ( zt(k)<ze(m+1) .and. tz(m)>
tice )
then 2705 melt =
min(
qg(k)*dp(k)/dp(m), dtime*(tz(m)-
tice)/icpk(m))
2706 tz(m) = tz(m) - melt*icpk(m)
2707 qg(k) =
qg(k) - melt*dp(m)/dp(k)
2708 if ( zt(k)<zs )
then 2709 r1 = r1 + melt*dp(m)
2711 qr(m) = qr(m) + melt
2722 dm(k) = dp(k)*(1.+qv(k)+ql(k)+qr(k)+qi(k)+qs(k)+
qg(k))
2731 m1_sol(k) = m1_sol(k) + m1(k)
2734 w1(ktop) = (dm(ktop)*w1(ktop)+m1(ktop)*vtg(ktop)) /(dm(ktop)-m1(ktop))
2736 w1(k) = (dm(k)*w1(k) - m1(k-1)*vtg(k-1) + m1(k)*vtg(k)) &
2737 / (dm(k) + m1(k-1) - m1(k))
2747 integer,
intent(in):: ktop, kbot
2748 real,
intent(in):: q(ktop:kbot)
2749 logical,
intent(out):: no_fall
2755 if ( q(k) >
qrmin )
then 2765 real,
intent(in):: zs
2766 integer,
intent(in):: ktop, kbot
2767 real,
intent(in),
dimension(ktop:kbot+1):: ze, zt
2768 real,
intent(in),
dimension(ktop:kbot):: dp
2769 real,
intent(inout),
dimension(ktop:kbot):: q, m1
2770 real,
intent(out):: precip
2772 real,
dimension(ktop:kbot):: qm
2777 q(k) = q(k)*dp(k) / (zt(k)-zt(k+1))
2784 if(ze(k) <= zt(n) .and. ze(k) >= zt(n+1))
then 2785 if(ze(k+1) >= zt(n+1))
then 2787 qm(k) = q(n)*(ze(k)-ze(k+1))
2791 qm(k) = q(n)*(ze(k)-zt(n+1))
2794 if(ze(k+1) < zt(m+1) )
then 2795 qm(k) = qm(k) + q(m)
2797 qm(k) = qm(k) + q(m)*(zt(m)-ze(k+1))
2809 m1(ktop) = q(ktop) - qm(ktop)
2811 m1(k) = m1(k-1) + q(k) - qm(k)
2814 #ifdef DO_DIRECT_PRECIP 2818 if ( zt(k+1) < zs )
then 2819 precip = q(k)*(zs-zt(k+1))
2820 if ( (k+1) > kbot )
goto 777
2822 precip = precip + q(m)
2843 integer,
intent(in):: ktop, kbot
2844 real,
intent(in):: zs
2845 logical,
intent(in):: mono
2846 real,
intent(in),
dimension(ktop:kbot+1):: ze, zt
2847 real,
intent(in),
dimension(ktop:kbot):: dp
2849 real,
intent(inout),
dimension(ktop:kbot):: q, m1
2850 real,
intent(out):: precip
2852 real,
dimension(ktop:kbot):: qm, dz
2853 real:: a4(4,ktop:kbot)
2854 real:: pl, pr, delz, esl
2856 real,
parameter:: r3 = 1./3., r23 = 2./3.
2860 dz(k) = zt(k) - zt(k+1)
2862 a4(1,k) = q(k) / dz(k)
2868 call cs_profile(a4(1,ktop), dz(ktop), kbot-ktop+1, mono)
2873 if(ze(k) <= zt(n) .and. ze(k) >= zt(n+1))
then 2874 pl = (zt(n)-ze(k)) / dz(n)
2875 if( zt(n+1) <= ze(k+1) )
then 2877 pr = (zt(n)-ze(k+1)) / dz(n)
2878 qm(k) = a4(2,n) + 0.5*(a4(4,n)+a4(3,n)-a4(2,n))*(pr+pl) - &
2879 a4(4,n)*r3*(pr*(pr+pl)+pl**2)
2880 qm(k) = qm(k)*(ze(k)-ze(k+1))
2884 qm(k) = (ze(k)-zt(n+1)) * (a4(2,n)+0.5*(a4(4,n)+ &
2885 a4(3,n)-a4(2,n))*(1.+pl) - a4(4,n)*( r3*(1.+pl*(1.+pl))) )
2889 if( ze(k+1) < zt(m+1) )
then 2890 qm(k) = qm(k) + q(m)
2892 delz = zt(m) - ze(k+1)
2894 qm(k) = qm(k) + delz*( a4(2,m) + 0.5*esl* &
2895 (a4(3,m)-a4(2,m)+a4(4,m)*(1.-r23*esl)) )
2908 m1(ktop) = q(ktop) - qm(ktop)
2910 m1(k) = m1(k-1) + q(k) - qm(k)
2924 integer,
intent(in):: km
2925 real ,
intent(in):: del(km)
2926 logical,
intent(in):: do_mono
2927 real ,
intent(inout):: a4(4,km)
2929 real,
parameter:: qp_min = 1.e-6
2932 real d4, bet, a_bot, grat, pmp, lac
2933 real pmp_1, lac_1, pmp_2, lac_2
2938 grat = del(2) / del(1)
2939 bet = grat*(grat+0.5)
2940 q(1) = (2.*grat*(grat+1.)*a4(1,1)+a4(1,2)) / bet
2941 gam(1) = ( 1. + grat*(grat+1.5) ) / bet
2944 d4 = del(k-1) / del(k)
2945 bet = 2. + 2.*d4 - gam(k-1)
2946 q(k) = (3.*(a4(1,k-1)+d4*a4(1,k))-q(k-1))/bet
2950 a_bot = 1. + d4*(d4+1.5)
2951 q(km+1) = (2.*d4*(d4+1.)*a4(1,km)+a4(1,km-1)-a_bot*q(km)) &
2952 / ( d4*(d4+0.5) - a_bot*gam(km) )
2955 q(k) = q(k) - gam(k)*q(k+1)
2962 gam(k) = a4(1,k) - a4(1,k-1)
2968 q(1) =
max( q(1), 0. )
2969 q(2) =
min( q(2),
max(a4(1,1), a4(1,2)) )
2970 q(2) =
max( q(2),
min(a4(1,1), a4(1,2)), 0. )
2974 if ( gam(k-1)*gam(k+1)>0. )
then 2975 q(k) =
min( q(k),
max(a4(1,k-1),a4(1,k)) )
2976 q(k) =
max( q(k),
min(a4(1,k-1),a4(1,k)) )
2978 if ( gam(k-1) > 0. )
then 2980 q(k) =
max( q(k),
min(a4(1,k-1),a4(1,k)) )
2983 q(k) =
min( q(k),
max(a4(1,k-1),a4(1,k)) )
2984 q(k) =
max( q(k), 0.0 )
2989 q(km ) =
min( q(km),
max(a4(1,km-1), a4(1,km)) )
2990 q(km ) =
max( q(km),
min(a4(1,km-1), a4(1,km)), 0. )
3002 if ( gam(k)*gam(k+1) > 0.0 )
then 3013 if ( a4(1,k)<qp_min .or. extm(k-1) .or. extm(k+1) )
then 3018 a4(4,k) = 6.*a4(1,k) - 3.*(a4(2,k)+a4(3,k))
3019 if( abs(a4(4,k)) > abs(a4(2,k)-a4(3,k)) )
then 3021 pmp_1 = a4(1,k) - 2.0*gam(k+1)
3022 lac_1 = pmp_1 + 1.5*gam(k+2)
3023 a4(2,k) =
min(
max(a4(2,k),
min(a4(1,k), pmp_1, lac_1)), &
3024 max(a4(1,k), pmp_1, lac_1) )
3025 pmp_2 = a4(1,k) + 2.0*gam(k)
3026 lac_2 = pmp_2 - 1.5*gam(k-1)
3027 a4(3,k) =
min(
max(a4(3,k),
min(a4(1,k), pmp_2, lac_2)), &
3028 max(a4(1,k), pmp_2, lac_2) )
3034 if ( extm(k) .and. (extm(k-1).or.extm(k+1).or.a4(1,k)<qp_min) )
then 3042 a4(4,k) = 6.*a4(1,k) - 3.*(a4(2,k)+a4(3,k))
3051 da1 = a4(3,k) - a4(2,k)
3054 if(a6da < -da2)
then 3055 a4(4,k) = 3.*(a4(2,k)-a4(1,k))
3056 a4(3,k) = a4(2,k) - a4(4,k)
3057 elseif(a6da > da2)
then 3058 a4(4,k) = 3.*(a4(3,k)-a4(1,k))
3059 a4(2,k) = a4(3,k) - a4(4,k)
3075 integer,
intent(in) :: km
3076 real,
intent(inout) :: a4(4,km)
3078 real,
parameter:: r12 = 1./12.
3084 if( abs(a4(3,k)-a4(2,k)) < -a4(4,k) )
then 3085 if( (a4(1,k)+0.25*(a4(3,k)-a4(2,k))**2/a4(4,k)+a4(4,k)*r12) < 0. )
then 3086 if( a4(1,k)<a4(3,k) .and. a4(1,k)<a4(2,k) )
then 3090 elseif( a4(3,k) > a4(2,k) )
then 3091 a4(4,k) = 3.*(a4(2,k)-a4(1,k))
3092 a4(3,k) = a4(2,k) - a4(4,k)
3094 a4(4,k) = 3.*(a4(3,k)-a4(1,k))
3095 a4(2,k) = a4(3,k) - a4(4,k)
3105 subroutine fall_speed(ktop, kbot, den, qs, qi, qg, ql, tk, vts, vti, vtg)
3106 integer,
intent(in) :: ktop, kbot
3107 real,
intent(in ),
dimension(ktop:kbot) :: den, qs, qi, qg, ql, tk
3108 real,
intent(out),
dimension(ktop:kbot) :: vts, vti, vtg
3110 real,
parameter :: thi = 1.0e-9
3111 real,
parameter :: thg = 1.0e-9
3112 real,
parameter :: ths = 1.0e-9
3113 real,
parameter :: vf_min = 1.0e-5
3114 real,
parameter :: vs_max = 7.
3118 real :: vcons = 6.6280504, vcong = 87.2382675, vconi = 3.29
3119 real :: norms = 942477796.076938, &
3120 normg = 5026548245.74367
3121 real,
dimension(ktop:kbot) :: ri, qden, tc, rhof
3122 real :: aa = -4.14122e-5, bb = -0.00538922, cc = -0.0516344, dd = 0.00216078, ee = 1.9714
3140 rhof(k) = sqrt(
min(100., rho0/den(k)) )
3145 if ( qs(k) < ths )
then 3148 vts(k) =
max(vf_min, vcons*rhof(k)*exp(0.0625*log(qs(k)*den(k)/norms)))
3153 if (
qg(k) < thg )
then 3156 vtg(k) =
max(vf_min,
max(
vmin,
vg_fac*vcong*rhof(k)*sqrt(sqrt(sqrt(
qg(k)*den(k)/normg)))))
3164 if ( qi(k) < thi )
then 3167 qden(k) = log10( 1000.*qi(k)*den(k) )
3168 tc(k) = tk(k) -
tice 3169 vti(k) = qden(k)*( tc(k)*(aa*tc(k) + bb) + cc ) + dd*tc(k) + ee
3170 vti(k) =
max( vf_min,
vi_fac*0.01*10.**vti(k) )
3177 if ( qi(k) < thi )
then 3181 vti(k) =
max( vf_min, vconf*rhof(k)*exp(0.16*log(qi(k)*den(k))) )
3191 real :: gcon, cd, scm3, pisq, act(8), acc(3)
3192 real :: vdifu, tcond
3195 real :: hlts, hltc, ri50
3197 real :: gam263, gam275, gam290, &
3198 gam325, gam350, gam380, &
3199 gam425, gam450, gam480, &
3202 data gam263/1.456943/, gam275/1.608355/, gam290/1.827363/ &
3203 gam325/2.54925/, gam350/3.323363/, gam380/4.694155/ &
3204 gam425/8.285063/, gam450/11.631769/, gam480/17.837789/ &
3205 gam625/184.860962/, gam680/496.604067/
3209 real :: rnzr, rnzs, rnzg, rhos, rhog
3215 data acc/5.0,2.0,0.5/
3226 if(
master)
write(*,*)
'prog_ccn option is .T.' 3230 if(
master)
write(*,*)
'MP: for ccn_o=',
ccn_o,
'ql_rc=', den_rc
3232 if(
master)
write(*,*)
'MP: for ccn_l=',
ccn_l,
'ql_rc=', den_rc
3247 scm3 = (visk/vdifu)**(1./3.)
3249 cracs = pisq*rnzr*rnzs*rhos
3252 cgacs = pisq*rnzg*rnzs*rhos
3258 act(1) =
pie * rnzs * rhos
3260 act(6) =
pie * rnzg * rhog
3269 acco(i,k) = acc(i)/(act(2*k-1)**((7-i)*0.25)*act(2*k)**(i*0.25))
3273 gcon = 40.74 * sqrt(
sfcrho )
3281 cgacw =
pie*rnzg*gam350*gcon/(4.*act(6)**0.875)
3294 cssub(2) = 0.78/sqrt(act(1))
3295 cgsub(2) = 0.78/sqrt(act(6))
3296 crevp(2) = 0.78/sqrt(act(2))
3297 cssub(3) = 0.31*scm3*gam263*sqrt(
clin/visk)/act(1)**0.65625
3298 cgsub(3) = 0.31*scm3*gam275*sqrt(gcon/visk)/act(6)**0.6875
3299 crevp(3) = 0.31*scm3*gam290*sqrt(
alin/visk)/act(2)**0.725
3301 cssub(5) = hlts**2*vdifu
3305 crevp(5) = hltc**2*vdifu
3307 cgfr(1) = 20.e2*pisq*rnzr*
rhor/act(2)**1.75
3313 csmlt(2) = 2.*
pie*vdifu*rnzs*hltc/hltf
3316 csmlt(5) = ch2o/hltf
3320 cgmlt(2) = 2.*
pie*vdifu*rnzg*hltc/hltf
3323 cgmlt(5) = ch2o/hltf
3333 integer,
intent(in) :: id, jd, kd
3334 integer,
intent(in) :: axes(4)
3337 integer :: unit, io, ierr, k, logunit
3341 master = (mpp_pe().eq.mpp_root_pe())
3343 #ifdef INTERNAL_FILE_NML 3347 if( file_exist(
'input.nml' ) )
then 3348 unit = open_namelist_file()
3350 do while ( io .ne. 0 )
3351 read( unit, nml = lin_cld_microphys_nml, iostat = io, end = 10 )
3354 10
call close_file ( unit )
3357 call write_version_number (
'0.0',
'fv3-jedi-lm')
3369 if (
master)
write( logunit, nml = lin_cld_microphys_nml )
3415 write(*,*)
'TESTING water vapor tables in lin_cld_microphys' 3419 q2 =
qs1d_m(tmp,
real(0,kind=FVPRC),
real(100000,kind=
fvprc))
3420 write(*,*) nint(tmp-
tice), q1, q2,
'dq=', q1-q2
3425 if (
master )
write(*,*)
'lin_cld_micrphys diagnostics initialized.' 3437 deallocate (
table )
3454 master = (mpp_pe().eq.mpp_root_pe())
3464 real function acr3d(v1, v2, q1, q2, c, cac, rho)
3465 real,
intent(in) :: v1, v2, c, rho
3466 real,
intent(in) :: q1, q2
3467 real,
intent(in) :: cac(3)
3482 acr3d = c*abs(v1-v2)*q1*s2*(cac(1)*t1 + cac(2)*sqrt(t1)*s2 + cac(3)*s1)
3489 real function smlt(tc, dqs, qsrho,psacw,psacr,c,rho, rhofac)
3490 real,
intent(in):: tc,dqs,qsrho,psacw,psacr,c(5),rho, rhofac
3492 smlt = (c(1)*tc/rho-c(2)*dqs) * (c(3)*sqrt(qsrho)+ &
3493 c(4)*qsrho**0.65625*sqrt(rhofac)) + c(5)*tc*(psacw+psacr)
3498 real function gmlt(tc, dqs,qgrho,pgacw,pgacr,c, rho)
3499 real,
intent(in):: tc,dqs,qgrho,pgacw,pgacr,c(5),rho
3503 gmlt = (c(1)*tc/rho-c(2)*dqs) * (c(3)*sqrt(qgrho)+ &
3504 c(4)*qgrho**0.6875/rho**0.25) + c(5)*tc*(pgacw+pgacr)
3509 integer,
parameter:: length=2621
3514 master = (mpp_pe().eq.mpp_root_pe())
3515 if (
master) print*,
' lin MP: initializing qs tables' 3521 allocate (
table( length) )
3522 allocate (
table2(length) )
3523 allocate (
table3(length) )
3524 allocate (
tablew(length) )
3525 allocate (
des(length) )
3526 allocate (
des2(length) )
3527 allocate (
des3(length) )
3528 allocate (
desw(length) )
3541 des(length) =
des(length-1)
3551 real function wqs1(ta, den)
3554 real,
intent(in):: ta, den
3560 ap1 = 10.*dim(ta, tmin) + 1.
3561 ap1 =
min(2621., ap1)
3568 real function wqs2(ta, den, dqdt)
3571 real,
intent(in):: ta, den
3572 real,
intent(out):: dqdt
3580 ap1 = 10.*dim(ta, tmin) + 1.
3581 ap1 =
min(2621., ap1)
3593 real,
intent(in):: t, q, den
3594 real :: qs, tp, dqdt
3598 tp = 0.5*(qs-q)/(1.+
lcp*dqdt)*
lcp 3601 if ( tp > 0.01 )
then 3603 tp = (qs-q)/(1.+
lcp*dqdt)*
lcp 3608 real function iqs1(ta, den)
3611 real,
intent(in):: ta, den
3617 ap1 = 10.*dim(ta, tmin) + 1.
3618 ap1 =
min(2621., ap1)
3625 real function iqs2(ta, den, dqdt)
3628 real,
intent(in):: ta, den
3629 real,
intent(out):: dqdt
3635 ap1 = 10.*dim(ta, tmin) + 1.
3636 ap1 =
min(2621., ap1)
3647 real,
intent(in):: ta, pa, qv
3648 real,
intent(out):: dqdt
3652 real,
parameter:: eps10 = 10.*
eps 3655 ap1 = 10.*dim(ta, tmin) + 1.
3656 ap1 =
min(2621., ap1)
3667 real,
intent(in):: ta, pa, qv
3668 real,
intent(out):: dqdt
3672 real,
parameter:: eps10 = 10.*
eps 3675 ap1 = 10.*dim(ta, tmin) + 1.
3676 ap1 =
min(2621., ap1)
3686 real,
intent(in):: ta, pa, qv
3692 ap1 = 10.*dim(ta, tmin) + 1.
3693 ap1 =
min(2621., ap1)
3700 real function qs1d_m(ta, qv, pa)
3702 real,
intent(in):: ta, pa, qv
3706 real,
parameter:: eps10 = 10.*
eps 3709 ap1 = 10.*dim(ta, tmin) + 1.
3710 ap1 =
min(2621., ap1)
3717 real function d_sat(ta)
3719 real,
intent(in):: ta
3721 real es_w, es_i, ap1
3724 ap1 = 10.*dim(ta, tmin) + 1.
3725 ap1 =
min(2621., ap1)
3738 real,
intent(in):: ta
3742 ap1 = 10.*dim(ta, tmin) + 1.
3743 ap1 =
min(2621., ap1)
3751 real,
intent(in):: ta
3755 ap1 = 10.*dim(ta, tmin) + 1.
3756 ap1 =
min(2621., ap1)
3763 integer,
intent(in):: n
3765 real,
intent(in):: ta(n)
3766 real,
intent(out):: es(n)
3772 ap1 = 10.*dim(ta(i), tmin) + 1.
3773 ap1 =
min(2621., ap1)
3782 integer,
intent(in):: n
3785 real,
intent(in):: ta(n)
3786 real,
intent(out):: es(n)
3792 ap1 = 10.*dim(ta(i), tmin) + 1.
3793 ap1 =
min(2621., ap1)
3801 integer,
intent(in):: n
3803 real,
intent(in):: ta(n)
3804 real,
intent(out):: es(n)
3810 ap1 = 10.*dim(ta(i), tmin) + 1.
3811 ap1 =
min(2621., ap1)
3821 integer,
intent(in):: n
3823 real esbasw, tbasw, esbasi, tbasi, tmin, tem, aa, b, c, d, e
3834 tem = tmin+delt*
real(i-1)
3836 #ifdef SMITHSONIAN_TABLE 3838 aa = -7.90298*(tbasw/tem-1.)
3839 b = 5.02808*alog10(tbasw/tem)
3840 c = -1.3816e-07*(10**((1.-tem/tbasw)*11.344)-1.)
3841 d = 8.1328e-03*(10**((tbasw/tem-1.)*(-3.49149))-1.)
3843 tablew(i) = 0.1 * 10**(aa+b+c+d+e)
3854 integer,
intent(in):: n
3856 real esbasw, tbasw, esbasi, tbasi, tmin, tem, aa, b, c, d, e
3869 tem = tmin+delt*
real(i-1)
3870 if ( i<= 1600 )
then 3872 #ifdef SMITHSONIAN_TABLE 3874 aa = -9.09718 *(tbasi/tem-1.)
3875 b = -3.56654 *alog10(tbasi/tem)
3876 c = 0.876793*(1.-tem/tbasi)
3878 table2(i) = 0.1 * 10**(aa+b+c+e)
3884 #ifdef SMITHSONIAN_TABLE 3886 aa = -7.90298*(tbasw/tem-1.)
3887 b = 5.02808*alog10(tbasw/tem)
3888 c = -1.3816e-07*(10**((1.-tem/tbasw)*11.344)-1.)
3889 d = 8.1328e-03*(10**((tbasw/tem-1.)*(-3.49149))-1.)
3891 table2(i) = 0.1 * 10**(aa+b+c+d+e)
3901 i0 = 1600; i1 = 1601
3913 integer,
intent(in):: n
3915 real esbasw, tbasw, esbasi, tbasi, tmin, tem, aa, b, c, d, e
3928 tem = tmin+delt*
real(i-1)
3930 if ( i<= 1580 )
then 3933 aa = -9.09718 *(tbasi/tem-1.)
3934 b = -3.56654 *alog10(tbasi/tem)
3935 c = 0.876793*(1.-tem/tbasi)
3937 table3(i) = 0.1 * 10**(aa+b+c+e)
3941 aa = -7.90298*(tbasw/tem-1.)
3942 b = 5.02808*alog10(tbasw/tem)
3943 c = -1.3816e-07*(10**((1.-tem/tbasw)*11.344)-1.)
3944 d = 8.1328e-03*(10**((tbasw/tem-1.)*(-3.49149))-1.)
3946 table3(i) = 0.1 * 10**(aa+b+c+d+e)
3966 real,
intent(in):: t, p, q
3971 ap1 = 10.*dim(t, tmin) + 1.
3972 ap1 =
min(2621., ap1)
3980 integer,
intent(in):: n
3983 real esbasw, tbasw, esbasi, tbasi, tmin, tem, aa, b, c, d, e, esh20
3997 tem = tmin+delt*
real(i-1)
3998 #ifdef SMITHSONIAN_TABLE 3999 aa = -9.09718 *(tbasi/tem-1.)
4000 b = -3.56654 *alog10(tbasi/tem)
4001 c = 0.876793*(1.-tem/tbasi)
4003 table(i)= 0.1 * 10**(aa+b+c+e)
4012 tem = 253.16+delt*
real(i-1)
4013 #ifdef SMITHSONIAN_TABLE 4014 aa = -7.90298*(tbasw/tem-1.)
4015 b = 5.02808*alog10(tbasw/tem)
4016 c = -1.3816e-07*(10**((1.-tem/tbasw)*11.344)-1.)
4017 d = 8.1328e-03*(10**((tbasw/tem-1.)*(-3.49149))-1.)
4019 esh20 = 0.1 * 10**(aa+b+c+d+e)
4026 table(i+1400) = esh20
4032 tem = 253.16+delt*
real(i-1)
4033 wice = 0.05*(273.16-tem)
4034 wh2o = 0.05*(tem-253.16)
4035 table(i+1400) = wice*
table(i+1400)+wh2o*esupc(i)
4041 subroutine qsmith(im, km, ks, t, p, q, qs, dqdt)
4043 integer,
intent(in):: im, km, ks
4044 real,
intent(in),
dimension(im,km):: t, p, q
4045 real,
intent(out),
dimension(im,km):: qs
4046 real,
intent(out),
optional:: dqdt(im,km)
4048 real,
parameter:: eps10 = 10.*
eps 4060 ap1 = 10.*dim(t(i,k), tmin) + 1.
4061 ap1 =
min(2621., ap1)
4063 es(i,k) =
table(it) + (ap1-it)*
des(it)
4064 qs(i,k) =
eps*es(i,k)*(1.+
zvir*q(i,k))/p(i,k)
4068 if (
present(dqdt) )
then 4071 ap1 = 10.*dim(t(i,k), tmin) + 1.
4072 ap1 =
min(2621., ap1) - 0.5
4074 dqdt(i,k) = eps10*(
des(it)+(ap1-it)*(
des(it+1)-
des(it)))*(1.+
zvir*q(i,k))/p(i,k)
4082 subroutine neg_adj(ktop, kbot, p1, pt, dp, qv, ql, qr, qi, qs, qg)
4085 integer,
intent(in):: ktop, kbot
4086 real,
intent(in):: dp(ktop:kbot), p1(ktop:kbot)
4087 real,
intent(inout),
dimension(ktop:kbot):: &
4088 pt, qv, ql, qr, qi, qs, qg
4090 real lcpk(ktop:kbot), icpk(ktop:kbot)
4105 if( qi(k) < 0. )
then 4106 qs(k) = qs(k) + qi(k)
4110 if( qs(k) < 0. )
then 4111 qg(k) =
qg(k) + qs(k)
4115 if (
qg(k) < 0. )
then 4116 qr(k) = qr(k) +
qg(k)
4117 pt(k) = pt(k) -
qg(k)*icpk(k)
4123 if ( qr(k) < 0. )
then 4124 ql(k) = ql(k) + qr(k)
4128 if ( ql(k) < 0. )
then 4129 qv(k) = qv(k) + ql(k)
4130 pt(k) = pt(k) - ql(k)*lcpk(k)
4139 if( qv(k) < 0. )
then 4140 qv(k+1) = qv(k+1) + qv(k)*dp(k)/dp(k+1)
4146 if( qv(kbot) < 0. .and. qv(kbot-1)>0.)
then 4147 dq =
min(-qv(kbot)*dp(kbot), qv(kbot-1)*dp(kbot-1))
4148 qv(kbot-1) = qv(kbot-1) - dq/dp(kbot-1)
4149 qv(kbot ) = qv(kbot ) + dq/dp(kbot )
4156 subroutine sg_conv(is, ie, js, je, isd, ied, jsd, jed, &
4158 delp, phalf, pm, zfull, zhalf, ta, qa, ua, va, w, &
4159 u_dt, v_dt, t_dt, q_dt, nqv, nql, nqi, nqr, nqs, nqg, &
4160 hydrostatic, phys_hydrostatic)
4163 logical,
intent(in):: hydrostatic, phys_hydrostatic
4164 integer,
intent(in):: is, ie, js, je, km, nq
4165 integer,
intent(in):: isd, ied, jsd, jed
4166 integer,
intent(in):: tau
4167 integer,
intent(in):: nqv, nql, nqi
4168 integer,
intent(in):: nqr, nqs, nqg
4169 real,
intent(in):: dt
4170 real,
intent(in):: phalf(is:ie,js:je,km+1)
4171 real,
intent(in):: pm(is:ie,js:je,km)
4172 real,
intent(in):: zfull(is:ie,js:je,km)
4173 real,
intent(in):: zhalf(is:ie,js:je,km+1)
4174 real,
intent(in):: delp(isd:ied,jsd:jed,km)
4176 real,
intent(inout),
dimension(is:ie,js:je,km):: ta, ua, va
4177 real,
intent(inout):: qa(is:ie,js:je,km,nq)
4178 real,
intent(inout):: w(isd:ied,jsd:jed,km)
4179 real,
intent(inout):: u_dt(isd:ied,jsd:jed,km)
4180 real,
intent(inout):: v_dt(isd:ied,jsd:jed,km)
4181 real,
intent(inout):: t_dt(is:ie,js:je,km)
4182 real,
intent(inout):: q_dt(is:ie,js:je,km,nq)
4184 real,
dimension(is:ie,km):: tvm, u0, v0, w0, t0, gz, hd, pkz, qcon
4185 real,
dimension(is:ie,km+1):: pk, peln
4186 real:: q0(is:ie,km,nq)
4188 real:: pbot, ri, pt1, pt2, lf, ratio
4189 real:: rdt, dh, dh0, dhs, dq, tv, h0, mc, mx, fra, rk, rz, rcp
4193 integer i, j, k, n, m, iq, kk
4194 real,
parameter:: ustar2 = 1.e-6
4195 real,
parameter:: dh_min = 1.e-4
4197 if ( nqv /= 1 )
then 4198 call error_mesg (
'sg_conv',
'Tracer indexing error', fatal)
4217 peln(i,k) = log(phalf(i,j,k))
4218 pk(i,k) = exp(
kappa*peln(i,k))
4227 pkz(i,k) = (pk(i,k+1)-pk(i,k))/(
kappa*(peln(i,k+1)-peln(i,k)))
4231 if ( .not.hydrostatic )
then 4242 q0(i,k,iq) = qa(i,j,k,iq)
4254 ratio =
real(n)/
real(m)
4256 if( phys_hydrostatic )
then 4262 tvm(i,k) = t0(i,k)*(1.+
zvir*q0(i,k,nqv))
4264 gz(i,k) = gzh(i) + tv*(1.-phalf(i,j,k)/pm(i,j,k))
4265 hd(i,k) =
cp_air*tvm(i,k)+gz(i,k)+0.5*(u0(i,k)**2+v0(i,k)**2)
4266 gzh(i) = gzh(i) + tv*(peln(i,k+1)-peln(i,k))
4275 gz(i,k) =
grav*zfull(i,j,k)
4276 hd(i,k) =
cp_air*t0(i,k)+gz(i,k)+0.5*(u0(i,k)**2+v0(i,k)**2+w0(i,k)**2)
4286 pt1 = t0(i,k)/pkz(i,k)*(1.+
zvir*q0(i,k,nqv)-q0(i,k,nql)-q0(i,k,nqi))
4287 pt2 = t0(i,km)/pkz(i,km)*(1.+
zvir*q0(i,km,nqv)-q0(i,km,nql)-q0(i,km,nqi))
4288 ri = (gz(i,k)-gz(i,km))*(pt1-pt2)/( 0.5*(pt1+pt2)* &
4289 ((u0(i,k)-u0(i,km))**2+(v0(i,k)-v0(i,km))**2+ustar2) )
4292 mc = delp(i,j,km-1)*delp(i,j,km)/(delp(i,j,km-1)+delp(i,j,km))
4294 h0 = mc*(q0(i,km,iq)-q0(i,km-1,iq))
4295 q0(i,km-1,iq) = q0(i,km-1,iq) + h0/delp(i,j,km-1)
4296 q0(i,km ,iq) = q0(i,km ,iq) - h0/delp(i,j,km )
4299 h0 = mc*(u0(i,km)-u0(i,km-1))
4300 u0(i,km-1) = u0(i,km-1) + h0/delp(i,j,km-1)
4301 u0(i,km ) = u0(i,km ) - h0/delp(i,j,km )
4303 h0 = mc*(v0(i,km)-v0(i,km-1))
4304 v0(i,km-1) = v0(i,km-1) + h0/delp(i,j,km-1)
4305 v0(i,km ) = v0(i,km ) - h0/delp(i,j,km )
4307 h0 = mc*(hd(i,km)-hd(i,km-1))
4308 hd(i,km-1) = hd(i,km-1) + h0/delp(i,j,km-1)
4309 hd(i,km ) = hd(i,km ) - h0/delp(i,j,km )
4310 if ( .not.hydrostatic )
then 4311 h0 = mc*(w0(i,km)-w0(i,km-1))
4312 w0(i,km-1) = w0(i,km-1) + h0/delp(i,j,km-1)
4313 w0(i,km ) = w0(i,km ) - h0/delp(i,j,km )
4324 qcon(i,k-1) = q0(i,k-1,nql) + q0(i,k-1,nqi) + q0(i,k-1,nqs) + q0(i,k-1,nqr) + q0(i,k-1,nqg)
4325 qcon(i,k) = q0(i,k,nql) + q0(i,k,nqi) + q0(i,k,nqs) + q0(i,k,nqr) + q0(i,k,nqg)
4327 pt1 = t0(i,k-1)/pkz(i,k-1)*(1.+
zvir*q0(i,k-1,nqv)-qcon(i,k-1))
4328 pt2 = t0(i,k )/pkz(i,k )*(1.+
zvir*q0(i,k ,nqv)-qcon(i,k))
4329 ri = (gz(i,k-1)-gz(i,k))*(pt1-pt2)/( 0.5*(pt1+pt2)* &
4330 ((u0(i,k-1)-u0(i,k))**2+(v0(i,k-1)-v0(i,k))**2+ustar2) )
4334 mc = ratio * (1.-
max(0.0, ri)) ** 2
4335 mc = mc*delp(i,j,k-1)*delp(i,j,k)/(delp(i,j,k-1)+delp(i,j,k))
4337 h0 = mc*(q0(i,k,iq)-q0(i,k-1,iq))
4338 q0(i,k-1,iq) = q0(i,k-1,iq) + h0/delp(i,j,k-1)
4339 q0(i,k ,iq) = q0(i,k ,iq) - h0/delp(i,j,k )
4342 h0 = mc*(u0(i,k)-u0(i,k-1))
4343 u0(i,k-1) = u0(i,k-1) + h0/delp(i,j,k-1)
4344 u0(i,k ) = u0(i,k ) - h0/delp(i,j,k )
4346 h0 = mc*(v0(i,k)-v0(i,k-1))
4347 v0(i,k-1) = v0(i,k-1) + h0/delp(i,j,k-1)
4348 v0(i,k ) = v0(i,k ) - h0/delp(i,j,k )
4350 h0 = mc*(hd(i,k)-hd(i,k-1))
4351 hd(i,k-1) = hd(i,k-1) + h0/delp(i,j,k-1)
4352 hd(i,k ) = hd(i,k ) - h0/delp(i,j,k )
4353 if ( .not.hydrostatic )
then 4354 h0 = mc*(w0(i,k)-w0(i,k-1))
4355 w0(i,k-1) = w0(i,k-1) + h0/delp(i,j,k-1)
4356 w0(i,k ) = w0(i,k ) - h0/delp(i,j,k )
4363 if ( phys_hydrostatic )
then 4366 t0(i,kk) = (hd(i,kk)-gzh(i)-0.5*(u0(i,kk)**2+v0(i,kk)**2)) &
4367 / ( rk - phalf(i,j,kk)/pm(i,j,kk) )
4368 gzh(i) = gzh(i) + t0(i,kk)*(peln(i,kk+1)-peln(i,kk))
4369 t0(i,kk) = t0(i,kk) / (
rdgas + rz*q0(i,kk,nqv) )
4373 t0(i,kk) = (hd(i,kk)-gzh(i)-0.5*(u0(i,kk)**2+v0(i,kk)**2)) &
4374 / ((rk-phalf(i,j,kk)/pm(i,j,kk))*(
rdgas+rz*q0(i,kk,nqv)))
4380 t0(i,kk) = rcp*(hd(i,kk)-gz(i,kk)-0.5*(u0(i,kk)**2+v0(i,kk)**2+w0(i,kk)**2))
4396 ratio =
real(n)/
real(m)
4398 if ( phys_hydrostatic )
then 4405 do k=km, kcond+1, -1
4407 if ( phalf(i,j,k) >
p_crt )
then 4408 qsw =
wqsat_moist(t0(i,k-1), q0(i,k-1,nqv), pm(i,j,k-1))
4410 dh0 = hd(i,k) - hd(i,k-1) -
lati*(q0(i,k,nqi)-q0(i,k-1,nqi))
4411 dhs = dh0 +
latv*(q0(i,k,nqv)-qsw )
4412 dh = dh0 +
latv*(q0(i,k,nqv)-q0(i,k-1,nqv))
4414 if ( dhs>0.0 .and. dh>dh_min .and. q0(i,k,nqv)>q0(i,k-1,nqv) )
then 4415 mc = ratio*
min(1.0, dhs/dh)* &
4416 delp(i,j,k-1)*delp(i,j,k)/(delp(i,j,k-1)+delp(i,j,k))
4417 h0 = mc*(hd(i,k) - hd(i,k-1))
4418 hd(i,k-1) = hd(i,k-1) + h0/delp(i,j,k-1)
4419 hd(i,k ) = hd(i,k ) - h0/delp(i,j,k )
4422 h0 = mc*(q0(i,k,iq)-q0(i,k-1,iq))
4423 q0(i,k-1,iq) = q0(i,k-1,iq) + h0/delp(i,j,k-1)
4424 q0(i,k ,iq) = q0(i,k ,iq) - h0/delp(i,j,k )
4427 h0 = mc*(u0(i,k)-u0(i,k-1))
4428 u0(i,k-1) = u0(i,k-1) + h0/delp(i,j,k-1)
4429 u0(i,k ) = u0(i,k ) - h0/delp(i,j,k )
4431 h0 = mc*(v0(i,k)-v0(i,k-1))
4432 v0(i,k-1) = v0(i,k-1) + h0/delp(i,j,k-1)
4433 v0(i,k ) = v0(i,k ) - h0/delp(i,j,k )
4435 if ( .not.hydrostatic )
then 4436 h0 = mc*(w0(i,k)-w0(i,k-1))
4437 w0(i,k-1) = w0(i,k-1) + h0/delp(i,j,k-1)
4438 w0(i,k ) = w0(i,k ) - h0/delp(i,j,k )
4446 if ( phys_hydrostatic )
then 4449 t0(i,kk) = (hd(i,kk)-gzh(i)-0.5*(u0(i,kk)**2+v0(i,kk)**2)) &
4450 / ( rk - phalf(i,j,kk)/pm(i,j,kk) )
4451 gzh(i) = gzh(i) + t0(i,kk)*(peln(i,kk+1)-peln(i,kk))
4452 t0(i,kk) = t0(i,kk) / (
rdgas + rz*q0(i,kk,nqv) )
4456 t0(i,kk) = (hd(i,kk)-gzh(i)-0.5*(u0(i,kk)**2+v0(i,kk)**2)) &
4457 / ((rk-phalf(i,j,kk)/pm(i,j,kk))*(
rdgas+rz*q0(i,kk,nqv)))
4463 t0(i,kk) = rcp*(hd(i,kk)-gz(i,kk)-0.5*(u0(i,kk)**2+v0(i,kk)**2+w0(i,kk)**2))
4471 if ( fra < 1. )
then 4474 t0(i,k) = ta(i,j,k) + (t0(i,k) - ta(i,j,k))*fra
4475 u0(i,k) = ua(i,j,k) + (u0(i,k) - ua(i,j,k))*fra
4476 v0(i,k) = va(i,j,k) + (v0(i,k) - va(i,j,k))*fra
4480 if ( .not.hydrostatic )
then 4483 w0(i,k) = w(i,j,k) + (w0(i,k) - w(i,j,k))*fra
4491 q0(i,k,iq) = qa(i,j,k,iq) + (q0(i,k,iq) - qa(i,j,k,iq))*fra
4500 u_dt(i,j,k) = u_dt(i,j,k) + rdt*(u0(i,k) - ua(i,j,k))
4501 v_dt(i,j,k) = v_dt(i,j,k) + rdt*(v0(i,k) - va(i,j,k))
4502 t_dt(i,j,k) = t_dt(i,j,k) + rdt*(t0(i,k) - ta(i,j,k))
4513 q_dt(i,j,k,iq) = q_dt(i,j,k,iq) + rdt*(q0(i,k,iq)-qa(i,j,k,iq))
4515 qa(i,j,k,iq) = q0(i,k,iq)
4520 if ( .not. hydrostatic )
then 4532 subroutine dbzcalc(qv, qr, qs, qg, pt, delp, dz, &
4533 dbz, maxdbz, allmax, is, ie, js, je, ks, ke, &
4534 in0r, in0s, in0g, iliqskin)
4572 integer,
intent(IN) :: is, ie, js, je, ks, ke
4573 real,
intent(IN),
dimension(is:, js:, ks:) :: qv, qr, qs, qg, pt, delp, dz
4574 real,
intent(OUT),
dimension(is:, js:, ks:) :: dbz
4575 real,
intent(OUT),
dimension(is:, js:) :: maxdbz
4576 logical,
intent(IN) :: in0r, in0s, in0g, iliqskin
4577 real,
intent(OUT) :: allmax
4580 real,
parameter :: rn0_r = 8.e6
4581 real,
parameter :: rn0_s = 2.e7
4582 real,
parameter :: rn0_g = 4.e6
4585 real,
parameter :: r1=1.e-15
4586 real,
parameter :: ron=8.e6
4587 real,
parameter :: ron2=1.e10
4588 real,
parameter :: son=2.e7
4589 real,
parameter :: gon=5.e7
4590 real,
parameter :: ron_min = 8.e6
4591 real,
parameter :: ron_qr0 = 0.00010
4592 real,
parameter :: ron_delqr0 = 0.25*ron_qr0
4593 real,
parameter :: ron_const1r = (ron2-ron_min)*0.5
4594 real,
parameter :: ron_const2r = (ron2+ron_min)*0.5
4597 real,
parameter :: gamma_seven = 720.
4598 real,
parameter :: rho_r =
rhor 4599 real,
parameter :: rho_s = 100.
4600 real,
parameter :: rho_g = 400.
4601 real,
parameter :: alpha = 0.224
4602 real,
parameter :: factor_r = gamma_seven * 1.e18 * (1./(
pi*rho_r))**1.75
4603 real,
parameter :: factor_s = gamma_seven * 1.e18 * (1./(
pi*rho_s))**1.75 &
4604 * (rho_s/rho_r)**2 * alpha
4605 real,
parameter :: factor_g = gamma_seven * 1.e18 * (1./(
pi*rho_g))**1.75 &
4606 * (rho_g/rho_r)**2 * alpha
4609 real :: factorb_s, factorb_g, rhoair
4610 real :: temp_c, pres, sonv, gonv, ronv, z_e
4620 rhoair = -delp(i,j,k)/(
grav*dz(i,j,k))
4627 if (iliqskin .and. pt(i,j,k) .gt.
tice)
then 4628 factorb_s=factor_s/alpha
4629 factorb_g=factor_g/alpha
4638 temp_c =
min(-0.001, pt(i,j,k) -
tice)
4639 sonv =
min(2.0e8, 2.0e6*exp(-0.12*temp_c))
4644 q1 =
max(0.,
qg(i,j,k))
4645 q2 =
max(0., qr(i,j,k))
4646 q3 =
max(0., qs(i,j,k))
4650 if (
qg(i,j,k) > r1)
then 4651 gonv = 2.38 * (
pi * rho_g / (rhoair*q1))**0.92
4652 gonv =
max(1.e4,
min(gonv,gon))
4660 if (qr(i,j,k) > r1 )
then 4661 ronv = ron_const1r * tanh((ron_qr0-q2)/ron_delqr0) + ron_const2r
4668 z_e = factor_r * (rhoair*q2)**1.75 / ronv**.75 &
4669 + factorb_s * (rhoair*q3)**1.75 / sonv**.75 &
4670 + factorb_g * (rhoair*q1)**1.75 / gonv**.75
4673 dbz(i,j,k) = 10. * log10(z_e)
4675 maxdbz(i,j) =
max(dbz(i,j,k), maxdbz(i,j))
4676 allmax =
max(dbz(i,j,k), allmax)
4684 real function g_sum(p, ifirst, ilast, jfirst, jlast, area, mode)
4689 integer,
intent(IN) :: ifirst, ilast
4690 integer,
intent(IN) :: jfirst, jlast
4691 integer,
intent(IN) :: mode
4692 real,
intent(IN) :: p(ifirst:ilast,jfirst:jlast)
4693 real,
intent(IN) :: area(ifirst:ilast,jfirst:jlast)
4710 gsum = gsum + p(i,j)*area(i,j)
4723 subroutine interpolate_z(is, ie, js, je, km, zl, hght, a3, a2)
4725 integer,
intent(in):: is, ie, js, je, km
4726 real,
intent(in):: hght(is:ie,js:je,km+1)
4727 real,
intent(in):: a3(is:ie,js:je,km)
4728 real,
intent(in):: zl
4729 real,
intent(out):: a2(is:ie,js:je)
4739 zm(k) = 0.5*(hght(i,j,k)+hght(i,j,k+1))
4741 if( zl >= zm(1) )
then 4743 elseif ( zl <= zm(km) )
then 4744 a2(i,j) = a3(i,j,km)
4747 if( zl <= zm(k) .and. zl >= zm(k+1) )
then 4748 a2(i,j) = a3(i,j,k) + (a3(i,j,k+1)-a3(i,j,k))*(zm(k)-zl)/(zm(k)-zm(k+1))
subroutine, public setup_con
real function, public wqs2(ta, den, dqdt)
subroutine, public es2_table1d(ta, es, n)
real function, public wqs1(ta, den)
real function, public qs_blend(t, p, q)
subroutine mpdrv(hydrostatic, uin, vin, w, delp, pt, qv, ql, qr, qi, qs, qg, qa, qn, dz, is, ie, js, je, ks, ke, ktop, kbot, j, dt_in, ntimes, rain, snow, graupel, ice, m2_rain, m2_sol, cond, area1, land, u_dt, v_dt, pt_dt, qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt, qa_dt, w_var, vt_r, vt_s, vt_g, vt_i, qn2)
subroutine linear_prof(km, p1, q, dm, z_var, h_var)
real function, public wet_bulb(q, t, den)
subroutine, public es3_table1d(ta, es, n)
real, dimension(:), allocatable table3
subroutine dbzcalc(qv, qr, qs, qg, pt, delp, dz, dbz, maxdbz, allmax, is, ie, js, je, ks, ke, in0r, in0s, in0g, iliqskin)
subroutine, public lin_cld_microphys_end
subroutine terminal_fall(dtm, ktop, kbot, tz, qv, ql, qr, qg, qs, qi, pm, dz, dp, den, vtg, vts, vti, fac_sno, fac_gra, r1, g1, s1, i1, m1_sol, w1)
real function qs1d_moist(ta, qv, pa, dqdt)
real, parameter, public hlv
Latent heat of evaporation [J/kg].
real, dimension(:), allocatable des3
real function acr3d(v1, v2, q1, q2, c, cac, rho)
real function, public g_sum(p, ifirst, ilast, jfirst, jlast, area, mode)
subroutine interpolate_z(is, ie, js, je, km, zl, hght, a3, a2)
real function smlt(tc, dqs, qsrho, psacw, psacr, c, rho, rhofac)
subroutine cs_profile(a4, del, km, do_mono)
logical tables_are_initialized
real function es2_table(ta)
real, parameter, public rdgas
Gas constant for dry air [J/kg/deg].
subroutine icloud(ktop, kbot, tzk, p1, qvk, qlk, qrk, qik, qsk, qgk, dp1, den, denfac, vts, vtg, vtr, qak, rh_adj, rh_rain, dts, fac_sno, fac_gra, h_var)
subroutine, public sat_adj2(mdt, is, ie, js, je, ng, hydrostatic, consv_te, te0, qv, ql, qi, qr, qs, qg, qa, area, dpeln, delz, pt, dp, q_con, ifdef MOIST_CAPPA
subroutine, public qsmith_init
subroutine revap_racc(ktop, kbot, dt, tz, qv, ql, qr, qi, qs, qg, den, denfac, rh_rain, h_var)
real, parameter, public cp_vapor
Specific heat capacity of water vapor at constant pressure [J/kg/deg].
real function gmlt(tc, dqs, qgrho, pgacw, pgacr, c, rho)
real, dimension(:), allocatable table
logical module_is_initialized
integer function, public check_nml_error(IOSTAT, NML_NAME)
real function iqs1(ta, den)
subroutine warm_rain(dt, ktop, kbot, p1, dp, dz, tz, qv, ql, qr, qi, qs, qg, pm, den, denfac, ccn, c_praut, rh_rain, vtr, r1, m1_rain, w1, h_var)
character(len=input_str_length), dimension(:), allocatable, target, public input_nml_file
subroutine, public lin_cld_microphys_init(id, jd, kd, axes, time)
real, parameter, public rvgas
Gas constant for water vapor [J/kg/deg].
subroutine subgrid_z_proc(ktop, kbot, p1, den, dts, rh_adj, tz, qv, ql, qr, qi, qs, qg, qa, h_var)
real, dimension(:), allocatable desw
subroutine sedi_heat(ktop, kbot, dm, m1, dz, tz, qv, ql, qr, qi, qs, qg, cw)
real function qs1d_m(ta, qv, pa)
subroutine lagrangian_fall_ppm(ktop, kbot, zs, ze, zt, dp, q, precip, m1, mono)
real, parameter, public cp_air
Specific heat capacity of dry air at constant pressure [J/kg/deg].
logical qsmith_tables_initialized
real function, public wqsat_moist(ta, qv, pa)
character(len=17) mod_name
subroutine check_column(ktop, kbot, q, no_fall)
subroutine neg_adj(ktop, kbot, p1, pt, dp, qv, ql, qr, qi, qs, qg)
subroutine fall_speed(ktop, kbot, den, qs, qi, qg, ql, tk, vts, vti, vtg)
subroutine revap_rac1(hydrostatic, is, ie, dt, tz, qv, ql, qr, qi, qs, qg, den, hvar)
subroutine, public esw_table1d(ta, es, n)
subroutine, public lin_cld_microphys_driver(qv, ql, qr, qi, qs, qg, qa, qn, qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt, qa_dt, pt_dt, pt, w, uin, vin, udt, vdt, dz, delp, area, dt_in, land, rain, snow, ice, graupel, hydrostatic, phys_hydrostatic, iis, iie, jjs, jje, kks, kke, ktop, kbot, time)
real, dimension(:), allocatable des
real, parameter, public hlf
Latent heat of fusion [J/kg].
real, parameter, public grav
Acceleration due to gravity [m/s^2].
real function esw_table(ta)
real function iqs2(ta, den, dqdt)
real, parameter table_ice
real, dimension(:), allocatable tablew
subroutine lagrangian_fall_pcm(ktop, kbot, zs, ze, zt, dp, q, precip, m1)
subroutine remap2(ktop, kbot, kn, km, dp, q1, q2, id)
real, dimension(:), allocatable des2
subroutine, public qsmith(im, km, ks, t, p, q, qs, dqdt)
real, dimension(:), allocatable table2
real function, public wqsat2_moist(ta, qv, pa, dqdt)
subroutine, public get_time(Time, seconds, days, ticks, err_msg)
subroutine, public error_mesg(routine, message, level)
subroutine cs_limiters(km, a4)
real, parameter, public kappa
RDGAS / CP_AIR [dimensionless].
The namespace for the qg model.
subroutine, public sg_conv(is, ie, js, je, isd, ied, jsd, jed, km, nq, dt, tau, delp, phalf, pm, zfull, zhalf, ta, qa, ua, va, w, u_dt, v_dt, t_dt, q_dt, nqv, nql, nqi, nqr, nqs, nqg, hydrostatic, phys_hydrostatic)
real, dimension(3, 4) acco
real(fp), parameter, public pi