Skip to content

Commit

Permalink
Merge branch 'cropresidues3' into tillage-and-residues4
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Jan 8, 2024
2 parents 2f69473 + 336f848 commit cd6a021
Show file tree
Hide file tree
Showing 43 changed files with 1,402 additions and 269 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ b88e1cd1b28e3609684c79a2ec0e88f26cfc362b
b771971e3299c4fa56534b93421f7a2b9c7282fd
9de88bb57ea9855da408cbec1dc8acb9079eda47
8bc4688e52ea23ef688e283698f70a44388373eb
c8bd4c6f98c0b411391b4355da449507db3aab4e
4ee49e3e516ca7dee5df378f65664f93a7db4415
0207bc98dd5c75cd69a0e788bc53e41093712f5c
e4d38681df23ccca0ae29581a45f8362574e0630
0a5a9e803b56ec1bbd6232eff1c99dbbeef25eb7
810cb346f05ac1aabfff931ab1a2b7b584add241
5933b0018f8e29413e30dda9b906370d147bad45
025d5e7c2e80263717fb029101d65cbbf261c3c4
a9d96219902cf609636886c7073a84407f450d9a
# Ran SystemTests and python/ctsm through black python formatter
5364ad66eaceb55dde2d3d598fe4ce37ac83a93c
8056ae649c1b37f5e10aaaac79005d6e3a8b2380
0bc3f00115d86d026a977918661c93779b3b19f9
540b256d1f3382f4619d7b0877c32d54ce5c40b6
8a168bb0895f4f2421608dd2589398e13a6663e6
183fc26a6691bbdf87f515dc47924a64be3ced9b
6fccf682eaf718615407d9bacdd3903b8786a03d
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.68.2_api.31.0.0
tag = sci.1.70.0_api.32.0.0
required = True

[externals_description]
Expand Down
28 changes: 23 additions & 5 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ sub setup_cmdl_fates_mode {
my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_cohort_age_tracking","use_fates_inventory_init","use_fates_fixed_biogeog",
"use_fates_nocomp","use_fates_sp","fates_inventory_ctrl_filename","use_fates_logging",
"fates_parteh_mode","use_fates_tree_damage","fates_seeddisp_cadence" );
"fates_parteh_mode","use_fates_tree_damage","fates_seeddisp_cadence","use_fates_luh","fluh_timeseries" );
# dis-allow fates specific namelist items with non-fates runs
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
Expand Down Expand Up @@ -2240,8 +2240,13 @@ sub setup_logic_crop_inparm {
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "initial_seed_at_planting",
'use_crop'=>$nl->get_value('use_crop') );

my $crop_residue_removal_frac = $nl->get_value('crop_residue_removal_frac');
if ( $crop_residue_removal_frac < 0.0 or $crop_residue_removal_frac > 1.0 ) {
$log->fatal_error("crop_residue_removal_frac must be in range [0, 1]");
}
} else {
error_if_set( $nl, "Can NOT be set without crop on", "baset_mapping", "baset_latvary_slope", "baset_latvary_intercept" );
error_if_set( $nl, "Can NOT be set without crop on", "baset_mapping", "baset_latvary_slope", "baset_latvary_intercept", "crop_residue_removal_frac" );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'crop_fsat_equals_zero' );
}
}
Expand Down Expand Up @@ -4386,7 +4391,7 @@ sub setup_logic_fates {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init","use_fates_fixed_biogeog","use_fates_nocomp","fates_seeddisp_cadence",
"use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage" );
"use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage","use_fates_luh" );
foreach my $var ( @list ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'},
'use_fates_sp'=>$nl_flags->{'use_fates_sp'} );
Expand Down Expand Up @@ -4414,21 +4419,34 @@ sub setup_logic_fates {
# spit-fire can't be on with FATES SP mode is active
if ( $nl->get_value('fates_spitfire_mode') > 0 ) {
$log->fatal_error('fates_spitfire_mode can NOT be set to greater than 0 when use_fates_sp is true');
}
}
}
}
my $var = "use_fates_inventory_init";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
$var = "fates_inventory_ctrl_filename";
my $fname = substr $nl->get_value($var), 1, -1; # ignore first and last positions of string because those are quote characters
my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
if ( ! defined($nl->get_value($var)) ) {
$log->fatal_error("$var is required when use_fates_inventory_init is set" );
} elsif ( ! -f "$fname" ) {
$log->fatal_error("$fname does NOT point to a valid filename" );
}
}
}
my $var = "use_fates_luh";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
$var = "fluh_timeseries";
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, nofail=>1 );
my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
if ( ! defined($nl->get_value($var)) ) {
$log->fatal_error("$var is required when use_fates_luh is set" );
} elsif ( ! -f "$fname" ) {
$log->fatal_error("$fname does NOT point to a valid filename" );
}
}
}
}
}

