Partial Differential Equations: Heat Dissipation

The NDSolve function of Version 3.0 is now capable of solving numerically a limited number of boundary value problems in dimension 1+1 in a rectangular domain.

Example 1

The following example shows how to compute heat dissipation in a thin bar whose ends are kept in constant zero temperature.

If there was a Gaussian initial distribution of temperature along the bar, then the unitial condition would be (Subscript[y, 0])(x) = (e^(-(x^2))). The other two conditions below reflect the temperature at the ends.

\(u = y[x, t]; 

    v6 = NDSolve[{∂\_t u == ∂\_\(x, x\)u, 
          y[x, 0] == If[Abs[x] < 2.99, E\^\(-x\^2\), 0], y[\(-3\), t] == 0, 
          y[3, t] == 0}, y, {x, \(-3\), 3}, {t, 0, 2}]\)

The result of solving the heat equation with the specified initial and boundary conditions is represented as a two-dimensional interpolation function above, which can be plotted over the solution domain as follows:

Plot3D[Evaluate[y[x, t] /. First[v6]], {x, -3, 3}, {t, 0, 2}, 
      PlotPoints -> 30, PlotRange -> All];

You can also create animated heat profiles changing over time to see the actual heat dissipation dynamics. This is easily done using a single For loop (you can almost feel the heat flowing out from the ends of the bar).

Needs["Graphics`FilledPlot`"]

For[t = 0, t ≤ 2, t += 0.05, 
      FilledPlot[{0, Evaluate[y[x, t] /. First[v6]], 1}, {x, -3, 3}, 
        Fills -> {{{1, 2}, RGBColor[1 - (t/2), 0, (t/2)]}, {{2, 3}, 
              RGBColor[1, 1, 1]}}]]; t =. ;

Example 2

This is a variation of the previous example with the ends of the heated bar now thermoisolated.

The boundary conditions below mean that there is no heat flow through the ends of the bar.

\(u = y[x, t]; 

    v7 = NDSolve[{∂\_t\ u == ∂\_\(x, x\)u, 
          y[x, 0] == If[Abs[x] < 2.99, E\^\(-x\^2\), 0], 
		
          \((∂\_x\ u /. x -> \((\(-3\))\))\) == 0, 
			
          \((∂\_x\ u /. x -> 3)\) == 0}, y, 

        	{x, \(-3\), 3}, {t, 0, 2}]\)

The result, again, comes out as a 2D interpolation function that can be plotted

Plot3D[Evaluate[y[x, t] /. First[v7]], {x, -3, 3}, {t, 0, 2}, 
      PlotPoints -> 30, PlotRange -> All];

We get a superficially similar 3D picture of the heat dynamics but the big difference is that the heat gets redistributed evenly along the bar instead of flowing away.

This might be clearer from the animated graph sequence that  is, again built in a fairly easy manner

For[t = 0, t ≤ 2, t += 0.05, 
      FilledPlot[{0, Evaluate[y[x, t] /. First[v7]], 1}, {x, -3, 3}, 
        PlotRange -> All, 
        Fills -> {{{1, 2}, RGBColor[1 - (t/3), 0, (t/3)]}, {{2, 3}, 
              RGBColor[1, 1, 1]}}]]; t =. ;

One can see that, because there is no heat flow through the ends of the bar, the ends and areas close thereof eventualy get heated as the time elapses