Skip to content

Commit

Permalink
Merge branch 'development' into hplin/check_energy_rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmielin committed Dec 10, 2024
2 parents 6105ca8 + edf84cd commit cca6e42
Show file tree
Hide file tree
Showing 83 changed files with 3,494 additions and 1,413 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "ccpp-framework"]
path = ccpp_framework
url = https://github.com/NCAR/ccpp-framework
fxtag = 2024-07-19-dev
fxtag = 2024-11-07-dev
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/NCAR/ccpp-framework
[submodule "history"]
Expand All @@ -19,8 +19,8 @@
fxDONOTUSEurl = https://github.com/MPAS-Dev/MPAS-Model.git
[submodule "ncar-physics"]
path = src/physics/ncar_ccpp
url = https://github.com/jimmielin/atmospheric_physics
fxtag = 7b188e35
url = https://github.com/ESCOMP/atmospheric_physics
fxtag = e7a599f4bb1533f7cdcd8723b1f864e11578e96c
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
[submodule "ccs_config"]
Expand Down
2 changes: 1 addition & 1 deletion ccpp_framework
Submodule ccpp_framework updated 64 files
+1 −1 .github/workflows/capgen_unit_tests.yaml
+3 −49 scripts/ccpp_capgen.py
+0 −65 scripts/ccpp_datafile.py
+4 −1 scripts/ccpp_state_machine.py
+15 −12 scripts/ccpp_suite.py
+1 −1 scripts/ccpp_track_variables.py
+26 −51 scripts/constituents.py
+143 −16 scripts/host_cap.py
+1 −10 scripts/metadata_table.py
+6 −4 scripts/metavar.py
+1 −1 scripts/parse_tools/parse_checkers.py
+26 −3 scripts/parse_tools/xml_tools.py
+125 −31 scripts/suite_objects.py
+36 −4 scripts/var_props.py
+49 −8 src/ccpp_constituent_prop_mod.F90
+17 −0 src/ccpp_constituent_prop_mod.meta
+45 −0 test/advection_test/CMakeLists.txt
+39 −0 test/advection_test/apply_constituent_tendencies.F90
+36 −0 test/advection_test/apply_constituent_tendencies.meta
+29 −26 test/advection_test/cld_ice.F90
+25 −1 test/advection_test/cld_ice.meta
+29 −25 test/advection_test/cld_liq.F90
+29 −6 test/advection_test/cld_liq.meta
+2 −0 test/advection_test/cld_suite.xml
+9 −0 test/advection_test/cld_suite_error.xml
+1 −0 test/advection_test/cld_suite_files.txt
+3 −0 test/advection_test/cld_suite_files_error.txt
+41 −0 test/advection_test/dlc_liq.F90
+29 −0 test/advection_test/dlc_liq.meta
+16 −6 test/advection_test/run_test
+151 −29 test/advection_test/test_host.F90
+1 −0 test/advection_test/test_host_data.F90
+17 −4 test/advection_test/test_reports.py
+2 −0 test/capgen_test/run_test
+22 −0 test/capgen_test/temp_adjust.F90
+24 −0 test/capgen_test/temp_adjust.meta
+10 −0 test/capgen_test/test_host.F90
+1 −0 test/capgen_test/test_host_mod.F90
+7 −1 test/capgen_test/test_host_mod.meta
+1 −0 test/capgen_test/test_reports.py
+0 −1 test/unit_tests/sample_files/test_host.meta
+0 −96 test/unit_tests/sample_scheme_files/duplicate_dyn_const.F90
+0 −104 test/unit_tests/sample_scheme_files/duplicate_dyn_const.meta
+0 −75 test/unit_tests/sample_scheme_files/dyn_const_not_present.F90
+0 −104 test/unit_tests/sample_scheme_files/dyn_const_not_present.meta
+0 −100 test/unit_tests/sample_scheme_files/dyn_const_not_present_nested.F90
+0 −104 test/unit_tests/sample_scheme_files/dyn_const_not_present_nested.meta
+21 −21 test/unit_tests/sample_scheme_files/temp_adjust.F90
+32 −1 test/unit_tests/sample_scheme_files/temp_adjust.meta
+5 −38 test/unit_tests/test_metadata_scheme_file.py
+0 −3 test/unit_tests/test_metadata_table.py
+46 −2 test/unit_tests/test_var_transforms.py
+42 −0 test/var_compatibility_test/effr_diag.F90
+31 −0 test/var_compatibility_test/effr_diag.meta
+34 −0 test/var_compatibility_test/effr_post.F90
+30 −0 test/var_compatibility_test/effr_post.meta
+34 −0 test/var_compatibility_test/effr_pre.F90
+30 −0 test/var_compatibility_test/effr_pre.meta
+2 −2 test/var_compatibility_test/run_test
+2 −1 test/var_compatibility_test/test_host.F90
+1 −1 test/var_compatibility_test/test_host.meta
+2 −1 test/var_compatibility_test/test_reports.py
+3 −0 test/var_compatibility_test/var_compatibility_files.txt
+3 −0 test/var_compatibility_test/var_compatibility_suite.xml
16 changes: 9 additions & 7 deletions cime_config/cam_autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def generate_registry(data_search, build_cache, atm_root, bldroot,
gen_fort_indent, source_mods_dir, atm_root,
logger=_LOGGER, schema_paths=data_search,
error_on_no_validate=True)
retcode, reg_file_list, ic_names = retvals
retcode, reg_file_list, ic_names, registry_constituents = retvals
# Raise error if gen_registry failed:
if retcode != 0:
emsg = "ERROR:Unable to generate CAM data structures from {}, err = {}"
Expand All @@ -406,14 +406,15 @@ def generate_registry(data_search, build_cache, atm_root, bldroot,
# Save build details in the build cache
reg_file_paths = [x.file_path for x in reg_file_list if x.file_path]
build_cache.update_registry(gen_reg_file, registry_files, dycore,
reg_file_paths, ic_names)
reg_file_paths, ic_names, registry_constituents)
else:
# If we did not run the registry generator, retrieve info from cache
reg_file_paths = build_cache.reg_file_list()
ic_names = build_cache.ic_names()
registry_constituents = build_cache.constituents()
# End if

