These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
In the exercises below, you will simulate heat transfer along a $L = 15$ cm long frying pan handle for a frying pan that is heated on a stove for 10 minutes.
**Exercise 1: Mathematical Derivation**
Derive an equation for the temperature of slice number $N$ at the end of a one-dimensional rod, $T_N^j$. Your derivation, and the resulting equation, will be very similar to the derivation and result for the other slices of the rod (for $i \leq N-1$). The only difference is that there is no heat flow in/out of the right side of this slice.
**Exercise 2: `x` and `t`**
Write lines of code to generate two one-dimensional arrays: one for the discrete values of position, $x_i$, and one for the discrete values of time, $t^j$.
**Exercise 3: Material Properties**
You will simulate the handle of a frying pan, using handles made of (1) stainless steel and (2) Bakelite. Look up the relevant material properties for both stainless steel and Bakelite. What are the numerical values for each of these properties for each material?
**Exercise 4: Dimensionless constant, `r`**
Compute the constant "$r$" for stainless steel. What value do you obtain? If it is greater than 0.5, you will need to adjust your discretization of the position and/or the time to decrease the values of $r$.
**Exercise 5: 2D array and initial temperature**
Generate a 2D array that will be used to store temperature as a function of both position and time, $T_i^j$.
The temperature of the frying pan handle will begin at a room temperature of $T_i^0 = 72^{\circ}$ F. Store this initial ($j=0$) value in the 2D array for all slices of the rod (for all $i$).
**Exercise 6: Temperature of the pan**
You will need to generate an array of temperatures for the frying pan (at the left edge of the handle) as a function of time, $T_0(t)$. The frying pan will start out at room temperature at time $t = 0$. A typical frying pan will then heat up quicky for the first minute or two after a stove is turned on, and then it will reach a constant temperature of around 350 to $400^{\circ}$ F. This behavior can be reproduced using the equation
$$ T_0(t) = T_{room} + \Delta T_{stove} \times \tanh\left(\frac{t}{\tau}\right)$$
with $T_{room}=72^{\circ}$ F, $\Delta T_{stove} = 300^{\circ}$ F, and $\tau = 60$ seconds. "tanh" is the "hyperbolic tangent" function, which is one of the standard built-in functions for any computer math library.
Use this equation to compute an array of $T_0(t)$ values, and then plot $T_0$ versus $t$ to verify that the temperature of you frying pan agrees with the following plot:
![FryingPanTemperature](images/heatflow_1d/T0_vs_t.png)
Once you have verified that $T_0(t)$ is correct, use the 1D array of $T_0(t)$ values to set the temperature of the left ($i=0$) edge of the handle in the 2D array, $T_0^j$, for all values of time (for all $j$).
**Exercise 7: Conversions**
You will need to convert the 2D array, $T_i^j$ from units of Fahrenheit to Celsius before beginning the simulation. Then convert back from Celsius to Fahrenheit after the simulation. What will you need to do in order to perform both of these conversions?
**Exercise 8: Computing for many `i` and `j`**
Complete the line of code to compute $T_i^j$ for all positions, $1 \leq i \leq N-1$, and all times, $j > 0$.
**Exercise 9: End of the handle**
Complete the line of code to compute $T_N^j$ at the end of the handle for all times, $j > 0$. (You derived this equation in Exercise 1.)
**Exercise 10: Plotting**
Plot the temperature of the rod versus position, $T(x)$, for a few different values of time, $t$. Make sure that your results seem reasonable. Discuss if/why the results seem reasonable.
**Note:** It is likely that your program won't work right away! If your code generates errors, or if the results just don't seem physically reasonable, you will need to *debug* your code.
**Exercise 11: Convergence**
Decrease the values of $\Delta x$ and $\Delta t$, and re-run the simulation to check for *convergence*. If the temperature results change when you change the discretization, that means that $\Delta x$ and/or $\Delta t$ are too big, and you need to make them smaller. (But make sure that $r \lt 0.5.)$
**Exercise 12: Animating**
Create an *animation* showing temperature versus position at many different moments in time. Again, make sure that the results seem reasonable, and check for convergence. Discuss.
**Exercise 13: Contour plots**
Create a *contour plot* that shows temperature as a function of *both* position and time in a single static plot. Again, make sure that the results seem reasonable, and check for convergence. Discuss.
**Exercise 14: Analysis**
At a temperature of 150$^{\circ}$ F, an object will quickly cause a burn if touched. (You can also get burned by cooler objects, but not immediately -- only if you continue to touch the object for an extended period of time.)
Based on the results of your simulations, discuss where you would -- and would not -- be able to safely touch the handle of the pan at different moments in time.
**Exercise 15: Repeat for other material**
Repeat the exercises above for a frying pan handle that is made of Bakelite rather than stainless steel. Discuss your results.