Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Litter model theory and implementation docs #593

Merged
merged 41 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8902407
Added automatic variable documentation to litter model implementation…
jacobcook1995 Jul 31, 2024
404ff3b
Made a seperate page for the litter theory
jacobcook1995 Jul 31, 2024
03a0014
Added a new higher level decay theory docs page
jacobcook1995 Jul 31, 2024
69de4bd
Moved decay documentation to it's own subfolder
jacobcook1995 Jul 31, 2024
880b8e4
Added new decay theory pages into the toc tree
jacobcook1995 Jul 31, 2024
7068c11
Added a small amount of text explaining litter soil model split
jacobcook1995 Aug 2, 2024
30a74c9
Added a justification for the relatively simple litter model
jacobcook1995 Aug 15, 2024
ed9ec3a
Improved justification for the relatively simple litter model
jacobcook1995 Aug 15, 2024
414bb0c
Updated litter implementation TODO
jacobcook1995 Aug 15, 2024
791f66b
fixed outdated docs links
jacobcook1995 Aug 15, 2024
07ea8ba
Fixed typos in decay theory frontpage
jacobcook1995 Aug 15, 2024
6876c55
Added introduction to new litter theory page
jacobcook1995 Aug 15, 2024
36ec81c
Updated litter pool details to fit new docs structure
jacobcook1995 Aug 15, 2024
621255b
Added documentation for lignin impact on litter decay
jacobcook1995 Sep 3, 2024
e801d8f
Merge branch 'develop' into 513-litter-model-documentation
jacobcook1995 Sep 3, 2024
e25a99c
Added basic explanation of litter input partition to the docs
jacobcook1995 Sep 16, 2024
937a0cd
Merge branch 'develop' into 513-litter-model-documentation
jacobcook1995 Sep 16, 2024
0d4861f
Fleshed out docs section on litter input partition
jacobcook1995 Sep 16, 2024
9ec39fa
Merge branch 'develop' into 513-litter-model-documentation
jacobcook1995 Sep 26, 2024
a56a901
Added paragraph on how temperature dependance is captured
jacobcook1995 Sep 26, 2024
38f34d0
Added an explanation of animal model links to the litter documentation
jacobcook1995 Oct 11, 2024
97634d6
Made landing page for animal theory and linked a page on excrement an…
jacobcook1995 Oct 11, 2024
21451d0
Added decription of soil moisture limitation to the litter documentation
jacobcook1995 Oct 11, 2024
23ef587
Merge branch 'develop' into 513-litter-model-documentation
jacobcook1995 Oct 11, 2024
1de07af
Added commas after equations
jacobcook1995 Oct 14, 2024
d84bad8
Wrote theory documentation describing how tracking of excrement and c…
jacobcook1995 Oct 14, 2024
7b09f42
Added description of litter model flow to the litter model implementa…
jacobcook1995 Oct 14, 2024
e593617
Edit of litter_implemenatation.md
davidorme Oct 14, 2024
272f057
Theory of biomass decay update
davidorme Oct 14, 2024
ce24a97
Fixing RTD theme issue
davidorme Oct 14, 2024
104830d
Addressed Vivienne's comments on the soil_theory docs
jacobcook1995 Oct 16, 2024
f61a96d
Merge branch 'develop' into 513-litter-model-documentation
jacobcook1995 Oct 16, 2024
b4c9c07
Fixed typo in litter theory docs
jacobcook1995 Oct 16, 2024
3a2e982
Improved the decay theory based on Vivienne's suggestions
jacobcook1995 Oct 16, 2024
647fcb6
Made a seperate environmental impacts doc page
jacobcook1995 Oct 16, 2024
a73e3b5
Added description of environmental links page to the soil theory summ…
jacobcook1995 Oct 16, 2024
e83420a
Updated environmental links docs to not be litter model specific
jacobcook1995 Oct 16, 2024
c103e6d
Updated into to litter theory page to reflect current content
jacobcook1995 Oct 17, 2024
aca6188
Merge branch 'develop' into 513-litter-model-documentation, adjusted …
jacobcook1995 Oct 17, 2024
c7709be
Improved the use of admonition throughout the litter docs
jacobcook1995 Oct 17, 2024
8406e6d
Merge branch 'develop' into 513-litter-model-documentation
jacobcook1995 Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/source/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ subtrees:
- file: virtual_ecosystem/theory/microclimate_theory
- file: virtual_ecosystem/theory/hydrology_theory
- file: virtual_ecosystem/theory/plant_theory
- file: virtual_ecosystem/theory/soil_theory
- file: virtual_ecosystem/theory/animal_theory
- file: virtual_ecosystem/theory/soil/summary
entries:
- file: virtual_ecosystem/theory/soil/soil_theory
- file: virtual_ecosystem/theory/soil/litter_theory
- file: virtual_ecosystem/theory/soil/environmental_links
- file: virtual_ecosystem/theory/animals/animal_theory
entries:
- file: virtual_ecosystem/theory/animals/carcasses_and_excrement
- file: virtual_ecosystem/implementation/implementation
title: Implementation
entries:
Expand Down
9 changes: 5 additions & 4 deletions docs/source/using_the_ve/example_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ The `example_soil_data.nc` file provides:
This code creates a set of plausible values for which the
{mod}`~virtual_ecosystem.models.soil.soil_model` absolutely has to function sensibly
for. Descriptions of the soil pools can be found
[here](../virtual_ecosystem/theory/soil_theory.md).
[here](../virtual_ecosystem/theory/soil/summary.md).

