2 !Yair, Y., B. Lynn, C. Price, V. Kotroni, K. Lagouvardos, E. Morin,
3 !A. Magnai, and M. del Carmen Llasat (2010), Predicting the potential for
4 !lightning activity in Mediterranean storms based on the Weather
5 !Research and Forecasting (WRF) model dynamic and microphysical
6 !fields, J. Geophys. Res., 115, D04205, doi:10.1029/2008JD010868.
7 ! However, we don't check for collapsing cell (so as not to require use of halo).
8 ! This means that lpi is also calculated in cells that are no longer (on average) growing
9 ! For a "complete" lightning forecast scheme, please see:
10 !https://doi.org/10.1175/WAF-D-11-00144.1
11 !(Predicting Cloud-to-Ground and Intracloud Lightning in Weather Forecast Models)
14 !===================================================================
16 SUBROUTINE calclpi(qv,qc, qr, qi, qs, qg &
17 ,w,z,dz8w,pi_phy,th_phy,p_phy,rho_phy &
19 ,ids,ide, jds,jde, kds,kde &
20 ,ims,ime, jms,jme, kms,kme &
21 ,its,ite, jts,jte, kts,kte &
23 !-------------------------------------------------------------------
25 !-------------------------------------------------------------------
28 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , &
29 ims,ime, jms,jme, kms,kme , &
30 its,ite, jts,jte, kts,kte
31 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
40 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
42 REAL, INTENT(IN), DIMENSION(ims:ime, kms:kme, jms:jme):: &
43 & dz8w,pi_phy,p_phy,rho_phy
44 REAL, INTENT(IN), DIMENSION(ims:ime, kms:kme, jms:jme):: &
46 REAL, INTENT(INOUT), DIMENSION(ims:ime,jms:jme):: &
52 REAL, DIMENSION(kms:kme):: tempk,rh
53 REAL, DIMENSION(kms:kme):: qv1d,p1d,rho1d,qti1d
54 REAL, DIMENSION(kms:kme):: temp,qc1d,ql1d,qi1d,qs1d,qg1d,lpi1d
55 REAL, DIMENSION(0:kme):: w1d,height
56 REAL, DIMENSION(kms:kme):: e1d,height_t,w1d_t
57 REAL z_full,qrs,teten,RELHUM,LOC,Td_850,Td_700,PC_DWPT
59 REAL :: dt_lpi,t_base,t_top
62 INTEGER I_START,I_END,J_START,J_END
66 !-------------------------------------------------------------------
78 temp(k) = th_phy(i,k,j)*pi_phy(i,k,j)-273.16
79 tempk(k) = th_phy(i,k,j)*pi_phy(i,k,j)
82 rho1d(k)=rho_phy(i,k,j)
83 z_full=z_full+dz8w(i,k,j)
86 ql1d(k)=qc(i,k,j)+qr(i,k,j)
88 qti1d(k)=qi(i,k,j)+qs(i,k,j)+qg(i,k,j)
90 ! qg1d(k)=qg(i,k,j)+qh(i,k,j)
91 ! Hail doesn't usually charge
93 ! For conservative advection multiply by rho1d and divide by it below
96 height_t(k)=0.5*(height(k-1)+height(k))
97 w1d_t(k)=0.5*(w1d(k-1)+w1d(k))
101 call calc_lpi(ql1d,qi1d,qs1d,qg1d,w1d,temp,height,lpi(i,j),t_base,t_top,kme,kte)
105 end subroutine calclpi
108 & calc_lpi(ql3d,qi3d,qs3d,qg3d,w3d,t3d,height,lpi,t_base,t_top,nk,nke)
122 integer ic,jc,icnt,i,j,k,i_collapse
123 real i_dist,j_dist,del_z_tot
137 w_ave(k)=0.5*(w3d(k)+w3d(k-1))
140 ! Check for collapsing cell
141 ! Here, we don't check, since it requires a halo.
147 if (t3d(k).le.t_base.and.t3d(k).gt.t_top)then ! set temp range
149 den_i = qi3d(k)+qg3d(k)
150 den_s = qs3d(k)+qg3d(k)
151 if (qs3d(k).le.small_num.or.qg3d(k).le.small_num)then !checks for zeroes
155 num_s = sqrt(qs3d(k)*qg3d(k))
157 if (qi3d(k).le.small_num.or.qg3d(k).le.small_num)then ! checks for zeroes
161 num_i = sqrt(qi3d(k)*qg3d(k))
163 q_isg = qg3d(k)*(num_i/den_i+num_s/den_s) ! ice "fract"-content
165 if (ql3d(k).le.small_num.or.q_isg.eq.0)then
169 num = sqrt(ql3d(k)*q_isg)
172 del_z_tot=del_z_tot+del_z(k)
174 ave_z=ave_z+del_z(k)*(2.*num/den)*w_ave(k)**2 ! lightning potential index J/unit-mass
179 if (del_z_tot.eq.0)del_z_tot=100000
183 end subroutine calc_lpi
184 END MODULE module_ltng_lpi