Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update calculation of time-averaged radiation variables #241

Open
wants to merge 36 commits into
base: ufs/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8c2afec
Moved fluxr computation from GFS_rrtmg_post to dcyc2t3 to provide cor…
LarissaReames-NOAA Dec 16, 2024
739b174
Remove fluxr calculation from RRTMG post routine.
LarissaReames-NOAA Dec 17, 2024
f20c5a4
Update documentation of dcyc2t3 to account for the variables moved fr…
LarissaReames-NOAA Dec 17, 2024
9d251ba
Combined GFS_rrtmg/rrtmgp_post.F90 in to GFS_radiation_post.F90
LarissaReames-NOAA Dec 19, 2024
b876e1e
Replaced 'rrtmg' in warning/error message with 'radiation' to avoid c…
LarissaReames-NOAA Jan 10, 2025
e65b355
Merge branch 'ufs/dev' of https://github.com/ufs-community/ccpp-physi…
LarissaReames-NOAA Jan 13, 2025
868dadb
update cloud/radiation/land
rhaesung Jan 3, 2025
ba78577
update radiation_clouds.f according to the review
rhaesung Jan 6, 2025
f3fe9ca
update module_sf_noahmp_glacier.F90 and module_sf_noahmplsm.F90 accor…
rhaesung Jan 21, 2025
1635966
update module_sf_noahmplsm.F90
rhaesung Jan 22, 2025
6619587
update module_sf_noahmplsm.F90
rhaesung Jan 22, 2025
3b2a01a
skip land component for first time step
uturuncoglu Nov 8, 2024
3110557
minor fix for restart
uturuncoglu Dec 6, 2024
48278a5
add simple land flux calculation that is used in the initial time step
uturuncoglu Dec 19, 2024
73e032e
fix minor issue
uturuncoglu Dec 19, 2024
08857a8
remove flag_init
uturuncoglu Dec 23, 2024
c25d36c
correction for flux calculation
uturuncoglu Dec 27, 2024
6b40c48
fix space issue
uturuncoglu Jan 7, 2025
5c3886a
add a new parameter to control if G-F cold starts or not
JiliDong-NOAA Aug 22, 2024
4c558e1
Update physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_vary.fv3.*…
climbfuji Dec 19, 2024
428ebdb
Revert "Update physics/Interstitials/UFS_SCM_NEPTUNE/GFS_phys_time_va…
LarissaReames-NOAA Feb 6, 2025
a5b7c0f
Revert "add a new parameter to control if G-F cold starts or not"
LarissaReames-NOAA Feb 6, 2025
09c97a5
Revert "fix space issue"
LarissaReames-NOAA Feb 6, 2025
00cf6e7
Revert "correction for flux calculation"
LarissaReames-NOAA Feb 6, 2025
2811f8c
Revert "remove flag_init"
LarissaReames-NOAA Feb 6, 2025
4d40d7e
Revert "fix minor issue"
LarissaReames-NOAA Feb 6, 2025
db66342
Revert "add simple land flux calculation that is used in the initial …
LarissaReames-NOAA Feb 6, 2025
770e193
Revert "minor fix for restart"
LarissaReames-NOAA Feb 6, 2025
15161d9
Revert "skip land component for first time step"
LarissaReames-NOAA Feb 6, 2025
f32a01e
Revert "update module_sf_noahmplsm.F90"
LarissaReames-NOAA Feb 6, 2025
c37e2d2
Revert "update module_sf_noahmplsm.F90"
LarissaReames-NOAA Feb 6, 2025
1a55e3b
Revert "update module_sf_noahmp_glacier.F90 and module_sf_noahmplsm.F…
LarissaReames-NOAA Feb 6, 2025
75f72bb
Revert "update radiation_clouds.f according to the review"
LarissaReames-NOAA Feb 6, 2025
8a96ec2
Revert "update cloud/radiation/land"
LarissaReames-NOAA Feb 6, 2025
4f2a977
Merge branch 'ufs/dev' into feature/rad-fix
LarissaReames-NOAA Feb 6, 2025
8c549ef
Merge branch 'ufs/dev' into feature/rad-fix
LarissaReames-NOAA Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
!> \file GFS_rrtmgp_post.F90
!> \file GFS_radiation_post.F90
!!
!> \defgroup GFS_rrtmgp_post GFS_rrtmgp_post.F90
!> \defgroup GFS_radiation_post GFS_rrtmgp_post.F90
!!
!! \brief RRTMGP post-processing routine.
!!
module GFS_rrtmgp_post
module GFS_radiation_post
use machine, only: kind_phys
use module_radlw_parameters, only: topflw_type, sfcflw_type
use module_radsw_parameters, only: topfsw_type, sfcfsw_type, cmpfsw_type
use mo_heating_rates, only: compute_heating_rate
use radiation_tools, only: check_error_msg
implicit none

