Skip to content

Commit 51a30e7

Browse files
committed
Merge branch 'development' into develop/implement-dyn-run
2 parents 8133144 + 623ef7b commit 51a30e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+8918
-2790
lines changed

.gitmodules

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
[submodule "ccpp-framework"]
22
path = ccpp_framework
33
url = https://github.com/NCAR/ccpp-framework
4-
fxtag = 2024-07-19-dev
4+
fxtag = 2024-10-31-dev
55
fxrequired = AlwaysRequired
6-
fxDONOTUSEurl = https://github.com/NCAR/ccpp-framework
6+
fxDONOTUSEurl = https://github.com/NCAR/ccpp-framework
7+
[submodule "history"]
8+
path = src/history/buffers
9+
url = https://github.com/ESMCI/history_output
10+
fxtag = history01_00
11+
fxrequired = AlwaysRequired
12+
fxDONOTUSEurl = https://github.com/ESMCI/history_output
713
[submodule "mpas"]
814
path = src/dynamics/mpas/dycore
915
url = https://github.com/MPAS-Dev/MPAS-Model.git
@@ -13,8 +19,8 @@
1319
fxDONOTUSEurl = https://github.com/MPAS-Dev/MPAS-Model.git
1420
[submodule "ncar-physics"]
1521
path = src/physics/ncar_ccpp
16-
url = https://github.com/ESCOMP/atmospheric_physics
17-
fxtag = 098585940ad763be58ebab849bb8eaf325fda42a
22+
url = https://github.com/ESCOMP/atmospheric_physics
23+
fxtag = atmos_phys0_06_000
1824
fxrequired = AlwaysRequired
1925
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
2026
[submodule "ccs_config"]

ccpp_framework

Submodule ccpp_framework updated 46 files

cime_config/atm_in_paramgen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,8 @@ def append_user_nl_file(self, user_nl_file):
14471447
#Notify loop to check the next line for a comma:
14481448
is_continue_line = False
14491449
#End if
1450-
1451-
else:
1450+
elif ('hist_' not in line_s[0]):
1451+
#Raise parsing error; ignore hist lines to be processed by hist_config.py
14521452
emsg = "Cannot parse the following line in '{}' :\n'{}'"
14531453
raise AtmInParamGenError(emsg.format(user_nl_file, line))
14541454
#End if ("=" sign check)

cime_config/buildlib

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def _build_cam():
9797
case.get_value("COMP_INTERFACE")),
9898
os.path.join(atm_root, "src", "dynamics", "utils"),
9999
os.path.join(atm_root, "src", "physics", "utils"),
100+
os.path.join(atm_root, "src", "history"),
101+
os.path.join(atm_root, "src", "history", "buffers", "src"),
102+
os.path.join(atm_root, "src", "history", "buffers", "src", "hash"),
103+
os.path.join(atm_root, "src", "history", "buffers", "src", "util"),
100104
os.path.join(atm_root, "src", "utils")]
101105
for path in phys_dirs:
102106
if path not in paths:

