In the previous lecture you made a food-web model of salmon, bears, scavengers and salmon carcasses. You first created the conceptual model (flow diagram), then wrote the mass balance equations.
Now, you will create a rate expression for every flow that entered the mass balance equations. Once you have done that, you can see how this model is implemented in R.
{width=14cm}
Suitable mass balances for the state variable SALMON, BEAR, CARCASS and SCAVENGERS are:
$$\frac{dSALMON}{dt} = Migration - BearFeeding - SalmonLoss$$ $$\frac{dBEAR}{dt} = BearFeeding-CarcassProd-BearLossIngest-BearLoss$$ $$\frac{dCARCASS}{dt} = CarcassProd -ScavFeeding - CarcassDecay$$ $$\frac{dSCAVENGERS}{dt} = ScavFeeding -ScavLossIngest - ScavLoss$$
The assumptions are the following:
The units of the state variables are $kg~C~m^{-2}$; the time unit is days.
Question: What are the units of the flows?
| parameter | units | description | |---------------------------|--------------- | ---------------------------------------------------- | | area = 1000000 | [$m^2$] | | | migrate = 10000 | [$kg~C~d^{-1}$] | Amount of salmon entering the river system | | rSalmonLoss = 0.05 | [$d^{-1}$] | Salmon loss rate constant (Spawning+death+basalResp) | | rBearFeeding = 0.02 | [$d^{-1}$] | Bear feeding rate constant | | ksSalmon = 0.01 | [$kg~C~m^{-2}$] | Half saturation ct for ingestion bear | | rBearLoss = 0.01/365 | [$d^{-1}$] | Death rate constant (hunting and other) for bear | | pLossToCarcass = 0.5 | [$-$] | Losses of salmon to carcass (fraction) | | pBearLossIngest = 0.4 | [$-$] | Ingested fraction that is lost (respiration+faeces) | | rCarcassDecay = 0.001 | [$d^{-1}$] | Decay rate constant of carcasses | | rScavFeeding = 0.02 | [$d^{-1}$] | Feeding rate constant of scavengers | | ksCarcass = 0.002 | [$kg~C~m^{-2}$] | Half saturation ct for ingestion scavenger | | pScavLossIngest = 0.7 | [$-$] | Growth efficiency of scavengers | | rScavLoss = 1/365 | [$d^{-1}$] | Mortality+basal respiration rate constant scavengers |
The above information is all you get. Write the mathematical equations for each flow on a piece of paper.
Note: to make the equations (and the model code) easy to follow, we use the following formalism:
If you have finished with this exercise, then you can try to read, understand and then run the implementation of this model in R, using R markdown.
It is in the file called RiverRun_Rcode.Rmd. The model is run twice, with different rate constants characterising ingestion by the bears.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.