Skip to content

fix(fates): fix c13disc_acc weighting order and add EDAccumulateFluxes unit tests - #1602

Draft
johnpaulalex wants to merge 3 commits into
NGEET:mainfrom
johnpaulalex:fix+test/biogeophys-accum-fluxes+cohort-create
Draft

fix(fates): fix c13disc_acc weighting order and add EDAccumulateFluxes unit tests#1602
johnpaulalex wants to merge 3 commits into
NGEET:mainfrom
johnpaulalex:fix+test/biogeophys-accum-fluxes+cohort-create

Conversation

@johnpaulalex

@johnpaulalex johnpaulalex commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Depends on parent PR: #1601

Description:

Fixes a calculation ordering bug in EDAccumulateFluxesMod.F90 where gpp_acc was accumulated prior to computing the c13disc_acc weighted mean, resulting in double-counting gpp_tstep in the denominator. Also updates the zero-denominator check to <= 0.0_r8 for negative total GPP underflow protection, adds a prt_global association safeguard in PRTGenericMod.F90, introduces shared test factory helpers (CreateTestSite and SetTestFluxes) in FatesFactoryMod.F90, and adds a full pFUnit test suite (test_EDAccumulateFluxes.pf) verifying multi-site iteration, multi-cohort/multi-layer accumulation, empty cohort linked lists, and underflow protections.

Specific notes

Collaborators:

Linked issues addressed, if any:

  • None

Expectation of Answer Changes:

  • Bit-for-Bit (B4B) with baseline master
  • Roundoff-level differences only
  • Expected Answer Changes (ECA)
    • If ECA, describe exact conditions under which answers change and attach scientific evaluation summary/plots:
      Modifies carbon isotope discrimination accumulation (c13disc_acc) across timesteps for active vegetated canopy cohorts.

Description of generative AI usage (as necessary)

Google Antigravity was used to write the code and tests, followed by human-guided verification.

Checklist

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

Test Results:

CTSM (or) E3SM (specify which) test hash-tag: N/A
CTSM (or) E3SM (specify which) baseline hash-tag: 5efa6fbfd173afe85d523431e75c8a6ec493b242
FATES baseline hash-tag: 960a4f1c

Test Output:
[x] Executed pFUnit / CIME regression tests

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants