Openfoam
Skill svd-ai-lab/sim-plugin-openfoam/src/sim_plugin_openfoam/_skills/openfoam
Use when the user asks Codex, Claude Code, or another AI coding agent to run, inspect, or debug OpenFOAM cases through sim-cli. Supports case checks, solver execution, log inspection, result artifacts, replayable CFD workflows, and benchmark tasks.From its SKILL.md
npx -y skills add svd-ai-lab/sim-plugin-openfoam --skill openfoamAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 5 commands, including `uv run sim run solve.py --solver openfoam` and 4 more.
SKILL.md
7.5 KB, ~1.9k tokens by cl100k_base, as published. Nobody here has run it
openfoam-sim
You are driving OpenFOAM through sim-cli. This file is the index.
Detail lives in references/ — load progressively, only what the task needs.
How to load this skill
Don't read every reference up front — context is precious. Walk this list:
- Always read
references/case-setup.mdbefore authoring any case. - Pick a solver via
references/solver-selection.md. - Look up the fields & dictionaries you'll need in
references/field-and-dictionary-matrix.md. - For boundary conditions:
references/boundary-conditions.md. - If the case has turbulence:
references/turbulence-setup.md. - If the case is multiphase / VOF:
references/multiphase-vof.md. - If the case has heat or buoyancy:
references/heat-transfer.md(andreferences/conjugate-heat-transfer.mdfor solid+fluid). - For mesh generation:
references/mesh-and-blockmesh.md. - For schemes / solvers / relaxation:
references/numerics-and-schemes.md. - For runtime monitors / probes / forces:
references/function-objects.md. - For parallel execution and decomposition:
references/parallel-execution.md. - For runtime log diagnosis:
references/log-parsing-and-residuals.md. - For post-processing (sample lines, point queries, integrals):
references/post-processing.md. - For complete case skeletons by scenario:
references/case-recipes.md. - When something fails:
references/error-recovery.md— decision tree + fix sequences.
sim-cli integration (one-shot mode)
Most benchmark/single-shot use is one-shot:
# 1. Write your driver script. Conventionally `solve.py`.
# The script invokes blockMesh / solver / postProcess via subprocess,
# parses the result, and writes the answer to disk.
# 2. Run via sim-cli:
uv run sim run solve.py --solver openfoam
# sim wraps the script in a RunResult (exit_code, stdout, stderr, duration,
# errors) and stores it under `.sim/runs/`. Browse with:
uv run sim logs # list runs
uv run sim logs last # full last RunResult
uv run sim logs last --field exit_code
Persistent-session mode (uv run sim serve + uv run sim connect/exec/inspect/disconnect)
is supported when sim-server is reachable, but is not required for
typical case authoring.
Work sequence (the protocol)
Before writing any OpenFOAM file, classify the case:
- Time: steady or transient?
- Compressibility: incompressible or compressible?
- Phases: single-phase, two-phase (VOF), or multi-region?
- Turbulence: laminar, RANS (k-ε / k-ω SST / SpalartAllmaras), or LES/DNS?
- Heat/buoyancy: isothermal, forced convection, or buoyancy-driven?
This classification fixes the solver family (see solver-selection.md),
the required field set (see field-and-dictionary-matrix.md), and the
turbulence boundary recipe (see turbulence-setup.md).
Then, in this order:
- Mesh (
blockMeshorsnappyHexMesh); validate withcheckMesh. - Fields in
0/: one per required field; consistent patch names with the mesh. - Properties in
constant/: transport, turbulence, thermophysical (when relevant). - Numerics in
system/:controlDict,fvSchemes,fvSolution. Start conservative (upwind, low CFL, tight relaxation) and upgrade after the case is stable. - Run the chosen solver; tail the log; check the convergence signals
(
references/log-parsing-and-residuals.md). - Post-process to extract the requested KPI.
Validate at every layer — don't push to "run solver" before checkMesh is
clean and the field files reference patches that exist in the mesh.
Hard guardrails
These are mistakes LLMs make often. Don't.
- Don't invent dictionary keys, patch types, or solver names. Every key
in
controlDict/fvSchemes/fvSolution/transportProperties/ field files comes from a closed vocabulary. If you're not sure the key exists, look it up rather than guess. - Don't mix turbulence-model fields. k-ε needs
k+epsilon+nut; k-ω SST needsk+omega+nut; Spalart-Allmaras needsnuTilda+nut. Mixing fields across models causes solver to abort at startup. - Don't use
pwhen the solver expectsp_rgh. Buoyant solvers (buoyantBoussinesqSimpleFoam,buoyantSimpleFoam,chtMultiRegionFoam) and VOF (interFoam) wantp_rgh. Pure incompressible (icoFoam,simpleFoam,pimpleFoam) wantp. - Don't use
linear(central differencing) foralpha.waterconvection in VOF. It's unbounded;alphawill blow past [0,1]. UsevanLeerorMUSCLvia theinterfaceCompressionfamily. - Don't set relaxation factors to 1.0 in steady-state SIMPLE without
consistent yes(SIMPLEC). It's a recipe for divergence on most cases. - Don't keep aggressive second-order convection schemes on a fragile
case. Stabilize with
upwindfirst, upgrade tolinearUpwindonce residuals are well-behaved. - Don't treat
checkMeshwarnings as optional if the log is already diverging. Most divergence on a fresh case is a mesh-quality issue. - Don't assume
0/exists. Many tutorials ship0.orig/and rely onAllrunto copy it; if you skip Allrun, do it yourself:cp -r 0.orig 0. - Don't run on more MPI ranks than
numberOfSubdomainsindecomposeParDict. They must match, ormpirunwill hang or crash.
Output expected
When you finish, produce a short summary that states:
- Solver and physics family chosen
- Required fields and dictionaries authored
- Turbulence model + wall treatment (if any) + estimated inlet turbulence
- Numerical schemes used and any relaxation choices
- Convergence signal observed (
Endreached? final residuals? continuity errors?) - The requested KPI value, with units
- Any stability concerns or follow-up recommendations
For benchmark/grader contexts, this summary is implicit in the produced
/tmp/agent/result.json — you still benefit from doing the mental
checklist before submitting.
Reference index
| File | When to read |
|---|---|
references/case-setup.md | Always, first |
references/solver-selection.md | Picking a solver / pressure convention |
references/field-and-dictionary-matrix.md | "What files do I need?" lookup |
references/boundary-conditions.md | Concrete BC syntax per type |
references/turbulence-setup.md | Any turbulent case |
references/mesh-and-blockmesh.md | Mesh generation, blockMesh, checkMesh |
references/numerics-and-schemes.md | fvSchemes, fvSolution, relaxation, algorithm controls |
references/multiphase-vof.md | Two-phase / VOF cases |
references/heat-transfer.md | Buoyant or compressible-thermal |
references/conjugate-heat-transfer.md | Multi-region fluid + solid |
references/parallel-execution.md | decomposePar, MPI, reconstructPar |
references/log-parsing-and-residuals.md | Diagnosing solver progress + convergence |
references/post-processing.md | postProcess, sample, point queries |
references/function-objects.md | Runtime monitors (probes, forces, yPlus) |
references/case-recipes.md | Complete skeletons by scenario |
references/error-recovery.md | Failure decision tree + fix sequences |
references/failure_patterns.md | Catalog of historical failures (legacy) |
What ships with it: 29 files
175.2 KB alongside SKILL.md, 3 of them executable
base/
references/
- boundary-conditions.md7.3 KB
- case-recipes.md9.3 KB
- case-setup.md7.4 KB
- conjugate-heat-transfer.md7.8 KB
- error-recovery.md10.7 KB
- failure_patterns.md8.7 KB
- field-and-dictionary-matrix.md6.6 KB
- function-objects.md7.3 KB
- heat-transfer.md7.4 KB
- log-parsing-and-residuals.md8.1 KB
- mesh-and-blockmesh.md7.5 KB
- multiphase-vof.md8.3 KB
- numerics-and-schemes.md9.3 KB
- parallel-execution.md5.9 KB
- post-processing.md8.4 KB
- solver-selection.md6.1 KB
- turbulence-setup.md7.0 KB
solver/
- v2206/notes.md329 B
- v2312/notes.md207 B
- v2406/notes.md333 B
tests/
- fixtures/cavity_setup.shruns142 B
- fixtures/empty.foam0 B
- fixtures/hello_foam.pyruns81 B
- test_driver.pyruns8.3 KB