Skip to content

Commit 14ad2a0

Browse files
authored
Merge pull request #1554 from PeterHjortLauritzen/pdc-energy-bug-fix
cam6_4_173: fix energy bug in physics-dynamics coupling
2 parents 35d419d + 56e126c commit 14ad2a0

9 files changed

Lines changed: 207 additions & 41 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
[submodule "atmos_phys"]
3030
path = src/atmos_phys
3131
url = https://github.com/ESCOMP/atmospheric_physics
32-
fxtag = atmos_phys0_21_002
32+
fxtag = atmos_phys0_21_003
3333
fxrequired = AlwaysRequired
3434
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
3535

doc/ChangeLog

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,174 @@
1+
Tag name: cam6_4_173
2+
Originator(s): pel, peverwhee, hplin
3+
Date: 15 May 2026
4+
One-line Summary: Fix energy bugs in physics-dynamics coupling, RRTMGP diagnostics, and ZM scheme
5+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1554
6+
7+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
8+
- Closes #1551 - Bug in physics tendency scaling
9+
- Closes #1553 - RRTMGP diagnostic net_flx bug
10+
- Closes #1550 - ZM scheme no longer conserving energy
11+
- Closes #1556 - rad_cnst refactor: list_idx gating in carma_aerosol_state_mod.F90 breaks radiation diagnostics
12+
13+
Describe any changes made to build system: N/A
14+
15+
Describe any changes made to the namelist: N/A
16+
17+
List any changes to the defaults for the boundary datasets: N/A
18+
19+
Describe any substantial timing or memory changes: N/A
20+
21+
Code reviewed by: nusbaume, cacraig (atmos_phys)
22+
23+
List all files eliminated: N/A
24+
25+
List all files added and what they do: N/A
26+
27+
List all existing files that have been modified, and describe the changes:
28+
29+
M .gitmodules
30+
- Update atmos_phys external to atmos_phys0_21_003
31+
32+
M src/atmos_phys
33+
- Update to atmos_phys0_21_003: fix ZM scheme factor for energy conservation
34+
35+
M src/physics/cam/physpkg.F90
36+
M src/physics/cam7/physpkg.F90
37+
M src/physics/simple/physpkg.F90
38+
- Move cam_thermo_water_update call to after state is saved (inside the
39+
.not.moist_mixing_ratio_dycore block) so that cp/cv is updated using
40+
post-physics water variables for energy diagnostics only
41+
- Save and restore cp_or_cv_dycore along with state tracers/pdel/ps so
42+
the energy-diagnostic-only call to physics_dme_adjust does not corrupt
43+
the cp/cv used by the dycore energy consistency adjustment
44+
45+
M src/physics/rrtmgp/radiation.F90
46+
- Move zeroing of flns/flnt (longwave net flux at surface/TOA) from
47+
before the shortwave block to before the longwave block, fixing
48+
incorrect net_flx diagnostics
49+
50+
M src/utils/air_composition.F90
51+
- Remove 'protected' attribute from cp_or_cv_dycore to allow physpkg to
52+
save/restore it across the diagnostic physics_dme_adjust call
53+
54+
M src/chemistry/aerosol/carma_aerosol_state_mod.F90
55+
- Remove erroneous endrun guards in carma aerosol state that were blocking
56+
double radiation cases
57+
58+
If there were any failures reported from running test_driver.sh on any test
59+
platform, and checkin with these failures has been OK'd by the gatekeeper,
60+
then copy the lines from the td.*.status files for the failed tests to the
61+
appropriate machine below. All failed tests must be justified.
62+
63+
derecho/intel/aux_cam:
64+
ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
65+
ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s (Overall: DIFF) details:
66+
ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details:
67+
ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details:
68+
ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details:
69+
ERC_D_Ln9.mpasa120_mpasa120.QPC7.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details:
70+
ERC_D_Ln9.ne30pg2_ne30pg2_mt232.QPC7.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
71+
ERC_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
72+
ERC_Ln9.C96_C96_mt232.F2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
73+
ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details:
74+
ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details:
75+
ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details:
76+
ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details:
77+
ERP_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
78+
ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
79+
ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details:
80+
ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details:
81+
ERP_Lh12.f19_f19_mg17.FW4madSD.derecho_intel.cam-outfrq3h (Overall: DIFF) details:
82+
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
83+
ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
84+
ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
85+
ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
86+
ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: DIFF) details:
87+
ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
88+
ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
89+
SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday (Overall: DIFF) details:
90+
SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
91+
SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
92+
SMS_D_Ln9.f19_f19_mg17.FCARMA2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
93+
SMS_D_Ln9.f19_f19_mg17.FCHIST_SLH.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
94+
SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
95+
SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 (Overall: DIFF) details:
96+
SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) details:
97+
SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 (Overall: DIFF) details:
98+
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: DIFF) details:
99+
SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details:
100+
SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details:
101+
SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging (Overall: DIFF) details:
102+
SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s (Overall: DIFF) details:
103+
ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: DIFF) details:
104+
SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep (Overall: DIFF) details:
105+
SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
106+
SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
107+
SMS_D_Ln9.ne16_ne16_mg17.QPX2000.derecho_intel.cam-outfrq9s_amie (Overall: DIFF) details:
108+
SMS_D_Ln9.ne30pg3_ne30pg3_mt232.1850C_CAM70%MT%CT4S2_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV_SESP.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
109+
SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
110+
SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details:
111+
SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details:
112+
SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details:
113+
SMS_D_Ln9_P1536x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
114+
- expected differences due to SE dycore updates + ZM bug fix.
115+
116+
117+
derecho/nvhpc/aux_cam:
118+
ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: DIFF)
119+
- expected differences due to SE dycore updates + ZM bug fix.
120+
121+
izumi/nag/aux_cam:
122+
ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-outfrq3s_subcol (Overall: FAIL) details:
123+
- pre-existing failure -- see https://github.com/ESCOMP/CAM/issues/1514
124+
125+
ERC_D_Ln27.ne3pg3_ne3pg3_mt232.FKESSLER.izumi_nag.cam-outfrq9s (Overall: DIFF) details::
126+
ERC_D_Ln9.mpasa480_mpasa480_mt232.QPC7.izumi_nag.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
127+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) details:
128+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-outfrq9s_nochem (Overall: DIFF) details:
129+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s (Overall: DIFF) details:
130+
SMS_D_Ln3.ne5pg3_ne5pg3_mg37.QPX2000.izumi_nag.cam-outfrq3s (Overall: DIFF) details:
131+
SMS_D_Ln6.ne5_ne5_mg37.QPWmaC4.izumi_nag.cam-outfrq3s_physgrid_tem (Overall: DIFF) details:
132+
SMS_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_nag.cam-carma_test_tracers (Overall: DIFF) details:
133+
- expected differences due to SE dycore updates + ZM bug fix.
134+
135+
ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s (Overall: DIFF) details:
136+
ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) details
137+
SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s (Overall: DIFF) details:
138+
TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac (Overall: DIFF) details:
139+
- expected differences due to ZM bug fix.
140+
141+
izumi/gnu/aux_cam:
142+
ERC_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
143+
ERC_D_Ln9.f10_f10_mg37.QPC4.izumi_gnu.cam-outfrq3s_diags (Overall: DIFF) details:
144+
ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag (Overall: DIFF) details:
145+
ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags (Overall: DIFF) details:
146+
ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
147+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp (Overall: DIFF) details:
148+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FGRAYRAD.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
149+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_gnu.cam-carma_cosp_rad_diag_mam (Overall: DIFF) details:
150+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod (Overall: DIFF) details:
151+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf (Overall: DIFF) details:
152+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FTJ16.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
153+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
154+
ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
155+
ERC_D_Ln9.ne5_ne5_mg37.QPC4.izumi_gnu.cam-outfrq3s_nudging_ne5_L26 (Overall: DIFF) details:
156+
ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
157+
PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal0 (Overall: DIFF) details:
158+
PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 (Overall: DIFF) details:
159+
PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 (Overall: DIFF) details:
160+
SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 (Overall: DIFF) details:
161+
SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc (Overall: DIFF) details:
162+
SMS_D_Ln9.f10_f10_mg37.FWmaHIST.izumi_gnu.cam-outfrq9s_mee_fluxes (Overall: DIFF) details:
163+
SMS_D_Ln9.f10_f10_mg37.QPWmaC4.izumi_gnu.cam-outfrq9s_apmee (Overall: DIFF) details:
164+
SMS_D_Ln9.f19_f19_mt232.FW4madSD.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
165+
SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
166+
- expected failures due to SE dycore updates + ZM bug fix
167+
168+
Summarize any changes to answers:
169+
Expecting failures against baseline for all tests using SE dycore
170+
(only tests without moisture should not fail)
171+
1172
===============================================================
2173

