You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repo is my 3rd assignment submission of the course 11110PME511300 Computational Fluid Dynamics in 2022 Fall, lectured by Prof. Chao-An Lin. I wrote the original report in LaTeX on 2023 Jan 11, and commited the files to GitHub on 2025 Aug 20.
II. Program structure and key files
To run the program, just download the CA3_2022.m file and the MAIN LIBRARY/ folder in the same directory, and you're good to go on MATLAB. Do Not Change The Folder Name, lest the path commands produce error warnings.
the Dirichlet boundary conditions are imposed strongly, $U_{\Gamma^1} = V_{\Gamma^1} = U_{\Gamma^2} = V_{\Gamma^2} = U_{\Gamma^3} = V_{\Gamma^3} = V_{\Gamma^4} = 0$ and $U_{\Gamma^4} = 1$. The Reynolds number is defined as $Re = \rho U_{\Gamma^4}L / \mu$, the lid velocity $U_{\Gamma^4} = 1 m/s$ and the cavity height $L = 1 m$.
Please compute the cavity flows with Reynolds numbers 100, 1000, and 5000.
Please use mesh sizes at least 81x81 and 161x161.
Please also compare your results with the benchmark solutions from Gihia et al. (1982) for u(y) at x=0.5 and v(x) at y=0.5.
Please compare the accuracy of the central difference, QUICK and MUSCL schemes.
IV. Methodology
4.1 Convergence Criterion
Let the correction terms be the velocity at the current time step minus the one in the previous time step.
$$
\begin{align}
% \label{eq:5}
\begin{split}
&u_{corr} = u^{n} - u^{n-1}\\
&v_{corr} = v^{n} - v^{n-1}\\
\end{split}
\end{align}
$$
Define the maximum of infinity norms of two velocities,
$$
\begin{align}
% \label{eq:6}
max({\lVert u_{corr}\rVert_{\infty}, \lVert v_{corr}\rVert_{\infty}})
\end{align}
$$
which is also the largest row sum of A, $max(\sum{\lvert A^{T} \rvert})$, s.t. convergent iff.
$$
\begin{align}
% \label{eq:7} -->
max({\lVert u_{corr}\rVert_{\infty}, \lVert v_{corr}\rVert_{\infty}}) < TOL_{abs} = 10^{-4}U_{\Gamma_{4}}
\end{align}
$$
Given the lid velocity $U_{\Gamma^4} = 1 m/s$, the cavity height $L = 1 m$ and the selection of Reynolds number, considering the incompressible flow $\rho = 1 kg/m^3$, the corresponding viscosity $\mu_{Re}$ is determined by Equation 4: $\mu_{100} = 1 \times 10^{-2}$, $\mu_{1000} = 1 \times 10^{-3}$, $\mu_{5000} = 2 \times 10^{-4}$. Although these equations are seemingly simplified, the coupling of velocity and pressure is yet unresolved. I adopted staggered mesh thusly to circumvent this issue.
Using the central differencing (CD) scheme to demonstrate the derivation of the SIMPLE algorithm. The mass flow rates for x-directional momentum conservation are
The diffusive coefficients are all the same regardless of directions, $D_i = \frac{\mu \delta y_{i}}{\delta x_{i}}$, $i = e,w,n,s$. For homogeneous mesh, $\delta y_{i} = \delta x_{i}$, $i = e,w,n,s$,
where $\psi(r_{i}) = r_{i}$, $i=e,w,n,s$, for CD, and $r_{i} =(\phi_{D} - \phi_{C})/(\phi_{C} - \phi_{U} + \epsilon)$, in which $D$, $C$, $U$ signifies downwind, central, upwind point respectively. $\phi$ is the variable TBD, which is $U$ in x-directional momentum conservation, and $V$ in y-directional momentum conservation.
Notice that the term, $\dot{m_{e}} - \dot{m_{w}} + \dot{m_{n}} - \dot{m_{s}}$, does not satisfy Equation (1), the continuity equation. Therefore, I introduced the Semi-Implicit Method for Pressure Linked Equations (SIMPLE) method to couple the pressure and velocities.
4.3 Introduction of The SIMPLE (Semi-Implicit Method for Pressure Linked Equations) Algorithm
Add the correction terms to Equations (23) and (24) to satisfy Equation (1). By the SIMPLE algorithm, the correction terms are reduced to the corrected pressure term, that are, $(P^\prime_{i,j} - P^\prime_{i-1,j}) \delta y$ term in $U_{P}$ and $(P^\prime_{i,j} - P^\prime_{i,j-1})\delta y$ in $V_{P}$, respectively.
And this is the SIMPLE implementation using central differencing scheme. For other schemes: LUD (Linear Upwind Differencing), QUICK (Quadratic Upstream Interpolation for Convective Kinematics), TVD (Total Variation Diminishing), TVD QUICK, MUSCL (Monotonic Upstream-centered Scheme for Conservation Laws), etc., a slight modification of the $U_i (i=e,w,n,s)$ and $V_i (i=e,w,n,s)$ to their corresponding representation is required. The details can be found in chapter 5 of CFD lecture note by Prof. Chao-An Lin, 2021).
V. Result and discussion
5.1 Result
(a)
(b)
(c)
(d)
(e)
(f)
Figure 3. Results of central differencing scheme: (a) Reynolds number of 100 under grid size of 81, (b) Reynolds number of 1000 under grid size of 81 (c) Reynolds number of 5000 under grid size of 81 (d) Reynolds number of 100 under grid size of 161 (e) Reynolds number of 1000 under grid size of 161 (f) Reynolds number of 5000 under grid size of 161.
(a)
(b)
(c)
(d)
(e)
(f)
Figure 4. Results of Quadratic Upstream Interpolation for Convective Kinematics (QUICK) scheme: (a) Reynolds number of 100 under grid size of 81, (b) Reynolds number of 1000 under grid size of 81 (c) Reynolds number of 5000 under grid size of 81 (d) Reynolds number of 100 under grid size of 161 (e) Reynolds number of 1000 under grid size of 161 (f) Reynolds number of 5000 under grid size of 161.
(a)
(b)
(c)
(d)
(e)
(f)
Figure 5. Results of Monotonic Upstream-centered Scheme for Conservation Laws (MUSCL) scheme: (a) Reynolds number of 100 under grid size of 81, (b) Reynolds number of 1000 under grid size of 81 (c) Reynolds number of 5000 under grid size of 81 (d) Reynolds number of 100 under grid size of 161 (e) Reynolds number of 1000 under grid size of 161 (f) Reynolds number of 5000 under grid size of 161.
5.2 Discussion
From Figures (3), (4), and (5), I drew the centered lines at $x=0.5$ for the x-directional velocity $u(y)$, and at $y=0.5$ for the y-directional velocity $v(x)$ using Microsoft Office Excel. The Ghia1989, $N = 129$ curves are fitted from the sample points.
Notice that the schemes produce similar characteristics at low Reynolds numbers in Fig (6) and (9), but variate at high Reynolds numbers in Fig (8) and (11). The MUSCL and QUICK schemes resemble because of the same ground rock on which they are built, the upwind differencing scheme. While they look similar, the values are slightly different. Choosing the Reynolds number of $5000$ (largest Reynolds number) and grid size of $161$ (finest spatial resolution), the difference in x-directional velocity is seen in the point values of Figure (8)(a) in Table (2); that in y-directional velocity is seen in the point values of Figure (8)(b) in Table (3).
Table 2. First ten values of $u(y)$
y (m)
$u(y)_{CD}$ (m/s)
$u(y)_{MUSCL}$ (m/s)
$u(y)_{QUICK}$ (m/s)
0
0
0
0
0.006172840
0.076742197
0.049134526
0.049183673
0.012345679
0.14049004
0.090517207
0.090604849
0.018518519
0.190035281
0.123695103
0.123809749
0.024691358
0.227110941
0.149204069
0.149335855
0.030864198
0.255237398
0.168315656
0.16845755
0.037037037
0.277773476
0.182590392
0.182738206
0.043209877
0.296858955
0.193486394
0.193638087
0.049382716
0.31339041
0.202128973
0.202283633
0.055555556
0.32749287
0.209261662
0.209418771
Table 3. First ten values of $v(x)$
x (m)
$v(x)_{CD}$ (m/s)
$v(x)_{MUSCL}$ (m/s)
$v(x)_{QUICK}$ (m/s)
0
0
0
0
0.006172840
-0.136405976
-0.094255483
-0.094363291
0.012345679
-0.187299161
-0.135710999
-0.135861958
0.018518519
-0.227580313
-0.169952973
-0.170136119
0.024691358
-0.260391073
-0.196824535
-0.197029379
0.030864198
-0.288312577
-0.217209931
-0.21742801
0.037037037
-0.31248656
-0.232395834
-0.23262089
0.043209877
-0.3329256
-0.243638087
-0.243865661
0.049382716
-0.349175307
-0.25194424
-0.252171117
0.055555556
-0.360808374
-0.258018899
-0.258242631
Overall, despite the deviation in values, the trend displays consistency. To better compare the results, the following figures are drawn.
(a)
(b)
(c)
(d)
(e)
(f)
Figure 6. Results of grid size of 81, compared with benchmark solution in (a) u(y) at x = 0.5 and Re = 100, (b) v(x) at y = 0.5 and Re = 100, (c) u(y) at x = 0.5 and Re = 1000, (d) v(x) at y = 0.5 and Re = 1000, (e) u(y) at x = 0.5 and Re = 5000, (f) v(x) at y = 0.5 and Re = 5000.
(a)
(b)
(c)
(d)
(e)
(f)
Figure 7. Results of grid size of 161, compared with benchmark solution in (a) u(y) at x = 0.5 and Re = 100, (b) v(x) at y = 0.5 and Re = 100, (c) u(y) at x = 0.5 and Re = 1000, (d) v(x) at y = 0.5 and Re = 1000, (e) u(y) at x = 0.5 and Re = 5000, (f) v(x) at y = 0.5 and Re = 5000.
VII. Summary
In this study, the Lid-driven cavity is explored using finite volume analysis. Different schemes (CD, QUICK, and MUSCL) are employed in the SIMPLE algorithm with the benchmark solution (Ghia et al). The four results are similar at low Reynolds numbers, but not at high Reynolds numbers. Despite the deviated values, the trends are consistent regardless of the magnitude of the Reynolds number. And QUICK and MUSCL schemes bear a resemblance in accuracy.