Skip to content

Commit 66a3a88

Browse files
committed
add back remaining RRTMGP diagnostics
1 parent eeb2e03 commit 66a3a88

2 files changed

Lines changed: 274 additions & 124 deletions

File tree

physics/Interstitials/UFS_SCM_NEPTUNE/GFS_radiation_post.F90

Lines changed: 107 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,23 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
6161
kd, kt, sfcflw, sfcfsw, topflw, scmpsw, nCol, nLev, nDay, nfxr, nspc1, fluxr, do_RRTMGP, &
6262
do_lw_clrsky_hr, fluxlwUP_clrsky, fluxlwDOWN_clrsky, htrlwc, fluxlwUP_allsky, &
6363
fluxlwDOWN_allsky, htrlw, do_sw_clrsky_hr, htrswc, fluxswUP_clrsky, idxday, &
64-
fluxswDOWN_clrsky, htrsw, fluxswUP_allsky, fluxswDOWN_allsky, errmsg, errflg)
65-
! (iSFC, iTOA, &
66-
! sfc_alb_nir_dir, &
67-
! sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, tsfa, &
68-
! scmpsw, &
69-
! sfcdlw, sfculw, sfcflw, tsflw, htrlwu, topflw, nirbmdi, nirdfdi, &
70-
! visbmdi, visdfdi, nirbmui, nirdfui, visbmui, visdfui, sfcnsw, sfcdsw, sfcfsw, &
64+
fluxswDOWN_clrsky, htrsw, fluxswUP_allsky, fluxswDOWN_allsky, iSFC, iTOA, tsflw, tsfa, &
65+
sfcdlw, sfculw, htrlwu, nirbmdi, nirdfdi, visbmdi, visdfdi, nirbmui, nirdfui, visbmui, &
66+
visdfui, sfc_alb_nir_dir, sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, sfcnsw, &
67+
sfcdsw, errmsg, errflg)
7168

