Skip to content

Patch fusion crash in historic land only simulation fix#1579

Closed
glemieux wants to merge 1 commit into
NGEET:mainfrom
glemieux:noresm-cp-pr66-abs-err
Closed

Patch fusion crash in historic land only simulation fix#1579
glemieux wants to merge 1 commit into
NGEET:mainfrom
glemieux:noresm-cp-pr66-abs-err

Conversation

@glemieux

Copy link
Copy Markdown
Contributor

Description:

Changing EDCanopyStructureMod.F90 to have relative rather than absolute error comparisons so that errors are not triggered by differences which are in the noise of r8 precisions numbers

Addresses NorESMhub/CTSM#223. Cherry-picked from NorESMhub/CTSM#66.

Collaborators:

@maritsandstad

Expectation of Answer Changes:

Description of generative AI usage (as necessary)

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
  • Describe use of generative AI (if necessary)

Integrator

  • FATES PASS/FAIL regression tests were run
  • Evaluation of test results for answer changes was performed and results provided
  • FATES-CLM6 Code Freeze: satellite phenology regression tests are b4b

If satellite phenology regressions are not b4b, please hold merge and notify the FATES development team.

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:

…elative error indicating differences below noise
! comparisons below use max(absolute_target, rel_area_precision*|operand|).
! rel_area_precision is set to relative machine precision for r8 so that
! a difference below machine precision is never treated as a real error.
real(r8), parameter :: rel_area_precision = 1.0E-15_r8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this is supposed to match the general precision of math on most compilers, maybe we should move this to FatesConstantsMod , give it a more general name, and use it in more places?

@rgknox rgknox Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, we should not be so strict, and expect machine precision exactly. I think we should drop this down at least an order of magnitude, if not 2...

cc @maritsandstad

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually I did do it by putting it in FatesConstantsMod for later PRs, I agree it should move here also for this (see here: NorESMhub#74).

I'm not sure what you mean, do you want it to be lower as in 1.e-17 or 1.e-13. I would argue quite strongly against the former, asl that would allow you to let noise through, the point of that is to not do that. I would be fine with going to a larger number like 1e-13, but it is easiest to argue the machine precision numbers.



elseif ( abs(layer_co(ic)%pd_area - cohort%c_area) < co_area_target_precision ) then
elseif ( abs(layer_co(ic)%pd_area - cohort%c_area) < &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@glemieux noted this would be better as an "<=", I agree

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean, for all practical purposes there is no difference between a < or <= comparison here. Chances that you are bang on to 15 digits are virtually nill

@glemieux

glemieux commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of merging via #1583 or similar direct pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants