Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dust emissions control moved to cmeps #2545

Merged
merged 58 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8a90024
Merge tag 'ctsm5.2.002' into dustcontrolincmeps
ekluzek Apr 26, 2024
66c1004
Update cmeps to the branch
ekluzek Apr 26, 2024
f8aa6ea
Add shr_dust_emis_mod.F90 to the files needed for unit testing, fails…
ekluzek Apr 26, 2024
b767a82
Start adding the unit testing for dust emission in cmeps
ekluzek Apr 30, 2024
82704fe
Change call to is_NOT_initialized function, unit test works
ekluzek Apr 30, 2024
118010d
add a test that is expected to fail
ekluzek Apr 30, 2024
516d147
Update cmeps version so will work
ekluzek Apr 30, 2024
5cf5dc0
Add more tests that pass
ekluzek Apr 30, 2024
c2d226c
Add new tests and get working again
ekluzek May 1, 2024
0ff68d7
Update cmeps with unit-testing completed
ekluzek May 1, 2024
f65de8f
Add LND_SETS_DUST_EMIS_DRV_FLDS which will be used to NOT set dust_em…
ekluzek May 4, 2024
89f0871
Move dust_emis and soil_erod namelist items to the drv_fld_in namelis…
ekluzek May 4, 2024
bcf0521
Merge tag 'ctsm5.2.003' into dustcontrolincmeps
ekluzek May 4, 2024
6f8021c
Start adding reference for LND_SETS_DUST_EMIS_DRV_FLDS in unit tester
ekluzek May 7, 2024
f52f76f
Add dust emis namelist default for drv_flds_in
ekluzek May 7, 2024
8aa0a70
Update cmeps to the branch
ekluzek Apr 26, 2024
603d267
Add shr_dust_emis_mod.F90 to the files needed for unit testing, fails…
ekluzek Apr 26, 2024
0b48097
Start adding the unit testing for dust emission in cmeps
ekluzek Apr 30, 2024
d2d2da4
Change call to is_NOT_initialized function, unit test works
ekluzek Apr 30, 2024
66578f0
add a test that is expected to fail
ekluzek Apr 30, 2024
a692769
Update cmeps version so will work
ekluzek Apr 30, 2024
a65752d
Add more tests that pass
ekluzek Apr 30, 2024
dd73ca6
Add new tests and get working again
ekluzek May 1, 2024
ccd976a
Update cmeps with unit-testing completed
ekluzek May 1, 2024
65fc553
Add LND_SETS_DUST_EMIS_DRV_FLDS which will be used to NOT set dust_em…
ekluzek May 4, 2024
d9c94eb
Move dust_emis and soil_erod namelist items to the drv_fld_in namelis…
ekluzek May 4, 2024
0c23d08
Update ChangeLog and ChangeSum.
samsrabin May 2, 2024
747d104
Start adding reference for LND_SETS_DUST_EMIS_DRV_FLDS in unit tester
ekluzek May 7, 2024
c36f3a9
Add dust emis namelist default for drv_flds_in
ekluzek May 7, 2024
8ab4063
Git rebase didn't correct the change files for some reason, so going …
ekluzek May 15, 2024
b706c5a
Have build-namelist not do the dust emission namelist settings, when …
ekluzek May 16, 2024
4b0c2ae
Merge remote-tracking branch 'escomp/b4b-dev' into dustcontrolincmeps
ekluzek Jul 9, 2024
cb7376e
Remove whitespace at end of lines
ekluzek Jul 9, 2024
9878509
Merge remote-tracking branch 'escomp/b4b-dev' into dustcontrolincmeps
ekluzek Jul 10, 2024
17fb3d8
Changes to remove dust_emis namelist items from CTSM fortran code and…
ekluzek Jul 11, 2024
d8ce02c
Merge branch 'dustcontrolincmeps' of github.com:ekluzek/CTSM into dus…
ekluzek Jul 11, 2024
7dd9af0
Update test number
ekluzek Jul 11, 2024
976347d
Update cmeps and ccs_config to versions used in #2590 which allows ca…
ekluzek Jul 11, 2024
170b3a5
Update cmeps and ccs_config to versions used in #2590 which allows ca…
ekluzek Jul 11, 2024
ba28bea
Update number of tests and comment out the whole values section as it…
ekluzek Jul 11, 2024
61b3cb4
Merge tag 'ctsm5.2.011' into merge-master-20240712
slevis-lmwg Jul 12, 2024
3de6f95
Merge pull request #2644 from slevis-lmwg/merge-master-20240712
slevis-lmwg Jul 12, 2024
5686def
Update bld/unit_testers/build-namelist_test.pl
ekluzek Jul 15, 2024
7dbc538
Remove duplicated tests, and new dust tests with clm6_0
ekluzek Jul 15, 2024
02f9cb3
Make fail tests lines where the namelst option is split up into two l…
ekluzek Jul 15, 2024
561ad17
Merge branch 'dustcontrolincmeps' of github.com:ekluzek/CTSM into dus…
ekluzek Jul 15, 2024
be96436
Merge branch 'b4b-dev' into dustcontrolincmeps
ekluzek Jul 16, 2024
8478b73
Comments about move to CMEPS
ekluzek Jul 16, 2024
b11bc89
Update cism to work with this cmeps version
ekluzek Jul 24, 2024
38656f9
Get LILAC test working
ekluzek Jul 24, 2024
28fbfa7
Merge tag 'ctsm5.2.015' into dustcontrolincmeps
ekluzek Jul 24, 2024
e438a90
Fix test number
ekluzek Jul 24, 2024
0f9fee7
LILAC needs to read and handle the drv_flds_in file as dust emission …
ekluzek Jul 29, 2024
0c527dd
Merge tag 'ctsm5.2.016' into dustcontrolincmeps
ekluzek Jul 29, 2024
17c748b
Fix 1x1_cidadinhoBR tests by specifying 2000_control for it and 1850_…
ekluzek Jul 29, 2024
4d4fe83
Fix test numbers
ekluzek Jul 30, 2024
cdb36a0
Update change files
ekluzek Jul 30, 2024
f28ecdb
Add note about the fails compared to baselines
ekluzek Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute
[submodule "ccs_config"]
path = ccs_config
url = https://github.com/ESMCI/ccs_config_cesm.git
fxtag = ccs_config_cesm0.0.106
fxtag = ccs_config_cesm1.0.0
fxrequired = ToplevelRequired
fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git