````{admonition} soil_example_data.py
:class: dropdown
Expand Down Expand Up @@ -324,9 +324,10 @@ The `example_litter_data.nc` file provides:
- XY
```

The generation script creates a set of plausible values for which the {mod}`~virtual_ecosystem.models.litter.litter_model`
absolutely has to function sensibly for.
Descriptions of the litter pools can be found [here](../virtual_ecosystem/theory/soil_theory.md).
The generation script creates a set of plausible values for which the
{mod}`~virtual_ecosystem.models.litter.litter_model` absolutely has to function sensibly
for. Descriptions of the litter pools can be found
[here](../virtual_ecosystem/theory/soil/litter_theory.md).

````{admonition} litter_example_data.py
:class: dropdown
Expand Down
106 changes: 106 additions & 0 deletions docs/source/virtual_ecosystem/implementation/litter_implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,109 @@ language_info:
---

# The Litter Model implementation

## Model overview

The litter model uses the following sequence:

1. The amount of litter consumed by animals is subtracted from the relevant pools and
diverted into animal digestion processes.

2. Decay rates are calculated for the remaining litter in the pools. These rates vary
based on environmental conditions (see the [environmental factors
submodule](virtual_ecosystem.models.litter.env_factors)) and the lignin proportion of
each pool. The decay rates across pools are calculated using the
[calculate_decay_rates
function](virtual_ecosystem.models.litter.carbon.calculate_decay_rates).

3. Plant inputs are considered from two sources, which have different stoichiometric
properties.

* Inputs from tissue senescence and turnover directly from plant communities
typically have reduced nutrient concentrations through translocation.

* Plant inputs generated during herbivory, where animals drop unconsumed biomass,
are not depleted in nutrients and herbivores may be actively selecting plant
matter rich in limiting nutrients.

The [LitterInputs class](virtual_ecosystem.models.litter.inputs.LitterInputs)
therefore handles multiple different tissue types and pathways to keep information
on the total input mass and chemistry of these different input routes, along with
flows into the different litter pools.

4. Given the litter loss to consumption and decay and the new inputs, updated litter
pool sizes are calculated using the [calculate_updated_pools
function](virtual_ecosystem.models.litter.carbon.calculate_updated_pools).

5. The chemistry of these new pools is then found using the
[calculate_new_pool_chemistries
method](virtual_ecosystem.models.litter.chemistry.LitterChemistry.calculate_new_pool_chemistries)
of the [LitterChemistry
class](virtual_ecosystem.models.litter.chemistry.LitterChemistry).

6. The mineralisation rates at which nutrients enter the soil are then found. We track
carbon (using the [calculate_total_C_mineralised
function](virtual_ecosystem.models.litter.carbon.calculate_total_C_mineralised)) and
also nitrogen and phosphorus (using `LitterChemistry` class methods).

:::{admonition} Future directions 🔭

However, there is an issue with this approach in that it gives animals preferential
access to litter over microbes (which drive the decay processes). This is something we
may have to address in future, potentially by only making a limited portion of the
litter available for animal consumption.

:::

## Model variables

## Initialisation and update

The tables below show the variables that are required to initialise the litter model and
then update it at each time step.

```{code-cell} ipython3
---
mystnb:
markdown_format: myst
tags: [remove-input]
---
from IPython.display import display_markdown
from var_generator import generate_variable_table

