<< Chapter < Page Chapter >> Page >
i = 2 f ( i , j , 1 ) = f ( i , j , 1 ) - b ( i , j , 1 , 1 ) * ψ 1 , j B C f ( i , j , 2 ) = f ( i , j , 2 ) - b ( i , j , 2 , 2 ) * ( 2 * ψ 1 , j B C / δ 2 - 2 * v v B C ( j ) / δ - α v x B C y ) e ( i , j , 2 , 1 ) = e ( i , j , 2 , 1 ) - b ( i , j , 2 , 2 ) * 2 / δ 2

If the boundary condition is that of zero vorticity as on a surface of symmetry, it is necessary to only set to zero the coefficient that multiplies the boundary value of vorticity, i.e.,

i = 2 b ( i , j , 2 , 2 ) = 0 , when w ( 1 , j ) = 0

The linear system of equations and unknowns can be written in matrix form by ordering the equations with the i index changing the fastest, i.e., i = 2 , 3 , … , J M A X - 1 . The linear system of equations can now be expressed in matrix notation as follows.

A x = F where x = u 2 , 2 u 3 , 2 u J M 1 , J M 1 = ψ 2 , 2 w 2 , 2 ψ 3 , 2 w 3 , 2 ψ J M 1 , J M 1 w J M 1 , J M 1

The non-zero coefficients of coefficient matrix A for J M A X = 5 is illustrated below. Since the first and last grid points of each row and column of grid points are boundary conditions, the number of grid with pairs of unknowns is only 3x3. Only one grid point is isolated from boundaries. The i , j location of the coefficients become clearer if a box is drawn to enclose each 2 x 2 coefficient.

Most of the elements of the coefficient matrix are zero. In fact, the coefficient matrix is a block pentadiagonal sparse matrix and only the nonzero coefficients need to be stored and processed for solving the linear system of equations. The non-zero coefficients of the coefficient matrix are stored with the row-indexed sparse storage mode and the linear system of equations is solved by preconditioned biconjugate gradient method (Numerical Recipes, 1992).

The row-indexed sparse matrix mode requires storing the nonzero coefficients in the array, s a ( k ) , and the column number of the coefficient in the coefficient matrix in the array, i j a ( k ) , where k = 1 , 2 , … . The indices that are needed to identify the coefficients are the i , j grid location ( i , j = 2 , 3 , … , J M A X - 1 ) , the m equation and dependent variable identifier ( m = 1 for stream function; = 2 for vorticity), and the I A row index of the coefficient matrix ( I A = 1 , 2 , 3 , 4 , … , 2 ( J M A X - 2 ) 2 ) . The coefficient matrix has two equations for each grid point, the first for the stream function and the second for vorticity. The total number of equations is N N = 2 ( J M A X - 2 ) 2 .

The diagonal elements of the coefficient array are first stored in the s a ( k ) array. The first element of i j a ( k ) , i j a ( 1 ) = N N + 2 and can be used to determine the size of the coefficient matrix. The algorithm then cycles over the pairs of rows in the coefficient matrix while keeping track of the i , j locations of the grid point and cycling over equation m = 1 and 2 . The off-diagonal coefficients are stored in s a ( k ) and the column number in the coefficient matrix stored in i j a ( k ) . As each row is completed, the k index for the next row is stored in the first N N elements of i j a .

A test problem for this code is a square box that has one side sliding as to impart a unit tangential component of velocity along this side. All other walls are stationary. The stream function, vorticity, and velocity contours for this problem with a 20x20 grid is illustrated below.

Stream function contours for square with top side sliding

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Transport phenomena. OpenStax CNX. May 24, 2010 Download for free at http://cnx.org/content/col11205/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Transport phenomena' conversation and receive update notifications?

Ask