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

Feature RRTMGP documentation #8

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
220 changes: 131 additions & 89 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmgp_cloud_mp.F90

Large diffs are not rendered by default.

33 changes: 15 additions & 18 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmgp_cloud_overlap.F90
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
! ########################################################################################
!> \file GFS_rrtmgp_cloud_overlap.F90
!!
!> \defgroup GFS_rrtmgp_cloud_overlap GFS_rrtmgp_cloud_overlap.F90
!!
!! \brief This module contains EMC's interface to the different assumptions of vertical cloud
!! structuce, cloud overlap, used by McICA for cloud sampling in the RRTMGP longwave
!! structuce (i.e. cloud overlap) used by McICA for cloud sampling in the RRTMGP longwave
!! and shortwave schemes.
!!
! ########################################################################################
module GFS_rrtmgp_cloud_overlap
use machine, only: kind_phys
use radiation_tools, only: check_error_msg
Expand All @@ -14,21 +16,23 @@ module GFS_rrtmgp_cloud_overlap
public GFS_rrtmgp_cloud_overlap_run

contains

! ########################################################################################
!>\defgroup gfs_rrtmgp_cloud_overlap_mod GFS RRTMGP Cloud Overlap Module
!! \section arg_table_GFS_rrtmgp_cloud_overlap_run
!! \htmlinclude GFS_rrtmgp_cloud_overlap_run.html
!!
!> \ingroup GFS_rrtmgp_cloud_overlap
!!
!! This is identical (shares common-code) to RRTMG. The motivation for RRTMGP to have
!! its own scheme is both organizational and philosophical*.
!! \brief This shares common-code with the RRTMG radiations scheme. The motivation for RRTMGP
!! to have its own scheme is both organizational and philosophical*.
!!
!! *The number of "clouds" being produced by the model physics is often greater than one.
!! rte-rrtmgp can accomodate multiple cloud-types. This module preservers this enhancement
!! in the EMCs coupling to the RRTMGP scheme.
!!
!! \section GFS_rrtmgp_cloud_overlap_run
!> @{
! ########################################################################################
subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad, &
julian, lat, p_lev, p_lay, tv_lay, deltaZc, con_pi, con_g, con_rd, con_epsq, &
dcorr_con, idcor, iovr, iovr_dcorr, iovr_exp, iovr_exprand, idcor_con, &
Expand Down Expand Up @@ -97,9 +101,7 @@ subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad,

if (.not. (doSWrad .or. doLWrad)) return

!
! Cloud decorrelation length
!
!> Compute cloud decorrelation length.
de_lgth(:) = 0.
if (idcor == idcor_hogan) then
call cmp_dcorr_lgth(nCol, lat, con_pi, de_lgth)
Expand All @@ -111,18 +113,14 @@ subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad,
de_lgth(:) = dcorr_con
endif

!
! Cloud overlap parameter
!
!> Compute cloud overlap parameter.
if (iovr == iovr_dcorr .or. iovr == iovr_exp .or. iovr == iovr_exprand) then
call get_alpha_exper(nCol, nLev, iovr, iovr_exprand, deltaZc*0.001, de_lgth, cld_frac, cloud_overlap_param)
else
cloud_overlap_param(:,:) = 0.
endif

!
! Convective cloud overlap parameter
!
!> Compute convective cloud overlap parameter (Only is treating independently from macro clouds)
if (imfdeepcnv == imfdeepcnv_samf .or. imfdeepcnv == imfdeepcnv_gf) then
if (iovr_convcld == iovr_dcorr .or. iovr_convcld == iovr_exp .or. iovr_convcld == iovr_exprand) then
call get_alpha_exper(nCol, nLev, iovr_convcld, iovr_exprand, deltaZc*0.001, de_lgth, cld_cnv_frac, cnv_cloud_overlap_param)
Expand All @@ -131,10 +129,9 @@ subroutine GFS_rrtmgp_cloud_overlap_run(nCol, nLev, yearlen, doSWrad, doLWrad,
endif
endif

!
! Compute precipitation overlap parameter (Hack. Using same as cloud for now)
!
precip_overlap_param = cloud_overlap_param

! Compute precipitation overlap parameter. (Using same as cloud for now, but highlights distinction)
precip_overlap_param = cloud_overlap_param

end subroutine GFS_rrtmgp_cloud_overlap_run
!> @}
end module GFS_rrtmgp_cloud_overlap
45 changes: 29 additions & 16 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmgp_post.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
! ##########################################################################################
!> \file GFS_rrtmgp_post.F90
!! RRTMGP post-processing routine.
!!
!> \defgroup GFS_rrtmgp_post GFS_rrtmgp_post.F90
!!
!! \brief RRTMGP post-processing routine.
!!
! ##########################################################################################
module GFS_rrtmgp_post
use machine, only: kind_phys
use module_radlw_parameters, only: topflw_type, sfcflw_type
Expand All @@ -12,16 +17,23 @@ module GFS_rrtmgp_post
public GFS_rrtmgp_post_run

contains

!> \section arg_table_GFS_rrtmgp_post_run Argument Table
! ##########################################################################################
!> \section arg_table_GFS_rrtmgp_post_run
!! \htmlinclude GFS_rrtmgp_post.html
!!The all-sky radiation tendency is computed, the clear-sky tendency is computed
!!
!! \ingroup GFS_rrtmgp_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
!> @{
! ##########################################################################################
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, &
Expand Down Expand Up @@ -186,12 +198,12 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
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
!> 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
Expand Down Expand Up @@ -313,12 +325,12 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
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
!> 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
Expand Down Expand Up @@ -381,4 +393,5 @@ subroutine GFS_rrtmgp_post_run (nCol, nLev, nDay, iSFC, iTOA, idxday, doLWrad, d
endif

end subroutine GFS_rrtmgp_post_run
!> @}
end module GFS_rrtmgp_post
149 changes: 85 additions & 64 deletions physics/Interstitials/UFS_SCM_NEPTUNE/GFS_rrtmgp_pre.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
! ###########################################################################################
!> \file GFS_rrtmgp_pre.F90
!!
!> \defgroup GFS_rrtmgp_pre GFS_rrtmgp_pre.F90
!!
!! \brief This module contains code to prepare model fields for use by the RRTMGP
!! radiation scheme.

! ###########################################################################################
module GFS_rrtmgp_pre
use machine, only: kind_phys
use funcphys, only: fpvs
Expand Down Expand Up @@ -31,23 +35,31 @@ module GFS_rrtmgp_pre
public GFS_rrtmgp_pre_run,GFS_rrtmgp_pre_init
contains

!> \section arg_table_GFS_rrtmgp_pre_init Argument Table
! ###########################################################################################
!! \section arg_table_GFS_rrtmgp_pre_init
!! \htmlinclude GFS_rrtmgp_pre_init.html
!! Actuve gas-names are read from namelist. Set to interstitial%active_gases.
!!
!> \ingroup GFS_rrtmgp_pre
!!
!! \brief Active gas-names are read from namelist. Set to interstitial%active_gases.
!!
!! \section GFS_rrtmgp_pre_init
!> @{
! ###########################################################################################
subroutine GFS_rrtmgp_pre_init(nGases, active_gases, active_gases_array, errmsg, errflg)
! Inputs
integer, intent(in) :: &
nGases !< Number of active gases in RRTMGP
nGases ! Number of active gases in RRTMGP
character(len=*), intent(in) :: &
active_gases !< List of active gases from namelist
active_gases ! List of active gases from namelist
character(len=*), dimension(:), intent(out) :: &
active_gases_array !< List of active gases from namelist as array
active_gases_array ! List of active gases from namelist as array

! Outputs
character(len=*), intent(out) :: &
errmsg !< Error message
errmsg ! Error message
integer, intent(out) :: &
errflg !< Error flag
errflg ! Error flag

! Local variables
character(len=1) :: tempstr
Expand Down Expand Up @@ -92,10 +104,19 @@ subroutine GFS_rrtmgp_pre_init(nGases, active_gases, active_gases_array, errmsg,
enddo

end subroutine GFS_rrtmgp_pre_init

!> \section arg_table_GFS_rrtmgp_pre_run Argument Table
!> @}

! ###########################################################################################
!> \section arg_table_GFS_rrtmgp_pre_run
!! \htmlinclude GFS_rrtmgp_pre_run.html
!! Sanitize inputs for use in RRTMGP.
!!
!> \ingroup GFS_rrtmgp_pre
!!
!! \brief Sanitize inputs for use in RRTMGP.
!!
!! \section GFS_rrtmgp_pre_run
!> @{
! ###########################################################################################
subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhlwr, &
xlat, xlon, prsl, tgrs, prslk, prsi, qgrs, tsfc, coslat, sinlat, con_g, con_rd, &
con_eps, con_epsm1, con_fvirt, con_epsqs, solhr, raddt, p_lay, t_lay, p_lev, t_lev, &
Expand All @@ -107,79 +128,79 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl

! Inputs
integer, intent(in) :: &
me, & !< MPI rank
nCol, & !< Number of horizontal grid points
nLev, & !< Number of vertical layers
ico2, & !< Flag for co2 radiation scheme
i_o3 !< Index into tracer array for ozone
me, & ! MPI rank
nCol, & ! Number of horizontal grid points
nLev, & ! Number of vertical layers
ico2, & ! Flag for co2 radiation scheme
i_o3 ! Index into tracer array for ozone
type(ty_ozphys),intent(in) :: &
ozphys
logical, intent(in) :: &
doSWrad, & !< Call SW radiation?
doLWrad !< Call LW radiation
doSWrad, & ! Call SW radiation?
doLWrad ! Call LW radiation
real(kind_phys), intent(in) :: &
fhswr, & !< Frequency of SW radiation call.
fhlwr !< Frequency of LW radiation call.
fhswr, & ! Frequency of SW radiation call.
fhlwr ! Frequency of LW radiation call.
real(kind_phys), intent(in) :: &
con_g, & !< Physical constant: gravitational constant
con_rd, & !< Physical constant: gas-constant for dry air
con_eps, & !< Physical constant: Epsilon (Rd/Rv)
con_epsm1, & !< Physical constant: Epsilon (Rd/Rv) minus one
con_fvirt, & !< Physical constant: Inverse of epsilon minus one
con_epsqs, & !< Physical constant: Minimum saturation mixing-ratio (kg/kg)
con_pi, & !< Physical constant: Pi
solhr !< Time in hours after 00z at the current timestep
con_g, & ! Physical constant: gravitational constant
con_rd, & ! Physical constant: gas-constant for dry air
con_eps, & ! Physical constant: Epsilon (Rd/Rv)
con_epsm1, & ! Physical constant: Epsilon (Rd/Rv) minus one
con_fvirt, & ! Physical constant: Inverse of epsilon minus one
con_epsqs, & ! Physical constant: Minimum saturation mixing-ratio (kg/kg)
con_pi, & ! Physical constant: Pi
solhr ! Time in hours after 00z at the current timestep
real(kind_phys), dimension(:), intent(in) :: &
xlon, & !< Longitude
xlat, & !< Latitude
tsfc, & !< Surface skin temperature (K)
coslat, & !< Cosine(latitude)
sinlat, & !< Sine(latitude)
xlon, & ! Longitude
xlat, & ! Latitude
tsfc, & ! Surface skin temperature (K)
coslat, & ! Cosine(latitude)
sinlat, & ! Sine(latitude)
semis
real(kind_phys), dimension(:,:), intent(in) :: &
prsl, & !< Pressure at model-layer centers (Pa)
tgrs, & !< Temperature at model-layer centers (K)
prslk, & !< Exner function at model layer centers (1)
prsi !< Pressure at model-interfaces (Pa)
prsl, & ! Pressure at model-layer centers (Pa)
tgrs, & ! Temperature at model-layer centers (K)
prslk, & ! Exner function at model layer centers (1)
prsi ! Pressure at model-interfaces (Pa)
real(kind_phys), dimension(:,:,:), intent(in) :: &
qgrs !< Tracer concentrations (kg/kg)
qgrs ! Tracer concentrations (kg/kg)
character(len=*), dimension(:), intent(in) :: &
active_gases_array !< List of active gases from namelist as array
active_gases_array ! List of active gases from namelist as array

! Outputs
character(len=*), intent(out) :: &
errmsg !< Error message
errmsg ! Error message
integer, intent(out) :: &
errflg, & !< Error flag
errflg, & ! Error flag
nDay
integer, intent(inout) :: &
iSFC, & !< Vertical index for surface
iTOA !< Vertical index for TOA
iSFC, & ! Vertical index for surface
iTOA ! Vertical index for TOA
logical, intent(inout) :: &
top_at_1 !< Vertical ordering flag
top_at_1 ! Vertical ordering flag
real(kind_phys), intent(inout) :: &
raddt !< Radiation time-step
raddt ! Radiation time-step
real(kind_phys), dimension(:), intent(inout) :: &
tsfg, & !< Ground temperature
tsfa, & !< Skin temperature
tsfc_radtime, & !< Surface temperature at radiation timestep
coszen, & !< Cosine of SZA
coszdg !< Cosine of SZA, daytime
tsfg, & ! Ground temperature
tsfa, & ! Skin temperature
tsfc_radtime, & ! Surface temperature at radiation timestep
coszen, & ! Cosine of SZA
coszdg ! Cosine of SZA, daytime
integer, dimension(:), intent(inout) :: &
idxday !< Indices for daylit points
idxday ! Indices for daylit points
real(kind_phys), dimension(:,:), intent(inout) :: &
p_lay, & !< Pressure at model-layer
t_lay, & !< Temperature at model layer
q_lay, & !< Water-vapor mixing ratio (kg/kg)
tv_lay, & !< Virtual temperature at model-layers
relhum, & !< Relative-humidity at model-layers
qs_lay, & !< Saturation vapor pressure at model-layers
deltaZ, & !< Layer thickness (m)
deltaZc, & !< Layer thickness (m) (between layer centers)
deltaP, & !< Layer thickness (Pa)
p_lev, & !< Pressure at model-interface
sfc_emiss_byband, & !<
t_lev, & !< Temperature at model-interface
p_lay, & ! Pressure at model-layer
t_lay, & ! Temperature at model layer
q_lay, & ! Water-vapor mixing ratio (kg/kg)
tv_lay, & ! Virtual temperature at model-layers
relhum, & ! Relative-humidity at model-layers
qs_lay, & ! Saturation vapor pressure at model-layers
deltaZ, & ! Layer thickness (m)
deltaZc, & ! Layer thickness (m) (between layer centers)
deltaP, & ! Layer thickness (Pa)
p_lev, & ! Pressure at model-interface
sfc_emiss_byband, & !
t_lev, & ! Temperature at model-interface
vmr_o2, vmr_h2o, vmr_o3, vmr_ch4, vmr_n2o, vmr_co2

! Local variables
Expand Down Expand Up @@ -396,5 +417,5 @@ subroutine GFS_rrtmgp_pre_run(me, nCol, nLev, i_o3, doSWrad, doLWrad, fhswr, fhl
enddo

end subroutine GFS_rrtmgp_pre_run
!> @}
end module GFS_rrtmgp_pre
Loading