Skip to content

Commit

Permalink
Changes were made to use RRTMGP for SW calculation, and RRTMG for the…
Browse files Browse the repository at this point in the history
… LW calculation.
  • Loading branch information
dustinswales committed Oct 7, 2019
1 parent 34d5fe1 commit 3958a87
Show file tree
Hide file tree
Showing 17 changed files with 1,192 additions and 760 deletions.
2 changes: 2 additions & 0 deletions physics/GFS_rrtmgp_gas_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ subroutine GFS_rrtmgp_gas_optics_init(Model, Radtend, errmsg, errflg)
end subroutine GFS_rrtmgp_gas_optics_init
!
subroutine GFS_rrtmgp_gas_optics_run()


end subroutine GFS_rrtmgp_gas_optics_run
!
subroutine GFS_rrtmgp_gas_optics_finalize()
Expand Down
88 changes: 81 additions & 7 deletions physics/GFS_rrtmgp_lw_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ module GFS_rrtmgp_lw_post
use GFS_typedefs, only: GFS_coupling_type, &
GFS_control_type, &
GFS_grid_type, &
GFS_radtend_type
GFS_radtend_type, &
GFS_statein_type, &
GFS_diag_type
use module_radiation_aerosols, only: NSPC1
use module_radlw_parameters, only: topflw_type, sfcflw_type, proflw_type
! RRTMGP DDT's
Expand All @@ -25,10 +27,10 @@ end subroutine GFS_rrtmgp_lw_post_init
!> \section arg_table_GFS_rrtmgp_lw_post_run
!! \htmlinclude GFS_rrtmgp_lw_post.html
!!
subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, &
Coupling, im, p_lev, &
tsfa, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, fluxlwDOWN_clrsky, &
hlwc, topflx_lw, sfcflx_lw, flxprf_lw, hlw0, errmsg, errflg)
subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, Coupling, Diag, Statein, im, &
p_lev, tsfa, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, fluxlwDOWN_clrsky,&
raddt, aerodp, cldsa, mtopa, mbota, cld_frac, cldtaulw, hlwc, topflx_lw, &
sfcflx_lw, flxprf_lw, hlw0, errmsg, errflg)

! Inputs
type(GFS_control_type), intent(in) :: &
Expand All @@ -39,6 +41,10 @@ subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, &
Coupling ! Fortran DDT containing FV3-GFS fields to/from coupling with other components
type(GFS_radtend_type), intent(inout) :: &
Radtend ! Fortran DDT containing FV3-GFS radiation tendencies
type(GFS_diag_type), intent(inout) :: &
Diag ! Fortran DDT containing FV3-GFS diagnotics data
type(GFS_statein_type), intent(in) :: &
Statein ! Fortran DDT containing FV3-GFS prognostic state data in from dycore
integer, intent(in) :: &
im ! Horizontal loop extent
real(kind_phys), dimension(size(Grid%xlon,1)), intent(in) :: &
Expand All @@ -50,6 +56,18 @@ subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, &
fluxlwDOWN_allsky, & ! LW All-sky flux (W/m2)
fluxlwUP_clrsky, & ! LW Clear-sky flux (W/m2)
fluxlwDOWN_clrsky ! LW All-sky flux (W/m2)
real(kind_phys), intent(in) :: &
raddt ! Radiation time step
real(kind_phys), dimension(im,NSPC1), intent(in) :: &
aerodp ! Vertical integrated optical depth for various aerosol species
real(kind_phys), dimension(im,5), intent(in) :: &
cldsa ! Fraction of clouds for low, middle, high, total and BL
integer, dimension(im,3), intent(in) ::&
mbota, & ! vertical indices for low, middle and high cloud tops
mtopa ! vertical indices for low, middle and high cloud bases
real(kind_phys), dimension(im,Model%levs), intent(in) :: &
cld_frac, & ! Total cloud fraction in each layer
cldtaulw ! approx 10.mu band layer cloud optical depth

! Outputs (mandatory)
character(len=*), intent(out) :: &
Expand Down Expand Up @@ -80,10 +98,11 @@ subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, &
! dnfx0 - clear sky dnward flux (W/m2)

! Local variables
integer :: k, iSFC, iTOA
integer :: i, j, k, iSFC, iTOA, itop, ibtc
logical :: l_clrskylw_hr, l_fluxeslw2d, top_at_1
real(kind_phys) :: tem0d, tem1, tem2

! Initialize CCPP error handling variables
! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

Expand Down Expand Up @@ -163,6 +182,61 @@ subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, &
Coupling%sfcdlw(:) = Radtend%sfcflw(:)%dnfxc
endif

