Skip to content

cam6_4_097: An alternative for TEM diagnostics #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,13 @@ Default: .false., unless it is overridden (WACCM with interactive chemistry and
configurations do this)
</entry>

<entry id="ctem_diags_numlats" type="integer" category="diagnostics"
group="ctem_diags_nl" valid_values="" >
Number of latitude grid points for zonal average Transformed Eulerian Mean (TEM)
diagnostics history fields. Values greater than zero turn on the TEM diagostics.
Default: 0
</entry>

<entry id="phys_grid_ctem_zm_nbas" type="integer" category="diagnostics"
group="phys_grid_ctem_opts" valid_values="" >
Number of zonal mean basis functions (number of m=0 spherical harmonics) used in
Expand Down Expand Up @@ -3226,7 +3233,7 @@ Default: .false.

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./xmlchange ROF_NCPL=\$ATM_NCPL
./xmlchange GLC_NCPL=\$ATM_NCPL
14 changes: 14 additions & 0 deletions cime_config/testdefs/testmods_dirs/cam/outfrq9s_ctem/user_nl_cam
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
mfilt=1,1,1,1,1,1
ndens=1,1,1,1,1,1
nhtfrq=9,9,9,9,9,9
write_nstep0=.true.
inithist='ENDOFRUN'

cam_physics_mesh = '$ATM_DOMAIN_MESH'
ctem_diags_numlats = 90

fincl2 = 'THtem','Utem','Vtem','Wtem','VTHtem','WTHtem','UVtem', 'UWtem', 'MSKtem', 'PStem'
fincl3 = 'Uzm', 'Vzm','Wzm', 'THzm','VTHzm','WTHzm','UVzm', 'UWzm', 'PSzm'

do_circulation_diags = .false.
fincl7 = ' '
27 changes: 27 additions & 0 deletions cime_config/testdefs/testmods_dirs/cam/outfrq9s_ctem/user_nl_clm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
!----------------------------------------------------------------------------------
! Users should add all user specific namelist changes below in the form of
! namelist_var = new_namelist_value
!
! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options
! are set in the CLM_NAMELIST_OPTS env variable.
!
! EXCEPTIONS:
! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting
! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting
! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting
! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting
! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting
! Set irrigate by the CLM_BLDNML_OPTS -irrig setting
! Set dtime with L_NCPL option
! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options
! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases
! (includes $inst_string for multi-ensemble cases)
! Set glc_grid with CISM_GRID option
! Set glc_smb with GLC_SMB option
! Set maxpatch_glcmec with GLC_NEC option
! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable
!----------------------------------------------------------------------------------
hist_nhtfrq = 9
hist_mfilt = 1
hist_ndens = 1

2 changes: 2 additions & 0 deletions src/control/runtime_opts.F90
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
use surface_emissions_mod, only: surface_emissions_readnl
use elevated_emissions_mod, only: elevated_emissions_readnl
use atm_stream_ndep, only: stream_ndep_readnl
use ctem_diags_mod, only: ctem_diags_readnl

!---------------------------Arguments-----------------------------------

Expand Down Expand Up @@ -211,6 +212,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
call surface_emissions_readnl(nlfilename)
call elevated_emissions_readnl(nlfilename)
call stream_ndep_readnl(nlfilename)
call ctem_diags_readnl(nlfilename)

end subroutine read_namelist

Expand Down
14 changes: 14 additions & 0 deletions src/physics/cam/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ subroutine phys_register
use upper_bc, only: ubc_fixed_conc
use surface_emissions_mod, only: surface_emissions_reg
use elevated_emissions_mod, only: elevated_emissions_reg
use ctem_diags_mod, only: ctem_diags_reg

!---------------------------Local variables-----------------------------
!
Expand Down Expand Up @@ -355,6 +356,9 @@ subroutine phys_register
call HCOI_Chunk_Init()
endif

