Heat-wave gives you several options on how to solve the heat equation.
(Click on the picture to the left to see some of the UI that controls the heat solver.)
There are three major methods to choose from: forward difference (also called the explicit method),
backward difference (also called the implicit method),
and central difference
(also called the Crank-Nicolson method).
Central difference combines features of forward and backward difference and is the most accurate of the three.
You can read more about these methods at
Wikipedia's Finite-difference method entry.
I also found
Parallel Numerical Solution of 2-D Heat Equation (Horak, Gruber) (PDF)
to be useful.
The forward-difference method is the simplest to understand. It calculates a (weighted) average with the neighbor cells,
applied to a window that is 3 cells wide in the 1D case. (In 2D it is applied to 5 cells, the center value, the two cells
adjoining in the x direction, and the two cells adjoining in the y direction.)
The value of a cell at position x and time t+dt is calculated from the previous sheet (at time t) as
The forward-difference method is easy to code, easily made parallel, and fast to run.
But you can only take small forward steps with the forward-difference method, so although each generation
may be fast to calculate you will need a lot of generations (and a small time step) to reach an equilibrium.
If you try to take big steps with forward-difference you end up with sheet values that oscillate and grow
with each generation. See the Instabilities page for details.
With the backward-difference method however you don't have instabilities.
You can make timesteps as big as you want and the solution will not blow up,
although it does get less accurate.
This is the big advantage to using backward difference.
It is more difficult to code than forward difference, and the individual sheet calculations are quite
a bit slower, but the fact that you can take large time steps means you can run a rough simulation
much faster.
The backward-difference method involves linear algebra.
You have to solve a matrix equation, which means you have to invert a matrix.
You will almost always see this described for the 1D case, since in 1D the matrix is a
tri-diagonal matrix, and the equation is easily and quickly solved.
You can read more about tri-diagonal matrices here:
Unfortunately the 2D case is not so simple.
The matrix is penta-diagonal (5-diagonal), and the non-zero diagonals are not adjacent.
Furthermore the matrix is very large. For a 100x100 sheet the (sparse) matrix is 10000x10000.
Here are some links that describe penta-diagonal matrices:
Of course the 3D case is even worse, with a gigantic 7-diagonal matrix.
So instead of solving the 2D sheet all at once, Heat-wave solves the sheet along one axis with a 1D solve, and then
solves it again sideways. This is a poor solution however.
Heat-wave also let's you choose the central-difference method, which is a combination of the forward- and
reverse-difference methods. It has the disadvantages of both — you're restricted to smaller time steps, and
you have to invert a matrix, but it's the more accurate than the other two methods.
Heat wave has a check-box that lets you choose to "Use parallel algorithm (via QtConcurrent)".
This is provided for timing tests and does not affect the results of a solve.
For more info see:
Heat-wave also lets you choose a "Solve technique".
The first choice, "Interleave", means first solve the sheet as a bunch of 1D lines parallel to the x-axis,
and then solve on top of the first result as a bunch of 1D lines along the y-axis.
The second choice, "Simultaneous", performs a one-pass 2D solve when the method is forward difference.
When the method is either backward or central difference "Simultaneous" performs 2 one-dimensional solves
like it does with "Interleave", but both solves start from the same source sheet, and the results of the
two are added together.
The last the technique choice, "Damped wave", solves the wave equation instead of the heat equation.
We'll talk about that on the next page.
|