! #######################################################################################
! 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 (Model%lssav) then
if (Model%lslwr) then
do i=1,im
! LW all-sky fluxes
Diag%fluxr(i,1 ) = Diag%fluxr(i,1 ) + Model%fhlwr * Diag%topflw(i)%upfxc ! total sky top lw up
Diag%fluxr(i,19) = Diag%fluxr(i,19) + Model%fhlwr * Radtend%sfcflw(i)%dnfxc ! total sky sfc lw dn
Diag%fluxr(i,20) = Diag%fluxr(i,20) + Model%fhlwr * Radtend%sfcflw(i)%upfxc ! total sky sfc lw up
! LW clear-sky fluxes
Diag%fluxr(i,28) = Diag%fluxr(i,28) + Model%fhlwr * Diag%topflw(i)%upfx0 ! clear sky top lw up
Diag%fluxr(i,30) = Diag%fluxr(i,30) + Model%fhlwr * Radtend%sfcflw(i)%dnfx0 ! clear sky sfc lw dn
Diag%fluxr(i,33) = Diag%fluxr(i,33) + Model%fhlwr * Radtend%sfcflw(i)%upfx0 ! clear sky sfc lw up
enddo

do i=1,im
Diag%fluxr(i,17) = Diag%fluxr(i,17) + raddt * cldsa(i,4)
Diag%fluxr(i,18) = Diag%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, IM
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j)
ibtc = mbota(i,j)
Diag%fluxr(i, 8-j) = Diag%fluxr(i, 8-j) + tem0d
Diag%fluxr(i,11-j) = Diag%fluxr(i,11-j) + tem0d * Statein%prsi(i,itop)
Diag%fluxr(i,14-j) = Diag%fluxr(i,14-j) + tem0d * Statein%prsi(i,ibtc)
Diag%fluxr(i,17-j) = Diag%fluxr(i,17-j) + tem0d * Statein%tgrs(i,itop)

! Add optical depth and emissivity output
tem2 = 0.
do k=ibtc,itop
tem2 = tem2 + cldtaulw(i,k) ! approx 10. mu channel
enddo
Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
endif

if (Model%lgocart .or. Model%ldiag3d) then
do k = 1, Model%levs
Coupling%cldcovi(1:im,k) = cld_frac(1:im,k)
enddo
endif
endif

end subroutine GFS_rrtmgp_lw_post_run

subroutine GFS_rrtmgp_lw_post_finalize ()
Expand Down
77 changes: 77 additions & 0 deletions physics/GFS_rrtmgp_lw_post.meta
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@
type = GFS_coupling_type
intent = inout
optional = F
[Diag]
standard_name = GFS_diag_type_instance
long_name = instance of derived type GFS_diag_type
units = DDT
dimensions = ()
type = GFS_diag_type
intent = inout
optional = F
[Statein]
standard_name = GFS_statein_type_instance
long_name = instance of derived type GFS_statein_type
units = DDT
dimensions = ()
type = GFS_statein_type
intent = in
optional = F
[im]
standard_name = horizontal_loop_extent
long_name = horizontal loop extent
Expand Down Expand Up @@ -95,6 +111,67 @@
kind = kind_phys
intent = in
optional = F
[raddt]
standard_name = time_step_for_radiation
long_name = radiation time step
units = s
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[aerodp]
standard_name = atmosphere_optical_thickness_due_to_ambient_aerosol_particles
long_name = vertical integrated optical depth for various aerosol species
units = none
dimensions = (horizontal_dimension,number_of_species_for_aerosol_optical_depth)
type = real
kind = kind_phys
intent = in
optional = F
[cldsa]
standard_name = cloud_area_fraction_for_radiation
long_name = fraction of clouds for low, middle, high, total and BL
units = frac
dimensions = (horizontal_dimension,5)
type = real
kind = kind_phys
intent = in
optional = F
[mtopa]
standard_name = model_layer_number_at_cloud_top
long_name = vertical indices for low, middle and high cloud tops
units = index
dimensions = (horizontal_dimension,3)
type = integer
intent = in
optional = F
[mbota]
standard_name = model_layer_number_at_cloud_base
long_name = vertical indices for low, middle and high cloud bases
units = index
dimensions = (horizontal_dimension,3)
type = integer
intent = in
optional = F
[cld_frac]
standard_name = total_cloud_fraction
long_name = layer total cloud fraction
units = frac
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[cldtaulw]
standard_name = RRTMGP_cloud_optical_depth_layers_at_10mu_band
long_name = approx 10mu band layer cloud optical depth
units = none
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[hlwc]
standard_name = RRTMGP_lw_heating_rate_all_sky
long_name = RRTMGP longwave all sky heating rate
Expand Down
118 changes: 118 additions & 0 deletions physics/GFS_rrtmgp_lw_pre.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
!> \file GFS_rrtmgp_lw_pre.f90
!! This file contains
module GFS_rrtmgp_lw_pre
use physparam
use machine, only: &
kind_phys ! Working type
use GFS_typedefs, only: &
GFS_control_type, & !
GFS_sfcprop_type, & ! Surface fields
GFS_grid_type, & ! Grid and interpolation related data
GFS_statein_type, & !
GFS_radtend_type ! Radiation tendencies needed in physics
use module_radiation_surface, only: &
setemis ! Routine to compute surface-emissivity
use module_radiation_aerosols, only: &
NF_AESW, & ! Number of optical-fields in SW output (3=tau+g+omega)
NF_AELW, & ! Number of optical-fields in LW output (3=tau+g+omega)
setaer, & ! Routine to compute aerosol radiative properties (tau,g,omega)
NSPC1 ! Number of species for vertically integrated aerosol optical-depth
use mo_gas_optics_rrtmgp, only: &
ty_gas_optics_rrtmgp

