Skip to content

Commit 4ee1b13

Browse files
authored
Add wolf-sheep-soil-creep tutorial (#793)
1 parent 0409fdb commit 4ee1b13

19 files changed

Lines changed: 450 additions & 0 deletions

changelog-entries/793.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added the `wolf-sheep-soil-creep` tutorial [#793](https://github.com/precice/tutorials/pull/793)

tools/tests/tests.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,16 @@ test_suites:
487487
reference_result: ./water-hammer/reference-results/fluid1d-left-nutils_fluid3d-right-openfoam.tar.gz
488488
# More case combinations are possible, but they requite calling set-case.sh
489489

490+
wolf-sheep-soil-creep:
491+
tutorials:
492+
- &wolf-sheep-soil-creep_soil-creep-landlab_wolf-sheep-grass-mesa
493+
path: wolf-sheep-soil-creep
494+
case_combination:
495+
- soil-creep-landlab
496+
- wolf-sheep-grass-mesa
497+
max_time: 20
498+
reference_result: ./wolf-sheep-soil-creep/reference-results/soil-creep-landlab_wolf-sheep-grass-mesa.tar.gz
499+
490500
#####################################################################
491501
## Test suites referring to the test suites defined above
492502

@@ -539,6 +549,7 @@ test_suites:
539549
- *volume-coupled-diffusion_source-fenics_drain-fenics
540550
- *volume-coupled-flow_fluid-openfoam_source-nutils
541551
- *water-hammer_fluid1d-left-nutils_fluid3d-right-openfoam
552+
- *wolf-sheep-soil-creep_soil-creep-landlab_wolf-sheep-grass-mesa
542553

543554
# These test suites take longer to run. They are available, but not regularly executed.
544555
extra:

wolf-sheep-soil-creep/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Wolf-sheep-grass model with soil creep
3+
permalink: tutorials-wolf-sheep-soil-creep.html
4+
keywords: MESA, Landlab, wolf-sheep-grass, soil creep, ABM, agent-based modeling
5+
summary: Example of bi-directional ABM-PDE coupling via preCICE.
6+
---
7+
8+
{% note %}
9+
Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/develop/wolf-sheep-soil-creep), as continuously rendered here, or see the [latest released version](https://github.com/precice/tutorials/tree/master/wolf-sheep-soil-creep) (if there is already one). Read how in the [tutorials introduction](https://precice.org/tutorials.html).
10+
{% endnote %}
11+
12+
## Setup
13+
14+
This tutorial is based on Landlab's [Wolf-Sheep-Grass Model with Soil Creep](https://landlab.csdms.io/tutorials/agent_based_modeling/wolf_sheep/wolf_sheep_with_soil_creep.html) example, which couples the [Wolf-Sheep model from Mesa](https://mesa.readthedocs.io/latest/examples/advanced/wolf_sheep.html) with a Landlab soil creep model in a single notebook-based workflow. The [source notebook](https://github.com/landlab/landlab/blob/master/docs/source/tutorials/agent_based_modeling/wolf_sheep/wolf_sheep_with_soil_creep.ipynb) is licensed under [MIT](https://landlab.csdms.io/about/license.html).
15+
16+
The purpose of this tutorial is to demonstrate a simple two-way coupling between an agent-based model (ABM) and a grid-based continuum model via preCICE. The example extends the canonical wolf-sheep-grass ABM with a simple soil-creep feedback on a shared sloping raster grid. When sheep eat grass, the soil beneath the damaged grass becomes more mobile, increasing the local soil transport efficiency and affecting downslope soil transport. The feedback also acts in the other direction: soil thickness affects grass growth by preventing grass from growing where the soil becomes too thin.
17+
18+
In this implementation, the Mesa wolf-sheep-grass model and the Landlab soil creep model are two separate preCICE participants, exchanging grass cover and soil depth during the simulation. The Mesa participant extracts the current grass map from the wolf-sheep-grass model and sends it to the Landlab participant. The Landlab participant uses this grass map to adapt the soil creep coefficient, evolves the soil thickness, and sends the updated soil depth back to the Mesa participant, where it is used to limit grass growth. This example is intentionally simple and should be understood as a demonstration case for coupling ABM and PDE-style models via preCICE, rather than as a physically calibrated landscape evolution model.
19+
20+
## Configuration
21+
22+
preCICE configuration (image generated using the [precice-config-visualizer](https://precice.org/tooling-config-visualization.html)):
23+
24+
![preCICE configuration visualization](images/tutorials-wolf-sheep-soil-creep-precice-config.png)
25+
26+
## Available solvers
27+
28+
Soil-Creep PDE participant:
29+
30+
* Landlab. Numerical modeling of Earth surface dynamics. For more information, have a look at the [Landlab documentation](https://landlab.csdms.io/index.html).
31+
32+
Wolf-Sheep-Grass ABM participant:
33+
34+
* MESA. Agent-based modeling (or ABM) framework. For more information have a look at the [MESA documentation](https://mesa.readthedocs.io/latest/index.html)
35+
36+
## Running the simulation
37+
38+
Open two separate terminals and start the soil creep and wolf sheep participants by calling the respective run scripts `run.sh` located in each of the participants' directories. For example:
39+
40+
```bash
41+
cd soil-creep-landlab
42+
./run.sh
43+
```
44+
45+
and
46+
47+
```bash
48+
cd wolf-sheep-grass-mesa
49+
./run.sh
50+
```
51+
52+
## Post-processing
53+
54+
The soil-creep participant generates Python-based visualizations, which are written to `soil-creep-landlab/output`. The following examples were generated by setting `rng=42` in the `WolfSheepScenario` for the wolf-sheep-grass participant.
55+
56+
![erosion/deposition patterns](images/tutorials-wolf-sheep-soil-creep-erosion_deposition_patterns.png)
57+
![soil thickness](images/tutorials-wolf-sheep-soil-creep-soil_thickness.png)
58+
![grass map](images/tutorials-wolf-sheep-soil-creep-grass_map.png)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../tools/clean-tutorial-base.sh
66.7 KB
Loading
61.5 KB
Loading
98.8 KB
Loading
60.5 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Wolf-sheep-grass soil creep
2+
path: wolf-sheep-soil-creep
3+
url: https://precice.org/tutorials-wolf-sheep-soil-creep.html
4+
5+
participants:
6+
- Soil-Creep
7+
- Wolf-Sheep-Grass
8+
9+
cases:
10+
soil-creep-landlab:
11+
participant: Soil-Creep
12+
directory: ./soil-creep-landlab
13+
run: ./run.sh
14+
component: python-bindings
15+
16+
wolf-sheep-grass-mesa:
17+
participant: Wolf-Sheep-Grass
18+
directory: ./wolf-sheep-grass-mesa
19+
run: ./run.sh
20+
component: python-bindings
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<precice-configuration>
3+
<log>
4+
<sink
5+
filter="%Severity% > debug"
6+
format="---[precice] %ColorizedSeverity% %Message%"
7+
enabled="true" />
8+
</log>
9+
10+
<data:scalar name="Grass" />
11+
<data:scalar name="Soil" />
12+
13+
<mesh name="Wolf-Sheep-Grass-Mesh" dimensions="2">
14+
<use-data name="Grass" />
15+
</mesh>
16+
17+
<mesh name="Soil-Creep-Mesh" dimensions="2">
18+
<use-data name="Grass" />
19+
</mesh>
20+
21+
<mesh name="Soil-Grass-Mesh" dimensions="2">
22+
<use-data name="Soil" />
23+
</mesh>
24+
25+
<mesh name="Soil-Depth-Mesh" dimensions="2">
26+
<use-data name="Soil" />
27+
</mesh>
28+
29+
<participant name="Wolf-Sheep-Grass">
30+
<receive-mesh name="Soil-Depth-Mesh" from="Soil-Creep" />
31+
<provide-mesh name="Wolf-Sheep-Grass-Mesh" />
32+
<provide-mesh name="Soil-Grass-Mesh" />
33+
<write-data name="Grass" mesh="Wolf-Sheep-Grass-Mesh" />
34+
<read-data name="Soil" mesh="Soil-Grass-Mesh" />
35+
<mapping:nearest-neighbor
36+
direction="read"
37+
from="Soil-Depth-Mesh"
38+
to="Soil-Grass-Mesh"
39+
constraint="consistent" />
40+
</participant>
41+
42+
<participant name="Soil-Creep">
43+
<receive-mesh name="Wolf-Sheep-Grass-Mesh" from="Wolf-Sheep-Grass" />
44+
<provide-mesh name="Soil-Creep-Mesh" />
45+
<provide-mesh name="Soil-Depth-Mesh" />
46+
<read-data name="Grass" mesh="Soil-Creep-Mesh" />
47+
<write-data name="Soil" mesh="Soil-Depth-Mesh" />
48+
<mapping:nearest-neighbor
49+
direction="read"
50+
from="Wolf-Sheep-Grass-Mesh"
51+
to="Soil-Creep-Mesh"
52+
constraint="consistent" />
53+
</participant>
54+
55+
<m2n:sockets acceptor="Wolf-Sheep-Grass" connector="Soil-Creep" exchange-directory=".." />
56+
57+
<coupling-scheme:serial-explicit>
58+
<participants first="Soil-Creep" second="Wolf-Sheep-Grass" />
59+
<time-window-size value="2" />
60+
<max-time value="100" />
61+
<exchange
62+
data="Grass"
63+
mesh="Wolf-Sheep-Grass-Mesh"
64+
from="Wolf-Sheep-Grass"
65+
to="Soil-Creep"
66+
initialize="true" />
67+
<exchange data="Soil" mesh="Soil-Depth-Mesh" from="Soil-Creep" to="Wolf-Sheep-Grass" />
68+
</coupling-scheme:serial-explicit>
69+
</precice-configuration>

0 commit comments

Comments
 (0)