3174
Tag name: cam6_4_172

src/chemistry/aerosol/carma_aerosol_state_mod.F90

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,6 @@ subroutine hygroscopicity(self, bin_ndx, kappa)
407407
character(len=aero_name_len) :: bin_name, shortname
408408
integer :: igroup, ibin, rc, nchr, ncol
409409

410-
if (self%list_idx_ /= 0) then
411-
call endrun('carma_aerosol_state::hygroscopicity: only valid for climate list (list_idx=0)')
412-
end if
413-
414410
call rad_aer_get_info_by_bin(0, bin_ndx, bin_name=bin_name)
415411

416412
nchr = len_trim(bin_name)-2
@@ -476,10 +472,6 @@ function dry_volume(self, aero_props, bin_idx, ncol, nlev) result(vol)
476472
character(len=aero_name_len) :: bin_name, shortname
477473
integer :: igroup, ibin, rc, nchr
478474

479-
if (self%list_idx_ /= 0) then
480-
call endrun('carma_aerosol_state::dry_volume: only valid for climate list (list_idx=0)')
481-
end if
482-
483475
call rad_aer_get_info_by_bin(0, bin_idx, bin_name=bin_name)
484476

485477
nchr = len_trim(bin_name)-2
@@ -519,10 +511,6 @@ function wet_volume(self, aero_props, bin_idx, ncol, nlev) result(vol)
519511
character(len=aero_name_len) :: bin_name, shortname
520512
integer :: igroup, ibin, rc, nchr
521513

522-
if (self%list_idx_ /= 0) then
523-
call endrun('carma_aerosol_state::wet_volume: only valid for climate list (list_idx=0)')
524-
end if
525-
526514
call rad_aer_get_info_by_bin(0, bin_idx, bin_name=bin_name)
527515

528516
nchr = len_trim(bin_name)-2
@@ -586,10 +574,6 @@ function wet_diameter(self, bin_idx, ncol, nlev) result(diam)
586574
character(len=aero_name_len) :: bin_name, shortname
587575
integer :: igroup, ibin, rc, nchr
588576

589-
if (self%list_idx_ /= 0) then
590-
call endrun('carma_aerosol_state::wet_diameter: only valid for climate list (list_idx=0)')
591-
end if
592-
593577
call rad_aer_get_info_by_bin(0, bin_idx, bin_name=bin_name)
594578

595579
nchr = len_trim(bin_name)-2

src/physics/cam/physpkg.F90

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,7 @@ subroutine tphysac (ztodt, cam_in, &
14691469
real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space
14701470
real(r8) :: tmp_pdel (pcols,pver) ! tmp space
14711471
real(r8) :: tmp_ps (pcols) ! tmp space
1472+
real(r8) :: tmp_cpcv (pcols,pver) ! tmp space
14721473
real(r8) :: scaling(pcols,pver)
14731474
logical :: moist_mixing_ratio_dycore
14741475

@@ -1987,11 +1988,6 @@ subroutine tphysac (ztodt, cam_in, &
19871988
! FV: convert dry-type mixing ratios to moist here because physics_dme_adjust
19881989
! assumes moist. This is done in p_d_coupling for other dynamics. Bundy, Feb 2004.
19891990
moist_mixing_ratio_dycore = dycore_is('LR').or. dycore_is('FV3')
1990-
!
1991-
! update cp/cv for energy computation based in updated water variables
1992-
!
1993-
call cam_thermo_water_update(state%q(:ncol,:,:), lchnk, ncol, vc_dycore,&
1994-
to_dry_factor=state%pdel(:ncol,:)/state%pdeldry(:ncol,:))
19951991

19961992
! for dry mixing ratio dycore, physics_dme_adjust is called for energy diagnostic purposes only.
19971993
! So, save off tracers
@@ -2005,10 +2001,17 @@ subroutine tphysac (ztodt, cam_in, &
20052001
tmp_trac(:ncol,:pver,:pcnst) = state%q(:ncol,:pver,:pcnst)
20062002
tmp_pdel(:ncol,:pver) = state%pdel(:ncol,:pver)
20072003
tmp_ps(:ncol) = state%ps(:ncol)
2004+
tmp_cpcv(:ncol,:pver) = cp_or_cv_dycore(:ncol,:pver,lchnk)
20082005
if (trim(cam_take_snapshot_before) == "physics_dme_adjust") then
20092006
call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,&
20102007
fh2o, surfric, obklen, flx_heat)
2011-
end if
2008+
end if
2009+
!
2010+
! update cp/cv for energy computation based in updated water variables
2011+
!
2012+
call cam_thermo_water_update(state%q(:ncol,:,:), lchnk, ncol, vc_dycore,&
2013+
to_dry_factor=state%pdel(:ncol,:)/state%pdeldry(:ncol,:))
2014+
20122015
call physics_dme_adjust(state, tend, qini, totliqini, toticeini, ztodt)
20132016
if (trim(cam_take_snapshot_after) == "physics_dme_adjust") then
20142017
call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,&
@@ -2020,6 +2023,7 @@ subroutine tphysac (ztodt, cam_in, &
20202023
state%q(:ncol,:pver,:pcnst) = tmp_trac(:ncol,:pver,:pcnst)
20212024
state%pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver)
20222025
state%ps(:ncol) = tmp_ps(:ncol)
2026+
cp_or_cv_dycore(:ncol,:pver,lchnk) = tmp_cpcv(:ncol,:pver)
20232027
end if
20242028
else
20252029
!

src/physics/cam7/physpkg.F90

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,7 @@ subroutine tphysac (ztodt, cam_in, &
15391539
real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space
15401540
real(r8) :: tmp_pdel (pcols,pver) ! tmp space
15411541
real(r8) :: tmp_ps (pcols) ! tmp space
1542+
real(r8) :: tmp_cpcv (pcols,pver) ! tmp space
15421543
real(r8) :: scaling(pcols,pver)
15431544
logical :: moist_mixing_ratio_dycore
15441545

@@ -2497,12 +2498,6 @@ subroutine tphysac (ztodt, cam_in, &
24972498
! FV: convert dry-type mixing ratios to moist here because physics_dme_adjust
24982499
! assumes moist. This is done in p_d_coupling for other dynamics. Bundy, Feb 2004.
24992500
moist_mixing_ratio_dycore = dycore_is('LR').or. dycore_is('FV3')
2500-
!
2501-
! update cp/cv for energy computation based in updated water variables
2502-
!
2503-
call cam_thermo_water_update(state%q(:ncol,:,:), lchnk, ncol, vc_dycore,&
2504-
to_dry_factor=state%pdel(:ncol,:)/state%pdeldry(:ncol,:))
2505-
25062501
! for dry mixing ratio dycore, physics_dme_adjust is called for energy diagnostic purposes only.
25072502
! So, save off tracers
25082503
if (.not.moist_mixing_ratio_dycore) then
@@ -2515,10 +2510,17 @@ subroutine tphysac (ztodt, cam_in, &
25152510
tmp_trac(:ncol,:pver,:pcnst) = state%q(:ncol,:pver,:pcnst)
25162511
tmp_pdel(:ncol,:pver) = state%pdel(:ncol,:pver)
25172512
tmp_ps(:ncol) = state%ps(:ncol)
2513+
tmp_cpcv(:ncol,:pver) = cp_or_cv_dycore(:ncol,:pver,lchnk)
25182514
if (trim(cam_take_snapshot_before) == "physics_dme_adjust") then
25192515
call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,&
25202516
fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx)
25212517
end if
2518+
!
2519+
! update cp/cv for energy computation based in updated water variables
2520+
!
2521+
call cam_thermo_water_update(state%q(:ncol,:,:), lchnk, ncol, vc_dycore,&
2522+
to_dry_factor=state%pdel(:ncol,:)/state%pdeldry(:ncol,:))
2523+
25222524
call physics_dme_adjust(state, tend, qini, totliqini, toticeini, ztodt)
25232525
if (trim(cam_take_snapshot_after) == "physics_dme_adjust") then
25242526
call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,&
@@ -2530,6 +2532,7 @@ subroutine tphysac (ztodt, cam_in, &
25302532
state%q(:ncol,:pver,:pcnst) = tmp_trac(:ncol,:pver,:pcnst)
25312533
state%pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver)
25322534
state%ps(:ncol) = tmp_ps(:ncol)
2535+
cp_or_cv_dycore(:ncol,:pver,lchnk) = tmp_cpcv(:ncol,:pver)
25332536
end if
25342537
else
25352538
!

src/physics/rrtmgp/radiation.F90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,11 +1124,6 @@ subroutine radiation_tend( &
11241124
end do
11251125
end if
11261126

1127-
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
1128-
flns(:) = 0._r8
1129-
flnt(:) = 0._r8
1130-
!REMOVECAM_END
1131-
11321127
! Find tropopause height if needed for diagnostic output
11331128
if (hist_fld_active('FSNR') .or. hist_fld_active('FLNR')) then
11341129
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
@@ -1336,6 +1331,11 @@ subroutine radiation_tend( &
13361331

13371332
if (dolw) then
13381333

1334+
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
1335+
flns(:) = 0._r8
1336+
flnt(:) = 0._r8
1337+
!REMOVECAM_END
1338+
13391339
! Set cloud optical properties in cloud_lw object.
13401340
call rrtmgp_lw_cloud_optics_run(dolw, ncol, nlay, cld(:ncol,:), cldfsnow_in, &
13411341
cldfgrau_in, cldfprime(:ncol,:), kdist_lw, lambda(:ncol,:), mu(:ncol,:), &

0 commit comments

Comments
 (0)