Skip to content

Commit

Permalink
Merge pull request #1182 from rosiealice/SP_api
Browse files Browse the repository at this point in the history
FATES SP api
  • Loading branch information
ekluzek authored Sep 17, 2021
2 parents fdf5ef1 + 278c260 commit 7761d5b
Show file tree
Hide file tree
Showing 25 changed files with 1,397 additions and 999 deletions.
2 changes: 1 addition & 1 deletion Externals_CLM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local_path = src/fates
protocol = git
repo_url = https://github.com/NGEET/fates
tag = sci.1.46.2_api.16.1.0
tag = sci.1.47.0_api.17.0.0
required = True

[PTCLM]
Expand Down
128 changes: 78 additions & 50 deletions bld/CLMBuildNamelist.pm

Large diffs are not rendered by default.

437 changes: 221 additions & 216 deletions bld/namelist_files/namelist_defaults_ctsm.xml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,17 @@ Toggle to turn on fixed biogeography mode
(Only relevant if FATES is on)
</entry>

<entry id="use_fates_nocomp" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on no competition mode (only relevant if FATES is being used).
</entry>


<entry id="use_fates_sp" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on FATES satellite phenology mode (only relevant if FATES is being used).
</entry>

<entry id="use_fates_logging" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on the logging module
Expand Down
76 changes: 44 additions & 32 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ sub usage {
SYNOPSIS
build-namelist_test.pl [options]
Test the the CLM build-namelist
Test the the CLM build-namelist
OPTIONS
-help [or -h] Print usage to STDOUT.
-help [or -h] Print usage to STDOUT.
-compare <directory> Compare namelists for this version to namelists
created by another version.
-generate Leave the namelists in place to do a later compare.
Expand Down Expand Up @@ -59,7 +59,7 @@ sub make_env_run {
EOF
foreach my $item ( keys(%env_vars) ) {
print $fh <<EOF;
<entry id="$item" value="$env_vars{$item}" />
<entry id="$item" value="$env_vars{$item}" />
EOF
}
print $fh <<EOF;
Expand Down Expand Up @@ -135,7 +135,7 @@ sub cat_and_create_namelistinfile {
my $inputdata_rootdir = undef;
if (defined($opts{'csmdata'})) {
$inputdata_rootdir = $opts{'csmdata'};
} elsif (defined $ENV{'CSMDATA'} ) {
} elsif (defined $ENV{'CSMDATA'} ) {
$inputdata_rootdir = $ENV{'CSMDATA'};
} else {
# use yellowstone location as default
Expand All @@ -153,7 +153,7 @@ sub cat_and_create_namelistinfile {
$compGen='compare';
} elsif ( defined($opts{'compare'} && ($opts{'generate'} eq 1 ))) {
#_# if compare and generate are both given, use compare
$compGen='compare';
$compGen='compare';
}

my $ProgName;
Expand All @@ -163,9 +163,9 @@ sub cat_and_create_namelistinfile {
#
# Figure out number of tests that will run
#
my $ntests = 1829;
my $ntests = 1839;
if ( defined($opts{'compare'}) ) {
$ntests += 1245;
$ntests += 1251;
}
plan( tests=>$ntests );

Expand All @@ -176,7 +176,7 @@ sub cat_and_create_namelistinfile {
my $captOut=""; #_# variable to capture Test::More output
Test::More->builder->output(\$captOut);
#_# ============================================================
#_#
#_#
#_# ============================================================

# Check for unparsed arguments
Expand Down Expand Up @@ -222,7 +222,7 @@ sub cat_and_create_namelistinfile {
&make_env_run();
eval{ system( "$bldnml > $tempfile 2>&1 " ); };
is( $@, '', "plain build-namelist" );
$cfiles->checkfilesexist( "default", $mode );
$cfiles->checkfilesexist( "default", $mode );
# Compare to baseline
if ( defined($opts{'compare'}) ) {
$cfiles->doNOTdodiffonfile( "$tempfile", "default", $mode );
Expand All @@ -236,7 +236,7 @@ sub cat_and_create_namelistinfile {
$cfiles->copyfiles( "default", $mode );
&cleanup();
# Simple test -- run all the list options
foreach my $options ( "clm_demand", "ssp_rcp", "res",
foreach my $options ( "clm_demand", "ssp_rcp", "res",
"sim_year", "use_case" ) {
&make_env_run();
eval{ system( "$bldnml -${options} list > $tempfile 2>&1 " ); };
Expand Down Expand Up @@ -327,7 +327,7 @@ sub cat_and_create_namelistinfile {
"-res 1x1pt_US-UMB -clm_usr_name 1x1pt_US-UMB -namelist '&a fsurdat=\"/dev/null\"/'",
"-res 1x1_brazil",
"-clm_start_type startup", "-namelist '&a irrigate=.false./' -crop -bgc bgc",
"-envxml_dir . -infile myuser_nl_clm",
"-envxml_dir . -infile myuser_nl_clm",
"-ignore_ic_date -clm_start_type branch -namelist '&a nrevsn=\"thing.nc\"/' -bgc bgc -crop",
"-clm_start_type branch -namelist '&a nrevsn=\"thing.nc\",use_init_interp=T/'",
"-ignore_ic_date -clm_start_type startup -namelist '&a finidat=\"thing.nc\"/' -bgc bgc -crop",
Expand Down Expand Up @@ -365,17 +365,17 @@ sub cat_and_create_namelistinfile {
$mode = "-phys $phys";
&make_config_cache($phys);
my $neondir = "../../cime_config/usermods_dirs/NEON";
foreach my $site ( "ABBY", "BLAN", "CPER", "DEJU", "GRSM", "HEAL", "KONA", "LENO", "NIWO",
"ONAQ", "PUUM", "SERC", "SRER", "TALL", "TREE", "WOOD", "BARR", "BONA",
"DCFS", "DELA", "GUAN", "JERC", "KONZ", "MLBS", "NOGP", "ORNL", "RMNP",
"SJER", "STEI", "TEAK", "UKFS", "WREF", "BART", "CLBJ", "DSNY", "HARV",
"JORN", "LAJA", "MOAB", "OAES", "OSBS", "SCBI", "SOAP", "STER", "TOOL",
"UNDE", "YELL"
foreach my $site ( "ABBY", "BLAN", "CPER", "DEJU", "GRSM", "HEAL", "KONA", "LENO", "NIWO",
"ONAQ", "PUUM", "SERC", "SRER", "TALL", "TREE", "WOOD", "BARR", "BONA",
"DCFS", "DELA", "GUAN", "JERC", "KONZ", "MLBS", "NOGP", "ORNL", "RMNP",
"SJER", "STEI", "TEAK", "UKFS", "WREF", "BART", "CLBJ", "DSNY", "HARV",
"JORN", "LAJA", "MOAB", "OAES", "OSBS", "SCBI", "SOAP", "STER", "TOOL",
"UNDE", "YELL"
) {
&make_env_run();
#
# Concatonate default usermods and specific sitetogether expanding env variables while doing that
#
#
if ( ! -d "$neondir/$site" ) {
print "NEON directory is not there: $neondir/$site\n";
die "ERROR:: NEON site does not exist: $site\n";
Expand All @@ -390,7 +390,7 @@ sub cat_and_create_namelistinfile {
&cat_and_create_namelistinfile( $neondefaultfile, $neonsitefile, $namelistfile );
#
# Now run the site
#
#
my $options = "-res CLM_USRDAT -clm_usr_name NEON -no-megan -bgc bgc -sim_year 2000 -infile $namelistfile";
eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); };
is( $@, '', "options: $options" );
Expand All @@ -415,7 +415,7 @@ sub cat_and_create_namelistinfile {
foreach my $phys ( "clm4_5", "clm5_0" ) {
$mode = "-phys $phys";
&make_config_cache($phys);
foreach my $options (
foreach my $options (
"-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0",
"-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0",
"-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0",
Expand Down Expand Up @@ -452,11 +452,13 @@ sub cat_and_create_namelistinfile {
$phys = "clm5_0";
$mode = "-phys $phys";
&make_config_cache($phys);
foreach my $options (
foreach my $options (
"-bgc bgc -use_case 1850-2100_SSP1-2.6_transient -namelist '&a start_ymd=20100101/'",
"-bgc sp -use_case 1850-2100_SSP2-4.5_transient -namelist '&a start_ymd=18501223/'",
"-bgc bgc -use_case 1850-2100_SSP3-7.0_transient -namelist '&a start_ymd=20701029/'",
"-bgc fates -use_case 2000_control -no-megan",
"-bgc fates -use_case 20thC_transient -no-megan",
"-bgc fates -use_case 1850_control -no-megan -namelist '&a use_fates_sp=T/'",
"-bgc sp -use_case 2000_control -res 0.9x1.25 -namelist '&a use_soil_moisture_streams = T/'",
"-bgc bgc -use_case 1850-2100_SSP5-8.5_transient -namelist '&a start_ymd=19101023/'",
"-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop",
Expand Down Expand Up @@ -490,7 +492,7 @@ sub cat_and_create_namelistinfile {
my $finidat = "thing.nc";
system( "touch $finidat" );

my %failtest = (
my %failtest = (
"coldstart but with IC file"=>{ options=>"-clm_start_type cold -envxml_dir .",
namelst=>"finidat='$finidat'",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down Expand Up @@ -602,7 +604,7 @@ sub cat_and_create_namelistinfile {
phys=>"clm5_0",
},
"toosmall glc w trans" =>{ options=>"-bgc sp -envxml_dir .",
namelst=>"toosmall_glacier=10, dyn_transient_pfts=T",
namelst=>"toosmall_glacier=10, dyn_transient_pfts=T",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
Expand Down Expand Up @@ -968,7 +970,7 @@ sub cat_and_create_namelistinfile {
phys=>"clm5_0",
},
"usespitfireButNOTFATES" =>{ options=>"-envxml_dir . -no-megan",
namelst=>"fates_spitfire_mode>0",
namelst=>"fates_spitfire_mode=1",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
Expand All @@ -992,6 +994,16 @@ sub cat_and_create_namelistinfile {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useFATESSPWONOCOMP" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"use_fates_sp=T,use_fates_nocomp=F",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"useFATESTRANSWdynPFT" =>{ options=>"-bgc fates -envxml_dir . -use_case 20thC_transient -no-megan",
namelst=>"do_transient_pfts=T",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"useHYDSTwithFATES" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"use_hydrstress=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down Expand Up @@ -1136,7 +1148,7 @@ sub cat_and_create_namelistinfile {

# Warning testing, do things that give warnings, unless -ignore_warnings option is used

my %warntest = (
my %warntest = (
# Warnings without the -ignore_warnings option given
"coldwfinidat" =>{ options=>"-envxml_dir . -clm_start_type cold",
namelst=>"finidat = 'testfile.nc'",
Expand Down Expand Up @@ -1481,7 +1493,7 @@ sub cat_and_create_namelistinfile {
my $mode = "-phys $phys";
&make_config_cache($phys);
my @clmoptions = ( "-bgc bgc -envxml_dir .", "-bgc bgc -envxml_dir . -clm_accelerated_spinup=on", "-bgc bgc -envxml_dir . -light_res 360x720",
"-bgc sp -envxml_dir . -vichydro", "-bgc bgc -dynamic_vegetation -ignore_warnings",
"-bgc sp -envxml_dir . -vichydro", "-bgc bgc -dynamic_vegetation -ignore_warnings",
"-bgc bgc -clm_demand flanduse_timeseries -sim_year 1850-2000 -namelist '&a start_ymd=18500101/'",
"-bgc bgc -envxml_dir . -namelist '&a use_c13=.true.,use_c14=.true.,use_c14_bombspike=.true./'" );
foreach my $clmopts ( @clmoptions ) {
Expand All @@ -1503,7 +1515,7 @@ sub cat_and_create_namelistinfile {
&cleanup();
}
}
my @clmoptions = ( "-bgc bgc -envxml_dir .",
my @clmoptions = ( "-bgc bgc -envxml_dir .",
"-bgc sp -envxml_dir .", );
foreach my $clmopts ( @clmoptions ) {
my @clmres = ( "ne16np4" );
Expand Down Expand Up @@ -1545,11 +1557,11 @@ sub cat_and_create_namelistinfile {
my @clmres = ( "1x1_brazil", "5x5_amazon", "4x5", "1.9x2.5" );
foreach my $res ( @clmres ) {
$options = "-res $res -clm_start_type cold";
my @edoptions = ( "-use_case 2000_control",
"-use_case 1850_control",
"",
"-namelist \"&a use_lch4=.true.,use_nitrif_denitrif=.true./\"",
"-clm_accelerated_spinup on"
my @edoptions = ( "-use_case 2000_control",
"-use_case 1850_control",
"",
"-namelist \"&a use_lch4=.true.,use_nitrif_denitrif=.true./\"",
"-clm_accelerated_spinup on"
);
foreach my $edop (@edoptions ) {
if ( $res eq "5x5_amazon" && ($edop =~ /1850_control/) ) {
Expand Down
33 changes: 6 additions & 27 deletions cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,6 @@

<!-- fates test suite failures -->

<test name="ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.hobart_nag.clm-Fates">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>NGEET/fates#315</issue>
</phase>
</test>

<test name="ERP_Ld9.f45_f45_mg37.I2000Clm45Fates.hobart_nag.clm-FatesAllVars">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>NGEET/fates#315</issue>
</phase>
</test>

<test name="ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-FatesLogging">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
Expand All @@ -88,13 +74,6 @@
</phase>
</test>

<test name="SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.hobart_nag.clm-FatesHydro">
<phase name="MEMLEAK">
<status>FAIL</status>
<issue>NGEET/fates#510</issue>
</phase>
</test>

<test name="SMS_Lm3_D_Mmpi-serial.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro">
<phase name="RUN">
<status>FAIL</status>
Expand Down Expand Up @@ -137,25 +116,25 @@
</phase>
</test>

<test name="ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.hobart_nag.clm-FatesHydro">
<test name="ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro">
<phase name="RUN">
<status>FAIL</status>
<issue>#667</issue>
</phase>
</test>

<test name="ERS_D_Ld5.1x1_brazil.I2000Clm50FatesCruGs.izumi_nag.clm-FatesHydro">
<phase name="RUN">
<test name="ERS_D_Lm12.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-Fates_nat_and_anthro_ignitions">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#667</issue>
</phase>
</test>

<test name="ERS_D_Lm12.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-Fates_nat_and_anthro_ignitions">
<test name="ERS_Ld30.f45_f45_mg37.I2000Clm50FatesCruGs.cheyenne_intel.clm-FatesReducedComplexSatellitePhenology">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#667</issue>
<issue>#1485</issue>
</phase>
</test>

</expectedFails>
</expectedFails>
33 changes: 32 additions & 1 deletion cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,38 @@
<option name="comment">60 day exact restart test activating FATES prescribed physiology mode on an f45 grid.</option>
</options>
</test>
<test name="ERS_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCru" testmods="clm/FatesReducedComplexFixedBiogeo">
<test name="ERS_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCru" testmods="clm/FatesReducedComplexFixedBiogeo">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
<machine name="izumi" compiler="nag" category="fates"/>
<machine name="lawrencium-lr3" compiler="intel" category="fates"/>
</machines>
<options>
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="ERS_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCru" testmods="clm/FatesReducedComplexNoComp">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
<machine name="izumi" compiler="nag" category="fates"/>
<machine name="lawrencium-lr3" compiler="intel" category="fates"/>
</machines>
<options>
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="SMS_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCru" testmods="clm/FatesReducedComplexSatellitePhenology">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
<machine name="izumi" compiler="nag" category="fates"/>
<machine name="lawrencium-lr3" compiler="intel" category="fates"/>
</machines>
<options>
<option name="wallclock">00:40:00</option>
<option name="comment">Temporary smoke test. This test should be removed once the ERS version of this test passes COMPARE_base_rest</option>
</options>
</test>
<test name="ERS_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCru" testmods="clm/FatesReducedComplexSatellitePhenology">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
<machine name="izumi" compiler="nag" category="fates"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use_fates_fixed_biogeog=.true.
use_fates_fixed_biogeog=.true.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesColdDef
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_fates_nocomp = .true.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesColdDef
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use_fates_sp = .true.
fates_spitfire_mode = 0
Loading

0 comments on commit 7761d5b

Please sign in to comment.