7269
! Inputs
7370
integer, intent(in) :: &
74-
nCol, & !< Horizontal loop extent
75-
nLev, & !< Number of vertical layers
76-
nDay, & !< Number of daylit columns
77-
nfxr, & !< Number of variables stored in the fluxr array
78-
nspc1, & !< Number of species for output aerosol optical depth
79-
kb, & !< Vertical index difference between layer and lower bound (H/M/L diag)
80-
kd, & !< Vertical index difference between in/out and local (H/M/L diag)
81-
kt !< Vertical index difference between layer and upper bound (H/M/L diag)
82-
! integer, intent(in) :: &
83-
84-
! iSFC, & !< Vertical index for surface level
85-
! iTOA, & !< Vertical index for TOA level
71+
nCol, & !< Horizontal loop extent
72+
nLev, & !< Number of vertical layers
73+
nDay, & !< Number of daylit columns
74+
nfxr, & !< Number of variables stored in the fluxr array
75+
nspc1, & !< Number of species for output aerosol optical depth
76+
kb, & !< Vertical index difference between layer and lower bound (H/M/L diag)
77+
kd, & !< Vertical index difference between in/out and local (H/M/L diag)
78+
kt, & !< Vertical index difference between layer and upper bound (H/M/L diag)
79+
iSFC, & !< Vertical index for surface level
80+
iTOA !< Vertical index for TOA level
8681
integer, intent(in), dimension(:) :: &
8782
idxday !< Index array for daytime points
8883
logical, intent(in) :: &
@@ -92,21 +87,19 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
9287
do_RRTMGP, & !< Flag for using RRTMGP scheme
9388
do_lw_clrsky_hr, & !< Output clear-sky LW heating-rate?
9489
do_sw_clrsky_hr !< Output clear-sky SW heating-rate?
95-
9690
real(kind_phys), intent(in) :: &
9791
fhlwr, & !< Frequency for longwave radiation (sec)
9892
fhswr, & !< Frequency for shortwave radiation (sec)
9993
raddt !< Radiation time step (sec)
10094
real(kind_phys), dimension(:), intent(in) :: &
10195
coszen, & !< Mean cos of zenith angle over rad call period
10296
coszdg !< Daytime mean cosz over rad call period
103-
! real(kind_phys), dimension(:), intent(in) :: &
104-
! tsfa, & !< Lowest model layer air temperature for radiation (K)
105-
! sfc_alb_nir_dir, & !< Surface albedo (direct)
106-
! sfc_alb_nir_dif, & !< Surface albedo (diffuse)
107-
! sfc_alb_uvvis_dir, & !< Surface albedo (direct)
108-
! sfc_alb_uvvis_dif, & !< Surface albedo (diffuse)
109-
97+
real(kind_phys), dimension(:), intent(in) :: &
98+
tsfa, & !< Lowest model layer air temperature for radiation (K)
99+
sfc_alb_nir_dir, & !< Surface albedo (direct)
100+
sfc_alb_nir_dif, & !< Surface albedo (diffuse)
101+
sfc_alb_uvvis_dir, & !< Surface albedo (direct)
102+
sfc_alb_uvvis_dif !< Surface albedo (diffuse)
110103
real(kind_phys), dimension(:,:), intent(in) :: &
111104
p_lev !< Pressure @ model layer-interfaces (Pa)
112105
real(kind_phys), dimension(:,:), intent(in) :: &
@@ -120,12 +113,6 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
120113
fluxswDOWN_clrsky, & !< RRTMGP shortwave clear-sky flux (W/m2)
121114
fluxswUP_allsky, & !< RRTMGP shortwave all-sky flux (W/m2)
122115
fluxswDOWN_allsky !< RRTMGP shortwave all-sky flux (W/m2)
123-
! real(kind_phys), dimension(nCol,nLev+1), intent(in), optional :: &
124-
125-
126-
127-
128-
129116
real(kind_phys), dimension(:,:), intent(in) :: &
130117
aerodp !< Vertical integrated optical depth for <nspc1> aerosol species
131118
real(kind_phys), dimension(:,:), intent(in) :: &
@@ -145,29 +132,28 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
145132
!!\n nirdf - downward nir diffused flux (W/m2)
146133
!!\n visbm - downward uv+vis direct beam flux (W/m2)
147134
!!\n visdf - downward uv+vis diffused flux (W/m2)
148-
!
149-
! ! Outputs (mandatory)
150-
! real(kind_phys), dimension(nCol), intent(inout) :: &
151-
! tsflw, & !< LW sfc air temp during calculation (K)
152-
! sfcdlw, & !< LW sfc all-sky downward flux (W/m2)
153-
! sfculw, & !< LW sfc all-sky upward flux (W/m2)
154-
! nirbmdi, & !< SW sfc nir beam downward flux (W/m2)
155-
! nirdfdi, & !< SW sfc nir diff downward flux (W/m2)
156-
! visbmdi, & !< SW sfc uv+vis beam downward flux (W/m2)
157-
! visdfdi, & !< SW sfc uv+vis diff downward flux (W/m2)
158-
! nirbmui, & !< SW sfc nir beam upward flux (W/m2)
159-
! nirdfui, & !< SW sfc nir diff upward flux (W/m2)
160-
! visbmui, & !< SW sfc uv+vis beam upward flux (W/m2)
161-
! visdfui, & !< SW sfc uv+vis diff upward flux (W/m2)
162-
! sfcnsw, & !< SW sfc all-sky net flux (W/m2) flux into ground
163-
! sfcdsw !< SW sfc all-sky downward flux (W/m2)
135+
! Outputs (mandatory)
136+
real(kind_phys), dimension(:), intent(inout) :: &
137+
tsflw, & !< LW sfc air temp during calculation (K)
138+
sfcdlw, & !< LW sfc all-sky downward flux (W/m2)
139+
sfculw, & !< LW sfc all-sky upward flux (W/m2)
140+
nirbmdi, & !< SW sfc nir beam downward flux (W/m2)
141+
nirdfdi, & !< SW sfc nir diff downward flux (W/m2)
142+
visbmdi, & !< SW sfc uv+vis beam downward flux (W/m2)
143+
visdfdi, & !< SW sfc uv+vis diff downward flux (W/m2)
144+
nirbmui, & !< SW sfc nir beam upward flux (W/m2)
145+
nirdfui, & !< SW sfc nir diff upward flux (W/m2)
146+
visbmui, & !< SW sfc uv+vis beam upward flux (W/m2)
147+
visdfui, & !< SW sfc uv+vis diff upward flux (W/m2)
148+
sfcnsw, & !< SW sfc all-sky net flux (W/m2) flux into ground
149+
sfcdsw !< SW sfc all-sky downward flux (W/m2)
164150
real(kind_phys), dimension(:,:), intent(inout) :: &
165151
htrlw, & !< LW all-sky heating rate (K/s)
166152
htrsw !< SW all-sky heating rate (K/s)
167153
real(kind_phys), dimension(:), intent(inout) :: &
168154
total_albedo !< Total sky albedo at TOA (W/m2)
169-
! real(kind_phys), dimension(:,:), intent(inout), optional :: &
170-
! htrlwu !< LW all-sky heating-rate updated in-between radiation calls.
155+
real(kind_phys), dimension(:,:), intent(inout), optional :: &
156+
htrlwu !< LW all-sky heating-rate updated in-between radiation calls.
171157
type(sfcflw_type), dimension(:), intent(inout) :: &
172158
sfcflw !< LW radiation fluxes at sfc
173159
type(sfcfsw_type), dimension(:), intent(inout) :: &
@@ -182,15 +168,13 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
182168
errmsg !< CCPP error message
183169
integer, intent(out) :: &
184170
errflg !< CCPP error code
185-
186171
! Outputs (optional)
187172
real(kind_phys),dimension(:,:),intent(inout),optional :: &
188173
htrlwc, & !< LW clear-sky heating-rate (K/s)
189174
htrswc !< SW clear-sky heating rate (K/s)
190175

