Skip to content

Commit 88ab16e

Browse files
author
adrifoster
committed
update
2 parents 90a9dc9 + 9cb42ec commit 88ab16e

36 files changed

+1134
-414
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ aa04d1f7d86cc2503b98b7e2b2d84dbfff6c316b
5555
753fda3ff0147837231a73c9c728dd9ce47b5997
5656
f112ba0bbf96a61d5a4d354dc0dcbd8b0c68145c
5757
bd535c710db78420b8e8b9d71d88d8339e899c59
58+
4b20bbd7003e6f77dab4e3268cc4a43f9b5a3b5d
59+
cf433215b58ba8776ec5edfb0b0d80c0836ed3a0
60+
16d57ff37859b34dab005693e3085d64e2bcd95a

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,18 @@ unit_test_build
8989
/tools/site_and_regional/listing.csv
9090
/tools/site_and_regional/????/
9191
/tools/site_and_regional/????.ad/
92+
/tools/site_and_regional/????.*.ad/
9293
/tools/site_and_regional/????.postad/
94+
/tools/site_and_regional/????.*.postad/
9395
/tools/site_and_regional/????.transient/
96+
/tools/site_and_regional/????.*.transient/
97+
/tools/site_and_regional/??-???/
98+
/tools/site_and_regional/??-???.ad/
99+
/tools/site_and_regional/??-???.*.ad/
100+
/tools/site_and_regional/??-???.postad/
101+
/tools/site_and_regional/??-???.*.postad/
102+
/tools/site_and_regional/??-???.transient/
103+
/tools/site_and_regional/??-???.*.transient/
94104
/tools/site_and_regional/archive/
95105

96106
# build output

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
[submodule "fates"]
2929
path = src/fates
3030
url = https://github.com/NGEET/fates
31-
fxtag = sci.1.80.4_api.37.0.0
31+
fxtag = sci.1.80.11_api.37.0.0
3232
fxrequired = AlwaysRequired
3333
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
3434
fxDONOTUSEurl = https://github.com/NCAR/fates-release

bld/CLMBuildNamelist.pm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,17 +2118,21 @@ sub setup_logic_roughness_methods {
21182118
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
21192119

21202120
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'z0param_method',
2121-
'phys'=>$nl_flags->{'phys'} );
2121+
'phys'=>$nl_flags->{'phys'} , 'use_fates'=>$nl_flags->{'use_fates'});
21222122

