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

[Land Use] C-based wood harvest #888

Merged
merged 27 commits into from
Jan 31, 2023
Merged

Conversation

sshu88
Copy link
Contributor

@sshu88 sshu88 commented Aug 2, 2022

Added C-based harvest as another option (wood_harvest_units = 2) in FATES.

Description:

See issue #869

Corresponding E3SM PR: E3SM-Project/E3SM#5106

Collaborators:

@jenniferholm @aldivi @ckoven @rgknox @glemieux

Expectation of Answer Changes:

Checklist:

  • My change requires a change to the documentation.
  • I have updated the in-code documentation .AND. (the technical note .OR. the wiki) accordingly.
  • [ X ] I have read the CONTRIBUTING document.
  • FATES PASS/FAIL regression tests were run
  • If answers were expected to change, evaluation was performed and provided

Test Results:

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

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

FATES baseline hash-tag: FATES - aaa1062

Test Output:

See issue #869

@glemieux glemieux added the PR status: Not Ready The author is signaling that this PR is a work in progress and not ready for integration. label Aug 2, 2022
@glemieux glemieux removed the PR status: Not Ready The author is signaling that this PR is a work in progress and not ready for integration. label Sep 19, 2022
@glemieux glemieux requested a review from ckoven October 10, 2022 16:47
Copy link
Contributor

@ckoven ckoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sshu88 for this, I think it is a great addition! I have a bunch of comments and questions, mostly I am trying to wrap my head around these changes.

main/FatesHistoryInterfaceMod.F90 Show resolved Hide resolved
! ! transfer factor from kg biomass (dry matter) to kg carbon
! ! now we applied a simple fraction of 50% based on the IPCC
! ! guideline
! real(r8), parameter :: carbon_per_kg_biomass = 0.5_r8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this lines since they are no longer used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove.

harvestable_forest_c, available_forest_c
end if
!write(fates_log(),*) 'HLM harvest carbon data not implemented yet. Exiting.'
!call endrun(msg=errMsg(sourcefile, __LINE__))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete above two lines since it is now working?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

harvest_rate = 0._r8
harvest_rate_c = 0._r8
harvest_rate_supply = 0._r8
harvest_tag = 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
harvest_tag = 2
harvest_tag(:) = 2

Copy link
Contributor Author

@sshu88 sshu88 Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial value for this tag shall be 1 since we removed the logics to account for available_forest_c. Will change.

biogeochem/EDLoggingMortalityMod.F90 Show resolved Hide resolved
Comment on lines 576 to 577
real(r8) :: harvest_rate_c ! Temporary variable
real(r8) :: harvest_rate_supply ! Temporary variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the units of the above two variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kgC site-1. Will add.

Comment on lines 562 to 563
real(r8), intent(in) :: harvestable_forest_c(:) ! site level forest c matching criteria available for harvest
real(r8), intent(out) :: harvest_rate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are units for these two variables? one is a carbon stock and one is an areal rate of harvest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Will add.

do h_index = 1,hlm_num_lu_harvest_cats
if (patch_anthro_disturbance_label .eq. primaryforest) then
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_VH1") then! .or. &
! hlm_harvest_catnames(h_index) .eq. "HARVEST_VH2") then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again curious why not using HARVEST_VH2 here?

Comment on lines 586 to 623
do h_index = 1,hlm_num_lu_harvest_cats
if (patch_anthro_disturbance_label .eq. primaryforest) then
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_VH1") then! .or. &
! hlm_harvest_catnames(h_index) .eq. "HARVEST_VH2") then
harvest_rate_c = harvest_rate_c + hlm_harvest_rates(h_index)
! Determine the total supply of available C for harvest
if(harvestable_forest_c(h_index) >= harvest_rate_c) then
harvest_rate_supply = harvest_rate_supply + harvestable_forest_c(h_index)
harvest_tag(h_index) = 0
else
harvest_tag(h_index) = 1
end if
endif
else if (patch_anthro_disturbance_label .eq. secondaryforest .and. &
secondary_age >= secondary_age_threshold) then
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH1") then
harvest_rate_c = harvest_rate_c + hlm_harvest_rates(h_index)
if(harvestable_forest_c(h_index) >= harvest_rate_c) then
harvest_rate_supply = harvest_rate_supply + harvestable_forest_c(h_index)
harvest_tag(h_index) = 0
else
harvest_tag(h_index) = 1
end if
endif
else if (patch_anthro_disturbance_label .eq. secondaryforest .and. &
secondary_age < secondary_age_threshold) then
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH2") then! .or. &
! hlm_harvest_catnames(h_index) .eq. "HARVEST_SH3") then
harvest_rate_c = harvest_rate_c + hlm_harvest_rates(h_index)
if(harvestable_forest_c(h_index) >= harvest_rate_c) then
harvest_rate_supply = harvest_rate_supply + harvestable_forest_c(h_index)
harvest_tag(h_index) = 0
else
harvest_tag(h_index) = 1
end if
endif
endif
end do
Copy link
Contributor

@ckoven ckoven Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the logic here of adding each category ofhlm_harvest_rates(:) to the harvest_rate_c as you go through the loop, it seems like it should be only using the hlm_harvest_rates(:) indexed for each category within each patch type comparison? I'm also unclear about the time normalization between hlm_harvest_rates(:) which is a rate and harvestable_forest_c(:) which is a stock? Is there meant to be an implicit annualization in that comparison? If so, should it be made explicit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for now. But since I will include non-forest harvest into the harvest rate, we now need these 3 categories to be separated.

