Skip to content

Commit

Permalink
Merge pull request #1084 from brian-eaton/cosp-cwat2
Browse files Browse the repository at this point in the history
cam6_4_032: Use same cloud water for radiation and COSP.
  • Loading branch information
peverwhee committed Sep 10, 2024
2 parents 9f0cb73 + 6b00a9e commit 98c35fc
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 79 deletions.
89 changes: 89 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,94 @@
===============================================================

Tag name: cam6_4_032
Originator(s): eaton
Date:
One-line Summary: Use same cloud water for radiation and COSP.
Github PR URL: https://github.com/ESCOMP/CAM/pull/1084

Purpose of changes (include the issue number and title text for each relevant GitHub issue):

Issue #1027 - Radiatively active cloud water missing from COSP.

The all-cloud liquid and ice mixing ratios calculated in the conv_water module are
used by the radiation code. Use these same quantities in the COSP code by
making them accessable via the physics buffer.

resolves #1027

Describe any changes made to build system: none

Describe any changes made to the namelist: none

List any changes to the defaults for the boundary datasets: none

Describe any substantial timing or memory changes: none

Code reviewed by: peverwhee

List all files eliminated: none

List all files added and what they do: none

List all existing files that have been modified, and describe the changes:

src/control/cam_snapshot_common.F90
. remove pbuf fields DP_CLDLIQ, DP_CLDICE, SH_CLDLIQ1, SH_CLDICE1

src/physics/cam/conv_water.F90
. add GB_TOTCLDLIQMR, GB_TOTCLDICEMR to pbuf
. remove SH_CLDLIQ1, SH_CLDICE1 from pbuf
. conv_water_4rad
- remove dummy args totg_liq and totg_ice and replace assignment to those
args by assignment to the pbuf variables GB_TOTCLDLIQMR and
GB_TOTCLDICEMR

src/physics/cam/cloud_diagnostics.F90
. access the pbuf fields GB_TOTCLDLIQMR and GB_TOTCLDICEMR which are set by
the calls to conv_water_4rad

src/physics/cam/cospsimulator_intr.F90
. replace access of pbuf fields DP_CLDLIQ, DP_CLDICE, SH_CLDLIQ1, and
SH_CLDICE1, by GB_TOTCLDLIQMR and GB_TOTCLDICEMR
. assign the total cloud mixing ratios to the arguments for the large scale
values, and set the convective cloud inputs to zero.

src/physics/cam/zm_conv_intr.F90
. remove pbuf fields DP_CLDLIQ and DP_CLDICE which were set to 0. and being
used as if they had real data by COSP.

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:

ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL)
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856

SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: PEND)
- pre-existing failure -- need fix in CLM external

SMS_D_Ln9_P1280x1.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: PASS)
- test failed with error in ESMF on first run, but passed when I reran the tests
- unclear when/why exactly this test began to pass again


izumi/nag/aux_cam:
FAIL DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae
- pre-existing failure - issue #670

izumi/gnu/aux_cam: All BFB

CAM tag used for the baseline comparison tests if different than previous
tag:

Summarize any changes to answers: BFB. Only COSP diagnostic fields have
differences.

===============================================================

Tag name: cam6_4_031
Originator(s): jedwards, eaton
Date: Sept 9, 2024
Expand Down
28 changes: 12 additions & 16 deletions src/control/cam_snapshot_common.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module cam_snapshot_common


! This is the number of pbuf fields in the CAM code that are declared with the fieldname as opposed to being data driven.
integer, parameter :: npbuf_all = 314
integer, parameter :: npbuf_all = 310

type snapshot_type
character(len=40) :: ddt_string
Expand Down Expand Up @@ -1322,14 +1322,12 @@ subroutine fill_pbuf_info(pbuf_info, pbuf, const_cname)
'DLFZM ','kg/kg/s ',&
'DNIFZM ','1/kg/s ',&
'DNLFZM ','1/kg/s ',&
'DP_CLDICE ','unset ',&
'DP_CLDLIQ ','unset ',&
'DP_FLXPRC ','unset ',&
'DP_FLXSNW ','unset ' /), (/2,100/))
'DP_FLXSNW ','unset ',&
'DP_FRAC ','unset ',&
'dragblj ','1/s ' /), (/2,100/))

