NCSI Talks

   

Salt Diffusion Learning Scenario (Web)


Shodor > NCSI Talks > Excel > Salt Diffusion Learning Scenario (Web)

Learning Scenario - Salt Diffusion (Excel)

Basic Model:

Description

This is a system model of salt diffusion in water. Each of the cells starts with a certain concentration of salt, and then changes its concentration each time step based on the concentration of salt in all adjacent cells. Because the outer edge of the cellblock is considered permanently zero (representing a large body of water), salt will slowly diffuse down to zero, beginning at the edges and progressing into the middle. Users can set the initial concentration, and then step through the simulation.

Background Information

Diffusion - the spread of particles in fluid - is an extremely important process in the natural world. Diffusion occurs in cells to transport nutrients, in the lungs to saturate the blood with oxygen, and in the ocean as rocks and minerals slowly dissolve. The basic principle behind diffusion is the fact that every molecule with temperature above absolute zero is moving around randomly. Under normal circumstances, this has little effect as molecules are rigidly held in solid compounds, or confined by gravity into liquids. However, when solid objects are dissolved in a fluid, the movement of the water molecules and the object's molecules causes them to slowly mix and spread. The movement of individual molecules is random and unpredictable, but the vast number of molecules allows us to use the Law of Large Numbers to accurately predict at what rate and in which direction particles will diffuse.

Science/Math

The fundamental principle behind this model is HAVE = HAD + CHANGE. The difference with this model is that the HAVE parameter is based on the HAD of the adjacent cells, rather than the individual cell itself. Each time step, the salt concentration in each cell is calculated based on the concentration of salt in each of the four cells adjacent to it. If the field were infinite, we would expect to see the cells approach a uniform concentration over time. However, in this case the borders of the field are always zero, simulating a large body of water, so the cells will approach zero concentration over time instead.

Each cell c i,j , where (i,j) refers to the matrix notation for its location, calculates its new value each tick via the following formula:

c i,j = (c i-1,j + c i+1,j + c i,j-1 + c i,j+1 )/4

This is a circular formula, since each cell depends on its neighbors, which in turn depend on it. As a result, the system of equations cannot be evaluated to completion. Instead, we evaluate one iteration at a time, allowing each cell to average the values of its peers once before pausing. This creates a recursive process that accurately models the diffusion of particles in a fluid.

Teaching Strategies

Food Coloring Diffusion:

An effective way of introducing this model is to let students first experiment with food color. For this activity, each student or group of students is given several containers of different sizes and one color of food coloring. They start by filling each of the containers with water, and then dropping the same amount of food coloring into each one and measuring the amount of time it takes to fully diffuse. Full diffusion is defined as the point where the water is a uniform color.

Students can test a number of parameters relating to this model. Aside from testing diffusion time in different-size containers, students can also test the amount of time it takes to diffuse depending on the initial placement of the color droplet, the amount of coloring added, the temperature of the water, and the shape of the container in which the water is placed. This is a great way for students to intuitively understand what it means to say that a substance is diffusing, as well as get an idea of how different factors affect the rates of diffusion.

Ask students to think about the reasons that each parameter had the effect that it did. In particular, there should be strong, easily explainable differences in diffusion time between containers of different sizes and temperatures. This will relate back to the science behind why diffusion occurs in the first place.

Implementation:

How to use the model

This is a relatively simple population model with just a few parameters that can be changed. The important parameters are as follows:

  1. The initial concentration of the salt
  2. The size of the salt field

To change the initial concentration of the salt, click on the InitConc cell and change the number to something other than 50. Then, change the Start cell to 0 to reset all of the cells back to the initial concentration. To change the size of the salt field, set the Start cell to 0, select the entire field, and then click and drag from the bottom-right corner (your cursor will change to a black plus sign) to make the area larger or smaller. With either change, the model should update immediately.

To run the model, you must first make sure Excel knows to calculate only one iteration at a time. If this parameter is not set, then Excel will throw an error because it will attempt to calculate the formulas to completion, which takes an infinite amount of time. Under the main menu, go to Preferences, Formulas and Lists, and then Calculation. Here, select manual calculations, check the Limit Iteration box and set the maximum iterations to 1. This will ensure that Excel steps through the simulation properly. Now, to run the simulation set Start to 0, and then 1. Then, press [F9] on Windows, or [Command] + [=] on Mac, to advance the simulation by one step.

For more information on Excel, reference the Excel tutorial here.

Learning Objectives

  1. Connect recursive multiplication with exponential growth/decay
  2. Understand the difference between agent and system models

Objective 1

