Skip to content

Commit

Permalink
Merge pull request #1967 from dmleung/zendersource_dev
Browse files Browse the repository at this point in the history
Move the dust emission source function soil erodibility for the Zender scheme from CAM to CTSM
  • Loading branch information
ekluzek committed Mar 27, 2024
2 parents 4ffba74 + b01fbb5 commit e007f67
Show file tree
Hide file tree
Showing 20 changed files with 708 additions and 44 deletions.
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 @@ -3959,6 +3965,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 @@ -4644,6 +4700,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
80 changes: 75 additions & 5 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
>30.0d00</rh_low>
<rh_low fire_method="li2016crufrc" lnd_tuning_mode="clm5_0_cam6.0"
>20.0d00</rh_low>
<rh_low fire_method="li2016crufrc" lnd_tuning_mode="clm5_0_cam5.0"
>20.0d00</rh_low>
<rh_low fire_method="li2016crufrc" lnd_tuning_mode="clm5_0_cam4.0"
>20.0d00</rh_low>
<rh_hgh fire_method="li2016crufrc" >80.0d00</rh_hgh>
<bt_min fire_method="li2016crufrc" >0.85d00</bt_min>
<bt_max fire_method="li2016crufrc" >0.98d00</bt_max>
Expand All @@ -290,6 +294,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
>0.010d00</pot_hmn_ign_counts_alpha>
<pot_hmn_ign_counts_alpha fire_method="li2016crufrc" lnd_tuning_mode="clm5_0_cam6.0"
>0.008d00</pot_hmn_ign_counts_alpha>
<pot_hmn_ign_counts_alpha fire_method="li2016crufrc" lnd_tuning_mode="clm5_0_cam5.0"
>0.008d00</pot_hmn_ign_counts_alpha>
<pot_hmn_ign_counts_alpha fire_method="li2016crufrc" lnd_tuning_mode="clm5_0_cam4.0"
>0.008d00</pot_hmn_ign_counts_alpha>
<non_boreal_peatfire_c fire_method="li2016crufrc" >0.17d-3</non_boreal_peatfire_c>
<cropfire_a1 fire_method="li2016crufrc" >1.6d-4</cropfire_a1>
<occur_hi_gdp_tree fire_method="li2016crufrc" >0.33d00</occur_hi_gdp_tree>
Expand Down Expand Up @@ -657,7 +665,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).

<!-- Can you interpolate from an initial condition file at startup (is there a finidat file to find)? -->
<!-- NOTE: Make sure all possible lnd_tuning_mode options are accounted for. Some finidat files are only for one mode -->
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="1850" >.true.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="1850" >.true.</use_init_interp>
<!-- For an exact match for these grids -->
<!-- These first five are for SP mode and CLM5.0 only -->
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="1979" lnd_tuning_mode="clm5_0_cam6.0"
Expand All @@ -676,12 +684,20 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2013" lnd_tuning_mode="clm5_0_cam6.0"
maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4CONUS.ne30x8" >.true.</use_init_interp>
<!-- For an inexact match use either low resolution or high resolution match for SP or BGC mode CLM5.0 -->
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2000" phys="clm5_0" >.true.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2000" phys="clm5_1" >.true.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2000" phys="clm5_0" >.true.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2000" phys="clm5_1" >.true.</use_init_interp>
<!-- For an inexact match use either low resolution or high resolution match for SP or BGC mode CLM4.5 -->
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2000" lnd_tuning_mode="clm4_5_GSWP3v1" >.true.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="2000" lnd_tuning_mode="clm4_5_CRUv7" >.true.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." sim_year="1979" lnd_tuning_mode="clm4_5_cam6.0" >.true.</use_init_interp>
<!-- Let CAM4 and CAM5 lnd_tuning mode be FALSE (so do a coldstart) -->
<!-- Yes, the phys setting is essentially duplicated here but it is needed to ensure this is used and isn't matched above -->
<use_init_interp use_cndv=".false." use_fates=".false." phys="clm4_5" lnd_tuning_mode="clm4_5_cam5.0" >.false.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." phys="clm4_5" lnd_tuning_mode="clm4_5_cam4.0" >.false.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." phys="clm5_0" lnd_tuning_mode="clm5_0_cam5.0" >.false.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." phys="clm5_0" lnd_tuning_mode="clm5_0_cam4.0" >.false.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." phys="clm5_1" lnd_tuning_mode="clm5_1_cam5.0" >.false.</use_init_interp>
<use_init_interp use_cndv=".false." use_fates=".false." phys="clm5_1" lnd_tuning_mode="clm5_1_cam4.0" >.false.</use_init_interp>
<!-- Default to FALSE if couldn't find a match -->
<use_init_interp >.false.</use_init_interp>
<!-- NOTE: if use_init_interp is FALSE that indicates that you can't interpolate from an initial conditions file that's similar
Expand Down Expand Up @@ -712,12 +728,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<init_interp_attributes sim_year="1850" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_0_GSWP3v1" use_cn=".false."
>hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.false. use_crop=.false. irrigate=.true. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>

