Numerical Analysis of Differential Equation with Boundary Conditions

54 Views Asked by At

Note

I have decided to edit this post so it is more specific and also because I was incorrect the first time. I didn't wanna make another post about the same subject, but if this is not allowed then put a comment below and I will repost the original, thanks for your time.

The temperature distribution $T(r)$ within the cylinder wall ($1 \leq r \leq 2$) is determined by the differential equation:

$$ r \frac{d^2T}{dr^2} + \frac{dT}{dr} = 0 \quad $$ The outer side of the pipeline, at $r = 2$, is cooled by the surrounding air with a temperature of $Te = 20^\circ$C. $$ k \frac{dT}{dr} = -\alpha(T - T_e) \quad \text{at } r = 2 \quad $$ a) Discretize the equation using central finite differences for $N = 4$. Use boundary conditions and print out the system matrix and the right-hand side with all elements. The derivative in the boundary condition at $r = 2$ can be approximated using a first-order difference approximation:

$$ k \frac{T_{N+1} - T_{N}}{h} = -\alpha(T_{N} - T_{e}). $$ Use this boundary condition to eliminate $T_{N+1}$ in the last equation of the equation system. Let k = $\alpha$ = 1

This is basically the problem summerized and I got to this linear equation: $$\begin{bmatrix} \frac{-2r}{h^2} && \frac{2r+h}{2h^2} && 0 \\ \frac{2r-h}{2h^2} && \frac{-2r}{h^2} && \frac{2r+h}{2h^2} \\ 0 && \frac{2r-h}{2h^2} && \frac{ah}{k}-\frac{2r}{h^2}-1\end{bmatrix} \begin{bmatrix} T{1} \\ T{2} \\ T{3} \end{bmatrix} = \begin{bmatrix} -T_0\frac{2r-h}{2*h^2} \\ 0 \\ T{e}\frac{ah}{k} \end{bmatrix}$$

Btw $T_{e}$ is the temperature outside which is 20 and $T_0$ is inside witch is 450, is this equation wrong because I keep getting incorrect result when I solve for the vector T. I have been stuck at this problem because no matter what I do I can't get it right. The problem is larger than this but it builds upon it so if I am correct here then I should be there too.