Skip to content

Commit

Permalink
Merge pull request #2076 from glemieux/fates-luh2
Browse files Browse the repository at this point in the history
Add FATES land use change module to pass LUH2 data to FATES
  • Loading branch information
ekluzek authored Dec 31, 2023
2 parents 03246f8 + ebc5cd8 commit adbc727
Show file tree
Hide file tree
Showing 22 changed files with 485 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Externals_CLM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local_path = src/fates
protocol = git
repo_url = https://github.com/NGEET/fates
tag = sci.1.68.2_api.31.0.0
tag = sci.1.70.0_api.32.0.0
required = True

[externals_description]
Expand Down
21 changes: 17 additions & 4 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ sub setup_cmdl_fates_mode {
my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_cohort_age_tracking","use_fates_inventory_init","use_fates_fixed_biogeog",
"use_fates_nocomp","use_fates_sp","fates_inventory_ctrl_filename","use_fates_logging",
"fates_parteh_mode","use_fates_tree_damage","fates_seeddisp_cadence" );
"fates_parteh_mode","use_fates_tree_damage","fates_seeddisp_cadence","use_fates_luh","fluh_timeseries" );
# dis-allow fates specific namelist items with non-fates runs
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
Expand Down Expand Up @@ -4370,7 +4370,7 @@ sub setup_logic_fates {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init","use_fates_fixed_biogeog","use_fates_nocomp","fates_seeddisp_cadence",
"use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage" );
"use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage","use_fates_luh" );
foreach my $var ( @list ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'},
'use_fates_sp'=>$nl_flags->{'use_fates_sp'} );
Expand Down Expand Up @@ -4398,21 +4398,34 @@ sub setup_logic_fates {
# spit-fire can't be on with FATES SP mode is active
if ( $nl->get_value('fates_spitfire_mode') > 0 ) {
$log->fatal_error('fates_spitfire_mode can NOT be set to greater than 0 when use_fates_sp is true');
}
}
}
}
my $var = "use_fates_inventory_init";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
$var = "fates_inventory_ctrl_filename";
my $fname = substr $nl->get_value($var), 1, -1; # ignore first and last positions of string because those are quote characters
my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
if ( ! defined($nl->get_value($var)) ) {
$log->fatal_error("$var is required when use_fates_inventory_init is set" );
} elsif ( ! -f "$fname" ) {
$log->fatal_error("$fname does NOT point to a valid filename" );
}
}
}
my $var = "use_fates_luh";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
$var = "fluh_timeseries";
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, nofail=>1 );
my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
if ( ! defined($nl->get_value($var)) ) {
$log->fatal_error("$var is required when use_fates_luh is set" );
} elsif ( ! -f "$fname" ) {
$log->fatal_error("$fname does NOT point to a valid filename" );
}
}
}
}
}

Expand Down
12 changes: 11 additions & 1 deletion bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- FATES default parameter file -->
<!-- ================================================================== -->

<fates_paramfile>lnd/clm2/paramdata/fates_params_api.25.5.0_12pft_c230628.nc</fates_paramfile>
<fates_paramfile>lnd/clm2/paramdata/fates_params_api.32.0.0_12pft_c231215.nc</fates_paramfile>

<!-- ================================================================== -->
<!-- Default surface roughness parameterization -->
Expand Down Expand Up @@ -1572,6 +1572,15 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<flanduse_timeseries hgrid="10x15" sim_year_range="1850-2100" ssp_rcp="SSP5-3.4"
use_crop=".false." >lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc</flanduse_timeseries>

<!-- Land Use Harmonization unified data sets for dynamic FATES land use change -->

<fluh_timeseries hgrid="4x5" sim_year_range="1850-2000" use_fates=".true."
>lnd/clm2/surfdata_map/fates-sci.1.68.3_api.31.0.0_tools.1.0.1/LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101.nc</fluh_timeseries>

<!-- This one is just for testing until Issue #2304 is resolved -->
<fluh_timeseries hgrid="4x5" sim_year_range="constant" use_fates=".true."
>lnd/clm2/surfdata_map/fates-sci.1.68.3_api.31.0.0_tools.1.0.1/LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101.nc</fluh_timeseries>

