Skip to content

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

Closed
johnpaulalex wants to merge 3 commits into
NGEET:mainfrom
johnpaulalex:fix/biogeophys-accum-fluxes-and-tests
Closed

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

Conversation

@johnpaulalex

@johnpaulalex johnpaulalex commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Depends on parent PR: #1601

Description of changes

Fixes a calculation ordering bug in EDAccumulateFluxesMod.F90 where gpp_acc was accumulated before 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, 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.

Refactoring & Test Helpers

Refactored test_EDAccumulateFluxes.pf using two new shared test factory helpers in FatesFactoryMod.F90 (CreateTestSite and SetTestFluxes), reducing setup boilerplate across the file by 211 net lines.

Testing performed:

  • Executed pFUnit ed_accumulate_fluxes test suite (100% passed)

@johnpaulalex
johnpaulalex force-pushed the fix/biogeophys-accum-fluxes-and-tests branch from aed3ed7 to 3b86ecf Compare August 8, 2026 16:55
@johnpaulalex
johnpaulalex force-pushed the fix/biogeophys-accum-fluxes-and-tests branch 2 times, most recently from 6bd93a7 to 58bb1bf Compare August 8, 2026 17:08
@johnpaulalex
johnpaulalex force-pushed the fix/biogeophys-accum-fluxes-and-tests branch from 58bb1bf to 960a4f1 Compare August 8, 2026 17:11
…es/CreateTestSite helpers in FatesFactoryMod
@johnpaulalex
johnpaulalex force-pushed the fix/biogeophys-accum-fluxes-and-tests branch from 960a4f1 to 698b143 Compare August 8, 2026 17:15
@johnpaulalex
johnpaulalex deleted the fix/biogeophys-accum-fluxes-and-tests branch August 8, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant