23 SUBROUTINE calrch(EL,RICHNO)
26 use vrbls3d, only: pmid, q, t, uh, vh, zmid, q2
28 use params_mod, only: h10e5, capa, d608,h1, epsq2, g, beta
29 use ctlblk_mod
, only: jsta, jend, spval, lm1, jsta_m, jend_m, im, &
31 use gridspec_mod
, only: gridtype
37 REAL,
intent(in) :: el(im,jsta_2l:jend_2u,lm)
38 REAL,
intent(inout) :: richno(im,jsta_2l:jend_2u,lm)
40 REAL,
ALLOCATABLE :: thv(:,:,:)
42 real ape,uhkl,ulkl,vhkl,vlkl,wndsl,wndslp,rdzkl, &
43 dthvkl,dukl,dvkl,ri,ct,cs
51 ALLOCATE ( thv(im,jsta_2l:jend_2u,lm) )
69 ape = (h10e5/pmid(i,j,l))**capa
70 thv(i,j,l) = (q(i,j,l)*d608+h1)*t(i,j,l)*ape
83 if(gridtype /=
'A')
THEN
84 call exch(vtm(1,jsta_2l,l))
85 call exch(uh(1,jsta_2l,l))
86 call exch(vh(1,jsta_2l,l))
87 call exch(vtm(1,jsta_2l,l+1))
88 call exch(uh(1,jsta_2l,l+1))
89 call exch(vh(1,jsta_2l,l+1))
95 IF(gridtype ==
'A')
THEN
100 ELSE IF(gridtype ==
'E')
THEN
110 wndsl = vtm(i,j-1,l)+vtm(iw,j,l)+vtm(ie,j,l)+vtm(i,j+1,l)
111 wndslp = vtm(i,j-1,l+1) + vtm(iw,j,l+1)+ &
112 vtm(ie,j,l+1) + vtm(i,j+1,l+1)
113 IF(wndsl == 0. .OR. wndslp == 0.) cycle
114 uhkl = (uh(i,j-1,l)+uh(iw,j,l)+uh(ie,j,l)+uh(i,j+1,l))/wndsl
115 ulkl = (uh(i,j-1,l+1)+uh(iw,j,l+1)+uh(ie,j,l+1)+ &
116 uh(i,j+1,l+1))/wndslp
117 vhkl = (vh(i,j-1,l)+vh(iw,j,l)+vh(ie,j,l)+vh(i,j+1,l))/wndsl
118 vlkl = (vh(i,j-1,l+1)+vh(iw,j,l+1)+vh(ie,j,l+1)+ &
119 vh(i,j+1,l+1))/wndslp
120 ELSE IF(gridtype ==
'B')
THEN
123 uhkl = (uh(iw,j-1,l)+uh(iw,j,l)+uh(ie,j-1,l)+uh(i,j,l))/4.0
124 ulkl = (uh(iw,j-1,l+1)+uh(iw,j,l+1)+uh(ie,j-1,l+1)+ &
126 vhkl = (vh(iw,j-1,l)+vh(iw,j,l)+vh(ie,j-1,l)+vh(i,j,l))/4.0
127 vlkl = (vh(iw,j-1,l+1)+vh(iw,j,l+1)+vh(ie,j-1,l+1)+ &
131 rdzkl = 1.0 / (zmid(i,j,l)-zmid(i,j,l+1))
139 dthvkl = thv(i,j,l)-thv(i,j,l+1)
140 dukl = (uhkl-ulkl) * rdzkl
141 dvkl = (vhkl-vlkl) * rdzkl
142 cs = dukl*dukl + dvkl*dvkl
151 richno(i,j,l) = spval
157 ct = -1.*g*beta*dthvkl*rdzkl