Skip to content

Commit

Permalink
Merge pull request #2464 from ekluzek/updatetodev176
Browse files Browse the repository at this point in the history
Update ctsm5.2 branch to ctsm5.1.dev176 and some small updates
  • Loading branch information
ekluzek authored Apr 19, 2024
2 parents af3c7fb + 78b2267 commit 7746e9f
Show file tree
Hide file tree
Showing 49 changed files with 1,031 additions and 368 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ ctsm.input_data_list.previous
/tools/mksurfdata_esmf/mksurfdata_in
/tools/mksurfdata_esmf/surfdata_*.nc
/tools/mksurfdata_esmf/landuse.timeseries_*.nc
/tools/mksurfdata_esmf/mksurfdata_jobscript_multi
/tools/mksurfdata_esmf/mksurfdata_jobscript_single
/tools/mksurfdata_esmf/mksurfdata_jobscript_multi.sh
/tools/mksurfdata_esmf/mksurfdata_jobscript_single.sh
/tools/mksurfdata_esmf/pio_iotype.txt
/tools/mksurfdata_esmf/*.sh
/tools/mksurfdata_esmf/mksrf_*.o*
/tools/mksurfdata_esmf/tool_bld
/tools/mksurfdata_esmf/pio_iotype.txt

Expand Down
2 changes: 1 addition & 1 deletion Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ required = True
local_path = components/cism
protocol = git
repo_url = https://github.com/ESCOMP/CISM-wrapper
tag = cismwrap_2_1_97
tag = cismwrap_2_1_99
externals = Externals_CISM.cfg
required = True

Expand Down
79 changes: 68 additions & 11 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ sub process_namelist_commandline_options {
setup_cmdl_dynamic_vegetation($opts, $nl_flags, $definition, $defaults, $nl);
setup_cmdl_fates_mode($opts, $nl_flags, $definition, $defaults, $nl);
setup_cmdl_vichydro($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_lnd_tuning($opts, $nl_flags, $definition, $defaults, $nl, $physv);
setup_cmdl_run_type($opts, $nl_flags, $definition, $defaults, $nl);
setup_cmdl_output_reals($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_lnd_tuning($opts, $nl_flags, $definition, $defaults, $nl, $physv);
}

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -1265,6 +1265,8 @@ sub setup_cmdl_simulation_year {

sub setup_cmdl_run_type {
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
# Set the clm_start_type and the st_year, start year
# This MUST be done after lnd_tuning_mode is set

my $val;
my $var = "clm_start_type";
Expand All @@ -1279,20 +1281,19 @@ sub setup_cmdl_run_type {
my $group = $definition->get_group_name($date);
$nl->set_variable_value($group, $date, $ic_date );
}
my $set = undef;
if (defined $opts->{$var}) {
if ($opts->{$var} eq "default" ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'},
'sim_year'=>$st_year, 'sim_year_range'=>$nl_flags->{'sim_year_range'},
'bgc_spinup'=>$nl_flags->{'bgc_spinup'} );
} else {
if ($opts->{$var} ne "default" ) {
$set = 1;
my $group = $definition->get_group_name($var);
$nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) );
}
} else {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'},
'sim_year'=>$st_year );
}
if ( ! defined $set ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'},
'sim_year'=>$st_year, 'sim_year_range'=>$nl_flags->{'sim_year_range'},
'bgc_spinup'=>$nl_flags->{'bgc_spinup'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} );
}
$nl_flags->{'clm_start_type'} = $nl->get_value($var);
$nl_flags->{'st_year'} = $st_year;
Expand Down Expand Up @@ -1697,6 +1698,11 @@ sub process_namelist_inline_logic {
#################################
setup_logic_fire_emis($opts, $nl_flags, $definition, $defaults, $nl);

######################################
# namelist options for dust emissions
######################################
setup_logic_dust_emis($opts, $nl_flags, $definition, $defaults, $nl);

#################################
# namelist group: megan_emis_nl #
#################################
Expand Down Expand Up @@ -3981,6 +3987,56 @@ sub setup_logic_fire_emis {

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

sub setup_logic_dust_emis {
# Logic to handle the dust emissions
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;

# First get the dust emission method
my $var = "dust_emis_method";
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var );

my $dust_emis_method = remove_leading_and_trailing_quotes( $nl->get_value($var) );

my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod",
"zendersoilerod_mapalgo" );
if ( $dust_emis_method eq "Zender_2003" ) {
# get the zender_soil_erod_source
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
"zender_soil_erod_source", 'dust_emis_method'=>$dust_emis_method );

my $zender_source = remove_leading_and_trailing_quotes( $nl->get_value('zender_soil_erod_source') );
if ( $zender_source eq "lnd" ) {
foreach my $option ( @zender_files_in_lnd_opts ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $option,
'dust_emis_method'=>$dust_emis_method, 'zender_soil_erod_source'=>$zender_source,
'hgrid'=>$nl_flags->{'res'}, 'lnd_tuning_mod'=>$nl_flags->{'lnd_tuning_mode'} );
}
} else {
foreach my $option ( @zender_files_in_lnd_opts ) {
if ( defined($nl->get_value($option)) ) {
$log->fatal_error("zender_soil_erod_source is NOT lnd, but the file option $option is being set" .
" and should NOT be unless you want it handled here in the LAND model, " .
"otherwise the equivalent option is set in CAM" );
}
}
}
} else {
# Verify that NONE of the Zender options are being set if Zender is NOT being used
push @zender_files_in_lnd_opts, "zender_soil_erod_source";
foreach my $option ( @zender_files_in_lnd_opts ) {
if ( defined($nl->get_value($option)) ) {
$log->fatal_error("dust_emis_method is NOT set to Zender_2003, but one of it's options " .
"$option is being set, need to change one or the other" );
}
}
if ( $dust_emis_method eq "Leung_2023" ) {
$log->warning("dust_emis_method is Leung_2023 and that option has NOT been brought into CTSM yet");
}
}
}

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

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

Expand Down Expand Up @@ -4665,6 +4721,7 @@ sub write_output_files {
push @groups, "exice_streams";
push @groups, "soilbgc_decomp";
push @groups, "clm_canopy_inparm";
push @groups, "zendersoilerod";
if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') {
push @groups, "scf_swenson_lawrence_2012_inparm";
}
Expand Down
Loading

0 comments on commit 7746e9f

Please sign in to comment.