Skip to content

Commit

Permalink
Merge branch 'CESM3_dev' of github.com:ESCOMP/CTSM into CESM3_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ekluzek committed Oct 22, 2023
2 parents 3636565 + 958a49b commit 844ab66
Show file tree
Hide file tree
Showing 15 changed files with 289 additions and 53 deletions.
14 changes: 7 additions & 7 deletions Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ required = True
local_path = components/cism
protocol = git
repo_url = https://github.com/ESCOMP/CISM-wrapper
tag = cismwrap_2_1_95
tag = cismwrap_2_1_96
externals = Externals_CISM.cfg
required = True

Expand All @@ -34,7 +34,7 @@ hash = 34723c2
required = True

[ccs_config]
tag = ccs_config_cesm0.0.65
tag = ccs_config_cesm0.0.82
protocol = git
repo_url = https://github.com/ESMCI/ccs_config_cesm.git
local_path = ccs_config
Expand All @@ -44,26 +44,26 @@ required = True
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
tag = cime6.0.125
tag = cime6.0.175
required = True

[cmeps]
tag = cmeps0.14.21
tag = cmeps0.14.43
protocol = git
repo_url = https://github.com/ESCOMP/CMEPS.git
local_path = components/cmeps
required = True

[cdeps]
tag = cdeps1.0.13
tag = cdeps1.0.23
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
local_path = components/cdeps
externals = Externals_CDEPS.cfg
required = True

[cpl7]
tag = cpl77.0.5
tag = cpl77.0.7
protocol = git
repo_url = https://github.com/ESCOMP/CESM_CPL7andDataComps
local_path = components/cpl7
Expand All @@ -84,7 +84,7 @@ local_path = libraries/mct
required = True

