Milestone 05
Lid-driven cavity
Learning goals
The student will…
- …be able to implement bounce-back (no-slip) boundary conditions.
- …be able to implement a moving-wall boundary condition.
- …validate a flow simulation against published benchmark data.
- …measure and report the performance of their solver.
Introduction
In the previous milestone you implemented a system with periodic boundary conditions. Now we disable periodicity and instead introduce hard walls.
Boundary conditions
Imagine that we are given a quadratic box with a sliding lid, as shown in Fig. Figure 1. Use equilibrium initial conditions for the discrete Boltzmann transport equations. Choose the initial values of \(\rho(0)=1.0\) and \(\mathbf{u}(0)=0\) at time \(t=0\).
Suppose the 2D quadratic box has a lid, the top boundary drawn in red (see Fig. Figure 1). This lid moves with a prescribed velocity \(v\) in the positive \(x\)-direction (i.e. to the right).
Tasks
- Apply bounce-back boundary conditions (see boundary conditions) on the black (stationary) boundaries and the moving wall boundary conditions on the red wall. Bounce-back introduces a no-slip condition at the wall, with the physical wall located halfway between boundary and first interior node.
- Calculate the velocity field in the steady state. Run the simulation until the velocity field no longer changes significantly between time steps (e.g. until the maximum change in velocity between successive steps falls below a chosen threshold such as \(10^{-6}\)).
- Visualize the steady-state flow field using velocity vectors or streamlines.
- Measure and report the performance of your solver in MLUPS (million lattice updates per second), i.e. the number of lattice nodes updated per second divided by \(10^6\). See the benchmarking notes for how to time your code properly. You will use these numbers again in milestone 6 as the single-process baseline.
Suggested parameters
The simulation is controlled by the grid size, the lid velocity and the relaxation parameter. A reasonable starting point:
- Grid: \(128\times 128\) to \(300\times 300\) lattice points.
- Lid velocity: \(u_\text{lid} = 0.1\) (in lattice units). Keep the Mach number low: the lattice Boltzmann method is only valid for \(u_\text{lid} \ll c_s = 1/\sqrt{3} \approx 0.577\).
- Relaxation parameter: \(\omega\) in a stable range, e.g. \(\omega = 1.7\).
The flow is characterized by the Reynolds number \[ \mathrm{Re} = \frac{u_\text{lid}\, L}{\nu}, \tag{1}\] where \(L\) is the box size (in lattice points) and \(\nu = \frac{1}{3}(1/\omega - 1/2)\) is the kinematic viscosity. Aim for \(\mathrm{Re} \approx 100\)–\(1000\). Two simulations with the same Reynolds number produce the same (dimensionless) flow field, even if grid size, lid velocity and viscosity differ individually.
The simulation becomes unstable when \(\omega\) approaches \(2\) (vanishing viscosity) and the lid velocity is large: the combination of large \(\omega\) and large \(u_\text{lid}\) leads to a high Reynolds number that the grid can no longer resolve, and the populations blow up (you will typically see NaNs or a checkerboard pattern). If this happens, reduce \(u_\text{lid}\) or \(\omega\) (or increase the grid resolution).
Validation
In the steady state you should observe a single primary vortex that fills the cavity, with its center slightly off-center towards the lid (and, at moderate Reynolds numbers, shifted towards the downstream/right side). At higher Reynolds numbers, secondary counter-rotating vortices appear in the bottom corners of the cavity.
Figure 2 shows the expected flow field. For a quantitative validation, compare the centerline velocity profile \(u_x(y)\) along the vertical line through the cavity center (\(x = L/2\)) with the classical benchmark data of Ghia, Ghia & Shin, High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method, J. Comput. Phys. 48, 387–411 (1982), which tabulates these profiles for \(\mathrm{Re} = 100\) to \(10000\). Your profile (at matching Reynolds number) should agree with the tabulated values within a few percent.