Skip to content

Commit

Permalink
Merge pull request ESCOMP#1180 from jimmielin/hplin/check_energy
Browse files Browse the repository at this point in the history
cam6_4_050:  Implement CCPPized check_energy_chng and check_energy_fix
  • Loading branch information
jimmielin authored Dec 31, 2024
2 parents 95cbd6d + b7b4c3c commit b4c6463
Show file tree
Hide file tree
Showing 13 changed files with 573 additions and 532 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
[submodule "atmos_phys"]
path = src/atmos_phys
url = https://github.com/ESCOMP/atmospheric_physics
fxtag = atmos_phys0_06_000
fxtag = atmos_phys0_07_001
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics

Expand Down
1 change: 1 addition & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2341,6 +2341,7 @@ sub write_filepath
print $fh "$camsrcdir/src/atmos_phys/schemes/tropopause_find\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/zhang_mcfarlane\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/dry_adiabatic_adjust\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/check_energy\n";
print $fh "$camsrcdir/src/atmos_phys/schemes/utilities\n";

# Dynamics package and test utilities
Expand Down
76 changes: 76 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
===============================================================
Tag name: cam6_4_050
Originator(s): jimmielin
Date: 31 Dec 2024
One-line Summary: Implement CCPPized check_energy_chng and check_energy_fix
Github PR URL: https://github.com/ESCOMP/CAM/pull/1180

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
- CCPPize check_energy_chng and check_energy_fix (https://github.com/ESCOMP/CAM/issues/1138)
CAM interfaces have been kept in check_energy.F90 instead of a new module because check_tracers is not yet CCPPized, there are other non-CCPPized routines in module, and for compatibility with FV3 external calls
- Save air_composition cp_or_cv_dycore into state snapshot
- Separate out "energy_formula_physics"/"energy_formula_dycore" definitions used in get_hydrostatic_energy from dyn_tests_utils "vcoord" for an eventual change in SIMA.

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by: nusbaume, cacraigucar

List all files eliminated: N/A

List all files added and what they do:
- separate out energy formula definitions used in get_hydrostatic_energy from dyn_tests_utils "vcoord"
A src/utils/cam_thermo_formula.F90

List all existing files that have been modified, and describe the changes:

Update atmos_phys external with CCPPized check_energy
M .gitmodules
M bld/configure
M src/atmos_phys

Save cp_or_cv_dycore in state snapshot
M src/control/cam_snapshot_common.F90

New CAM interfaces to CCPPized routines, when available
M src/physics/cam/check_energy.F90

Update calls to CCPPized routines, when available
M src/physics/cam/physpkg.F90
M src/physics/cam/zm_conv_intr.F90
M src/physics/cam7/physpkg.F90
M src/physics/simple/physpkg.F90
M src/physics/spcam/crm_physics.F90
M src/physics/spcam/spcam_drivers.F90

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:

SMS_D_Ln9.f19_f19_mg17.FXHIST.derecho_intel.cam-outfrq9s_amie (Overall: FAIL)
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL)
- pre-existing failures due to build-namelist error requiring CLM/CTSM external update.

ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL)
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: PASS)
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856

derecho/nvhpc/aux_cam: All PASS

izumi/nag/aux_cam:

DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL)
- pre-existing failure -- issue #670

izumi/gnu/aux_cam: All PASS

Summarize any changes to answers: B4B

===============================================================

