Implement plant N pools with fixed CN ratios and N limitation #206
+5,711
−5,481
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds nitrogen tracking to plant carbon pools (leaf, wood, fine root, coarse root) with configurable C:N ratios. Growth is now limited when soil mineral N is insufficient to meet plant N demand.
Implementation
New parameters:
leafCN,woodCN,fineRootCN,coarseRootCN- C:N ratios for each plant pool (g C / g N)New state variables:
plantLeafN,plantWoodN,fineRootN,coarseRootN- N content in each pool (g N m⁻²)N demand calculation (eq 12):
Total N demand and uptake (eq 20):
N limitation:
When
plantNDemand > plantNUptake, NPP is set to 0 by makingGPP = R_A, preventing growth under N-limited conditions.N allocation:
When supply < demand, N is allocated proportionally:
k = uptake / demand, each pool receivesk × demand - losses.Changes
src/sipnet/state.h: Added CN parameters and plant N pool state variablessrc/sipnet/sipnet.c:calcPlantNDemandAndUptake()functioncalculateFluxes()updatePoolsForSoil()to track plant N poolsinitModel()docs/CHANGELOG.md: Documented new featuresdocs/parameters.md: Added CN parameter definitionstests/smoke/russell_2/sipnet.param: Added example CN values (25, 200, 50, 150)Backward compatible: when nitrogen cycle is disabled or CN parameters are unspecified (0), new code has no effect.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.