Skip to content

Commit

Permalink
Merge tag 'ctsm5.3.011' into feature/megan_cherrypick_ctsm_mvertens
Browse files Browse the repository at this point in the history
Fix handling of finidat with cold starts
  • Loading branch information
mvertens committed Nov 13, 2024
2 parents 6508c01 + 931b425 commit dbab48c
Show file tree
Hide file tree
Showing 85 changed files with 1,964 additions and 1,372 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ aa04d1f7d86cc2503b98b7e2b2d84dbfff6c316b
1a49e547ba3c48fa483f9ae81a8f05adcd6b888c
045d90f1d80f713eb3ae0ac58f6c2352937f1eb0
753fda3ff0147837231a73c9c728dd9ce47b5997
f112ba0bbf96a61d5a4d354dc0dcbd8b0c68145c
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[submodule "fates"]
path = src/fates
url = https://github.com/NGEET/fates
fxtag = sci.1.78.2_api.36.0.0
fxtag = sci.1.78.3_api.36.1.0
fxrequired = AlwaysRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/NCAR/fates-release
Expand Down
35 changes: 12 additions & 23 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2591,16 +2591,9 @@ sub setup_logic_initial_conditions {
my $finidat = $nl->get_value($var);
$nl_flags->{'excess_ice_on_finidat'} = "unknown";
if ( $nl_flags->{'clm_start_type'} =~ /cold/ ) {
# start of hack
# THIS is a temporary hack to enable fates to use finidat values for startup runs
my $is_fates = $nl_flags->{'use_fates'};
if (defined $finidat && not $is_fates) {
# end of hack
$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" .
if (defined $finidat && !&value_is_true(($nl->get_value('use_fates')))) {
$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" .
" (by setting CLM_FORCE_COLDSTART=on)." );
$log->warning("Overridding input $var file with one specifying that this is a cold start from arbitrary initial conditions." );
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, "' '" );
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
$var, 'val'=>"' '", 'no_abspath'=>1);
Expand Down Expand Up @@ -2763,6 +2756,12 @@ SIMYR: foreach my $sim_yr ( @sim_years ) {
$log->fatal_error("$useinitvar is being set for you but a $var was not found, so $useinitvar, init_interp_attributes, and finidat must not be set correctly for this configuration in the namelist_default file" );
}
}

# this check has to be here and not earlier since use_init_interp is set here and hillslope is already set above in setup_logic_hillslope
if ( &value_is_true($nl->get_value($useinitvar)) && value_is_true($nl->get_value("use_hillslope")) ) {
$log->warning("WARNING: You have set use_hillslope while $useinitvar is TRUE.\n This means all hillslope columns in a gridcell will read identical values from initial conditions, even if the initial conditions (finidat) file has hillslope information. If you are sure you want this behaviour, add -ignore_warnings to CLM_BLDNML_OPTS.")
}

} # end initial conditions

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -3603,17 +3602,6 @@ sub setup_logic_luna {
if ( &value_is_true($nl->get_value('lnc_opt') ) && not &value_is_true( $nl_flags->{'use_cn'}) ) {
$log->fatal_error("Cannot turn lnc_opt to true when bgc=sp" );
}
my $var = "jmaxb1";
if ( &value_is_true( $nl_flags->{'use_luna'} ) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'use_luna'=>$nl_flags->{'use_luna'} );
}
my $val = $nl->get_value($var);
if ( ! &value_is_true( $nl_flags->{'use_luna'} ) ) {
if ( defined($val) ) {
$log->fatal_error("Cannot set $var when use_luna is NOT on" );
}
}
}

#-------------------------------------------------------------------------------
Expand All @@ -3637,6 +3625,10 @@ sub setup_logic_hillslope {
if ( (! &value_is_true($use_hillslope)) && &value_is_true($use_hillslope_routing) ) {
$log->fatal_error("Cannot turn on use_hillslope_routing when use_hillslope is off\n" );
}
my $hillslope_file = $nl->get_value('hillslope_file');
if ( &value_is_true($use_hillslope) && ( ! defined($hillslope_file) ) ) {
$log->fatal_error("You must provide hillslope_file if use_hillslope is .true.\n" );
}
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -4519,8 +4511,6 @@ sub setup_logic_canopyhydrology {
#
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'interception_fraction' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'maximum_leaf_wetted_fraction' );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_clm5_fpi' );
}

Expand All @@ -4539,7 +4529,6 @@ sub setup_logic_snowpack {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'wind_dependent_snow_density');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'snow_overburden_compaction_method');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lotmp_snowdensity_method');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upplim_destruct_metamorph');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc_ela');
Expand Down
Loading

0 comments on commit dbab48c

Please sign in to comment.