191176
! Local variables
192-
! integer :: i
193-
! real(kind_phys) :: tem0d, tem1, tem2
177+
integer :: i
194178
real(kind_phys), dimension(nDay, nLev) :: thetaTendClrSky, thetaTendAllSky
195179

196180
! Initialize CCPP error handling variables
@@ -221,27 +205,26 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
221205
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
222206
htrlw)) ! OUT - Longwave all-sky heating rate (K/sec)
223207

224-
! (Copy fluxes from RRTMGP types into model radiation types.)
225-
!
226-
! ! TOA fluxes
227-
! topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
228-
! topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)
229-
!
230-
! ! Surface fluxes
231-
! sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
232-
! sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
233-
! sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
234-
! sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)
235-
!
236-
! ! Save surface air temp for diurnal adjustment at model t-steps
237-
! tsflw (:) = tsfa(:)
238-
!
239-
! ! Radiation fluxes for other physics processes
240-
! sfcdlw(:) = sfcflw(:)%dnfxc
241-
! sfculw(:) = sfcflw(:)%upfxc
242-
!
243-
! ! Heating-rate at radiation timestep, used for adjustment between radiation calls.
244-
! htrlwu = htrlw
208+
! (Copy fluxes from RRTMGP types into model radiation types.)
209+
! TOA fluxes
210+
topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
211+
topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)
212+
213+
! Surface fluxes
214+
sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
215+
sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
216+
sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
217+
sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)
218+
219+
! Save surface air temp for diurnal adjustment at model t-steps
220+
tsflw(:) = tsfa(:)
221+
222+
! Radiation fluxes for other physics processes
223+
sfcdlw(:) = sfcflw(:)%dnfxc
224+
sfculw(:) = sfcflw(:)%upfxc
225+
226+
! Heating-rate at radiation timestep, used for adjustment between radiation calls.
227+
htrlwu = htrlw
245228
endif ! RRTMGP Longwave Radiaiton
246229
endif ! ALL Longwave Radiation
247230

