Skip to content

Commit 2a861bf

Browse files
authored
Merge pull request #1336 from jimmielin/hplin/cam_in_cflx_snapshot
cam6_4_101: Write cam_in%cflx for all constituents, not just Q
2 parents 5dd4faf + d835d2b commit 2a861bf

3 files changed

Lines changed: 91 additions & 8 deletions

File tree

doc/ChangeLog

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
===============================================================
22

3+
Tag name: cam6_4_101
4+
Originator(s): jimmielin
5+
Date: July 1, 2025
6+
One-line Summary: Write cam_in%cflx for all constituents in snapshots, not just Q
7+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1336
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
- For CAM snaphots, write cam_in%cflx for all constituents instead of just Q as it was declared horiz_only. Now write out as cam_in_cflx_(constituent name) - https://github.com/ESCOMP/CAM/issues/1335
11+
12+
Describe any changes made to build system: N/A
13+
14+
Describe any changes made to the namelist: N/A
15+
16+
List any changes to the defaults for the boundary datasets: N/A
17+
18+
Describe any substantial timing or memory changes: N/A
19+
20+
Code reviewed by: cacraig
21+
22+
List all files eliminated: N/A
23+
24+
List all files added and what they do: N/A
25+
26+
List all existing files that have been modified, and describe the changes:
27+
M src/control/cam_snapshot_common.F90
28+
- fix #1335
29+
M src/control/cam_history.F90
30+
- fix typo in comment
31+
32+
If there were any failures reported from running test_driver.sh on any test
33+
platform, and checkin with these failures has been OK'd by the gatekeeper,
34+
then copy the lines from the td.*.status files for the failed tests to the
35+
appropriate machine below. All failed tests must be justified.
36+
37+
derecho/intel/aux_cam:
38+
39+
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL)
40+
- pre-existing failure due to build-namelist error requiring CLM/CTSM external update
41+
42+
derecho/nvhpc/aux_cam: All PASS
43+
44+
izumi/nag/aux_cam: All PASS
45+
46+
izumi/gnu/aux_cam: All PASS
47+
48+
CAM tag used for the baseline comparison tests if different than previous
49+
tag:
50+
51+
Summarize any changes to answers: B4B - only new fields to snapshots
52+
53+
===============================================================
54+
355
Tag name: cam6_4_100
456
Originator(s): peverwhee, gdicker1
557
Date: 26 June 2025
@@ -69,7 +121,7 @@ Github PR URL: https://github.com/ESCOMP/CAM/pull/1331
69121

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

72-
. Resolve #1329 - Create an F compset for CAM4
124+
. Resolve #1329 - Create an F compset for CAM4
73125
- Add compset FHIST_C4
74126

