Skip to content

Commit

Permalink
Merge tag 'ctsm5.1.dev133' into python/xesmf-add
Browse files Browse the repository at this point in the history
FATES API update to facilitate fates refactor

This updates a number of FATES type names and module use statements
which correspond with a refactoring effort that moves FATES
patches and cohorts into their own respective modules.

With the FATES update is a minor science update, so there are
changes to answers for FATES.

This also incorporates a minor update to a more recent version
of the ccs config external.
  • Loading branch information
ekluzek committed Aug 10, 2023
2 parents 01534b1 + 942de5c commit 8842be8
Show file tree
Hide file tree
Showing 68 changed files with 9,200 additions and 1,369 deletions.
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ e44dc469439e02e9ee582dab274d890ebdfab104
b88e1cd1b28e3609684c79a2ec0e88f26cfc362b
51c102c5df2e0ef971b5f8eeeb477567899af63a
7dacad70e74e2ec97f6492d4e7a3cb5dd498bcd7
b771971e3299c4fa56534b93421f7a2b9c7282fd
9de88bb57ea9855da408cbec1dc8acb9079eda47
8bc4688e52ea23ef688e283698f70a44388373eb
# Ran SystemTests and python/ctsm through black python formatter
5364ad66eaceb55dde2d3d598fe4ce37ac83a93c
4 changes: 2 additions & 2 deletions Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ hash = 34723c2
required = True

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

[cmeps]
Expand Down
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.66.1_api.25.5.0
tag = sci.1.67.1_api.26.0.0
required = True

