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

fleaf is sensitive to compiler math imprecision #899

Open
rgknox opened this issue Sep 13, 2022 · 0 comments
Open

fleaf is sensitive to compiler math imprecision #899

rgknox opened this issue Sep 13, 2022 · 0 comments

Comments

@rgknox
Copy link
Contributor

rgknox commented Sep 13, 2022

When determining the leaf and stem area profiles, we use an intermediate variable called "fleaf" to parse out total area to the leaves and stems in each layer. See its usage here: https://github.com/NGEET/fates/blob/sci.1.59.5_api.24.1.0/biogeochem/EDCanopyStructureMod.F90#L1710-L1729

Essentially, its the fraction of leaf to total stem and leaf in a cohort.

However in PR #887 @glemieux and I noticed that the calculation of fleaf was strangely sensitive, in that we get different results if we use lai/(lai+sai) versus tree_lai / (tree_lai + tree_sai). Note that the difference between lai and tree_lai is that the former the leaf area per canopy area (of the patch), and the latter is the the leaf area per crown area (of the cohort).

IE lai = tree_lai *crown_area/canopy_area

However, what makes this really strange, is that the term crown_area/canopy_area term is in both the numerator and denominator of fleaf (when based on lai), and should cancel out. Thus:

tree_lai / (tree_lai + tree_sai) == lai / (lai + sai)

However, in the testing of #887, we found that this is not so. In this commit you can see we were testing the two methods. And eventually decided to stay with using the lai formulation, to maintain b4b results with the base.

bf99a0b

This issue is to serve a reminder that there is a difference, which is probably related to numerical imprecision. My personal take is that we should use tree_lai to form the ratio. The differences could be due to small crown_area values, perhaps as a result of very small number densities, and since tree_lai and tree_sai is independant of number density, there is less chance for numerical weirdness when calculating a ratio. Plus, we test if we should do the math on tree_lai and tree_sai, not lai and sai.

@rgknox rgknox changed the title fleaf is sensitive to compiler math imprecisionss fleaf is sensitive to compiler math imprecision Sep 13, 2022
@glemieux glemieux moved this to ❕Todo in FATES issue board Sep 19, 2022
@glemieux glemieux mentioned this issue Apr 9, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ❕Todo
Development

No branches or pull requests

1 participant