Expand Down
14 changes: 13 additions & 1 deletion bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- FATES default parameter file -->
<!-- ================================================================== -->

<fates_paramfile>lnd/clm2/paramdata/fates_params_api.25.5.0_12pft_c230628.nc</fates_paramfile>
<fates_paramfile>lnd/clm2/paramdata/fates_params_api.32.0.0_12pft_c231215.nc</fates_paramfile>

<!-- ================================================================== -->
<!-- Default surface roughness parameterization -->
Expand Down Expand Up @@ -553,6 +553,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<use_grainproduct use_crop=".true." phys="clm5_0" >.true.</use_grainproduct> <!-- 1-year grain product pool default to on for clm50 if crop is turned on -->
<use_grainproduct use_crop=".true." phys="clm5_1" >.true.</use_grainproduct> <!-- 1-year grain product pool default to on for clm50 if crop is turned on -->

<crop_residue_removal_frac>0.d+0</crop_residue_removal_frac>

<!-- Crop model options -->
<baset_mapping use_crop=".true." phys="clm4_5" >constant</baset_mapping>
<baset_mapping use_crop=".true." phys="clm5_0" >varytropicsbylat</baset_mapping>
Expand Down Expand Up @@ -1572,6 +1574,15 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<flanduse_timeseries hgrid="10x15" sim_year_range="1850-2100" ssp_rcp="SSP5-3.4"
use_crop=".false." >lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc</flanduse_timeseries>

<!-- Land Use Harmonization unified data sets for dynamic FATES land use change -->

<fluh_timeseries hgrid="4x5" sim_year_range="1850-2000" use_fates=".true."
>lnd/clm2/surfdata_map/fates-sci.1.68.3_api.31.0.0_tools.1.0.1/LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101.nc</fluh_timeseries>

<!-- This one is just for testing until Issue #2304 is resolved -->
<fluh_timeseries hgrid="4x5" sim_year_range="constant" use_fates=".true."
>lnd/clm2/surfdata_map/fates-sci.1.68.3_api.31.0.0_tools.1.0.1/LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101.nc</fluh_timeseries>

<!-- Fixation and Uptake of Nitrogen Model (FUN2.0) -->
<use_fun phys="clm5_1" use_cn=".true." use_nitrif_denitrif=".true.">.true.</use_fun>
<use_fun phys="clm5_0" use_cn=".true." use_nitrif_denitrif=".true.">.true.</use_fun>
Expand Down Expand Up @@ -2755,6 +2766,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<use_fates_logging use_fates=".true.">.false.</use_fates_logging>
<use_fates_inventory_init use_fates=".true.">.false.</use_fates_inventory_init>
<use_fates_sp use_fates=".true.">.false.</use_fates_sp>
<use_fates_luh use_fates=".true.">.false.</use_fates_luh>
<fates_parteh_mode use_fates=".true.">1</fates_parteh_mode>
<fates_seeddisp_cadence use_fates=".true.">0</fates_seeddisp_cadence>

Expand Down
23 changes: 23 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,22 @@ Full pathname to the inventory initialization control file.
(Only relevant if FATES is on).
</entry>

<!-- This may eventually migrate to the dynamic_subgrid group-->
<entry id="use_fates_luh" type="logical" category="physics"
group="clm_inparm" valid_values="" >
If TRUE, enable use of land use harmonization (LUH) state and transition data from luh_timeseries file.
(Also, only valid for use_fates = true and is incompatible with transient runs currently.)
</entry>

<!-- This could eventually be included in the "dynamic_subgrid" -->
<entry id="fluh_timeseries" type="char*256" category="datasets"
input_pathname="abs" group="clm_inparm" valid_values="" >
Full pathname of unified land use harmonization (LUH) data file. This causes the land-use
types to vary over time.
(Required, if use_fates_luh=T)
(Only relevant if FATES is on).
</entry>

<entry id="use_luna" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on the LUNA model, to effect Photosynthesis by leaf Nitrogen
Expand Down Expand Up @@ -1148,6 +1164,13 @@ Toggle to turn on the prognostic fertilizer for crop model
Toggle to turn on the 1-year grain product pool in the crop model
</entry>

<entry id="crop_residue_removal_frac" type="real" category="physics"
group="clm_inparm" valid_values="" value="0.0d00">
Fraction of post-harvest crop residues (leaf and stem) to move to
1-year product pool instead of letting them fall as litter.
<default>Default: 0.0</default>
</entry>