[externals_description]
Expand Down
116 changes: 112 additions & 4 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1625,9 +1625,9 @@ sub process_namelist_inline_logic {
setup_logic_urban($opts, $nl_flags, $definition, $defaults, $nl);

###############################
# namelist group: crop #
# namelist group: crop_inparm #
###############################
setup_logic_crop($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_crop_inparm($opts, $nl_flags, $definition, $defaults, $nl);

###############################
# namelist group: ch4par_in #
Expand Down Expand Up @@ -1695,6 +1695,11 @@ sub process_namelist_inline_logic {
##################################
setup_logic_lai_streams($opts, $nl_flags, $definition, $defaults, $nl);

##################################
# namelist group: cropcal_streams #
##################################
setup_logic_cropcal_streams($opts, $nl_flags, $definition, $defaults, $nl);

##########################################
# namelist group: soil_moisture_streams #
##########################################
Expand Down Expand Up @@ -1788,6 +1793,11 @@ sub process_namelist_inline_logic {
# namelist group: clm_initinterp_inparm #
#########################################
setup_logic_initinterp($opts, $nl_flags, $definition, $defaults, $nl);

###############################
# namelist group: exice_streams #
###############################
setup_logic_exice($opts, $nl_flags, $definition, $defaults, $nl);
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -2149,7 +2159,7 @@ sub setup_logic_urban {

#-------------------------------------------------------------------------------

sub setup_logic_crop {
sub setup_logic_crop_inparm {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

if ( &value_is_true($nl->get_value('use_crop')) ) {
Expand Down Expand Up @@ -2192,6 +2202,7 @@ sub setup_logic_soilstate {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'organic_frac_squared' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_bedrock',
'use_fates'=>$nl_flags->{'use_fates'}, 'vichydro'=>$nl_flags->{'vichydro'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice'); # excess ice flag should be read before stream vars

my $var1 = "soil_layerstruct_predefined";
my $var2 = "soil_layerstruct_userdefined";
Expand Down Expand Up @@ -3920,6 +3931,53 @@ sub setup_logic_lai_streams {

#-------------------------------------------------------------------------------

sub setup_logic_cropcal_streams {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

# Set first and last stream years
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_cropcal',
'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_cropcal',
'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});

# Set align year, if first and last years are different
if ( $nl->get_value('stream_year_first_cropcal') !=
$nl->get_value('stream_year_last_cropcal') ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'model_year_align_cropcal', 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
}

# Set up other crop calendar parameters
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'generate_crop_gdds');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_mxmat');

# Option checks
my $generate_crop_gdds = $nl->get_value('generate_crop_gdds') ;
my $use_mxmat = $nl->get_value('use_mxmat') ;
my $sdate_file = $nl->get_value('stream_fldFileName_sdate') ;
my $gdd_file = $nl->get_value('stream_fldFileName_cultivar_gdds') ;
my $mesh_file = $nl->get_value('stream_meshfile_cropcal') ;
if ( $generate_crop_gdds eq '.true.' ) {
if ( $use_mxmat eq '.true.' ) {
$log->fatal_error("If generate_crop_gdds is true, you must also set use_mxmat to false" );
}
if ( $sdate_file eq '' ) {
$log->fatal_error("If generate_crop_gdds is true, you must specify stream_fldFileName_sdate")
}
if ( $gdd_file ne '' ) {
$log->fatal_error("If generate_crop_gdds is true, do not specify stream_fldFileName_cultivar_gdds")
}
}
if ( $mesh_file eq '' and ( $sdate_file ne '' or $gdd_file ne '' ) ) {
$log->fatal_error("If prescribing crop sowing dates and/or maturity requirements, you must specify stream_meshfile_cropcal")
}
}

#-------------------------------------------------------------------------------

sub setup_logic_soilwater_movement {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

Expand Down Expand Up @@ -4254,6 +4312,54 @@ sub setup_logic_fates {
}
}

#-------------------------------------------------------------------------------
sub setup_logic_exice {
#
# excess ice streams
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
my $use_exice = $nl->get_value( 'use_excess_ice' );
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)) {
# Can only be true if excess ice is also on, otherwise fail
if (defined($use_exice) && not value_is_true($use_exice)) {
$log->fatal_error("use_excess_ice_streams can NOT be TRUE when use_excess_ice is FALSE" );
}
# Otherwise if ice streams are off
} else {
my @list = ( "stream_meshfile_exice", "stream_fldfilename_exice" );
# fail is excess ice streams files are set
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
$log->fatal_error("$var should NOT be set when use_excess_ice_streams=FALSE" );
}
}
# mapalgo can only be none, if excess ice streams are off
my $map_algo = $nl->get_value("stream_mapalgo_exice");
if ( defined($map_algo) && ($map_algo ne "none") ) {
$log->fatal_error("stream_mapalgo_exice can ONLY be none when use_excess_ice_streams=FALSE" );
}
}
# If excess ice is on
if (defined($use_exice) && value_is_true($use_exice)) {
# IF nuopc driver and excess ice streams are on get the stream defaults
if (defined($use_exice_streams) && value_is_true($use_exice_streams)) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_exice');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_mapalgo_exice');
# If excess ice streams on, but NOT the NUOPC driver fail
if ( not $opts->{'driver'} eq "nuopc" ) {
$log->fatal_error("nuopc driver is required when use_excess_ice_streams is set to true" );
# NUOPC driver needs a mesh file
} else {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_exice');
}
}
}


} # end exice streams

#-------------------------------------------------------------------------------

sub setup_logic_misc {
Expand Down Expand Up @@ -4297,14 +4403,15 @@ sub write_output_files {
my @groups;
@groups = qw(clm_inparm ndepdyn_nml popd_streams urbantv_streams light_streams
soil_moisture_streams lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology
cropcal_streams
clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate
finidat_consistency_checks dynpft_consistency_checks
clm_initinterp_inparm century_soilbgcdecompcascade
soilhydrology_inparm luna friction_velocity mineral_nitrogen_dynamics
soilwater_movement_inparm rooting_profile_inparm
soil_resis_inparm bgc_shared canopyfluxes_inparm aerosol
clmu_inparm clm_soilstate_inparm clm_nitrogen clm_snowhydrology_inparm
cnprecision_inparm clm_glacier_behavior crop irrigation_inparm
cnprecision_inparm clm_glacier_behavior crop_inparm irrigation_inparm
surfacealbedo_inparm water_tracers_inparm);

#@groups = qw(clm_inparm clm_canopyhydrology_inparm clm_soilhydrology_inparm
Expand All @@ -4324,6 +4431,7 @@ sub write_output_files {
push @groups, "nitrif_inparm";
push @groups, "lifire_inparm";
push @groups, "ch4finundated";
push @groups, "exice_streams";
push @groups, "soilbgc_decomp";
push @groups, "clm_canopy_inparm";
if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') {
Expand Down
17 changes: 17 additions & 0 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<min_critical_dayl_method use_cn=".true." phys="clm5_1" >DependsOnLat</min_critical_dayl_method>
<onset_thresh_depends_on_veg >.false.</onset_thresh_depends_on_veg>
<min_critical_dayl_method >Constant</min_critical_dayl_method>
<generate_crop_gdds >.false.</generate_crop_gdds>
<use_mxmat >.true.</use_mxmat>

<!-- use additional stress deciduous onset trigger -->
<constrain_stress_deciduous_onset phys="clm4_5" >.false.</constrain_stress_deciduous_onset>
Expand Down Expand Up @@ -1665,6 +1667,11 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<lai_mapalgo hgrid="1x1_asphaltjungleNJ" >nn</lai_mapalgo>
<lai_mapalgo hgrid="5x5_amazon" >nn</lai_mapalgo>

<!-- crop calendar streams namelist defaults -->
<stream_year_first_cropcal >1850</stream_year_first_cropcal>
<stream_year_last_cropcal >2100</stream_year_last_cropcal>
<model_year_align_cropcal >1850</model_year_align_cropcal>

<!-- lightning streams namelist defaults -->

<light_res use_cn=".false." >none</light_res>
Expand Down Expand Up @@ -2706,4 +2713,14 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1

<init_interp_method>general</init_interp_method>

<!-- ========================================= -->
<!-- Defaults for excess ice -->
<!-- ========================================= -->

<use_excess_ice>.false.</use_excess_ice>

<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>
<stream_mapalgo_exice use_excess_ice=".true.">bilinear</stream_mapalgo_exice>

</namelist_defaults>
85 changes: 82 additions & 3 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1090,20 +1090,20 @@ Toggle to turn on the 1-year grain product pool in the crop model
</entry>

<entry id="baset_mapping" type="char*20" category="physics"
group="crop" valid_values="constant,varytropicsbylat" value="constant">
group="crop_inparm" valid_values="constant,varytropicsbylat" value="constant">
Type of mapping to use for base temperature for prognostic crop model
constant = Just use baset from the PFT parameter file
varytropicsbylat = Vary the tropics by latitude
</entry>

<entry id="baset_latvary_slope" type="real" category="physics"
group="crop" valid_values="" value="0.4d00">
group="crop_inparm" valid_values="" value="0.4d00">
Only used when baset_mapping == varytropicsbylat
Slope with latitude in degrees to vary tropical baset by
</entry>

<entry id="baset_latvary_intercept" type="real" category="physics"
group="crop" valid_values="" value="12.0d00">
group="crop_inparm" valid_values="" value="12.0d00">
Only used when baset_mapping == varytropicsbylat
Intercept at zero latitude to add to baset from the PFT parameter file
</entry>
Expand All @@ -1129,6 +1129,16 @@ Phenology onset depends on the vegetation type
(only used when CN is on)
</entry>

<entry id="generate_crop_gdds" type="logical" category="physics"
group="cnphenology" valid_values="" value=".false.">
Set to .true. in order to override crop harvesting logic and to instead harvest the day before the next sowing date. Used to generate growing-degree day outputs that can be used with an external script to generate new GDD requirement ("cultivar") files.
</entry>

<entry id="use_mxmat" type="logical" category="physics"
group="cnphenology" valid_values="" value=".true.">
Set to .false. in order to ignore crop PFT parameter for maximum growing season length (mxmat). Must be set to .false. when generate_crop_gdds is .true.
</entry>

<entry id="min_critical_dayl_method" type="char*25" category="physics"
group="cnphenology" valid_values="Constant,DependsOnLat,DependsOnVeg,DependsOnLatAndVeg">
Method for determining what the minimum critical day length for seasonal decidious leaf offset depends on
Expand Down Expand Up @@ -1805,6 +1815,41 @@ Mapping method from LAI input file to the model resolution
copy = copy using the same indices
</entry>

<!-- ======================================================================================== -->
<!-- cropcal_streams streams Namelist -->
<!-- ======================================================================================== -->

<!-- Crop calendars -->
<entry id="stream_year_first_cropcal" type="integer" category="datasets"
group="cropcal_streams" valid_values="" >
First year to loop over for crop calendar data
</entry>

<entry id="stream_year_last_cropcal" type="integer" category="datasets"
group="cropcal_streams" valid_values="" >
Last year to loop over for crop calendar data
</entry>

<entry id="model_year_align_cropcal" type="integer" category="datasets"
group="cropcal_streams" valid_values="" >
Simulation year that aligns with stream_year_first_cropcal value
</entry>

<entry id="stream_fldfilename_sdate" type="char*256(30)" category="datasets"
input_pathname="abs" group="cropcal_streams" valid_values="" >
Filename of input stream data for sowing dates
</entry>

<entry id="stream_fldfilename_cultivar_gdds" type="char*256(30)" category="datasets"
input_pathname="abs" group="cropcal_streams" valid_values="" >
Filename of input stream data for cultivar growing degree-day targets
</entry>

<entry id="stream_meshfile_cropcal" type="char*256" category="datasets"
input_pathname="abs" group="cropcal_streams" valid_values="" >
Filename of input stream data for crop calendar inputs
</entry>

<!-- ======================================================================================== -->
<!-- light_streams streams Namelist (when CN an CLM4_5 is active) -->
<!-- ======================================================================================== -->
Expand Down Expand Up @@ -2803,4 +2848,38 @@ use case.)

</entry>

<!-- ======================================================================================== -->
<!-- Namelist options related to excess ice -->
<!-- ======================================================================================== -->
<entry id="use_excess_ice" type="logical" category="clm_physics"
group="clm_inparm" valid_values="" >
If TRUE turn on the excess ice physics, (Lee et al., 2014; Cai et al., 2020)
</entry>

<entry id="use_excess_ice_streams" type="logical" category="clm_physics"
group="exice_streams" valid_values="" >
If TRUE and use_excess_ice is TRUE, use the excess ice stream to determine the initial values of the excess ice field
if FALSE and use_excess_ice is TRUE, expect excess ice to come from the initial conditions or restart file
Expect to be FALSE is use_excess_ice is FALSE
</entry>

<entry id="stream_fldfilename_exice" type="char*256(30)" category="datasets"
input_pathname="abs" group="exice_streams" valid_values="" >
Filename of input stream data for excess ice data
</entry>

<entry id="stream_meshfile_exice" type="char*256" category="datasets"
input_pathname="abs" group="exice_streams" valid_values="" >
mesh filename of input stream data for excess ice
</entry>

<entry id="stream_mapalgo_exice" type="char*256" category="datasets"
group="exice_streams" valid_values="bilinear,nn,none" >
Mapping method from excess ice input stream data to the model resolution
bilinear = bilinear interpolation
nn = nearest neighbor
none = no interpolation
</entry>


</namelist_definition>
Loading

0 comments on commit 8842be8

Please sign in to comment.