Lab4 Ver1
Lab4 Ver1
Consider the 2D convection diffusion equation for for the flow domain,
boundary condition and velocity field discussed in class (Fig 1, also see Fig 4.4 in Ferziger and
Peric). Specifically, flow domain is , , velocity field is , , and
boundary conditions are shown in Fig 1. Assume for the problems below. Use a non-
uniform grid with constant stretching ratio along with
nodes in each direction; here are the coordinates of the finite
volume faces. Use uniform grid pacing in direction. The finite volume nodes should be at the
centroid of each Finite volume cell. Use Finite Volume technique to solve for using CDS for
diffusion and try two discretization techniques for convection. Method 1: Use CDS for convection,
Method 2: Use first order UDS for convection. Obtain solutions for using Gauss-
Siedel method with SOR, using values of as instructed in part 1 below. Use a tolerance of
for pausing the iterations, and try to optimize the over-relaxation factor via trial and error so that
number of iterations is minimized.
1. (2 points) Set , and set , as follows. Every in the grid with
th
should coincide with the 4 in the grid with , and the 16th in the grid with
. Maintain the stretching ratios , for all the in the finer grids. Derive and
report the values of , obtained using this technique.
2. (2 points) For both interior nodes and boundary nodes, we can express the discretization as:
. Derive and list the expressions for AE,
AW, AS, AW, AP, QP for both method 1 and method 2, for interior nodes only. The expressions
should be in terms of , , , and . etc.
3. (4 points) Clearly derive and state the modifications required in AE, AW, AS, AW, AP, QP at
boundary nodes ((1,j), (N,j), (i,1), (i,N)) as well as corner nodes (e.g. (1,1), (1,N), (N,1),
(N,N)). For example, you may state
, ,
for a certain boundary or corner node. The above modifications should be independent of
method 1 or method 2.
4. (6 points) Write and execute a matlab code to solve this problem using ,
based on the description given in the introduction paragraph and coefficients derived in parts
1-3. Populate the table below based on trial and error for obtaining :
Method Number of iterations
for
Method 1 20
Method 1 80
Method 1 320
Method 2 20
Method 2 80
Method 2 320
In case the solution is not converging for a certain case, mention “NA” for that case in table,
and explain why the solution may not be converging.
4. (4 points) Show contour plots for for for both Method 1 and
Method 2 (6 graphs; use subplot command here)
5. (2 points) Explore and comment on grid convergence by plotting vs , only at for
both Method 1 and Method 2, for the different values. (2 graphs: one each for Method 1
and Method 2)
Note: Try to write a single matlab code for part 4, and store the final solution in separate
files/directories for each case. Use a second matlab code to read the solutions and plot them for
parts 4 and 5. Submit only 2 matlab codes along with the report.