pbuf_all(1:2,101:200) = reshape ( (/ &
'DP_FRAC ','unset ',&
'dragblj ','1/s ',&
'DRYMASS ','unset ',&
'DRYRAD ','unset ',&
'DRYVOL ','unset ',&
Expand Down Expand Up @@ -1427,11 +1425,11 @@ subroutine fill_pbuf_info(pbuf_info, pbuf, const_cname)
'QRL ','K/s ',&
'qrlin ','unset ',&
'QRS ','K/s ',&
'qrsin ','unset ' /), (/2,100/))
'qrsin ','unset ',&
'QSATFAC ','- ',&
'QSNOW ','kg/kg ' /), (/2,100/))

pbuf_all(1:2,201:300) = reshape ( (/ &
'QSATFAC ','- ',&
'QSNOW ','kg/kg ',&
'QTeAur ','unset ',&
'qti_flx ','unset ',&
'qtl_flx ','unset ',&
Expand Down Expand Up @@ -1459,9 +1457,7 @@ subroutine fill_pbuf_info(pbuf_info, pbuf, const_cname)
'SD ','unset ',&
'SGH30 ','unset ',&
'SGH ','unset ',&
'SH_CLDICE1 ','unset ',&
'SH_CLDICE ','unset ',&
'SH_CLDLIQ1 ','unset ',&
'SH_CLDLIQ ','unset ',&
'SH_E_ED_RATIO ','unset ',&
'SHFLX ','W/m2 ',&
Expand Down Expand Up @@ -1529,13 +1525,13 @@ subroutine fill_pbuf_info(pbuf_info, pbuf, const_cname)
'wprtp_mc_zt ','unset ',&
'WPRTP_nadv ','unset ',&
'wpthlp_mc_zt ','unset ',&
'WPTHLP_nadv ','unset ' /), (/2,100/))

pbuf_all(1:2,301:npbuf_all) = reshape ( (/ &
'WPTHLP_nadv ','unset ',&
'WPTHVP ','unset ',&
'WSEDL ','unset ',&
'wstarPBL ','unset ',&
'ZM_DP ','unset ',&
'ZM_DP ','unset ' /), (/2,100/))

pbuf_all(1:2,301:npbuf_all) = reshape ( (/ &
'ZM_DSUBCLD ','unset ',&
'ZM_DU ','unset ',&
'ZM_ED ','unset ',&
Expand All @@ -1545,7 +1541,7 @@ subroutine fill_pbuf_info(pbuf_info, pbuf, const_cname)
'ZM_MAXG ','unset ',&
'ZM_MD ','unset ',&
'ZM_MU ','unset ',&
'ZTODT ','unset ' /), (/2,14/))
'ZTODT ','unset ' /), (/2,10/))

! Fields which are added with pbuf_add_field calls, but are data driven. These are not
! included in the above list. This means that these fields will not have proper units
Expand Down
23 changes: 18 additions & 5 deletions src/physics/cam/cloud_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module cloud_diagnostics
integer :: cldtau_idx = -1
integer :: nmxrgn_idx = -1
integer :: pmxrgn_idx = -1
integer :: gb_totcldliqmr_idx = -1
integer :: gb_totcldicemr_idx = -1

! Index fields for precipitation efficiency.
integer :: acpr_idx, acgcme_idx, acnum_idx
Expand Down Expand Up @@ -103,6 +105,10 @@ subroutine cloud_diagnostics_init(pbuf2d)
!-----------------------------------------------------------------------

cld_idx = pbuf_get_index('CLD')
! grid box total cloud liquid water mixing ratio (kg/kg)
gb_totcldliqmr_idx = pbuf_get_index('GB_TOTCLDLIQMR')
! grid box total cloud ice water mixing ratio (kg/kg)
gb_totcldicemr_idx = pbuf_get_index('GB_TOTCLDICEMR')

call phys_getopts(use_spcam_out=use_spcam)

