15 subroutine gfs_suite_interstitial_2_run (im, levs, lssav, ldiag3d, lsidea, flag_cice, shal_cnv, old_monin, mstrat, &
16 do_shoc, frac_grid, imfshalcnv, dtf, xcosz, adjsfcdsw, adjsfcdlw, cice, pgr, ulwsfc_cice, lwhd, htrsw, htrlw, xmu, ctei_rm, &
17 work1, work2, prsi, tgrs, prsl, qgrs_water_vapor, qgrs_cloud_water, cp, hvap, prslk, suntim, adjsfculw, adjsfculw_lnd, &
18 adjsfculw_ice, adjsfculw_wat, dlwsfc, ulwsfc, psmean, dtend, dtidx, index_of_process_longwave, index_of_process_shortwave, &
19 index_of_process_pbl, index_of_process_dcnv, index_of_process_scnv, index_of_process_mp, index_of_temperature, &
20 ctei_rml, ctei_r, kinver, dry, icy, wet, frland, huge, use_LW_jacobian, htrlwu, errmsg, errflg)
25 integer,
intent(in ) :: im, levs, imfshalcnv
26 logical,
intent(in ) :: lssav, ldiag3d, lsidea, shal_cnv
27 logical,
intent(in ) :: old_monin, mstrat, do_shoc, frac_grid, use_LW_jacobian
28 real(kind=kind_phys),
intent(in ) :: dtf, cp, hvap
30 logical,
intent(in ),
dimension(:) :: flag_cice
31 real(kind=kind_phys),
intent(in ),
dimension(:) :: ctei_rm
32 real(kind=kind_phys),
intent(in ),
dimension(:) :: xcosz, adjsfcdsw, adjsfcdlw, pgr, xmu, work1, work2
33 real(kind=kind_phys),
intent(in ),
dimension(:),
optional :: ulwsfc_cice
34 real(kind=kind_phys),
intent(in ),
dimension(:) :: cice
35 real(kind=kind_phys),
intent(in ),
dimension(:,:) :: htrsw, htrlw, tgrs, prsl, qgrs_water_vapor, qgrs_cloud_water, prslk
36 real(kind=kind_phys),
intent(in ),
dimension(:,:),
optional :: htrlwu
37 real(kind=kind_phys),
intent(in ),
dimension(:,:) :: prsi
38 real(kind=kind_phys),
intent(in ),
dimension(:,:,:) :: lwhd
39 integer,
intent(inout),
dimension(:) :: kinver
40 real(kind=kind_phys),
intent(inout),
dimension(:) :: suntim, dlwsfc, ulwsfc, psmean, ctei_rml, ctei_r
41 real(kind=kind_phys),
intent(in ),
dimension(:) :: adjsfculw_lnd, adjsfculw_ice, adjsfculw_wat
42 real(kind=kind_phys),
intent(inout),
dimension(:) :: adjsfculw
45 real(kind=kind_phys),
optional,
intent(inout),
dimension(:,:,:) :: dtend
46 integer,
intent(in),
dimension(:,:) :: dtidx
47 integer,
intent(in) :: index_of_process_longwave, index_of_process_shortwave, &
48 index_of_process_pbl, index_of_process_dcnv, index_of_process_scnv, &
49 index_of_process_mp, index_of_temperature
51 logical,
intent(in ),
dimension(:) :: dry, icy, wet
52 real(kind=kind_phys),
intent(in ),
dimension(:) :: frland
53 real(kind=kind_phys),
intent(in ) :: huge
55 character(len=*),
intent( out) :: errmsg
56 integer,
intent( out) :: errflg
59 real(kind=kind_phys),
parameter :: czmin = 0.0001_kind_phys
60 integer :: i, k, idtend
61 real(kind=kind_phys) :: tem1, tem2, tem, hocp
62 logical,
dimension(im) :: invrsn
63 real(kind=kind_phys),
dimension(im) :: tx1, tx2
65 real(kind=kind_phys),
parameter :: zero = 0.0_kind_phys, one = 1.0_kind_phys
66 real(kind=kind_phys),
parameter :: qmin = 1.0e-10_kind_phys, epsln=1.0e-10_kind_phys
81 if ( xcosz(i) >= czmin )
then
82 tem1 = adjsfcdsw(i) / xcosz(i)
83 if ( tem1 >= 120.0_kind_phys )
then
84 suntim(i) = suntim(i) + dtf
92 tem = (one - frland(i)) * cice(i)
93 if (flag_cice(i))
then
94 adjsfculw(i) = adjsfculw_lnd(i) * frland(i) &
95 + ulwsfc_cice(i) * tem &
96 + adjsfculw_wat(i) * (one - frland(i) - tem)
98 adjsfculw(i) = adjsfculw_lnd(i) * frland(i) &
99 + adjsfculw_ice(i) * tem &
100 + adjsfculw_wat(i) * (one - frland(i) - tem)
106 adjsfculw(i) = adjsfculw_lnd(i)
109 if (flag_cice(i))
then
110 if (wet(i) .and. adjsfculw_wat(i) /= huge)
then
111 adjsfculw(i) = ulwsfc_cice(i)*cice(i) + adjsfculw_wat(i)*tem
113 adjsfculw(i) = ulwsfc_cice(i)
116 if (wet(i) .and. adjsfculw_wat(i) /= huge)
then
117 adjsfculw(i) = adjsfculw_ice(i)*cice(i) + adjsfculw_wat(i)*tem
119 adjsfculw(i) = adjsfculw_ice(i)
123 adjsfculw(i) = adjsfculw_wat(i)
129 dlwsfc(i) = dlwsfc(i) + adjsfcdlw(i)*dtf
130 ulwsfc(i) = ulwsfc(i) + adjsfculw(i)*dtf
131 psmean(i) = psmean(i) + pgr(i)*dtf
136 idtend = dtidx(index_of_temperature,index_of_process_longwave)
138 dtend(:,:,idtend) = dtend(:,:,idtend) + lwhd(:,:,1)*dtf
141 idtend = dtidx(index_of_temperature,index_of_process_shortwave)
143 dtend(:,:,idtend) = dtend(:,:,idtend) + lwhd(:,:,2)*dtf
146 idtend = dtidx(index_of_temperature,index_of_process_pbl)
148 dtend(:,:,idtend) = dtend(:,:,idtend) + lwhd(:,:,3)*dtf
151 idtend = dtidx(index_of_temperature,index_of_process_dcnv)
153 dtend(:,:,idtend) = dtend(:,:,idtend) + lwhd(:,:,4)*dtf
156 idtend = dtidx(index_of_temperature,index_of_process_scnv)
158 dtend(:,:,idtend) = dtend(:,:,idtend) + lwhd(:,:,5)*dtf
161 idtend = dtidx(index_of_temperature,index_of_process_mp)
163 dtend(:,:,idtend) = dtend(:,:,idtend) + lwhd(:,:,6)*dtf
166 idtend = dtidx(index_of_temperature,index_of_process_longwave)
168 if (use_lw_jacobian)
then
169 dtend(:,:,idtend) = dtend(:,:,idtend) + htrlwu(:,:)*dtf
171 dtend(:,:,idtend) = dtend(:,:,idtend) + htrlw(:,:)*dtf
175 idtend = dtidx(index_of_temperature,index_of_process_shortwave)
179 dtend(i,k,idtend) = dtend(i,k,idtend) + htrsw(i,k)*dtf*xmu(i)
190 tx2(i) = 10.0_kind_phys
191 ctei_r(i) = 10.0_kind_phys
194 if ((((imfshalcnv == 0 .and. shal_cnv) .or. old_monin) .and. mstrat) &
196 ctei_rml(:) = ctei_rm(1)*work1(:) + ctei_rm(2)*work2(:)
199 if (prsi(i,1)-prsi(i,k+1) < 0.35_kind_phys*prsi(i,1) &
200 .and. (.not. invrsn(i)))
then
201 tem = (tgrs(i,k+1) - tgrs(i,k)) &
202 / (prsl(i,k) - prsl(i,k+1))
204 if (((tem > 0.0001_kind_phys) .and. (tx1(i) < zero)) .or. &
205 ((tem-abs(tx1(i)) > zero) .and. (tx2(i) < zero)))
then
208 if (qgrs_water_vapor(i,k) > qgrs_water_vapor(i,k+1))
then
209 tem1 = tgrs(i,k+1) + hocp*max(qgrs_water_vapor(i,k+1),qmin)
210 tem2 = tgrs(i,k) + hocp*max(qgrs_water_vapor(i,k),qmin)
212 tem1 = tem1 / prslk(i,k+1) - tem2 / prslk(i,k)
215 ctei_r(i) = (one/hocp)*tem1/(qgrs_water_vapor(i,k+1)-qgrs_water_vapor(i,k) &
216 + qgrs_cloud_water(i,k+1)-qgrs_cloud_water(i,k))
218 ctei_r(i) = 10.0_kind_phys
221 if ( ctei_rml(i) > ctei_r(i) )
then