Skip to content

Simplified mycorrhizal uptake model#1266

Merged
jacobcook1995 merged 5 commits intodevelopfrom
1197-mycorrhizal-uptake-model-needs-to-be-rethought
Jan 21, 2026
Merged

Simplified mycorrhizal uptake model#1266
jacobcook1995 merged 5 commits intodevelopfrom
1197-mycorrhizal-uptake-model-needs-to-be-rethought

Conversation

@jacobcook1995
Copy link
Copy Markdown
Collaborator

Description

This PR simplifies the mycorrhizal uptake model by reducing the amount of information being passed backwards and forwards between the soil and plants models.

Instead, the mycorrhizal fungi allocate a fixed (but configurable) portion of their nutrient uptake to supply the plants. And the total amount supplied is passed to the plants at the next model time step.

Getting this to work requires making an initial estimate of the amount of nutrients supplied (in the soil model init). This estimate is based on the initial state of the model with the assumption that the microbes take up nutrients at the maximum possible rate.

I've added documentation justifying the new model. Let me know if it makes sense!

Fixes #1197

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@jacobcook1995 jacobcook1995 linked an issue Jan 20, 2026 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 98.59155% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.05%. Comparing base (8368bb1) to head (3b8e05f).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
virtual_ecosystem/models/soil/model_config.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1266      +/-   ##
===========================================
- Coverage    95.05%   95.05%   -0.01%     
===========================================
  Files           71       71              
  Lines         7298     7317      +19     
===========================================
+ Hits          6937     6955      +18     
- Misses         361      362       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

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

Yup - LGTM. I think this is cleaner code, easy to explain and a reasonable approximation, and it avoids a whole lot of unpleasantness from the previous version. One minor niggle on code.

@jacobcook1995 jacobcook1995 merged commit bb515f8 into develop Jan 21, 2026
13 checks passed
@jacobcook1995 jacobcook1995 deleted the 1197-mycorrhizal-uptake-model-needs-to-be-rethought branch January 21, 2026 14:38
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.

Mycorrhizal uptake model needs to be rethought

3 participants