What would occur when you heated a small section of an insulated metal rod and left it alone for some time? Our each day experience of warmth diffusion allows us to predict that the temperature will smooth out until it becomes uniform. In a scenario of perfect insulation, the warmth will remain within the metal eternally.

That may be a correct qualitative description of the phenomenon, but the right way to describe it quantitatively?

We consider the one-dimensional problem of a skinny metal rod wrapped in an insulating material. The insulation prevents the warmth from escaping the rod from the side, however the heat can flow along the rod axis.

You’ll find the code utilized in this story here.

The heat diffusion equation is an easy second-order differential equation in two variables:

x âˆˆ [0, L] is the position along the rod, t is the time, u(x, t) is the temperature, and Î± is the thermal diffusivity of the fabric.

What intuition can we obtain in regards to the temperature evolution by examining the warmth diffusion equation?

Equation (1) states that** the local rate of temperature change is proportional to the curvature, i.e., the second derivative with respect to x, of the temperature profile**.

Figure 1 shows a temperature profile with three sections. The primary section is linear; the second section has a negative second derivative, and the third section has a positive second derivative. The red arrows show the speed of change in temperature along the rod.

If ever a gentle state where âˆ‚u/âˆ‚t = 0 is reached, the temperature profile could have to smooth out as much as the purpose where the temperature profile is linear.

The solutionÂ¹ to the warmth diffusion equation (1) is:

You’ll be able to confirm by differentiating (2) that it does satisfy the differential equation (1). For those keen on the derivation, see Annex I.

The coefficients {Aâ‚™}, {Bâ‚™}, {Î»â‚™}, C, D, and E are constants that should be fit from the initial and boundary conditions of the case. The work we did studying the Fourier series will play!

The boundary conditions are the constraints imposed at x=0 and x=L. We encounter two kinds of constraints in practical scenarios:

- Insulation, which translates into âˆ‚u/âˆ‚x=0 on the rod extremity. This constraint prevents the warmth from flowing in or out of the rod;
- Fixed temperature on the rod extremity: for instance, the rod tip might be heated or cooled by a thermoelectric cooler, keeping it at a desired temperature.

The mix of constraint types will dictate the suitable flavor of the Fourier series to represent the initial temperature profile.

## Each ends insulated

When each rod ends are insulated, the gradient of the temperature profile gets set to zero at x=0 and x=L:

The initial condition is the temperature profile along the rod at t=0. Assume that for some obscure reason â€” perhaps the rod was possessed by an evil force â€” the temperature profile looks like this:

To run our simulation of the temperature evolution, we want to match equation (2) evaluated at t=0 with this function. We all know the initial temperature profile through sample points but not its analytical expression. That may be a task for a Fourier series expansion.

From our work on the Fourier series, we observed that an *even half-range expansion* yields a function whose derivative is zero at each extremities. That’s what we want on this case.

Figure 3 shows the even half-range expansion of the function from Figure 2:

Although the finite variety of terms utilized in the reconstruction creates some wiggling on the discontinuities, the derivative is zero on the extremities.

Equating equations (4), (5), (6), and (7) with equation (2) evaluated at t=0:

We are able to solve the constants:

Take a better have a look at (14). This expression states that Î»â‚™ is proportional to the square of n, which is the variety of half-periods that a specific cosine term goes through within the range [0, L]. In other words, n is proportional to the spatial frequency. Equation (2) includes an exponential factor exp(Î»â‚™t), forcing each frequency component to dampen over time. Since Î»â‚™ grows just like the square of the frequency, we predict that the high-frequency components of the initial temperature profile will get damped much faster than the low-frequency components.

Figure 4 shows a plot of u(x, t) over the primary second. We observe that the upper frequency component of the right-hand side disappears inside 0.1 s. The moderate frequency component within the central section considerably fades but continues to be visible after 1 s.

When the simulation is run for 100 seconds, we get an almost uniform temperature:

## Each ends at a hard and fast temperature

With each ends kept at a continuing temperature, we have now boundary conditions of the shape:

The set of Fourier series that we studied within the previous post didnâ€™t include the case of boundary temperatures fixed at non-zero values. We’d like to reformulate the initial temperature profile uâ‚€(x) to develop a function that evaluates 0 at x=0 and x=L. Allow us to define a shifted initial temperature profile Ã»â‚€(x):

The newly defined function Ã»â‚€(x) linearly shifts the initial temperature profile uâ‚€(x) such that Ã»â‚€(0) = Ã»â‚€(L) = 0.

As an illustration, Figure 6 shows an arbitrary initial temperature profile uâ‚€, with set temperatures of 30 at x=0 and 70 at x=0.3. The green line (Cx + D) goes from (0, 30) to (0.3, 70). The orange curve represents Ã»â‚€(x) = uâ‚€(x) â€” Cx â€” D:

The shifted initial temperature profile Ã»â‚€(x), going through zero at each ends, could be expanded with odd half-range expansion:

Equating equation (2) with (17), (18), (19), (20), and (21):

We are able to solve the constants:

The simulation of the temperature profile over time u(x, t) can now run, from equation (2):

In a everlasting regime, the temperature profile is linear between the 2 set points, and constant heat flows through the rod.

## Insulation on the left end, fixed temperature at the appropriate end

We’ve these boundary conditions:

We follow essentially the identical procedure as before. This time, we model the initial temperature profile with an even quarter-range expansion to get a zero derivative on the left end and a hard and fast value at the appropriate end:

Which ends up in the next constants:

The simulation over 1000 seconds shows the expected behavior. The left-hand extremity has a null temperature gradient, and the right-hand extremity stays at constant temperature. The everlasting regime is a rod at a uniform temperature:

We reviewed the issue of the temperature profile dynamics in a skinny metal rod. Ranging from the governing differential equation, we derived the final solution.

We considered various boundary configurations. The boundary scenarios led us to specific the initial temperature profile in keeping with one in every of the Fourier series flavors we derived within the previous post. The Fourier series expression of the initial temperature profile allowed us to unravel the combination constants and run the simulation of u(x, t).

Thanks on your time. You’ll be able to experiment with the code on this repository. Let me know what you’re thinking that!