75127
. Modify some MPAS tests.
@@ -79,7 +131,7 @@ Purpose of changes (include the issue number and title text for each relevant Gi
79131
. Resolve #1332 - ne0ARCTICne30x4 test fails with 1280 tasks and fixed CTSM,
80132
because of too few processors
81133
- increase pe count from 1280 to 1920. Make this the default in the
82-
config_pes.xml file.
134+
config_pes.xml file.
83135

84136
. Resolve #1326 - Add MPAS-O and MPAS-SI from EarthWorksOrg/EarthWorks
85137
- add "mpaso" as a valid value in the configure definition file
@@ -157,7 +209,7 @@ cime_config/testdefs/testlist_cam.xml
157209
ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_gnu.cam-outfrq3s_unicon
158210
. Increase PEs for ARCTIC test by modifying config_pes.xml and remove the
159211
specification from the test definition.
160-
Replace
212+
Replace
161213
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s
162214
by
163215
SMS_D_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s

src/control/cam_history.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7023,7 +7023,7 @@ end subroutine cam_history_snapshot_deactivate
70237023

70247024
subroutine cam_history_snapshot_activate(name, tape)
70257025

7026-
! This subroutine activates (set aftflag to true) for the requested tape number
7026+
! This subroutine activates (set actflag to true) for the requested tape number
70277027

70287028
character(len=*), intent(in) :: name
70297029
integer, intent(in) :: tape

src/control/cam_snapshot_common.F90

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,16 @@ subroutine cam_in_snapshot_init(cam_snapshot_before_num, cam_snapshot_after_num,
433433
! This subroutine does the addfld calls for cam_in fields
434434
!--------------------------------------------------------
435435

436+
use constituents, only: cnst_name
437+
436438
type(cam_in_t), intent(in) :: cam_in
437439

438-
integer,intent(in) :: cam_snapshot_before_num, cam_snapshot_after_num
440+
integer, intent(in) :: cam_snapshot_before_num, cam_snapshot_after_num
441+
442+
! for constituent loop.
443+
integer :: mcnst
444+
character(len=64) :: fname
445+
character(len=128) :: lname
439446

440447
ncam_in_var = 0
441448

@@ -464,8 +471,15 @@ subroutine cam_in_snapshot_init(cam_snapshot_before_num, cam_snapshot_after_num,
464471
call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
465472
'cam_in%shf', 'cam_in_shf', 'unset', horiz_only)
466473

467-
call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
468-
'cam_in%cflx', 'cam_in_cflx', 'unset', horiz_only)
474+
! cam_in%cflx is sized (pcols, pcnst); because the constituent indices at the model that reads this
475+
! data may not match the indices in the model outputting the snapshot,
476+
! cam_in%cflx is split into a series of snapshot variables cam_in_cflx_(constituent name).
477+
do mcnst = 1, pcnst
478+
fname = 'cam_in_cflx_'//trim(cnst_name(mcnst))
479+
lname = 'cam_in_cflx_'//trim(cnst_name(mcnst))
480+
call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
481+
fname, lname, 'kg m-2 s-1', horiz_only)
482+
enddo
469483

470484
call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
471485
'cam_in%wsx', 'cam_in_wsx', 'unset', horiz_only)
@@ -988,11 +1002,15 @@ end subroutine tend_snapshot_all_outfld
9881002

9891003
subroutine cam_in_snapshot_all_outfld(lchnk, file_num, cam_in)
9901004

1005+
use constituents, only: cnst_name
1006+
9911007
integer, intent(in) :: lchnk
9921008
integer, intent(in) :: file_num
9931009
type(cam_in_t), intent(in) :: cam_in
9941010

9951011
integer :: i
1012+
integer :: mcnst
1013+
character(len=64) :: fname
9961014

9971015
do i=1, ncam_in_var
9981016

@@ -1057,14 +1075,27 @@ subroutine cam_in_snapshot_all_outfld(lchnk, file_num, cam_in)
10571075
call outfld(cam_in_snapshot(i)%standard_name, cam_in%dstflx, pcols, lchnk)
10581076

10591077
case default
1060-
call endrun('ERROR in cam_in_snapshot_all_outfld: no match found for '//trim(cam_in_snapshot(i)%ddt_string))
1078+
if (cam_in_snapshot(i)%ddt_string(1:12) == 'cam_in_cflx_') then
1079+
! This case is handled below in a loop (not looked up here as it would be i*pcnst iterations)
1080+
else
1081+
call endrun('ERROR in cam_in_snapshot_all_outfld: no match found for '//trim(cam_in_snapshot(i)%ddt_string))
1082+
endif
10611083

10621084
end select
10631085

10641086
call cam_history_snapshot_deactivate(trim(cam_in_snapshot(i)%standard_name))
10651087

10661088
end do
10671089

1090+
! Handle cam_in%cflx constituent loop
1091+
do mcnst = 1, pcnst
1092+
fname = 'cam_in_cflx_'//trim(cnst_name(mcnst))
1093+
1094+
call cam_history_snapshot_activate(trim(fname), file_num)
1095+
call outfld(fname, cam_in%cflx(:,mcnst), pcols, lchnk)
1096+
call cam_history_snapshot_deactivate(trim(fname))
1097+
end do
1098+
10681099
end subroutine cam_in_snapshot_all_outfld
10691100

10701101
subroutine cam_out_snapshot_all_outfld(lchnk, file_num, cam_out)

0 commit comments

Comments
 (0)