2.4 Numerical Methods
2.4.1 Linear Algebra
Understanding linear algebra theory and operations is important when trying to learn and apply different numerical methods to solve the discretized transport equations in CFD. The objective of this section is to introduce the basic linear algebra concepts that will be used throughout section 2.4 to describe various iterative techniques.
Matrices and vectors form the foundation of linear algebra. A vector can be defined as a one-dimensional sequence of elements. An important operation with vectors is known as the dot product, or the Euclidean inner product. If ๐ and ๐ are vectors of the real coordinate space of ๐-dimensions (โ๐), then the dot product is commonly denoted as ๐ ยท ๐
or (๐, ๐), and can be calculated as:
๐ ยท ๐ or (๐, ๐) = โ๐๐=1๐ฅ๐๐ฆ๐ = ๐ฅ1๐ฆ1+ ๐ฅ2๐ฆ2 + โฏ + ๐ฅ๐๐ฆ๐. (2.23) By this definition, the dot product of a vector with itself can be expressed as:
๐ ยท ๐ = โ๐๐=1๐ฅ๐2 = ๐ฅ12 + ๐ฅ22 + โฏ + ๐ฅ๐2 (2.24) which is also equal to the length of the vector squared. Furthermore, the square root can be taken to obtain the vector length or Euclidean norm:
โ๐โ = โ๐ ยท ๐ = โ๐ฅ12+ ๐ฅ
The Euclidean norm is also referred to as the ๐๐-norm of a vector.
A vector space contains a set ๐ of vectors that can be added together or multiplied by a scalar. For all vectors ๐, ๐, and ๐ in ๐, the vector addition operation must adhere to the following axioms:
1. Closure: ๐ + ๐ also belongs to ๐
2. Communicative Law: ๐ + ๐ = ๐ + ๐
3. Associative Law: ๐ + (๐ + ๐) = (๐ + ๐) + ๐
4. Additive Identity: There is a zero vector ๐ in ๐ such that ๐ + ๐ = ๐ and ๐ + ๐ = ๐
5. Additive Inverses: For each vector ๐ in ๐, there is an additive inverse denoted โ๐ such that ๐ + (โ๐) = ๐
Furthermore, multiplication of vectors with scalars ๐ and ๐ must satisfy these axioms:
6. Closure: ๐ ยท ๐ also belongs to ๐
7. Distributive Law: ๐ ยท (๐ + ๐) = ๐ ยท ๐ + ๐ ยท ๐ 8. Distributive Law: (๐ + ๐) ยท ๐ = ๐ ยท ๐ + ๐ ยท ๐ 9. Associative Law: ๐ ยท (๐ ยท ๐) = (๐๐) ยท ๐
10. Unitary Law: 1 ยท ๐ = ๐
A subset is a set of vectors from a vector space that do not need to follow any conditions. A subspace on the other hand is a set of vectors from a vector space that do need to adhere to certain conditions. A subspace is always a subset, but a subset is not necessarily a subspace. If ๐ is a subset of ๐, then ๐ is also a subspace of ๐ if:
2. If ๐ and ๐ are in ๐, then ๐ + ๐ is also in ๐.
3. If ๐ is a vector in ๐, and ๐ is any real number, then ๐ ยท ๐ is also in ๐.
Overall, a subspace can be thought of as a vector space contained within another vector space.
A set of vectors is said to be linearly independent when none of the vectors can be defined as a linear combination of the others. Given vector space ๐, a basis is a subset of ๐ that contains a set of linearly independent vectors of ๐. A vector space can have various sets of basis vectors, but each must have the same number of elements which is known as the dimension of the vector space. In general, a vector space can be thought of as a linear combination of the basis vectors.
The set of all linear combinations of a vector set ๐๐, ๐๐, โฆ , ๐๐ is known as the span of the vectors, denoted ๐ ๐๐๐{๐๐, ๐๐, โฆ , ๐๐}. For a subset ๐ of vector space ๐, ๐ ๐๐๐{๐} is a subspace of ๐.
A matrix is defined as a rectangular array of elements arranged into rows and columns. Matrices can be denoted with a capital ๐จ and subscripts ๐๐, where ๐ represents the row number, and j represents the column number. If matrix ๐จ๐๐ is an ๐ ร ๐ matrix, then:
๐จ๐๐ = (
๐11 โฏ ๐1๐
โฎ โฑ โฎ
๐๐1 โฏ ๐๐๐) (2.26)
where ๐ is each element of the matrix. When the number of rows is equal to the number of columns, it is called a square matrix, which can be denoted by ๐จ๐๐.
Matrices can be defined by their structure in several ways, which can be useful for computational purposes. The elements of a diagonal matrix are 0 when ๐ โ ๐. These matrices can be represented as ๐จ = ๐๐๐๐(๐ ). For an upper triangular matrix,
๐๐๐ = 0 below the matrix diagonal, or in other words when ๐ > ๐ using the notation in Equation (2.26). In opposition, ๐๐๐ = 0 above the matrix diagonal (๐ < ๐) for a lower
triangular matrix. A block diagonal matrix is a generalization for a diagonal matrix. It
replaces each diagonal element with a smaller matrix, and is represented as ๐จ = ๐๐๐๐(๐จ11, ๐จ22, โฆ , ๐จ๐๐).
The Navier-Stokes equations are typically discretized in a way to form tridiagonal
matrices (1-D problems), pentadiagonal matrices (2-D problems), and septadiagonal matrices (3-D problems). These types of matrices can be defined as:
๏ท Tridiagonal Matrix (1-D problem) o ๐๐๐ = 0 for ๐ โ ๐ or |๐ โ ๐| > 1
๏ท Pentadiagonal Matrix (2-D problem with an ๐ ร ๐ mesh) o ๐๐๐ = 0 for ๐ โ ๐ or |๐ โ ๐| โ 1 or |๐ โ ๐| โ ๐
๏ท Septadiagonal Matrix (3-D problem with an ๐ ร ๐ ร ๐ mesh) o ๐๐๐ = 0 for ๐ โ ๐ or |๐ โ ๐| โ 1 or |๐ โ ๐| โ ๐ or |๐ โ ๐| โ ๐ ร ๐ All three of these matrix types can be considered diagonally dominant matrices.
Matrix multiplication involves the dot product of rows of one matrix with columns
of a second matrix. If ๐จ is a 2 ร 3 matrix, and ๐ฉ is a 3 ร 2 matrix, these two can be multiplied to yield a 2 ร 2 product vector ๐ช. The first step is to take the dot product between the first row of ๐จ and the first column of ๐ฉ and place it into the product matrix at ๐ช11. Furthermore,
the dot product of the second row of ๐จ and the first column of ๐ฉ can be placed into ๐ช21, and so on. An example solution to matrix multiplication is shown in Figure 2-5.
๐ฉ = ( 1 2 1 4 5 2 ) ๐จ = (1 0 โ4 3 4 0 ) ๐ช = ( โ19 โ6 7 22)
Figure 2-5: Multiplication of matrix ๐จ (2 ร 3) with matrix ๐ฉ (3 ร 2) to get matrix C (2 ร 2).
In iterative methods, multiplication of a matrix by a vector is very common. This operation can be explained the same way as matrix-matrix multiplication, except one of the matrices has dimensions of (๐ ร 1) or (1 ร ๐), and the solution is a vector.
An important concept pertaining to matrices is an identity matrix (๐ฐ), where the diagonal entries are equal to 1 and all other entries are equal to 0. Furthermore, the
inverse of a matrix (๐จโ1) is a similar idea to finding the reciprocal of a number. Putting
these two concepts together, the inverse of matrix ๐จ has to satisfy:
๐จ ร ๐จโ1= ๐จโ1ร ๐จ = ๐ฐ. (2.27)
A matrix is considered nonsingular if and only if it can admit an inverse. The transpose of a matrix ๐จ๐๐ can be expressed by:
๐จ๐๐๐ = ๐จ๐๐ (2.28)
where the rows of ๐จ๐๐ are the columns of ๐จ๐๐๐. A symmetric matrix is a special case where
the transpose of a matrix is equivalent to the original matrix. When a linear system consists of a symmetric matrix, it can be solved using different iterative techniques than one with a non-symmetric matrix.
The norm of a matrix can be defined in many different ways, similar to a vector norm. If ๐จ is a matrix with ๐ rows and ๐ columns, then the Euclidean norm of the matrix (๐2-
norm) is:
โ๐จโ2 = โโ๐๐=1โ๐๐=1|๐๐๐|2. (2.29)