<!-- Fixation and Uptake of Nitrogen Model (FUN2.0) -->
<use_fun phys="clm5_1" use_cn=".true." use_nitrif_denitrif=".true.">.true.</use_fun>
<use_fun phys="clm5_0" use_cn=".true." use_nitrif_denitrif=".true.">.true.</use_fun>
Expand Down Expand Up @@ -2755,6 +2764,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1
<use_fates_logging use_fates=".true.">.false.</use_fates_logging>
<use_fates_inventory_init use_fates=".true.">.false.</use_fates_inventory_init>
<use_fates_sp use_fates=".true.">.false.</use_fates_sp>
<use_fates_luh use_fates=".true.">.false.</use_fates_luh>
<fates_parteh_mode use_fates=".true.">1</fates_parteh_mode>
<fates_seeddisp_cadence use_fates=".true.">0</fates_seeddisp_cadence>

Expand Down
16 changes: 16 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,22 @@ Full pathname to the inventory initialization control file.
(Only relevant if FATES is on).
</entry>

<!-- This may eventually migrate to the dynamic_subgrid group-->
<entry id="use_fates_luh" type="logical" category="physics"
group="clm_inparm" valid_values="" >
If TRUE, enable use of land use harmonization (LUH) state and transition data from luh_timeseries file.
(Also, only valid for use_fates = true and is incompatible with transient runs currently.)
</entry>

<!-- This could eventually be included in the "dynamic_subgrid" -->
<entry id="fluh_timeseries" type="char*256" category="datasets"
input_pathname="abs" group="clm_inparm" valid_values="" >
Full pathname of unified land use harmonization (LUH) data file. This causes the land-use
types to vary over time.
(Required, if use_fates_luh=T)
(Only relevant if FATES is on).
</entry>