To accomplish this objective, ask students to pick a cell in the diagram and record the values contained within (to at least 2 decimal places) for at least 50 iterations in an Excel spreadsheet. Then, have students graph the values and attempt to determine what sort of relationship the values have with their indices. Once students have a guess, use Excel to draw the appropriate trendline and evaluate whether or not it is a good model for the data. Ask the following questions:

  1. What type of model do you think best fits the data? Why?
  2. Does your data set have a maximum and a minimum? If so, what are they?
  3. Will the concentration of salt in a cell ever reach exactly zero or a negative number? How do you know?
  4. Does your chosen model fit the data well? If not, how could you correct it to improve the fit?
Most students should end up choosing an exponential model, since it is the only model that never reaches zero and is by far the most accurate representation of the data. Students should already be familiar with the fact that recursively multiplying a term by a constant creates an exponential equation, so discuss why the average of the concentrations in adjacent cells is proportional to the concentration in your cell.

Objective 2

To accomplish this objective, ask students to determine the time it takes for salt to fully diffuse (all cells round to 0) in multiple trials, and compare that to the results from the food coloring experiment. Ask the following questions:

  1. Are the number of iterations for full salt diffusion the same or different from trial to trial?
  2. Is the amount of time for full food coloring diffusion the same or different from trial to trial?
  3. Why is there a difference between the two outcomes? In what way are the models different?
  4. Which of the two models is a system model, and which is an agent model? How do you know?
Discuss with the students the reason for the differences in diffusion time in the food coloring trials. Students should quickly realize that much of the variation arises from the fact that the food coloring is not put in precisely the same place, the water is not completely still, and the temperature is not necessarily uniform. In fact, because there are so many molecules in even a small body of fluid, the system model is actually a nearly perfect representation of reality, assuming that human error is accounted for.

Extensions:

  1. Model diffusion under different formulas for cell concentration
  2. Consider ways in which this model does not accurately match the real world

Extension 1

Ask students to speculate about what would happen if cells gave their neighbors unequal weight in determining their new concentrations. Have students choose one of the four cell neighbors and multiply it by 1.5 in the equation, and then choose another to multiply by 0.5. Be sure to propagate the new formula to all of the cells in the worksheet, to get an even distribution. Then, run the simulations again and see how things change. Ask the following questions:

  1. How does changing the weight of the cells change the way diffusion occurs?
  2. What real-world circumstances might lead to non-uniform diffusion?
Now have students change the formula such that instead of calculating the average of the four adjacent cells, it takes the average of the four adjacent cells and the cell itself (it should divide by five rather than four). Discuss the effects this change might have on the rates of diffusion, and ask students to formulate a hypothesis. Then, run the simulations again and see how things change. Ask the following questions:
  1. How does changing the formula in this manner cause the rate of diffusion to change? Was your hypothesis correct?
  2. Is this new formula more or less realistic than the original formula? Why do you think so?
  3. Is the effect of this formula uniform, i.e. is it a proportional change in diffusion time, or is it more complicated? Why? If you're unsure, try a variety of different field sizes and initial concentrations.

Extension 2

Ask students to consider the ways in which this model does not reflect the real world. Ask the following questions:

  1. In this model, we assume that the area around the field is always fresh water. Is this realistic? What real-world situation would be the closest analogue to what we are modeling?
  2. When you put food coloring into water, did it spread out evenly in all directions? Why or why not? How could we take this into account in our model?
  3. If every cell in the model calculates its new concentration in exactly the same way, why do the corner cells each have different concentrations after the first iteration? Why is the diffusion not quite symmetric? Think about the ways in which Excel calculates each cell.

Related Models

Simple Population Model

This model is useful as a way of comparing different ways in which exponential growth and decay occur in nature. Both population and salt concentration change exponentially because they change recursively - the population at time t is some proportion of the population at time t - 1, just as the concentration of salt at time t is some proportion of the concentration of salt in adjacent cells at time t - 1. Comparing simple population growth with salt diffusion is a great way of demonstrating different types of change over time. Population growth is a one-dimensional variable while salt concentration is a two-dimensional matrix, but both change in roughly the same fashion.

Diffusion Limited Aggregation

This model is useful as an agent-based analogue of the opposite process to salt diffusion - precipitation. In this model, particles are already diffused and move randomly through a fluid until they run into each other, at which point they stick together. This process, just like salt diffusion, is roughly exponential as a certain proportion of particles tend to hit each other in each time period and remove themselves from the pool. Students can also use this as a way to compare agent and system models in a more direct way than the food coloring study, since the agents here are easily countable and visible, rather than numbering in the trillions as in the food coloring experiment.

Dosing Model

This model demonstrates an important real-world application for diffusion models. When drugs are introduced into the blood stream, they pass into the cells via diffusion, so we can model the amount of drugs present in an individual's body precisely through a diffusion model. This is extremely important to pharmacists and doctors, since they need to provide a schedule of doses in order to maintain a certain blood saturation level at all times.