Skip to content

Commit 4764c5b

Browse files
authored
Merge pull request #1319 from fvitt/esmf_tem_diags
cam6_4_097: An alternative for TEM diagnostics
2 parents 7f3c5cb + 6878d14 commit 4764c5b

15 files changed

Lines changed: 1629 additions & 4 deletions

File tree

bld/namelist_files/namelist_definition.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,13 @@ Default: .false., unless it is overridden (WACCM with interactive chemistry and
538538
configurations do this)
539539
</entry>
540540

541+
<entry id="ctem_diags_numlats" type="integer" category="diagnostics"
542+
group="ctem_diags_nl" valid_values="" >
543+
Number of latitude grid points for zonal average Transformed Eulerian Mean (TEM)
544+
diagnostics history fields. Values greater than zero turn on the TEM diagostics.
545+
Default: 0
546+
</entry>
547+
541548
<entry id="phys_grid_ctem_zm_nbas" type="integer" category="diagnostics"
542549
group="phys_grid_ctem_opts" valid_values="" >
543550
Number of zonal mean basis functions (number of m=0 spherical harmonics) used in
@@ -3226,7 +3233,7 @@ Default: .false.
32263233

32273234
<entry id="zmconv_parcel_hscale" type="real" category="conv"
32283235
group="zmconv_nl" valid_values="" >
3229-
The fraction of the boundary layer (PBL) depth, over which to mix the initial ZM convective parcel properties (fraction).
3236+
The fraction of the boundary layer (PBL) depth, over which to mix the initial ZM convective parcel properties (fraction).
32303237
Default: 0.5
32313238
</entry>
32323239

cime_config/testdefs/testlist_cam.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@
11381138
<option name="wallclock">00:30:00</option>
11391139
</options>
11401140
</test>
1141-
<test compset="FHISTC_WXma" grid="ne30pg3_ne30pg3_mg17" name="ERS_Ln9" testmods="cam/outfrq9s">
1141+
<test compset="FHISTC_WXma" grid="ne30pg3_ne30pg3_mg17" name="ERS_Ln9" testmods="cam/outfrq9s_ctem">
11421142
<machines>
11431143
<machine name="derecho" compiler="intel" category="aux_cam"/>
11441144
<machine name="derecho" compiler="intel" category="waccmx"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
./xmlchange ROF_NCPL=\$ATM_NCPL
2+
./xmlchange GLC_NCPL=\$ATM_NCPL
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mfilt=1,1,1,1,1,1,1,1,1,1
2+
ndens=1,1,1,1,1,1,1,1,1,1
3+
nhtfrq=9,9,9,9,9,9,9,9,9,9
4+
write_nstep0=.true.
5+
inithist='ENDOFRUN'
6+
7+
cam_physics_mesh = '$ATM_DOMAIN_MESH'
8+
ctem_diags_numlats = 90
9+
10+
fincl2 = 'THtem','Utem','Vtem','Wtem','VTHtem','WTHtem','UVtem', 'UWtem', 'MSKtem', 'PStem'
11+
fincl3 = 'Uzm', 'Vzm','Wzm', 'THzm','VTHzm','WTHzm','UVzm', 'UWzm', 'PSzm'
12+
13+
do_circulation_diags = .false.
14+
fincl7 = ' '
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
!----------------------------------------------------------------------------------
2+
! Users should add all user specific namelist changes below in the form of
3+
! namelist_var = new_namelist_value
4+
!
5+
! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options
6+
! are set in the CLM_NAMELIST_OPTS env variable.
7+
!
8+
! EXCEPTIONS:
9+
! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting
10+
! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting
11+
! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting
12+
! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting
13+
! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting
14+
! Set irrigate by the CLM_BLDNML_OPTS -irrig setting
15+
! Set dtime with L_NCPL option
16+
! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options
17+
! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases
18+
! (includes $inst_string for multi-ensemble cases)
19+
! Set glc_grid with CISM_GRID option
20+
! Set glc_smb with GLC_SMB option
21+
! Set maxpatch_glcmec with GLC_NEC option
22+
! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable
23+
!----------------------------------------------------------------------------------
24+
hist_nhtfrq = 9
25+
hist_mfilt = 1
26+
hist_ndens = 1
27+

doc/ChangeLog

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,89 @@
1+
===============================================================
2+
3+
Tag name: cam6_4_097
4+
Originator(s): fvitt
5+
Date: 13 Jun 2025
6+
One-line Summary: An alternative method for zonal-mean TEM diagnostics
7+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1319
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
11+
Provides an method alternative to of computing zonal-mean terms of the
12+
Transformed Eulerian Mean (TEM) diagnostics independent of dynamical core.
13+
14+
The method here uses regridding capabilities provided in the ESMF library to map the dynamical
15+
fields needed in TEM diagnostics from the physics grid to a distributed regular longitude -
16+
latitude grid. The TEM diagnostics are computed on this regular longitude - latitude grid and
17+
computing zonal means is straightforward.
18+
19+
Describe any changes made to build system: N/A
20+
21+
Describe any changes made to the namelist:
22+
23+
New namelist option ctem_diags_numlats :
24+
Number of latitude grid points for zonal average Transformed Eulerian Mean (TEM)
25+
diagnostics history fields. Values greater than zero turn on the TEM diagostics.
26+
27+
List any changes to the defaults for the boundary datasets: N/A
128

29+
Describe any substantial timing or memory changes:
30+
Performance impact is minimal
31+
32+
Code reviewed by: nusbaume
33+
34+
List all files eliminated: N/A
35+
36+
List all files added and what they do:
37+
38+
A src/utils/ctem_diags_modc.F90
39+
A src/utils/esmf_check_error_mod.F90
40+
A src/utils/esmf_lonlat_grid_mod.F90
41+
A src/utils/esmf_phys2lonlat_mod.F90
42+
A src/utils/esmf_phys_mesh_mod.F90
43+
A src/utils/esmf_zonal_mean_mod.F90
44+
- module files for computing TEM diagnostics and zonal means
45+
46+
A cime_config/testdefs/testmods_dirs/cam/outfrq9s_ctem/shell_commands
47+
A cime_config/testdefs/testmods_dirs/cam/outfrq9s_ctem/user_nl_cam
48+
A cime_config/testdefs/testmods_dirs/cam/outfrq9s_ctem/user_nl_clm
49+
- for testing the new TEM diagnostics
50+
51+
List all existing files that have been modified, and describe the changes:
52+
53+
M bld/namelist_files/namelist_definition.xml
54+
- new namelist option described above
55+
56+
M src/control/runtime_opts.F90
57+
- read namelist options for ctem_diags_mod module
58+
59+
M src/physics/cam/physpkg.F90
60+
M src/physics/cam7/physpkg.F90
61+
- interface with the ctem_diags_mod module
62+
63+
M cime_config/testdefs/testlist_cam.xml
64+
- add test for TEM diags to aux_cam test of FHISTC_WXma
65+
66+
If there were any failures reported from running test_driver.sh on any test
67+
platform, and checkin with these failures has been OK'd by the gatekeeper,
68+
then copy the lines from the td.*.status files for the failed tests to the
69+
appropriate machine below. All failed tests must be justified.
70+
71+
derecho/intel/aux_cam:
72+
DIFF ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem
73+
- new TEM test -- no baseline to compare against
74+
75+
FAIL SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s
76+
- pre-existing failure due to build-namelist error requiring CLM/CTSM external update
77+
78+
derecho/nvhpc/aux_cam: All PASS
79+
80+
izumi/nag/aux_cam: All PASS
81+
82+
izumi/gnu/aux_cam: All PASS
83+
84+
Summarize any changes to answers: bit-for-bit unchanged
85+
86+
===============================================================
287
===============================================================
388

489
Tag name: cam6_4_096

src/control/runtime_opts.F90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
105105
use surface_emissions_mod, only: surface_emissions_readnl
106106
use elevated_emissions_mod, only: elevated_emissions_readnl
107107
use atm_stream_ndep, only: stream_ndep_readnl
108+
use ctem_diags_mod, only: ctem_diags_readnl
108109

109110
!---------------------------Arguments-----------------------------------
110111

@@ -211,6 +212,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
211212
call surface_emissions_readnl(nlfilename)
212213
call elevated_emissions_readnl(nlfilename)
213214
call stream_ndep_readnl(nlfilename)
215+
call ctem_diags_readnl(nlfilename)
214216

215217
end subroutine read_namelist
216218

src/physics/cam/physpkg.F90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ subroutine phys_register
164164
use upper_bc, only: ubc_fixed_conc
165165
use surface_emissions_mod, only: surface_emissions_reg
166166
use elevated_emissions_mod, only: elevated_emissions_reg
167+
use ctem_diags_mod, only: ctem_diags_reg
167168

168169
!---------------------------Local variables-----------------------------
169170
!
@@ -355,6 +356,9 @@ subroutine phys_register
355356
call HCOI_Chunk_Init()
356357
endif
357358

359+
! TEM diagnostics
360+
call ctem_diags_reg()
361+
358362
! This needs to be last as it requires all pbuf fields to be added
359363
if (cam_snapshot_before_num > 0 .or. cam_snapshot_after_num > 0) then
360364
call pbuf_cam_snapshot_register()
@@ -777,6 +781,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
777781
use elevated_emissions_mod, only: elevated_emissions_init
778782