Expand All @@ -50,7 +50,7 @@ fxDONOTUSEurl = https://github.com/ESMCI/cime
[submodule "cmeps"]
path = components/cmeps
url = https://github.com/ESCOMP/CMEPS.git
fxtag = cmeps0.14.63
fxtag = cmeps0.14.77
fxrequired = ToplevelRequired
fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git

Expand Down
123 changes: 69 additions & 54 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ OPTIONS
CENTURY or MIMICS decomposition
This toggles on the namelist variables:
use_fates. use_lch4 and use_nitrif_denitrif are optional

(Only for CLM4.5/CLM5.0)
-[no-]chk_res Also check [do NOT check] to make sure the resolution and
land-mask is valid.
Expand Down Expand Up @@ -517,6 +517,7 @@ sub read_namelist_defaults {
"$cfgdir/namelist_files/namelist_defaults_ctsm.xml",
"$cfgdir/namelist_files/namelist_defaults_drv.xml",
"$cfgdir/namelist_files/namelist_defaults_fire_emis.xml",
"$cfgdir/namelist_files/namelist_defaults_dust_emis.xml",
"$cfgdir/namelist_files/namelist_defaults_drydep.xml" );

# Add the location of the use case defaults files to the options hash
Expand Down Expand Up @@ -1011,7 +1012,7 @@ sub setup_cmdl_fire_light_res {
if ( ! &value_is_true($nl_flags->{'neon'}) ) {
if ( defined($opts->{'clm_usr_name'}) ) {
$log->warning("The NEON lightning dataset does NOT cover the entire globe, make sure it covers the region for your grid");
} else {
} else {
$log->fatal_error("The NEON lightning dataset can NOT be used for global grids or regions or points outside of its area as it does NOT cover the entire globe.");
}
}
Expand Down Expand Up @@ -1700,7 +1701,7 @@ sub process_namelist_inline_logic {
######################################
# namelist options for dust emissions
######################################
setup_logic_dust_emis($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_dust_emis($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref);

#################################
# namelist group: megan_emis_nl #
Expand Down Expand Up @@ -2271,7 +2272,7 @@ sub setup_logic_crop_inparm {
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "initial_seed_at_planting",
'use_crop'=>$nl->get_value('use_crop') );

my $crop_residue_removal_frac = $nl->get_value('crop_residue_removal_frac');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'crop_residue_removal_frac' );
if ( $crop_residue_removal_frac < 0.0 or $crop_residue_removal_frac > 1.0 ) {
Expand Down Expand Up @@ -2612,8 +2613,8 @@ SIMYR: foreach my $sim_yr ( @sim_years ) {
if ( defined($use_init_interp_default) ) {
$log->fatal_error($err_msg." but can't find one without $useinitvar being set to true, change it to true in your user_nl_clm file in your case");
} else {
my $set = "Relevent settings: use_cndv = ". $nl_flags->{'use_cndv'} . " phys = " .
$physv->as_string() . " hgrid = " . $nl_flags->{'res'} . " sim_year = " .
my $set = "Relevent settings: use_cndv = ". $nl_flags->{'use_cndv'} . " phys = " .
$physv->as_string() . " hgrid = " . $nl_flags->{'res'} . " sim_year = " .
$settings{'sim_year'} . " lnd_tuning_mode = " . $nl_flags->{'lnd_tuning_mode'} .
"use_fates = " . $nl_flags->{'use_fates'};
$log->fatal_error($err_msg." but the default setting of $useinitvar is false, so set both $var to a startup file and $useinitvar==TRUE, or developers should modify the namelist_defaults file".$set);
Expand Down Expand Up @@ -3156,7 +3157,6 @@ sub setup_logic_supplemental_nitrogen {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'suplnitro', 'use_fates'=>$nl_flags->{'use_fates'});
}

#
# Error checking for suplnitro
#
Expand Down Expand Up @@ -3662,10 +3662,10 @@ sub setup_logic_nitrogen_deposition {
'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, 'ndep_taxmode', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'},
'use_cn'=>$nl_flags->{'use_cn'},
'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_varlist', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'},
'use_cn'=>$nl_flags->{'use_cn'},
'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_ndep', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'},
Expand Down Expand Up @@ -3960,50 +3960,65 @@ sub setup_logic_fire_emis {
#-------------------------------------------------------------------------------

sub setup_logic_dust_emis {
# Logic to handle the dust emissions
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_;
# Logic to handle the dust emissions namelists, both drv_flds_in and lnd_in files
my ($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref) = @_;

# 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" );
}
}
}
# Only set dust emission settings -- if not connected to CAM
my $lnd_sets_dust = logical_to_fortran($envxml_ref->{'LND_SETS_DUST_EMIS_DRV_FLDS'});
if ( &value_is_true( $lnd_sets_dust)) {

# 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",
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
"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'} );
}
} elsif ( $zender_source eq "atm" ) {
foreach my $option ( @zender_files_in_lnd_opts ) {
if ( defined($nl->get_value($option)) ) {
$log->fatal_error("zender_soil_erod_source is atm, and the file option $option is being set" .
" which should NOT be unless you want it handled here in the LAND model, " .
"otherwise the equivalent option is set in CAM" );
}
}
} elsif ( $zender_source eq "none" ) {
$log->fatal_error("zender_soil_erod_source is set to none and only atm or lnd should be used when $var is Zender_2002" );
}
} 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");
}
}
# Otherwise make sure dust settings are NOT being set in CLM
} 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");
}
my @vars = ( "dust_emis_method", "zender_soil_erod_source" );
foreach my $option ( @vars ) {
if ( defined($nl->get_value($option)) ) {
$log->fatal_error("Dust emission variable is being set in CTSM, which should NOT be done when" .
" connected to CAM as CAM should set them");
}
}
}
}

