In fluid dynamics, a lid-driven cavity or driven cavity is a closed container of viscous fluid set in motion by one of its walls, the lid, sliding in its own plane. The most frequently modeled two-dimensional case is a square with a lid moving at constant speed over three stationary walls. It is one of the most common benchmarks in computational fluid dynamics because its square geometry is simple, various corner singularities are present, and the velocity is prescribed on every wall. Together, this makes it possible for all kinds of discretization method to simulate the lid-driven cavity and allows for detailed comparison between experiment, theory, and computation.
The sliding lid drives a large primary vortex, with weaker counter-rotating eddies in the lower corners. In steady two-dimensional solutions, the core of the primary vortex approaches solid-body rotation as the Reynolds number increases. The two corners where the lid meets the stationary walls are singular. The velocity on the boundary is discontinuous there, and the pressure and vorticity are unbounded. In two dimensions the flow becomes unsteady through a Hopf bifurcation near Reynolds number 8000 and is chaotic by 22,000. Real cavity flows are three-dimensional, however, with instabilities arising at much lower Reynolds numbers.

The standard problem involves an incompressible Newtonian fluid with constant density and kinematic viscosity filling a square of side . The top wall moves in its own plane at constant speed , and the other three walls are at rest.
Writing dimensional coordinates, time, velocity, and pressure with tildes, the velocity and pressure satisfy the Navier–Stokes equations: where denotes differentiation with respect to the dimensional coordinates. The domain is and . The no-slip and impermeability conditions prescribe and on the lid, , and on the stationary walls, excluding the two upper corner points where the boundary data are discontinuous.
Introducing dimensionless variables, gives the dimensionless equations where is the dimensionless velocity, is the dimensionless pressure, and the Reynolds number is the only dimensionless parameter in the equations.
On the unit square, and , the dimensionless boundary conditions are and on the lid, , and on the stationary walls, with the same discontinuities at the two upper corners. In the following equations, coordinates, time, and flow variables are dimensionless unless marked with tildes; , , , and remain dimensional parameters.
In two dimensions, the dimensionless velocity can be written in terms of a dimensionless stream function : and the dimensionless vorticity has a single component : The dimensional stream function and vorticity are related to these variables by
Taking the curl of the momentum equation eliminates the pressure and gives the vorticity equation The walls are streamlines, so on all four. The normal derivative of vanishes on the stationary walls, and on the lid. Many benchmark solutions use this formulation. With the lid moving in the direction, the primary vortex turns clockwise, and both and are negative at its center.
Kawaguti published the first numerical study in 1961, computing creeping and nonlinear flows at low Reynolds numbers in cavities with depth-to-width ratios of 0.5, 1 and 2. In 1966 Burggraf combined the analysis of a model eddy with numerical solutions for a square cavity. The model showed an inviscid core developing at high Reynolds numbers, as George Batchelor had envisaged. The numerical solutions, presented mainly for Reynolds numbers from 0 to 400, also showed such a core at the higher Reynolds numbers, along with secondary eddies in the bottom corners at all Reynolds numbers. After his study the cavity became a benchmark for Navier–Stokes solvers and a paradigm for vortex dynamics in closed systems. Pan and Acrivos followed in 1967 with work on rectangular cavities, including the stacked eddies of deep cavities and experimental support for the uniform-vorticity core.
In 1982 Ghia, Ghia and Shin used a multigrid method on grids of up to 257 × 257 points to reach Re = 10,000. Botella and Peyret described their paper in 1998 as the most referred-to source of results on the flow. In 1983 Schreiber and Keller combined Newton iteration with Richardson extrapolation and showed that some earlier calculations had produced spurious solutions. Large differences between numerical schemes prompted an experimental program by Koseff and Street, which showed that the real flow is three-dimensional. In 1998 Botella and Peyret reached a new level of accuracy by combining spectral methods with a special treatment of the singular corners.
The following discussion concerns steady two-dimensional solutions. A computed steady solution need not be stable: for example, the steady solution at Re = 10,000 is unstable to two-dimensional perturbations.
In the steady Stokes-flow limit, inertial terms are neglected and the stream function satisfies the biharmonic equation . The streamline pattern is symmetric about the vertical centerline. A single primary vortex fills most of the square and much smaller eddies occupy both bottom corners, each bounded by a streamline. The problem can also be solved by series expansions in eigenfunctions of the biharmonic equation.
Inertia destroys the reflectional symmetry about the vertical centerline. At Re = 100 the center of the primary vortex moves a little lower and toward the downstream wall, the one the lid moves toward. By Re = 400 it is even lower and back toward the centerline, and as the Reynolds number increases further it moves toward the geometric center of the square. In the steady solutions computed by Erturk et al., the primary vortex's location changes little above Re = 17,500. Their Richardson-extrapolated results show the magnitude of at the vortex center increasing up to about Re = 10,000 and then decreasing slowly.
The corner eddies grow as well. With the lid moving to the right, they are labelled BL (bottom left, upstream), BR (bottom right, downstream) and TL (top left), with the subscripts on BL and BR counting along each sequence toward the corner. BR1 grows more than BL1 and becomes stronger. A new eddy, TL1, appears next to the upstream wall just below the lid, at about Re = 1200. This is a genuine change in the flow's topology. Being attached to a plane wall, it differs in character from the eddies in the bottom corners.
Resolving the smaller corner eddies requires fine spatial resolution. Spectral calculations at Re = 1000 resolve a second eddy in each bottom corner. On a 601 × 601 grid, Erturk et al. resolved BR3 at Re = 5000, BL3 at Re = 10,000, and TL2 at Re = 12,500. With a finer 1025 × 1025 grid, Erturk resolved BL3 at Re = 7500, illustrating the sensitivity of the smallest resolved eddies to grid resolution.
In steady two-dimensional solutions at large Reynolds numbers, thin boundary layers form along the walls around a core in nearly inviscid motion. The Prandtl–Batchelor theorem implies that the vorticity becomes uniform within a region of closed streamlines in the inviscid limit of such a steady flow. In the square cavity, the computed core approaches solid-body rotation with nearly circular streamlines, and the velocity profiles along the centerlines become approximately linear across it. The surrounding boundary layers determine the value of the core vorticity.
The local flows near the corners of the cavity correspond to two classical problems of theoretical fluid dynamics: Taylor scraping flow at the two upper corners, and Moffatt eddies at both bottom corners.