Expand Down Expand Up @@ -254,6 +260,9 @@ subroutine cloud_diagnostics_calc(state, pbuf)
integer, pointer :: nmxrgn(:) ! Number of maximally overlapped regions
real(r8), pointer :: pmxrgn(:,:) ! Maximum values of pressure for each

real(r8), pointer :: totg_ice(:,:) ! grid box total cloud ice mixing ratio
real(r8), pointer :: totg_liq(:,:) ! grid box total cloud liquid mixing ratio

integer :: itim_old

real(r8) :: cwp (pcols,pver) ! in-cloud cloud (total) water path
Expand Down Expand Up @@ -306,6 +315,9 @@ subroutine cloud_diagnostics_calc(state, pbuf)
itim_old = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )

call pbuf_get_field(pbuf, gb_totcldicemr_idx, totg_ice)
call pbuf_get_field(pbuf, gb_totcldliqmr_idx, totg_liq)

if(two_mom_clouds)then

call pbuf_get_field(pbuf, iclwp_idx, iclwp )
Expand Down Expand Up @@ -371,10 +383,9 @@ subroutine cloud_diagnostics_calc(state, pbuf)
! iclwp and iciwp to pass to the radiation. !
! ----------------------------------------------------------- !
if( conv_water_in_rad /= 0 ) then
allcld_ice(:ncol,:) = 0._r8 ! Grid-avg all cloud liquid
allcld_liq(:ncol,:) = 0._r8 ! Grid-avg all cloud ice

call conv_water_4rad(state, pbuf, allcld_liq, allcld_ice)
call conv_water_4rad(state, pbuf)
allcld_ice(:ncol,:) = totg_ice(:ncol,:) ! Grid-avg all cloud liquid
allcld_liq(:ncol,:) = totg_liq(:ncol,:) ! Grid-avg all cloud ice
else
allcld_liq(:ncol,top_lev:pver) = state%q(:ncol,top_lev:pver,ixcldliq) ! Grid-ave all cloud liquid
allcld_ice(:ncol,top_lev:pver) = state%q(:ncol,top_lev:pver,ixcldice) ! " ice
Expand Down Expand Up @@ -419,7 +430,9 @@ subroutine cloud_diagnostics_calc(state, pbuf)
elseif(one_mom_clouds) then

if (conv_water_in_rad /= 0) then
call conv_water_4rad(state, pbuf, allcld_liq, allcld_ice)
call conv_water_4rad(state, pbuf)
allcld_ice(:ncol,:) = totg_ice(:ncol,:) ! Grid-avg all cloud liquid
allcld_liq(:ncol,:) = totg_liq(:ncol,:) ! Grid-avg all cloud ice
else
allcld_liq = state%q(:,:,ixcldliq)
allcld_ice = state%q(:,:,ixcldice)
Expand Down
35 changes: 15 additions & 20 deletions src/physics/cam/conv_water.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module conv_water
! --------------------------------------------------------------------- !
! Purpose: !
! Computes grid-box average liquid (and ice) from stratus and cumulus !
! Just for the purposes of radiation. !
! These values used by both the radiation and the COSP diagnostics. !
! !
! Method: !
! Extract information about deep+shallow liquid and cloud fraction from !
Expand Down Expand Up @@ -38,9 +38,10 @@ module conv_water
! pbuf indices

integer :: icwmrsh_idx, icwmrdp_idx, fice_idx, sh_frac_idx, dp_frac_idx, &
ast_idx, sh_cldliq1_idx, sh_cldice1_idx, rei_idx
ast_idx, rei_idx

integer :: ixcldice, ixcldliq
integer :: gb_totcldliqmr_idx, gb_totcldicemr_idx

! Namelist
integer, parameter :: unset_int = huge(1)
Expand Down Expand Up @@ -113,11 +114,10 @@ subroutine conv_water_register

!-----------------------------------------------------------------------