public GFS_rrtmgp_post_run
public GFS_radiation_post_run

contains
! ########################################################################################
!>\defgroup gfs_rrtmgp_post_mod GFS RRTMGP Post Module
!> \section arg_table_GFS_rrtmgp_post_run
!! \htmlinclude GFS_rrtmgp_post.html
!>\defgroup gfs_radiation_post_mod GFS Radiation Post Module
!> \section arg_table_GFS_radiation_post_run
!! \htmlinclude GFS_radiation_post.html
!!
!! \ingroup GFS_rrtmgp_post
!! \ingroup GFS_radiation_post
!!
!! \brief The all-sky radiation tendency is computed, the clear-sky tendency is computed
!! if requested.
!!
!! RRTMGP surface and TOA fluxes are copied to fields that persist between radiation/physics
!! calls.
!!
!! (optional) Save additional diagnostics.
!!
!! \section GFS_rrtmgp_post_run
!! \section GFS_radiation_post_run
! ########################################################################################
subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, doSWrad, &
do_lw_clrsky_hr, do_sw_clrsky_hr, save_diag, fhlwr, fhswr, sfc_alb_nir_dir, &
sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, p_lev, tsfa, coszen, coszdg, &
subroutine GFS_radiation_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, doSWrad, &
do_lw_clrsky_hr, do_sw_clrsky_hr, do_RRTMGP, sfc_alb_nir_dir, &
sfc_alb_nir_dif, sfc_alb_uvvis_dir, sfc_alb_uvvis_dif, p_lev, tsfa, &
fluxlwDOWN_clrsky, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, &
fluxswDOWN_clrsky, fluxswUP_allsky, fluxswDOWN_allsky, fluxswUP_clrsky, &
raddt, aerodp, cldsa, mtopa, mbota, cld_frac, cldtaulw, cldtausw, scmpsw, fluxr, &
fluxswDOWN_clrsky, fluxswUP_allsky, fluxswDOWN_allsky, fluxswUP_clrsky, scmpsw, &
sfcdlw, sfculw, sfcflw, tsflw, htrlw, htrlwu, topflw, nirbmdi, nirdfdi, visbmdi, &
visdfdi, nirbmui, nirdfui, visbmui, visdfui, sfcnsw, sfcdsw, htrsw, sfcfsw, topfsw, &
htrswc, htrlwc, errmsg, errflg)
htrswc, htrlwc, total_albedo, errmsg, errflg)