Tag name: cam6_4_049
Expand Down
2 changes: 1 addition & 1 deletion src/atmos_phys
Submodule atmos_phys updated 81 files
+72 −0 .github/workflows/unit-tests.yaml
+7 −0 .gitignore
+72 −0 doc/ChangeLog
+212 −89 doc/NamesNotInDictionary.txt
+420 −0 schemes/check_energy/check_energy_chng.F90
+413 −0 schemes/check_energy/check_energy_chng.meta
+19 −0 schemes/check_energy/check_energy_chng_namelist.xml
+48 −0 schemes/check_energy/check_energy_fix.F90
+67 −0 schemes/check_energy/check_energy_fix.meta
+77 −0 schemes/check_energy/check_energy_gmean/check_energy_gmean.F90
+98 −0 schemes/check_energy/check_energy_gmean/check_energy_gmean.meta
+37 −0 schemes/check_energy/check_energy_save_teout.F90
+37 −0 schemes/check_energy/check_energy_save_teout.meta
+42 −0 schemes/check_energy/check_energy_scaling.F90
+43 −0 schemes/check_energy/check_energy_scaling.meta
+39 −0 schemes/check_energy/check_energy_zero_fluxes.F90
+55 −0 schemes/check_energy/check_energy_zero_fluxes.meta
+52 −0 schemes/check_energy/dycore_energy_consistency_adjust.F90
+55 −0 schemes/check_energy/dycore_energy_consistency_adjust.meta
+1 −0 schemes/dry_adiabatic_adjust/dadadj.meta
+0 −33 schemes/dry_adiabatic_adjust/dadadj_apply_qv_tendency.F90
+0 −42 schemes/dry_adiabatic_adjust/dadadj_apply_qv_tendency.meta
+1 −1 schemes/held_suarez/held_suarez_1994.meta
+36 −32 schemes/musica/micm/musica_ccpp_micm.F90
+1 −71 schemes/musica/micm/musica_ccpp_micm_util.F90
+110 −70 schemes/musica/musica_ccpp.F90
+90 −8 schemes/musica/musica_ccpp.meta
+27 −3 schemes/musica/musica_ccpp_namelist.xml
+5 −0 schemes/musica/musica_ccpp_util.F90
+420 −109 schemes/musica/tuvx/musica_ccpp_tuvx.F90
+127 −0 schemes/musica/tuvx/musica_ccpp_tuvx_cloud_optics.F90
+110 −0 schemes/musica/tuvx/musica_ccpp_tuvx_extraterrestrial_flux.F90
+75 −0 schemes/musica/tuvx/musica_ccpp_tuvx_surface_albedo.F90
+3 −4 schemes/musica/tuvx/musica_ccpp_tuvx_temperature.F90
+62 −0 schemes/musica/tuvx/musica_ccpp_tuvx_wavelength_grid.F90
+86 −0 schemes/sima_diagnostics/check_energy_diagnostics.F90
+83 −0 schemes/sima_diagnostics/check_energy_diagnostics.meta
+61 −0 schemes/sima_diagnostics/check_energy_gmean_diagnostics.F90
+59 −0 schemes/sima_diagnostics/check_energy_gmean_diagnostics.meta
+19 −0 schemes/sima_diagnostics/check_energy_gmean_diagnostics_namelist.xml
+3 −3 schemes/tj2016/tj2016_sfc_pbl_hs.meta
+5 −5 schemes/tropopause_find/tropopause_find.meta
+38 −4 schemes/utilities/physics_tendency_updaters.F90
+53 −4 schemes/utilities/physics_tendency_updaters.meta
+1 −1 schemes/utilities/state_converters.meta
+30 −0 suites/suite_adiabatic.xml
+29 −2 suites/suite_cam7.xml
+21 −0 suites/suite_kessler.xml
+22 −0 suites/suite_tj2016.xml
+12 −10 test/CMakeLists.txt
+29 −27 test/docker/Dockerfile.musica
+18 −15 test/docker/Dockerfile.musica.no_install
+14 −11 test/musica/CMakeLists.txt
+0 −6 test/musica/micm/configs/chapman/config.json
+0 −97 test/musica/micm/configs/chapman/reactions.json
+0 −39 test/musica/micm/configs/chapman/species.json
+11 −74 test/musica/micm/test_micm_util.F90
+4 −3 test/musica/musica_ccpp_namelist.F90
+502 −49 test/musica/test_musica_api.F90
+119 −1 test/musica/tuvx/CMakeLists.txt
+0 −2,077 test/musica/tuvx/configs/ts1_tsmlt.json
+115 −0 test/musica/tuvx/test_tuvx_cloud_optics.F90
+67 −0 test/musica/tuvx/test_tuvx_extraterrestrial_flux.F90
+39 −41 test/musica/tuvx/test_tuvx_height_grid.F90
+57 −0 test/musica/tuvx/test_tuvx_surface_albedo.F90
+19 −23 test/musica/tuvx/test_tuvx_temperature.F90
+53 −0 test/musica/tuvx/test_tuvx_wavelength_grid.F90
+155 −0 test/test_schemes/initialize_constituents.F90
+44 −0 test/test_schemes/initialize_constituents.meta
+1 −1 test/test_suites/suite_dry_adiabatic_adjust.xml
+2 −0 test/test_suites/suite_tj2016_precip.xml
+2 −0 test/test_suites/suite_tj2016_sfc_pbl_hs.xml
+39 −0 test/unit-test/CMakeLists.txt
+26 −0 test/unit-test/README.md
+11 −0 test/unit-test/include/ccpp_kinds.F90
+2 −0 test/unit-test/tests/CMakeLists.txt
+5 −0 test/unit-test/tests/utilities/CMakeLists.txt
+27 −0 test/unit-test/tests/utilities/test_state_converters.pf
+43 −0 test/valgrind.supp
+5 −5 to_be_ccppized/ccpp_const_utils.F90
+91 −0 to_be_ccppized/ccpp_tuvx_utils.F90
11 changes: 10 additions & 1 deletion src/control/cam_snapshot_common.F90
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module cam_snapshot_common
integer :: cam_snapshot_before_num, cam_snapshot_after_num