At the two top corners the dimensional boundary velocity jumps between its value on the lid and zero on the side wall. Close to such a corner viscous forces dominate, and the flow approaches Taylor scraping flow, the Stokes flow in a corner where one plane slides over another. In dimensional polar coordinates centered on the corner, the stream function of this local Stokes flow is where is the dimensional distance from the corner and depends only on the angle. With and , the dimensionless form is The velocity therefore does not depend on , so it has no single value at the corner. The vorticity and pressure diverge there. The solution holds for , or equivalently , and higher-order terms depend on the Reynolds number.
A discontinuous velocity is physically unrealistic. In an experiment a gap between the lid and the side wall is hard to prevent, and it causes pumping and leakage. In a liquid-filled cavity, the low pressure near the corner where the lid moves away from the wall can cause cavitation. Even so, Stokes flow studies that treat the corners in detail found that the effects were confined to their neighborhood, and the singularity plays only a minor role in the overall flow. The singularity also does not prevent a numerical solution from converging in the rest of the domain. Hansen and Kelmanson gave a justification of the idealized boundary conditions in 1994.

At the bottom corners both walls are at rest. For steady two-dimensional flow driven by motion away from the corner, Keith Moffatt showed in 1964 that the local viscous solution between stationary no-slip walls contains an infinite sequence of increasingly small and weak counter-rotating eddies when the angle between the walls is below about 146°. These are now known as Moffatt eddies. In a right angle, each eddy is about 16 times smaller than the last, and its velocities are about 2000 times weaker. With again denoting distance from the corner divided by , the dimensionless stream function near these corners behaves like where and are about 3.73 and 1.12, and and are bounded trigonometric functions. This singularity is much weaker than the one at the lid, because only the second derivatives of the pressure and vorticity are unbounded.
The singularities at the boundaries harm the convergence and accuracy of any numerical solution. Spectral methods are especially affected, because their usual rate of convergence is lost and the error spreads across the whole domain. Grid refinement also behaves differently for different quantities. The kinetic energy converges, but the enstrophy and palinstrophy grow without limit as the mesh size goes to zero.
Many calculations ignore the singularities, on the grounds that their effect is local. Others use the known asymptotic form of the solution. In the subtraction method, the leading singular terms are removed analytically and a less singular remainder is computed, which significantly improves grid convergence. Botella and Peyret used singularity subtraction to obtain benchmark solutions, and Auteri et al. used it to investigate the stability of the flow.
A different approach, regularization, changes the problem itself. The uniform lid speed is replaced by a smooth profile that vanishes at the corners, along with its derivative, such as the dimensionless profile . The enstrophy and palinstrophy then converge. Shankar and Deshpande called this "the evasion of a genuine issue", since an experiment would normally involve a uniformly moving lid. As of 2019, there is a lack of rigorous assessments of how regularization affects flow properties such as stability boundaries.
Several features make the cavity a convenient test. The geometry needs no complicated meshing, and it is well suited to regular square grids. The velocity is prescribed through Dirichlet boundary conditions on every wall, and there are no inflow or outflow boundaries. The domain stays the same as the Reynolds number increases. Thin shear layers, weak corner eddies, and the singular corners nevertheless make accurate solutions demanding.
The problem has been solved with finite difference, finite volume, finite element, spectral, and lattice Boltzmann methods, in stream-function and primitive-variable formulations. Molecular dynamics and smoothed-particle hydrodynamics have also been used to compute the flow, and Monte Carlo methods have been applied to micro-cavity flows. Textbooks use it to teach and test numerical methods: Kundu et al. give codes for it, and Ferziger and Perić use it at Re = 1000 to compare grids and discretization schemes.
Results are usually compared through the extreme velocities along the two centerlines. Papers also tabulate the velocities along those lines, the vorticity along the lid, the stream function and vorticity at the vortex centers. The stream function at the primary vortex center appears to be a reliable indicator of accuracy, whereas the location of the center is limited by the mesh size and the vorticity there is sensitive to the wall boundary conditions. Global quantities such as the kinetic energy can be compared as well, although the enstrophy and palinstrophy do not converge under grid refinement.