! Inputs
integer, intent(in) :: &
Expand All @@ -51,22 +48,14 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
iTOA ! Vertical index for TOA level
integer, intent(in), dimension(:) :: &
idxday ! Index array for daytime points
integer, intent(in), dimension(:,:) :: &
mbota, & ! Vertical indices for low, middle and high cloud tops
mtopa ! ertical indices for low, middle and high cloud bases
logical, intent(in) :: &
doLWrad, & ! Logical flags for lw radiation calls
doSWrad, & ! Logical flags for sw radiation calls
do_lw_clrsky_hr, & ! Output clear-sky LW heating-rate?
do_sw_clrsky_hr, & ! Output clear-sky SW heating-rate?
save_diag ! Output radiation diagnostics?
real(kind_phys), intent(in) :: &
fhlwr, & ! Frequency for LW radiation calls
fhswr ! Frequency for SW radiation calls
do_RRTMGP ! Flag for using RRTMGP scheme
real(kind_phys), dimension(:), intent(in) :: &
tsfa, & ! Lowest model layer air temperature for radiation (K)
coszen, & ! Cosine(SZA)
coszdg, & ! Cosine(SZA), daytime
sfc_alb_nir_dir, & ! Surface albedo (direct)
sfc_alb_nir_dif, & ! Surface albedo (diffuse)
sfc_alb_uvvis_dir, & ! Surface albedo (direct)
Expand All @@ -81,14 +70,6 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
fluxswDOWN_allsky, & ! RRTMGP shortwave all-sky flux (W/m2)
fluxswUP_clrsky, & ! RRTMGP shortwave clear-sky flux (W/m2)
fluxswDOWN_clrsky ! RRTMGP shortwave clear-sky flux (W/m2)
real(kind_phys), intent(in) :: &
raddt ! Radiation time step
real(kind_phys), dimension(:,:), intent(in) :: &
aerodp, & ! Vertical integrated optical depth for various aerosol species
cldsa, & ! Fraction of clouds for low, middle, high, total and BL
cld_frac, & ! Total cloud fraction in each layer
cldtaulw, & ! approx 10.mu band layer cloud optical depth
cldtausw ! approx .55mu band layer cloud optical depth
type(cmpfsw_type), dimension(:), intent(in) :: &
scmpsw ! 2D surface fluxes, components:
! uvbfc - total sky downward uv-b flux at (W/m2)
Expand All @@ -98,9 +79,6 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
! visbm - downward uv+vis direct beam flux (W/m2)
! visdf - downward uv+vis diffused flux (W/m2)


real(kind=kind_phys), dimension(:,:), intent(inout) :: fluxr

! Outputs (mandatory)
real(kind_phys), dimension(:), intent(inout) :: &
tsflw, & ! LW sfc air temp during calculation (K)
Expand All @@ -119,6 +97,8 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
real(kind_phys), dimension(:,:), intent(inout) :: &
htrlw, & ! LW all-sky heating rate (K/s)
htrsw ! SW all-sky heating rate (K/s)
real(kind_phys), dimension(nCol), intent(inout) :: &
total_albedo ! Total sky albedo at TOA (W/m2)
real(kind_phys), dimension(:,:), intent(inout), optional :: &
htrlwu ! LW all-sky heating-rate updated in-between radiation calls.
type(sfcflw_type), dimension(:), intent(inout) :: &
Expand Down Expand Up @@ -151,96 +131,64 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
if (.not. (doLWrad .or. doSWrad)) return

if (doLWRad) then
! #######################################################################################
! Compute LW heating-rates.
! #######################################################################################
if (do_RRTMGP) then
! #######################################################################################
! Compute LW heating-rates.
! #######################################################################################

! Clear-sky heating-rate (optional)
if (do_lw_clrsky_hr) then
call check_error_msg('GFS_rrtmgp_post',compute_heating_rate( &
fluxlwUP_clrsky, & ! IN - RRTMGP upward longwave clear-sky flux profiles (W/m2)
fluxlwDOWN_clrsky, & ! IN - RRTMGP downward longwave clear-sky flux profiles (W/m2)
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
htrlwc)) ! OUT - Longwave clear-sky heating rate (K/sec)
endif
! Clear-sky heating-rate (optional)
if (do_lw_clrsky_hr) then
call check_error_msg('GFS_radiation_post',compute_heating_rate( &
fluxlwUP_clrsky, & ! IN - RRTMGP upward longwave clear-sky flux profiles (W/m2)
fluxlwDOWN_clrsky, & ! IN - RRTMGP downward longwave clear-sky flux profiles (W/m2)
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
htrlwc)) ! OUT - Longwave clear-sky heating rate (K/sec)
endif