779783
use ccpp_constituent_prop_mod, only: ccpp_const_props_init
784+
use ctem_diags_mod, only: ctem_diags_init
780785

781786
! Input/output arguments
782787
type(physics_state), pointer :: phys_state(:)
@@ -1059,6 +1064,8 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
10591064
dtcore_idx = pbuf_get_index('DTCORE')
10601065
dqcore_idx = pbuf_get_index('DQCORE')
10611066

1067+
call ctem_diags_init()
1068+
10621069
end subroutine phys_init
10631070

10641071
!
@@ -1083,6 +1090,7 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
10831090
#if ( defined OFFLINE_DYN )
10841091
use metdata, only: get_met_srf1
10851092
#endif
1093+
use ctem_diags_mod, only: ctem_diags_calc
10861094
!
10871095
! Input arguments
10881096
!
@@ -1127,6 +1135,9 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
11271135
call pbuf_allocate(pbuf2d, 'physpkg')
11281136
call diag_allocate()
11291137

1138+
! TEM diagnostics
1139+
call ctem_diags_calc(phys_state)
1140+
11301141
!-----------------------------------------------------------------------
11311142
! Advance time information
11321143
!-----------------------------------------------------------------------
@@ -1316,6 +1327,7 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
13161327
use microp_aero, only : microp_aero_final
13171328
use phys_grid_ctem, only : phys_grid_ctem_final
13181329
use nudging, only: Nudge_Model, nudging_final
1330+
use ctem_diags_mod, only: ctem_diags_final
13191331

13201332
!-----------------------------------------------------------------------
13211333
!
@@ -1346,6 +1358,8 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
13461358
call HCOI_Chunk_Final
13471359
endif
13481360

1361+
call ctem_diags_final()
1362+
13491363
end subroutine phys_final
13501364

13511365

src/physics/cam7/physpkg.F90

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ subroutine phys_register
158158
use hemco_interface, only: HCOI_Chunk_Init
159159
use surface_emissions_mod, only: surface_emissions_reg
160160
use elevated_emissions_mod, only: elevated_emissions_reg
161+
use ctem_diags_mod, only: ctem_diags_reg
161162

162163
!---------------------------Local variables-----------------------------
163164
!
@@ -345,6 +346,9 @@ subroutine phys_register
345346
call HCOI_Chunk_Init()
346347
endif
347348

349+
! TEM diagnostics
350+
call ctem_diags_reg()
351+
348352
! This needs to be last as it requires all pbuf fields to be added
349353
if (cam_snapshot_before_num > 0 .or. cam_snapshot_after_num > 0) then
350354
call pbuf_cam_snapshot_register()
@@ -772,6 +776,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
772776
use elevated_emissions_mod, only: elevated_emissions_init
773777

774778
use ccpp_constituent_prop_mod, only: ccpp_const_props_init
779+
use ctem_diags_mod, only: ctem_diags_init
775780

776781
! Input/output arguments
777782
type(physics_state), pointer :: phys_state(:)
@@ -1053,6 +1058,8 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
10531058

10541059
psl_idx = pbuf_get_index('PSL')
10551060

1061+
call ctem_diags_init()
1062+
10561063
end subroutine phys_init
10571064

10581065
!
@@ -1076,6 +1083,7 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
10761083
#if ( defined OFFLINE_DYN )
10771084
use metdata, only: get_met_srf1
10781085
#endif
1086+
use ctem_diags_mod, only: ctem_diags_calc
10791087
!
10801088
! Input arguments
10811089
!
@@ -1121,6 +1129,9 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
11211129
call pbuf_allocate(pbuf2d, 'physpkg')
11221130
call diag_allocate()
11231131

1132+
! TEM diagnostics
1133+
call ctem_diags_calc(phys_state)
1134+
11241135
!-----------------------------------------------------------------------
11251136
! Advance time information
11261137
!-----------------------------------------------------------------------
@@ -1310,6 +1321,7 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
13101321
use phys_grid_ctem, only: phys_grid_ctem_final
13111322
use nudging, only: Nudge_Model, nudging_final
13121323
use hemco_interface, only: HCOI_Chunk_Final
1324+
use ctem_diags_mod, only: ctem_diags_final
13131325

13141326
!-----------------------------------------------------------------------
13151327
!
@@ -1336,10 +1348,12 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
13361348
if(Nudge_Model) call nudging_final()
13371349

13381350
if(use_hemco) then
1339-
! cleanup hemco
1340-
call HCOI_Chunk_Final
1351+
! cleanup hemco
1352+
call HCOI_Chunk_Final
13411353
endif
13421354

1355+
call ctem_diags_final()
1356+
13431357
end subroutine phys_final
13441358

13451359

0 commit comments

Comments
 (0)