25 subroutine gfs_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, doSWrad, &
26 do_lw_clrsky_hr, do_sw_clrsky_hr, save_diag, fhlwr, fhswr, sfc_alb_nir_dir, &
27 sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, p_lev, tsfa, coszen, coszdg, &
28 fluxlwDOWN_clrsky, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, &
29 fluxswDOWN_clrsky, fluxswUP_allsky, fluxswDOWN_allsky, fluxswUP_clrsky, &
30 raddt, aerodp, cldsa, mtopa, mbota, cld_frac, cldtaulw, cldtausw, scmpsw, fluxr, &
31 sfcdlw, sfculw, sfcflw, tsflw, htrlw, htrlwu, topflw, nirbmdi, nirdfdi, visbmdi, &
32 visdfdi, nirbmui, nirdfui, visbmui, visdfui, sfcnsw, sfcdsw, htrsw, sfcfsw, topfsw, &
33 htrswc, htrlwc, errmsg, errflg)
36 integer,
intent(in) :: &
37 ncol, & !< Horizontal loop extent
38 nlev, & !< Number of vertical layers
39 nday, & !< Number of daylit columns
40 isfc, & !< Vertical index for surface level
42 integer,
intent(in),
dimension(:) :: &
44 integer,
intent(in),
dimension(:,:) :: &
45 mbota, & !< Vertical indices for low, middle and high cloud tops
47 logical,
intent(in) :: &
48 dolwrad, & !< Logical flags for lw radiation calls
49 doswrad, & !< Logical flags for sw radiation calls
50 do_lw_clrsky_hr, & !< Output clear-sky LW heating-rate?
51 do_sw_clrsky_hr, & !< Output clear-sky SW heating-rate?
53 real(kind_phys),
intent(in) :: &
54 fhlwr, & !< Frequency for LW radiation calls
56 real(kind_phys),
dimension(:),
intent(in) :: &
57 tsfa, & !< Lowest model layer air temperature for radiation (K)
58 coszen, & !< Cosine(SZA)
59 coszdg, & !< Cosine(SZA), daytime
60 sfc_alb_nir_dir, & !< Surface albedo (direct)
61 sfc_alb_nir_dif, & !< Surface albedo (diffuse)
62 sfc_alb_uvvis_dir, & !< Surface albedo (direct)
64 real(kind_phys),
dimension(:,:),
intent(in),
optional :: &
65 p_lev, & !< Pressure @ model layer-interfaces (Pa)
66 fluxlwup_allsky, & !< RRTMGP longwave all-sky flux (W/m2)
67 fluxlwdown_allsky, & !< RRTMGP longwave all-sky flux (W/m2)
68 fluxlwup_clrsky, & !< RRTMGP longwave clear-sky flux (W/m2)
69 fluxlwdown_clrsky, & !< RRTMGP longwave clear-sky flux (W/m2)
70 fluxswup_allsky, & !< RRTMGP shortwave all-sky flux (W/m2)
71 fluxswdown_allsky, & !< RRTMGP shortwave all-sky flux (W/m2)
72 fluxswup_clrsky, & !< RRTMGP shortwave clear-sky flux (W/m2)
74 real(kind_phys),
intent(in) :: &
76 real(kind_phys),
dimension(:,:),
intent(in) :: &
77 aerodp, & !< Vertical integrated optical depth for various aerosol species
78 cldsa, & !< Fraction of clouds for low, middle, high, total and BL
79 cld_frac, & !< Total cloud fraction in each layer
80 cldtaulw, & !< approx 10.mu band layer cloud optical depth
92 real(kind=kind_phys),
dimension(:,:),
intent(inout) :: fluxr
95 real(kind_phys),
dimension(:),
intent(inout) :: &
96 tsflw, & !< LW sfc air temp during calculation (K)
97 sfcdlw, & !< LW sfc all-sky downward flux (W/m2)
98 sfculw, & !< LW sfc all-sky upward flux (W/m2)
99 nirbmdi, & !< SW sfc nir beam downward flux (W/m2)
100 nirdfdi, & !< SW sfc nir diff downward flux (W/m2)
101 visbmdi, & !< SW sfc uv+vis beam downward flux (W/m2)
102 visdfdi, & !< SW sfc uv+vis diff downward flux (W/m2)
103 nirbmui, & !< SW sfc nir beam upward flux (W/m2)
104 nirdfui, & !< SW sfc nir diff upward flux (W/m2)
105 visbmui, & !< SW sfc uv+vis beam upward flux (W/m2)
106 visdfui, & !< SW sfc uv+vis diff upward flux (W/m2)
107 sfcnsw, & !< SW sfc all-sky net flux (W/m2) flux into ground
109 real(kind_phys),
dimension(:,:),
intent(inout) :: &
110 htrlw, & !< LW all-sky heating rate (K/s)
112 real(kind_phys),
dimension(:,:),
intent(inout),
optional :: &
114 type(
sfcflw_type),
dimension(:),
intent(inout) :: &
116 type(
sfcfsw_type),
dimension(:),
intent(inout) :: &
118 type(
topfsw_type),
dimension(:),
intent(inout) :: &
120 type(
topflw_type),
dimension(:),
intent(inout) :: &
122 character(len=*),
intent(out) :: &
124 integer,
intent(out) :: &
128 real(kind_phys),
dimension(:,:),
intent(inout),
optional :: &
129 htrlwc, & !< LW clear-sky heating-rate (K/s)
133 integer :: i, j, k, itop, ibtc
134 real(kind_phys) :: tem0d, tem1, tem2
135 real(kind_phys),
dimension(nDay, nLev) :: thetatendclrsky, thetatendallsky
141 if (.not. (dolwrad .or. doswrad))
return
149 if (do_lw_clrsky_hr)
then
150 call check_error_msg(
'GFS_rrtmgp_post',compute_heating_rate( &
158 call check_error_msg(
'GFS_rrtmgp_post',compute_heating_rate( &
170 topflw(:)%upfxc = fluxlwup_allsky(:,itoa)
171 topflw(:)%upfx0 = fluxlwup_clrsky(:,itoa)
174 sfcflw(:)%upfxc = fluxlwup_allsky(:,isfc)
175 sfcflw(:)%upfx0 = fluxlwup_clrsky(:,isfc)
176 sfcflw(:)%dnfxc = fluxlwdown_allsky(:,isfc)
177 sfcflw(:)%dnfx0 = fluxlwdown_clrsky(:,isfc)
183 sfcdlw(:) = sfcflw(:)%dnfxc
184 sfculw(:) = sfcflw(:)%upfxc
200 fluxr(i,1 ) = fluxr(i,1 ) + fhlwr * fluxlwup_allsky( i,itoa)
201 fluxr(i,19) = fluxr(i,19) + fhlwr * fluxlwdown_allsky(i,isfc)
202 fluxr(i,20) = fluxr(i,20) + fhlwr * fluxlwup_allsky( i,isfc)
204 fluxr(i,28) = fluxr(i,28) + fhlwr * fluxlwup_clrsky( i,itoa)
205 fluxr(i,30) = fluxr(i,30) + fhlwr * fluxlwdown_clrsky(i,isfc)
206 fluxr(i,33) = fluxr(i,33) + fhlwr * fluxlwup_clrsky( i,isfc)
213 tem0d = raddt * cldsa(i,j)
220 tem2 = tem2 + cldtaulw(i,k)
222 fluxr(i,46-j) = fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
234 if (nday .gt. 0)
then
240 if (do_sw_clrsky_hr)
then
241 htrswc(:,:) = 0._kind_phys
242 call check_error_msg(
'GFS_rrtmgp_post',compute_heating_rate( &
243 fluxswup_clrsky(idxday(1:nday),:), &
244 fluxswdown_clrsky(idxday(1:nday),:), &
245 p_lev(idxday(1:nday),:), &
247 htrswc(idxday(1:nday),:)=thetatendclrsky
251 htrsw(:,:) = 0._kind_phys
252 call check_error_msg(
'GFS_rrtmgp_post',compute_heating_rate( &
253 fluxswup_allsky(idxday(1:nday),:), &
254 fluxswdown_allsky(idxday(1:nday),:), &
255 p_lev(idxday(1:nday),:), &
257 htrsw(idxday(1:nday),:) = thetatendallsky
265 topfsw(:)%upfxc = fluxswup_allsky(:,itoa)
266 topfsw(:)%upfx0 = fluxswup_clrsky(:,itoa)
267 topfsw(:)%dnfxc = fluxswdown_allsky(:,itoa)
270 sfcfsw(:)%upfxc = fluxswup_allsky(:,isfc)
271 sfcfsw(:)%upfx0 = fluxswup_clrsky(:,isfc)
272 sfcfsw(:)%dnfxc = fluxswdown_allsky(:,isfc)
273 sfcfsw(:)%dnfx0 = fluxswdown_clrsky(:,isfc)
278 nirbmdi(i) = scmpsw(i)%nirbm
279 nirdfdi(i) = scmpsw(i)%nirdf
280 visbmdi(i) = scmpsw(i)%visbm
281 visdfdi(i) = scmpsw(i)%visdf
282 nirbmui(i) = scmpsw(i)%nirbm * sfc_alb_nir_dir(i)
283 nirdfui(i) = scmpsw(i)%nirdf * sfc_alb_nir_dif(i)
284 visbmui(i) = scmpsw(i)%visbm * sfc_alb_uvvis_dir(i)
285 visdfui(i) = scmpsw(i)%visdf * sfc_alb_uvvis_dif(i)
305 if (do_sw_clrsky_hr)
then
312 sfcnsw(i) = sfcfsw(i)%dnfxc - sfcfsw(i)%upfxc
313 sfcdsw(i) = sfcfsw(i)%dnfxc
326 fluxr(i,34) = aerodp(i,1)
327 fluxr(i,35) = aerodp(i,2)
328 fluxr(i,36) = aerodp(i,3)
329 fluxr(i,37) = aerodp(i,4)
330 fluxr(i,38) = aerodp(i,5)
331 fluxr(i,39) = aerodp(i,6)
332 if (coszen(i) > 0.)
then
334 tem0d = fhswr * coszdg(i) / coszen(i)
335 fluxr(i,2 ) = fluxr(i,2) + topfsw(i)%upfxc * tem0d
336 fluxr(i,3 ) = fluxr(i,3) + sfcfsw(i)%upfxc * tem0d
337 fluxr(i,4 ) = fluxr(i,4) + sfcfsw(i)%dnfxc * tem0d
339 fluxr(i,21) = fluxr(i,21) + scmpsw(i)%uvbfc * tem0d
340 fluxr(i,22) = fluxr(i,22) + scmpsw(i)%uvbf0 * tem0d
342 fluxr(i,23) = fluxr(i,23) + topfsw(i)%dnfxc * tem0d
344 fluxr(i,24) = fluxr(i,24) + visbmdi(i) * tem0d
345 fluxr(i,25) = fluxr(i,25) + visdfdi(i) * tem0d
346 fluxr(i,26) = fluxr(i,26) + nirbmdi(i) * tem0d
347 fluxr(i,27) = fluxr(i,27) + nirdfdi(i) * tem0d
349 fluxr(i,29) = fluxr(i,29) + topfsw(i)%upfx0 * tem0d
350 fluxr(i,31) = fluxr(i,31) + sfcfsw(i)%upfx0 * tem0d
351 fluxr(i,32) = fluxr(i,32) + sfcfsw(i)%dnfx0 * tem0d
357 fluxr(i,17) = fluxr(i,17) + raddt * cldsa(i,4)
358 fluxr(i,18) = fluxr(i,18) + raddt * cldsa(i,5)
365 tem0d = raddt * cldsa(i,j)
368 fluxr(i, 8-j) = fluxr(i, 8-j) + tem0d
369 fluxr(i,11-j) = fluxr(i,11-j) + tem0d * p_lev(i,itop)
370 fluxr(i,14-j) = fluxr(i,14-j) + tem0d * p_lev(i,ibtc)
371 fluxr(i,17-j) = fluxr(i,17-j) + tem0d * p_lev(i,itop)
376 tem1 = tem1 + cldtausw(i,k)
378 fluxr(i,43-j) = fluxr(i,43-j) + tem0d * tem1