! All-sky heating-rate (mandatory)
call check_error_msg('GFS_rrtmgp_post',compute_heating_rate( &
fluxlwUP_allsky, & ! IN - RRTMGP upward longwave all-sky flux profiles (W/m2)
fluxlwDOWN_allsky, & ! IN - RRTMGP downward longwave all-sky flux profiles (W/m2)
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
htrlw)) ! OUT - Longwave all-sky heating rate (K/sec)
! All-sky heating-rate (mandatory)
call check_error_msg('GFS_radiation_post',compute_heating_rate( &
fluxlwUP_allsky, & ! IN - RRTMGP upward longwave all-sky flux profiles (W/m2)
fluxlwDOWN_allsky, & ! IN - RRTMGP downward longwave all-sky flux profiles (W/m2)
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
htrlw)) ! OUT - Longwave all-sky heating rate (K/sec)

! #######################################################################################
! Save LW outputs.
! (Copy fluxes from RRTMGP types into model radiation types.)
! #######################################################################################
! TOA fluxes
! #######################################################################################
! Save LW outputs.
! (Copy fluxes from RRTMGP types into model radiation types.)
! #######################################################################################
! TOA fluxes

topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)

! Surface fluxes
sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)

! Save surface air temp for diurnal adjustment at model t-steps
tsflw (:) = tsfa(:)

! Radiation fluxes for other physics processes
sfcdlw(:) = sfcflw(:)%dnfxc
sfculw(:) = sfcflw(:)%upfxc

! Heating-rate at radiation timestep, used for adjustment between radiation calls.
htrlwu = htrlw

! #######################################################################################
! Save LW diagnostics
! - For time averaged output quantities (including total-sky and clear-sky SW and LW
! fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base
! pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
! corresponding slots of array fluxr with appropriate time weights.
! - Collect the fluxr data for wrtsfc
! #######################################################################################
if (save_diag) then
do i=1,nCol
! LW all-sky fluxes
fluxr(i,1 ) = fluxr(i,1 ) + fhlwr * fluxlwUP_allsky( i,iTOA) ! total sky top lw up
fluxr(i,19) = fluxr(i,19) + fhlwr * fluxlwDOWN_allsky(i,iSFC) ! total sky sfc lw dn
fluxr(i,20) = fluxr(i,20) + fhlwr * fluxlwUP_allsky( i,iSFC) ! total sky sfc lw up
! LW clear-sky fluxes
fluxr(i,28) = fluxr(i,28) + fhlwr * fluxlwUP_clrsky( i,iTOA) ! clear sky top lw up
fluxr(i,30) = fluxr(i,30) + fhlwr * fluxlwDOWN_clrsky(i,iSFC) ! clear sky sfc lw dn
fluxr(i,33) = fluxr(i,33) + fhlwr * fluxlwUP_clrsky( i,iSFC) ! clear sky sfc lw up
enddo
topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)

! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud is reversed for
! the fluxr output. save interface pressure (pa) of top/bot
do j = 1, 3
do i = 1, nCol
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j)
ibtc = mbota(i,j)

! Add optical depth and emissivity output
tem2 = 0.
do k=ibtc,itop
tem2 = tem2 + cldtaulw(i,k) ! approx 10. mu channel
enddo
fluxr(i,46-j) = fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
! Surface fluxes
sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)

! Save surface air temp for diurnal adjustment at model t-steps
tsflw (:) = tsfa(:)

! Radiation fluxes for other physics processes
sfcdlw(:) = sfcflw(:)%dnfxc
sfculw(:) = sfcflw(:)%upfxc

! Heating-rate at radiation timestep, used for adjustment between radiation calls.
htrlwu = htrlw
endif

! --- The total sky (with clouds) shortwave albedo
total_albedo = 0.0
where(topfsw(:)%dnfxc>0) total_albedo(:) = topfsw(:)%upfxc/topfsw(:)%dnfxc
endif
! #######################################################################################
! #######################################################################################
! #######################################################################################
! #######################################################################################
! #######################################################################################
! #######################################################################################
if (doSWRad) then
if (doSWRad .and. do_RRTMGP) then
if (nDay .gt. 0) then
! #################################################################################
! Compute SW heating-rates
Expand Down Expand Up @@ -323,73 +271,7 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
sfcdsw(i) = sfcfsw(i)%dnfxc
enddo

