Skip to content

Commit 931b425

Browse files
authored
Merge pull request #2870 from samsrabin/fix-fates-cold-finidat
Fix handling of finidat with cold starts
2 parents e07c66a + ebcd4fb commit 931b425

5 files changed

Lines changed: 160 additions & 9 deletions

File tree

bld/CLMBuildNamelist.pm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,12 +2588,9 @@ sub setup_logic_initial_conditions {
25882588
my $finidat = $nl->get_value($var);
25892589
$nl_flags->{'excess_ice_on_finidat'} = "unknown";
25902590
if ( $nl_flags->{'clm_start_type'} =~ /cold/ ) {
2591-
if (defined $finidat ) {
2592-
$log->warning("setting $var (either explicitly in your user_nl_clm or by doing a hybrid or branch RUN_TYPE)\n is incomptable with using a cold start" .
2591+
if (defined $finidat && !&value_is_true(($nl->get_value('use_fates')))) {
2592+
$log->fatal_error("setting $var (either explicitly in your user_nl_clm or by doing a hybrid or branch RUN_TYPE)\n is incompatible with using a cold start" .
25932593
" (by setting CLM_FORCE_COLDSTART=on)." );
2594-
$log->warning("Overridding input $var file with one specifying that this is a cold start from arbitrary initial conditions." );
2595-
my $group = $definition->get_group_name($var);
2596-
$nl->set_variable_value($group, $var, "' '" );
25972594
}
25982595
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
25992596
$var, 'val'=>"' '", 'no_abspath'=>1);

bld/unit_testers/build-namelist_test.pl

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,10 +1314,6 @@ sub cat_and_create_namelistinfile {
13141314

13151315
my %warntest = (
13161316
# Warnings without the -ignore_warnings option given
1317-
"coldwfinidat" =>{ options=>"-envxml_dir . -clm_start_type cold",
1318-
namelst=>"finidat = 'testfile.nc'",
1319-
phys=>"clm5_0",
1320-
},
13211317
"bgcspin_w_suplnitro" =>{ options=>"-envxml_dir . -bgc bgc -clm_accelerated_spinup on",
13221318
namelst=>"suplnitro='ALL'",
13231319
phys=>"clm5_0",
@@ -1398,6 +1394,56 @@ sub cat_and_create_namelistinfile {
13981394
system( "cat $tempfile" );
13991395
}
14001396

1397+
print "\n===============================================================================\n";
1398+
print "Ensure cold starts with finidat are handled properly \n";
1399+
print "=================================================================================\n";
1400+
1401+
my %coldwfinidat = (
1402+
"bgc" => { options=>"-envxml_dir . -clm_start_type cold",
1403+
namelst=>"finidat = 'testfile.nc'",
1404+
phys=>"clm5_0",
1405+
expected_fail=>1,
1406+
},
1407+
"fates" => { options=>"-envxml_dir . -clm_start_type cold -bgc fates -no-megan",
1408+
namelst=>"finidat = 'testfile.nc', use_fates = .true.",
1409+
phys=>"clm5_0",
1410+
expected_fail=>0,
1411+
},
1412+
);
1413+
my $finidat;
1414+
foreach my $key ( keys(%coldwfinidat) ) {
1415+
print( "$key\n" );
1416+
1417+
my $var;
1418+
foreach $var ( "phys" , "options", "namelst", "expected_fail" ) {
1419+
if ( not exists $coldwfinidat{$key}{$var} ) {
1420+
die "ERROR: Subkey $var does not exist for coldwfinidat $key\nERROR:Check if you spelled $var correctly\n"
1421+
}
1422+
}
1423+
1424+
&make_config_cache($coldwfinidat{$key}{"phys"});
1425+
my $options = $coldwfinidat{$key}{"options"};
1426+
my $namelist = $coldwfinidat{$key}{"namelst"};
1427+
my $expected_fail = $coldwfinidat{$key}{"expected_fail"};
1428+
my %settings;
1429+
&make_env_run( %settings );
1430+
1431+
# Should fail if expected to, pass otherwise
1432+
eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); };
1433+
is( $? eq 0, $expected_fail eq 0, "coldwfinidat $key run");
1434+
1435+
if ( $expected_fail ) {
1436+
# Now run with -ignore_warnings and make sure it still doesn't work
1437+
$options .= " -ignore_warnings";
1438+
eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); };
1439+
isnt( $?, 0, "coldwfinidat $key run -ignore_warnings" );
1440+
} else {
1441+
# Check that finidat was correctly set
1442+
$finidat = `grep finidat lnd_in`;
1443+
ok ( $finidat =~ "testfile.nc", "coldwfinidat $key finidat? $finidat" );
1444+
}
1445+
}
1446+
14011447
#
14021448
# Loop over all physics versions
14031449
#

cime_config/testdefs/ExpectedTestFails.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,19 @@
334334
</phase>
335335
</test>
336336

337+
<test name="ERS_D_Mmpi-serial_Ld5.1x1_brazil.I2000Clm50FatesCruRsGs.izumi_nag.clm-FatesCold">
338+
<phase name="RUN">
339+
<status>FAIL</status>
340+
<issue>#2861</issue>
341+
</phase>
342+
</test>
343+
344+
<test name="SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruRsGs.izumi_nag.clm-FatesColdHydro">
345+
<phase name="RUN">
346+
<status>FAIL</status>
347+
<issue>#2861</issue>
348+
</phase>
349+
</test>
337350

338351
<test name="SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Fates.derecho_intel.clm-FatesFireLightningPopDens--clm-NEON-FATES-NIWO">
339352
<phase name="SHAREDLIB_BUILD">
@@ -349,6 +362,13 @@
349362
</phase>
350363
</test>
351364

365+
<test name="ERS_D_Ld30.f45_f45_mg37.I2000Clm50FatesCruRsGs.izumi_nag.clm-FatesColdLandUse">
366+
<phase name="SHAREDLIB_BUILD">
367+
<status>FAIL</status>
368+
<issue>#2810</issue>
369+
</phase>
370+
</test>
371+
352372
<!-- Other submodule test list failures (MOSART, RTM, etc. -->
353373

354374
<test name="SMS_Lh3.f10_f10_mg37.I2000Clm51Sp.derecho_intel.mosart-clmAccelSpinupIgnoreWarn">

doc/ChangeLog

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,91 @@
11
===============================================================
2+
Tag name: ctsm5.3.011
3+
Originator(s): samrabin (Sam Rabin, UCAR/TSS, samrabin@ucar.edu)
4+
Date: Mon Nov 11 17:55:57 MST 2024
5+
One-line Summary: Improve handling of cold-start finidat
6+
7+
Purpose and description of changes
8+
----------------------------------
9+
10+
This PR changes things so that:
11+
12+
1. Cold-start FATES runs with finidat specified will not require -ignore_warnings, and the supplied finidat will actually be obeyed.
13+
2. Cold-start non-FATES runs will not be allowed, even with -ignore_warnings.
14+
15+
16+
Significant changes to scientifically-supported configurations
17+
--------------------------------------------------------------
18+
19+
Does this tag change answers significantly for any of the following physics configurations?
20+
(Details of any changes will be given in the "Answer changes" section below.)
21+
22+
[ ] clm6_0
23+
24+
[ ] clm5_1
25+
26+
[ ] clm5_0
27+
28+
[ ] ctsm5_0-nwp
29+
30+
[ ] clm4_5
31+
32+
33+
Bugs fixed
34+
----------
35+
[Remove any lines that don't apply. Remove entire section if nothing applies.]
36+
37+
List of CTSM issues fixed:
38+
- Resolves ESCOMP/CTSM#2856: FATES will never start from specified finidat (https://github.com/ESCOMP/CTSM/issues/2856)
39+
40+
Notes of particular relevance for developers:
41+
---------------------------------------------
42+
NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide
43+
44+
Changes to tests or testing:
45+
Adds three fates suite tests to expected fails:
46+
- ERS_D_Mmpi-serial_Ld5.1x1_brazil.I2000Clm50FatesCruRsGs.izumi_nag.clm-FatesCold
47+
- SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruRsGs.izumi_nag.clm-FatesColdHydro
48+
- ERS_D_Ld30.f45_f45_mg37.I2000Clm50FatesCruRsGs.izumi_nag.clm-FatesColdLandUse
49+
50+
51+
Testing summary:
52+
----------------
53+
54+
[PASS means all tests PASS; OK means tests PASS other than expected fails.]
55+
56+
build-namelist tests (if CLMBuildNamelist.pm has changed):
57+
58+
derecho - PASS
59+
60+
regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):
61+
62+
derecho ----- OK
63+
izumi ------- OK
64+
65+
fates tests:
66+
derecho ----- OK
67+
izumi ------- OK
68+
69+
70+
Answer changes
71+
--------------
72+
73+
Changes answers relative to baseline:
74+
75+
Summarize any changes to answers, i.e.,
76+
- what code configurations: FATES cold-start runs with finidat
77+
- what platforms/compilers: All
78+
- nature of change: new climate
79+
80+
81+
Other details
82+
-------------
83+
84+
Pull Requests that document the changes (include PR ids):
85+
- ESCOMP/CTSM#2870: Fix handling of finidat with cold starts (https://github.com/ESCOMP/CTSM/pull/2870)
86+
87+
===============================================================
88+
===============================================================
289
Tag name: ctsm5.3.010
390
Originator(s): afoster (Adrianna Foster)
491
Date: Sat Nov 9 12:54:18 MST 2024

doc/ChangeSum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Tag Who Date Summary
22
============================================================================================================================
3+
ctsm5.3.011 samrabin 11/11/2024 Improve handling of cold-start finidat
34
ctsm5.3.010 afoster 11/09/2024 Merge b4b-dev
45
ctsm5.3.009 samrabin 10/15/2024 Reduce outputs from matrixcnOn tests
56
ctsm5.3.008 olyson 10/14/2024 PPE change to sa_leaf in CanopyFluxesMod.F90

0 commit comments

Comments
 (0)