Skip to content

SIP261 Implement methane production#269

Merged
Alomir merged 54 commits intomasterfrom
SIP261-Implement-methane-production
Feb 25, 2026
Merged

SIP261 Implement methane production#269
Alomir merged 54 commits intomasterfrom
SIP261-Implement-methane-production

Conversation

@Alomir
Copy link
Copy Markdown
Collaborator

@Alomir Alomir commented Feb 18, 2026

Summary

  • What: Implement methane production in SIPNET
  • Motivation: Core MAGIC requirement

How was this change tested?

List steps taken to test this change, with appropriate outputs if applicable

If changes are needed for any sipnet.out files in the test/smoke subdirectories, then include output from
tools/smoke_check.py by running the commands below and pasting the output at the end of this PR. Note that
this must be run BEFORE submitting changes to any sipnet.out files.

make smoke
python tools/smoke_check.py run verbose <list tests/smoke subdirectories with changed outputs>

Run python tools/smoke_check.py help for more info.

Reproduction steps

If appropriate, list steps to reproduce the change locally

Related issues

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.

Base automatically changed from SIP75-Update-moisture-dependency-functions to master February 20, 2026 16:22
@Alomir Alomir marked this pull request as ready for review February 20, 2026 22:03
@dlebauer dlebauer requested a review from Copilot February 22, 2026 07:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements methane (CH₄) production in the SIPNET model when the anaerobic context/CLI option is enabled, including new parameters, new flux bookkeeping, output reporting, and supporting tests/docs.

Changes:

  • Added methane production parameters (soilMethaneRate, litterMethaneRate) and methane flux calculation, including pool updates and mass-balance accounting.
  • Populated the ch4 output column and added tracker support for timestep methane production.
  • Updated model docs and extended/adjusted unit tests and test parameters to cover new anaerobic/methane dependencies.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/sipnet/state.h Adds methane parameters, flux fields, and a methane tracker.
src/sipnet/sipnet.c Reads new params, computes methane flux, updates pools/trackers, and outputs CH₄.
src/sipnet/balance.c Incorporates methane into carbon outputs for balance checks.
docs/model-structure.md Documents methane production and adds methane terms to pool ODEs.
docs/CHANGELOG.md Adds an unreleased changelog line for methane production.
tests/smoke/russell_2/sipnet.param Adds methane rates to smoke test parameters.
tests/sipnet/test_modeling/balance.param Adds methane rates (and adjusts other params) for balance regression testing.
tests/sipnet/test_modeling/testMethane.c New unit test for methane flux/pool impacts.
tests/sipnet/test_modeling/testDependencyFunctions.c Updates context setup and adds validation checks around dependency function tests.
tests/sipnet/test_modeling/testNitrogenCycle.c Updates context setup and adds validation checks.
tests/sipnet/test_modeling/testBalance.c Updates context setup, adds a “no litter pool” balance scenario, and minor output handling tweaks.
tests/sipnet/test_modeling/Makefile Adds the new methane test to the modeling test build.
tests/sipnet/test_sipnet_infrastructure/Makefile Cleans up an additional generated artifact.
tests/sipnet/test_events_types/testEventFertilization.c Ensures context flag dependencies are satisfied in the fertilization event test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sipnet/state.h Outdated
Comment thread tests/sipnet/test_modeling/testMethane.c
Comment thread tests/sipnet/test_modeling/testMethane.c Outdated
Comment thread docs/CHANGELOG.md Outdated
Comment thread src/sipnet/sipnet.c
Comment thread src/sipnet/sipnet.c
Copy link
Copy Markdown
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

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

Yay, this is a huge milestone!

This does not block this PR, but to consider:

Since CH4 flux from non-flooded cropland is 1) rare and 2) very very tiny or negative (we don't represent methane oxidation that consumes CH4 because it is orders of magnitude smaller than typical flooded rice emissions.

For now, I think it will be sufficient to set the new rate parameters default to 0.

We discussed having a flag that would allow methane off when n2o is on. But I don't think that is a great solution. I think having anaerobic on/off makes more sense.

To simulate CH4 from flooded rice, we can change the parameter from the default, and have this associated with the PFT.

Setting these to 0 is an unsatisfying hack, but sufficient for now. It is analogous to linking drainage rate to Rice - practical but not mechanistic. One solution would be to add time dependence to the anaerobic scheme to actually capture the development of the anoxic state. I started a discussion in Slack.

Comment thread docs/model-structure.md Outdated
Comment thread src/sipnet/sipnet.c
Comment thread src/sipnet/sipnet.c Outdated
Comment thread docs/parameters.md
Alomir and others added 2 commits February 25, 2026 14:08
Co-authored-by: David LeBauer <dlebauer@gmail.com>
Co-authored-by: David LeBauer <dlebauer@gmail.com>
@Alomir Alomir merged commit 22598ac into master Feb 25, 2026
12 checks passed
@Alomir Alomir deleted the SIP261-Implement-methane-production branch February 25, 2026 20:30
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.

Implement methane production in SIPNET

3 participants