@@ -261,7 +244,7 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
261244
thetaTendClrSky)) ! OUT - Clear-sky heating-rate (K/sec)
262245
htrswc(idxday(1:nDay),:)=thetaTendClrSky !**NOTE** GP doesn't use radiation levels, it uses the model fields. Not sure if this is necessary
263246
endif
264-
247+
265248
! All-sky heating-rate (mandatory)
266249
htrsw(:,:) = 0._kind_phys
267250
call check_error_msg('GFS_radiation_post',compute_heating_rate( &
@@ -270,60 +253,60 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
270253
p_lev(idxday(1:nDay),:), & ! IN - Pressure at model-interface (Pa)
271254
thetaTendAllSky)) ! OUT - All-sky heating-rate (K/sec)
272255
htrsw(idxday(1:nDay),:) = thetaTendAllSky
273-
!
274-
! ! (Copy fluxes from RRTMGP types into model radiation types.)
275-
!
276-
! ! TOA fluxes
277-
! topfsw(:)%upfxc = fluxswUP_allsky(:,iTOA)
278-
! topfsw(:)%upfx0 = fluxswUP_clrsky(:,iTOA)
279-
! topfsw(:)%dnfxc = fluxswDOWN_allsky(:,iTOA)
280-
!
281-
! ! Surface fluxes
282-
! sfcfsw(:)%upfxc = fluxswUP_allsky(:,iSFC)
283-
! sfcfsw(:)%upfx0 = fluxswUP_clrsky(:,iSFC)
284-
! sfcfsw(:)%dnfxc = fluxswDOWN_allsky(:,iSFC)
285-
! sfcfsw(:)%dnfx0 = fluxswDOWN_clrsky(:,iSFC)
286-
!
287-
! ! Surface down and up spectral component fluxes
288-
! ! - Save two spectral bands' surface downward and upward fluxes for output.
289-
! do i=1,nCol
290-
! nirbmdi(i) = scmpsw(i)%nirbm
291-
! nirdfdi(i) = scmpsw(i)%nirdf
292-
! visbmdi(i) = scmpsw(i)%visbm
293-
! visdfdi(i) = scmpsw(i)%visdf
294-
! nirbmui(i) = scmpsw(i)%nirbm * sfc_alb_nir_dir(i)
295-
! nirdfui(i) = scmpsw(i)%nirdf * sfc_alb_nir_dif(i)
296-
! visbmui(i) = scmpsw(i)%visbm * sfc_alb_uvvis_dir(i)
297-
! visdfui(i) = scmpsw(i)%visdf * sfc_alb_uvvis_dif(i)
298-
! enddo
256+
257+
! (Copy fluxes from RRTMGP types into model radiation types.)
258+
259+
! TOA fluxes
260+
topfsw(:)%upfxc = fluxswUP_allsky(:,iTOA)
261+
topfsw(:)%upfx0 = fluxswUP_clrsky(:,iTOA)
262+
topfsw(:)%dnfxc = fluxswDOWN_allsky(:,iTOA)
263+
264+
! Surface fluxes
265+
sfcfsw(:)%upfxc = fluxswUP_allsky(:,iSFC)
266+
sfcfsw(:)%upfx0 = fluxswUP_clrsky(:,iSFC)
267+
sfcfsw(:)%dnfxc = fluxswDOWN_allsky(:,iSFC)
268+
sfcfsw(:)%dnfx0 = fluxswDOWN_clrsky(:,iSFC)
269+
270+
! Surface down and up spectral component fluxes
271+
! - Save two spectral bands' surface downward and upward fluxes for output.
272+
do i=1,nCol
273+
nirbmdi(i) = scmpsw(i)%nirbm
274+
nirdfdi(i) = scmpsw(i)%nirdf
275+
visbmdi(i) = scmpsw(i)%visbm
276+
visdfdi(i) = scmpsw(i)%visdf
277+
nirbmui(i) = scmpsw(i)%nirbm * sfc_alb_nir_dir(i)
278+
nirdfui(i) = scmpsw(i)%nirdf * sfc_alb_nir_dif(i)
279+
visbmui(i) = scmpsw(i)%visbm * sfc_alb_uvvis_dir(i)
280+
visdfui(i) = scmpsw(i)%visdf * sfc_alb_uvvis_dif(i)
281+
enddo
299282
else ! if_nday_block
300283
! Dark everywhere
301284
htrsw(:,:) = 0.0
302-
! sfcfsw = sfcfsw_type( 0.0, 0.0, 0.0, 0.0 )
303-
! topfsw = topfsw_type( 0.0, 0.0, 0.0 )
304-
! do i=1,nCol
305-
! nirbmdi(i) = 0.0
306-
! nirdfdi(i) = 0.0
307-
! visbmdi(i) = 0.0
308-
! visdfdi(i) = 0.0
309-
! nirbmui(i) = 0.0
310-
! nirdfui(i) = 0.0
311-
! visbmui(i) = 0.0
312-
! visdfui(i) = 0.0
313-
! enddo
314-
!
285+
sfcfsw = sfcfsw_type( 0.0, 0.0, 0.0, 0.0 )
286+
topfsw = topfsw_type( 0.0, 0.0, 0.0 )
287+
do i=1,nCol
288+
nirbmdi(i) = 0.0
289+
nirdfdi(i) = 0.0
290+
visbmdi(i) = 0.0
291+
visdfdi(i) = 0.0
292+
nirbmui(i) = 0.0
293+
nirdfui(i) = 0.0
294+
visbmui(i) = 0.0
295+
visdfui(i) = 0.0
296+
enddo
297+
315298
if (do_sw_clrsky_hr) then
316299
htrswc(:,:) = 0
317300
endif
318301
endif ! end_if_nday
319-
!
320-
! ! Radiation fluxes for other physics processes
321-
! ! *NOTE* For RRTMG, sfcnsw and sfcdsw are provided.
322-
! ! For RRTMGP, we compute them here.
323-
! do i=1,nCol
324-
! sfcnsw(i) = sfcfsw(i)%dnfxc - sfcfsw(i)%upfxc
325-
! sfcdsw(i) = sfcfsw(i)%dnfxc
326-
! enddo
302+
303+
! Radiation fluxes for other physics processes
304+
! *NOTE* For RRTMG, sfcnsw and sfcdsw are provided.
305+
! For RRTMGP, we compute them here.
306+
do i=1,nCol
307+
sfcnsw(i) = sfcfsw(i)%dnfxc - sfcfsw(i)%upfxc
308+
sfcdsw(i) = sfcfsw(i)%dnfxc
309+
enddo
327310
endif ! RRTMGP Shortwave Radiaiton
328311
endif ! ALL Shortwave Radiation
329312

@@ -339,7 +322,7 @@ subroutine GFS_radiation_post_run(doLWrad, doSWrad, lssav, total_albedo, topfsw,
339322
aerodp, cldsa, mtopa, mbota, cldtausw, cldtaulw, p_lev, tgrs, kb, kd, kt, sfcflw, &
340323
sfcfsw, topfsw, topflw, scmpsw, nCol, nDay, nLev, nfxr, nspc1, fluxr)
341324
endif
342-
325+
343326
end subroutine GFS_radiation_post_run
344327

345328
! ###########################################################################################

0 commit comments

Comments
 (0)