21232123
my $var = remove_leading_and_trailing_quotes( $nl->get_value("z0param_method") );
21242124
if ( $var ne "Meier2022" && $var ne "ZengWang2007" ) {
21252125
$log->fatal_error("$var is incorrect entry for the namelist variable z0param_method; expected Meier2022 or ZengWang2007");
21262126
}
21272127
my $phys = $physv->as_string();
2128-
if ( $phys eq "clm4_5" || $phys eq "clm5_0" ) {
2129-
if ( $var eq "Meier2022" ) {
2128+
if ( $var eq "Meier2022" ) {
2129+
if ( $phys eq "clm4_5" || $phys eq "clm5_0" ) {
21302130
$log->fatal_error("z0param_method = $var and phys = $phys, but this method has been tested only with clm6_0 and later versions; to use with earlier versions, disable this error, and add Meier2022 parameters to the corresponding params file");
21312131
}
2132+
# Make sure that fates and meier2022 are not both active due to issue #2932
2133+
if ( &value_is_true($nl_flags->{'use_fates'}) ) {
2134+
$log->fatal_error("z0param_method = $var and use_fates currently are not compatible. Please update the z0param_method to ZengWang2007. See issue #2932 for more information.")
2135+
}
21322136
}
21332137
}
21342138
#-------------------------------------------------------------------------------

bld/namelist_files/namelist_defaults_ctsm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
540540
<!-- ================================================================== -->
541541

542542
<z0param_method>ZengWang2007</z0param_method>
543-
<z0param_method phys="clm6_0">Meier2022</z0param_method>
543+
<z0param_method use_fates=".false." phys="clm6_0" >Meier2022</z0param_method>
544544

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

bld/unit_testers/build-namelist_test.pl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ sub cat_and_create_namelistinfile {
163163
#
164164
# Figure out number of tests that will run
165165
#
166-
my $ntests = 3263;
166+
my $ntests = 3264;
167167

168168
if ( defined($opts{'compare'}) ) {
169-
$ntests += 1979;
169+
$ntests += 1980;
170170
}
171171
plan( tests=>$ntests );
172172

@@ -1185,6 +1185,10 @@ sub cat_and_create_namelistinfile {
11851185
namelst=>"use_hydrstress=.true.",
11861186
phys=>"clm5_0",
11871187
},
1188+
"useMeierwithFATES" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
1189+
namelst=>"z0param_method=Meier2022",
1190+
phys=>"clm5_0",
1191+
},
11881192
"noanthro_w_crop" =>{ options=>"-envxml_dir . -res 0.9x1.25 -bgc bgc -crop -use_case 1850_noanthro_control",
11891193
namelst=>"",
11901194
phys=>"clm5_0",

cime_config/SystemTests/ssp.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def run_phase(self):
8181
)
8282
refsec = "00000"
8383

84-
# obtain rpointer files and necessary restart files from short term archiving directory
84+
# obtain necessary restart files from short term archiving directory
8585
rundir = self._case.get_value("RUNDIR")
8686

8787
rest_path = os.path.join(dout_sr, "rest", "{}-{}".format(refdate, refsec))
@@ -96,9 +96,6 @@ def run_phase(self):
9696
else:
9797
os.symlink(item, link_name)
9898

99-
for item in glob.glob("{}/*rpointer*".format(rest_path)):
100-
shutil.copy(item, rundir)
101-
10299
self._case.set_value("CLM_ACCELERATED_SPINUP", "off")
103100
self._case.set_value("RUN_TYPE", "hybrid")
104101
self._case.set_value("GET_REFCASE", False)

cime_config/SystemTests/sspmatrixcn.py

Lines changed: 52 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Step 4: matrix Spinup off
1414
"""
1515
import shutil, glob, os, sys
16+
from datetime import datetime
1617

1718
if __name__ == "__main__":
1819
CIMEROOT = os.environ.get("CIMEROOT")
@@ -24,6 +25,7 @@
2425
else:
2526
from CIME.status import append_testlog
2627

28+
from CIME.case import Case
2729
from CIME.XML.standard_module_setup import *
2830
from CIME.SystemTests.system_tests_common import SystemTestsCommon
2931
from CIME.SystemTests.test_utils import user_nl_utils
@@ -186,6 +188,26 @@ def append_user_nl(self, caseroot, n=0):
186188
caseroot=caseroot, component=self.comp, contents=contents_to_append
187189
)
188190

191+
def run_indv(self, nstep, st_archive=True):
192+
"""
193+
Individual run of a given step
194+
"""
195+
suffix = "step{}".format(self.steps[nstep])
196+
if isinstance(self._case, Case):
197+
super().run_indv(suffix, st_archive=True)
198+
else:
199+
caseroot = self._case.get_value("CASEROOT")
200+
dout_sr = self._case.get_value("DOUT_S_ROOT")
201+
rest_r = os.path.join(dout_sr, "rest")
202+
nyear = 1851 + nstep
203+
rundate = "%s-01-01-00000" % nyear
204+
restdir = os.path.join(rest_r, rundate)
205+
os.mkdir(restdir)
206+
rpoint = os.path.join(restdir, "rpointer.clm." + rundate)
207+
os.mknod(rpoint)
208+
rpoint = os.path.join(restdir, "rpointer.cpl." + rundate)
209+
os.mknod(rpoint)
210+
189211
def run_phase(self):
190212
"Run phase"
191213

@@ -225,6 +247,7 @@ def run_phase(self):
225247
self.append_user_nl(clone_path, n)
226248

227249
dout_sr = clone.get_value("DOUT_S_ROOT")
250+
ninst = self._case.get_value("NINST")
228251

229252
self._skip_pnl = False
230253
#
@@ -247,14 +270,24 @@ def run_phase(self):
247270
os.makedirs(rundir)
248271
os.symlink(item, linkfile)
249272

250-
for item in glob.glob("{}/*rpointer*".format(rest_path)):
251-
shutil.copy(item, rundir)
273+
# For a branch the cpl rpointer file needs to be handled
274+
if self.runtyp[n] == "branch":
275+
276+
drvrest = "rpointer.cpl"
277+
if ninst > 1:
278+
drvrest += "_0001"
279+
drvrest += rest_time
252280

281+
self._set_drv_restart_pointer(drvrest)
282+
try:
283+
shutil.copy(drvrest, rundir)
284+
except shutil.SameFileError:
285+
pass
253286
#
254287
# Run the case (Archiving on)
255288
#
256289
self._case.flush()
257-
self.run_indv(suffix="step{}".format(self.steps[n]), st_archive=True)
290+
self.run_indv(nstep=n, st_archive=True)
258291

259292
#
260293
# Get the reference case from this step for the next step
@@ -267,6 +300,7 @@ def run_phase(self):
267300
)
268301
refsec = "00000"
269302
rest_path = os.path.join(dout_sr, "rest", "{}-{}".format(refdate, refsec))
303+
rest_time = "." + refdate + "-" + refsec
270304

271305
#
272306
# Last step in original case
@@ -292,10 +326,22 @@ def run_phase(self):
292326
linkfile = os.path.join(rundir, os.path.basename(item))
293327
if os.path.exists(linkfile):
294328
os.remove(linkfile)
329+
expect(True, os.path.exists(item), "expected file does NOT exist = " + item)
295330
os.symlink(item, linkfile)
296331

297-
for item in glob.glob("{}/*rpointer*".format(rest_path)):
298-
shutil.copy(item, rundir)
332+
# For a branch the cpl rpointer file needs to be handled
333+
if self.runtyp[n] == "branch":
334+
335+
drvrest = "rpointer.cpl"
336+
if ninst > 1:
337+
drvrest += "_0001"
338+
drvrest += rest_time
339+
340+
self._set_drv_restart_pointer(drvrest)
341+
try:
342+
shutil.copy(os.path.join(rest_path, drvrest), rundir)
343+
except shutil.SameFileError:
344+
pass
299345

300346
self.append_user_nl(clone_path, n)
301347
#
@@ -306,66 +352,4 @@ def run_phase(self):
306352
# Run the case (short term archiving is off)
307353
#
308354
self._case.flush()
309-
self.run_indv(suffix="step{}".format(self.steps[n]), st_archive=False)
310-
311-
312-
#
313-
# Unit testing for above
314-
#
315-
import unittest
316-
from CIME.case import Case
317-
from CIME.utils import _LessThanFilter
318-
from argparse import RawTextHelpFormatter
319-
320-
321-
class test_ssp_matrixcn(unittest.TestCase):
322-
def setUp(self):
323-
self.ssp = SSPMATRIXCN()
324-
325-
def test_logger(self):
326-
# Test the logger
327-
stream_handler = logging.StreamHandler(sys.stdout)
328-
logger.addHandler(stream_handler)
329-
logger.level = logging.DEBUG
330-
logger.info("nyr_forcing = {}".format(self.ssp.nyr_forcing))
331-
for n in range(self.ssp.n_steps()):
332-
self.ssp.__logger__(n)
333-
if self.ssp.spin[n] == "sasu":
334-
logger.info(" SASU spinup is .true.")
335-
if self.ssp.sasu[n] != -999:
336-
logger.info(" nyr_sasu = {}".format(self.ssp.sasu[n]))
337-
if self.ssp.iloop[n] != -999:
338-
logger.info(" iloop_avg = {}".format(self.ssp.iloop[n]))
339-
340-
logger.info("Total number of years {}".format(self.ssp.total_years()))
341-
logger.removeHandler(stream_handler)
342-
343-
def test_n_steps(self):
344-
self.assertTrue(self.ssp.n_steps() == 3)
345-
346-
def test_valid_n(self):
347-
for n in range(self.ssp.n_steps()):
348-
self.ssp.check_n(n)
349-
350-
def test_negative_n(self):
351-
self.assertRaises(SystemExit, self.ssp.check_n, -1)
352-
353-
def test_n_too_big(self):
354-
self.assertRaises(SystemExit, self.ssp.check_n, self.ssp.n_steps())
355-
356-
def test_append_user_nl_step2(self):
357-
ufile = "user_nl_clm"
358-
if not os.path.exists(ufile):
359-
os.mknod(ufile)
360-
else:
361-
expect(0, ufile + " file already exists, not overwritting it")
362-
363-
self.ssp.append_user_nl(caseroot=".", n=2)
364-
print(ufile + " for step 2")
365-
log = open(ufile, "r").read()
366-
print(log)
367-
os.remove(ufile)
368-
369-
370-
if __name__ == "__main__":
371-
unittest.main()
355+
self.run_indv(nstep=n, st_archive=False)

cime_config/testdefs/ExpectedTestFails.xml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -138,41 +138,6 @@
138138
</phase>
139139
</test>
140140

141-
<test name="SSPMATRIXCN_Ly5_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRs.izumi_intel.clm-ciso_monthly">
142-
<phase name="RUN">
143-
<status>FAIL</status>
144-
<issue>#2913</issue>
145-
</phase>
146-
</test>
147-
148-
<test name="SSP_D_Ld10.f10_f10_mg37.I1850Clm60Bgc.derecho_intel.clm-rtmColdSSP">
149-
<phase name="RUN">
150-
<status>FAIL</status>
151-
<issue>#2913</issue>
152-
</phase>
153-
</test>
154-
155-
<test name="SSP_D_Ld4.f10_f10_mg37.I1850Clm50BgcCrop.derecho_intel.clm-ciso_rtmColdSSP">
156-
<phase name="RUN">
157-
<status>FAIL</status>
158-
<issue>#2913</issue>
159-
</phase>
160-
</test>
161-
162-
<test name="SSP_Ld10.f10_f10_mg37.I1850Clm50Bgc.derecho_gnu.clm-rtmColdSSP">
163-
<phase name="RUN">
164-
<status>FAIL</status>
165-
<issue>#2913</issue>
166-
</phase>
167-
</test>
168-
169-
<test name="SSP_Ld4.f09_g17.I1850Clm50BgcCrop.derecho_intel.clm-ciso_rtmColdSSP">
170-
<phase name="RUN">
171-
<status>FAIL</status>
172-
<issue>#2913</issue>
173-
</phase>
174-
</test>
175-
176141
<test name="SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Bgc.izumi_nag.clm-default--clm-NEON-HARV--clm-matrixcnOn">
177142
<phase name="RUN">
178143
<status>FAIL</status>

cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use_fates_tree_damage = .true.
88
hist_ndens = 1
99
hist_fincl1 = 'FATES_TLONGTERM',
1010
'FATES_TGROWTH','FATES_SEEDS_IN_GRIDCELL_PF','FATES_SEEDS_OUT_GRIDCELL_PF','FATES_NCL_AP',
11-
'FATES_NPATCH_AP','FATES_VEGC_AP','FATES_SECONDAREA_ANTHRODIST_AP','FATES_SECONDAREA_DIST_AP',
11+
'FATES_NPATCH_AP','FATES_VEGC_AP','FATES_SECONDARY_ANTHRODISTAGE_AP','FATES_SECONDARY_AREA_AP',
1212
'FATES_FUEL_AMOUNT_APFC','FATES_STOREC_TF_USTORY_SZPF','FATES_STOREC_TF_CANOPY_SZPF',
1313
'FATES_CROWNAREA_CLLL','FATES_ABOVEGROUND_MORT_SZPF',
1414
'FATES_ABOVEGROUND_PROD_SZPF','FATES_NPLANT_SZAP','FATES_NPLANT_CANOPY_SZAP',
@@ -56,4 +56,5 @@ hist_fincl1 = 'FATES_TLONGTERM',
5656
'FATES_PARSUN_CL','FATES_PARSHA_CL','FATES_LAISUN_CLLL','FATES_LAISHA_CLLL','FATES_LAISUN_CLLLPF',
5757
'FATES_LAISHA_CLLLPF','FATES_PARPROF_DIR_CLLLPF','FATES_PARPROF_DIF_CLLLPF','FATES_LAISUN_CL','FATES_LAISHA_CL',
5858
'FATES_PARPROF_DIR_CLLL','FATES_PARPROF_DIF_CLLL','FATES_NET_C_UPTAKE_CLLL','FATES_CROWNFRAC_CLLLPF',
59-
'FATES_LBLAYER_COND_AP','FATES_STOMATAL_COND_AP'
59+
'FATES_LBLAYER_COND_AP','FATES_STOMATAL_COND_AP','FATES_TLONGTERM','FATES_PRIMARY_AREA_AP','FATES_NPP_LU',
60+
'FATES_GPP_LU'

0 commit comments

Comments
 (0)