Skip to content

Commit

Permalink
Merge pull request #992 from cacraigucar/cam_zm_clean_up
Browse files Browse the repository at this point in the history
cam6_3_158: ZM clean up round 2 for CAM
  • Loading branch information
cacraigucar committed Apr 22, 2024
2 parents 82ed900 + 963876d commit 776400d
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ src/physics/pumas
src/physics/pumas-frozen
src/physics/rrtmgp/data
src/physics/rrtmgp/ext
src/dynamics/fv3/atmos_cubed_sphere
src/dynamics/fv3
libraries/FMS
libraries/mct
libraries/parallelio
Expand Down
2 changes: 1 addition & 1 deletion Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ local_path = libraries/parallelio
required = True

[cime]
tag = cime6.0.217_httpsbranch02
tag = cime6.0.236_httpsbranch01
protocol = git
repo_url = https://github.com/ESMCI/cime
local_path = cime
Expand Down
2 changes: 1 addition & 1 deletion Externals_CAM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tag = ALI_ARMS_v1.0.1
required = True

[atmos_phys]
tag = atmos_phys0_02_000
tag = atmos_phys0_02_006
protocol = git
repo_url = https://github.com/ESCOMP/atmospheric_physics
required = True
Expand Down
6 changes: 3 additions & 3 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2189,9 +2189,9 @@ sub write_filepath
if ($chem_src_dir) {
print $fh "$chem_src_dir\n";
}

# GEOS-Chem must be prior to Mozart
if ($chem_pkg =~ 'geoschem') {
if ($chem_pkg =~ 'geoschem') {
print $fh "$chem_src_dir/geoschem_src/GeosCore\n";
print $fh "$chem_src_dir/geoschem_src/GeosUtil\n";
print $fh "$chem_src_dir/geoschem_src/Headers\n";
Expand Down Expand Up @@ -2303,7 +2303,7 @@ sub write_filepath
print $fh "$camsrcdir/src/physics/cam\n";

#Add the CCPP'ized subdirectories
print $fh "$camsrcdir/src/atmos_phys/zm\n";
print $fh "$camsrcdir/src/atmos_phys/zhang_mcfarlane\n";

# Dynamics package and test utilities
print $fh "$camsrcdir/src/dynamics/$dyn\n";
Expand Down
77 changes: 77 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,80 @@

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

Tag name: cam6_3_158
Originator(s): cacraig
Date: April 22, 2024
One-line Summary: ZM clean up round 2 for CAM and cime update for GEOS-Chem
Github PR URL: https://github.com/ESCOMP/CAM/pull/992

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
- change zm directory to be zhang_mcfarlane: https://github.com/ESCOMP/CAM/issues/965
- Reimplement writing within ZM and remove pflx variable: https://github.com/ESCOMP/CAM/issues/978
- ZM cleanup: https://github.com/ESCOMP/CAM/issues/984
- Tag cam6_3_157 missing updated .gitignore: https://github.com/ESCOMP/CAM/issues/1012
- GEOS-Chem compsets will fail due to bugs in CAM and CIME: https://github.com/ESCOMP/CAM/issues/1004

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by: nusbaume

List all files eliminated: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
M .gitignore
- Update FV3 listing

M externals.cfg
- Update cime to bring in bug fix for GEOS-Chem

M Externals_CAM.cfg
- Update atmospheric_physics external to bring in changes for ZM

M bld/configure
- Change directory from zm to zhang-mcfarlane

M src/physics/cam/cam_snapshot.F90
M src/physics/cam/convect_deep.F90
M src/physics/cam/physpkg.F90
M src/physics/cam_dev/cam_snapshot.F90
M src/physics/cam_dev/physpkg.F90
- Remove pflx variable which is not used

M src/physics/cam/zm_conv_intr.F90
- Split winds into separate variable
- remove pflx
- reintroduce writing within ZM

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: all BFB, except:
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
- pre-existing failure

SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details:
- Answer change for HEMCO - approved by Francis and Lizzie due to HEMCO giving different answers when layout changes are made

SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: DIFF) details:
- no previous baseline

izumi/nag/aux_cam:
DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details:
- pre-existing failure

izumi/gnu/aux_cam: all BFB

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

Tag name: cam6_3_157
Expand Down
17 changes: 6 additions & 11 deletions src/physics/cam/cam_snapshot.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ subroutine cam_snapshot_init(cam_in_arr, cam_out_arr, pbuf, index)

call phys_getopts(cam_snapshot_before_num_out = cam_snapshot_before_num, &
cam_snapshot_after_num_out = cam_snapshot_after_num)


! Return if not turned on
if (cam_snapshot_before_num <= 0 .and. cam_snapshot_after_num <= 0) return ! No snapshot files are being requested
Expand All @@ -76,7 +76,7 @@ subroutine cam_snapshot_init(cam_in_arr, cam_out_arr, pbuf, index)
end subroutine cam_snapshot_init

subroutine cam_snapshot_all_outfld_tphysbc(file_num, state, tend, cam_in, cam_out, pbuf, flx_heat, cmfmc, cmfcme, &
pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx)
zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx)

