Numerical Analysis - Lab 9
Heat
The purpose of this lab is to model the flow of heat.
The Set-up
We start with one dimension. We may do two or three dimensions later.
Imagine a one-dimensional object, say a bar, 10 inches (or centimeters, if you prefer) long. It has 11 marks on it, one at each end, and one each inch along its length.
Initially, the temperature of the bar is exactly 0 degrees along its entire length. At time t=0, though, one end of the bar (the zero end) is held against the side of a hot stove, and its temperature instantly becomes 100 degrees. At the same time, the other end (the ten end) is held against an ice cube, and its temperature is maintained at 0 degrees.
The fragment of a spreadsheet below shows this situation. It shows what we call the "initial conditions".
| A | B | C | D | E | F | G | H | I | J | K | L | |
| 1 | Dist | |||||||||||
| 2 | time | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 3 | 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 4 | 1 | |||||||||||
| 5 | 2 | |||||||||||
| 6 | 3 | |||||||||||
| 7 | 4 |
We are going to keep one end of the bar against the stove and the other end of the bar against the ice cube, so one end of the bar will always be 100 degrees and the other end will always be 0 degrees. These are called the "boundary conditions" and are shown in the next version of the spreadsheet:
| A | B | C | D | E | F | G | H | I | J | K | L | |
| 1 | Dist | |||||||||||
| 2 | time | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 3 | 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 4 | 1 | 100 | 0 | |||||||||
| 5 | 2 | 100 | 0 | |||||||||
| 6 | 3 | 100 | 0 | |||||||||
| 7 | 4 | 100 | 0 |
Make a spreadsheet like the one above that goes up to t=25 or t=30.
Warming things up
Now, your experience tells you that the interior of the bar will gradually warm up, starting at the "zero end", but that the "ten end" will stay cool. How fast it warms up is a property of the particular material that the bar is made of, and is related to what is called the "heat conductivity" of the material.
Let's look at cell C4. It tells us the temperature one inch from the end (since distance = 1 there) after one minute (since time = 1 there). What do you think that the temperature ought to be there?
Well, I think it ought to be some sort of average of the temperatures at distance 0, 1, and 2, from the previous time t = 0. For now, let's just try a simple average. In cell C4, put the formula =(B3 + C3 + D3)/3
You should get a value of 33.3
Now copy this formula throughout the interior of your spreadsheet.
It is hard to see what is going on if you try to look at it to six decimal places. Reformat it to show either 0 or 1 decimal place, and it looks a lot better.
Exercises - part I
1. Explain why I think that the temperature in an interior cell at a time ought to be an average of the temperatures of the cells around at at the previous time. That is, why does the formula =(B3 + C3 + D3)/3 work?
2. Interpret the results of this spreadsheet.
Stirring things up
It is time to modify the spreadsheet a little bit. In particular, let's change that averaging formula.
The idea that C4 is exactly =(B3 + C3 + D3)/3 is a little bit limiting. It has all things warming up at the same rate. Some materials, though, warm up more slowly than others, and others warm more quickly.
A material that warms slowly might have a formula like
=(B3 + 2*C3 + D3)/4
That is called a weighted average, and it counts the current value of the cell more, and thus makes the temperature of the cell change more slowly.
Let's modify the spreadsheet to reflect that. Call the weight of the cell k, and store that near the top of the spreadsheet, as shown:
| A | B | C | D | E | F | G | H | I | J | K | L | |
| 1 | Dist | k = | 2.5 | |||||||||
| 2 | time | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 3 | 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 4 | 1 | 100 | 0 | |||||||||
| 5 | 2 | 100 | 0 | |||||||||
| 6 | 3 | 100 | 0 | |||||||||
| 7 | 4 | 100 | 0 |
I put it in cell F1 and put a label in cell E1.
Now, in cell C4, I want to use the weighted formula =(B3 + $F$1*C3 + D3)/($F$1 + 2)
Copy that through the whole interior of the spreadsheet, and see what happens. You should find that the bar warms up more slowly than it did before.
Exercises - part II
3. Why does the formula I suggest work as it does. Be sure to explain the denominator.
4. Describe how the spreadsheet changes for different values of k.
5. What happens if you take k < 0. What is the last negative value for k that still seems to work.
Cooking the Turkey
Thanksgiving is coming. (eventually. So's Spring Break.) Let's pretend that our "bar" represents a 10" frozen one-dimensional turkey that starts out at zero degrees.
Let's pretend that you "cook" this turkey by putting both ends up against hot stoves that maintain the temperature at each end of the turkey at 100 degrees. (These are boundary conditions, and here we are applying heat to both ends, not just to one end.
Let's pretend that the turkey is "cooked" when its center (distance = 5) reaches 50 degrees.
Believe it or not, this is a reasonable approximation of reality in turkey-land.
Exercises - part III
6. Find out how long it takes the turkey to cook if k=2.
7. Make a graph of how long the turkey takes to cook as a function of the temperature of the oven. For this part, keep k=2.
8. Restore the temperature of the oven to 100 degrees, and make a graph of how long the turkey takes to cook as a function of the value of k.
9. Interpret your results.
Write it all up nicely. Don't go overboard with handing in pages of spreadsheets. A good graph is worth a lot of spreadsheets.
Do it by Monday, December 6, 2004