# Homework Help: Approximation of boundary value problem using finite differences

1. Mar 3, 2010

### ataylor

1. The problem statement, all variables and given/known data
A hot fluid is flowing through a thick-walled cylindrical metal tube at a constant temperature of 450C. The cylinder wall has an inner radius of 1 cm and an outer radius of 2 cm and the surrounding temperature is 20C. The temperature distribution u(r) in the metal is defined by the differential equation:

$$r\frac{d^2 u}{dr^2} + \frac{du}{dr} = 0$$

With the boundary conditions:

$$u\left(1\right) = 450$$

$$\frac{du}{dr}\left(2\right) = -K\left(u-20\right)$$

where K=1.

Approximate the boundary value problem by creating a matrix problem using the finite difference method.

2. Relevant equations

3. The attempt at a solution
First, the interval $$1\leq r \leq 2$$ is divided by the number of iterations, N, to give the step length, h.

The derivatives of all the values inbetween the boundaries can be approximated by using finite differences as follows:

$$r\frac{u_{N-1}-2u_{N}+u_{N+1}}{h^2} + \frac{u_{N+1}-u_{N-1}}{2h} = 0$$

Which after rearrangement gives:

$$r\frac{u_{N-1}-2u_{N}+u_{N+1}}{h^2} = -\frac{u_{N+1}-u_{N-1}}{2h}$$

This can be represented as a linear matrix problem Ax = B by using the left-hand coefficients to create a tridiagonal N-by-N matrix (A), the coefficients being:

$$1\frac{r_{N}}{h^2}, -2\frac{r_{N}}{h^2}, 1\frac{r_{N}}{h^2}$$

and by using the right-hand values to create a n-by-1 column matrix (B). This problem should be solveable using gaussian elimination to give the matrix X, which contains the values of u at all N iteration points.

The first and last value of the B matrix also have to be corrected due to the boundary values, which themselves are outside the range of the matrix.

When solving similar problems in the past, the boundary conditions have always been given as two function values at different points i.e u(1) and u(2) and usually there has been some way of calculating values for the B matrix. The problem I'm having here is finding a way to use the second boundary value, since it is given as -(u-20), with u presumably being u(2) which is unknown and finding a way to generate the matrix B, i.e the values of du/dr.