use time_manager, only: is_first_step, is_first_restart_step

Expand All @@ -95,7 +95,6 @@ subroutine cam_snapshot_all_outfld_tphysbc(file_num, state, tend, cam_in, cam_ou
real(r8), intent(in) :: flx_heat(:) ! Heat flux for check_energy_chng.
real(r8), intent(in) :: cmfmc(:,:) ! convective mass flux
real(r8), intent(in) :: cmfcme(:,:) ! cmf condensation - evaporation
real(r8), intent(in) :: pflx(:,:) ! convective rain flux throughout bottom of level
real(r8), intent(in) :: zdu(:,:) ! detraining mass flux from deep convection
real(r8), intent(in) :: rliq(:) ! vertical integral of liquid not yet in q(ixcldliq)
real(r8), intent(in) :: rice(:) ! vertical integral of ice not yet in q(ixcldice)
Expand All @@ -111,15 +110,14 @@ subroutine cam_snapshot_all_outfld_tphysbc(file_num, state, tend, cam_in, cam_ou
! Return if the first timestep as not all fields may be filled in and this will cause a core dump
if (is_first_step().or. is_first_restart_step()) return

! Return if not turned on
! Return if not turned on
if (cam_snapshot_before_num <= 0 .and. cam_snapshot_after_num <= 0) return ! No snapshot files are being requested

lchnk = state%lchnk

call outfld('tphysbc_flx_heat', flx_heat, pcols, lchnk)
call outfld('tphysbc_cmfmc', cmfmc, pcols, lchnk)
call outfld('tphysbc_cmfcme', cmfcme, pcols, lchnk)
call outfld('tphysbc_pflx', pflx, pcols, lchnk)
call outfld('tphysbc_zdu', zdu, pcols, lchnk)
call outfld('tphysbc_rliq', rliq, pcols, lchnk)
call outfld('tphysbc_rice', rice, pcols, lchnk)
Expand Down Expand Up @@ -160,7 +158,7 @@ subroutine cam_snapshot_all_outfld_tphysac(file_num, state, tend, cam_in, cam_ou
! Return if the first timestep as not all fields may be filled in and this will cause a core dump
if (is_first_step()) return

! Return if not turned on
! Return if not turned on
if (cam_snapshot_before_num <= 0 .and. cam_snapshot_after_num <= 0) return ! No snapshot files are being requested

lchnk = state%lchnk
Expand All @@ -182,7 +180,7 @@ subroutine cam_tphysbc_snapshot_init(cam_snapshot_before_num, cam_snapshot_after
!--------------------------------------------------------

integer,intent(in) :: cam_snapshot_before_num, cam_snapshot_after_num

ntphysbc_var = 0

!--------------------------------------------------------
Expand All @@ -199,9 +197,6 @@ subroutine cam_tphysbc_snapshot_init(cam_snapshot_before_num, cam_snapshot_after
call snapshot_addfld( ntphysbc_var, tphysbc_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
'cmfcme', 'tphysbc_cmfcme', 'unset', 'lev')

call snapshot_addfld( ntphysbc_var, tphysbc_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
'pflx', 'tphysbc_pflx', 'unset', 'lev')

call snapshot_addfld( ntphysbc_var, tphysbc_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
'zdu', 'tphysbc_zdu', 'unset', 'lev')

Expand Down Expand Up @@ -240,7 +235,7 @@ subroutine cam_tphysac_snapshot_init(cam_snapshot_before_num, cam_snapshot_after
!--------------------------------------------------------

integer,intent(in) :: cam_snapshot_before_num, cam_snapshot_after_num

ntphysac_var = 0

!--------------------------------------------------------
Expand Down
62 changes: 30 additions & 32 deletions src/physics/cam/convect_deep.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module convect_deep
!
! CAM interface to several deep convection interfaces. Currently includes:
! Zhang-McFarlane (default)
! Kerry Emanuel
! Kerry Emanuel
!
!
! Author: D.B. Coleman, Sep 2004
Expand All @@ -28,34 +28,34 @@ module convect_deep
convect_deep_tend, &! return tendencies
convect_deep_tend_2, &! return tendencies
deep_scheme_does_scav_trans ! = .t. if scheme does scavenging and conv. transport

! Private module data
character(len=16) :: deep_scheme ! default set in phys_control.F90, use namelist to change
! Physics buffer indices
integer :: icwmrdp_idx = 0
integer :: rprddp_idx = 0
integer :: nevapr_dpcu_idx = 0
integer :: cldtop_idx = 0
integer :: cldbot_idx = 0
integer :: cld_idx = 0
integer :: fracis_idx = 0

integer :: pblh_idx = 0
integer :: tpert_idx = 0
! Physics buffer indices
integer :: icwmrdp_idx = 0
integer :: rprddp_idx = 0
integer :: nevapr_dpcu_idx = 0
integer :: cldtop_idx = 0
integer :: cldbot_idx = 0
integer :: cld_idx = 0
integer :: fracis_idx = 0

integer :: pblh_idx = 0
integer :: tpert_idx = 0
integer :: prec_dp_idx = 0
integer :: snow_dp_idx = 0

integer :: ttend_dp_idx = 0

!=========================================================================================
contains
contains

!=========================================================================================
function deep_scheme_does_scav_trans()
!
! Function called by tphysbc to determine if it needs to do scavenging and convective transport
! or if those have been done by the deep convection scheme. Each scheme could have its own
! identical query function for a less-knowledgable interface but for now, we know that KE
! identical query function for a less-knowledgable interface but for now, we know that KE
! does scavenging & transport, and ZM doesn't
!

Expand All @@ -76,7 +76,7 @@ subroutine convect_deep_register
! Purpose: register fields with the physics buffer
!----------------------------------------


use physics_buffer, only : pbuf_add_field, dtype_r8
use zm_conv_intr, only: zm_conv_register
use phys_control, only: phys_getopts, use_gw_convect_dp
Expand Down Expand Up @@ -118,12 +118,12 @@ subroutine convect_deep_init(pref_edge)
! Purpose: declare output fields, initialize variables needed by convection
!----------------------------------------

use cam_history, only: addfld
use cam_history, only: addfld
use pmgrid, only: plevp
use spmd_utils, only: masterproc
use zm_conv_intr, only: zm_conv_init
use cam_abortutils, only: endrun

use physics_buffer, only: physics_buffer_desc, pbuf_get_index

implicit none
Expand Down Expand Up @@ -169,14 +169,14 @@ end subroutine convect_deep_init

subroutine convect_deep_tend( &
mcon ,cme , &
pflx ,zdu , &
zdu , &
rliq ,rice , &
ztodt , &
state ,ptend ,landfrac ,pbuf)


use physics_types, only: physics_state, physics_ptend, physics_tend, physics_ptend_init

use cam_history, only: outfld
use constituents, only: pcnst
use zm_conv_intr, only: zm_conv_tend
Expand All @@ -187,27 +187,26 @@ subroutine convect_deep_tend( &
! Arguments
type(physics_state), intent(in ) :: state ! Physics state variables
type(physics_ptend), intent(out) :: ptend ! individual parameterization tendencies


type(physics_buffer_desc), pointer :: pbuf(:)
real(r8), intent(in) :: ztodt ! 2 delta t (model time increment)
real(r8), intent(in) :: landfrac(pcols) ! Land fraction


real(r8), intent(out) :: mcon(pcols,pverp) ! Convective mass flux--m sub c
real(r8), intent(out) :: pflx(pcols,pverp) ! scattered precip flux at each level
real(r8), intent(out) :: cme(pcols,pver) ! cmf condensation - evaporation
real(r8), intent(out) :: zdu(pcols,pver) ! detraining mass flux

real(r8), intent(out) :: rliq(pcols) ! reserved liquid (not yet in cldliq) for energy integrals
real(r8), intent(out) :: rice(pcols) ! reserved ice (not yet in cldice) for energy integrals

real(r8), pointer :: prec(:) ! total precipitation
real(r8), pointer :: snow(:) ! snow from ZM convection
real(r8), pointer :: snow(:) ! snow from ZM convection

real(r8), pointer, dimension(:) :: jctop
real(r8), pointer, dimension(:) :: jcbot
real(r8), pointer, dimension(:,:,:) :: cld
real(r8), pointer, dimension(:,:,:) :: cld
real(r8), pointer, dimension(:,:) :: ql ! wg grid slice of cloud liquid water.
real(r8), pointer, dimension(:,:) :: rprd ! rain production rate
real(r8), pointer, dimension(:,:,:) :: fracis ! fraction of transported species that are insoluble
Expand All @@ -230,9 +229,8 @@ subroutine convect_deep_tend( &

select case ( deep_scheme )
case('off', 'UNICON', 'CLUBB_SGS') ! in UNICON case the run method is called from convect_shallow_tend
zero = 0
zero = 0
mcon = 0
pflx = 0
cme = 0
zdu = 0
rliq = 0
Expand All @@ -244,7 +242,7 @@ subroutine convect_deep_tend( &
! Associate pointers with physics buffer fields
!

call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1/), kount=(/pcols,pver/) )
call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1/), kount=(/pcols,pver/) )
call pbuf_get_field(pbuf, rprddp_idx, rprd )
call pbuf_get_field(pbuf, fracis_idx, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) )
call pbuf_get_field(pbuf, nevapr_dpcu_idx, evapcdp )
Expand All @@ -267,7 +265,7 @@ subroutine convect_deep_tend( &
call pbuf_get_field(pbuf, tpert_idx, tpert)

call zm_conv_tend( pblh ,mcon ,cme , &
tpert ,pflx ,zdu , &
tpert ,zdu , &
rliq ,rice , &
ztodt , &
jctop, jcbot , &
Expand All @@ -291,22 +289,22 @@ end subroutine convect_deep_tend
subroutine convect_deep_tend_2( state, ptend, ztodt, pbuf)

use physics_types, only: physics_state, physics_ptend, physics_ptend_init

use physics_buffer, only: physics_buffer_desc
use constituents, only: pcnst
use zm_conv_intr, only: zm_conv_tend_2

! Arguments
type(physics_state), intent(in ) :: state ! Physics state variables
type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies

type(physics_buffer_desc), pointer :: pbuf(:)

real(r8), intent(in) :: ztodt ! 2 delta t (model time increment)


if ( deep_scheme .eq. 'ZM' ) then ! Zhang-McFarlane
call zm_conv_tend_2( state, ptend, ztodt, pbuf)
call zm_conv_tend_2( state, ptend, ztodt, pbuf)
else
call physics_ptend_init(ptend, state%psetcols, 'convect_deep')
end if
Expand Down
Loading

0 comments on commit 776400d

Please sign in to comment.