NetLogo - Modeling Effects of Ocean Acidification on Fish

Before you begin...

  • Ensure you have a strong understanding of systems and models by reading the background information page, if you haven't yet.

  • You will need a pencil and paper as you work through this activity. You have the option of printing this webpage or recording your findings in a notebook.

Background: Ocean Acidification and its Impacts

As the issue of ocean acidification came to light, many scientists began to research what the result of more acidic oceans might be. We now know, for example, that lower pH caused by carbon dioxide makes it harder for shelled organisms to build shells, negatively affects the nervous systems of some fish, and can stimulate growth of aquatic plants. It turns out that elevated levels of CO2 also affect small reef fish. In a comprehensive article Munday et al. describe the “dramatic effect” of both elevated carbon dioxide concentrations and rising temperatures on “a wide range of behaviors and sensory responses” in various tropical fishes.

We're going to use a specific study by Munday et al., "Replenishment of fish populations is threatened by ocean acidification" (PNAS, 2010) to build a model of how ocean acidification could affect clownfish-predator interactions.

Click to view the article:

Read the article to gain an understanding of the system being studied. Read the abstract first. Then you may want to look through the figures to get a general picture of what type of data this paper uses. Then read the text itself. You may want to print a copy to highlight and write notes on, or take notes elsewhere as you read. Pay special attention to what system is being studied, and what the different elements and relationships are in this system.

Do you think you could build a model of this data? It is similar to a predator prey relationship but there are slight differences that might influence how you set up your model. After you read the article, the following steps will help you create your model.

  1. List the key words of the article. These are words you might use if you were trying to find the article on Google. Try to come up with at least ten!

  2. Write down the main points of the article. These should be statements that link together the terms you came up with above.

  3. Create a concept map that links your terms together as you specified in question #2.

  4. Talk to your classmates and add any elements or connections you might have missed. Does your map tell the same story as the article?

Building the Model

The study shows that more acidic water will affect clownfish, but how will changing prey populations affect predators? Unless we want to build some really big tanks to observe the whole ecosystem, the only way to answer this question is through modeling. Let’s build a model to show us how changing CO2 concentrations effect the relationship between clownish and their predators.

Before we start, we will need to download NetLogo, a free to use tool to create models. The concepts of NetLogo are very similar to Stella Online, but you can reference the NetLogo Systems Dynamics instructions manual for any questions.

First, let's download the predator prey model. It is the same model you made in the Stella Online - Populating Modeling curriculum, but now we will use NetLogo because it is free to use and has a lot of additional functions, like the ability to use more than two stocks. Download it from the link below and open the predator prey model into your NetLogo and follow the steps below to convert it into a model for this data.

Download Netlogo model: Predator-Prey System

1. We need change the names of the elements of the model to make it relevant to this situation, and this is going to take some work because you have to change every element of the system to ensure they all match and the model runs smoothly. Go to the "System Dynamics Modeler" window and double-click on each element to change its name. Change every instance of "Fish" to "Clownfish" and "Sharks" to "Predators".

Challenge: Can you find the specific type of predator used in this study for the clownfish experiments? Hint: Look in the methods and materials section.

The equations will need to be changed too. For example, the formula for "clownfish_births" will need to become "Clownfish * clownfish_birth_rate". You will see error messages as you work. Just keep editing until you see no more errors, and you will know you are finished.

Note: You cannot edit the code directly from the code tab in this window. You have to make changes through the visual model interface.

2. Go to the Interface window (this is where you will actually run the model and observe what occurs) and change the boxes to refer to Clownfish and Predators as well. Double-click or right-click on each box and edit all references to fish or sharks.

3. Next we will need to add a line to the code of the model. From the interface window, click to the code tab and enter if ticks >= 2000 [ stop ] into the code just after to Start/Stop. This will keep the model tidy by stopping it after 2000 months. Because our model is simple and based on relatively little data, we cannot predict too far into the future. Your code should look like this when you are finished:

4. Now we need to add a variable for CO2 concentration. Still in the interface window, click on the drop down menu near the top of the screen, next to the add button, and click the slider. Click the add button (green plus sign), then click in the diagram area to add the slider. Name it user-Carbon-Dioxide-Concentration.

Set the "Minimum" to 390, the "Increment" to 10, and the "Maximum" to 800.

Set its initial value ("Value") to 390, the current value in most parts of the surface ocean. Set the units to "ppm" (parts per million).

5. Now we need to introduce carbon dioxide as a variable that affects our model. We will be setting its value from the slider we just made, so we need to tell the model to take the CO2 value from there. Go back to the Modeler window and click on the Variable button and place it somewhere in the model. Name this variable something simple like CO2. Set the expression to user-Carbon-Dioxide-Concentration so that the variable will take its value from the setting of the slider.

Stop and Think: How should we connect this variable to the rest of the model? Where do you think we should draw the link?

