Skip to content

SIP182c Update Effects of CN and Tillage on Heterotrophic Respiration#214

Merged
Alomir merged 49 commits intomasterfrom
SIP182c-update-heterotrophic-respiration
Jan 21, 2026
Merged

SIP182c Update Effects of CN and Tillage on Heterotrophic Respiration#214
Alomir merged 49 commits intomasterfrom
SIP182c-update-heterotrophic-respiration

Conversation

@Alomir
Copy link
Copy Markdown
Collaborator

@Alomir Alomir commented Jan 5, 2026

Summary

Motivation: This is the final piece of #182
What:

  • Adds kCN param
  • Adds CN dependency function
  • Refactors tillage dependency calc
  • Updates soil respiration calc
  • Updates litter breakdown calc
  • Adds simple test for all dependency effect functions

Here is the smoke test comparison result - note that soil and litter C and N do not decrease as much, which I think is to be expected since D_CN reduces the respiration/decomposition.

(venv-3.12.2) ~/git/sipnet (5307): python tools/smoke_check.py run verbose russell_2
Running tests: russell_2
Changed working directory to: /Users/mjl/git/sipnet/tests/smoke

**********************
Running test russell_2
**********************
         soil           litter           nee         cumNEE           rSoil            rh          rtot         soilOrgN            litterN         
          old      new     old     new   old   new      old      new    old    new    old    new    old    new       old       new      old      new
0     2688.14  2688.15     NaN     NaN  0.08  0.07     0.08     0.07  0.057  0.046  0.054  0.043  0.079  0.069  134.9993  134.9995  13.9994  13.9995
1     2688.14  2688.15  279.96  279.97  0.08  0.07     0.16     0.14  0.060  0.049  0.057  0.046  0.079  0.068  134.9985  134.9990  13.9987  13.9990
2     2688.14  2688.16  279.93  279.95  0.08  0.07     0.24     0.20  0.062  0.051  0.059  0.047  0.079  0.067  134.9976  134.9984  13.9980  13.9984
3     2688.14  2688.16  279.91  279.93  0.08  0.07     0.32     0.27  0.064  0.052  0.060  0.048  0.080  0.068  134.9967  134.9978  13.9973  13.9979
4     2688.14  2688.17  279.88  279.91  0.08  0.07     0.40     0.34  0.065  0.053  0.062  0.049  0.081  0.069  134.9958  134.9972  13.9966  13.9973
...       ...      ...     ...     ...   ...   ...      ...      ...    ...    ...    ...    ...    ...    ...       ...       ...      ...      ...
5843  1543.55  1749.38   94.50  100.11   NaN   NaN  1632.87  1421.43  0.066  0.062  0.063  0.060  0.082  0.078   96.7226  108.1558  10.6355  11.5540
5844  1543.53  1749.37   94.48  100.09   NaN   NaN  1632.96  1421.51  0.066  0.062  0.063  0.060  0.081  0.078   96.7212  108.1545  10.6343  11.5529
5845  1543.52  1749.36   94.46  100.08   NaN   NaN  1633.04  1421.59  0.066  0.062  0.063  0.060  0.082  0.078   96.7197  108.1533  10.6332  11.5518
5846  1543.51  1749.35   94.45  100.06   NaN   NaN  1633.12  1421.66  0.066  0.062  0.063  0.060  0.084  0.081   96.7182  108.1520  10.6320  11.5506
5847  1543.50  1749.34   94.43  100.05  0.09  0.08  1633.21  1421.75  0.066  0.062  0.063  0.060  0.088  0.085   96.7168  108.1507  10.6309  11.5495

[5848 rows x 18 columns]
Difference Summary:
         first diff total diffs     old mean     new mean
soil              0        5848  2096.759649  2221.738719
litter            1        5847   119.706097   127.374922
nee               0        5652     0.285147     0.247696
cumNEE            0        5848   830.711238   698.064605
rSoil             0        5848     0.332759     0.296594
rh                0        5848     0.320039     0.283884
rtot              0        5848     0.407545     0.371387
soilOrgN          0        5848     118.8783   125.225558
litterN           0        5848    18.561272    19.455409

NOTE: after updating the mineral N pool to add in mineralization from soil and litter, there are other differences:

**********************
Running test russell_2
**********************
       minN          n2oFlux           nLeachFlux    
        old    new       old       new        old new
0     0.991  0.993       NaN       NaN        NaN NaN
1     0.982  0.986  0.075781  0.075946        NaN NaN
2     0.972  0.979  0.077862  0.078212        NaN NaN
3     0.962  0.971  0.078919  0.079466        NaN NaN
4     0.952  0.963  0.079775  0.080530        NaN NaN
...     ...    ...       ...       ...        ...  ..
5843  0.000  0.205  0.000000  0.033918        NaN NaN
5844  0.000  0.205  0.000000  0.033959        NaN NaN
5845  0.000  0.205  0.000000  0.034036        NaN NaN
5846  0.000  0.205  0.000000  0.034080        NaN NaN
5847  0.000  0.205  0.000000  0.034030        NaN NaN

[5848 rows x 6 columns]
Difference Summary:
           first diff total diffs  old mean  new mean
minN                0        5848  0.061373  0.323728
n2oFlux             1        5847  0.028331   0.20082
nLeachFlux        149         451  0.005045  0.022707

Related issues

