We're currently solving the heat equation as a part of the PDE sequence in class.

We've been given the formula:$$T(i, n+1) = T(i,n)+\alpha \left [\frac{T(i+1,n)-2 T(i, n)+T(i-1,n)}{\Delta x^2} \right ] \quad \Delta t$$ I've got boundary conditions handled. They aren't the problem.

The problem here is, if one notices, $\alpha$, $\Delta x^2$, and $\Delta t$ are all permanent constants throughout the number of iterations. Thus, they can be pre-evaluated. There's just that one problem where, if the value of $\frac {\alpha \Delta t}{\Delta x^2}$ becomes larger than 0.5, I start running into problems with the equation itself. One can see that when that term = 0.5: $$\begin{matrix} 100 & 0 & 0 & 0 & 0\\ 100 & 50 & 0 & 0 & 0\\ 100 & 50 & 25 & 0 & 0\\ 100 & 67.5 & 25 & 12.5 & 0 \end{matrix}$$

Here, every row represents a new time instance, and every column is a new discrete x-position element along the 'thin rod' that I am considering.

The moment the $\frac {\alpha \Delta t}{\Delta x^2}$ goes below 0.5, however, we are 'good', meaning that this problem ceases to occur, but the propagation of temperature through the 'thin rod' is still really slow, even with a really high temperature at one end, which is held constant.

Is the equation provided wrong? Or am I misunderstanding something? Is there some error in sign somewhere?

Edit: This is indeed a class assignment, but given the nature of the situation, I am inclined to think that it is either my understanding that is fundamentally flawed (beyond the code, just the concept) or I've simply been given the wrong equation.

Edit 2: Error in evaluating the matrix. Corrected that.


2 Answers 2


You've stumbled upon a common problem with explicit schemes. This is a common issue with numerical analysis and it's called the Courant–Friedrichs–Lewy (CFL) condition (https://en.wikipedia.org/wiki/Courant%E2%80%93Friedrichs%E2%80%93Lewy_condition).

In short, you have to adjust your time step size and the spatial discretization in order to meet this condition, which very much depends on the physical situation. Usually, the time step is adjusted, since adaptive meshing (or remeshing and mapping your solution) is somewhat costly.

Conceptually, this condition occurs because the "communication" between nodes becomes much slower than the "motion" of the solution. This means that the temperature, let's think the diffusion of phonons for a more physical conceptualization, moves over multiple cells per time step. What you want is a condition such that the phonons travel through one cell over many time steps.

The CFL condition is a required condition only for explicit numerical schemes and is a necessary condition in both convection and diffusion problems.

  • $\begingroup$ I rather liked the 'Congratulations' pre-edit. It made me feel good for realizing that I'd run into this condition which I didn't even know was a thing. Many thanks. However, I am still stuck with the problem of the problem never progressing in terms of temperature gradients through the thin rod. $\endgroup$
    – Chronum
    Oct 23, 2015 at 5:58
  • $\begingroup$ Hah, I thought it might have seemed a bit sarcastic and condescending, but I do think it's really one of the graduating moments when you realized this. $\endgroup$ Oct 23, 2015 at 6:00
  • $\begingroup$ It is. Who would've know that the entire thing diverges (is that the correct word here?) given that the constant term exceeds 0.5. I am, however, unfortunately still stuck with a rod that barely conducts any heat. $\endgroup$
    – Chronum
    Oct 23, 2015 at 6:03

You've forgotten a step.

The equation is: $$T(i, n+1) = T(i,n)+\alpha \left [\frac{T(i+1,n)-2 T(i, n)+T(i-1,n)}{\Delta x^2} \right ] \quad \Delta t$$

And you are evaluating: $$T(i, n+1) = \alpha \left [\frac{T(i+1,n)-2 T(i, n)+T(i-1,n)}{\Delta x^2} \right ] \quad \Delta t$$

  • $\begingroup$ It appears that you are correct. How utterly stupid of me. I shall edit the matrix and see if that makes a difference, thank you. I'll accept the answer if I see that this works. $\endgroup$
    – Chronum
    Oct 23, 2015 at 5:42
  • 1
    $\begingroup$ It's a remarkably easy mistake to make, which is why I recognised it... We only think about the part of the problem that's non-trivial to solve. $\endgroup$ Oct 23, 2015 at 5:47
  • $\begingroup$ Jesse's answer enlightened me about what this particular problem is called. As helpful as that is, I still run into the problem of temperature conduction 'stagnating' after a certain time. Thus, one end stays at 0, while the other stays at 1000, and I make no progress. This is rather depressing. $\endgroup$
    – Chronum
    Oct 23, 2015 at 5:57
  • $\begingroup$ If the boundary conditions specify that one side is zero and one is 1000, that is actually the expected result, I would think. Gradually converging onto a straight line between the two boundary conditions is certainly normal for the heat equation, and this makes sense - heat equalizes over time. $\endgroup$ Oct 23, 2015 at 6:02
  • 1
    $\begingroup$ That's correct. If you don't have heat generation and you also have constant thermophysical properties, you will have a straight line between two Dirichlet boundary conditions. $\endgroup$ Oct 23, 2015 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.