Numerical simulations blog by Slawomir Polanski

1D Laplace equation - the Euler method

The previous post stated on how to solve the heat transfer equation analytically. I could have solved it because the equation form is really simple. For most of the physical problems, it is impossible to find the exact solution of differential equations so scientists have developed numerical methods to get some approximation of what we could obtain analytically. In this blog, I am about to show one of these methods and it is going to be the Euler’s method.

At first, let’s recall the heat transfer problem:

MathJax TeX Test Page

The Euler method

Using the definition of function derivative, one can formulate the method as follows:

Unfortunately, the specified problem of heat equation is kind of special as it is Double Boundary Value Problem (the two values of temperature are known on the boundaries). To solve it by Euler’s method we need to know a temperature and a derivative of the temperature on one of the boundaries. As I don’t know the derivative, I am going to guess a value and then based on the result check whether it’s correct.

Let’s reformulate the problem to be:

In discrete notation it is going to be:

The discrete value of function $T(x)$ is presented below for two datasets:

Temperature distribution

One can see that the values for the second dataset are getting lower through the wall thickness and it is more suitable for our example. Now, we can take another shoot and try to hit $T(1)=15$, but it is better to take advantage of following formula:

Knowing that $T(0) = 0$ and $\frac{dT(x)}{dx} = -15$ we can obtain the final solution.

Temperature distribution

Summary

This time, the method used for obtaining a solution seems to take more time than analytical way. In the next post I will present how to solve 1D Poisson’s equation and this will prove how handy the numerical methods are. For those who might be interested, I am attaching also the Python code which I used to get results.

SP