return genreg_dir, do_gen_registry, reg_file_paths, ic_names
return genreg_dir, do_gen_registry, reg_file_paths, ic_names, registry_constituents

###############################################################################
def generate_physics_suites(build_cache, preproc_defs, host_name,
Expand Down Expand Up @@ -443,7 +444,8 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
suite_search = [source_mods_dir, atm_suites_path, atm_test_suites_path]
# Find all scheme metadata files, organized by scheme name
atm_schemes_path = os.path.join(atm_phys_top_dir, "schemes")
source_search = [source_mods_dir, atm_schemes_path]
atm_test_schemes_path = os.path.join(atm_phys_top_dir, "test", "test_schemes")
source_search = [source_mods_dir, atm_schemes_path, atm_test_schemes_path]
all_scheme_files = _find_metadata_files(source_search, find_scheme_names)

# Find the SDFs specified for this model build
Expand Down Expand Up @@ -657,7 +659,7 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
###############################################################################
def generate_init_routines(build_cache, bldroot, force_ccpp, force_init,
source_mods_dir, gen_fort_indent,
cap_database, ic_names):
cap_database, ic_names, registry_constituents):
###############################################################################
"""
Generate the host model initialization source code files
Expand Down Expand Up @@ -695,8 +697,8 @@ def generate_init_routines(build_cache, bldroot, force_ccpp, force_init,
# within write_init_files (so that write_init_files can be the place
# where the source include files are stored).
source_paths = [source_mods_dir, _REG_GEN_DIR]
retmsg = write_init_files(cap_database, ic_names, init_dir,
_find_file, source_paths,
retmsg = write_init_files(cap_database, ic_names, registry_constituents,
init_dir, _find_file, source_paths,
gen_fort_indent, _LOGGER)

#Check that script ran properly:
Expand Down
16 changes: 15 additions & 1 deletion cime_config/cam_build_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def __init__(self, build_cache):
self.__kind_types = {}
self.__reg_gen_files = []
self.__ic_names = {}
self.__constituents = []
if os.path.exists(build_cache):
# Initialize build cache state
_, cache = read_xml_file(build_cache)
Expand All @@ -252,6 +253,10 @@ def __init__(self, build_cache):
# end if
itext = clean_xml_text(item)
self.__ic_names[stdname].append(itext)
elif item.tag == 'constituent_entry':
stdname = item.get('standard_name')
itext = clean_xml_text(item)
self.__constituents.append(itext)
else:
emsg = "ERROR: Unknown registry tag, '{}'"
raise ValueError(emsg.format(item.tag))
Expand Down Expand Up @@ -313,7 +318,7 @@ def __init__(self, build_cache):
# end if

def update_registry(self, gen_reg_file, registry_source_files,
dycore, reg_file_list, ic_names):
dycore, reg_file_list, ic_names, constituents):
"""Replace the registry cache data with input data
"""
self.__dycore = dycore
Expand All @@ -328,6 +333,7 @@ def update_registry(self, gen_reg_file, registry_source_files,
# ic_names are the initial condition variable names from the registry,
# and should already be of type dict:
self.__ic_names = ic_names
self.__constituents = constituents

def update_ccpp(self, suite_definition_files, scheme_files, host_files,
xml_files, namelist_meta_files, namelist_groups,
Expand Down Expand Up @@ -400,6 +406,10 @@ def write(self):
ic_entry.text = ic_name
# end for
# end for
for stdname in self.__constituents:
const_entry = ET.SubElement(registry, 'constituent_entry')
const_entry.text = stdname
# end for
# CCPP
ccpp = ET.SubElement(new_cache, 'CCPP')
for sfile in self.__sdfs.values():
Expand Down Expand Up @@ -603,5 +613,9 @@ def ic_names(self):
"""Return a copy of the registry initial conditions dictionary"""
return dict(self.__ic_names)

def constituents(self):
"""Return a copy of the registry constituents list"""
return list(self.__constituents)

#############
# End of file
4 changes: 2 additions & 2 deletions cime_config/cam_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def generate_cam_src(self, gen_fort_indent):
retvals = generate_registry(data_search, build_cache, self.__atm_root,
self.__bldroot, source_mods_dir,
dyn, gen_fort_indent)
reg_dir, force_ccpp, reg_files, ic_names = retvals
reg_dir, force_ccpp, reg_files, ic_names, registry_constituents = retvals

#Add registry path to config object:
reg_dir_desc = "Location of auto-generated registry code."
Expand Down Expand Up @@ -871,7 +871,7 @@ def generate_cam_src(self, gen_fort_indent):
init_dir = generate_init_routines(build_cache, self.__bldroot,
force_ccpp, force_init,
source_mods_dir, gen_fort_indent,
capgen_db, ic_names)
capgen_db, ic_names, registry_constituents)

#Add registry path to config object:
init_dir_desc = "Location of auto-generated physics initialization code."
Expand Down
27 changes: 27 additions & 0 deletions cime_config/config_archive.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<components version="2.0">

<comp_archive_spec compname="cam" compclass="atm">
<rest_file_extension>r</rest_file_extension>
<rest_file_extension>rh\d*</rest_file_extension>
<rest_file_extension>rs</rest_file_extension>
<hist_file_extension>h\d*.*\.nc$</hist_file_extension>
<hist_file_extension>i\..*\.nc$</hist_file_extension>
<hist_file_extension>e</hist_file_extension>
<rest_history_varname>nhfil</rest_history_varname>
<rpointer>
<rpointer_file>rpointer.atm$NINST_STRING</rpointer_file>
<rpointer_content>$CASE.cam$NINST_STRING.r.$DATENAME.nc </rpointer_content>
</rpointer>
<test_file_names>
<tfile disposition="copy">rpointer.atm</tfile>
<tfile disposition="copy">rpointer.atm_9999</tfile>
<tfile disposition="copy">casename.cam.r.1976-01-01-00000.nc</tfile>
<tfile disposition="copy">casename.cam.rh4.1976-01-01-00000.nc</tfile>
<tfile disposition="move">casename.cam.h0.1976-01-01-00000.nc</tfile>
<tfile disposition="ignore">casename.cam.h0.1976-01-01-00000.nc.base</tfile>
<tfile disposition="move">casename.cam_0002.e.postassim.1976-01-01-00000.nc</tfile>
<tfile disposition="move">casename.cam_0002.e.preassim.1976-01-01-00000.nc</tfile>
<tfile disposition="move">casename.cam.i.1976-01-01-00000.nc</tfile>
</test_file_names>
</comp_archive_spec>
</components>
2 changes: 2 additions & 0 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
CAM
===============
-->
<desc atm="CAM70[%1PCT][%4xCO2][%CCTS][%CFIRE][%CVBSX][%PORT][%RCO2][%SCAM][%SDYN][%WCCM][%WCMD][%WCSC][%WCTS][%WXIE]">CAM cam7 physics:</desc>
<desc atm="CAM60[%1PCT][%4xCO2][%CCTS][%CFIRE][%CVBSX][%PORT][%RCO2][%SCAM][%SDYN][%WCCM][%WCMD][%WCSC][%WCTS][%WXIE]">CAM cam6 physics:</desc>
<desc atm="CAM50[%CCTS][%CLB][%PORT][%RCO2][%SCAM][%SDYN][%WCSC][%WCTS]" >CAM cam5 physics:</desc>
<desc atm="CAM40[%PORT][%RCO2][%SCAM][%SDYN][%TMOZ][%WXIE][%WXIED][%WCMD]" >CAM cam4 physics:</desc>
Expand Down Expand Up @@ -120,6 +121,7 @@
<valid_values></valid_values>
<default_value></default_value>
<values match="last" modifier='additive'>
<value compset="_CAM70">--physics-suites cam7</value>
<!-- <value compset="_CAM40">-phys cam4</value>
<value compset="_CAM50">-phys cam5</value>
<value compset="_CAM60">-phys cam6</value> -->
Expand Down
5 changes: 5 additions & 0 deletions cime_config/config_compsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
<!-- CAM tested compsets -->
<!-- ****************************** -->

<compset>
<alias>FCAM7</alias>
<lname>2000_CAM70_SLND_SICE_SOCN_SROF_SGLC_SWAV</lname>
</compset>

<compset>
<alias>F2010climo</alias>
<lname>2010_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV</lname>
Expand Down
37 changes: 37 additions & 0 deletions cime_config/config_pes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,43 @@
</pes>
</mach>
</grid>
<grid name="a%ne3np4">
<mach name="any">
<pes pesize="any" compset="any">
<comment>none</comment>
<ntasks>
<ntasks_atm>24</ntasks_atm>
<ntasks_lnd>24</ntasks_lnd>
<ntasks_rof>24</ntasks_rof>
<ntasks_ice>24</ntasks_ice>
<ntasks_ocn>24</ntasks_ocn>
<ntasks_glc>24</ntasks_glc>
<ntasks_wav>24</ntasks_wav>
<ntasks_cpl>24</ntasks_cpl>
</ntasks>
<nthrds>
<nthrds_atm>1</nthrds_atm>
<nthrds_lnd>1</nthrds_lnd>
<nthrds_rof>1</nthrds_rof>
<nthrds_ice>1</nthrds_ice>
<nthrds_ocn>1</nthrds_ocn>
<nthrds_glc>1</nthrds_glc>
<nthrds_wav>1</nthrds_wav>
<nthrds_cpl>1</nthrds_cpl>
</nthrds>
<rootpe>
<rootpe_atm>0</rootpe_atm>
<rootpe_lnd>0</rootpe_lnd>
<rootpe_rof>0</rootpe_rof>
<rootpe_ice>0</rootpe_ice>
<rootpe_ocn>0</rootpe_ocn>
<rootpe_glc>0</rootpe_glc>
<rootpe_wav>0</rootpe_wav>
<rootpe_cpl>0</rootpe_cpl>
</rootpe>
</pes>
</mach>
</grid>
<grid name="a%ne30" >
<mach name="any">
<pes pesize="any" compset="any">
Expand Down
21 changes: 20 additions & 1 deletion cime_config/namelist_definition_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@
<value hgrid="8x16" ic_ymd="10101" nlev="26">${DIN_LOC_ROOT}/atm/cam/inic/gaus/cami_0000-01-01_8x16_L26_c030228.nc</value>
<value hgrid="8x16" ic_ymd="901" nlev="26">${DIN_LOC_ROOT}/atm/cam/inic/gaus/cami_0000-09-01_8x16_L26_c030918.nc</value>
<value hgrid="8x16" ic_ymd="10101" nlev="30">${DIN_LOC_ROOT}/atm/cam/inic/gaus/cami_0000-01-01_8x16_L30_c090102.nc</value>
<value dyn="se" hgrid="ne3np4" nlev="93" chem="trop_strat_mam5_ts4">${DIN_LOC_ROOT}/atm/cam/inic/se/FCts4MTHIST_ne3pg3_spinup02.cam.i.1980-01-01_c240702.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="10101" nlev="32">${DIN_LOC_ROOT}/atm/cam/inic/se/cam6_QPC6_topo_ne3pg3_mg37_L32_01-01-31_c221214.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="901" nlev="32">${DIN_LOC_ROOT}/atm/cam/inic/se/CESM2.F2000climo.ne3np4.cam.i.0003-09-01-00000.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="901" nlev="32">${DIN_LOC_ROOT}/atm/cam/inic/se/CESM2.F2000climo.ne3np4.cam.i.0003-09-01-00000.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="10101" nlev="30">${DIN_LOC_ROOT}/atm/cam/inic/se/cami_0000-01-01_ne3np4_L30_c120315.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="901" nlev="30">${DIN_LOC_ROOT}/atm/cam/inic/se/cami_0000-01-01_ne3np4_L30_c120315.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="10101" nlev="26">${DIN_LOC_ROOT}/atm/cam/inic/se/cami_0000-01-01_ne3np4_L26_c120525.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="901" nlev="26">${DIN_LOC_ROOT}/atm/cam/inic/se/cami_0000-01-01_ne3np4_L26_c120525.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="10101" nlev="58">${DIN_LOC_ROOT}/atm/cam/inic/se/cam6_QPC6_topo_ne3pg3_mg37_L58_01-01-31_c221214.nc</value>
<value dyn="se" hgrid="ne3np4" ic_ymd="10101" nlev="93">${DIN_LOC_ROOT}/atm/cam/inic/se/cam6_FMTHIST_ne3pg3_mg37_L93_79-02-01_c240517.nc</value>
<value dyn="se" hgrid="ne5np4" ic_ymd="10101" nlev="30">${DIN_LOC_ROOT}/atm/cam/inic/homme/cami-mam3_0000-01_ne5np4_L30.140707.nc</value>
<value dyn="se" hgrid="ne16np4" ic_ymd="10101" nlev="26">${DIN_LOC_ROOT}/atm/cam/inic/se/ape_topo_cam4_ne16np4_L26_c171020.nc</value>
<value dyn="se" hgrid="ne16np4" ic_ymd="10101" nlev="30">${DIN_LOC_ROOT}/atm/cam/inic/se/ape_topo_cam4_ne16np4_L30_c171020.nc</value>
Expand Down Expand Up @@ -212,6 +217,7 @@
<value hgrid="2.5x3.33">${DIN_LOC_ROOT}/atm/cam/topo/USGS-gtopo30_2.5x3.33_remap_c100204.nc</value>
<value hgrid="4x5">${DIN_LOC_ROOT}/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc</value>
<value hgrid="10x15">${DIN_LOC_ROOT}/atm/cam/topo/fv_10x15_nc0540_Nsw042_Nrs008_Co060_Fi001_20171220.nc</value>
<value hgrid="ne3np4">${DIN_LOC_ROOT}/atm/cam/topo/se/ne3np4_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230717.nc</value>
<value hgrid="ne5np4">${DIN_LOC_ROOT}/atm/cam/topo/se/ne5np4_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170515.nc</value>
<value hgrid="ne16np4">${DIN_LOC_ROOT}/atm/cam/topo/se/ne16np4_nc3000_Co120_Fi001_PF_nullRR_Nsw084_20171012.nc</value>
<value hgrid="ne30np4">${DIN_LOC_ROOT}/atm/cam/topo/se/ne30np4_nc3000_Co060_Fi001_PF_nullRR_Nsw042_20171020.nc</value>
Expand All @@ -223,6 +229,7 @@
<value hgrid="ne60np4" npg="2">${DIN_LOC_ROOT}/atm/cam/topo/se/ne60pg2_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171014.nc</value>
<value hgrid="ne120np4" npg="2">${DIN_LOC_ROOT}/atm/cam/topo/se/ne120pg2_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171012.nc</value>
<value hgrid="ne240np4" npg="2">${DIN_LOC_ROOT}/atm/cam/topo/se/ne240pg2_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171014.nc</value>
<value hgrid="ne3np4" npg="3">${DIN_LOC_ROOT}/atm/cam/topo/se/ne3pg3_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230209.nc</value>
<value hgrid="ne5np4" npg="3">${DIN_LOC_ROOT}/atm/cam/topo/se/ne5pg3_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170516.nc</value>
<value hgrid="ne16np4" npg="3">${DIN_LOC_ROOT}/atm/cam/topo/se/ne16pg3_nc3000_Co120_Fi001_PF_nullRR_Nsw084_20171012.nc</value>
<value hgrid="ne30np4" npg="3">${DIN_LOC_ROOT}/atm/cam/topo/se/ne30pg3_nc3000_Co060_Fi001_PF_nullRR_Nsw042_20171014.nc</value>
Expand Down Expand Up @@ -256,6 +263,18 @@
<value>UNSET_PATH</value>
</values>
</entry>
<entry id="ncdata_check_err">
<type>logical</type>
<category>initial_conditions</category>
<group>physics_nl</group>
<desc>
Flag to determine whether to endrun if the ncdata check fails.
Default: FALSE
</desc>
<values>
<value>.false.</value>
</values>
</entry>
<entry id="min_difference">
<type>real</type>
<category>diagnostics</category>
Expand Down
Loading

0 comments on commit cca6e42

Please sign in to comment.