public GFS_rrtmgp_lw_pre_run,GFS_rrtmgp_lw_pre_init,GFS_rrtmgp_lw_pre_finalize

contains

subroutine GFS_rrtmgp_lw_pre_init ()
end subroutine GFS_rrtmgp_lw_pre_init

!> \section arg_table_GFS_rrtmgp_lw_pre_run
!! \htmlinclude GFS_rrtmgp_lw_pre.html
!!
subroutine GFS_rrtmgp_lw_pre_run (Model, Grid, Sfcprop, Statein, ncol, p_lay, p_lev, &
tv_lay, relhum, tracer, lw_gas_props, Radtend, aerosolslw, aerodp, errmsg, errflg)

! Inputs
type(GFS_control_type), intent(in) :: &
Model ! Fortran DDT containing FV3-GFS model control parameters
type(GFS_grid_type), intent(in) :: &
Grid ! Fortran DDT containing FV3-GFS grid and interpolation related data
type(GFS_sfcprop_type), intent(in) :: &
Sfcprop ! Fortran DDT containing FV3-GFS surface fields
type(GFS_statein_type), intent(in) :: &
Statein ! Fortran DDT containing FV3-GFS prognostic state data in from dycore
integer, intent(in) :: &
ncol ! Number of horizontal grid points
real(kind_phys), dimension(ncol,Model%levs),intent(in) :: &
p_lay, & ! Layer pressure
tv_lay, & ! Layer virtual-temperature
relhum ! Layer relative-humidity
real(kind_phys), dimension(ncol, Model%levs, 2:Model%ntrac),intent(in) :: &
tracer
real(kind_phys), dimension(ncol,Model%levs+1),intent(in) :: &
p_lev ! Interface (level) pressure
type(ty_gas_optics_rrtmgp),intent(in) :: &
lw_gas_props ! RRTMGP DDT containing spectral information for LW calculation

! Outputs
type(GFS_radtend_type), intent(inout) :: &
Radtend ! Fortran DDT containing FV3-GFS radiation tendencies
real(kind_phys), dimension(ncol,Model%levs,lw_gas_props%get_nband(),NF_AELW), intent(out) ::&
aerosolslw ! Aerosol radiative properties in each SW band.
real(kind_phys), dimension(ncol,NSPC1), intent(inout) :: &
aerodp ! Vertical integrated optical depth for various aerosol species
character(len=*), intent(out) :: &
errmsg ! Error message
integer, intent(out) :: &
errflg ! Error flag

! Local
integer :: iSFC, iTOA
logical :: top_at_1
real(kind_phys), dimension(ncol, Model%levs, Model%rrtmgp_nBandsSW, NF_AESW) :: &
aerosolssw2
! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

if (.not. Model%lslwr) return

! #######################################################################################
! What is vertical ordering?
! #######################################################################################
top_at_1 = (Statein%prsi(1,1) .lt. Statein%prsi(1, Model%levs))
if (top_at_1) then
iSFC = Model%levs
iTOA = 1
else
iSFC = 1
iTOA = Model%levs
endif

! #######################################################################################
! Call module_radiation_surface::setemis(),to setup surface emissivity for LW radiation.
! #######################################################################################
call setemis (Grid%xlon, Grid%xlat, Sfcprop%slmsk, Sfcprop%snowd, Sfcprop%sncovr, &
Sfcprop%zorl, Sfcprop%tsfc,Sfcprop%tsfc, Sfcprop%hprim, NCOL, &
Radtend%semis)
do iBand=1,lw_gas_props%get_nband()
Radtend%sfc_emiss_byband(iBand,1:NCOL) = Radtend%semis(1:NCOL)
enddo

! #######################################################################################
! Call module_radiation_aerosols::setaer(),to setup aerosols property profile
! #######################################################################################
call setaer(p_lev, p_lay, Statein%prslk(1:NCOL,iSFC:iTOA), tv_lay, relhum, &
Sfcprop%slmsk, tracer, Grid%xlon, Grid%xlat, ncol, Model%levs, Model%levs+1, &
.false., Model%lslwr, aerosolssw2, aerosolslw, aerodp)


end subroutine GFS_rrtmgp_lw_pre_run

!> \section arg_table_GFS_rrtmgp_lw_pre_finalize Argument Table
!!
subroutine GFS_rrtmgp_lw_pre_finalize ()
end subroutine GFS_rrtmgp_lw_pre_finalize

end module GFS_rrtmgp_lw_pre
Loading

0 comments on commit 3958a87

Please sign in to comment.