# Earth Cubed

## Numeric Solutions to The Heat Equation

I have been reading a lot on Lucia’s blog about two box models which are essentially an approximation of the heat equation with basis functions which are constant over a box.

The heat equation is given by:

$\frac{\partial u}{\partial t} -k\left(\frac{\partial^2u}{\partial x^2}+\frac{\partial^2u}{\partial y^2}+\frac{\partial^2u}{\partial z^2}\right)=0$

or equivalently:

$\frac{\partial u}{\partial t} = k \nabla^2 u$

The fundamental solutions or Greens functions (also see main body theory) are of the form:

$\Phi(\mathbf{x},t) = \Phi(x_1,t)\Phi(x_2,t)\dots\Phi(x_n,t)=\frac{1}{(4\pi k t)^{n/2}}e^{-\mathbf{x}\cdot\mathbf{x}/4kt}.$

This suggests my choice of a negative exponential basis in my post (Lagrangian Mechanics and the Heat Equation) was not two bad a choice although, Guasian functions will decay slightly faster then negative exponentials.

Not all solutions are based on on fundamental solutions for instance in the post (Approximations used in Crank-Nicolson method for solving PDEs numerically) I read that the Crank-Nicolson method was the standard method of soliving the Heat equation numericaly.

For instance in 1-D

$\frac{\partial u}{\partial t}=k \frac{\partial^2u}{\partial x^2}$

the Cranck Nicholson Method is given by:

$\frac{u_{i}^{n + 1} - u_{i}^{n}}{\Delta t} = \frac{k}{2 (\Delta x)^2}\left((u_{i + 1}^{n + 1} - 2 u_{i}^{n + 1} + u_{i - 1}^{n + 1}) + (u_{i + 1}^{n} - 2 u_{i}^{n} + u_{i - 1}^{n})\right)$

It should be noted that this method produces a difference equation. The values at the next time step can be solved for analytically, using cramer’s rule (see also Invertible matrix, analytic solutions). The frequency domain characteristics can be explored using the z transform. Where the frequency response is given by evaluating the z transform along the unit circle.

Also note that numeric error can be reduced when computing future time steps by either recursive squaring:
$A^4=(A^2)(A^2)$
or by using matrix decomposition.

For other numeric method of solve partial differential equations see (Numerical partial differential equations), which I posted in the thread (Preparation for PDEs).

Further with regards to crank Nicholson, there is no time dependency on the right hand side of the equations so other methods, can be used to descretize the heat equations such as using Laplace transforms or the matrix exponential.

With regards to Lucia’s blog

My understanding as posted in (Arthur’s Case 2 (I think)) that the main focus of Lucia’s blog posts is to test the model chosen by Tamino:

lucia (Comment#19822) September 12th, 2009 at 9:23 pm

What I mean is– when testing the two box model, you don’t switch to the diffusive model even if it’s more inherently sensible and intelligent. That’s because to test “X” you must test “X”. You can’t test “Y” even if “Y” seems more likely to pass the test.

This is fine but I think that a wider discussion is warranted about how this model is just a simplified version of the heat equations and what principles of modeling and differential equations can be useful to obtain better solutions.

September 15, 2009 - Posted by | Math

## 3 Comments »

1. I want to do a post on the fundamental solutions but I have a bit of reading to do. The greens function is the impulse response of the system is the convolution of the greens function with the forcing function. I have lots of interesting questions about this which I posted at:

Greens Functions, PDEs and Laplace Transforms

In the mean time I’m going to try and learn a bit about function analysis by watching some of the math lectures at the university of Colorado.

Comment by s243a | September 18, 2009 | Reply

2. The fundamental solution (impulse response) to the heat equation is a Gaussian that increases in width in forward time. This represents the dispersion of the heat. When this response function get’s wide enough it hits a boundary and this changes the behavior of the solution.

I think that before exploring solutions in general an important question is how does a boundary change the solution. Numerical on could try and approximate the deviation on the boundary from that of an unbounded media with some forcing term and use remember that the heat equation is linear so the sum of the response to each forcing is the solution to the ODE. This response is still a numeric solution but requires less states to approximate the partial differential equation.

If the equation is descritized then the corresponding difference equation can be solved using matrix decomposition. Two methods of descritizing the matrix equation are, crank Nicholson and the matrix exponential. Given that the fundamental solution is known the heat equation can also be descritized based on the fundamental solution. Of course with this latter technique some accounting for the system boundaries will be necessary.

On another note, I was thinking of tying these ideas into the Scurr decomposition but I’m not sure if I want to go that rout.
http://www.maths.manchester.ac.uk/~nareports/narep404.pdf

Comment by s243a | September 25, 2009 | Reply

3. this site is very impresive ,pls cani get a mathematical modell on heat equation

Comment by akunna chukwunonso timothy | February 22, 2011 | Reply