<entry id="use_luna" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on the LUNA model, to effect Photosynthesis by leaf Nitrogen
Expand Down
10 changes: 10 additions & 0 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,16 @@ sub cat_and_create_namelistinfile {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useinventorybutnotfile" =>{ options=>"--res 0.9x1.25 --bgc fates --envxml_dir . --no-megan",
namelst=>"use_fates_luh=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"inventoryfileDNE" =>{ options=>"-bgc fates -envxml_dir . -no-megan",
namelst=>"use_fates_luh=.true., fluh_timeseries='zztop'",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm4_5",
},
"useMEGANwithFATES" =>{ options=>"-bgc fates -envxml_dir . -megan",
namelst=>"",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down
10 changes: 10 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,16 @@
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="ERS_D_Ld30" grid="f45_f45_mg37" compset="I2000Clm50FatesCruRsGs" testmods="clm/FatesColdLUH2">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
<machine name="derecho" compiler="intel" category="fates"/>
<machine name="izumi" compiler="nag" category="fates"/>
</machines>
<options>
<option name="wallclock">00:40:00</option>
</options>
</test>
<test name="ERS_D_Ld3" grid="f19_g17" compset="I2000Clm50FatesCruRsGs" testmods="clm/FatesCold">
<machines>
<machine name="cheyenne" compiler="intel" category="fates"/>
Expand Down
7 changes: 3 additions & 4 deletions cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_SAPWOODC', 'FATES_LEAFC', 'FATES_FROOTC', 'FATES_REPROC',
'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S',
'FATES_DISTURBANCE_RATE_S2S', 'FATES_DISTURBANCE_RATE_FIRE',
'FATES_HARVEST_CARBON_FLUX', 'FATES_DISTURBANCE_RATE_FIRE',
'FATES_DISTURBANCE_RATE_LOGGING', 'FATES_DISTURBANCE_RATE_TREEFALL',
'FATES_DISTURBANCE_RATE_POTENTIAL', 'FATES_HARVEST_CARBON_FLUX',
'FATES_STOMATAL_COND', 'FATES_LBLAYER_COND', 'FATES_NPP', 'FATES_GPP',
'FATES_AUTORESP', 'FATES_GROWTH_RESP', 'FATES_MAINT_RESP', 'FATES_GPP_CANOPY',
'FATES_AUTORESP_CANOPY', 'FATES_GPP_USTORY', 'FATES_AUTORESP_USTORY',
Expand All @@ -28,4 +26,5 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_NEP', 'FATES_HET_RESP', 'FATES_FIRE_CLOSS', 'FATES_FIRE_FLUX_EL',
'FATES_CBALANCE_ERROR', 'FATES_ERROR_EL', 'FATES_LEAF_ALLOC',
'FATES_SEED_ALLOC', 'FATES_STEM_ALLOC', 'FATES_FROOT_ALLOC',
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC'
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC',
'FATES_PATCHAREA_LU', 'FATES_DISTURBANCE_RATE_MATRIX_LULU'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../FatesCold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_fates_luh = .true.
3 changes: 1 addition & 2 deletions cime_config/usermods_dirs/fates_sp/user_nl_clm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ hist_fexcl1 = 'FATES_TRIMMING', 'FATES_COLD_STATUS', 'FATES_GDD', 'FATES_NCHILLD
'FATES_SEEDS_IN_EXTERN_EL', 'FATES_SEED_GERM_EL', 'FATES_SEED_DECAY_EL', 'FATES_STOREC', 'FATES_VEGC',
'FATES_SAPWOODC', 'FATES_FROOTC', 'FATES_REPROC', 'FATES_STRUCTC', 'FATES_NONSTRUCTC',
'FATES_VEGC_ABOVEGROUND', 'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S', 'FATES_DISTURBANCE_RATE_S2S',
'FATES_DISTURBANCE_RATE_FIRE', 'FATES_DISTURBANCE_RATE_LOGGING', 'FATES_DISTURBANCE_RATE_TREEFALL',
'FATES_DISTURBANCE_RATE_POTENTIAL', 'FATES_HARVEST_CARBON_FLUX', 'FATES_GPP_CANOPY', 'FATES_AUTORESP_CANOPY',
'FATES_HARVEST_CARBON_FLUX', 'FATES_GPP_CANOPY', 'FATES_AUTORESP_CANOPY',
'FATES_GPP_USTORY', 'FATES_AUTORESP_USTORY', 'FATES_CROWNAREA_CL', 'FATES_DEMOTION_CARBONFLUX',
'FATES_PROMOTION_CARBONFLUX', 'FATES_MORTALITY_CFLUX_CANOPY', 'FATES_MORTALITY_CFLUX_USTORY',
'FATES_DDBH_CANOPY_SZ', 'FATES_DDBH_USTORY_SZ', 'FATES_BASALAREA_SZ',
Expand Down
4 changes: 2 additions & 2 deletions doc/.ChangeLog_template
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Does this tag change answers significantly for any of the following physics conf
[ ] clm4_5


Bugs fixed or introduced
------------------------
Bugs fixed
----------
[Remove any lines that don't apply. Remove entire section if nothing applies.]

CTSM issues fixed (include CTSM Issue #):
Expand Down
100 changes: 100 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,104 @@
===============================================================
Tag name: ctsm5.1.dev160
Originator(s): glemieux (Gregory Lemieux, LBNL, [email protected])
Date: Sat 30 Dec 2023 11:23:47 PM MST
One-line Summary: FATES landuse version 1

Purpose and description of changes
----------------------------------

This tag enables FATES to utilize the state and transitions data
from the Land Use Harmonization (https://luh.umd.edu/) data sets.
This data has been preprocessed using tooling provided by FATES via
a separate pull request (FATES#1032). A new module has been added
to the dyn_subgrid directory that largely adapts the dynHarvest
module to import and read this minimially processed data, which is
data is passed to fates.


Significant changes to scientifically-supported configurations
--------------------------------------------------------------

Does this tag change answers significantly for any of the following physics configurations?
(Details of any changes will be given in the "Answer changes" section below.)

[Put an [X] in the box for any configuration with significant answer changes.]

[ ] clm5_1

[ ] clm5_0

[ ] ctsm5_0-nwp

[ ] clm4_5


Bugs fixed
----------
CTSM issues fixed (include CTSM Issue #):
#1077 -- Read in full LUH2 dataset for use by FATES
#2283 -- fates wood product flux not being correctly reported during CBalanceCheck endrun diagnostic output

Notes of particular relevance for users
---------------------------------------
Changes made to namelist defaults (e.g., changed parameter values):
New namelist item: fluh_timeseries and use_fates_luh

Notes of particular relevance for developers:
---------------------------------------------
Changes to tests or testing:
FATES landuse testmod, FatesColdLUH2, added

IMPORTANT NOTE ON BASELINES:
FATES baseline tests have a change in namelists because the fluh_timeseries file is listed in the baselines
but was removed in a last minute change. Compare to baseline other than that change are exact though.

Testing summary:
----------------

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

build-namelist tests (if CLMBuildNamelist.pm has changed):

derecho - PASS (66 FATES tests differ because of new fates param file)

regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):

derecho ----- OK
izumi ------- PASS

fates tests: (give name of baseline if different from CTSM tagname, normally fates baselines are fates-<FATES TAG>-<CTSM TAG>)
derecho ----- OK
izumi ------- OK


Answer changes
--------------

Changes answers relative to baseline: yes, for FATES only

Summarize any changes to answers, i.e.,
- what code configurations: FATES
- what platforms/compilers: ALL
- nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff

The fates tag update incorporates bug fixes and hydraulic mortality fixes, as well as the
restructured disturbance code necessary to accomodate the new landuse transitions capability.
As such, small differences were observed in testmods that engaged specific disturbance modes
or were long enough to trigger other default disturbances (e.g. fire)

Other details
-------------

List any externals directories updated (cime, rtm, mosart, cism, fates, etc.):
fates: sci.1.69.0_api.31.0.0 -> fates-sci.1.70.0_api.32.0.0

Pull Requests that document the changes (include PR ids):
https://github.com/ESCOMP/ctsm/pull/2076
https://github.com/NGEET/fates/pull/1040

===============================================================
===============================================================
Tag name: ctsm5.1.dev159
Originator(s): multiple (slevis (Sam Levis), afoster (Adrianna Foster), erik (Erik Kluzek), wwieder (Will Wieder), glemieux (Greg Lemieux), oleson (Keith Oleson), sacks (Bill Sacks), samrabin (Sam Rabin), santos (Sean Patrick Santos))
Date: Tue 12 Dec 2023 11:10:26 AM MST
Expand Down
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
============================================================================================================================
ctsm5.1.dev160 glemieux 12/30/2023 FATES landuse version 1
ctsm5.1.dev159 multiple 12/12/2023 Various BFB fixes and updates
ctsm5.1.dev158 erik 12/07/2023 First tag with testing moved to Derecho and working PE-layouts for Derecho
ctsm5.1.dev157 samrabin 12/05/2023 Update Externals to work on Derecho
Expand Down
8 changes: 1 addition & 7 deletions src/biogeochem/CNBalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, &
real(r8) :: hrv_xsmrpool_amount_left_to_dribble(bounds%begg:bounds%endg)
real(r8) :: gru_conv_cflux_amount_left_to_dribble(bounds%begg:bounds%endg)
real(r8) :: dwt_conv_cflux_amount_left_to_dribble(bounds%begg:bounds%endg)
real(r8) :: fates_woodproduct_flux ! Total carbon wood products flux from FATES to CLM [gC/m2/s]

!-----------------------------------------------------------------------

Expand Down Expand Up @@ -309,11 +308,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, &

s = clm_fates%f2hmap(ic)%hsites(c)


fates_woodproduct_flux = clm_fates%fates(ic)%bc_out(s)%hrv_deadstemc_to_prod10c + &
clm_fates%fates(ic)%bc_out(s)%hrv_deadstemc_to_prod100c

col_cinputs = fates_litter_flux(c) + fates_woodproduct_flux
col_cinputs = fates_litter_flux(c)

! calculate total column-level outputs
! fates has already exported burn losses and fluxes to the atm
Expand Down Expand Up @@ -372,7 +367,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, &
write(iulog,*)'--- Inputs ---'
if( col%is_fates(c) ) then
write(iulog,*)'fates litter_flux = ',fates_litter_flux(c)*dt
write(iulog,*)'fates wood product flux = ',fates_woodproduct_flux*dt
else
write(iulog,*)'gpp = ',gpp(c)*dt
end if
Expand Down
Loading

0 comments on commit adbc727

Please sign in to comment.