cime_config/buildnml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CAM namelist creator
55
"""
66
import sys
77
import os
8+
import re
89
import shutil
910
import logging
1011
import glob
@@ -31,6 +32,8 @@ sys.path.append(_CIME_CONFIG_PATH)
3132

3233
# Import CAM's configure structure:
3334
from cam_config import ConfigCAM
35+
# HistoryConfig allows translation from user_nl_cam into Fortran namelists
36+
from hist_config import HistoryConfig
3437

3538
#Import CAM's ParamGen class:
3639
from atm_in_paramgen import AtmInParamGen
@@ -51,6 +54,7 @@ class CamBuildnmlError(ValueError):
5154
# This simplifies the filename mangling for different cases.
5255
def _create_ic_filename(inst_string, i_or_r,
5356
run_refcase, run_refdate, run_reftod):
57+
"""Simplify the filename mangling for different cases."""
5458
return f"{run_refcase}.cam{inst_string}.{i_or_r}.{run_refdate}-{run_reftod}.nc"
5559

5660
##################
@@ -297,7 +301,8 @@ def buildnml(case, caseroot, compname):
297301
# End if
298302

299303
# Determine location and name of "user_nl_cam" files:
300-
user_nl_file = os.path.join(caseroot, "user_nl_cam" + inst_string)
304+
user_nl_fname = "user_nl_cam" + inst_string
305+
user_nl_file = os.path.join(caseroot, user_nl_fname)
301306

302307
# Check that file actually exists. If not then throw an error:
303308
if not os.path.exists(user_nl_file):
@@ -362,6 +367,16 @@ def buildnml(case, caseroot, compname):
362367
# Create CAM namelist using CIME's nmlgen routine:
363368
pg_atm.write(namelist_file)
364369

370+
# Add history namelists to atm_in
371+
hist_configs = HistoryConfig(filename=user_nl_file, logger=_LOGGER)
372+
with open(namelist_file, 'a', encoding='utf-8') as nl_file:
373+
hist_configs.output_class_namelist(nl_file)
374+
for key in sorted(hist_configs.keys()):
375+
hist_configs[key].output_config_namelist(nl_file, logger=_LOGGER)
376+
# end for
377+
# end with
378+
379+
365380
###############################################################################
366381
def _main_func():
367382

cime_config/cam_autogen.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,22 +435,31 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
435435
if not os.path.exists(physics_blddir):
436436
os.makedirs(physics_blddir)
437437
# End if
438-
# Collect all source directories
439-
atm_phys_src_dir = os.path.join(atm_root, "src", "physics", "ncar_ccpp")
440-
source_search = [source_mods_dir, atm_phys_src_dir]
441-
# Find all metadata files, organize by scheme name
438+
# Set top-level CCPP physics directory
439+
atm_phys_top_dir = os.path.join(atm_root, "src", "physics", "ncar_ccpp")
440+
# Collect all possible Suite Definition File (SDF) locations
441+
atm_suites_path = os.path.join(atm_phys_top_dir, "suites")
442+
atm_test_suites_path = os.path.join(atm_phys_top_dir, "test", "test_suites")
443+
suite_search = [source_mods_dir, atm_suites_path, atm_test_suites_path]
444+
# Find all scheme metadata files, organized by scheme name
445+
atm_schemes_path = os.path.join(atm_phys_top_dir, "schemes")
446+
source_search = [source_mods_dir, atm_schemes_path]
442447
all_scheme_files = _find_metadata_files(source_search, find_scheme_names)
443448

444449
# Find the SDFs specified for this model build
445450
sdfs = []
446451
scheme_files = []
447452
xml_files = {} # key is scheme, value is xml file path
448453
for sdf in phys_suites_str.split(';'):
449-
sdf_path = _find_file(f"suite_{sdf}.xml", source_search)
454+
sdf_path = _find_file(f"suite_{sdf}.xml", suite_search)
450455
if not sdf_path:
451456
emsg = f"ERROR: Unable to find SDF for suite '{sdf}'"
452457
raise CamAutoGenError(emsg)
453458
# End if
459+
if os.path.dirname(os.path.abspath(sdf_path)) == atm_test_suites_path:
460+
#Notify user that a test suite is being used
461+
_LOGGER.info("Using non-standard test suite: %s", sdf)
462+
# End if
454463
sdfs.append(sdf_path)
455464
# Given an SDF, find all the schemes it calls
456465
_, suite = read_xml_file(sdf_path)
@@ -587,13 +596,13 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
587596
# there to the bld directory:
588597
if do_gen_ccpp:
589598
# Set CCPP physics "utilities" path
590-
atm_phys_util_dir = os.path.join(atm_phys_src_dir, "utilities")
599+
atm_phys_util_dir = os.path.join(atm_schemes_path, "utilities")
591600

592601
# Check that directory exists
593602
if not os.path.isdir(atm_phys_util_dir):
594-
#CAM-SIMA will likely not run without this, so raise an error
603+
# CAM-SIMA will likely not run without this, so raise an error
595604
emsg = "ERROR: Unable to find CCPP physics utilities directory:\n"
596-
emsg += f" {atm_phys_util_dir}\n Have you run 'checkout_externals'?"
605+
emsg += f" {atm_phys_util_dir}\n Have you run 'git-fleximod'?"
597606
raise CamAutoGenError(emsg)
598607
# end if
599608

@@ -602,6 +611,25 @@ def generate_physics_suites(build_cache, preproc_defs, host_name,
602611
for util_file in atm_phys_util_files:
603612
shutil.copy(util_file, physics_blddir)
604613
# end for
614+
615+
# Copy to_be_ccppized utility modules to the build directory,
616+
# as SIMA cam_constituents depends on them.
617+
# Note: to_be_ccppized utility modules to be removed once functionality is migrated
618+
# to SIMA or CCPPized in atmospheric_physics.
619+
atm_phys_to_be_ccppized_dir = os.path.join(atm_phys_top_dir, "to_be_ccppized")
620+
621+
# Check that the directory exists
622+
if not os.path.isdir(atm_phys_to_be_ccppized_dir):
623+
# CAM-SIMA will likely not run without this, so raise an error
624+
emsg = "ERROR: Unable to find CCPP physics to_be_ccppized directory:\n"
625+
emsg += f" {atm_phys_to_be_ccppized_dir}\n Have you run 'git-fleximod'?"
626+
raise CamAutoGenError(emsg)
627+
# end if
628+
629+
atm_phys_to_be_ccppized_files = glob.glob(os.path.join(atm_phys_to_be_ccppized_dir, "*.F90"))
630+
for to_be_ccppized_file in atm_phys_to_be_ccppized_files:
631+
shutil.copy(to_be_ccppized_file, physics_blddir)
632+
# end for
605633
# end if
606634

607635
if do_gen_ccpp or do_gen_nl:

cime_config/config_component.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,10 @@
159159
<value compset="_CAM\d0%WX.*%SDYN">-nlev 145</value> -->
160160

161161
<!-- Simple models -->
162-
<!-- <value compset="_CAM%HS94" grid="(%ne[0-9])|(%[0-9.]+x)">-analytic_ic</value>
163-
<value compset="_CAM%ADIAB">-phys adiabatic</value>
164-
<value compset="_CAM%DABIP04">-phys adiabatic</value>
165-
<value compset="_CAM%TJ16">-phys tj2016 -analytic_ic</value>
166-
<value compset="_CAM%HS94">-phys held_suarez</value>
167-
<value compset="_CAM%KESSLER">-phys kessler -chem terminator -analytic_ic</value> -->
162+
<!-- <value compset="_CAM%ADIAB">-phys adiabatic</value>
163+
<value compset="_CAM%DABIP04">-phys adiabatic</value> -->
164+
<value compset="_CAM%TJ16">--physics-suites tj2016 --analytic_ic</value>
165+
<!-- <value compset="_CAM%KESSLER">-phys kessler -chem terminator -analytic_ic</value> -->
168166
<value compset="_CAM%KESSLER">--physics-suites kessler --analytic_ic</value>
169167
<value compset="_CAM%HS94">--physics-suites held_suarez_1994 --analytic_ic</value>
170168
<value compset="_CAM%PHYSTEST">--dyn none --physics-suites adiabatic</value>

0 commit comments

Comments
 (0)