I simulated the Laplace's heat equation on a grid (200x200) with boundary conditions of 0 (a cold source) on the top and left and 1 (of hot source) on the bottom and right. (see gif)

I stopped iterating more on the time because I obtain kind of an equilibrium. Do we know to which functions it converges ? It looks like a bit of x^2 and sqrt(x) between 0 and 1.

enter image description here

I'm looking for these functions:

enter image description here

The pure final step image looks like this (t = 39500)

enter image description here

Using wolframalpha, I find an quadratic approximation for the cold equilibrium : -0.00327*x^2 + 1.64*x + 2.42 it gives:

enter image description here

Do we have a precise equation?

  • 1
    $\begingroup$ What exactly are your boundry conditions along the edges? Do you have a fixed temperature along each edge or does it vary smoothly from the bottom right to top left? Or do you have some other condition? $\endgroup$ – By Symmetry Nov 10 '18 at 1:24
  • $\begingroup$ I have a permanent source of heat (=1) at the right and bottom and a permanent source of cold (=0) at the top and left. That's why we have an equilibrium because if we didn't have the cold source at the top, the heat would have spread all over the grid $\endgroup$ – Romain B. Nov 10 '18 at 1:31
  • $\begingroup$ You have a function value 0 at the grid point at the top left corner and function value of 1 at the grid point at the bottom right corner? Is the region square? $\endgroup$ – Chet Miller Nov 10 '18 at 2:21
  • $\begingroup$ This is the discretized heat equation where the value of the point (i,j) on the 2D grid at the time t+1 is the mean value of the 4 neighbors at time t. I just have constant value on the edges to simulate a constant source of heat/cold $\endgroup$ – Romain B. Nov 10 '18 at 2:31

Your iterations are converging to a solution of Laplace's equation, $\nabla^2T(x,y)=0$, with your boundary conditions. This equation can be solved exactly in a rectangular area, with $T$ being arbitrary specified functions along the borders. The solution technique produces an infinite series, as shown here:


If we take your grid to be the unit square $0 \le x \le 1$, $0 \le y \le 1$, then a solution which has $T=0$ along the bottom, left, and right and $T=1$ at the top is the one derived in the PDF, which is

$$f(x,y)=2\sum_{n=1}^\infty\frac{1-(-1)^n}{n \pi \sinh{n \pi}}\sin{n \pi x}\sinh{n \pi y}$$

It looks like this:

enter image description here

The contour lines show $T=0.1, 0.2, … 0.9$. Of course the temperature varies smoothly between the contours; the constant colors are just how Mathematica does contour plots by default.

The solution you want, with $T=0$ along the left and top and $T=1$ along the right and bottom is the superposition


and looks like this:

enter image description here

Here is a version with continuous shading:

enter image description here

As far as I know, the infinite sum cannot be summed to produce a simpler form for the solution, and there is no simple equation for the contour lines (except for the obvious one along the diagonal). However, using the exact solution you could calculate the points on any contour line numerically.

| cite | improve this answer | |
  • $\begingroup$ How can you compute this infinite serie ? Do we stop summing when the added term is small enough ? $\endgroup$ – Romain B. Nov 10 '18 at 11:45
  • $\begingroup$ Yes. For large $u$, $\sinh{u}$ behaves like $e^u/2$. So for large $n$ the terms in $f(x, y)$ decrease exponentially like $e^{-\pi(1-y)n}$. $\endgroup$ – G. Smith Nov 10 '18 at 18:13
  • $\begingroup$ I produced the plots by keeping the first 100 terms. $\endgroup$ – G. Smith Nov 10 '18 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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