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

unit fix on excess respiration mass balance checking #1372

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rgknox
Copy link
Contributor

@rgknox rgknox commented Mar 31, 2025

Description:

Excess respiration is activated when a plant is nutrient limited but continues to accumulate carbon. When stores are full, the plant will respire excess carbon. For book-keeping purposes, we make sure that carbon fluxes match the change in the carbon stocks. This excess respiration term had a unit error when calculating these balance check fluxes. There was no error in how this term actually affected NPP, which drives plant allocations, just the checking process. The unit error was fixed and descriptive text was updated.

Also, it was noticed that unit conversions of fluxes that are per year and per day, used a global variable "hlm_days_per_year". This is an integer, but was being used in multiply and divides on real numbers. Compilers should be converting this integer to a float for us, but it is better to pre-convert it to reduce warning messages and we shouldn't assume that the compilers will fix things for us. It is better practice to specify type conversions ourselves, so I applied the conversions.

Fixes: #1354

To verify that this fix I ran the following two ELM land tests:

SMS_D_Ld20.f45_f45.IELMFATES.pm-cpu_gnu.elm-fates_rd
SMS_Ld60.f45_f45.IELMFATES.pm-cpu_gnu.elm-fates_eca

Note that the second test is typically a 20 day test, but I wanted to run it longer to give it more time to trigger the error. Both tests now pass.

Collaborators:

@glemieux @ckoven

Expectation of Answer Changes:

This should fix failing tests in ELM.
It should not affect answers. If it does, that means the integer conversion was long overdue. :/

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

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:

@rgknox rgknox added status: Ready This PR is ready for integration after having passed through peer review and final testing. type: bug fix software: history output Pertaining to FATES history output variables science: nutrients labels Mar 31, 2025
@glemieux glemieux moved this to Finding Reviewers in FATES Pull Request Planning and Status Mar 31, 2025
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.

Do we need to update the calculation here in history as well? _acc_hold variables are kgC/indiv/year and resp_excess_hold is now kgC/indiv/day, correct?

hio_aresp_si(io_si) = hio_aresp_si(io_si) + &
(ccohort%resp_g_acc_hold + ccohort%resp_m_acc_hold + &
ccohort%resp_excess_hold) * n_perm2 / days_per_year / sec_per_day

@glemieux glemieux moved this from Finding Reviewers to Under Review in FATES Pull Request Planning and Status Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
science: nutrients software: history output Pertaining to FATES history output variables status: Ready This PR is ready for integration after having passed through peer review and final testing. type: bug fix
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

ELM-FATES CNP mode mass balance error due to sci.1.80.0_api.37.0.0
2 participants