Skip to content

Commit f12572e

Browse files
committed
Have the MUSICA build key off the presences of the 'musica_ccpp' scheme in the SDF.
1 parent f2174c9 commit f12572e

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

cime_config/atm_musica_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
and install the MUSICA library, as well as to download the MUSICA configuration."
44
"""
55

6+
MUSICA_CCPP_SCHEME_NAME = "musica_ccpp"
67
MUSICA_REPO_URL = "https://github.com/NCAR/musica.git"
78
MUSICA_TAG = "cc39bb00d2220fc81c85b22d3ceea4a39bd2bacf"
89
CHEMISTRY_DATA_REPO_URL = "https://github.com/NCAR/cam-sima-chemistry-data.git"

cime_config/buildlib

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import subprocess
1212
import logging
1313

1414
from cam_config import ConfigCAM # CAM's configure structure
15+
from atm_musica_config import MUSICA_CCPP_SCHEME_NAME
1516
from atm_musica_config import MUSICA_REPO_URL, MUSICA_TAG
1617
from atm_musica_config import CHEMISTRY_DATA_REPO_URL, CHEMISTRY_DATA_TAG
1718

@@ -76,7 +77,7 @@ def _build_cam():
7677
# Re-run source generator in case registry, CCPP suites, or
7778
# generator scripts have been modified, and
7879
# to extract required source code paths:
79-
config.generate_cam_src(gen_indent)
80+
scheme_names = config.generate_cam_src(gen_indent)
8081

8182
dycore = config.get_value('dyn')
8283
phys_suites = config.get_value('physics_suites')
@@ -173,7 +174,7 @@ def _build_cam():
173174
cmd += " OPTIONAL_MPAS_FEATURES=\"" + " ".join(optional_mpas_features) + "\""
174175

175176
# If the physics suite is MUSICA, build the MUSICA library and get configuration
176-
if phys_suites == "musica":
177+
if MUSICA_CCPP_SCHEME_NAME in scheme_names:
177178
_build_musica_library(case)
178179
_download_musica_configuration(caseroot)
179180

cime_config/buildnml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def buildnml(case, caseroot, compname):
166166
gen_indent = 3
167167

168168
#Generate model code and meta-data:
169-
config.generate_cam_src(gen_indent)
169+
_ = config.generate_cam_src(gen_indent)
170170

171171
#----------------------------------------------------------------
172172
# Create namelist attribute dictionary (to set namelist defaults):

cime_config/cam_autogen.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
452452
# Find the SDFs specified for this model build
453453
sdfs = []
454454
scheme_files = []
455+
scheme_names = set()
455456
xml_files = {} # key is scheme, value is xml file path
456457
for sdf in phys_suites_str.split(';'):
457458
sdf_path = _find_file(f"suite_{sdf}.xml", suite_search)
@@ -467,6 +468,8 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
467468
# Given an SDF, find all the schemes it calls
468469
_, suite = read_xml_file(sdf_path)
469470
sdf_schemes = _find_schemes_in_sdf(suite)
471+
#Add schemes to set of all scheme names:
472+
scheme_names.update(sdf_schemes)
470473
# For each scheme, find its metadata file
471474
for scheme in sdf_schemes:
472475
if scheme in all_scheme_files:
@@ -655,7 +658,7 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
655658
# End if
656659

657660
return [physics_blddir, genccpp_dir], do_gen_ccpp, cap_output_file, \
658-
xml_files.values(), capgen_db
661+
xml_files.values(), capgen_db, scheme_names
659662

660663
###############################################################################
661664
def generate_init_routines(build_cache, bldroot, force_ccpp, force_init,

cime_config/cam_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ def generate_cam_src(self, gen_fort_indent):
868868
self.__atm_root, self.__bldroot,
869869
reg_dir, reg_files, source_mods_dir,
870870
force_ccpp)
871-
phys_dirs, force_init, _, nml_fils, capgen_db = retvals
871+
phys_dirs, force_init, _, nml_fils, capgen_db, scheme_names = retvals
872872

873873
# Add namelist definition files to dictionary:
874874
for nml_fil in nml_fils:
@@ -899,6 +899,9 @@ def generate_cam_src(self, gen_fort_indent):
899899
#--------------------------------------------------------------
900900
build_cache.write()
901901

902+
#Return the set of all scheme names present in the SDFs:
903+
return scheme_names
904+
902905
#++++++++++++++++++++++++
903906

904907
def ccpp_phys_set(self, cam_nml_attr_dict, phys_nl_pg_dict):

test/unit/python/test_cam_autogen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def test_generate_physics_suites(self):
580580
expected_results = ([f'{self.test_bldroot}'+os.sep+'ccpp_physics',
581581
f'{self.test_bldroot}'+os.sep+'ccpp'], False,
582582
f'{self.test_bldroot}'+os.sep+'ccpp'+os.sep+'ccpp_datatable.xml',
583-
[], None)
583+
[], None, {"temp_adjust"})
584584

585585
#Run physics suite generation function:
586586
gen_results = generate_physics_suites(self.test_cache, "UNSET", "cam", "simple",

0 commit comments

Comments
 (0)