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

V2 Land Use Change #1116

Merged
merged 131 commits into from
Jul 8, 2024
Merged

V2 Land Use Change #1116

merged 131 commits into from
Jul 8, 2024

Conversation

ckoven
Copy link
Contributor

@ckoven ckoven commented Nov 10, 2023

This PR represents the second set of changes needed for transient global land use change in FATES.

Description:

This is written on top of #1040, so the scope looks larger than the specific code unique to this PR. The added functionality here is mainly based around running in nocomp+prescribed biogeography mode. So in this configuration, each patch has two distinct categorical variables: land-use class and nocomp PFT class, and the code allows the total patch area associated with both of these to be time-varying, so that land use governs land cover. The basic idea is that the code in #1040 reads in a prescribed timeseries of land-use states and transition rates from LUH2, which determines the rate of land-use-change disturbance on any given day for any given patch, and which happens alongside the existing harvest logic, which determines the transition rate of primary -> secondary lands. The new code in this PR builds on that to allow time-varying nocomp-PFT areas in response.

The way this works is that the code reads in a land use : PFT mapping file, which determines, for every gridcell, what fraction of each land-use type is associated with each PFT. This mapping is (currently) time-independent. The underlying dataset for this comes from @lawrencepj1's files that form the basis of the CLM and ELM BGC-configuration model's land use change data and the current FATES nocomp PFT data. Using that data, this code reallocates nocomp PFT fractions during the disturbance routines for all newly-disturbed patches whose land-use identity changed due to either logging or land-use-change disturbance. So, e.g., if primary lands are converted into rangelands, the PFT areal fractions of the newly-disturbed patches shifts in response. And the nocomp logic subsequently only allows the relevant PFT to recruit on the newly-changed patch.

