Franz J. Vesely > CompPhys Tutorial > Linear Algebra
 
 





 
< >
Ch. 2 Sec. 5



2.5 Sample Applications



Subsections

2.5.1 Thermal Conduction in 1D

Again, discretize the equation of thermal conduction,

$ \begin{eqnarray} \frac{\textstyle \partial T(x,t)}{\textstyle \partial t} &=& \lambda \frac{\textstyle \partial^{2} T(x,t)}{\textstyle \partial x^{2}} \end{eqnarray} $

Earlier we applied DNGF to the l.h.s. and DDST at time $ t_{n}$ to the r.h.s.:

$ \begin{eqnarray} \frac{\textstyle \partial T(x,t)}{\textstyle \partial x^{2}} &\approx& \frac{\textstyle \delta_{i}^{2}T_{i}^{n}}{\textstyle (\Delta x)^{2}} \end{eqnarray} $

In this manner we arrived at the "FTCS"-formula.

Now we may use the DDST formula at time $t_{n+1}$,

$ \begin{eqnarray} \frac{\textstyle \partial T(x,t)}{\textstyle \partial x^{2}} & \approx & \frac{\textstyle \delta_{i}^{2}T_{i}^{n+1}}{\textstyle (\Delta x)^{2}} \end{eqnarray} $

This leads us to the "implicit scheme of first order"

$ \begin{eqnarray} && \frac{\textstyle 1}{\textstyle \Delta t} [T_{i}^{n+1}-T_{i}^{n}] =\frac{\textstyle \lambda}{\textstyle (\Delta x)^{2}} [T_{i+1}^{n+1}-2T_{i}^{n+1}+T_{i-1}^{n+1}] \end{eqnarray} $

which may be written, using $a \equiv \lambda\Delta t/(\Delta x)^{2}$,

$ \begin{eqnarray} -a T_{i-1}^{n+1}+(1+2a)T_{i}^{n+1}-aT_{i+1}^{n+1}=T_{i}^{n} \end{eqnarray} $

or

$ \begin{eqnarray} && A \cdot T^{n+1} = T^{n} \end{eqnarray} $

where (for fixed $T_{0}$ and $T_{N}$)

$ \begin{eqnarray} && A \equiv \left( \begin{array}{cccccc} 1 & 0 & 0 & . & . & 0 \\ -a & 1+2a & -a & 0 & . & 0 \\ 0 & . & . & . & 0 & . \\ . & . & . & . & . & . \\ . & . & . & 0 & 0 & 1 \end{array} \right) \end{eqnarray} $


This tridiagonal system may be solved by the Recursion Method.


EXERCISE: (See also here)
Redo the earlier exercise on One-dimensional thermal conduction by applying the implicit scheme in place of the FTCS method. Use various values of $\Delta t$ (and therefore $a$.) Compare the efficiencies and stabilities of the two methods.



2.5.2 Potential Equation in 2D

Discretize the elliptic PDE
$ \begin{eqnarray} && \frac{\textstyle \partial^{2}u}{\textstyle \partial x^{2}} + \frac{\textstyle \partial^{2}u}{\textstyle \partial y^{2}} = - \rho \end{eqnarray} $

to find

$ \begin{eqnarray} \frac{\textstyle 1}{\textstyle (\Delta x)^{2}} \left[ u_{i+1,j} - 2u_{i,j} + u_{i-1,j} + u_{i,j+1} - 2u_{i,j} + u_{i,j-1} \right] & = & -\rho_{i,j} \\ && i=1,\dots N; j=1, \dots M \end{eqnarray} $


Combining the $N$ row vectors $\{u_{i,j};\;j=1, \dots M \}$ sequentially to a vector $v$ of length $N.M$ we may write these equations in the form
$ \begin{eqnarray} &&A \cdot v = b \end{eqnarray} $

where $A$ is a sparse matrix, and where the vector $b$ contains the charge density $\rho$ and the given boundary values of the potential function $u$.

Solve by applying any of the Relaxation Methods.


vesely 2005-10-10

< >