Home / Demos / CFD with OpenFOAM

Simulation OpenFOAM v1912 · icoFoam

CFD with OpenFOAM

The agent writes OpenFOAM case directories for plane Poiseuille flow and the lid-driven cavity at Re = 100. The judge copies each case to scratch, meshes and solves it itself, then compares the channel profile with the analytic parabola, checks mesh-refinement convergence, and compares the cavity centreline velocities with the tabulated data of Ghia, Ghia & Shin (1982).

The cavity flow developing over pseudo-time (|U| from a real icoFoam run) beside the gate-2 residual convergence. Made from real judge output, no illustrative data.

Measured

0.0043
Poiseuille L2 error vs analytic
pass line 0.02
0.0033 / 0.0073
cavity u / v max error vs Ghia 1982
pass line 0.02
2.15, 1.91
observed mesh-convergence orders
≥ 1.5
< 1e-5
all residuals at endTime
gate 2
10/10
known-bad artifacts rejected
self-test, ≥ 90 % required

reproduced Independently reproduced: bit-identical metrics and media. Numbers from the demo's README and receipt.

Ask your agent

With the sandbox plugin or any agent that can use a sandbox, paste:

Create a CPU sandbox. In it, clone https://github.com/agent-next/sandbox and run `bash cookbook/cfd-openfoam/judge/setup.sh` to install the pinned OpenFOAM. Then build a case directory for the lid-driven cavity at Re = 100 (unit square, lid speed 1 m/s, icoFoam) and iterate with `bash cookbook/cfd-openfoam/judge/grade.sh <your-case-dir>` until every gate passes. Do the same for a plane-Poiseuille channel case (fully developed parabolic inlet, Re = 100). Report the final verdict JSON and kill the sandbox when done.

Or run it yourself

Creates a sandbox, installs the pinned tools, runs the judge's self-test, grades the known-good example, prints the verdict and kills the sandbox.

pip install "git+https://github.com/agent-next/sandbox#subdirectory=cli"
export SBX_API_KEY=<your key>  # from the console
git clone --depth 1 https://github.com/agent-next/sandbox && cd sandbox
python3 cookbook/cfd-openfoam/run.py
No key? Run the judge on any Debian 12 box
# from cookbook/cfd-openfoam/
bash judge/setup.sh
bash judge/selftest.sh
bash judge/grade.sh examples/good/poiseuille --seed 42
bash judge/grade.sh examples/good/cavity --seed 42

Results

Judge results: Poiseuille profile vs analytic, cavity centrelines vs Ghia 1982, mesh convergence and the cavity field
Judge results: Poiseuille profile vs analytic, cavity centrelines vs Ghia 1982, mesh convergence and the cavity field. Full size
Replayed agent loop and the self-test kill rate
Replayed agent loop and the self-test kill rate. Full size

Why a sandbox

OpenFOAM is a heavy system-level toolchain (~600 MB of packages). The sandbox installs a pinned, sha256-checked build, runs it, and is thrown away, so nothing touches your own machine.

Measured wall time

StepWall time
judge/setup.sh (cold)~16–23 s with packages cached regionally; ~2–4 min worst case
judge/selftest.sh (2 good + 10 mutants)54–73 s
judge/grade.sh, one case~6 s

Limits, plainly

  • Single-core icoFoam only: no MPI, no turbulence, no snappyHexMesh.
  • Gates pin Re = 100 and the unit-square geometry; a case at another Re fails even if it is physically self-consistent.
  • The Ghia data is a 129×129 benchmark; the 0.02 tolerance reflects a 40×40 mesh, not solver-exact agreement.

Source

Demo folder · SPEC · RECEIPT · REPRODUCE — pinned at ba328e6

Run one yourself

Sign in with GitHub for a free key with 10 sandbox-hours. Every demo above finishes in minutes and kills its sandbox when it is done.