Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

This is the first of two chapters which illustrate the applicability of the methods introduced in Chap. 8. Within this chapter the finite difference approach is employed to solve the stationary heat equation. Let us motivate briefly this particular problem. We consider a rod of length \(L\) which is supposed to be kept at constant temperatures \(T_0\) and \(T_N\) at its ends as illustrated in Fig. 9.1. The homogeneous heat equation is a linear partial differential equation of the form

$$\begin{aligned} \frac{\partial }{\partial t} T = \kappa \varDelta T\!. \end{aligned}$$
(9.1)

Here \(T = T(x,t)\) is the temperature as a function of space \(x \in {\mathbb R}^3\) and time \(t \in {\mathbb R}\), \(\varDelta = \nabla ^2 = \partial ^2_x+\partial ^2_y+\partial ^2_z\) is the Laplace operator, and \(\kappa = \text {const}\) is the thermal diffusivity.

Fig. 9.1
figure 1

We consider a rod of length \(L\). Its ends are kept at constant temperatures \(T_0\) and \(T_N\), respectively

We remark, that Eq. (9.1) is a partial differential equation together with initial and boundary conditions. Moreover, we note in passing that the heat equation is equivalent to the diffusion equation

$$\begin{aligned} \frac{\partial }{\partial t} \rho (x,t) = D \varDelta \rho (x,t), \end{aligned}$$
(9.2)

with particle density\(\rho (x,t)\) and the diffusion coefficient\(D = \text {const}\). Here we restrict ourselves to a simplified situation in order to test the validity of the finite difference approach discussed in Sect. 8.2. The general solution of the heat or diffusion equation will be discussed in Sect. 11.3.

If we assume that the cylindrical surface of the rod is perfectly isolated, we can restrict the problem to a one-dimensional problem. Furthermore, we assume that the steady-state has been reached, i.e. \(\frac{\partial }{\partial t} T(x,t) = 0\). Hence, the remaining boundary value problem is of the form

