Skip to content

Commit

Permalink
Merge pull request #610 from olyson/hrv_xsmrpool_to_atm
Browse files Browse the repository at this point in the history
Add option to dribble XSMRPOOL at crop harvest to atmosphere over a half year
  • Loading branch information
ekluzek authored Jan 15, 2019
2 parents aea3cfa + 1989e97 commit 02f0af2
Show file tree
Hide file tree
Showing 17 changed files with 598 additions and 305 deletions.
2 changes: 1 addition & 1 deletion Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ required = True
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
tag = cime_cesm2_1_rel_05
tag = cime_cesm2_1_rel_06
required = True

[externals_description]
Expand Down
70 changes: 52 additions & 18 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,10 @@ sub process_namelist_inline_logic {
################################################
setup_logic_century_soilbgcdecompcascade($opts, $nl_flags, $definition, $defaults, $nl, $physv);

#############################
# namelist group: cngeneral #
#############################
setup_logic_cngeneral($opts, $nl_flags, $definition, $defaults, $nl, $physv);
####################################
# namelist group: cnvegcarbonstate #
####################################
Expand Down Expand Up @@ -3502,29 +3506,33 @@ sub setup_logic_lai_streams {
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
if ( &value_is_true($nl_flags->{'use_crop'}) && &value_is_true($nl_flags->{'use_lai_streams'}) ) {

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

if ( &value_is_true($nl_flags->{'use_crop'}) && &value_is_true($nl->get_value('use_lai_streams')) ) {
$log->fatal_error("turning use_lai_streams on is incompatable with use_crop set to true.");
}
if ( $nl_flags->{'bgc_mode'} eq "sp" ) {

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lai_streams');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lai_mapalgo',
'hgrid'=>$nl_flags->{'res'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lai',
'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_lai',
'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_lai') !=
$nl->get_value('stream_year_last_lai') ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'model_year_align_lai', 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
if ( &value_is_true($nl->get_value('use_lai_streams')) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lai_mapalgo',
'hgrid'=>$nl_flags->{'res'} );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lai',
'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_lai',
'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_lai') !=
$nl->get_value('stream_year_last_lai') ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'model_year_align_lai', '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_lai',
'hgrid'=>"360x720cru" );
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lai',
'hgrid'=>"360x720cru" );
} else {
# If bgc is CN/CNDV then make sure none of the LAI settings are set
if ( defined($nl->get_value('stream_year_first_lai')) ||
Expand Down Expand Up @@ -3598,6 +3606,32 @@ sub setup_logic_cnvegcarbonstate {

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

sub setup_logic_cngeneral {
# Must be set after setup_logic_co2_type
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) {
if ( &value_is_true($nl->get_value('use_crop')) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dribble_crophrv_xsmrpool_2atm',
'co2_type' => remove_leading_and_trailing_quotes($nl->get_value('co2_type')),
'use_crop' => $nl->get_value('use_crop') );
} else {
if ( defined($nl->get_value('dribble_crophrv_xsmrpool_2atm')) ) {
$log->fatal_error("When CROP is NOT on dribble_crophrv_xsmrpool_2atm can NOT be set\n" );
}
}
} else {
if ( defined($nl->get_value('reseed_dead_plants')) ||
defined($nl->get_value('dribble_crophrv_xsmrpool_2atm')) ) {
$log->fatal_error("When CN is not on none of the following can be set: ,\n" .
"dribble_crophrv_xsmrpool_2atm nor reseed_dead_plantsr\n" .
"(eg. don't use these options with SP mode).");
}
}
}

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

sub setup_logic_rooting_profile {
#
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
Expand Down
5 changes: 5 additions & 0 deletions bld/namelist_files/namelist_defaults_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<use_hydrstress phys="clm4_5" >.false.</use_hydrstress>
<use_hydrstress phys="clm5_0" use_fates=".true." >.false.</use_hydrstress>
<use_hydrstress phys="clm5_0" use_fates=".false.">.true.</use_hydrstress>

<!-- General CN options -->
<dribble_crophrv_xsmrpool_2atm co2_type="prognostic" use_crop=".true.">.true.</dribble_crophrv_xsmrpool_2atm>
<dribble_crophrv_xsmrpool_2atm use_crop=".true.">.false.</dribble_crophrv_xsmrpool_2atm>

<!--
Initial condition files to use and or interpolate from
Expand Down
7 changes: 6 additions & 1 deletion bld/namelist_files/namelist_definition_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ Representative concentration pathway for future scenarios [radiative forcing at
-999.9 means do NOT use a future scenario, just use historical data.
</entry>

<entry id="ssp-rcp" type="character*8" category="default_settings"
<entry id="ssp_rcp" type="character*8" category="default_settings"
group="default_settings"
valid_values="hist,SSP1-2.6,SSP3-7.0,SSP5-3.4,SSP2-4.5,SSP1-1.9,SSP4-3.4,SSP4-6.0,SSP5-8.5">
Shared Socioeconomic Pathway (SSP) and Representative Concentration Pathway (RCP) combination for future scenarios
Expand Down Expand Up @@ -1970,6 +1970,11 @@ Number of days over which to use exponential relaxation of NPP in N fixation cal
Flag to reseed any dead plants on startup from reading the initial conditions file
</entry>

<entry id="dribble_crophrv_xsmrpool_2atm" type="logical" category="clm_physics"
group="cn_general" valid_values="" >
Harvest the XSMR pool at crop harvest time to the atmosphere slowly at an exponential rate
</entry>

<!-- C isotope flags -->
<entry id="use_c13" type="logical" category="clm_isotope"
group="clm_inparm" valid_values="" >
Expand Down
17 changes: 16 additions & 1 deletion bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ sub make_env_run {
#
# Figure out number of tests that will run
#
my $ntests = 947;
my $ntests = 950;
if ( defined($opts{'compare'}) ) {
$ntests += 600;
}
Expand Down Expand Up @@ -387,6 +387,21 @@ sub make_env_run {
GLC_TWO_WAY_COUPLING=>"FALSE",
conopts=>"-phys clm4_5",
},
"reseed without CN" =>{ options=>" -envxml_dir . -bgc sp",
namelst=>"reseed_dead_plants=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
conopts=>"-phys clm5_0",
},
"dribble_crphrv w/o CN" =>{ options=>" -envxml_dir . -bgc sp",
namelst=>"dribble_crophrv_xsmrpool_2atm=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
conopts=>"-phys clm5_0",
},
"dribble_crphrv w/o crop" =>{ options=>" -envxml_dir . -bgc cn -no-crop",
namelst=>"dribble_crophrv_xsmrpool_2atm=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
conopts=>"-phys clm5_0",
},
"CNDV with flanduse_timeseries" =>{ options=>" -envxml_dir .",
namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
hist_type1d_pertape = ' ',' ',' '

use_init_interp = .true.
finidat = '/glade/p_old/image/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0001.r.2001-01-01-00000.nc'
finidat = '/glade/p/cisl/dares/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0001.r.2001-01-01-00000.nc'
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
hist_type1d_pertape = ' ',' ',' '

use_init_interp = .true.
finidat = '/glade/p_old/image/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0002.r.2001-01-01-00000.nc'
finidat = '/glade/p/cisl/dares/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0002.r.2001-01-01-00000.nc'
1 change: 1 addition & 0 deletions doc/ChangeSum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tag Who Date Summary
============================================================================================================================
release-clm5.0.16 erik 01/15/2019 PtVg and ssp_rcp future scenario options and Antarctica wetlands fix to mksurfdata, and option to dribble crop harvest XSMRPOOL flux to atmosphere
release-clm5.0.15 sacks 12/06/2018 Option for rain-to-snow to immediately run off in some regions
release-clm5.0.14 erik 11/29/2018 Update cime and fix surface dataset for f05 1850 non-crop case
release-clm5.0.13 erik 11/14/2018 Update externals with new CO2/presearo/rtm/mosart, add science_support, change testing
Expand Down
99 changes: 99 additions & 0 deletions doc/release-clm5.0.ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,103 @@
===============================================================
Tag name: release-clm5.0.16
Originator(s): erik (Erik Kluzek)
Date: Tue Jan 15 15:13:43 MST 2019
One-line Summary: PtVg and ssp_rcp future scenario options and Antarctica wetlands fix to mksurfdata, and option to dribble crop harvest XSMRPOOL flux to atmosphere

Purpose of this version:
------------------------

no-anthro changes on release branch. Update of mksurfdata for Antarctic. Also start adding in newly created SSP-RCP datasets that are easy to add in.
Also add in new option for dribble_crophrv_xsmrpool_2atm.

CTSM Master Tag This Corresponds To: N/A

Summary of changes:
-------------------

Issues fixed (include CTSM Issue #): #553 #533 #589 #547 #545
#553 -- More robust mksurfdata_map logic for determining where to put wetlands
#533 -- Add -no-anthro option to mksurfdata_map
#589 -- Existence of content in the lai_streams namelist makes it confusing to users
#547 -- Add conus_30_x8 grid as valid option for CTSM and mksurfdata_map
#545 -- Antarctica ice shelves are being treated as wetlands rather than glaciers

Science changes since: release-clm5.0.15
mksurfdata now properly makes Antarctica teated as glacier rather than wetland
Add in option to create all of the SSP-RCP future scenarios in mksurfdata_map
Add dribble_crophrv_xsmrpool_2atm, to do slow release of crop harvested XSMRPOOL to atmosphere
(only active by default when co2_type="prognostic")

Software changes since: release-clm5.0.15
Add no-anthro option for mksurfdata_map

Changes to User Interface since: release-clm5.0.15
New namelist option: dribble_crophrv_xsmrpool_2atm
Add SSP-RCP future scenarios can be done in mksurfdata_map

Testing:
--------

[PASS means all tests PASS and OK means tests PASS other than expected fails.]

build-namelist tests:

cheyenne - PASS

unit-tests (components/clm/src):

cheyenne - PASS
hobart --- PASS

tools-tests (components/clm/test/tools):

cheyenne - PASS
hobart ---

PTCLM testing (components/clm/tools/shared/PTCLM/test):

cheyenne - PASS

regular tests (aux_clm):

cheyenne_intel ---- OK
cheyenne_gnu ------ OK
hobart_nag -------- OK
hobart_pgi -------- OK
hobart_intel ------ OK

Summary of Answer changes:
-------------------------

Baseline version for comparison: release-clm5.0.15

Changes answers relative to baseline: No bit-for-bit

Detailed list of changes:
------------------------

Externals being used:

cism: release-cesm2.0.04
rtm: release-cesm2.0.02
mosart: release-cesm2.0.03
cime: cime_cesm2_1_rel_06
FATES: fates_s1.8.1_a3.0.0
PTCLM: PTCLM2_180611

CTSM Tag versions pulled over from master development branch: N/A

Pull Requests that document the changes (include PR ids): #567 #561 #564 #616 #610
(https://github.com/ESCOMP/ctsm/pull)

#616 -- No anthro options to tools, and all future scenarios in place, plus a few small issue fixes
#610 -- Add option to dribble XSMRPOOL at crop harvest to atmosphere over a half year
#567 -- ignore patterns for vim
#564 -- Update mksurfdata_map to include glaciers outside of pft landmask
#561 -- Add list of checks for new surface datasets

===============================================================
===============================================================
Tag name: release-clm5.0.15
Originator(s): sacks (Bill Sacks)
Date: Thu Dec 6 10:14:30 MST 2018
Expand Down
6 changes: 4 additions & 2 deletions src/biogeochem/CNBalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, &
er => cnveg_carbonflux_inst%er_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic
col_fire_closs => cnveg_carbonflux_inst%fire_closs_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total column-level fire C loss
col_hrv_xsmrpool_to_atm => cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_col , & ! Input: [real(r8) (:) ] (gC/m2/s) excess MR pool harvest mortality

col_xsmrpool_to_atm => cnveg_carbonflux_inst%xsmrpool_to_atm_col , & ! Input: [real(r8) (:) ] (gC/m2/s) excess MR pool crop harvest loss to atm
som_c_leached => soilbiogeochem_carbonflux_inst%som_c_leached_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total SOM C loss from vertical transport

totcolc => cnveg_carbonstate_inst%totc_col & ! Input: [real(r8) (:) ] (gC/m2) total column carbon, incl veg and cpool
Expand All @@ -167,7 +167,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, &

! calculate total column-level outputs
! er = ar + hr, col_fire_closs includes patch-level fire losses
col_coutputs = er(c) + col_fire_closs(c) + col_hrv_xsmrpool_to_atm(c)
col_coutputs = er(c) + col_fire_closs(c) + col_hrv_xsmrpool_to_atm(c) + &
col_xsmrpool_to_atm(c)

! Fluxes to product pools are included in column-level outputs: the product
! pools are not included in totcolc, so are outside the system with respect to
Expand Down Expand Up @@ -211,6 +212,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, &
write(iulog,*)'er = ',er(c)*dt
write(iulog,*)'col_fire_closs = ',col_fire_closs(c)*dt
write(iulog,*)'col_hrv_xsmrpool_to_atm = ',col_hrv_xsmrpool_to_atm(c)*dt
write(iulog,*)'col_xsmrpool_to_atm = ',col_xsmrpool_to_atm(c)*dt
write(iulog,*)'wood_harvestc = ',wood_harvestc(c)*dt
write(iulog,*)'grainc_to_cropprodc = ',grainc_to_cropprodc(c)*dt
write(iulog,*)'-1*som_c_leached = ',som_c_leached(c)*dt
Expand Down
Loading

0 comments on commit 02f0af2

Please sign in to comment.