# Solution of algebraic equations

Jump to: navigation, search
Line-by-line method

To obtain the temperature distribution for one time step, it is necessary to solve the discretized algebraic equations for all grid points simultaneously. Direct solution of these equations (e.g., using Cramer’s rule) requires a large amount of computational time and storage. If the problem is linear, we only need to solve the set of linear algebraic equations once for every step. If, however, the problem is nonlinear, solving the algebraic equations once only gives us the temperature distribution based on the temporary coefficients of the algebraic equations and several iterations must be performed to get the temperature distribution for one time step. For this case, it is imperative to develop an efficient algorithm to solve the algebraic equations. A simple but efficient algorithm – line-by-line method – that combines direct method (TDMA) and Gauss-Seidel iteration method will be discussed here (Patankar, 1980). We will demonstrate this method using a two-dimensional conduction problem. The discretized equation aPTP = aETE + aWTW + aNTN + aSTS + b from numerical solution of multi-dimensional unsteady-state conduction can be rewritten as

${A_{i,j}}{T_{i,j}} = {B_{ij}}{T_{i + 1,j}} + {C_{i,j}}{T_{i - 1,j}} + {D_{i,j}}{T_{i,j + 1}} + {E_{i,j}}{T_{i,j - 1}} + {E_{i,j}} \qquad \qquad(1)$

where i = 1,2,...M,j = 1,2,...N. The line-by-line method can be performed either in the x- or y-direction. To apply this method in the x-direction, we can choose the jth row to apply the TDMA [see Fig. 1(a)]. To do that, it is assumed that the temperature at the (j − 1)th and (j + 1)th row are known from the previous iteration. For the first iteration at the current time step, they can be taken as values at the previous time step. Equation (1) can then be rewritten as

${A_{i,j}}{T_{i,j}} = {B_{ij}}{T_{i + 1,j}} + {C_{i,j}}{T_{i - 1,j}} + ({D_{i,j}}{\tilde T_{i,j + 1}} + {E_{i,j}}{\tilde T_{i,j - 1}} + {E_{i,j}}) \qquad \qquad(2)$

where ~ represents the values from the previous iteration. If we treat all terms in the parentheses on the right hand of eq. (2) as the constant term, di, in eq. aiTi = biTi + 1 + ciTi − 1 + di,i = 1,2,...M from numerical solution of 1-D steady conduction, eq. (2) can be solved using TDMA to get Tij, in the jth row. We can perform this procedure from j = 1toN to get the temperature for the whole domain updated. This can also be done in the reverse direction from j = Nto1. The information about the boundary conditions in the x-direction can be propagated into the entire domain, but the information on the boundary condition in the y-direction can only propagate one grid into the computational domain. To speed up the process, we can also choose the ith column to update its temperature using TDMA [see Fig. 1(b)]. In this case, eq. (1) can then be rewritten as

${A_{i,j}}{T_{i,j}} = {D_{i,j}}{T_{i,j + 1}} + {E_{i,j}}{T_{i,j - 1}} + ({B_{ij}}{\tilde T_{i + 1,j}} + {C_{i,j}}{\tilde T_{i - 1,j}} + {E_{i,j}}) \qquad \qquad(3)$

which can be applied either from i = 1toM or i = Mto1. The line-by-line method is a combination of direct method (TDMA) and iteration method. Once we complete the procedure along the x- direction twice (fromj = 1toN and then from j = Nto1) and along the y-direction twice (fromi = 1toM and then from i = Mto1) – referred to as one iteration – the information from boundary conditions on all four sides can be propagated throughout the computational domain. The numerical practices by the authors and other researchers indicate that a converged solution can be obtained after two to four iterations. The above line-by-line method can be easily extended to the case of three-dimensional heat conduction problem. While our discussion here is for solution of algebraic equations resulting from the discretization of the heat conduction problem, it can also be used to solve the discretized equations for convection problems.

## References

Faghri, A., Zhang, Y., and Howell, J. R., 2010, Advanced Heat and Mass Transfer, Global Digital Press, Columbia, MO.

Patankar, S.V., 1980, Numerical Heat Transfer and Fluid Flow, Hemisphere, Washington, DC.