If the fish don’t hide from the predators, more fish are going to be eaten and the more food the predators will have. This makes it seem like the CO2 concentration is going to effect the predator efficiency, but how do we write the relationship?

Find Figure 1 in the article and look at the data for day 8. Note that a missing bar indicates 0% time spent in the predator cue. Create the chart below in your notes and fill in the data. You may want to look in the text of the article to find numbers, or you can approximate from the bars on the graph.

Now we need to figure out the relationship between the two variables. Graph that data on this chart.

You can see from your graph that the data is not linear. Because the concentration does not have an effect before 700 ppm, the graph is flat and then increases sharply. Draw a linear line onto your graph to represent the best fit line for all the data. Try to create a line that passes as close to all the points as possible.

Using a graphing program like Excel, or by hand on the graph above, come up with a best fit equation that relates the two variables.

Tip: If you graph the data in Excel as a scatter plot, you can add a Trendline to the graph, then right-click on the trendline and choose Format, then Display Equation.

Record your equation here:

% 𝑡𝑖𝑚𝑒 𝑠𝑝𝑒𝑛𝑡 𝑖𝑛 𝑝𝑟𝑒𝑑𝑎𝑡𝑜𝑟 𝑐𝑢𝑒 =____________________________________

What problems would you run into if you tried to use this equation in the model? What would happen to the ecosystem with a predator efficiency of 20? Hint: think of the y-value in the equation as a % efficiency. What would the efficiency be at 390 ppm?

You need to convert the percentage into a predator efficiency that you can use in the model. The efficiency you have been using in the model is 0.0003; it has four decimal places to the right. If you want to convert our percentages to efficiencies, what do you need to do? Rewrite your equation to equal efficiencies between 0.00000 and 0.00100 instead of percentages from 0 to 100. (Hint: how many places do you need to move the decimal point to convert from 100% to 0.00100? Move the decimal points for all parts of your equation this many times.)

Record your new equation here:

Efficiency =_____________________________________________

You still are not quite done. What problems would you run into if you tried to use this equation in the model? What would happen to the ecosystem with a predator efficiency of 0?

You know from the previous model that the optimal efficiency is 0.0003, so why not change the value for 390 ppm from 0 to 0.0003? We can do that by adding 0.0003 to the equation and changing the y-intercept. Record your final equation here:

Efficiency =_____________________________________________

You should have arrived at an equation fairly similar to this one:

Efficiency = 0.000002 ∗ 𝐶𝑂2 𝐶𝑜𝑛𝑐𝑒𝑛𝑡𝑟𝑎𝑡𝑖𝑜𝑛 − 0.0005

This equation can be used in your model. If you got a different equation try that one too, but if your model doesn’t work come back and use this one. Go to the model window and change the expression of the predator-efficiency variable to your equation. You will need spaces between the numbers and math operators, as shown in the example below. Be sure to use your variable name (like CO2) in the expression for predator-efficiency. Your finished model should look something like the one below.

Now it's time to see what our model predicts will happen! Create a data table in your notes with the columns shown below. Before you begin running the models, think about what might happen as levels of CO2 increase. What will change about our model, and what will be the impact on clownfish and predator populations?

Tip: Create your table one row at a time as you run each simulation, giving yourself plenty of space to capture detailed observations. You might find it helpful to include some graph sketches. A "system crash" means one or both of the populations disappears completely and never returns.

Go back to the Interface window. Before each run, adjust the user-Carbon-Dioxide-Concentration slider to the appropriate value, then press Setup. Then click Start/Stop and watch the populations of clownfish and predators vary on the graph.

Tip: You can change the size of the graph by right clicking and choosing "Select". You can also change the speed of the simulation by adjusting the slider at the top of the window.

Please take this 1-minute survey, now that you've completed this activity. We are interested in learning about your experience so we can improve these resources. All responses to this survey are anonymous, all questions are optional, and your feedback is much appreciated.

Back to other modeling exercises

Curriculum Contributors and Supporters

Students Anna Farrell-Sherman, William Wick, Michael Huang and Andrew Liu collaboratively created this resource with ISB scholars.

Dexter Chapin: Teacher Scholar, ISB; Seattle Academy of Arts and Sciences
Monica Orellana, Principal Scientist, ISB & University of WA
David Reiss: Senior Research Scientist, Computational Systems Biology, ISB 2001-2016
Steve Roderick: Teacher Scholar, 2015, ISB
Anne Gillies: Teacher Scholar, 2019, ISB
Claudia Ludwig: Director of Systems Education Experiences, ISB
Nitin Baliga: SVP and Director, Founder of Systems Education Experiences, ISB

Funding to support the development of this lesson was provided by the National Science Foundation Award DBI-1565166 & 0640950. The content of these pages was created by students for students with the help of teachers and scientists. The views expressed herein are those of the authors and do not necessarily reflect the views of NSF or ISB.