Skip to content

[N/A] Fix zero-carbon nitrogen transfer - #402

Open
Alomir wants to merge 1 commit into
PecanProject:masterfrom
dlebauer:fix/zero-carbon-nitrogen-transfer
Open

Alomir wants to merge 1 commit into
PecanProject:masterfrom
dlebauer:fix/zero-carbon-nitrogen-transfer

Conversation

@Alomir

@Alomir Alomir commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • What: Short description of the functional or documentation changes
  • Motivation: Why is this change needed?

How was this change tested?

  • All current tests pass
  • New test added

Related issues

  • Fixes #N/A

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)

@Alomir
Alomir marked this pull request as ready for review September 30, 2026 15:19
Copilot AI balanced review requested due to automatic review settings September 30, 2026 15:19

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

The focused guards address the zero-division paths and are covered by an appropriate regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Prevents non-finite nitrogen fluxes when zero-carbon pools produce zero transfers.

Changes:

  • Guards zero-carbon nitrogen transfer calculations.
  • Adds regression coverage for empty carbon pools and nitrogen conservation.
  • Documents the fix.
File Description
src/​sipnet/​nitrogen.c Safely handles zero carbon fluxes.
tests/​sipnet/​test_modeling/​testNitrogenCycle.c Tests finite, conserved nitrogen pools.
docs/​CHANGELOG.md Records the fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Alomir

Alomir commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator Author

I strongly suspect this is the source of the NaNs that @infotroph was seeing when pools dropped to zero; I believe those started with litter N

@Alomir

Alomir commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@dlebauer I believe you need to merge this with master?

This branch has not been deployed

No deployments
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.

3 participants