Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-eaton committed Feb 1, 2024
1 parent fd8fa8e commit a3571bc
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 132 deletions.
5 changes: 5 additions & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,11 @@ elsif ($rad_pkg =~ m/rrtmg/) {
die "configure ERROR: radiation package: $rad_pkg is not compatible\n".
" with physics package $phys_pkg\n";
}

# RRTMGP not currently working with CARMA
if ($rad_pkg eq 'rrtmgp' and $carma_pkg ne 'none') {
die "configure ERROR: The CARMA microphysics package does not currently work with RRTMGP\n";
}
}

$cfg_ref->set('rad', $rad_pkg);
Expand Down
15 changes: 9 additions & 6 deletions cime_config/testdefs/testlist_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,13 @@
<option name="wallclock">00:10:00</option>
</options>
</test>
<test compset="QPC6" grid="ne5pg3_ne5pg3_mg37" name="ERP_D_Ln9" testmods="cam/outfrq9s_rrtmgp">
<test compset="QPC6" grid="ne3pg3_ne3pg3_mg37" name="ERP_D_Ln9" testmods="cam/outfrq9s_rrtmgp">
<machines>
<machine name="izumi" compiler="gnu" category="aux_cam"/>
</machines>
<options>
<option name="wallclock">00:10:00</option>
<option name="comment" >CAM6 aquaplanet w/ RRTMGP</option>
</options>
</test>
<test compset="QPRCEMIP" grid="ne30_ne30_mg17" name="ERP_Ln9_Vnuopc" testmods="cam/outfrq9s">
Expand Down Expand Up @@ -1795,11 +1796,11 @@
</test>
<test compset="FLTHIST" grid="ne30pg3_ne30pg3_mg17" name="ERP_D_Ln9" testmods="cam/outfrq9s_rrtmgp">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cam"/>
<machine name="derecho" compiler="intel" category="aux_cam"/>
</machines>
<options>
<option name="wallclock">00:30:00</option>
<option name="comment">CAM7 dev low top ~40 km</option>
<option name="comment">CAM7 dev low top ~40 km w/ RRTMGP</option>
</options>
</test>
<test compset="FMTHIST" grid="ne30pg3_ne30pg3_mg17" name="SMS_D_Ln9" testmods="cam/outfrq9s">
Expand All @@ -1813,11 +1814,11 @@
</test>
<test compset="FMTHIST" grid="ne30pg3_ne30pg3_mg17" name="SMS_D_Ln9" testmods="cam/outfrq9s_rrtmgp">
<machines>
<machine name="cheyenne" compiler="intel" category="prealpha"/>
<machine name="derecho" compiler="intel" category="prealpha"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment">CAM7 dev mid top ~80 km</option>
<option name="comment">CAM7 dev mid top ~80 km w/ RRTMGP</option>
</options>
</test>
<test compset="FMTHIST" grid="ne30pg3_ne30pg3_mg17" name="ERP_D_Ln9" testmods="cam/outfrq9s">
Expand Down Expand Up @@ -2765,10 +2766,11 @@
</test>
<test compset="FW2000climo" grid="ne30pg3_ne30pg3_mg17" name="SMS_Ln9" testmods="cam/outfrq9s_rrtmgp">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cam"/>
<machine name="derecho" compiler="intel" category="aux_cam"/>
</machines>
<options>
<option name="wallclock">00:40:00</option>
<option name="comment">WACCM w/ RRTMGP</option>
</options>
</test>
<test compset="FW2000climo" grid="ne30pg3_ne30pg3_mg17" name="SMS_D_Ln9_Vnuopc" testmods="cam/outfrq9s">
Expand Down Expand Up @@ -2865,6 +2867,7 @@
</machines>
<options>
<option name="wallclock">00:30:00</option>
<option name="comment">CAM6 PORT w/ RRTMGP</option>
</options>
</test>

Expand Down
34 changes: 25 additions & 9 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Purpose of changes (include the issue number and title text for each relevant Gi
#255 - Provide RRTMGP as a radiation parameterization
https://github.com/ESCOMP/CAM/issues/255

Miscellaneous:
. The 1850_cam5.xml use case file was added back to the source code to
facilitate running the F1850 compset with CAM5. That discussion is in
issue #393.


Describe any changes made to build system:
. '-rad' argument to configure accepts the values 'rrtmgp' and 'rrtmgp_gpu'
to build the RRTMGP code for CPUs or for GPUs.
Expand Down Expand Up @@ -48,11 +54,16 @@ cime_config/testdefs/testmods_dirs/cam/outfrq9s_rrtmgp/user_nl_clm
. for adding RRTMGP to tests

src/physics/cam/cloud_rad_props.F90
src/physics/cam/ebert_curry.F90
src/physics/cam/oldcloud.F90
src/physics/cam/slingo.F90
. these 4 files are shared cloud optics code moved here from src/physics/rrtmg/.
. remove unused code, cleanup unused vars
src/physics/cam/ebert_curry_ice_optics.F90
src/physics/cam/oldcloud_optics.F90
src/physics/cam/slingo_liq_optics.F90
. these 4 files are shared cloud optics code moved here from
src/physics/rrtmg/ with the following name changes:
- ebert_curry.F90 -> ebert_curry_ice_optics.F90
- oldcloud.F90 -> oldcloud_optics.F90
- slingo.F90 -> slingo_liq_optics.F90
. remove unused code, cleanup unused vars, improve endrun messages
. module names changed to match file names.

src/physics/rrtmgp/mcica_subcol_gen.F90
src/physics/rrtmgp/radconstants.F90
Expand Down Expand Up @@ -83,6 +94,7 @@ bld/configure
. '-rad rrtmgp_gpu' sets a flag used to add the filepaths for the GPU code
versions to the Filepath file. The '_gpu' suffix is removed before
setting the parameter value for 'rad' in the config_cache.xml file.
. check to disallow CARMA + RRTMGP

bld/namelist_files/namelist_defaults_cam.xml
. the aersol and cloud optics datasets for RRTMG are being reused for
Expand All @@ -93,13 +105,14 @@ bld/namelist_files/namelist_definition.xml
. add variables rrtmgp_coefs_lw_file and rrtmgp_coefs_sw_file to contain
filepaths for the RRTMGP coefficients files.

cime_config/testdefs/testlist_cam.xml (aux_cam)
cime_config/testdefs/testlist_cam.xml
. add aux_cam tests:
ERP_D_Ln9.ne30pg3_ne30pg3_mg17.FLTHIST.cheyenne_intel.cam-outfrq9s_rrtmgp
SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.cheyenne_intel.cam-outfrq9s_rrtmgp
SMS_D_Ln9.ne30pg3_ne30pg3_mg17.FMTHIST.cheyenne_intel.cam-outfrq9s_rrtmgp
ERP_D_Ln9.ne30pg3_ne30pg3_mg17.FLTHIST.derecho_intel.cam-outfrq9s_rrtmgp
SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp
ERP_D_Ln9.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_rrtmgp
SMS_Ld5.f09_f09_mg17.PC6.izumi_gnu.cam-cam6_port_f09_rrtmgp
. add prealpha test:
SMS_D_Ln9.ne30pg3_ne30pg3_mg17.FMTHIST.derecho_intel.cam-outfrq9s_rrtmgp

src/chemistry/utils/solar_data.F90
. add solar_htng_spctrl_scl to log file output
Expand Down Expand Up @@ -134,6 +147,9 @@ src/physics/camrt/radconstants.F90
src/physics/rrtmg/radconstants.F90
. parameters ot_length and nrh moved to phys_props

src/physics/rrtmg/radiation.F90
. ebert_curry -> ebert_curry_ice_optics

src/physics/simple/radconstants.F90
. parameters ot_length and nrh moved to phys_props
. add dummy interface for get_sw_spectral_boundaries
Expand Down
30 changes: 16 additions & 14 deletions src/physics/cam/cloud_rad_props.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ module cloud_rad_props
use constituents, only: cnst_get_ind
use radconstants, only: nswbands, nlwbands, idx_sw_diag
use rad_constituents, only: iceopticsfile, liqopticsfile
use oldcloud, only: oldcloud_init, oldcloud_lw, &
use oldcloud_optics, only: oldcloud_init, oldcloud_lw, &
old_liq_get_rad_props_lw, old_ice_get_rad_props_lw


use slingo, only: slingo_rad_props_init
use ebert_curry, only: ec_rad_props_init, scalefactor
use slingo_liq_optics, only: slingo_rad_props_init
use ebert_curry_ice_optics, only: ec_rad_props_init, scalefactor

use interpolate_data, only: interp_type, lininterp_init, lininterp, &
extrap_method_bndry, lininterp_finish
Expand Down Expand Up @@ -101,6 +100,7 @@ subroutine cloud_rad_props_init()
integer :: d_id, ext_sw_ice_id, ssa_sw_ice_id, asm_sw_ice_id, abs_lw_ice_id

integer :: err
character(len=*), parameter :: sub = 'cloud_rad_props_init'

liquidfile = liqopticsfile
icefile = iceopticsfile
Expand Down Expand Up @@ -131,11 +131,11 @@ subroutine cloud_rad_props_init()

call handle_ncerr(nf90_inq_dimid( ncid, 'lw_band', dimid), 'getting lw_band dim')
call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nlwbands), 'getting n lw bands')
if (f_nlwbands /= nlwbands) call endrun('number of lw bands does not match')
if (f_nlwbands /= nlwbands) call endrun(sub//': number of lw bands does not match')

call handle_ncerr(nf90_inq_dimid( ncid, 'sw_band', dimid), 'getting sw_band_dim')
call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nswbands), 'getting n sw bands')
if (f_nswbands /= nswbands) call endrun('number of sw bands does not match')
if (f_nswbands /= nswbands) call endrun(sub//': number of sw bands does not match')

call handle_ncerr(nf90_inq_dimid( ncid, 'mu', mudimid), 'getting mu dim')
call handle_ncerr(nf90_inquire_dimension( ncid, mudimid, len=nmu), 'getting n mu samples')
Expand Down Expand Up @@ -210,12 +210,12 @@ subroutine cloud_rad_props_init()
call handle_ncerr(nf90_inq_dimid( ncid, 'lw_band', dimid), 'getting lw_band dim')
call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nlwbands), 'getting n lw bands')
if (f_nlwbands /= nlwbands) then
call endrun('number of lw bands does not match')
call endrun(sub//': number of lw bands does not match')
end if
call handle_ncerr(nf90_inq_dimid( ncid, 'sw_band', dimid), 'getting sw_band_dim')
call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nswbands), 'getting n sw bands')
if (f_nswbands /= nswbands) then
call endrun('number of sw bands does not match')
call endrun(sub//': number of sw bands does not match')
end if
call handle_ncerr(nf90_inq_dimid( ncid, 'd_eff', d_dimid), 'getting deff dim')
call handle_ncerr(nf90_inquire_dimension( ncid, d_dimid, len=n_g_d), 'getting n deff samples')
Expand Down Expand Up @@ -347,7 +347,7 @@ subroutine get_ice_optics_sw(state, pbuf, tau, tau_w, tau_w_g, tau_w_f)

real(r8),intent(out) :: tau (nswbands,pcols,pver) ! extinction optical depth
real(r8),intent(out) :: tau_w (nswbands,pcols,pver) ! single scattering albedo * tau
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! assymetry parameter * tau * w
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! asymetry parameter * tau * w
real(r8),intent(out) :: tau_w_f(nswbands,pcols,pver) ! forward scattered fraction * tau * w

real(r8), pointer :: iciwpth(:,:), dei(:,:)
Expand All @@ -370,7 +370,7 @@ subroutine get_snow_optics_sw(state, pbuf, tau, tau_w, tau_w_g, tau_w_f)

real(r8),intent(out) :: tau (nswbands,pcols,pver) ! extinction optical depth
real(r8),intent(out) :: tau_w (nswbands,pcols,pver) ! single scattering albedo * tau
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! assymetry parameter * tau * w
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! asymetry parameter * tau * w
real(r8),intent(out) :: tau_w_f(nswbands,pcols,pver) ! forward scattered fraction * tau * w

real(r8), pointer :: icswpth(:,:), des(:,:)
Expand All @@ -393,12 +393,13 @@ subroutine get_grau_optics_sw(state, pbuf, tau, tau_w, tau_w_g, tau_w_f)

real(r8),intent(out) :: tau (nswbands,pcols,pver) ! extinction optical depth
real(r8),intent(out) :: tau_w (nswbands,pcols,pver) ! single scattering albedo * tau
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! assymetry parameter * tau * w
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! asymetry parameter * tau * w
real(r8),intent(out) :: tau_w_f(nswbands,pcols,pver) ! forward scattered fraction * tau * w

real(r8), pointer :: icgrauwpth(:,:), degrau(:,:)

integer :: i,k
character(len=*), parameter :: sub = 'get_grau_optics_sw'

! This does the same thing as get_ice_optics_sw, except with a different
! water path and effective diameter.
Expand All @@ -419,7 +420,7 @@ subroutine get_grau_optics_sw(state, pbuf, tau, tau_w, tau_w_g, tau_w_f)
enddo

else
call endrun('ERROR: Get_grau_optics_sw called when graupel properties not supported')
call endrun(sub//': ERROR: Get_grau_optics_sw called when graupel properties not supported')
end if

end subroutine get_grau_optics_sw
Expand Down Expand Up @@ -520,6 +521,7 @@ subroutine grau_cloud_get_rad_props_lw(state, pbuf, abs_od)
real(r8), intent(out) :: abs_od(nlwbands,pcols,pver)

real(r8), pointer :: icgrauwpth(:,:), degrau(:,:)
character(len=*), parameter :: sub = 'grau_cloud_get_rad_props_lw'

! This does the same thing as ice_cloud_get_rad_props_lw, except with a
! different water path and effective diameter.
Expand All @@ -529,7 +531,7 @@ subroutine grau_cloud_get_rad_props_lw(state, pbuf, abs_od)

call interpolate_ice_optics_lw(state%ncol,icgrauwpth, degrau, abs_od)
else
call endrun('ERROR: Grau_cloud_get_rad_props_lw called when graupel &
call endrun(sub//': ERROR: Grau_cloud_get_rad_props_lw called when graupel &
&properties not supported')
end if

Expand Down Expand Up @@ -566,7 +568,7 @@ subroutine interpolate_ice_optics_sw(ncol, iciwpth, dei, tau, tau_w, &

real(r8),intent(out) :: tau (nswbands,pcols,pver) ! extinction optical depth
real(r8),intent(out) :: tau_w (nswbands,pcols,pver) ! single scattering albedo * tau
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! assymetry parameter * tau * w
real(r8),intent(out) :: tau_w_g(nswbands,pcols,pver) ! asymetry parameter * tau * w
real(r8),intent(out) :: tau_w_f(nswbands,pcols,pver) ! forward scattered fraction * tau * w

type(interp_type) :: dei_wgts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ebert_curry
module ebert_curry_ice_optics


use shr_kind_mod, only: r8 => shr_kind_r8
Expand Down Expand Up @@ -261,4 +261,4 @@ end subroutine ec_ice_get_rad_props_lw

!==============================================================================

end module ebert_curry
end module ebert_curry_ice_optics
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module oldcloud
module oldcloud_optics

!------------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------------
Expand All @@ -10,7 +10,7 @@ module oldcloud
use constituents, only: cnst_get_ind
use physconst, only: gravit
use radconstants, only: nlwbands
use ebert_curry, only: scalefactor
use ebert_curry_ice_optics, only: scalefactor

use cam_abortutils, only: endrun

Expand Down Expand Up @@ -79,8 +79,6 @@ subroutine oldcloud_init()
call cnst_get_ind('CLDICE', ixcldice)
call cnst_get_ind('CLDLIQ', ixcldliq)

return

end subroutine oldcloud_init

!==============================================================================
Expand All @@ -106,10 +104,8 @@ subroutine oldcloud_lw(state,pbuf,cld_abs_od,oldwp)
integer :: ncol, itim_old, lwband, i, k, lchnk
real(r8), pointer, dimension(:,:) :: iclwpth, iciwpth

real(r8) :: kabs, kabsi
real(r8) kabsl ! longwave liquid absorption coeff (m**2/g)
parameter (kabsl = 0.090361_r8)

real(r8) :: kabs, kabsi
real(r8), parameter :: kabsl = 0.090361_r8 ! longwave liquid absorption coeff (m**2/g)


ncol = state%ncol
Expand Down Expand Up @@ -152,7 +148,6 @@ subroutine oldcloud_lw(state,pbuf,cld_abs_od,oldwp)
!in range of 13 > rei > 130 micron (Ebert and Curry 92)
kabsi = 0.005_r8 + 1._r8/min(max(13._r8,scalefactor*rei(i,k)),130._r8)
kabs = kabsl*(1._r8-ficemr(i,k)) + kabsi*ficemr(i,k)
!emis(i,k) = 1._r8 - exp(-1.66_r8*kabs*clwp(i,k))
cldtau(i,k) = kabs*cwp(i,k)
end do
end do
Expand Down Expand Up @@ -185,8 +180,7 @@ subroutine old_liq_get_rad_props_lw(state, pbuf, abs_od, oldliqwp)
integer :: ncol, itim_old, lwband, i, k, lchnk

real(r8) :: kabs, kabsi
real(r8) kabsl ! longwave liquid absorption coeff (m**2/g)
parameter (kabsl = 0.090361_r8)
real(r8), parameter :: kabsl = 0.090361_r8 ! longwave liquid absorption coeff (m**2/g)

real(r8), pointer, dimension(:,:) :: iclwpth, iciwpth

Expand Down Expand Up @@ -234,11 +228,10 @@ subroutine old_liq_get_rad_props_lw(state, pbuf, abs_od, oldliqwp)
!in range of 13 > rei > 130 micron (Ebert and Curry 92)
kabsi = 0.005_r8 + 1._r8/min(max(13._r8,scalefactor*rei(i,k)),130._r8)
kabs = kabsl*(1._r8-ficemr(i,k)) ! + kabsi*ficemr(i,k)
!emis(i,k) = 1._r8 - exp(-1.66_r8*kabs*clwp(i,k))
cldtau(i,k) = kabs*cwp(i,k)
end do
end do
!

do lwband = 1,nlwbands
abs_od(lwband,1:ncol,1:pver)=cldtau(1:ncol,1:pver)
enddo
Expand Down Expand Up @@ -267,10 +260,8 @@ subroutine old_ice_get_rad_props_lw(state, pbuf, abs_od, oldicewp)
real(r8), pointer, dimension(:,:) :: rei
integer :: ncol, itim_old, lwband, i, k, lchnk

real(r8) :: kabs, kabsi

real(r8) kabsl ! longwave liquid absorption coeff (m**2/g)
parameter (kabsl = 0.090361_r8)
real(r8) :: kabs, kabsi
real(r8), parameter :: kabsl = 0.090361_r8 ! longwave liquid absorption coeff (m**2/g)

real(r8), pointer, dimension(:,:) :: iclwpth, iciwpth

Expand Down Expand Up @@ -318,11 +309,10 @@ subroutine old_ice_get_rad_props_lw(state, pbuf, abs_od, oldicewp)
!in range of 13 > rei > 130 micron (Ebert and Curry 92)
kabsi = 0.005_r8 + 1._r8/min(max(13._r8,scalefactor*rei(i,k)),130._r8)
kabs = kabsi*ficemr(i,k) ! kabsl*(1._r8-ficemr(i,k)) + kabsi*ficemr(i,k)
!emis(i,k) = 1._r8 - exp(-1.66_r8*kabs*clwp(i,k))
cldtau(i,k) = kabs*cwp(i,k)
end do
end do
!

do lwband = 1,nlwbands
abs_od(lwband,1:ncol,1:pver)=cldtau(1:ncol,1:pver)
enddo
Expand All @@ -331,4 +321,4 @@ end subroutine old_ice_get_rad_props_lw

!==============================================================================

end module oldcloud
end module oldcloud_optics
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module slingo
module slingo_liq_optics

!------------------------------------------------------------------------------------------------
! Implements Slingo Optics for MG/RRTMG for liquid clouds and
Expand Down Expand Up @@ -281,4 +281,4 @@ subroutine slingo_liq_get_rad_props_lw(state, pbuf, abs_od, oldliqwp)

end subroutine slingo_liq_get_rad_props_lw

end module slingo
end module slingo_liq_optics
Loading

0 comments on commit a3571bc

Please sign in to comment.