! Note the maximum number of variables for each type
type (snapshot_type) :: state_snapshot(29)
type (snapshot_type) :: state_snapshot(30)
type (snapshot_type) :: cnst_snapshot(pcnst)
type (snapshot_type) :: tend_snapshot(6)
type (snapshot_type) :: cam_in_snapshot(30)
Expand Down Expand Up @@ -283,6 +283,9 @@ subroutine cam_state_snapshot_init(cam_snapshot_before_num_in, cam_snapshot_afte
call snapshot_addfld( nstate_var, state_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
'state%te_cur_dyn', 'state_te_cur_dyn', 'unset', horiz_only)

call snapshot_addfld( nstate_var, state_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, &
'air_composition_cp_or_cv_dycore', 'cp_or_cv_dycore', 'J kg-1 K-1', 'lev')

end subroutine cam_state_snapshot_init

subroutine cam_cnst_snapshot_init(cam_snapshot_before_num, cam_snapshot_after_num)
Expand Down Expand Up @@ -741,6 +744,7 @@ end subroutine snapshot_addfld
subroutine state_snapshot_all_outfld(lchnk, file_num, state)

use physics_types, only: phys_te_idx, dyn_te_idx
use air_composition, only: cp_or_cv_dycore

integer, intent(in) :: lchnk
integer, intent(in) :: file_num
Expand Down Expand Up @@ -843,6 +847,11 @@ subroutine state_snapshot_all_outfld(lchnk, file_num, state)
case ('state%te_cur_dyn')
call outfld(state_snapshot(i)%standard_name, state%te_cur(:, dyn_te_idx), pcols, lchnk)

case ('air_composition_cp_or_cv_dycore')
! this field is not part of physics state (it is in air_composition)
! but describes the atmospheric thermodynamic state and thus saved within the snapshot
call outfld(state_snapshot(i)%standard_name, cp_or_cv_dycore(:,:,lchnk), pcols, lchnk)

case default
call endrun('ERROR in state_snapshot_all_outfld: no match found for '//trim(state_snapshot(i)%ddt_string))

Expand Down
Loading

0 comments on commit b4c6463

Please sign in to comment.