hlm_harvest_rates is in the unit of kgC site-1 yr-1 and harvestable_forest_c is in the unit of kgC site -1. Thus the calculation here will get an annual harvest_rate in the unit of area fraction yr-1, by assuming the carbon fraction to be equivalent to the area fraction. I will add comments on these variables.

Comment on lines 448 to 450
! under two different scenarios:
! harvestable carbon: aggregate all cohorts matching the dbhmin harvest criteria
! available carbon: aggregate all cohorts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this 'available' vs 'harvestable' carbon logic still used? I think it isn't so suggest changing the description.

Suggested change
! under two different scenarios:
! harvestable carbon: aggregate all cohorts matching the dbhmin harvest criteria
! available carbon: aggregate all cohorts
! according to the the dbhmin harvest criteria

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I forgot changing some of the comment here. Thank you for double checking.

@sshu88
Copy link
Contributor Author

sshu88 commented Nov 10, 2022

Hi @glemieux, I found a lot of differences in EDPatchDynamicsMod.F90 when merging FATES_ELM API 24 into my version. Just want to double check if you have already done the merge in the current version. If so I shall change that file back and only add my revision.

@glemieux
Copy link
Contributor

Thanks for checking @sshu88. I haven't merged in the latest fates master commits into this branch. Please feel free to push the merge with deconflicts to your branch or let me know if you'd like support with deconflicting the merge.

@sshu88
Copy link
Contributor Author

sshu88 commented Nov 11, 2022

Hi @glemieux. I did a manual vimdiff check and found the differences are actually caused by a series changes of the indents from loop and if statements. I will return back to the previous version of EDPatchDynamics.F90 and manually add my revision to avoid these confusions.

@glemieux
Copy link
Contributor

glemieux commented Dec 1, 2022

Hi @glemieux. I did a manual vimdiff check and found the differences are actually caused by a series changes of the indents from loop and if statements. I will return back to the previous version of EDPatchDynamics.F90 and manually add my revision to avoid these confusions.

Apologies for the delayed response @sshu88. Just to clarify: would it be helpful for me to help deconflict your branch?

@rgknox
Copy link
Contributor

rgknox commented Dec 5, 2022

@sshu88 is EDLoggingMortalityMod.F90 still an appropriate name for this file in your opinion? Is this file handling a broader number of things than identifying mortality rates and mass fluxes from logging?

@sshu88
Copy link
Contributor Author

sshu88 commented Dec 5, 2022

@sshu88 is EDLoggingMortalityMod.F90 still an appropriate name for this file in your opinion? Is this file handling a broader number of things than identifying mortality rates and mass fluxes from logging?

New subroutines transferred the harvest rate from carbon amount to disturbance rate, so I think the file name is still appropriate.

deallocate(this%variables(i_var)%burned)
deallocate(this%variables(i_var)%damaged)
end do
if(allocated(this%variables)) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sshu88 , did you encounter problems without this check? All cohorts should have a PRT allocation, if there is not, than there is a bigger problem in our logic flow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only once on Cori when running global version. I added this check and model passed. But the model branch I used on other machine (e.g., lawrencium) does not have this check and no issue is found.

@glemieux
Copy link
Contributor

glemieux commented Dec 8, 2022

I ran the ctsm-based fates suite of tests with the current version of the code against the sci.1.60.3_api.24.2.0 tag and all expected tests pass. This was primarily to make sure that nothing is accidentally breaking or answer changing from this PR (which is not expected). Only differences are due to new history variables from this PR. Folder location on cheyenne: /glade/u/home/glemieux/scratch/ctsm-tests/tests_pr888-paramfile

@wwieder
Copy link

wwieder commented Dec 8, 2022

Thanks for doing this testing, @glemieux. What do we need to do on the CTSM side to support this PR? Is there a parallel issue / PR than needs to be made for CTSM?

Copy link
Contributor

@glemieux glemieux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change needed to bring get_harvestable_carbon up to date with API25.

biogeochem/EDLoggingMortalityMod.F90 Outdated Show resolved Hide resolved
Copy link
Contributor

@glemieux glemieux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few minor questions.

biogeochem/EDPatchDynamicsMod.F90 Outdated Show resolved Hide resolved
main/FatesHistoryInterfaceMod.F90 Outdated Show resolved Hide resolved
@glemieux
Copy link
Contributor

I tested this against fates-sci.1.62.0_api.25.0.0-ctsm5.1.dev116 and aside from expected failures, this is mostly b4b aside from fieldlist differences. There is one difference due to the dev116 tag, but this is actually in the coupler output only and expected. Additionally, #701 seems to have cropped back up for the ERS hydro test. @adrifoster is going to mark that as expected failure in dev117.

@glemieux glemieux merged commit 7775358 into NGEET:main Jan 31, 2023
bishtgautam added a commit to E3SM-Project/E3SM that referenced this pull request Feb 13, 2023
This pull request contains modification in E3SM corresponding to another FATES
NGEET/fates#888. In detail, the necessary input to enable
FATES C-based harvest from ELM is passed to FATES through bc_in. Output
from FATES used to calculate land use emission and net biosphere productivity
is passed to ELM through bc_out.

[non-B4B] (FATES tests only)
bishtgautam added a commit to E3SM-Project/E3SM that referenced this pull request Feb 14, 2023
This pull request contains modification in E3SM corresponding to another FATES
NGEET/fates#888. In detail, the necessary input to enable
FATES C-based harvest from ELM is passed to FATES through bc_in. Output
from FATES used to calculate land use emission and net biosphere productivity
is passed to ELM through bc_out.

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

Successfully merging this pull request may close these issues.

7 participants