In their 2005 comparison of published steady solutions, Erturk et al. found close agreement at Re = 1000 but noticeable discrepancies at higher Reynolds numbers. Grid requirements are severe. Schreiber and Keller showed that mild grid refinement can appear to converge to what is really a spurious solution. Erturk et al. considered even a 401 × 401 grid under-resolved at Re = 1000 for a second-order scheme.
It is well established that the flow, if restricted to two dimensions, becomes time-dependent through a Hopf bifurcation near Re = 8000. Early work on the square cavity overlooked this, and for a long time it was unclear whether the steady solutions reported at Re = 10,000 were stable.
Published values of the critical Reynolds number for the square cavity are scattered, because the thin boundary layers must be modeled very accurately. Linear stability analyses by Poliashenko and Aidun in 1995 and by Fortin et al. in 1997 gave 7763 ± 2% and 7998.5 respectively. In 2002 Auteri et al. located the bifurcation between 8017.6 and 8018.8 by bisection, using direct simulations with a spectral method and singularity subtraction, and attributed the difference from Fortin et al. to that study's lack of an adequate treatment of the corners. Bruneau and Saad's range of 8000 to 8050, from 2006, is consistent with this, and Nuriev et al. obtained 8051 in 2016 by extrapolating linear stability results from grids of up to 512 × 512. Coarse grids can be far off though. Peng et al. found about 7400 on a 100 × 100 grid, a low value that Kuhlmann and Romanò attribute to the low resolution.
Just above the critical Reynolds number the flow settles into a periodic oscillation. The velocity, pressure, and vorticity throughout the cavity vary with a frequency of about 0.45 in units of , a period of about 2.2 . It has the form of a vortex street that travels around the primary vortex in the thin shear layer that separates it from the secondary eddies and seems to arise from the loss of stability of that layer. Transients decay increasingly slowly as the critical Reynolds number is approached from below. The leading Lyapunov exponents correspond to perturbation decay times of about 13 at Re = 1000 and 380 at Re = 8000, where a decay time is the time required for the perturbation amplitude to decrease by a factor of e. Just above the threshold, simulations can also require long integration times to approach the periodic state.
Studies have reported additional frequencies near Re = 10,000, a succession of Hopf bifurcations, and quasi-periodic and subharmonic flows with hysteresis. In their 2019 review, Kuhlmann and Romanò found that disagreement among the reported frequencies prevented a definitive account of the subsequent transitions. By Re = 22,000 the flow is chaotic. At Re = 100,000, simulations started from different initial conditions evolve to the same statistical state, which is evidence for a chaotic attractor.
Genuinely two-dimensional cavity flow cannot be realized experimentally with such flows having been called "almost fictitious".
Koseff and Street studied a cavity of equal depth and width, with a span three times its width, at Reynolds numbers from 1000 to 10,000. They measured the flow in a laboratory cavity and compared the results with other researchers' two-dimensional simulations. The lid was "a thermally conductive copper belt, supported on and driven by two rollers". The time-averaged flow on the central plane had one main circulation cell and three secondary eddies. The end walls weakened the flow compared with the two-dimensional case, and vortices formed in the corners along them. Longitudinal Taylor–Görtler-like vortices formed near the downstream secondary eddy. Mean velocity profiles from two-dimensional simulations differed significantly from those velocity profiles measured on the symmetry plane. The flow near the downstream eddy was unsteady at higher Reynolds numbers, and it showed some turbulent characteristics at Re = 10,000 but not at 3200.
End walls are not needed for the flow to become three-dimensional. For a cavity with a square cross-section and infinite span, linear stability analysis predicts a stationary three-dimensional instability at . Experiments in a cavity with a span 10.88 times its width found Taylor–Görtler vortices at Re = 791 ± 15. This threshold is about ten times lower than that of the two-dimensional Hopf bifurcation, which therefore cannot be observed experimentally.
When the span is comparable with the width, the secondary flow induced by the end walls makes the flow three-dimensional at any Reynolds number. The flow in a cube becomes time-dependent through a subcritical bifurcation at .
The depth of the cavity changes the pattern of vortices. In Stokes flow, there is one primary vortex when the depth is at most equal to the width, two when the depth is twice the width, and four when it is five times the width. New primary vortices form by the growth and merger of the corner eddies. In an infinitely deep cavity the vortices are spaced about 1.4 widths apart, and the magnitude of decreases by a factor of about 357 from one to the next.
Other variations on the lid-driven cavity exist. With two facing walls moving, the two-dimensional flow can lose its uniqueness. Other cavity shapes besides square have also been studied: these include triangular, trapezoidal, circular, and toroidal cavities. Temperature differences between the walls can introduce buoyancy effects in addition to the mechanical driving by the lid, producing mixed convection and thermally stratified flows. The lid may oscillate, and time-dependent driving can produce chaotic particle paths even in Stokes flow, which makes the cavity a model for studying chaotic mixing. The fluid is incompressible in the classical lid-driven cavity but extensions include compressible, magnetohydrodynamic, non-Newtonian and viscoelastic flows, suspended particles, and flows through porous media. The shear-driven cavity, open to an outer flow rather than closed by a lid, is a distinct but closely related flow.
The flow has industrial relevance. In the short-dwell coater used to produce high-grade paper and photographic film, the structure of the flow in the liquid pond can strongly affect the quality of the coating. Cavity flows are also relevant to melt spinning, and their eddies give insight into drag-reducing riblets and into cavities for mixing polymer composites. Shankar and Deshpande nevertheless considered the problem's overwhelming importance to lie in the basic study of fluid mechanics, since its unambiguous boundary conditions allow detailed comparison between experiment, theory, and computation.