In addition to the core functionality, a bunch of other things are also included to make the system work in a more general way. Model initialization had to be substantially changed to extend the nocomp logic to multiple land use types, and I pulled out bare ground fraction as its own variable instead of having an index of zero as in the prior logic. I added a switch for potential vegetation mode (use_fates_potentialveg) which allows for spinning up the model under potential vegetation (i.e. all primary lands). If a run with land use is initialized from the restart file of a run with potential vegetation, then there is logic to automatically apply all needed land use transition rates and logging from primary land to other lands on the first day of the simulation, so that the initial land use states align with the driving data (see #1080 for more discussion). The parameters governing the fates of dead material produced during land use change needed to be updated to allow for global simulations (#1084).

This code is tied to E3SM branch https://github.com/glemieux/E3SM/tree/fates-landuse-pft, will coordinate PRs as this moves through the queue. The tool to regrid and reformat the land use : PFT mapping data is in #1107.

The basic functionality appears to work, though there are a few things that still need to be sorted out. But I wanted to post it now that the core code is hopefully there, so that people can start looking at it.

This represents hopefully the last major piece of code development needed to start allowing CMIP-class experiments with FATES in a prescribed biogeography configuration.

fixes #1061.
fixes #1084.
further progress along the plan lain out in #450 .

Collaborators:

Lots of discussion with lots of people, and written with support of @glemieux.

Expectation of Answer Changes:

In principle this might not be answer changing in all other configurations, but I wouldn't be surprised if roundoff level differences were introduced.

Checklist

If this is your first time contributing, please read the CONTRIBUTING document.

All checklist items must be checked to enable merging this pull request:

Contributor

  • The in-code documentation has been updated with descriptive comments
  • The documentation has been assessed to determine if updates are necessary. Relevant changes to documentation are here.

Integrator

  • FATES PASS/FAIL regression tests were run
  • Evaluation of test results for answer changes was performed and results provided

Documentation

Test Results:

CTSM (or) E3SM (specify which) test hash-tag:

CTSM (or) E3SM (specify which) baseline hash-tag:

FATES baseline hash-tag:

Test Output:

ckoven and others added 30 commits July 14, 2023 13:37
…nough patches for a given land use type to acomodate all PFTs prescribed
loaner and others added 12 commits June 17, 2024 16:07
Updates and fixes to history zeroing and flushing

Includes fixes to how some multi-dimensional history variables are
initialized.  This also introduces a new flush all history subroutine,
to be implimented as an API call in later HLM pull requests.
…ght into the list

This handles cases in which only one pft needs to receive patch area from the buffer,
but due to precision errors, following the splitting routine would result in a very
small patch, technically above the reasonable math precision limit, being held
in the buffer
@glemieux
Copy link
Contributor

Regression testing is showing mostly expected results, but I'm seeing an exact restart issues with two satellite phenology tests:

    FAIL ERP_P128x2_Ld30.f45_f45_mg37.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdSatPhen COMPARE_base_rest
    FAIL ERS_Ld30.f45_f45_mg37.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdSatPhen COMPARE_base_rest

@glemieux
Copy link
Contributor

glemieux commented Jun 27, 2024

It looks like the seed values for the base are either zero or unset and the restart is uninitialized everywhere:

37526  FATES_SEEDLING_POOL   (lon,lat,time)  t_index =     18    18
37527        1077     3312  (    33,     2,     1) (    34,     6,     1) (    33,     2,     1) (    33,     2,     1)
37528                 1083   0.000000000000000E+00  -1.199999999999999E+37 1.2E+37  0.000000000000000E+00 2.5E-01  0.000000000000000E+00
37529                 1083  -1.199999999999998E+37  -1.199999999999999E+37         -1.199999999999999E+37         -1.199999999999999E+37
37530                 3312  (    60,    11,     1) (    33,     2,     1)
37531           avg abs field values:    9.051314643096083E+36    rms diff: 5.2E+36   avg rel diff(npos):  2.5E-01
37532                                    1.199999999999980E+37                        avg decimal digits(ndif):  1.6 worst:  0.0
37533  RMS FATES_SEEDLING_POOL              5.1713E+36            NORMALIZED  4.9131E-01

FATES_SEEDS_IN_LOCAL are always zero so these are B4B.

Looking at the passing baseline I generated recently the ERS differences are always showing unset everywhere for base and rest:

65153  FATES_SEEDLING_POOL   (lon,lat,time)  t_index =     31    31
65154                 3312  (    59,    10,     1) (    33,     2,     1)
65155                 1083  -0.120000000000000E+38  -0.120000000000000E+38
65156                 1083  -0.120000000000000E+38  -0.120000000000000E+38
65157                 3312  (    59,    10,     1) (    33,     2,     1)
65158           avg abs field values:    1.199999999999980E+37
65159                                    1.199999999999980E+37

@glemieux
Copy link
Contributor

glemieux commented Jul 5, 2024

The exact restart satellite phenology issue noted above has been corrected per c9e7271.

The majority of fates testmods with differences are those that engage fixed biogeography, which includes all satellite phenology tests and the pre-existing FatesColdLUH2 test.

FAIL ERS_D_Ld15.f45_f45_mg37.I2000Clm50FatesRs.derecho_gnu.clm-FatesColdTwoStreamNoCompFixedBioGeo BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL ERP_P128x2_Ld30.f45_f45_mg37.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdSatPhen BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL ERS_D_Ld30.f45_f45_mg37.I2000Clm50FatesCruRsGs.derecho_intel.clm-FatesColdLandUse BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL ERS_D_Ld30.f45_f45_mg37.I2000Clm50FatesCruRsGs.derecho_intel.clm-FatesColdLUH2 BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL ERS_Ld30.f45_f45_mg37.I2000Clm50FatesCruRsGs.derecho_intel.clm-FatesColdFixedBiogeo BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL ERS_Ld30.f45_f45_mg37.I2000Clm50FatesCruRsGs.derecho_intel.clm-FatesColdNoCompFixedBioGeo BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL ERS_Ld30.f45_f45_mg37.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdSatPhen BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL SMS_D.1x1_brazil.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdSatPhen BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF
FAIL SMS_Lm1.f45_f45_mg37.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdBasic BASELINE fates-sci.1.76.4_api.35.1.0-ctsm5.2.008: DIFF

Looking at an older fates suite test from back on May 30 that compared d38bc59 against fates-sci.1.76.3_api.35.1.0-ctsm5.2.005, I confirmed that the satellite phenology differences seen at that time are exactly the same as the diffs with this most recent test (done via cprnc).

Their is a DIFF for the FatesColdLandUse testmod that shouldn't be showing up. Looking into this.

All other tests are B4B with expected FIELDLIST DIFFS.

@glemieux
Copy link
Contributor

glemieux commented Jul 6, 2024

The DIFF associated with the FatesColdLandUse testmod has been fixed per ESCOMP/CTSM@a486e86. The option name change for this testmod was getting truncated and as such, not populating the harvest rates correctly.

@glemieux
Copy link
Contributor

glemieux commented Jul 6, 2024

@ckoven what is your take on the DIFFs above, particularly for the satellite phenology test results? I'm seeing diffs in the first time step for these cases, which suggests the difference is due to the update in the way the patches are being initialized. Here are the DIFF values that I'm seeing for the first time steps.

SMS_D.1x1_brazil.I2000Clm60FatesSpCruRsGs.derecho_intel.clm-FatesColdSatPhen:

  1  RMS FATES_AREA_PLANTS                1.5590E-02            NORMALIZED  1.5712E-02
  2  RMS FATES_AREA_TREES                 1.4696E-02            NORMALIZED  1.5712E-02
  3  RMS FATES_ELAI                       3.1179E-03            NORMALIZED  1.5712E-02
  4  RMS FATES_LAI                        3.1179E-03            NORMALIZED  1.5712E-02
  5  RMS FATES_LBLAYER_COND               5.5511E-17            NORMALIZED  1.1751E-16
  6  RMS FATES_LEAFC                      2.4743E-04            NORMALIZED  1.5712E-02
  7  RMS FATES_NPATCHES                   1.0000E+00            NORMALIZED  4.0000E-01
  8  RMS FATES_SEEDLING_POOL              2.3612E+21            NORMALIZED  1.9677E-16
  9  RMS FATES_STOMATAL_COND              2.6470E-23            NORMALIZED  1.3350E-16
 10  RMS FATES_UNGERM_SEED_BANK           2.3612E+21            NORMALIZED  1.9677E-16
 11  RMS FATES_CANOPYAREA_HT              6.3644E-03            NORMALIZED  3.8487E-02
 12  RMS FATES_LEAFAREA_HT                1.0252E-03            NORMALIZED  3.0997E-02
 13  RMS FATES_CANOPYCROWNAREA_PF         4.2501E-03            NORMALIZED  5.1402E-02
 14  RMS FATES_CROWNAREA_PF               4.2501E-03            NORMALIZED  5.1402E-02
 15  RMS FATES_LEAFC_PF                   6.9727E-05            NORMALIZED  5.3133E-02
 16  RMS FATES_NOCOMP_PATCHAREA_PF        4.2501E-03            NORMALIZED  5.1402E-02
 17  RMS FATES_NPLANT_PF                  1.3582E-01            NORMALIZED  5.1130E-02
 18  RMS FATES_RECRUITMENT_CFLUX_PF       2.8226E-01            NORMALIZED  5.1093E-02
 19  RMS FATES_FROOTC_SL                  1.3178E-03            NORMALIZED  3.0443E-02

I suspect the NPATCHES difference is due to there being an additional patch for bareground. The seed related diffs I think are mainly due to the values being huge (normalized results are small).

The test folder on derecho can be found at: /glade/u/home/glemieux/scratch/ctsm-tests/tests_pr1116-fates-008.

@glemieux
Copy link
Contributor

glemieux commented Jul 8, 2024

I looked into this some more this morning to get a better sense of what the initialization in fbg modes look like (without landuse). The new way in which we initialize the bareground with this update creates a difference in the initial patch areas. With this change we directly reference the incoming HLM wt_nat_patch for the bareground (via bc_in(s)%pft_areafrac(0)) which is correctly being passed as zero bare ground fraction. That said, since there can be other hlm pfts with non-zero fraction beyond the 14 pfts not being mapped to fates pfts, we can end up with a total fates pft fraction less than one. This account for this, we normalize against the sum of all the fates pft areas (including bareground).

On main currently we generate the bareground fraction (in fbg+nocomp modes) by computing the difference between the sum of the fates pft fractions (not including the bareground) and 1 and use that as the bareground fraction. As a result we will generate some amount of bareground when we have the case above, even if the actual wt_nat_patch is zero.

@ckoven should we retain the old method of the bareground generation for nocomp+fbg (without landuse) given the above? Or do we feel this is more correct given that the hlm is saying there may not be bareground?

@ckoven
Copy link
Contributor Author

ckoven commented Jul 8, 2024

Thanks @glemieux I was also just looking into this and not understanding why there would be a difference. Your answer makes sense to me. To me, the new logic makes more sense than the old logic: we shouldn't be making bare ground area if the datasets say not to, it makes more sense to me to rescale the existing PFT areas proportionally.

But a larger problem remains if there are PFTs beyond the 14 that we have been using, that means that they are crop PFTs and we should be mapping those onto our crop-analog PFT(s). But that also seems to me like a subsequent development for after when this is merged.

@glemieux
Copy link
Contributor

glemieux commented Jul 8, 2024

@ckoven I think the only thing that might be of concern here, or at least should be noted for posterity, is that this will result in slightly lower sp_tlai values since the patch areas that we use to scale the sp_tlai will be slightly larger due to the patch area normalization:

if(currentPatch%area.gt.0.0_r8)then
currentSite%sp_tlai(fates_pft) = currentSite%sp_tlai(fates_pft) &
/(currentPatch%area/area)
currentSite%sp_tsai(fates_pft) = currentSite%sp_tsai(fates_pft) &
/(currentPatch%area/area)
currentSite%sp_htop(fates_pft) = currentSite%sp_htop(fates_pft) &
/(currentPatch%area/area)
endif

@glemieux glemieux merged commit fd7f343 into NGEET:main Jul 8, 2024
1 check was pending
peterdschwartz added a commit to E3SM-Project/E3SM that referenced this pull request Jul 22, 2024
This pull request adds the capability to read a landuse x pft mapping file to then be passed to fates.
It also refactors the use_fates_logging namelist option from a switch to a mode select.
This update allows the user to select a harvest mode that provides the mass or area-based
land use harvest rates from the LUH2 landuse timeseries dataset.

The fates pull request associated with this update is NGEET/fates#1116

[non-BFB] for FATES
peterdschwartz added a commit to E3SM-Project/E3SM that referenced this pull request Jul 23, 2024
This pull request adds the capability to read a landuse x pft mapping file to then be passed to fates.
It also refactors the use_fates_logging namelist option from a switch to a mode select.
This update allows the user to select a harvest mode that provides the mass or area-based land use harvest rates from the LUH2 landuse timeseries dataset.

The fates pull request associated with this update is NGEET/fates#1116

[non-BFB] for FATES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Logging fractions to product pools parameters
7 participants