Tutorial: altering an existing NPZ model

I had the recent pleasure this summer of teaching high school students as a part of a Sally Ride Science Junior Academy. My class was called Polar Microbes, and we discussed adaptations to environments unique to the poles and the importance of microbes to the food webs of the Arctic and Antarctic. One of the things I most wanted to show students was how a simple ecological model could be changed to better fit the polar environment and explicitly include micro-organisms. I was so impressed by how quickly my students were able to understand and change the code underlying the model we used. I wanted to write a quick tutorial to expand that learning to anyone that is intimidated by ecological modeling and wants an easy place to start.

It is valuable to start out with a basic definition: a model is a simple representation of a complex phenomenon. Models are useful because they explicitly describe important mechanisms, which then can be tested against observations. This testing will ultimately demonstrate if your concept of a natural phenomenon was valid or that it needs to be refined.  With very little modeling experience myself, I started with an existing model from the excellent textbook “A Practical Guide to Ecological Modeling” by Karline Soetaert and Peter Herman from Springer. If you use R as a coding language, it is a great book to start modeling, as they have many conceptional explanations paired with highly understandable code. All the examples from the book are in the R package ecolMod:

install.packages("ecolMod”)

library(ecolMod)

demo("chap2")

Once you have the package loaded, you can click through the examples to see how to build a simple ecological model, where a forcing function causes flow between state variables. It is easier to understand with the below visual (Fig 2.1 of Soetart and Herman).

In oceanography, a common real-world application of this conceptual type of model is the NPZD, which stands for Nutrient, Phytoplankton, Zooplankton and Detritus. It is important for us to understand the flow of carbon and nitrogen (among other elements!) through both the macroscopic (zooplankton) and microscopic (detritus that is re-mineralized by bacteria) food web. This is one of the simplest ways to mathematically model it.

Along with figures, the authors are kind enough to include the code for the model. In their code, each of the state variables of NPZ or D (the boxes) are mathematically equal to the flows in minus the flows out. Based on the figure above for instance, PHYTO = f1 – f2. In turn, each of the flows are their own mathematical equations with parameters (constants that are experimentally determined). The equation provided for f1 for instance is:

 f1 = Nuptake  <- maxUptake * PAR/(PAR+ksPAR) * din/(din+ksDIN)

This is because Nuptake is dependent on solar radiation (PAR) and the amount of nutrients that are available (din), as well as the parameters maxUptake, ksPAR and ksDIN which are set as equal to 1/day, 140 muEinst/m2/s and 0.5 mmolN/m3 respectively when we define our parameters later in the model. I encourage you to download the model code and follow how each of the state variable definitions, flows and parameters are connected. Even in a model as simple as this it gets complicated!

Even more exciting are the model solutions, which show a sensible story over two years. As you know from above, the forcing function for the model is PAR (solar radiation), which varies over the season (the sine wave in panel A of the following figure). As PAR increases in the spring, there is a modeled increase in Chlorophyll and Zooplankton (what oceanographers call a “spring bloom”!) and a decrease in DIN.

As I was teaching a class called Polar Microbes, I wanted to change some parts of the model to better reflect a polar environment. Since the model’s forcing function is the seasonal light cycle, I knew it was the first thing that needed to change. The tilt of our rotation axis ensures that our poles have a much more extreme seasonal light cycles, with time in both full darkness and full light.

When you change the model to reflect this planetary fact (just change the PAR function to have a steeper slope and a period of darkness), the output variables change drastically (the Polar Model is in blue below):

Our class had long discussions about this model output. Is it sensible? What can you infer about the polar regions from this? How could it be improved? In our class, we ended up even adding another state variable, Bacteria, and altering the flows from it (viral lysis) to see what happens.

I encourage you to download the ecolMod package and see for yourself! If you are a high school student, consider joining us next summer at Sally Ride Science for my summer class on Polar Microbes as well.

5781 Total Views 4 Views Today
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Anti Spam by WP-SpamShield