<init_interp_attributes sim_year="1850" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_0_GSWP3v1" use_cn=".true."
>hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>

<!-- These two needs to specify use_cn=F/T since there is a version for both, other files just use the BGC version -->
<!-- These first two needs to specify use_cn=F/T since there is a version for both, other files just use the BGC version -->
<init_interp_attributes sim_year="1850" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_0_CRUv7" use_cn=".true."
>hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>
Expand Down Expand Up @@ -761,6 +776,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<init_interp_attributes sim_year="2000" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_0_GSWP3v1"
>hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>

<init_interp_attributes sim_year="2000" use_cndv=".false." use_fates=".false." lnd_tuning_mode="clm5_1_GSWP3v1"
>hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false.
</init_interp_attributes>
Expand Down Expand Up @@ -2759,6 +2775,60 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<stream_meshfile_ch4finundated finundation_method="ZWT_inversion"
>lnd/clm2/paramdata/finundated_inversiondata_0.9x1_ESMFmesh_cdf5_130621.nc</stream_meshfile_ch4finundated>

<!-- =========================================== -->
<!-- Defaults for dust namelist items -->
<!-- Defaults for Zender's soil erodibility data -->
<!-- =========================================== -->

<dust_emis_method>Zender_2003</dust_emis_method>
<zender_soil_erod_source dust_emis_method="Zender_2003">atm</zender_soil_erod_source>
<zendersoilerod_mapalgo>bilinear</zendersoilerod_mapalgo>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_cam6.0"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_cam6.0"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_cam6.0"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_cam5.0"
>lnd/clm2/dustemisdata/dst_source2x2_cam5.4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_cam5.0"
>lnd/clm2/dustemisdata/dst_source2x2_cam5.4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_cam5.0"
>lnd/clm2/dustemisdata/dst_source2x2_cam5.4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_cam4.0"
>lnd/clm2/dustemisdata/dst_source2x2tuned-cam4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_cam4.0"
>lnd/clm2/dustemisdata/dst_source2x2tuned-cam4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_cam4.0"
>lnd/clm2/dustemisdata/dst_source2x2tuned-cam4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_cam4.0" hgrid="0.9x1.25"
>lnd/clm2/dustemisdata/dst_source1x1tuned-cam4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_cam4.0" hgrid="0.9x1.25"
>lnd/clm2/dustemisdata/dst_source1x1tuned-cam4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_cam4.0" hgrid="0.9x1.25"
>lnd/clm2/dustemisdata/dst_source1x1tuned-cam4-forCLM_cdf5_c240202.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_cam6.0"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_cam6.0"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_cam6.0"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_CRUv7"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_CRUv7"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_CRUv7"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam45_GSWP3v1"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam50_GSWP3v1"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_fldfilename_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd" lnd_tuning_mode="cam51_GSWP3v1"
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>

<stream_meshfile_zendersoilerod dust_emis_method="Zender_2003" zender_soil_erod_source="lnd"
>lnd/clm2/dustemisdata/dust_2x2_ESMFmesh_cdf5_c230730.nc</stream_meshfile_zendersoilerod>

<!-- ========================================= -->
<!-- Defaults for different BGC/decomp modes -->
<!-- ========================================= -->
Expand Down
6 changes: 6 additions & 0 deletions bld/namelist_files/namelist_defaults_overall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ determine default values for namelists.
-->

<clm_start_type phys="clm4_5" lnd_tuning_mode="clm4_5_cam5.0" >cold</clm_start_type>
<clm_start_type phys="clm4_5" lnd_tuning_mode="clm4_5_cam4.0" >cold</clm_start_type>
<clm_start_type phys="clm5_0" lnd_tuning_mode="clm5_0_cam5.0" >cold</clm_start_type>
<clm_start_type phys="clm5_0" lnd_tuning_mode="clm5_0_cam4.0" >cold</clm_start_type>
<clm_start_type phys="clm5_1" lnd_tuning_mode="clm5_1_cam5.0" >cold</clm_start_type>
<clm_start_type phys="clm5_1" lnd_tuning_mode="clm5_1_cam4.0" >cold</clm_start_type>
<clm_start_type phys="clm5_1" use_cndv=".true." >arb_ic</clm_start_type>
<clm_start_type phys="clm5_0" use_cndv=".true." >arb_ic</clm_start_type>
<clm_start_type phys="clm4_5" use_cndv=".true." >arb_ic</clm_start_type>
Expand Down
Loading

0 comments on commit e007f67

Please sign in to comment.