Checklist

  • Tests added for new features
  • Documentation updated (if applicable)
  • docs/CHANGELOG.md updated with noteworthy changes
  • Code formatted with clang-format (run git clang-format if needed)
  • Requested review from at least one CODEOWNER

For model structure changes:

  • Removed \fraktur font formatting from docs/model-structure.md for implemented features

Base automatically changed from SIP182b-add-litter-and-soil-org-N-fluxes to master January 6, 2026 20:17
@dlebauer dlebauer requested a review from Copilot January 6, 2026 20:49

This comment was marked as off-topic.

@Alomir Alomir marked this pull request as ready for review January 12, 2026 21:11
@Alomir Alomir closed this Jan 16, 2026
@Alomir Alomir reopened this Jan 16, 2026
@dlebauer dlebauer changed the title SIP182c Update Heterotrophic Respiration SIP182c Update Effects of CN and Tillage on Heterotrophic Respiration Jan 21, 2026
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.

This looks good, and aligns with docs and you've done a good job of both implementing the equations and answering many of my questions (like where is this or that) in the comments 🌟.

Approved, but please review and consider suggested changes before merging.

Comment thread src/sipnet/sipnet.c
Comment on lines +1046 to +1047
* Moisture dependency term is used in soil respiration, litter
* breakdown, and nitrogen volatilization.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CH4 and N volatilization should use the D_water,O2 function.

Suggested change
* Moisture dependency term is used in soil respiration, litter
* breakdown, and nitrogen volatilization.
* Moisture dependency term for aerobic metabolism is used
* in soil respiration and litter breakdown.

Out of scope for this PR but the moistEffect (as well as D_water,O2 in docs) are ambiguously named because there will be two moisture effects - one on aerobic (RH, litter breakdown) and the other on anaerobic metabolism (CH4, N volatilization).

To disambiguate we could name these AnaerobicMoistEffect, calcAnaerobicMoistEffect().

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I noticed that overlap! Thanks for clarifying.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Wait, we are using the same moistEffect for all three of those calcs - is that a problem?

The overlap I was thinking of was the two D_temp's we have for potPsn vs. resp/breakdown calcs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm going to push this to a later fix - let's chat later.

Comment thread src/sipnet/sipnet.c Outdated
@@ -395,6 +395,7 @@ void readParamData(ModelParams **modelParamsPtr, const char *paramFile) {
initializeOneModelParam(modelParams, "leafCN", &(params.leafCN), ctx.nitrogenCycle);
initializeOneModelParam(modelParams, "woodCN", &(params.woodCN), ctx.nitrogenCycle);
initializeOneModelParam(modelParams, "rootCN", &(params.rootCN), ctx.nitrogenCycle);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Alomir sorry this isn't part of the PR, but is this coarse or fine root? parameters.md says "coarserootCN = woodCN"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's fine root, and I will change to match.

Comment thread docs/parameters.md Outdated
| --- | ------------------------- | ------ | -------------------------------------- | ----- | ------------------------------------------------ |
| | $CN_{\textrm{wood}}$ | woodCN | Carbon to Nitrogen ratio of wood | | $CN_{\textrm{coarse root}} = CN_{\textrm{wood}}$ |
| | $CN_{\textrm{leaf}}$ | leafCN | Carbon to Nitrogen ratio of leaves | | |
| | $CN_{\textrm{fine root}}$ | rootCN | Carbon to Nitrogen ratio of fine roots | | |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Alomir also check here - does rootCN refer to fine root?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes it does...why on earth did I name it that??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Renamed.

Comment thread docs/README.md Outdated
@Alomir Alomir merged commit 07f46f8 into master Jan 21, 2026
12 checks passed
@Alomir Alomir deleted the SIP182c-update-heterotrophic-respiration branch January 21, 2026 16:06
ayushman1210 pushed a commit to ayushman1210/sipnet that referenced this pull request Feb 14, 2026
…PecanProject#214)

* Add org N handling for fert

* Adds fields for org N handling

* Adds organic N pools and params, with output

* Updates for fert org N

* Updates cols list for niwot

* Updates for initial org N implementation

* Updates to eqs 13 and 14

* Adds litter pool req for nitrogen cycle

* Initial implementation for organic N pools plus fert updates

* Updates to fert for org N pools

* Updates for org N pools

* Reorg and updates for org N pools

* Adds CN ration params

* Tweak output spacing for readability

* Fix broken link

* Fix merge errors

* Allow russell ranch link

* Brings russell_1 params up to date

* Updates for organic N calcs

* Removes 'frak' font from some implemented sections

* Updates for nitrogen cycle additions to date

* Interim commit, heterotrophic resp updates

* Removes unused include

* Tests calcXYZEffect dependency functions

* Adds testDependencyFunctions

* Tweaks error msg

* Adds CN dep function, updates soil and litter resp

* Adds kCN param

* Updates for soil/litter resp tweaks

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Updates for CN implementation

* C:N impl

* Function rename

* Updates to min N pool

* Updates for mineral N pool update

* Updates for CN impl

* Attempts to fix broken link

* added code symbols to stoichiometry param definitions

* Update docs/README.md

Co-authored-by: David LeBauer <dlebauer@gmail.com>

* Renames param rootCN to fineRootCN

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: David LeBauer <dlebauer@gmail.com>
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.

Add litter and soil organic N pools, dynamic CN

3 participants