display_markdown(
generate_variable_table(
"LitterModel", ["vars_required_for_init", "vars_required_for_update"]
),
raw=True,
)
```

## Generated variables

The first update of the litter model adds the following variables to the data
environment of the Virtual Ecosystem:

```{code-cell} ipython3
---
mystnb:
markdown_format: myst
tags: [remove-input]
---
display_markdown(
generate_variable_table("LitterModel", ["vars_populated_by_first_update"]), raw=True
)
```

## Updated variables

At each model step, the following variables are then updated.

```{code-cell} ipython3
---
mystnb:
markdown_format: myst
tags: [remove-input]
---
display_markdown(generate_variable_table("LitterModel", ["vars_updated"]), raw=True)
```
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ occluded phosphorus which is irrecoverably bound within a mineral structure.
### Further details

Further theoretical background for the Soil Model can be found
[here](../theory/soil_theory.md).
[here](../theory/soil/summary.md).

## Animal Model

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ language_info:
---

# Theory of the animals

:::{admonition} In progress 🛠️

This is a high level landing page from animal theory, that will be filled out at a later
date.

:::

Both animal carcasses and excrement are important resources for animals to scavenge
from, as such their decay is tracked as part of the animal model. How they are tracked
is explained [here](./carcasses_and_excrement.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
jupytext:
formats: md:myst
main_language: python
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
language_info:
codemirror_mode:
name: ipython
version: 3
file_extension: .py
mimetype: text/x-python
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.11.9
---

# Carcasses and excrement

Carcasses and excrement are critical components of litter, soil and animal models but
the fastest processes using these resources are carrion feeding and coprophagy by
animals. If carcasses and excrement are handled within the soil or litter model, new
inputs would only become available to animals at the end of each model update step. To
avoid the resulting lags in feeding responses to new carcass and excrement inputs, these
resources pools are handled within the animal model.

Each grid cell contains two pools recording carcass and excrement mass along with the
nitrogen and phosphorus stoichiometry of each resource. The total mass in each pool is
divided into two fractions:

* _scavengable_ mass that can be consumed by animals, and
* _decayed_ mass that will be added to the soil model at the next time step.

When biomass is added to either pool, the relative allocation to the scavengable
fraction is determined by the following equation

$$f_c = d / (s + d),$$

where $d$ is the rate at which the resource decays due to microbial activity and $s$ is
the rate at which animals discover and remove the resource.

:::{admonition} Future directions 🔭

* We currently only have one class of carcasses, but this may well be split into
separate size classes at some point in the future.

* Both rates $d$ and $s$ are currently empirically derived constants. Scavenging rate
($s$) could be determined dynamically from the animal model but this would introduce
parameterisation complexities that we don't want to tackle at present. Future
extensions could allow the microbial decay rate ($d$) to vary environmentally (e.g.
with temperature).

:::
82 changes: 82 additions & 0 deletions docs/source/virtual_ecosystem/theory/soil/environmental_links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
jupytext:
formats: md:myst
main_language: python
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
language_info:
codemirror_mode:
name: ipython
version: 3
file_extension: .py
mimetype: text/x-python
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.11.9
---

# Environmental impacts on soil processes

Litter decay and soil nutrient transformations are both affected by temperature. As the
soil model explicitly includes microbes, temperature effects many different processes in
the model, e.g. enzymatic rates and the carbon use efficiency of microbial growth.
Temperature is more straightforward in the litter model and just effects the decay rate
of each litter pool. Processes that take place underground are also affected by soil
moisture. For the soil moisture response, an empirical relationship is used for both
litter decay and soil organic matter breakdown.

:::{admonition} In progress 🛠️

The representation of soil microbial communities has still not been finalised. Once this
has happened this section of the documentation will be extended to detail the relevant
thermal responses.

:::

## Soil moisture response

Breakdown rates for soil organic matter and breakdown rates for the below-ground litter
pools are both impacted by how wet the soil is. In very dry soils rates are extremely
slow, this is because microbial movement is restricted so microbes struggle to reach
the substrate to break it down. As soils get wetter, microbial motility increases
resulting in faster breakdown rates. However, increasing soil moisture makes it harder
for oxygen to permeate the soil, so at a certain point breakdown rates begin to
decrease with increasing soil moisture as oxygen availability has become limiting. The
"intrinsic" process rates are altered to capture the effect of soil moisture by
multiplying them with a factor that takes the following form

$$
A(\psi) = 1 - \left(
\frac{\log_{10}|\psi| - \log_{10}|\psi_{o}|}
{\log_{10}|\psi_{h}| - \log_{10}|\psi_{o}|}
\right)^\alpha,
$$

where $\psi$ is the soil water potential, $\psi_{o}$ is the "optimal" water potential at
which substrate breakdown is maximised, $\psi_{h}$ is the water potential at which
substrate breakdown stops entirely, and $\alpha$ is an empirically determined parameter
which sets the curvature of the response to changing soil water potential.

## Litter decay temperature response

The decay rates of all classes of litter are effected by temperature. For the
above-ground pools, this temperature is simply the air temperature just above the soil
surface. For the below ground pools, the temperature is an average of the temperatures
for the biologically active soil layers. The "intrinsic" litter decay rates are altered
to capture the effect of temperature by multiplying them with a factor that takes the
following form

$$f(T) = \exp{\left(\gamma \frac{T - T_{\mathrm{ref}}}{T + T_{\mathrm{off}}}\right)},$$

where $T$ is the litter temperature, $T_\mathrm{ref}$ is reference temperature used to
establish "intrinsic" litter decay rates, $T_\mathrm{off}$ is an offset temperature, and
$\gamma$ is a parameter capturing how responsive litter decay rates are to temperature
changes.
Loading