Skip to content

Commit

Permalink
Merge tag 'ctsm5.1.dev025' into hardcodep2
Browse files Browse the repository at this point in the history
Refactor ozone code, and misc. small fixes

(1) Restructure ozone code (ESCOMP#1276) in
    preparation for new ozone parameterization.

(2) Fix non-standard hexadecimal constant
    (ESCOMP#1271), needed for gfortran 10

(3) Remove support for CISM1 (ESCOMP#1226)

(4) Move final WaterGridcellBalance call out to clm_driver (resolves
    ESCOMP#1286)

(5) Only add WA and QCHARGE history fields if use_aquifer_layer is true
    (resolves ESCOMP#1281)

(6) Consolidate conditional structures for VIC initialization (resolves
    ESCOMP#1287)

 Conflicts:
	bld/namelist_files/namelist_defaults_ctsm.xml
	src/main/histFileMod.F90
  • Loading branch information
ekluzek committed Mar 12, 2021
2 parents 28804d7 + 2094348 commit 8943a36
Show file tree
Hide file tree
Showing 200 changed files with 9,940 additions and 3,839 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ manage_externals.log
/tools/PTCLM/
/cime/
/components/
/doc/doc-builder/

# ignore svn directories
**/.svn/**
Expand Down
36 changes: 28 additions & 8 deletions Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,51 @@ required = True
local_path = components/rtm
protocol = git
repo_url = https://github.com/ESCOMP/RTM
tag = rtm1_0_72
tag = rtm1_0_73
required = True

[mosart]
local_path = components/mosart
protocol = git
repo_url = https://github.com/ESCOMP/MOSART
tag = mosart1_0_37
tag = mosart1_0_38
required = True

[cdeps]
hash = 45b7a85
[mizuRoute]
local_path = components/mizuRoute
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
local_path = components/cdeps
repo_url = https://github.com/nmizukami/mizuRoute
hash = 34723c2
required = True

[cime]
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
tag = cime5.8.32
externals = ../Externals_cime.cfg
tag = branch_tags/cime5.8.32_a02
required = True

[cmeps]
local_path = cime/src/drivers/nuopc/
protocol = git
repo_url = https://github.com/ESCOMP/CMEPS.git
hash = 7654038
required = True

[cdeps]
local_path = components/cdeps
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
hash = 45b7a85
required = True

[doc-builder]
local_path = doc/doc-builder
protocol = git
repo_url = https://github.com/ESMCI/doc-builder
tag = v1.0.5
required = False

[externals_description]
schema_version = 1.0.0

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.30.0_api.8.0.0
tag = sci.1.43.2_api.14.2.0
required = True

[PTCLM]
Expand Down
9 changes: 0 additions & 9 deletions Externals_cime.cfg

This file was deleted.

155 changes: 82 additions & 73 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,9 @@ sub setup_cmdl_fates_mode {
}
} else {
# dis-allow fates specific namelist items with non-fates runs
my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_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", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_mode" );
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
$log->fatal_error("$var is being set, but can ONLY be set when -bgc fates option is used.\n");
Expand Down Expand Up @@ -907,52 +908,58 @@ sub setup_cmdl_fire_light_res {
my $var = "light_res";
my $val = $opts->{$var};
if ( $val eq "default" ) {
$nl_flags->{$var} = remove_leading_and_trailing_quotes($defaults->get_value($var));
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'},
'fates_spitfire_mode'=>$nl->get_value('fates_spitfire_mode'),
'use_fates'=>$nl_flags->{'use_fates'}, fire_method=>$nl->get_value('fire_method') );
$val = remove_leading_and_trailing_quotes( $nl->get_value($var) );
$nl_flags->{$var} = $val;
} else {
my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') );
if ( defined($fire_method) && $val ne "none" ) {
if ( $fire_method eq "nofire" ) {
$log->fatal_error("-$var option used with fire_method='nofire'. -$var can ONLY be used without the nofire option");
}
}
my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') );
if ( defined($stream_fldfilename_lightng) && $val ne "none" ) {
$log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both.");
}
if ( ! &value_is_true($nl->get_value('use_cn')) ) {
$log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)");
}
if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) {
$log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction");
}
$nl_flags->{$var} = $val;
}
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) );
if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) {
my @valid_values = $definition->get_valid_values( $var );
$log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values");
}
$log->verbose_message("Using $nl_flags->{$var} for $var.");
#
# Set flag if cn-fires are on or not
#
$var = "cnfireson";
if ( &value_is_true($nl->get_value('use_cn')) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method');
}
my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') );
if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) ) {
$log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc.");
}
if ( defined($fire_method) && $fire_method eq "nofire" ) {
$nl_flags->{$var} = ".false.";
} elsif ( &value_is_true($nl->get_value('use_cn')) ) {
$nl_flags->{$var} = ".true.";
} else {
$nl_flags->{$var} = ".false.";
}
}
my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') );
if ( defined($stream_fldfilename_lightng) && $val ne "none" ) {
$log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both.");
}
if ( ! &value_is_true($nl->get_value('use_cn')) ) {
$log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)");
}
if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) {
$log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction");
}
$nl_flags->{$var} = $val;
}
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) );
if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) {
my @valid_values = $definition->get_valid_values( $var );
$log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values");
}
$log->verbose_message("Using $nl_flags->{$var} for $var.");
#
# Set flag if cn-fires are on or not
#
$var = "cnfireson";
if ( &value_is_true($nl->get_value('use_cn')) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method');
}
my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') );
if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) {
$log->fatal_error("fire_method is being set while use_cn and use_fates are both false.");
}
if ( defined($fire_method) && $fire_method eq "nofire" ) {
$nl_flags->{$var} = ".false.";
# } elsif ( &value_is_true($nl->get_value('use_cn')) || $nl_flags->{'fates_spitfire_mode'} > 1 ) {
} elsif ( &value_is_true($nl->get_value('use_cn')) || &value_is_true($nl->get_value('use_fates')) ) {
$nl_flags->{$var} = ".true.";
} else {
$nl_flags->{$var} = ".false.";
}
}
}

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

Expand Down Expand Up @@ -2063,7 +2070,6 @@ sub error_if_set {
}
}


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

sub setup_logic_soilstate {
Expand Down Expand Up @@ -2177,9 +2183,6 @@ sub setup_logic_surface_dataset {
if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_cndv'}) ) {
$log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with dynamic vegetation (use_cndv=.true)." );
}
if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_fates'}) ) {
$log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with ecosystem dynamics (use_fates=.true)." );
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat',
'hgrid'=>$nl_flags->{'res'}, 'ssp_rcp'=>$nl_flags->{'ssp_rcp'},
'sim_year'=>$nl_flags->{'sim_year'}, 'irrigate'=>$nl_flags->{'irrigate'},
Expand Down Expand Up @@ -2620,17 +2623,17 @@ sub setup_logic_do_harvest {
# in any of these cases, a fatal error will be generated
my $cannot_be_true = "";

if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) {
$cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)";
} elsif (!&value_is_true($nl->get_value('use_cn'))) {
$cannot_be_true = "$var can only be set to true when running with CN (use_cn = true)";
} elsif (&value_is_true($nl->get_value('use_fates'))) {
$cannot_be_true = "$var currently doesn't work with ED";
}
if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) {
$cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)";
}

if ($cannot_be_true) {
$default_val = ".false.";
}
elsif (!&value_is_true($nl->get_value('use_cn')) && !&value_is_true($nl->get_value('use_fates'))) {
$cannot_be_true = "$var can only be set to true when running with either CN or FATES";
}

if ($cannot_be_true) {
$default_val = ".false.";
}

if (!$cannot_be_true) {
# Note that, if the variable cannot be true, we don't call add_default
Expand Down Expand Up @@ -3371,23 +3374,23 @@ sub setup_logic_lightning_streams {
# lightning streams require CN/BGC
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

if ( &value_is_true($nl_flags->{'cnfireson'}) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'},
'hgrid'=>$nl_flags->{'res'},
'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
'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_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
'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_lightng') !=
$nl->get_value('stream_year_last_lightng') ) {
if ( $nl_flags->{'light_res'} ne "none" ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo',
'hgrid'=>$nl_flags->{'res'},
'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng',
'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_lightng',
'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_lightng') !=
$nl->get_value('stream_year_last_lightng') ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_lightng', '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_fldfilename_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lightng',
'hgrid'=>$nl_flags->{'light_res'} );
} else {
# If bgc is NOT CN/CNDV then make sure none of the Lightng settings are set
Expand All @@ -3396,7 +3399,7 @@ sub setup_logic_lightning_streams {
defined($nl->get_value('model_year_align_lightng')) ||
defined($nl->get_value('lightng_tintalgo' )) ||
defined($nl->get_value('stream_fldfilename_lightng')) ) {
$log->fatal_error("When bgc is SP (NOT CN or BGC) or fire_method==nofire none of: stream_year_first_lightng,\n" .
$log->fatal_error("When bgc is SP (NOT CN or BGC or FATES) or fire is turned off none of: stream_year_first_lightng,\n" .
"stream_year_last_lightng, model_year_align_lightng, lightng_tintalgo nor\n" .
"stream_fldfilename_lightng can be set!");
}
Expand Down Expand Up @@ -3676,6 +3679,11 @@ sub setup_logic_canopyfluxes {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_undercanopy_stability' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'itmax_canopy_fluxes',
'structure'=>$nl_flags->{'structure'});
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_biomass_heat_storage',
'use_fates'=>$nl_flags->{'use_fates'}, 'phys'=>$nl_flags->{'phys'} );
if ( &value_is_true($nl->get_value('use_biomass_heat_storage') ) && &value_is_true( $nl_flags->{'use_fates'}) ) {
$log->fatal_error('use_biomass_heat_storage can NOT be set to true when fates is on');
}
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -3862,8 +3870,8 @@ sub setup_logic_fates {

if (&value_is_true( $nl_flags->{'use_fates'}) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init", "use_fates_logging","fates_parteh_mode" );
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_logging","fates_parteh_mode", "use_fates_cohort_age_tracking" );
foreach my $var ( @list ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'} );
}
Expand Down Expand Up @@ -3891,6 +3899,7 @@ sub setup_logic_misc {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'for_testing_run_ncdiopio_tests');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'hist_master_list_file');
}

#-------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 8943a36

Please sign in to comment.