I'm a developer in naval engineering. I used Ansys for years, then a large, automatable CFD workload had to move to OpenFOAM. For the past year I've had an AI agent (through MCP) editing case files, running the steps and reading results. Some lessons, in case they're useful to anyone trying the same:
**1. The model rarely gets the physics wrong — it gets the mesh setup wrong.** Most failed runs were meshing details: surfaceFeatureExtractDict entries in the wrong format for the version, snappy features pointing to the .stl instead of the extracted edge mesh, mergeTol not matching writePrecision. Checking these before running saved more time than any prompt tweak.
**2. Agents over-refine.** Left alone, it would put level 6–7 on a 250 m hull and blow up the cell count. Capping refinement levels from the base cell size and the part's smallest dimension fixed it.
**3. Error loops are the real token sink.** When a step fails (e.g. "No surfaces found" because a geometry reference is wrong), the agent tends to retry variations of the same thing. Checking case consistency first — geometry references, patches in 0/ vs. the mesh, initial conditions — stops the loop before it starts.
**4. Don't let it reason about the pipeline.** Which utilities to run, and in what order, can be inferred deterministically from which dictionaries exist (blockMeshDict, snappyHexMeshDict, setFieldsDict…). I validated that against the 350+ tutorial Allruns; the model doesn't need to spend tokens on it.
**5. Raw output is expensive.** Reading full solver logs and plotting from scratch burned most of the tokens. Returning short summaries (residual trends, windowed force averages) instead made it practical: I now run 20+ cases over 3 days without watching them.
**6. Give it tools, not scripts.** Writing an STL by hand or a matplotlib script for every figure is slow and inconsistent. Giving the agent operations instead — build a part by extrude/revolve/sweep/loft, set up a scene with camera, lights, arrows and dimensions, then capture it — made geometry changes and report images fast and repeatable.
**7. It doesn't replace judgment.** The setup decisions and judging the results are still on the engineer. What it removes is the manual editing and clicking.
I ended up wrapping all of this into a Windows GUI — NavStokes — with its own VTK-based 3D viewport where you see the mesh, fields and convergence while the agent works, a part modeler (extrude, revolve, sweep, loft, shell, piping) and scene tools for report images. It's free and uses your own OpenFOAM install (ESI/OpenCFD, openfoam.com, v2106 and newer) and your own AI subscription. The prompt/validator core is closed, but I can share the interface code with anyone interested in the project — just DM me. It needs an account because remote access over the internet runs through our relay server (encrypted end to end; your PC still does the computing) and your AI preferences sync across machines; case files stay on your PC.
Link at the bottom for anyone curious, but I'm mainly interested in the discussion:
- Has anyone else tried agents with OpenFOAM? What broke for you?
- Next I want to map OpenFOAM surface pressure/shear onto CalculiX or Code_Aster, then two-way FSI with preCICE. If you've done that coupling, what was the painful part?
www.navstokes.com