next up previous
Next: Exercise 6.1: Finite differences Up: Heat Flow Previous: Heat Flow

Finite differences solution

Figure 14: The finite differences algorithm for the heat equation.
\begin{figure}\begin{center}
\epsfig{file=heat.eps,width = 12cm}\end{center}\end{figure}

The numerical solution is based on converting the differential equation into an approximate finite-diffence one. Following a derivation similar to the one we used for the wave equation we approximate the derivatives by finite differences:

$\displaystyle \frac{\partial T}{\partial t}$ $\textstyle =$ $\displaystyle \frac{T(x,t+\Delta t)-T(x,t)}{\Delta t},$ (69)
$\displaystyle \frac{\partial^2 T}{\partial x^2}$ $\textstyle =$ $\displaystyle \frac{T(x+\Delta x,t)+T(x-\Delta x,t)-
2T(x,t)}{(\Delta x)^2}.$ (70)

Replacing in 66 we obtain the discrete equivalent:

\begin{displaymath}
T(x,t+\Delta t)=T(x,t)+\frac{\alpha}{C}\left[T(x+\delta x,t)+T(x-\Delta x,t)
-2T(x,t) \right],
\end{displaymath} (71)

with the constant $C=(\Delta x)^2/\Delta t$. We see in Fig. 14 that the temperature at the point $(x, t+\Delta t)$ is determined by the temperatures at three points of the previous time step. The boundary conditions impose fixed values along the perimeter. The initial condition 67 is used to generate the temperature gradient at time $t=\Delta t$, and the equation is used for the time evolution.

The stability condition for a numerical solution is iven by

\begin{displaymath}
\alpha\frac{\Delta t}{(\Delta x)^2} \leq \frac{1}{4}.
\end{displaymath} (72)

This means that if we make the time step smaller we improve convergence, but if we decrease the space step without a simultaneous quadratic increase of the time step, we worsen it.



Subsections
next up previous
Next: Exercise 6.1: Finite differences Up: Heat Flow Previous: Heat Flow
Adrian E. Feiguin 2004-06-01