[parallelio]
tag = pio2_5_10
tag = pio2_6_2
protocol = git
repo_url = https://github.com/NCAR/ParallelIO
local_path = libraries/parallelio
Expand Down
2 changes: 2 additions & 0 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4394,6 +4394,8 @@ sub setup_logic_exice {
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
my $use_exice = $nl->get_value( 'use_excess_ice' );

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice_streams', 'phys'=>$nl_flags->{'phys'});
my $use_exice_streams = $nl->get_value( 'use_excess_ice_streams' );
# IF excess ice streams is on
if (defined($use_exice_streams) && value_is_true($use_exice_streams)) {
Expand Down
30 changes: 22 additions & 8 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- The default filenames are given relative to the root directory
for the CLM2 data in the CESM distribution -->
<!-- Plant function types (relative to {csmdata}) -->
<paramfile phys="clm5_1" >lnd/clm2/paramdata/ctsm51_params.c211112.nc</paramfile>
<paramfile phys="clm5_1" >lnd/clm2/paramdata/ctsm51_params.RMz0.c231011.nc</paramfile>
<paramfile phys="clm5_0" >lnd/clm2/paramdata/clm50_params.c211112.nc</paramfile>
<paramfile phys="clm4_5" >lnd/clm2/paramdata/clm45_params.c211112.nc</paramfile>

Expand All @@ -501,10 +501,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- Default surface roughness parameterization -->
<!-- ================================================================== -->

<z0param_method>ZengWang2007</z0param_method>
<z0param_method>Meier2022</z0param_method>

<use_z0m_snowmelt z0param_method="Meier2022" >.true.</use_z0m_snowmelt>
<use_z0m_snowmelt >.false.</use_z0m_snowmelt>
<use_z0m_snowmelt >.true.</use_z0m_snowmelt>

<!-- ======================================================================================== -->
<!-- clm 5.0 BGC nitrogen model -->
Expand Down Expand Up @@ -680,6 +680,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
set up. If more finidat files are added you may need to add more of these.
Or one specific file will be chosen over another.
-->

<init_interp_attributes sim_year="1850" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm4_5_GSWP3v1"
>hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.true. use_crop=.false. irrigate=.true. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>
Expand Down Expand Up @@ -724,6 +725,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
>hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>

<!-- 1850 spinup for CESM3 development for CLM5.1-->
<init_interp_attributes sim_year="1850" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_1_cam6.0"
>hgrid=ne30np4.pg3 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>

<!-- present day -->
<init_interp_attributes sim_year="2000" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm4_5_GSWP3v1"
>hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false.
Expand Down Expand Up @@ -875,7 +881,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
hgrid="ne0np4.ARCTICGRIS.ne30x8" use_cn=".false." maxpft="17"
>hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_crop=.false. irrigate=.true. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>
p

<!-- 2003 -->
<init_interp_attributes sim_year="2003" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_0_cam6.0"
hgrid="1.9x2.5" use_cn=".false." maxpft="17"
Expand Down Expand Up @@ -968,6 +974,14 @@ p
>lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc
</finidat>

<!-- CESM3 dev spinup -->
<finidat hgrid="ne30np4.pg3" maxpft="79" mask="gx1v7" use_cn=".true." use_cndv=".false." use_fates=".false."
ic_ymd="18500101" sim_year="1850" do_transient_pfts=".false."
ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".false."
lnd_tuning_mode="clm5_1_cam6.0"
>lnd/clm2/initdata_map/clmi.I1850Clm51CplhistBgcCrop-ciso.0561-01-01.ne30np4.pg3_gx1v7_simyr1850_c230717.nc
</finidat>

<!--
Present day IC (if use_init_interp is set and .true. then MUST still interpolate even on an exact match)
(if it will work on an exact match, leave use_init_interp off)
Expand Down Expand Up @@ -1133,7 +1147,6 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr2000
lnd/clm2/surfdata_esmf/ctsm5.2.0/surfdata_0.9x1.25_hist_78pfts_CMIP6_2000_c230517.nc</fsurdat>
<fsurdat hgrid="1.9x2.5" sim_year="2000" use_crop=".true." use_vichydro=".false.">
lnd/clm2/surfdata_esmf/ctsm5.2.0/surfdata_1.9x2.5_hist_78pfts_CMIP6_2000_c230517.nc</fsurdat>
lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1.9x2.5_hist_78pfts_CMIP6_simyr2000_c190304.nc</fsurdat>
<fsurdat hgrid="hcru_hcru" sim_year="2000">
lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_360x720cru_78pfts_CMIP6_simyr2000_c170824.nc</fsurdat>
<fsurdat hgrid="0.125x0.125" sim_year="2000" use_crop=".true." >
Expand Down Expand Up @@ -1260,8 +1273,8 @@ lnd/clm2/surfdata_map/ctsm5.1.dev120/surfdata_ne16np4.pg3_hist_78pfts_CMIP6_simy
lnd/clm2/surfdata_esmf/ctsm5.2.0/surfdata_ne30np4_hist_78pfts_CMIP6_1850_c230517.nc</fsurdat>
<fsurdat hgrid="ne30np4.pg2" sim_year="1850">
lnd/clm2/surfdata_esmf/ctsm5.2.0/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_1850_c230517.nc</fsurdat>
<fsurdat hgrid="ne30np4.pg3" sim_year="1850">
lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc</fsurdat>
<fsurdat hgrid="ne30np4.pg3" sim_year="1850">
lnd/clm2/surfdata_esmf/ctsm5.2.0/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_1850_c230517.nc</fsurdat>
<fsurdat hgrid="ne30np4.pg3" sim_year="1850">
lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850_c200426.nc</fsurdat>
<fsurdat hgrid="ne120np4" sim_year="1850">
Expand Down Expand Up @@ -2012,7 +2025,8 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<!-- Defaults for excess ice -->
<!-- ========================================= -->

<use_excess_ice>.false.</use_excess_ice>
<use_excess_ice>.true.</use_excess_ice>
<use_excess_ice_streams>.true.</use_excess_ice_streams>

<stream_fldfilename_exice use_excess_ice=".true.">lnd/clm2/paramdata/exice_init_0.125x0.125_c20220516.nc</stream_fldfilename_exice>
<stream_meshfile_exice use_excess_ice=".true.">lnd/clm2/paramdata/exice_init_0.125x0.125_ESMFmesh_cdf5_c20220802.nc</stream_meshfile_exice>
Expand Down
2 changes: 1 addition & 1 deletion bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ Land mask description

<entry id="lnd_tuning_mode" type="char*20" category="default_settings"
group="default_settings"
valid_values="clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_0_cam6.0,clm5_0_CRUv7,clm5_0_GSWP3v1,clm5_1_GSWP3v1">
valid_values="clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_0_cam6.0,clm5_0_CRUv7,clm5_0_GSWP3v1,clm5_1_GSWP3v1,clm5_1_cam6.0">
General configuration of model version and atmospheric forcing to tune the model to run under.
This sets the model to run with constants and initial conditions that were set to run well under
the configuration of model version and atmospheric forcing. To run well constants would need to be changed
Expand Down
80 changes: 44 additions & 36 deletions cime_config/SystemTests/mksurfdataesmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,31 @@

logger = logging.getLogger(__name__)

class MKSURFDATAESMF(SystemTestsCommon):

class MKSURFDATAESMF(SystemTestsCommon):
def __init__(self, case):
"""
initialize an object interface to the SMS system test
"""
SystemTestsCommon.__init__(self, case)

# Paths and strings needed throughout
ctsm_root = self._case.get_value('COMP_ROOT_DIR_LND')
self._tool_path = os.path.join(ctsm_root, 'tools/mksurfdata_esmf')
self._tool_bld = os.path.join(self._get_caseroot(), 'tool_bld')
ctsm_root = self._case.get_value("COMP_ROOT_DIR_LND")
self._tool_path = os.path.join(ctsm_root, "tools/mksurfdata_esmf")
self._tool_bld = os.path.join(self._get_caseroot(), "tool_bld")
time_stamp = datetime.today().strftime("%y%m%d")
self._res = '10x15' # see important comment in script's docstring
self._model_yr = '1850'
self._jobscript = os.path.join(self._get_caseroot(),
'mksurfdata_jobscript_single')
self._fsurdat_namelist = os.path.join(self._get_caseroot(),
f'surfdata_{self._res}_hist_78pfts_CMIP6_{self._model_yr}_c{time_stamp}.namelist')
self._fsurdat_nc = os.path.join(self._get_caseroot(),
f'surfdata_{self._res}_hist_78pfts_CMIP6_{self._model_yr}_c{time_stamp}.nc')
self._TestStatus_log_path = os.path.join(self._get_caseroot(),
'TestStatus.log')
self._res = "10x15" # see important comment in script's docstring
self._model_yr = "1850"
self._jobscript = os.path.join(self._get_caseroot(), "mksurfdata_jobscript_single")
self._fsurdat_namelist = os.path.join(
self._get_caseroot(),
f"surfdata_{self._res}_hist_78pfts_CMIP6_{self._model_yr}_c{time_stamp}.namelist",
)
self._fsurdat_nc = os.path.join(
self._get_caseroot(),
f"surfdata_{self._res}_hist_78pfts_CMIP6_{self._model_yr}_c{time_stamp}.nc",
)
self._TestStatus_log_path = os.path.join(self._get_caseroot(), "TestStatus.log")

def build_phase(self, sharedlib_only=False, model_only=False):
"""
Expand All @@ -58,49 +60,53 @@ def build_phase(self, sharedlib_only=False, model_only=False):
# if the test stops and gets restarted.
if sharedlib_only:
# Paths and strings
build_script_path = os.path.join(self._tool_path,
'gen_mksurfdata_build.sh')
nml_script_path = os.path.join(self._tool_path,
'gen_mksurfdata_namelist.py')
gen_jobscript_path = os.path.join(self._tool_path,
'gen_mksurfdata_jobscript_single.py')
gen_mksurfdata_namelist = f'{nml_script_path} --res {self._res} --start-year {self._model_yr} --end-year {self._model_yr}'
gen_mksurfdata_jobscript = f'{gen_jobscript_path} --number-of-nodes 12 --tasks-per-node 12 --namelist-file {self._fsurdat_namelist}'
build_script_path = os.path.join(self._tool_path, "gen_mksurfdata_build.sh")
nml_script_path = os.path.join(self._tool_path, "gen_mksurfdata_namelist.py")
gen_jobscript_path = os.path.join(self._tool_path, "gen_mksurfdata_jobscript_single.py")
gen_mksurfdata_namelist = f"{nml_script_path} --res {self._res} --start-year {self._model_yr} --end-year {self._model_yr}"
gen_mksurfdata_jobscript = f"{gen_jobscript_path} --number-of-nodes 12 --tasks-per-node 12 --namelist-file {self._fsurdat_namelist}"

# Rm tool_bld and build executable that will generate fsurdat
try:
subprocess.check_call(f'rm -rf {self._tool_bld}', shell=True)
subprocess.check_call(f"rm -rf {self._tool_bld}", shell=True)
except subprocess.CalledProcessError as e:
sys.exit(f'{e} ERROR REMOVING {self._tool_bld}. DETAILS IN {self._TestStatus_log_path}')
sys.exit(
f"{e} ERROR REMOVING {self._tool_bld}. DETAILS IN {self._TestStatus_log_path}"
)
try:
subprocess.check_call(f'{build_script_path} --blddir {self._tool_bld}', shell=True)
subprocess.check_call(f"{build_script_path} --blddir {self._tool_bld}", shell=True)
except subprocess.CalledProcessError as e:
sys.exit(f'{e} ERROR RUNNING {build_script_path}. DETAILS IN {self._TestStatus_log_path}')
sys.exit(
f"{e} ERROR RUNNING {build_script_path}. DETAILS IN {self._TestStatus_log_path}"
)

# Generate namelist for generating fsurdat (rm namelist if exists)
if os.path.exists(self._fsurdat_namelist):
os.remove(self._fsurdat_namelist)
try:
subprocess.check_call(gen_mksurfdata_namelist, shell=True)
except subprocess.CalledProcessError as e:
sys.exit(f'{e} ERROR RUNNING {gen_mksurfdata_namelist}. DETAILS IN {self._TestStatus_log_path}')
sys.exit(
f"{e} ERROR RUNNING {gen_mksurfdata_namelist}. DETAILS IN {self._TestStatus_log_path}"
)

# Generate jobscript that will run the executable
if os.path.exists(self._jobscript):
os.remove(self._jobscript)
try:
subprocess.check_call(gen_mksurfdata_jobscript, shell=True)
except subprocess.CalledProcessError as e:
sys.exit(f'{e} ERROR RUNNING {gen_mksurfdata_jobscript}. DETAILS IN {self._TestStatus_log_path}')
sys.exit(
f"{e} ERROR RUNNING {gen_mksurfdata_jobscript}. DETAILS IN {self._TestStatus_log_path}"
)
# Change self._jobscript to an executable file
subprocess.check_call(f'chmod a+x {self._jobscript}', shell=True)
subprocess.check_call(f"chmod a+x {self._jobscript}", shell=True)

# Call this step only once even if the test stops and gets restarted.
if not os.path.exists(os.path.join(self._get_caseroot(),
'done_MKSURFDATAESMF_setup.txt')):
if not os.path.exists(os.path.join(self._get_caseroot(), "done_MKSURFDATAESMF_setup.txt")):
# Modify user_nl_clm to point to the generated fsurdat
self._modify_user_nl()
with open('done_MKSURFDATAESMF_setup.txt', 'w') as fp:
with open("done_MKSURFDATAESMF_setup.txt", "w") as fp:
pass

self.build_indv(sharedlib_only=sharedlib_only, model_only=model_only)
Expand All @@ -117,7 +123,7 @@ def run_phase(self):
try:
subprocess.check_call(self._jobscript, shell=True)
except subprocess.CalledProcessError as e:
sys.exit(f'{e} ERROR RUNNING {self._jobscript}; details in {self._TestStatus_log_path}')
sys.exit(f"{e} ERROR RUNNING {self._jobscript}; details in {self._TestStatus_log_path}")

# Submit CTSM run that uses fsurdat just generated
self.run_indv()
Expand All @@ -126,6 +132,8 @@ def _modify_user_nl(self):
"""
Modify user_nl_clm to point to the generated fsurdat
"""
append_to_user_nl_files(caseroot = self._get_caseroot(),
component = "clm",
contents = "fsurdat = '{}'".format(self._fsurdat_nc))
append_to_user_nl_files(
caseroot=self._get_caseroot(),
component="clm",
contents="fsurdat = '{}'".format(self._fsurdat_nc),
)
3 changes: 2 additions & 1 deletion cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<desc>Tuning parameters and initial conditions should be optimized for what CLM model version and what meteorlogical forcing combination?
</desc>
<default_value>UNSET</default_value>
<valid_values>clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_1_GSWP3v1</valid_values>
<valid_values>clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_1_GSWP3v1,clm5_1_cam6.0</valid_values>
<values>
<value compset= "CLM45" >clm4_5_CRUv7</value>
<value compset="DATM%CRUv7.+_CLM45" >clm4_5_CRUv7</value>
Expand All @@ -76,6 +76,7 @@
<value compset="CAM.+_CLM50" >clm5_0_cam6.0</value>
<value compset="DATM%CPLHIST.*_CLM50" >clm5_0_cam6.0</value>
<value compset= "_CLM51" >clm5_1_GSWP3v1</value>
<value compset="CAM.+_CLM51" >clm5_1_cam6.0</value>
</values>
</entry>

Expand Down
Loading

0 comments on commit 844ab66

Please sign in to comment.