Sie sind auf Seite 1von 6

ME109, Fall 2005

Primer in the Finite Difference Method

G. Rein

Numerical Solutions to the 1D Heat Equation

0. Problem Statement:
Find the temperature distribution for the plane wall at steady state.
& Conductivity of material is k , length is L , and internal heat generation is q .

One end is insulated, and the other exposed to convection from air at T0 with coefficient h . See sketch in Fig. 1.

Fig. 1: Sketch of the problem

1. Physical Model
Heat transfer by conduction inside the wall. Convection at then exposed end. Assumption: Plane wall Consider change in one dimension only. Properties are uniform Steady state solution at t =

ME109, Fall 2005

Primer in the Finite Difference Method

G. Rein

2. Mathematical Model
The governing equation is obtained applying the conservation of energy and using Fourier's Law in one spatial dimension and at steady state. One-dimensional Heat Equation:
T T & =0 k + q = c p x x t

For the boundary conditions using Fourier's Law:

&0 at x = 0 adiabatic condition, q = k

T =0 x x = 0 T = h (T T x = L ) x x = L

&L at x = L convection surface condition, q = k

3. Numerical Model
First we define a uniform grid for the problem. If the total number of nodes is N , then the node size is x =
L . See sketch in Fig. 2. N

Fig. 2: Sketch of the numerical grid

Fig. 3: Heat fluxes on a node

ME109, Fall 2005

Primer in the Finite Difference Method

G. Rein

In terms of the heat fluxes in and out of node m (Fig. 3), the general form of the & Heat Equation is: q
m+ 1 2

& q

1 2

& + q x = 0 . Now we will apply it to the grid

shown above; first to the inside the domain and then to the boundaries. Inside the domain, the heat equation is: k which simplifies to: Tm =
Tm + 1 Tm T Tm 1 & + q x = 0 , k m x x

1 x 2 q & k + Tm + 1 + Tm 1 . 2

At the boundaries, it goes as: at x = 0 , k T2 T1 0 x 2 x & = 0 T0 = q +q & k + T2 x TN TN 1 h k & q + T + TN 1 x x x 2 = 0 TL = & +q h k x + x x 2

at x = L ,

h (T0 TN ) k

4. Computer Model
The implementation of the numerical model into the computer depends on the software used, i.e. Excel, Matlab, FORTAN, C+, CFD package... The conductivity of material is k = 0.5
& generation is q = 10 W , length is L = 1m , and internal heat m 2K

W . One end is insulated, and the other exposed to m3

convection from air at T0 = 25C with coefficient h = 10

W . mK Note that before reporting your final results, one has to make sure than the grid

has the proper size and that the numerical error is acceptably small. This can be done comparing the results from different grid sizes or Grid Independence Study (see corresponding section in this document).

ME109, Fall 2005

Primer in the Finite Difference Method

G. Rein

4.1 Computer Model with Excel

Fig. 4: Screen-shot of the excel computer model

With Excel, note the following tricks: Write once the formula for the inside of the domain and paste it in all the corresponding cells. Then write the formula on each boundary. When using properties or parameters in Excel formulas, make sure to use the absolute reference to it with the $ symbol, i.e. $D$3. Otherwise the pasting advantage will not work. Note that a relative reference to a cell does not have the $ symbol. i.e. D3. We will use circular references. To avoid Excel error messages we must activate the iteration tool. Go to the menu Tools, then to the submenu Options, then to the label Calculation and click the box for Iteration. Increase the number of iterations as needed. To make sure that Excel has finished iterating, press the key F9 on your keyboard a few of times until no more changes in the cell values occur. If Excel crashes and cells show the message #NUM it means that initialization must be done. In a few cells put by hand a random temperature (this will erase the formula in the cell too). Do that in more

ME109, Fall 2005

Primer in the Finite Difference Method

G. Rein

cells until the #NUM message disappears from the other cells. Then paste again the formula all over the cells. Iterate. To extend the grid, just change the number of grid nodes N . Add more rows (or column) and paste the formula for the inside of the domain into more Excel cells. Then write again the formula for the boundary at the new last cell. Iterate.

Grid Independence Study


The step from the mathematical model to the numerical model always involves some degree of approximation. Numerical methods produce results that include a numerical error. It is very important to control the magnitude of this error and to keep it bellow an acceptable value. The maximum accuracy that can be achieved is usually dictated by the amount of computer resources available to solve the problem (time constrains, storage limitations, manageable considerations, etc...).
39 37 35 T[C] 33 31 29 27 25 0.0 0.2 0.4 X [m] 0.6 0.8 1.0 5 10 20 100

Fig. 5. Results as a function of the number of nodes.

In finite difference, one source of error is the truncation error, which can be reduced by increasing the number of nodes and reducing the node size. So as the grid is made finer, the results converge towards the exact mathematical solution (Fig. 5). A grid independence study is the procedure where the results of the

ME109, Fall 2005

Primer in the Finite Difference Method

G. Rein

numerical method are compared as a function of the grid size. It quantifies the convergence of the result to an acceptable solution, and aid to determine the compromise solution between accuracy and resource allocation.

Das könnte Ihnen auch gefallen