! #################################################################################
! Save SW diagnostics
! - For time averaged output quantities (including total-sky and clear-sky SW and LW
! fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base
! pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
! corresponding slots of array fluxr with appropriate time weights.
! - Collect the fluxr data for wrtsfc
! #################################################################################
if (save_diag) then
do i=1,nCol
fluxr(i,34) = aerodp(i,1) ! total aod at 550nm
fluxr(i,35) = aerodp(i,2) ! DU aod at 550nm
fluxr(i,36) = aerodp(i,3) ! BC aod at 550nm
fluxr(i,37) = aerodp(i,4) ! OC aod at 550nm
fluxr(i,38) = aerodp(i,5) ! SU aod at 550nm
fluxr(i,39) = aerodp(i,6) ! SS aod at 550nm
if (coszen(i) > 0.) then
! SW all-sky fluxes
tem0d = fhswr * coszdg(i) / coszen(i)
fluxr(i,2 ) = fluxr(i,2) + topfsw(i)%upfxc * tem0d ! total sky top sw up
fluxr(i,3 ) = fluxr(i,3) + sfcfsw(i)%upfxc * tem0d
fluxr(i,4 ) = fluxr(i,4) + sfcfsw(i)%dnfxc * tem0d ! total sky sfc sw dn
! SW uv-b fluxes
fluxr(i,21) = fluxr(i,21) + scmpsw(i)%uvbfc * tem0d ! total sky uv-b sw dn
fluxr(i,22) = fluxr(i,22) + scmpsw(i)%uvbf0 * tem0d ! clear sky uv-b sw dn
! SW TOA incoming fluxes
fluxr(i,23) = fluxr(i,23) + topfsw(i)%dnfxc * tem0d ! top sw dn
! SW SFC flux components
fluxr(i,24) = fluxr(i,24) + visbmdi(i) * tem0d ! uv/vis beam sw dn
fluxr(i,25) = fluxr(i,25) + visdfdi(i) * tem0d ! uv/vis diff sw dn
fluxr(i,26) = fluxr(i,26) + nirbmdi(i) * tem0d ! nir beam sw dn
fluxr(i,27) = fluxr(i,27) + nirdfdi(i) * tem0d ! nir diff sw dn
! SW clear-sky fluxes
fluxr(i,29) = fluxr(i,29) + topfsw(i)%upfx0 * tem0d
fluxr(i,31) = fluxr(i,31) + sfcfsw(i)%upfx0 * tem0d
fluxr(i,32) = fluxr(i,32) + sfcfsw(i)%dnfx0 * tem0d
endif
enddo

! Save total and boundary-layer clouds
do i=1,nCol
fluxr(i,17) = fluxr(i,17) + raddt * cldsa(i,4)
fluxr(i,18) = fluxr(i,18) + raddt * cldsa(i,5)
enddo

! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud
! is reversed for the fluxr output. save interface pressure (pa) of top/bot
do j = 1, 3
do i = 1, nCol
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j)
ibtc = mbota(i,j)
fluxr(i, 8-j) = fluxr(i, 8-j) + tem0d
fluxr(i,11-j) = fluxr(i,11-j) + tem0d * p_lev(i,itop)
fluxr(i,14-j) = fluxr(i,14-j) + tem0d * p_lev(i,ibtc)
fluxr(i,17-j) = fluxr(i,17-j) + tem0d * p_lev(i,itop)

! Add optical depth and emissivity output
tem1 = 0.
do k=ibtc,itop
tem1 = tem1 + cldtausw(i,k) ! approx .55 mu channel
enddo
fluxr(i,43-j) = fluxr(i,43-j) + tem0d * tem1
enddo
enddo
endif
endif

end subroutine GFS_rrtmgp_post_run
end module GFS_rrtmgp_post
end subroutine GFS_radiation_post_run
end module GFS_radiation_post
Loading