Skip to content

Fix nitrogen allocation to litter pool during harvest events (#244)#258

Merged
Alomir merged 13 commits intoPecanProject:masterfrom
Thomas-Sedhom:fix-harvest-litterN
Feb 17, 2026
Merged

Fix nitrogen allocation to litter pool during harvest events (#244)#258
Alomir merged 13 commits intoPecanProject:masterfrom
Thomas-Sedhom:fix-harvest-litterN

Conversation

@Thomas-Sedhom
Copy link
Copy Markdown
Contributor

@Thomas-Sedhom Thomas-Sedhom commented Feb 12, 2026

Summary

This PR fixes nitrogen loss during harvest events.

Currently, harvest transfers carbon from plant biomass to the litter pool but does not allocate the associated nitrogen. Since plant nitrogen is not explicitly tracked in SIPNET, this results in nitrogen being lost from the system.

Related issues

Fixes #244

Checklist

  • Related issues are listed above. PRs without an approved, related issue may not get reviewed.
  • PR title has the issue number in it ("[#] <concise description of proposed change>")
  • Tests added/updated for new features (if applicable)
  • Documentation updated (if applicable)
  • docs/CHANGELOG.md updated with noteworthy changes
  • Code formatted with clang-format (run git clang-format if needed)

Note: See CONTRIBUTING.md for additional guidance. This repository uses automated formatting checks; if the pre-commit hook blocks your commit, run git clang-format to format staged changes.

Copy link
Copy Markdown
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

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

Looks great so far. This should break a unit test, but is unlikely to before we update them (future work, though very-soon future work). I suspect the russell_2 smoke test will fail.

Please resolve the conflicts in events.c and we'll see how it goes.

Comment thread src/sipnet/events.c Outdated
Comment thread src/sipnet/events.c Outdated
@Alomir
Copy link
Copy Markdown
Collaborator

Alomir commented Feb 12, 2026

In the PR summary, the related issue needs to be

- Fixes #244

not an embedded link. Github will take care of the linking, as well as automagically assigning this PR as closing that ticket.

Comment thread src/sipnet/events.c
Comment thread src/sipnet/events.c Outdated
@Thomas-Sedhom
Copy link
Copy Markdown
Contributor Author

If everything looks good, I can start working on fixing the russell_2 smoke test next.

@Alomir
Copy link
Copy Markdown
Collaborator

Alomir commented Feb 12, 2026

@Thomas-Sedhom One thing - please make sure the code builds cleanly locally before pushing changes.

@Alomir
Copy link
Copy Markdown
Collaborator

Alomir commented Feb 16, 2026

Hey @Thomas-Sedhom - to be clear, we don't have any harvest events in the smoke tests (yet!), so we won't see any break.

Copy link
Copy Markdown
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

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

Looks great - just one missed rename that needs to be done.

Comment thread src/sipnet/events.c
Comment thread src/sipnet/events.c Outdated
@Thomas-Sedhom
Copy link
Copy Markdown
Contributor Author

Hey @Thomas-Sedhom - to be clear, we don't have any harvest events in the smoke tests (yet!), so we won't see any break.

Thanks for clarifying! That makes sense.

@Thomas-Sedhom Thomas-Sedhom requested a review from Alomir February 16, 2026 16:51
Copy link
Copy Markdown
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

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

Looks good, nice job!

Copy link
Copy Markdown
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

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

Whoops, tests are failing - can't wait until the B&T runs automatically.

Comment thread src/sipnet/events.c Outdated
@Thomas-Sedhom Thomas-Sedhom requested a review from Alomir February 17, 2026 01:19
Copy link
Copy Markdown
Collaborator

@Alomir Alomir left a comment

Choose a reason for hiding this comment

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

All good now

@Alomir Alomir merged commit 7a6eb8f into PecanProject:master Feb 17, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update event handling to allocate to litter N pool for harvest

2 participants