From f18090aa80382f194b5f2e297f01d14f16e0f711 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 13 May 2026 06:45:36 -0400 Subject: [PATCH 1/6] SIMA patch for energy bug in physics-dynamics coupling --- src/data/registry.xml | 17 ++++++++++++++++- src/dynamics/mpas/dyn_coupling_impl.F90 | 4 +++- src/dynamics/se/dp_coupling.F90 | 3 +++ tools/stdnames_to_inputnames_dictionary.xml | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/data/registry.xml b/src/data/registry.xml index 83ba849e0..6b33309a3 100644 --- a/src/data/registry.xml +++ b/src/data/registry.xml @@ -575,8 +575,23 @@ standard_name="specific_heat_of_air_used_in_dycore" units="J kg-1 K-1" type="real" kind="kind_phys" allocatable="allocatable"> - specific heat of air used in the dynamical core (enthalpy for pressure-based dynamical cores and internal energy for z-based dynamical cores) + specific heat of air used in the dynamical core (enthalpy for pressure-based dynamical cores and internal energy for z-based dynamical cores), updated mid-physics for post-mass-adjustment total energy diagnostics horizontal_dimension vertical_layer_dimension + 0._kind_phys + + + Specific heat of air used in the dynamical core (enthalpy for + pressure-based dynamical cores and internal energy for z-based + dynamical cores), at start of physics timestep, for energy-consistency scaling and energy checker + horizontal_dimension vertical_layer_dimension + cp_or_cv_dycore diff --git a/src/dynamics/mpas/dyn_coupling_impl.F90 b/src/dynamics/mpas/dyn_coupling_impl.F90 index 2eb90f696..4970ba374 100644 --- a/src/dynamics/mpas/dyn_coupling_impl.F90 +++ b/src/dynamics/mpas/dyn_coupling_impl.F90 @@ -507,7 +507,7 @@ subroutine set_physics_state_external() use dyn_comp, only: advected_constituent_index, mpas_dynamical_core use dyn_procedures, only: exner_function use dynconst, only: constant_g => gravit - use physics_types, only: cappav, cp_or_cv_dycore, cpairv, lagrangian_vertical, phys_state, rairv, zvirv + use physics_types, only: cappav, cp_or_cv_dycore, cp_or_cv_dycore_at_start_of_physics_timestep, cpairv, lagrangian_vertical, phys_state, rairv, zvirv use runtime_obj, only: cam_runtime_opts use string_utils, only: stringify use vert_coord, only: pver, pverp @@ -565,6 +565,8 @@ subroutine set_physics_state_external() call cam_thermo_water_update( & constituents, ncells_solve, pver, energy_formula_dycore_mpas, cp_or_cv_dycore) + cp_or_cv_dycore_at_start_of_physics_timestep(:ncells_solve, :) = cp_or_cv_dycore(:ncells_solve, :) + ! This variable name is really misleading. It actually represents the reciprocal of Exner function ! with respect to surface pressure. This definition is sometimes used for boundary layer work. See ! the paragraph below equation 1.5.1c in doi:10.1007/978-94-009-3027-8. diff --git a/src/dynamics/se/dp_coupling.F90 b/src/dynamics/se/dp_coupling.F90 index de4f7fe06..ae351a660 100644 --- a/src/dynamics/se/dp_coupling.F90 +++ b/src/dynamics/se/dp_coupling.F90 @@ -588,6 +588,7 @@ subroutine derived_phys_dry(cam_runtime_opts, phys_state, phys_tend) use air_composition, only: dry_air_species_num use physics_types, only: cpairv, rairv, zvirv, cappav use physics_types, only: cp_or_cv_dycore + use physics_types, only: cp_or_cv_dycore_at_start_of_physics_timestep use physics_grid, only: columns_on_task use geopotential_temp, only: geopotential_temp_run use static_energy, only: update_dry_static_energy_run @@ -807,6 +808,8 @@ subroutine derived_phys_dry(cam_runtime_opts, phys_state, phys_tend) cp_or_cv_dycore = cp_or_cv_dycore & ) + cp_or_cv_dycore_at_start_of_physics_timestep(:,:) = cp_or_cv_dycore(:,:) + !$omp parallel do num_threads(horz_num_threads) private (k, i) do k = 1, nlev do i = 1, pcols diff --git a/tools/stdnames_to_inputnames_dictionary.xml b/tools/stdnames_to_inputnames_dictionary.xml index dbd84b994..bbe5d9fba 100644 --- a/tools/stdnames_to_inputnames_dictionary.xml +++ b/tools/stdnames_to_inputnames_dictionary.xml @@ -196,7 +196,7 @@ state_tw_cur - + cp_or_cv_dycore From fb44c3fb1c70b5114d98a47b0f028956ce838412 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 13 May 2026 07:14:58 -0400 Subject: [PATCH 2/6] Registry formatting fix - no linebreaks. Fill in CAM tag 173 --- src/data/registry.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/data/registry.xml b/src/data/registry.xml index 6b33309a3..fadcc1f46 100644 --- a/src/data/registry.xml +++ b/src/data/registry.xml @@ -583,12 +583,10 @@ standard_name="specific_heat_of_air_used_in_dycore_at_start_of_physics_timestep" units="J kg-1 K-1" type="real" kind="kind_phys" allocatable="allocatable"> - Specific heat of air used in the dynamical core (enthalpy for - pressure-based dynamical cores and internal energy for z-based - dynamical cores), at start of physics timestep, for energy-consistency scaling and energy checker + Specific heat of air used in the dynamical core (enthalpy for pressure-based dynamical cores and internal energy for z-based dynamical cores), at start of physics timestep, for energy-consistency scaling and energy checker horizontal_dimension vertical_layer_dimension From e029fa0d6ab614a194ec194ea06a12cbf0453213 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 13 May 2026 16:31:44 -0400 Subject: [PATCH 3/6] Update src/dynamics/mpas/dyn_coupling_impl.F90 Co-authored-by: Kuan-Chih Wang --- src/dynamics/mpas/dyn_coupling_impl.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dynamics/mpas/dyn_coupling_impl.F90 b/src/dynamics/mpas/dyn_coupling_impl.F90 index 4970ba374..4028fa38e 100644 --- a/src/dynamics/mpas/dyn_coupling_impl.F90 +++ b/src/dynamics/mpas/dyn_coupling_impl.F90 @@ -507,7 +507,8 @@ subroutine set_physics_state_external() use dyn_comp, only: advected_constituent_index, mpas_dynamical_core use dyn_procedures, only: exner_function use dynconst, only: constant_g => gravit - use physics_types, only: cappav, cp_or_cv_dycore, cp_or_cv_dycore_at_start_of_physics_timestep, cpairv, lagrangian_vertical, phys_state, rairv, zvirv + use physics_types, only: cappav, cp_or_cv_dycore, cp_or_cv_dycore_at_start_of_physics_timestep, & + cpairv, lagrangian_vertical, phys_state, rairv, zvirv use runtime_obj, only: cam_runtime_opts use string_utils, only: stringify use vert_coord, only: pver, pverp From ce13b60e1efa0daf39fd27f1ead2a0fc0f31281d Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 13 May 2026 16:32:18 -0400 Subject: [PATCH 4/6] Update src/dynamics/mpas/dyn_coupling_impl.F90 Co-authored-by: Kuan-Chih Wang --- src/dynamics/mpas/dyn_coupling_impl.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamics/mpas/dyn_coupling_impl.F90 b/src/dynamics/mpas/dyn_coupling_impl.F90 index 4028fa38e..b6247ce90 100644 --- a/src/dynamics/mpas/dyn_coupling_impl.F90 +++ b/src/dynamics/mpas/dyn_coupling_impl.F90 @@ -566,7 +566,7 @@ subroutine set_physics_state_external() call cam_thermo_water_update( & constituents, ncells_solve, pver, energy_formula_dycore_mpas, cp_or_cv_dycore) - cp_or_cv_dycore_at_start_of_physics_timestep(:ncells_solve, :) = cp_or_cv_dycore(:ncells_solve, :) + cp_or_cv_dycore_at_start_of_physics_timestep(:, :) = cp_or_cv_dycore(:, :) ! This variable name is really misleading. It actually represents the reciprocal of Exner function ! with respect to surface pressure. This definition is sometimes used for boundary layer work. See From dcae27061177ef3bb9f4399628f7c8d90712b21d Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 18 May 2026 11:37:10 -0400 Subject: [PATCH 5/6] Add specific_heat_of_air_used_in_dycore_at_start_of_physics_timestep to mark as initialized. --- src/dynamics/mpas/dyn_comp_impl.F90 | 1 + src/dynamics/none/dyn_grid.F90 | 1 + src/dynamics/se/dyn_comp.F90 | 1 + 3 files changed, 3 insertions(+) diff --git a/src/dynamics/mpas/dyn_comp_impl.F90 b/src/dynamics/mpas/dyn_comp_impl.F90 index f38c0e4e6..a11829832 100644 --- a/src/dynamics/mpas/dyn_comp_impl.F90 +++ b/src/dynamics/mpas/dyn_comp_impl.F90 @@ -1000,6 +1000,7 @@ subroutine mark_variables_as_initialized() call mark_as_initialized('reciprocal_of_air_pressure_thickness_of_dry_air') call mark_as_initialized('reciprocal_of_dimensionless_exner_function_wrt_surface_air_pressure') call mark_as_initialized('specific_heat_of_air_used_in_dycore') + call mark_as_initialized('specific_heat_of_air_used_in_dycore_at_start_of_physics_timestep') call mark_as_initialized('surface_air_pressure') call mark_as_initialized('surface_geopotential') call mark_as_initialized('surface_pressure_of_dry_air') diff --git a/src/dynamics/none/dyn_grid.F90 b/src/dynamics/none/dyn_grid.F90 index 64cc20b8b..3130eb6cb 100644 --- a/src/dynamics/none/dyn_grid.F90 +++ b/src/dynamics/none/dyn_grid.F90 @@ -721,6 +721,7 @@ subroutine find_energy_formula(file, grid_is_latlon) ! Mark other energy variables calculated by check_energy_timestep_init ! here since it will always run when required call mark_as_initialized("specific_heat_of_air_used_in_dycore") + call mark_as_initialized("specific_heat_of_air_used_in_dycore_at_start_of_physics_timestep") call mark_as_initialized("vertically_integrated_total_energy_using_physics_energy_formula_at_start_of_physics_timestep") call mark_as_initialized("vertically_integrated_total_energy_using_physics_energy_formula") call mark_as_initialized("vertically_integrated_total_energy_using_dycore_energy_formula_at_start_of_physics_timestep") diff --git a/src/dynamics/se/dyn_comp.F90 b/src/dynamics/se/dyn_comp.F90 index 0f62eed41..1fac36667 100644 --- a/src/dynamics/se/dyn_comp.F90 +++ b/src/dynamics/se/dyn_comp.F90 @@ -1868,6 +1868,7 @@ subroutine read_inidat(dyn_in) call mark_as_initialized("tendency_of_eastward_wind_due_to_model_physics") call mark_as_initialized("tendency_of_northward_wind_due_to_model_physics") call mark_as_initialized("specific_heat_of_air_used_in_dycore") + call mark_as_initialized("specific_heat_of_air_used_in_dycore_at_start_of_physics_timestep") call mark_as_initialized("frontogenesis_function") call mark_as_initialized("frontogenesis_angle") call mark_as_initialized("relative_vorticity") From 43f19d56c5c4f0068548046b62d16ceb6ab65050 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 18 May 2026 12:12:25 -0400 Subject: [PATCH 6/6] Update atmos_phys hash. --- .gitmodules | 2 +- src/physics/ncar_ccpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index d84a6b258..7dcc83adb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,7 +20,7 @@ [submodule "ncar-physics"] path = src/physics/ncar_ccpp url = https://github.com/ESCOMP/atmospheric_physics - fxtag = e773e048679df7057855d446fba24c658de33462 + fxtag = 26f4f553da47fc4b347f0ee80ea1041dd0da7988 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics [submodule "rrtmgp-data"] diff --git a/src/physics/ncar_ccpp b/src/physics/ncar_ccpp index e773e0486..26f4f553d 160000 --- a/src/physics/ncar_ccpp +++ b/src/physics/ncar_ccpp @@ -1 +1 @@ -Subproject commit e773e048679df7057855d446fba24c658de33462 +Subproject commit 26f4f553da47fc4b347f0ee80ea1041dd0da7988