# Lid-driven cavity flow

The lid-driven cavity is a classical fluid dynamics problem for incompressible viscous flow. As shown in Fig. d.1, it consists of a square cavity with three stationary walls and a moving wall which moves at a constant velocity. In this section, we are going to solve the unsteady and steady solutions of the problem and find the velocity and pressure distribution inside the cavity.

Fig. d.1. Lid-driven cavity sketch.

# Governing equations

It is assumed that the flow is Newtonian, 2-dimensional, incompressible and governed by a set of mass and momentum conservation equations as follows:
$$\left\lbrace{\begin{array}{l} \frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} = 0 \\ \ \\ \frac{\partial u}{\partial t} + u \frac{\partial u}{\partial x} + v \frac{\partial u}{\partial y} = -\frac{\partial p}{\partial x} + \frac{1}{\text{Re}} \nabla^2 u \\ \ \\ \frac{\partial v}{\partial t} + u \frac{\partial v}{\partial x} + v \frac{\partial v}{\partial y} = -\frac{\partial p}{\partial y} + \frac{1}{\text{Re}} \nabla^2 v \end{array}}\right.$$ in which $u$ and $v$ are velocities in $x$ and $y$ directions, $\text{Re}$ is Reynolds number, and $p$ is pressure. The system of equations is non-dimensionalized using:
$$u = \frac{\tilde{u}}{U} \ , \ x = \frac{\tilde{x}}{L} \ , \ t = \frac{\tilde{t}U}{L} \ , \ p = \frac{\tilde{p}}{\rho U^2}$$ where $\tilde{u}, \tilde{x}, \tilde{t}$, etc. are the dimensional variables and $L$ is width of the cavity and the reference length.

# Boundary conditions

On all walls, no-slip boundary condition is applied (homogeneous Dirichlet boundary conditions $u = 0$ and $v = 0$) except the moving lid which has the velocity $u$ in $x$-direction (and $v = 0$).

# Solving the problem

In this section, the unsteady problem is going to be solved in two ways (only the first method is accessible at the moment, the second one will be available soon):

(d-1) Stream function-vorticity formulation using collocated grid;
(d-2) Primitive variables (pressure and velocity) using staggered grid