! these calls were already done in convect_shallow...so here I add the same fields to the physics buffer with a "1" at the end
! shallow gbm cloud liquid water (kg/kg)
call pbuf_add_field('SH_CLDLIQ1','physpkg',dtype_r8,(/pcols,pver/),sh_cldliq1_idx)
! shallow gbm cloud ice water (kg/kg)
call pbuf_add_field('SH_CLDICE1','physpkg',dtype_r8,(/pcols,pver/),sh_cldice1_idx)
! grid box total cloud liquid water mixing ratio (kg/kg)
call pbuf_add_field('GB_TOTCLDLIQMR', 'physpkg', dtype_r8, (/pcols,pver/), gb_totcldliqmr_idx)
! grid box total cloud ice water mixing ratio (kg/kg)
call pbuf_add_field('GB_TOTCLDICEMR', 'physpkg', dtype_r8, (/pcols,pver/), gb_totcldicemr_idx)

end subroutine conv_water_register

Expand Down Expand Up @@ -168,7 +168,7 @@ subroutine conv_water_init()

end subroutine conv_water_init

subroutine conv_water_4rad(state, pbuf, totg_liq, totg_ice)
subroutine conv_water_4rad(state, pbuf)

! --------------------------------------------------------------------- !
! Purpose: !
Expand Down Expand Up @@ -202,9 +202,6 @@ subroutine conv_water_4rad(state, pbuf, totg_liq, totg_ice)
type(physics_state), target, intent(in) :: state ! state variables
type(physics_buffer_desc), pointer :: pbuf(:)

real(r8), intent(out):: totg_ice(pcols,pver) ! Total GBA in-cloud ice
real(r8), intent(out):: totg_liq(pcols,pver) ! Total GBA in-cloud liquid

! --------------- !
! Local Workspace !
! --------------- !
Expand All @@ -222,8 +219,9 @@ subroutine conv_water_4rad(state, pbuf, totg_liq, totg_ice)
real(r8), pointer, dimension(:,:) :: dp_icwmr ! Deep conv. cloud water
real(r8), pointer, dimension(:,:) :: sh_icwmr ! Shallow conv. cloud water
real(r8), pointer, dimension(:,:) :: fice ! Ice partitioning ratio
real(r8), pointer, dimension(:,:) :: sh_cldliq ! shallow convection gbx liq cld mixing ratio for COSP
real(r8), pointer, dimension(:,:) :: sh_cldice ! shallow convection gbx ice cld mixing ratio for COSP

real(r8), pointer, dimension(:,:) :: totg_ice ! Grid box total cloud ice mixing ratio
real(r8), pointer, dimension(:,:) :: totg_liq ! Grid box total cloud liquid mixing ratio

real(r8) :: conv_ice(pcols,pver) ! Convective contributions to IC cloud ice
real(r8) :: conv_liq(pcols,pver) ! Convective contributions to IC cloud liquid
Expand Down Expand Up @@ -282,6 +280,10 @@ subroutine conv_water_4rad(state, pbuf, totg_liq, totg_ice)
itim_old = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )

! Fields computed below and stored in pbuf.
call pbuf_get_field(pbuf, gb_totcldicemr_idx, totg_ice)
call pbuf_get_field(pbuf, gb_totcldliqmr_idx, totg_liq)

! --------------------------------------------------------------- !
! Loop through grid-boxes and determine: !
! 1. Effective mean in-cloud convective ice/liquid (deep+shallow) !
Expand Down Expand Up @@ -407,13 +409,6 @@ subroutine conv_water_4rad(state, pbuf, totg_liq, totg_ice)
end do
end do

!add pbuff calls for COSP
call pbuf_get_field(pbuf, sh_cldliq1_idx, sh_cldliq )
call pbuf_get_field(pbuf, sh_cldice1_idx, sh_cldice )

sh_cldliq(:ncol,:pver)=sh_icwmr(:ncol,:pver)*(1-fice(:ncol,:pver))*sh_frac(:ncol,:pver)
sh_cldice(:ncol,:pver)=sh_icwmr(:ncol,:pver)*fice(:ncol,:pver)*sh_frac(:ncol,:pver)

! Output convective IC WMRs

call outfld( 'ICLMRCU ', conv_liq , pcols, lchnk )
Expand Down
Loading

0 comments on commit 98c35fc

Please sign in to comment.