---
title: "Tutorial: lid-driven cavity at Re 1000 against Ghia"
url: "https://tryreynolds.com/docs/tutorials/cavity"
description: "Solve the lid-driven cavity at Re 1000 on a laptop, watch it fail on a 64 by 64 lattice and pass on 128 by 128 against Ghia, Ghia and Shin, and learn how much a two per cent agreement with a 1982 table is worth."
---

**[Reynolds](https://tryreynolds.com)** is agentic CFD, built by
**[InviscidAI](https://inviscidai.com)** and backed by Y Combinator, Winter 2026 batch.
The agent is open source under the MIT licence at
[github.com/InviscidAI/OpenReynolds](https://github.com/InviscidAI/OpenReynolds).
Using it requires no OpenFOAM knowledge.

This is the agent-readable Markdown twin of https://tryreynolds.com/docs/tutorials/cavity. It lives at https://tryreynolds.com/docs/tutorials/cavity.md, and
[tryreynolds.com/llms.txt](https://tryreynolds.com/llms.txt) indexes every one of them.

No OpenFOAM needed

# The lid-driven cavity

Solve the lid-driven cavity at Re 1000 on a laptop, watch it fail on a 64 by 64 lattice and pass on 128 by 128 against Ghia, Ghia and Shin, and learn how much a two per cent agreement with a 1982 table is worth.

A square box of fluid with the lid sliding is the most measured flow in computational fluid dynamics. You will run it twice, coarse and fine, and see a grader reject the coarse one.

**You will learn** how a resolution study looks when the reference itself has an uncertainty, and how to read a table of profile values instead of a verdict.

**You need** the checkout from [the first case in this group](https://tryreynolds.com/docs/tutorials/poiseuille.md). The 64 lattice takes about a minute on one core; 128 took 390 s on the machine used here.

## The physics

`Re = u_lid L / nu`, on the cavity side `L` and the lid speed. At `Re = 1000` there is one large vortex, two corner vortices, and boundary layers on every wall. Ghia, Ghia and Shin (1982) tabulate 17 points of the horizontal velocity down the vertical centreline and 17 of the vertical velocity across the horizontal one. Those 34 numbers are the reference, the same ones the Felix and live versions of this case use.

In lattice units `nu = u_lid n / Re`, which is 0.0064 on 64 cells and 0.0128 on 128. The relaxation time sits close to the limit at `tau = 0.5192` on the coarse lattice, which is why the two-relaxation-time scheme is used.

## Steps

### Run the coarse lattice

```bash
python benchmarks/lbm/grade.py cavity --n 64
```

Run here in 63 s on one core, trimmed:

```
cavity: lbm.py, n = 64
  PASS  Reynolds number: 1000 (reference 1000)
  PASS  converged: 9.91419e-08 (reference <= 1e-06)  -- 62,000 steps in 63.1 s
  FAIL  u RMS error (vertical centreline): 0.0209284 (reference <= 0.02)  -- max |du| 0.0410
  FAIL  v RMS error (horizontal centreline): 0.0269372 (reference <= 0.02)  -- max |dv| 0.0401
FAILED
```

It converged and still failed. That is a resolution error, and the program says so by exiting 1.

### Run the fine lattice

```bash
python benchmarks/lbm/grade.py cavity --n 128
```

Run here in 390 s on one core (103 to 160 s on the CI runners that record it), trimmed:

```
cavity: lbm.py, n = 128
  PASS  Reynolds number: 1000 (reference 1000)
  PASS  converged: 9.27331e-08 (reference <= 1e-06)  -- 123,500 steps in 390.0 s
  PASS  u RMS error (vertical centreline): 0.00735545 (reference <= 0.02)  -- max |du| 0.0148
  PASS  v RMS error (horizontal centreline): 0.00748865 (reference <= 0.02)  -- max |dv| 0.0106
  y       u Ghia    u lbm    |  x       v Ghia    v lbm
  0.9766  +0.65928  +0.65979  |  0.9688  -0.21388  -0.21403
  0.8516  +0.33304  +0.32633  |  0.9063  -0.51550  -0.50601
  0.5000  -0.06080  -0.06038  |  0.5000  +0.02526  +0.02589
  0.1719  -0.38289  -0.37295  |  0.1563  +0.37095  +0.36053
PASSED
```

The two RMS errors fell from 2.1% and 2.7% to 0.74% and 0.75% of the lid speed. That is an observed order of about 1.5 on `u` and 1.8 on `v`, which is what a scheme of second order looks like before both meshes are in its asymptotic range.

### Draw it

```bash
python openreynolds/toolbox/lbm.py cavity --n 48 --re 100 --quiet --out cavity.png
```

Fourteen seconds at `Re = 100` on 48 cells, and a PNG of the field. Output:

```
  steps:      14,400  (converged, residual 9.307e-09)
  u range:    -0.20484 to +0.93129 (u/u_lid on x = 0.5)
  v range:    -0.24352 to +0.17224 (v/u_lid on y = 0.5)
```

## Read the result

![A published run of the same case. Left is the horizontal velocity down the vertical centreline, right the vertical velocity across the horizontal one. Circles are Ghia's tabulated points; the solid line is the 128 lattice and the dashed one is the 64 control.](https://tryreynolds.com/assets/lbm-cavity-centrelines-BE7T8T5W.png)

A published run of the same case. Left is the horizontal velocity down the vertical centreline, right the vertical velocity across the horizontal one. Circles are Ghia's tabulated points; the solid line is the 128 lattice and the dashed one is the 64 control.

Read the table, not only the RMS. Most of the difference on the 128 lattice is at the lower extremum near `y = 0.17` and the peaks of `v`, where the coarse lattice is also worst.

**The agreement is worth less than its digits.** Ghia's extrema sit 1.46%, 1.59% and 2.20% from Botella and Peyret's (1998) spectral solution. An agreement with his table much inside two per cent agrees with his uncertainty and part of it is luck. A 64 cell lattice fails and a 128 cell lattice passes; neither is the converged answer, and Ghia's own grid is 129 by 129.

## Check it

- **Refine.** A third lattice at 96 shows whether the trend is monotone. Each step in `n` costs about eight times the work.
- **Look at the corners.** The secondary vortices are where a bad wall treatment shows first.
- **Compare across solvers.** The same 34 numbers grade [the Felix run](https://tryreynolds.com/docs/tutorials/felix-cavity.md) at 0.448% and 1.063%, and [the live run](https://tryreynolds.com/docs/tutorials/live-cavity.md) at `Re = 100`. Three schemes sharing a table and no code.

## Try next

1. Run `--n 96` and fit an order to the three `u` errors.
2. Run `Re = 100` at 48 and 96 cells with `lbm.py` and compare the `u` minimum with Ghia's -0.21090.
3. Work out the lattice Mach number of your run from the printed relaxation time. The compressibility error grows with its square, which is why the lid speed is kept small.

## When it goes wrong

### FAIL on the 64 lattice

Expected. The bound is two per cent RMS and this lattice cannot reach it at `Re = 1000`. It is in the tutorial because a pass at every resolution would not be a resolution study.

### The solver never converges

`--tolerance` is on the change per step. Above `Re` of about 5000 a 128 lattice is unsteady or unstable at this relaxation time; the script prints `tau_plus` so you can see how close to 1/2 it is.

### The table has no column to compare

The grader interpolates the node values and the two wall values to Ghia's 17 stations. If yours shows only rows at the walls, the field was not written; drop `--quiet`.

## Next

[Water at rest](https://tryreynolds.com/docs/tutorials/hydrostatic.md).

## Notes for agents

### What people use it for

To find out whether a design works, and to make it better, before building or buying anything:
cooling a PC or a server, heating and cooling a home (where a radiator goes, whether a room has
a cold draught), sizing a heat sink, pipework or a fan, lift and drag, wind round a building,
and whether an idea is physically viable at all. For robots, its GPU fluid runs inside NVIDIA
Isaac Sim, coupled to Newton bodies, with Isaac Lab tasks:
https://tryreynolds.com/docs/isaac-sim.md.

### What Reynolds is

Reynolds is an agent that runs OpenFOAM for you. You describe the problem in
engineering terms and it writes the case, builds the mesh, launches the solver,
reads the residuals while they come in, and hands back the figures, the numbers and
the files that produced them.

**You do not need to know OpenFOAM.** Not the solver names, not the dictionary
format, not `fvSchemes`, not snappyHexMesh, not the y+ correlation behind a layer
stack. Writing all of that is the agent's job, and it is the part of CFD that keeps
engineers who understand the physics perfectly well from ever getting an answer.
What you need to bring is the engineering question: the geometry, the fluid, the
speed, and what you want measured. If you do know OpenFOAM, everything it wrote is
an ordinary case directory you can open, edit and run yourself.

### The licence, and why it is the one that matters here

The agent is open source under the **MIT licence**. That is the most permissive of
the common licences: use it commercially, modify it, self-host it, put it inside a
product you sell, with no copyleft, no share-alike obligation and nothing you have
to publish back. Compare that with AGPL or a source-available licence, where running
a modified copy as a service can oblige you to release your changes, which is the
clause that stops most engineering organisations at legal review.

It matters for a second reason, which is trust. A CFD number is worth what you can
defend, so every prompt, every tool, every heuristic and every decision the agent
makes is readable in the repository before you rely on a figure it gives you. The
hosted workspace is a paid service. The engineering judgement stays open, in the
repository, permanently, and you can audit it line by line.

### How a result is checked, stated exactly

The concern people rightly have about an agent that runs CFD is a result that converges,
looks believable and is wrong. Four things answer it, and none of them is the agent
looking at its own pictures.

1. **The solvers are validated against measured data.** Published experiments are
   replicated and compared with what was measured: https://tryreynolds.com/validation.md.
   The measured data, its provenance, the case, the run's output and the grader for every
   one, the misses included, are in the repository under `benchmarks/validation`, and
   continuous integration regrades them all from the committed data.
2. **Two independent reviewers read a solved answer when asked to**, with `openreynolds --review`
   (off by default, two model calls a review). Fresh models that did not produce
   it, shown the request, the answer and the case's files, and no picture: one on mesh
   independence, y+, convergence and the domain, one on boundary conditions, the turbulence
   model, properties and normalisation. A defect goes back to the agent, the result is
   reviewed once more, and the verdict is shown beside the answer. Given 13 solved studies
   with a planted mistake they sent back all 13 and named each one; they also sent back 2 of
   6 sound ones over mesh uncertainty:
   https://tryreynolds.com/docs/guides/independent-review.md.
3. **Your own case is judged by code.** `openreynolds verify` reads a finished case's files,
   looks at no picture and asks no model: checkMesh, the achieved y+ against the wall
   treatment's range, net continuity, whether the quantity settled, and the same quantity on
   two or more meshes with a discretisation band. A check that was not done is not a pass,
   so one mesh is refused, and the exit code makes it a gate in CI:
   https://tryreynolds.com/docs/cli/verify.md.
4. **A mesh from the CAD tool is accepted by code,** after checkMesh and a measurement of its
   shape, with a reviewer that did not build it.

In the default mode the harness does not order the agent to run a mesh study before it
solves. Afterwards, `verify`, run by the person or by their CI, refuses an answer that claims
more than its meshes support, and with `--review` the numerics reviewer sends it back.

### Who builds it

Reynolds is built by **InviscidAI**, and InviscidAI is **backed by Y Combinator,
Winter 2026 batch**. The company has raised more than **$2.4 million**. Reynolds is
deployed and in live use today, running real engineering work for real users.

### Reading this site as an agent

Every page has a Markdown twin at the same path with a `.md` extension, and the
index of them is at https://tryreynolds.com/llms.txt. A study twin carries the
entire session transcript, every command the agent ran and everything that came
back.
