From 1ce3e524c1e63dd7b2d9781950ad7d8b2ebd36b8 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 23 Dec 2022 11:48:14 -0700 Subject: [PATCH 1/3] Update standard names and fix bugs to better match future external physics tag and standard names dict. --- cime_config/cam_config.py | 16 ++++---- src/data/air_composition.F90 | 12 +++--- src/data/namelist_definition_air_comp.xml | 48 +++++++++++------------ src/data/registry.xml | 18 ++++----- src/dynamics/se/dyn_comp.F90 | 12 +++--- 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/cime_config/cam_config.py b/cime_config/cam_config.py index a85d7e46..7a0f95f1 100644 --- a/cime_config/cam_config.py +++ b/cime_config/cam_config.py @@ -241,11 +241,17 @@ def __init__(self, case, case_log): # Save local (cime_config) directory path: cime_conf_path = os.path.dirname(os.path.abspath(__file__)) + # Save path to the "data" src direcotry: + data_nml_path = os.path.join(cime_conf_path, os.pardir, "src", "data") + # Create empty XML namelist definition files dictionary: self.__xml_nml_def_files = OrderedDict() - #Add the default host model namelist: - self._add_xml_nml_file(cime_conf_path, 'namelist_definition_cam.xml') + #Add the default host model namelists: + self._add_xml_nml_file(cime_conf_path, "namelist_definition_cam.xml") + self._add_xml_nml_file(data_nml_path, "namelist_definition_physconst.xml") + self._add_xml_nml_file(data_nml_path, "namelist_definition_air_comp.xml") + self._add_xml_nml_file(data_nml_path, "namelist_definition_ref_pres.xml") #---------------------------------------------------- # Set CAM start date (needed for namelist generation) @@ -342,16 +348,12 @@ def __init__(self, case, case_log): self.create_config("dyn_src_dirs", dyn_dirs_desc, ["se",os.path.join("se","dycore")], valid_list_type="str") - # Set paths for the SE dycore and "air composition" - # namelist definition files: + # Set paths for the SE dycore namelist definition file: se_dyn_nml_path = os.path.join(cime_conf_path, os.pardir, "src", "dynamics", "se") data_nml_path = os.path.join(cime_conf_path, os.pardir, "src", "data") #Add NML definition files to dictionary: self._add_xml_nml_file(se_dyn_nml_path, "namelist_definition_se_dycore.xml") - self._add_xml_nml_file(data_nml_path, "namelist_definition_air_comp.xml") - self._add_xml_nml_file(data_nml_path, "namelist_definition_physconst.xml") - self._add_xml_nml_file(data_nml_path, "namelist_definition_ref_pres.xml") # Add required CPP definitons: self.add_cppdef("_MPI") diff --git a/src/data/air_composition.F90 b/src/data/air_composition.F90 index 6b491ac1..3d87c950 100644 --- a/src/data/air_composition.F90 +++ b/src/data/air_composition.F90 @@ -485,7 +485,7 @@ subroutine air_composition_init() ! ! Q ! - case('water_vapor_specific_humidity') + case('specific_humidity') ! call air_species_info('Q', ix, mw) !!XXgoldyXX: this should be uncommented once constituents are enabled ix = ix_qv ! this should be removed once constituents are enabled mw = mwh2o !this should be removed once constituents are enabled @@ -497,7 +497,7 @@ subroutine air_composition_init() ! ! CLDLIQ ! - case('cloud_liquid_water_mixing_ratio_of_moist_air') + case('cloud_liquid_water_mixing_ratio_wrt_moist_air') ! call air_species_info('CLDLIQ', ix, mw) !!XXgoldyXX: this should be uncommented once constituents are enabled ix = ix_cld_liq ! this should be removed once constituents are enabled thermodynamic_active_species_idx(icnst) = ix @@ -510,7 +510,7 @@ subroutine air_composition_init() ! ! CLDICE ! - case('cloud_ice_mixing_ratio_of_moist_air') + case('cloud_ice_mixing_ratio_wrt_moist_air') ! call air_species_info('CLDICE', ix, mw) !!XXgoldyXX: this should be uncommented once constituents are enabled ix = -1 !!XXgoldyXX: Model should die if it gets here, until constituents are enabled thermodynamic_active_species_idx(icnst) = ix @@ -523,7 +523,7 @@ subroutine air_composition_init() ! ! RAINQM ! - case('rain_water_mixing_ratio') + case('rain_water_mixing_ratio_wrt_moist_air') ! call air_species_info('RAINQM', ix, mw) !!XXgoldyXX: this should be uncommented once constituents are enabled ix = ix_rain !!XXgoldyXX: this should be removed once constituents are enabled thermodynamic_active_species_idx(icnst) = ix @@ -536,7 +536,7 @@ subroutine air_composition_init() ! ! SNOWQM ! - case('snow_water_mixing_ratio') + case('snow_water_mixing_ratio_wrt_moist_air') ! call air_species_info('SNOWQM', ix, mw) !!XXgoldyXX: this should be uncommented once constituents are enabled ix = -1 !!XXgoldyXX: Model should die if it gets here, until constituents are enabled thermodynamic_active_species_idx(icnst) = ix @@ -549,7 +549,7 @@ subroutine air_composition_init() ! ! GRAUQM ! - case('graupel_mixing_ratio') + case('graupel_mixing_ratio_wrt_moist_air') ! call air_species_info('GRAUQM', ix, mw) !!XXgoldyXX: this should be uncommented once constituents are enabled ix = -1 !!XXgoldyXX: Model should die if it gets here, until constituents are enabled thermodynamic_active_species_idx(icnst) = ix diff --git a/src/data/namelist_definition_air_comp.xml b/src/data/namelist_definition_air_comp.xml index de23dbc9..8b93b22f 100644 --- a/src/data/namelist_definition_air_comp.xml +++ b/src/data/namelist_definition_air_comp.xml @@ -41,45 +41,45 @@ mass and thermodynamic properties. Default if CAM4, CAM5, or Kessler physics is used: - ['water_vapor_specific_humidity', - 'cloud_liquid_water_mixing_ratio_of_moist_air', - 'rain_water_mixing_ratio'] + ['specific_humidity', + 'cloud_liquid_water_mixing_ratio_wrt_moist_air', + 'rain_water_mixing_ratio_wrt_moist_air'] Default if CAM6 physics is used: - ['water_vapor_specific_humidity', - 'cloud_liquid_water_mixing_ratio_of_moist_air', - 'cloud_ice_water_mixing_ratio_of_moist_air', - 'rain_water_mixing_ratio', - 'snow_water_mixing_ratio'] + ['specific_humidity', + 'cloud_liquid_water_mixing_ratio_wrt_moist_air', + 'cloud_ice_water_mixing_ratio_wrt_moist_air', + 'rain_water_mixing_ratio_wrt_moist_air', + 'snow_water_mixing_ratio_wrt_moist_air'] - Otherwise default is: ['water_vapor_specific_humidity'] + Otherwise default is: ['specific_humidity'] - water_vapor_specific_humidity + specific_humidity - water_vapor_specific_humidity, - cloud_liquid_water_mixing_ratio_of_moist_air, - rain_water_mixing_ratio + specific_humidity, + cloud_liquid_water_mixing_ratio_wrt_moist_air, + rain_water_mixing_ratio_wrt_moist_air - water_vapor_specific_humidity, - cloud_liquid_water_mixing_ratio_of_moist_air, - rain_water_mixing_ratio + specific_humidity, + cloud_liquid_water_mixing_ratio_wrt_moist_air, + rain_water_mixing_ratio_wrt_moist_air - water_vapor_specific_humidity, - cloud_liquid_water_mixing_ratio_of_moist_air, - rain_water_mixing_ratio + specific_humidity, + cloud_liquid_water_mixing_ratio_wrt_moist_air, + rain_water_mixing_ratio_wrt_moist_air - water_vapor_specific_humidity, - cloud_liquid_water_mixing_ratio_of_moist_air, - cloud_ice_water_mixing_ratio_of_moist_air, - rain_water_mixing_ratio, - snow_water_mixing_ratio + specific_humidity, + cloud_liquid_water_mixing_ratio_wrt_moist_air, + cloud_ice_water_mixing_ratio_wrt_moist_air, + rain_water_mixing_ratio_wrt_moist_air, + snow_water_mixing_ratio_wrt_moist_air diff --git a/src/data/registry.xml b/src/data/registry.xml index cca0edd4..853d6e15 100644 --- a/src/data/registry.xml +++ b/src/data/registry.xml @@ -21,17 +21,17 @@ 1 2 3 @@ -178,18 +178,18 @@ allocatable="pointer"> horizontal_dimension vertical_layer_dimension number_of_constituents - Q cnst_Q - CLDLIQ cnst_CLDLIQ - RAINQM cnst_RAINQM diff --git a/src/dynamics/se/dyn_comp.F90 b/src/dynamics/se/dyn_comp.F90 index 3a242510..5d89b69f 100644 --- a/src/dynamics/se/dyn_comp.F90 +++ b/src/dynamics/se/dyn_comp.F90 @@ -728,13 +728,13 @@ subroutine dyn_init(cam_runtime_opts, dyn_in, dyn_out) if (m == ix_qv) then cnst_name_gll(m) = 'Q' - cnst_longname_gll(m) = 'water_vapor_specific_humidity' + cnst_longname_gll(m) = 'specific_humidity' else if (m == ix_cld_liq) then cnst_name_gll(m) = 'CLDLIQ' - cnst_longname_gll(m) = 'cloud_liquid_water_mixing_ratio' + cnst_longname_gll(m) = 'cloud_liquid_water_mixing_ratio_wrt_moist_air' else cnst_name_gll(m) = 'RAINQM' - cnst_longname_gll(m) = 'rain_water_mixing_ratio' + cnst_longname_gll(m) = 'rain_water_mixing_ratio_wrt_moist_air' end if end do #endif @@ -1866,9 +1866,9 @@ subroutine read_inidat(dyn_in) call mark_as_initialized("air_temperature") !These calls will need to be modified once constituents are enabled: - call mark_as_initialized("water_vapor_specific_humidity") - call mark_as_initialized("cloud_liquid_water_mixing_ratio_of_moist_air") - call mark_as_initialized("rain_water_mixing_ratio") + call mark_as_initialized("specific_humidity") + call mark_as_initialized("cloud_liquid_water_mixing_ratio_wrt_moist_air") + call mark_as_initialized("rain_water_mixing_ratio_wrt_moist_air") !These calls may be removed if geopotential_t is only allowed to run !in a CCPP physics suite: From 0bd239d4e798132d1a5de1d101776c5185cf5e6c Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 23 Dec 2022 12:10:52 -0700 Subject: [PATCH 2/3] Fix tests, and remove un-needed extra variable creation. --- cime_config/cam_config.py | 1 - test/unit/test_cam_config.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cime_config/cam_config.py b/cime_config/cam_config.py index 7a0f95f1..3bc81fee 100644 --- a/cime_config/cam_config.py +++ b/cime_config/cam_config.py @@ -350,7 +350,6 @@ def __init__(self, case, case_log): # Set paths for the SE dycore namelist definition file: se_dyn_nml_path = os.path.join(cime_conf_path, os.pardir, "src", "dynamics", "se") - data_nml_path = os.path.join(cime_conf_path, os.pardir, "src", "data") #Add NML definition files to dictionary: self._add_xml_nml_file(se_dyn_nml_path, "namelist_definition_se_dycore.xml") diff --git a/test/unit/test_cam_config.py b/test/unit/test_cam_config.py index d2484e87..91b95ae4 100644 --- a/test/unit/test_cam_config.py +++ b/test/unit/test_cam_config.py @@ -764,9 +764,20 @@ def test_xml_nml_file(self): #Create new, expected dictionary: xml_fil_list = OrderedDict() - #This file will always be present: + #Create path to "src/data" directory: + data_path = os.path.join(CAM_CONF_DIR, os.pardir, + "src", "data") + + #These files will always be present: xml_fil_list['namelist_definition_cam.xml'] = os.path.join(CAM_CONF_DIR, 'namelist_definition_cam.xml') + xml_fil_list['namelist_definition_physconst.xml'] = os.path.join(data_path, + 'namelist_definition_physconst.xml') + xml_fil_list['namelist_definition_air_comp.xml'] = os.path.join(data_path, + 'namelist_definition_air_comp.xml') + xml_fil_list['namelist_definition_ref_pres.xml'] = os.path.join(data_path, + 'namelist_definition_ref_pres.xml') + #This is the file being added: xml_fil_list['test_file.xml'] = '/fake/path/test_file.xml' From 5b427f37462505b0d9c6109e69b9cbdd772ba993 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 23 Dec 2022 14:26:47 -0700 Subject: [PATCH 3/3] Update atmospheric_physics external. --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 4f7772b4..1baada2f 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -23,7 +23,7 @@ required = False local_path = src/physics/ncar_ccpp protocol = git repo_url = https://github.com/NCAR/atmospheric_physics -tag = atmos_phys0_00_017 +tag = atmos_phys0_00_018 required = True [silhs]