Skip to content

Conversation

Copy link

Copilot AI commented Dec 17, 2025

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):

// For each pool i: dN_i/dt = dC_i/dt / CN_i
fluxes.leafNDemand = fluxes.leafCreation / params.leafCN;
// ... similarly for wood, fine root, coarse root

Total N demand and uptake (eq 20):

fluxes.plantNDemand = leafNDemand + woodNDemand + fineRootNDemand + coarseRootNDemand;
fluxes.plantNUptake = fmin(plantNDemand, envi.minN / climate->length);

N limitation:
When plantNDemand > plantNUptake, NPP is set to 0 by making GPP = R_A, preventing growth under N-limited conditions.

N allocation:
When supply < demand, N is allocated proportionally: k = uptake / demand, each pool receives k × demand - losses.

Changes

  • src/sipnet/state.h: Added CN parameters and plant N pool state variables
  • src/sipnet/sipnet.c:
    • Added calcPlantNDemandAndUptake() function
    • Integrated N limitation check in calculateFluxes()
    • Updated updatePoolsForSoil() to track plant N pools
    • Added CN parameter reading in initModel()
  • docs/CHANGELOG.md: Documented new features
  • docs/parameters.md: Added CN parameter definitions
  • tests/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

This section details on the original issue you should resolve

<issue_title>Implement plant N pools, fixed CN, N demand, N limitation</issue_title>
<issue_description>plant pools (i) leaf, wood, fine root, coarse root

  • Add CN parameters for each pool
  • calculate dN_i/dt = dC_i/dt * CN_i for each pool (eq 12)
  • calculate total plant N demand (eq 20, F^N_demand = sum dN_i/dt), and subtract from N_min
    • calculate all the N demand and N supply terms in a time step, then for a particular N stock calculate k = (N demand) / (N stock + N supply), then if k < 1 each demand gets k*Ndemand
  • N limitation
    • F^N_uptake = min(N_min/dt, F^N_demand)
    • New indicator variable I_N = boolean(F^N_demand > N_min/dt)
    • if(I_N): NPP = 0; this might be done by setting GPP = R_A</issue_description>

<agent_instructions>Follow the style that exists in the current code. Use standard C constructs.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 17, 2025
Copilot AI and others added 5 commits December 17, 2025 00:30
Co-authored-by: dlebauer <464871+dlebauer@users.noreply.github.com>
Co-authored-by: dlebauer <464871+dlebauer@users.noreply.github.com>
Co-authored-by: dlebauer <464871+dlebauer@users.noreply.github.com>
…ndant nSupply

Co-authored-by: dlebauer <464871+dlebauer@users.noreply.github.com>
Co-authored-by: dlebauer <464871+dlebauer@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement plant N pools with CN parameters and N limitation calculations Implement plant N pools with fixed CN ratios and N limitation Dec 17, 2025
Copilot AI requested a review from dlebauer December 17, 2025 00:43
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 plant N pools, fixed CN, N demand, N limitation

2 participants