<entry id="baset_mapping" type="char*20" category="physics"
group="crop_inparm" valid_values="constant,varytropicsbylat" value="constant">
Type of mapping to use for base temperature for prognostic crop model
Expand Down
10 changes: 10 additions & 0 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,16 @@ sub cat_and_create_namelistinfile {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useinventorybutnotfile" =>{ options=>"--res 0.9x1.25 --bgc fates --envxml_dir . --no-megan",
namelst=>"use_fates_luh=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"inventoryfileDNE" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"use_fates_luh=.true., fluh_timeseries='zztop'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useMEGANwithFATES" =>{ options=>"-bgc fates -envxml_dir . -megan",
namelst=>"",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down
10 changes: 10 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,16 @@
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="ERS_D_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCruRsGs" testmods="clm/FatesColdLUH2">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
<machine name="derecho" compiler="intel" category="fates"/>
<machine name="izumi" compiler="nag" category="fates"/>
</machines>
<options>
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="ERS_D_Ld3" grid="f19_g17" compset="I2000Clm50FatesCruRsGs" testmods="clm/FatesCold">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
Expand Down
7 changes: 3 additions & 4 deletions cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_SAPWOODC', 'FATES_LEAFC', 'FATES_FROOTC', 'FATES_REPROC',
'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S',
'FATES_DISTURBANCE_RATE_S2S', 'FATES_DISTURBANCE_RATE_FIRE',
'FATES_HARVEST_CARBON_FLUX', 'FATES_DISTURBANCE_RATE_FIRE',
'FATES_DISTURBANCE_RATE_LOGGING', 'FATES_DISTURBANCE_RATE_TREEFALL',
'FATES_DISTURBANCE_RATE_POTENTIAL', 'FATES_HARVEST_CARBON_FLUX',
'FATES_STOMATAL_COND', 'FATES_LBLAYER_COND', 'FATES_NPP', 'FATES_GPP',
'FATES_AUTORESP', 'FATES_GROWTH_RESP', 'FATES_MAINT_RESP', 'FATES_GPP_CANOPY',
'FATES_AUTORESP_CANOPY', 'FATES_GPP_USTORY', 'FATES_AUTORESP_USTORY',
Expand All @@ -28,4 +26,5 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_NEP', 'FATES_HET_RESP', 'FATES_FIRE_CLOSS', 'FATES_FIRE_FLUX_EL',
'FATES_CBALANCE_ERROR', 'FATES_ERROR_EL', 'FATES_LEAF_ALLOC',
'FATES_SEED_ALLOC', 'FATES_STEM_ALLOC', 'FATES_FROOT_ALLOC',
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC'
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC',
'FATES_PATCHAREA_LU', 'FATES_DISTURBANCE_RATE_MATRIX_LULU'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesCold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_fates_luh = .true.
3 changes: 1 addition & 2 deletions cime_config/usermods_dirs/fates_sp/user_nl_clm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ hist_fexcl1 = 'FATES_TRIMMING', 'FATES_COLD_STATUS', 'FATES_GDD', 'FATES_NCHILLD
'FATES_SEEDS_IN_EXTERN_EL', 'FATES_SEED_GERM_EL', 'FATES_SEED_DECAY_EL', 'FATES_STOREC', 'FATES_VEGC',
'FATES_SAPWOODC', 'FATES_FROOTC', 'FATES_REPROC', 'FATES_STRUCTC', 'FATES_NONSTRUCTC',
'FATES_VEGC_ABOVEGROUND', 'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S', 'FATES_DISTURBANCE_RATE_S2S',
'FATES_DISTURBANCE_RATE_FIRE', 'FATES_DISTURBANCE_RATE_LOGGING', 'FATES_DISTURBANCE_RATE_TREEFALL',
'FATES_DISTURBANCE_RATE_POTENTIAL', 'FATES_HARVEST_CARBON_FLUX', 'FATES_GPP_CANOPY', 'FATES_AUTORESP_CANOPY',
'FATES_HARVEST_CARBON_FLUX', 'FATES_GPP_CANOPY', 'FATES_AUTORESP_CANOPY',
'FATES_GPP_USTORY', 'FATES_AUTORESP_USTORY', 'FATES_CROWNAREA_CL', 'FATES_DEMOTION_CARBONFLUX',
'FATES_PROMOTION_CARBONFLUX', 'FATES_MORTALITY_CFLUX_CANOPY', 'FATES_MORTALITY_CFLUX_USTORY',
'FATES_DDBH_CANOPY_SZ', 'FATES_DDBH_USTORY_SZ', 'FATES_BASALAREA_SZ',
Expand Down
4 changes: 2 additions & 2 deletions doc/.ChangeLog_template
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Does this tag change answers significantly for any of the following physics conf
[ ] clm4_5


Bugs fixed or introduced
------------------------
Bugs fixed
----------
[Remove any lines that don't apply. Remove entire section if nothing applies.]

CTSM issues fixed (include CTSM Issue #):
Expand Down
Loading

0 comments on commit cd6a021

Please sign in to comment.