$$\begin{aligned} \left\{ \begin{array}{ll} \frac{\mathrm{d}^2}{\mathrm{d} x^2}T\!\!\!\!\!\!\!&{} = 0, \qquad x \in [0,L], \\ T(0)\!\!\!\!\!\!\!&{}= T_0,\\ T(L)\!\!\!\!\!\!\!&{}= T_N. \end{array} \right. \end{aligned}$$
(9.3)

The solution can easily be found analytically and one obtains

$$\begin{aligned} T(x) = T_0 + \left( T_N - T_0 \right) \frac{x}{L}. \end{aligned}$$
(9.4)

In the following section we will apply the approach of finite differences to the boundary value problem (9.3) as discussed in Sect. 8.2.

2 Finite Differences

We discretize the interval \([0,L]\) according Chap. 2 by the introduction of \(N\) grid-points\(x_n = n h\), with \(h = L/N\), \(x_0 = 0\), and \(x_N = L\). Furthermore, \(T_n \equiv T(x_n)\) and, in particular, we refer to the boundary conditions (9.3) as \(T_0\) and \(T_N\), respectively.

On the basis of this discretization, we approximate Eq. (9.3) by

$$\begin{aligned} \frac{T_{n+1} - 2 T_n + T_{n-1}}{h^2} = 0, \end{aligned}$$
(9.5)

or equivalently

$$\begin{aligned} T_{n+1} - 2 T_n + T_{n-1} = 0. \end{aligned}$$
(9.6)

We can rewrite this as a matrix equation,

$$\begin{aligned} A T = F, \end{aligned}$$
(9.7)

where the boundary conditions have already been included. In Eq. (9.7) the vector \(T = ( T_1 , T_2, \ldots , T_{N-1} )^T\), the tridiagonal matrix\(A\) is given by

$$\begin{aligned} A = \left( \begin{array}{cccccc} -2 &{} 1 &{} 0 &{} &{} \ldots &{} 0 \\ 1 &{} -2 &{} 1 &{} 0 &{} \ldots &{} 0 \\ 0 &{} 1 &{} -2 &{} 1 &{} &{} \\ \vdots &{} &{}\ddots &{}\ddots &{}\ddots &{} \\ 0 &{} \ldots &{} &{} &{} 1 &{} -2 \end{array} \right) , \end{aligned}$$
(9.8)

and the vector \(F\) is given by

$$\begin{aligned} F = \left( \begin{array}{c} -T_0 \\ 0 \\ \vdots \\ 0 \\ -T_N \end{array} \right) . \end{aligned}$$
(9.9)

It is an easy task to solve Eq. (9.7) analytically. It follows from Eq. (9.6) that

$$\begin{aligned} T_{n+1} = 2 T_n - T_{n-1}, \qquad n = 1, \ldots , N-1. \end{aligned}$$
(9.10)

We insert \(n = 1, 2, 3\) in order to obtain

$$\begin{aligned} T_2&= 2 T_1 - T_0,\end{aligned}$$
(9.11)
$$\begin{aligned} T_3&= 2 T_2 - T_1, \nonumber \\&= 3 T_1 - 2 T_0,\end{aligned}$$
(9.12)
$$\begin{aligned} T_4&= 2 T_3 - T_2, \nonumber \\&= 4 T_1 - 3 T_0. \end{aligned}$$
(9.13)

We recognize the pattern and conclude that \(T_n\) has the general form

$$\begin{aligned} T_n = n T_1 - (n-1) T_0, \end{aligned}$$
(9.14)

which we prove by complete induction:

$$\begin{aligned} T_{n+1} =\,&2 T_n - T_{n-1} \nonumber \\ =\,&2 ( n T_1 - (n-1) T_0) - \left[ (n-1) T_1 - (n-2) T_0 \right] \nonumber \\ =\,&(n+1) T_1 - n T_0. \end{aligned}$$
(9.15)

Hence, expression (9.14) is valid for all \(n = 1, \ldots , N\). However, since \(T_N\) is kept constant according to the boundary condition, we can determine \(T_1\) from

$$\begin{aligned} T_N = N T_1 - N T_0 +T_0, \end{aligned}$$
(9.16)

which yields

$$\begin{aligned} T_1 = \frac{T_N - T_0}{N} + T_0. \end{aligned}$$
(9.17)

Inserting (9.17) into (9.14) gives

$$\begin{aligned} T_n&= T_0 + (T_N - T_0 ) \frac{n}{N} \nonumber \\&= T_0 + (T_N -T_0 ) \frac{n h}{L}, \end{aligned}$$
(9.18)

which is exactly the discretized version of Eq. (9.4). Hence the finite difference approach to the boundary value problem (9.3) is exact and independent of the grid-spacing \(h\). This is not surprising since we proved already in Chap. 2 that finite difference derivatives are exact for linear functions.

3 A Second Scenario

We consider the inhomogeneous heat equation

$$\begin{aligned} \frac{\partial }{\partial t} T = \kappa \varDelta T - \varGamma (x,t). \end{aligned}$$
(9.19)

Here \(\varGamma (x,t) \equiv \varGamma (x)\) is some heat source or heat drain, which is assumed to be independent of time \(t\). Again, we consider the one dimensional, stationary case, i.e.

$$\begin{aligned} \frac{\mathrm{d}^2}{\mathrm{d} x^2}T = \frac{1}{\kappa } \varGamma (x), \end{aligned}$$
(9.20)

with the same boundary conditions as in Eq. (9.4). Furthermore, we assume \(\varGamma (x)\) to be of the form

$$\begin{aligned} \varGamma (x) = \frac{{\varTheta }}{\ell } \exp \left[ - \frac{ \left( x - \frac{L}{2} \right) ^2}{\ell ^2} \right] , \end{aligned}$$
(9.21)

i.e. \(\varGamma (x)\) has the form of a Gauss peak which is centered at \(x = L/2\) and has a width determined by the parameter \(\ell \) and a maximum height given by the constant \({\varTheta }\). Such a situation might occur, for instance, when the rod is heated with some kind of a heat gun or cooled by a cold spot. (In the case of the diffusion equation one could imagine, that the density of electrons \(\rho \) is constant at the contacts at \(x = 0\) and \(x = L\). The source/drain term \(\varGamma (x)\) then accounts for a constant generation or recombination rate of electrons, for instance, through incoming light or intrinsic traps, respectively.)

Furthermore, we note that in the limiting case \(\ell \rightarrow 0\) we have

$$\begin{aligned} \lim _{\ell \rightarrow 0} \varGamma (x) = \varTheta \delta \left( x - \frac{L}{2} \right) \!, \end{aligned}$$
(9.22)

where \(\delta ( \cdot )\) is the Dirac \(\delta \)-distribution; in this case the spatial extension of the source/drain term \(\varGamma (x)\) is infinitesimal.

We now employ the results of Sect. 8.2 and rewrite the system of equations in the familiar form

$$\begin{aligned} A T = F\!, \end{aligned}$$
(9.23)

where \(A\) has already been given in Eq. (9.8), \(T = (T_1,T_2,\ldots , T_{N-1})^T\) and \(F\) is given by

$$\begin{aligned} F = \frac{h^2}{\kappa } \left( \begin{array}{c} \varGamma _1-\frac{\kappa }{h^2}T_0 \\ \varGamma _2 \\ \vdots \\ \varGamma _{N-2} \\ \varGamma _{N-1}-\frac{\kappa }{h^2}T_N \end{array} \right) \!. \end{aligned}$$
(9.24)

Here we used the notation \(\varGamma _n \equiv \varGamma (x_n)\).

Fig. 9.2
figure 2

Temperature profile \(T(x)\) (solid line, left hand scale) and the source function \(\varGamma (x)\) (dashed line, right hand scale) for \(N = 5\)

Fig. 9.3
figure 3

Temperature profile \(T(x)\) (solid line, left hand scale) and the source function \(\varGamma (x)\) (dashed line, right hand scale) for \(N = 10\)

Fig. 9.4
figure 4

Temperature profile \(T(x)\) (solid line, left hand scale) and the source function \(\varGamma (x)\) (dashed line, right hand scale) for \(N = 100\)

The system is solved numerically quite easily using methods discussed by Press et al. [1] for the solution of sets of algebraic equations of the kind (9.24) with tridiagonal matrix \(A\). We chose \(L = 10\), \(\kappa = 1\), \(\varTheta = -0.4\), \(\ell =1\), \(T_0 = 0\) and \(T_N = 2\). The resulting temperature profiles \(T(x)\) (solid line) for different values of \(N\) can be found in Figs. 9.2, 9.3 and 9.4 as well as the respective form of the function \(\varGamma (x)\) (dashed line). With increasing number of steps we see, as it was to be expected, a refinement of the temperature profile. Its maximum does not quite agree with the minimum of \(\varGamma (x)\), it is shifted slightly towards the end of the rod because of the boundary conditions, i.e. \(T_0 < T_N\).

Summary

The methods of Sect. 8.2 were applied to find the numerical solution of the stationary heat equation with Dirichlet boundary conditions. We studied the particular case of an isolated rod of length \(L\). This reduced the dimensionality of the differential equation to one. The length of the rod was then divided into \(N\) discrete grid-points. Using finite differences the one-dimensional ordinary second order differential equation which described this particular problem was transformed into a set of linear algebraic equations which determined the temperatures at each grid-point. This set of algebraic equations was characterized by a tridiagonal coefficient matrix. Solutions have been studied with and without a heat source which was described as a ‘point’ source characterized by a Gaussian of given width and amplitude. In the first case analytic solutions were easily derived. They described a linear temperature profile increasing (decreasing) from \(T_0\) to \(T_N\). In the latter case solutions were generated numerically using specific algorithms designed for sets of algebraic equations with a tridiagonal coefficient matrix \(A\).

Problems

  1. 1.

    Calculate the stationary temperature profile across the cylindrical rod of Fig. 9.1 which is exposed to a heat sink centered around \(x=L/2\). This heat sink is described by a function \(\varGamma (x)\) which is of rectangular shape of width \(a\) and depth \(\theta \). Both ends of the rod are kept at constant temperatures \(T_0\) and \(T_N\), respectively.

  2. 2.

    Investigate the three cases \(T_0 > T_N\), \(T_0<T_N\), \(T_0=T_N>0\), and study the influence of the width \(a\) of the heat sink on the temperature profile.