Computational Fluid Dynamics - Elementary (a)



Linear Algebraic Systems



A linear algebraic system is a set of linear equations dealing with a certain collection of unknowns:
\begin{equation} \left\lbrace{ \begin{aligned} & a_{11} x_1 + a_{12} x_2 + ... + a_{1n} x_n = b_1 \\ & a_{21} x_1 + a_{22} x_2 + ... + a_{2n} x_n = b_2 \\ & \\ & a_{m1} x_1 + a_{m2} x_2 + ... + a_{mn} x_n = b_m \end{aligned}} \right. \end{equation} A more compact way to write a linear system is to gather all the coefficients $a_{ij}$ in a matrix $[A]$, all the unknowns $x_j$ in a vector $\textbf{x}$ and all the rhs in another vector $\textbf{b}$:
\begin{equation} [A]\textbf{x} = \textbf{b}. \end{equation} To solve the linear system, if possible, means to find the unique solution for each unknowns and, in terms of matrix, it is posible just if the determinant of [A] is different from zero. The solution can then be obtained inverting the system matrix and multiplying it times the rhs vector:
\begin{equation} if \ \ det([A]) ~= 0 \ \ \ , \ \ \ \textbf{x} = [A]^{-1}\textbf{b}. \end{equation} Such a sort of solution is called direct solution for the system. Because of cost reasons, many time it is preferred an iterative way to solve the system, whos aim is to approach the exact solution for \textbf{x} via an iterative process. To do it an initial guess for the solution $\textbf{x}^{(0)}$ is required:
\begin{equation} \textbf{x}^{(k+1)} = [M]^{-1}([N]\textbf{x}^{(k)} + \textbf{b}) \ \ \ , \ \ \ where \ \ [A] = [M] - [N]. \end{equation} Examples of very useful iterative methods for linear system are the Gauss-Seidel method and the Jacobi one. In the latter case [M] is represented by the lower triangular elements of [A] and [N] by the strictly upper triangular ones, changed of signs. In the Jacobi method [M] is formed with the diagonal elements of [A] and [N] is the rest of the system matrix, once again changed of sign. Sometimes, for more quickly solving a system, can be useful to find a factorization for the system matrix. In this case it is very common to use LU, QR or Cholesky factorizations.
Many times, in order to study the behaviour of a system, it is important to solve the associated eigenvalues-eigenvectors problem:
\begin{equation} [A]\textbf{x} = \lambda \textbf{x}. \end{equation} This could also be a suitable way to understand the stability of a numerical scheme whether the linear system comes from a discretization of a PDE or a system of PDEs.

The relevant Matlab codes can be downloaded using the following link:
Matlab Codes Bank

1 comment:

  1. Hello, the equations appear as Latex code, i.e.
    \begin{equation} \left\lbrace{ \begin{aligned} & .....

    I have tested with Chrome and IE, same issue. Any solution?

    ReplyDelete