+
Heat flow  Dynamics of a 1D rod
Developed by L. Engelhardt  Published July 17, 2016
In introductory physics, students learn two equations that involve heat: $Q = mc\Delta T$, describes the amount of heat transferred in calorimetry; and $\frac{Q}{\Delta t} = k_t A \frac{\Delta T}{\Delta x}$ describes the rate of steady state heat flow through a window. In this Exercise Set we combine these two equations to explore the ***dynamics*** of heat flow and temperature change in one dimension. Specifically, we will explore the temperature of a frying pan handle as a function of both position and time, and we will see how this temperature profile depends on the material properties of the handle.
Subject Area  Thermal & Statistical Physics 

Levels  First Year and Beyond the First Year 
Available Implementations  IPython/Jupyter Notebook, Python, and Easy Java Simulations 
Learning Objectives 
Students will be able to:
 Mathematically derive an equation for the small slice of a 1D rod at the end of the rod (**Exercise 1**)
 Create 1D arrays to store the discretized values of both position and time (**Exercise 2**)
 Look up the relevant material properties for heat transfer through a rod (**Exercise 3**)
 Compute the heat transfer constant, $r$ (**Exercise 4**)
 Set initial values in a 2D array  $T(x,t)$  to represent a 1D rod at time $t=0$ (**Exercise 5**)
 Use the hyperbolic tangent function to model the increasing temperature of a frying pan, and use this to set boundary conditions for $T(x=0,t)$ (**Exercise 6**)
 Convert temperatures between Fahrenheit and Celsius (**Exercise 7**)
 Write code to compute $T(x,t)$ for all $x$, $t$ (**Exercises 8 and 9**)
 Plot $T(x)$ for various values of $t$ (**Exercise 10**)
 Test for convergence in $T(x,t)$ (**Exercise 11**)
 Create animations of $T(x,t)$ (**Exercise 12**)
 Create contour plots of $T(x,t)$ (**Exercise 13**)
 Interpret simulated data of $T(x,t)$ from plots, animations, and contour plots (**Exercise 14**)
 Carry out the analysis described above for multiple materials (**Exercise 15**)

Time to Complete  120 min 
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 onedimensional 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 N1$). 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 onedimensional 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 builtin 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 N1$, 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 rerun 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.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
L. Engelhardt, "Heat flow  Dynamics of a 1D rod," Published in the PICUP Collection, July 2016.
The instructor materials are ©2016 L. Engelhardt.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license