Expand Down Expand Up @@ -4497,8 +4512,8 @@ sub setup_logic_fates {
my $suplnitro = $nl->get_value('suplnitro');
my $parteh_mode = $nl->get_value('fates_parteh_mode');
if ( ($parteh_mode == 1) && ($suplnitro !~ /ALL/) && not &value_is_true( $nl_flags->{'use_fates_sp'}) ) {
$log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to ALL, FATES is on, " .
"but and FATES-SP is not active, but fates_parteh_mode is 1, so Nitrogen is not active" .
$log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to ALL, FATES is on, " .
"but and FATES-SP is not active, but fates_parteh_mode is 1, so Nitrogen is not active" .
"Change suplnitro back to ALL");
}
#
Expand Down Expand Up @@ -4708,7 +4723,7 @@ sub write_output_files {
$log->verbose_message("Writing clm namelist to $outfile");

# Drydep, fire-emission or MEGAN namelist for driver
@groups = qw(drydep_inparm megan_emis_nl fire_emis_nl carma_inparm);
@groups = qw(drydep_inparm megan_emis_nl fire_emis_nl carma_inparm dust_emis_inparm);
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
$outfile = "$opts->{'dir'}/drv_flds_in";
$nl->write($outfile, 'groups'=>\@groups, 'note'=>"$note" );
$log->verbose_message("Writing @groups namelists to $outfile");
Expand Down
2 changes: 0 additions & 2 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1944,8 +1944,6 @@ lnd/clm2/surfdata_esmf/NEON/surfdata_1x1_NEON_TOOL_hist_78pfts_CMIP6_simyr2000_c
<!-- 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>
Expand Down
21 changes: 21 additions & 0 deletions bld/namelist_files/namelist_defaults_dust_emis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="namelist_defaults.xsl"?>

<namelist_defaults>

<!--
Values to use by default for creation of CLM model driver namelists.
The element names are the same as the corresponding namelist
variables. Values that depend on the model configuration use
attributes to express the dependency. The recognized attributes
are: RESOLUTION, defaults, mask, ic_ymd, ic_tod, sim_year and all configuration
attributes from the config_cache.xml file (with keys converted to upper-case).
-->

<!-- Defaults for dust_emis_inparm namelist -->
<dust_emis_method>Zender_2003</dust_emis_method>

<zender_soil_erod_source>atm</zender_soil_erod_source>

</namelist_defaults>
14 changes: 0 additions & 14 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1607,20 +1607,6 @@ Mapping method from Nitrogen deposition input file to the model resolution
<!-- Dust namelist and Zender soil erodibility stream -->
<!-- ======================================================================================== -->

<entry id="dust_emis_method" type="char*12" category="physics"
group="clm_inparm" valid_values="Zender_2003,Leung_2023" >
Which dust emission method is going to be used. Either the Zender 2003 scheme or the Leung 2023
scheme.
(NOTE: The Leung 2023 method is NOT currently available)
</entry>

<entry id="zender_soil_erod_source" type="char*3" category="physics"
group="zendersoilerod" valid_values="lnd,atm" >
Option only applying for the Zender_2003 method for whether the soil erodibility file is handled
here in CTSM, or in the ATM model.
(only used when dust_emis_method is Zender_2003)
</entry>

<entry id="zendersoilerod_mapalgo" type="char*256" category="physics"
group="zendersoilerod" valid_values="bilinear,nn,nnoni,nnonj,spval,copy" >
Option only applying for the Zender_2003 method for whether the soil erodibility file is handled
Expand Down
13 changes: 13 additions & 0 deletions bld/namelist_files/namelist_definition_drv_flds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,17 @@
List of fluxes needed by the CARMA model, from CLM to CAM.
</entry>

<entry id="dust_emis_method" type="char*80" category="dust_emissions"
group="dust_emis_inparm" valid_values="Zender_2003,Leung_2023" >
Which dust emission method is going to be used. Either the Zender 2003 scheme or the Leung 2023 scheme.
(NOTE: The Leung 2023 method is NOT currently available)
</entry>

<entry id="zender_soil_erod_source" type="char*80" category="dust_emissions"
group="dust_emis_inparm" valid_values="none,lnd,atm" >
Option only applying for the Zender_2003 method for whether the soil erodibility file is handled
in the active LAND model or in the ATM model.
(only used when dust_emis_method is Zender_2003)
</entry>

</namelist_definition>
Loading
Loading