! TEM diagnostics
call ctem_diags_reg()

! This needs to be last as it requires all pbuf fields to be added
if (cam_snapshot_before_num > 0 .or. cam_snapshot_after_num > 0) then
call pbuf_cam_snapshot_register()
Expand Down Expand Up @@ -777,6 +781,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
use elevated_emissions_mod, only: elevated_emissions_init

use ccpp_constituent_prop_mod, only: ccpp_const_props_init
use ctem_diags_mod, only: ctem_diags_init

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

call ctem_diags_init()

end subroutine phys_init

!
Expand All @@ -1083,6 +1090,7 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
#if ( defined OFFLINE_DYN )
use metdata, only: get_met_srf1
#endif
use ctem_diags_mod, only: ctem_diags_calc
!
! Input arguments
!
Expand Down Expand Up @@ -1127,6 +1135,9 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
call pbuf_allocate(pbuf2d, 'physpkg')
call diag_allocate()

! TEM diagnostics
call ctem_diags_calc(phys_state)

!-----------------------------------------------------------------------
! Advance time information
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -1316,6 +1327,7 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
use microp_aero, only : microp_aero_final
use phys_grid_ctem, only : phys_grid_ctem_final
use nudging, only: Nudge_Model, nudging_final
use ctem_diags_mod, only: ctem_diags_final

!-----------------------------------------------------------------------
!
Expand Down Expand Up @@ -1346,6 +1358,8 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
call HCOI_Chunk_Final
endif

call ctem_diags_final()

end subroutine phys_final


Expand Down
18 changes: 16 additions & 2 deletions src/physics/cam7/physpkg.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ subroutine phys_register
use hemco_interface, only: HCOI_Chunk_Init
use surface_emissions_mod, only: surface_emissions_reg
use elevated_emissions_mod, only: elevated_emissions_reg
use ctem_diags_mod, only: ctem_diags_reg

!---------------------------Local variables-----------------------------
!
Expand Down Expand Up @@ -345,6 +346,9 @@ subroutine phys_register
call HCOI_Chunk_Init()
endif

! TEM diagnostics
call ctem_diags_reg()

! This needs to be last as it requires all pbuf fields to be added
if (cam_snapshot_before_num > 0 .or. cam_snapshot_after_num > 0) then
call pbuf_cam_snapshot_register()
Expand Down Expand Up @@ -772,6 +776,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
use elevated_emissions_mod, only: elevated_emissions_init

use ccpp_constituent_prop_mod, only: ccpp_const_props_init
use ctem_diags_mod, only: ctem_diags_init

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

psl_idx = pbuf_get_index('PSL')

call ctem_diags_init()

end subroutine phys_init

!
Expand All @@ -1076,6 +1083,7 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
#if ( defined OFFLINE_DYN )
use metdata, only: get_met_srf1
#endif
use ctem_diags_mod, only: ctem_diags_calc
!
! Input arguments
!
Expand Down Expand Up @@ -1121,6 +1129,9 @@ subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out)
call pbuf_allocate(pbuf2d, 'physpkg')
call diag_allocate()

! TEM diagnostics
call ctem_diags_calc(phys_state)

!-----------------------------------------------------------------------
! Advance time information
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -1310,6 +1321,7 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
use phys_grid_ctem, only: phys_grid_ctem_final
use nudging, only: Nudge_Model, nudging_final
use hemco_interface, only: HCOI_Chunk_Final
use ctem_diags_mod, only: ctem_diags_final

!-----------------------------------------------------------------------
!
Expand All @@ -1336,10 +1348,12 @@ subroutine phys_final( phys_state, phys_tend, pbuf2d )
if(Nudge_Model) call nudging_final()

if(use_hemco) then
! cleanup hemco
call HCOI_Chunk_Final
! cleanup hemco
call HCOI_Chunk_Final
endif

call ctem_diags_final()

end subroutine phys_final


Expand Down
Loading