Foam-Agent: A Large Language Model-Based Multi-Agent Framework for Automating Computational Fluid Dynamics Workflows

arXiv:2505.04997 · cs.AI, cs.MA · Submitted 2026-08-13 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: Next we'll be talking about the paper "Foam-Agent: A Large Language Model-Based Multi-Agent Framework for Automating Computational Fluid Dynamics Workflows".

Jane: The paper was written by Ling Yue, Nithin Somasekharan, Tingwen Zhang, Yadi Cao, Zhangze Chen et al. from Rensselaer Polytechnic Institute and University of California San Diego and Zhejiang Normal University and Southeast University.

Tom: Stay tuned as we take you through the paper and discuss its implications.

Jane: We also have Lu with us today — senior AI researcher at Tsinghua.

Tom: We also have Meng with us today — lead engineer at a mysterious AI startup.

Jane: We also have Lalam with us today — the in-house Large Language Model.

Tom: Alright, let's get started.

Title: Tom: Welcome back to the show, everyone! Today we're diving into a paper that's got me genuinely fired up — it's called "Foam-Agent: A Large Language Model-Based Multi-Agent Framework for Automating Computational Fluid Dynamics Workflows." Jane, I have to say, just the title alone tells you we're in for something big.

Jane: Oh absolutely, Tom. And for our listeners who might be tuning in thinking, "what on earth is computational fluid dynamics?" — let me break that down. It's basically the science of simulating how fluids move. Think airplane wings, blood flowing through arteries, wind hitting turbine blades. Engineers use it to test designs without building physical prototypes.

Tom: Right, and the problem is that doing this kind of simulation is brutally hard. You need to master OpenFOAM, which is this massive open-source toolkit, plus meshing tools, plus post-processing software. It takes years of training. That's where this paper comes in — they've built an AI system that automates the whole thing from a single natural language prompt.

Jane: And that's the part that gets me excited. You just type something like "simulate a lid-driven cavity at Reynolds number one hundred" and the system figures out the rest. It plans the simulation, generates the mesh, writes all the configuration files, runs it, and even fixes errors when things go wrong.

Tom: Exactly! And the numbers are impressive. On their benchmark, Foam-Agent hit an eighty-eight point two percent execution success rate on the basic tier — that's more than one and a half times better than the previous state-of-the-art system. On the harder, out-of-distribution cases, it was five times better.

Jane: What I love about this is the name, too. "Foam" comes from OpenFOAM, and "Agent" because it's a team of AI agents working together. It's not one monolithic AI trying to do everything — it's six specialists, each handling a different part of the workflow.

Tom: And that's the architectural insight, isn't it? You don't want one generalist doing everything. You want a planner, a mesher, a file writer, an executor, a reviewer, and a visualizer — each one focused on their job.

Jane: So Tom, what do you think this means for the field? I mean, if this works as well as they claim, we're talking about dramatically lowering the barrier to entry for CFD.

Tom: Honestly, Jane, I think it's huge. There are so many engineers and researchers who have great ideas but can't execute them because they don't have the CFD expertise. This could unlock a whole new wave of innovation. And the fact that it's built on open standards and can run on HPC clusters means it's not just a toy — it's a real tool.

Jane: And that's just the title and the big picture. Wait until we get into how they actually built this thing — the multi-index retrieval, the dependency-aware file generation, the trajectory-conditioned reviewer loop. That's where the real magic happens.

Tom: You're reading my mind, Jane. Let's get into the meat of it.

Summary: Jane: Alright, so we're back with "Foam-Agent: A Large Language Model-Based Multi-Agent Framework for Automating Computational Fluid Dynamics Workflows." Tom, we teased the big picture — now let's talk about what the paper actually does.

Tom: Right. So the core problem they're solving is that CFD workflows are fragmented. You have geometry creation, meshing, solver configuration, execution, error debugging, and visualization. Each step requires different tools and deep expertise. The authors realized that this is a perfect candidate for AI automation because the workflow is well-understood and stable.

Jane: And that's the key insight, right? They didn't try to reinvent CFD. They took the existing OpenFOAM workflow and built an AI harness around it. Six specialist agents, each bound to a specific stage of the pipeline.

Tom: Exactly. The Architect agent plans the file structure. The Meshing agent generates the computational mesh — either with OpenFOAM's native tools or with Gmsh. The Input Writer generates all the configuration files. The Runner executes the simulation. The Reviewer diagnoses and fixes errors. And the Visualization agent renders the results.

Jane: And the numbers really speak for themselves. On the FoamBench benchmark, they got eighty-eight point two percent execution success on one hundred ten basic cases. The previous system, MetaOpenFOAM, only got fifty-five point five percent with the same underlying language model. That's a massive jump.

Tom: And here's something I love — they don't just measure "did it run without crashing." They also measure field-level fidelity. That means they compare the actual simulation output — the velocity fields, temperature distributions — against ground truth solutions. Because a simulation that runs but gives wrong physics is worse than useless.

Jane: Right, and that's such an important distinction. They report both metrics separately. The execution success rate is eighty-eight point two percent, but the field-level fidelity score is zero point four seven seven out of one. So there's still a gap between "it ran" and "it's physically accurate."

Tom: But even that fidelity number is nearly three times better than the baseline. And on the advanced tier — these are hand-crafted cases that weren't in the training data — they got sixty-two point five percent execution success versus twelve point five percent for the baseline. That's the out-of-distribution test, and it shows the system generalizes.

Jane: I also want to highlight the multi-physics case study they did — a multi-region burner with combustion, conjugate heat transfer, radiation, and compressible thermodynamics all coupled together. That's the kind of thing that takes an expert days to set up. Foam-Agent did it autonomously, and the temperature field matched the expert reference with a normalized mean squared error of zero point zero three nine eight.

Tom: That's genuinely impressive. And it's not just about speed — it's about accessibility. This paper is essentially saying "you don't need five years of OpenFOAM experience to run a credible CFD simulation." That has huge implications for education, for small startups, for researchers in adjacent fields.

Jane: So the summary is: they built a team of AI agents that can take a plain English description of a fluid dynamics problem and produce a validated simulation, with error correction built in. And it works significantly better than anything that came before.

Tom: And the implications are broader than just CFD. This is a template for how to apply AI agents to complex scientific workflows in general. Let's keep going — I want to dig into the three methodological contributions that make this work.

Jane: Perfect setup for the next segment.

Improvements: Tom: So we're back with "Foam-Agent: A Large Language Model-Based Multi-Agent Framework for Automating Computational Fluid Dynamics Workflows." Jane, we've covered what it does — now let's get into how it does it. The paper has three main methodological contributions.

Jane: And I think the first one is really clever. It's called multi-index retrieval. Instead of having one big database of OpenFOAM knowledge, they split it into four specialized indices — case metadata, directory structure, file contents, and execution scripts. Each stage of the workflow queries the index that matches its needs.

Tom: Right, and that makes so much sense. It's like having a library organized by subject instead of one giant pile of books. When you need to know what boundary conditions to use, you query the file contents index. When you need to know what commands to run, you query the execution scripts index. The ablation shows this alone improves success rate from forty-four point five percent to fifty-seven point three percent when the reviewer is disabled.

Jane: And the second contribution is dependency-aware file generation. In OpenFOAM, files depend on each other. The solver settings in the system directory affect what goes in the constant directory, which affects the boundary conditions in the zero directory. If you generate them independently, you get inconsistencies — undefined variables, mismatched patch names, that kind of thing.

Tom: So what they do is treat it as a topological traversal of a dependency graph. Each file is generated in the context of the files that came before it. The system directory first, then constant, then zero then the Allrun script. It's like building a house — you need the foundation before you can put up the walls.

Jane: And the third contribution is what I find most exciting — the trajectory-conditioned reviewer loop. When a simulation fails, the Reviewer agent doesn't just look at the current error. It looks at the entire history of its own previous attempts — what errors it saw, what fixes it tried, what worked and what didn't.

Tom: That's like a scientist keeping a lab notebook. Each iteration, the system learns from its past mistakes and applies a minimal fix. The paper shows this is the single most important factor — it raises success rates from around fifty percent to over eighty percent across all configurations.

Jane: And the ablation study really isolates each contribution. With the reviewer off, multi-index retrieval gives you +twelve point eight percentage points. With the reviewer on, it gives you +three point seven. So they're complementary — retrieval gets you partway, and the reviewer closes the gap.

Tom: What I also appreciate is the failure taxonomy. They categorized every failure into ten categories — syntax errors, missing files, boundary condition mismatches, solver mismatches, convergence failures, and so on. And they measured how recoverable each category is. The reviewer recovers one hundred percent of syntax errors and ninety-five point five percent of missing-file errors. But solver/model mismatches — like mpirun option errors — are only twelve point five percent recoverable.

Jane: That's honest reporting. They're not claiming their system is perfect. They're showing exactly where it works and where it struggles. That's the kind of transparency we need more of in AI research.

Tom: And the practical impact is real. They compared against a human expert — a senior OpenFOAM user with five years of experience. Foam-Agent was two point one to fourteen point five times faster across three standard cases. And that's including the time the AI spends running simulations between error corrections.

Jane: So the improvements are: smarter retrieval, context-aware file generation, and iterative self-correction. Each one contributes, and together they create a system that dramatically outperforms the prior state of the art.

Tom: And I think the trajectory-conditioned reviewer is the most transferable idea. That concept — conditioning each correction on the full history of attempts — could apply to any domain where AI agents are debugging complex systems. Let's bring in some other perspectives on what this means.

Conclusion: Tom: And that brings us to the wrap-up for "Foam-Agent: A Large Language Model-Based Multi-Agent Framework for Automating Computational Fluid Dynamics Workflows." Jane, we've covered a lot of ground today — the multi-agent architecture, the three methodological contributions, the benchmark results.

Jane: We have. And I think the most important takeaway is that this paper demonstrates a blueprint for applying AI to complex scientific workflows. It's not about replacing scientists — it's about removing the drudgery so they can focus on the actual science.

Tom: The numbers are genuinely impressive. eighty-eight point two percent execution success on basic cases, sixty-two point five percent on out-of-distribution advanced cases, and field-level fidelity scores that are nearly three times better than the previous best system. All with the same underlying language model, which means the gains come from the architecture, not from a bigger model.

Jane: And the implications go beyond CFD. The multi-index retrieval, the dependency-aware generation, the trajectory-conditioned reviewer — these are design patterns that could apply to any domain with structured workflows. Finite element analysis, molecular dynamics, circuit simulation — the list goes on.

Tom: There are limitations, of course. The system struggles with complex geometries, and the reviewer can't fix everything — about nineteen percent of initial failures remain unrecoverable. But the authors are upfront about that, and they've laid out clear directions for future work.

Jane: I also love that they've made the code open source. Anyone can go to their GitHub repository and try it themselves. That's how you build a community and accelerate progress.

Tom: And the bigger picture is about accessibility. CFD has been a bottleneck for so many engineers and researchers. This paper is a significant step toward making that expertise available to everyone. It's not the end of the journey, but it's a major milestone.

Jane: Well said, Tom. And with that, we're going to say goodbye to Foam-Agent. It's been a fascinating paper — great architecture, honest evaluation, real results. We're excited to see where this line of research goes next.

Tom: Absolutely. Thanks for joining us, everyone. We'll be back with the next paper soon — and you won't want to miss it. Until then, keep exploring, keep asking questions, and keep pushing the boundaries of what's possible.

Ling Yue, Nithin Somasekharan, Tingwen Zhang, Yadi Cao, Zhangze Chen, Shimin Di, Shaowu Pan

Rensselaer Polytechnic Institute · University of California San Diego · Zhejiang Normal University · Southeast University

cs.AI, cs.MA

Submitted: 2026-08-13

Comments: 34 pages, 9 figures, 9 tables

Journal ref: Computer Methods in Applied Mechanics and Engineering, Vol. 461, 119271 (2026)

DOI: 10.1016/j.cma.2026.119271

Code: https://github.com/NLR-Theseus/cfdllmbench

Project page: https://langchain-ai.github.io/langgraph

License: http://creativecommons.org/licenses/by-nc-nd/4.0/

Importance score: 63/100

The gist: The paper introduces Foam-Agent, a multi-agent framework that leverages large language models (LLMs) to automate the end-to-end Computational Fluid Dynamics (CFD) workflow in OpenFOAM from a single

Key concepts

Computational Fluid Dynamics (CFD)
CFD is the science of simulating how fluids move through various environments like airplane wings or blood vessels. Engineers use these simulations to test designs and understand physical behavior without needing to build physical prototypes.
OpenFOAM
OpenFOAM is a massive open-source toolkit used for CFD simulations. The complexity of mastering this tool historically required years of training, which the Foam-Agent framework aims to automate.
Multi-Agent Framework
Foam-Agent uses six specialized AI agents—including a planner, mesher, and reviewer—to handle different stages of a workflow. This approach is used instead of one monolithic AI trying to manage all tasks at once.

Terminology

Summary

The paper introduces Foam-Agent, a multi-agent framework that leverages large language models (LLMs) to automate the end-to-end Computational Fluid Dynamics (CFD) workflow in OpenFOAM from a single natural-language prompt. The authors state: We present Foam-Agent, a multi-agent framework that leverages large language models (LLMs) to automate the end-to-end CFD workflow in OpenFOAM from a single natural-language prompt.

The paper rests on three methodological contributions:

  1. Multi-index retrieval: The authors state it organizes OpenFOAM domain knowledge along four complementary structural dimensions and selects indices by workflow stage, sharpening retrieval precision over conventional single-index retrieval-augmented generation. The four dimensions are "case metadata (the solver name from controlDict, physics tags from the Allrun header, and the turbulence model from constant/momentumTransport), directory structure (a bag-of-paths over the case file tree), file contents (full file text together with the parsed triples), and execution scripts (the Allrun command sequence)."

  2. Dependency-aware file generation: The authors state it is formulated as a topological traversal of the OpenFOAM case dependency graph, so that each configuration file is synthesized in the context of its already-generated predecessors, enforcing cross-file consistency. The traversal is realized by a stable four-tier priority sort over folder names following the order system ≻ constant ≻ 0 ≻ Allrun.

  3. Trajectory-conditioned reviewer loop: The authors state it "iteratively repairs failed runs by conditioning each correction on the accumulated error-and-diagnosis trajectory of its own previous attempts, applying at each step a minimal configuration edit that targets a reduced solver-error set."

Foam-Agent organizes six specialist agents:

  • Architect Agent: translates a natural-language description into a structured, dependency-ordered file-generation plan through an explicit five-step pipeline including classification into a four-field Pydantic schema (case name, case domain, case category, case solver), template selection by FAISS retrieval, file-manifest decomposition, dependency layering, and emission.

  • Meshing Agent: supports four mesh-generation pathways — blockMesh, snappyHexMesh, Gmsh, and external.msh files.

  • Input Writer Agent: realizes the dependency-aware file generation where the file content Ci is generated as Ci = LLM(Ti, S, Cj: j ≺ i) with predecessor files injected verbatim, rather than as paraphrased summaries.

  • Runner Agent: interfaces with the OpenFOAM execution environment and extracts solver errors for the Reviewer using a single-regex extractor that captures OpenFOAM's canonical fatal-error prefix from each solver log file.

  • Reviewer Agent: drives the execution-grounded correction loop through "three sequential LLM calls (Algorithm 4): an analysis call produces a diagnosis dt from the extracted error set Et; a plan call turns the diagnosis into a minimal rewrite plan Pt; and a rewrite call realizes the plan into the configuration edit ΔCt."

  • Visualization Agent: identifies the target field variables and generates a Python script (using either the PyVista library or ParaView Python routines) to render them.

On the FoamBench benchmark, the paper reports: "Foam-Agent achieves an 88.2% execution success rate on the 110 Basic-tier tasks and 62.5% on the out-of-distribution Advanced tier, 1.6× and 5× those of the prior MetaOpenFOAM framework, both with Claude 3.5 Sonnet, all without expert intervention."

The paper reports two metrics: Mexec ∈ 0, 1 is the execution-success metric: it is 1 if and only if the OpenFOAM solver returns exit code 0, writes a final time step, and produces no NaN or Inf in the residuals and "MNMSE ∈ 0, 0.5, 1 is a bucketed field-level fidelity metric: the per-case normalized mean-squared error (NMSE) against the ground-truth solution is scored 1 if NMSE ≤ 0.1, 0.5 if 0.1 < NMSE ≤ 0.3, and 0 otherwise."

Table 1 reports: Foam-Agent achieves Mexec = 0.882 and MNMSE = 0.477 on Basic (n=110), and Mexec = 0.625 and MNMSE = 0.406 on Advanced (n=16). MetaOpenFOAM achieves Mexec = 0.555 and MNMSE = 0.173 on Basic, and Mexec = 0.125 and MNMSE = 0.125 on Advanced. The zero-shot LLM baseline achieves Mexec = 0.064 and MNMSE = 0.050 on Basic, and Mexec = 0.017 and MNMSE = 0.009 on Advanced.

The paper reports a 2×2 Reviewer × RAG ablation on FoamBench-Basic: Under Reviewer-off, the multi-index lifts Mexec by +12.8 percentage points (44.5% → 57.3%) over the flat baseline... Under Reviewer-on this narrows to +3.7 points (84.5% → 88.2%). The paper concludes: Retrieval and iterative repair are thus complementary: retrieval alone caps Mexec at 57.3%, and the Reviewer is what carries the system to 88.2%.

The paper also reports: The Reviewer is the single most important factor: it raises the execution-success rate from roughly 50% to over 80% across all configurations.

The paper demonstrates several additional capabilities:

  • External mesh: Processing externally developed mesh files is a supported capability of Foam-Agent demonstrated on Multi-element airfoil and Tandem wing configuration cases, where The simulation results from Foam-Agent closely match with the result from a human OpenFOAM expert.

  • Tool-based mesh generation: using the Gmsh Python library on two cases: 1) Flow over a cylinder. 2) Flow over two square obstacles, noting The native meshing modules were unable to capture the intended geometry of the flow scenario, whereas the Gmsh-based approach successfully generated the overall domain.

  • HPC execution: demonstrated on a 3D lid-driven cavity flow with one million cells on the HPC platform Perlmutter, where the agent generates the necessary OpenFOAM case files along with a Slurm submission script.

  • Multi-physics case study: a multi-region burner case that Foam-Agent configured and ran end-to-end from a natural-language description using chtMultiRegionFoam, where The field-level NMSE between the two solutions at the final time step is 0.0398, placing the case in the top fidelity bucket (MNMSE =1).

  • MCP interoperability: Foam-Agent exposes all of its agent functions through the Model Context Protocol (Anthropic, 2024) so that external orchestrators can consume it as a composable component, demonstrated with the cursor environment as the orchestrator to perform a complete end-to-end simulation of the flow over a NACA 0012 airfoil.

The paper reports: Foam-Agent is 2.1–14.5× faster than the human expert across the three cases (Lid-driven cavity: 14.5×, Cylinder flow: 8.7×, forwardStep: 2.1×). Per-agent wall-clock attribution shows The Reviewer step dominates (74.7% of attributed time on FoamBench-Basic and 83.7% on Advanced). Token costs are reported: The Basic-tier median cost (0.29 per case) sits well below the mean (1.07).

The paper presents a ten-category symptom taxonomy of failures, finding: "multi-index retrieval rescues reasoning errors upstream of the Reviewer... the Reviewer is highly effective on dictionary-grade errors: it recovers 100% of syntax and boundary-condition errors and 95.5% of missing-file errors... the hardest residual class is solver/model mismatch (category 5, dominated by mpirun option errors), where recovery is only 0–12.5%. Aggregate Reviewer recovery on initial failures is 80.9% under the multi-index."

The paper acknowledges: "The present system remains limited in several respects. It is most reliable for simple-to-moderate geometries generated through blockMesh, snappyHexMesh, or Gmsh... Its repair capability is centered on mesh regeneration, mesh-parameter adjustment, execution diagnosis, and case-level correction, rather than closed-loop modification of CAD or the pre-meshing geometry definitions. Finally, the inter-file dependency structure is currently implemented as a fixed topological order derived from the OpenFOAM directory convention."

Future directions include code-level modification can enable LLM-driven development of low-level components of CFD solvers, real-world OpenFOAM workflow that requires multi-physics and advanced geometric understanding, such as fluid–structure interaction, overset and sliding meshes, solve-time adaptive mesh refinement, and human-agent collaborative paradigms... could enable the system to gracefully solicit human intervention when encountering unrecoverable states.

Improvements for AI systems

Based on the paper, here are the specific improvements I can implement and what the improved AI system can do:

Implementation: Replace single-index RAG with four specialized FAISS indices (case metadata, directory structure, file contents, execution scripts) and select the index dynamically based on the current workflow stage (planning, meshing, file writing, execution, review).

What the improved system can do: Retrieve more precise domain knowledge for each phase of the CFD workflow. For example, during the planning stage, it queries the case metadata index to identify the correct solver and physics; during file writing, it queries the file contents index for exact boundary condition syntax and numerical schemes. This reduces retrieval noise and improves downstream file generation accuracy by 12.8 percentage points (from 44.5% to 57.3% execution success without a reviewer).

Implementation: Enforce a fixed four-tier priority sort (system → constant → 0 → Allrun) so that each configuration file is generated with the verbatim content of its already-emitted predecessors in the prompt context.

Implementation: Maintain an append-only history of error logs and diagnoses across iterations. Each correction step: (a) analyzes the current error set against the full trajectory, (b) plans the smallest set of file changes targeting a reduced error set, and (c) rewrites only the necessary files.

Implementation: Replace a preloaded error catalog with a single regex extractor that captures OpenFOAM's ERROR: prefix, then delegate classification and repair to the LLM reviewer.

Implementation: Expose six specialist agents (Architect, Meshing, Input Writer, Runner, Reviewer, Visualization) as atomic, stateful functions via the Model Context Protocol, enabling external orchestrators to sequence them.

Implementation: Add a Meshing Agent that writes Python scripts using the Gmsh library for complex geometries, converts .msh files to OpenFOAM polyMesh format, and verifies boundary patch consistency.

Implementation: Inject cluster-specific documentation (partition limits, module naming, header syntax) into the agent's context via RAG before generating Slurm scripts.

The improved AI system can:

  • Take a single natural-language prompt (e.g., simulate a laminar incompressible lid-driven cavity at Re=100) and produce a complete, validated OpenFOAM case with mesh, configuration files, execution script, and visualization—without expert intervention.

  • Achieve 88.2% execution success on 110 Basic-tier benchmark cases and 62.5% on out-of-distribution Advanced-tier cases, 1.6× and 5× better than the prior state-of-the-art.

  • Recover from 80.9% of initial failures through iterative self-correction, learning from its own error trajectory.

  • Distinguish between crash-free execution and physical fidelity, reporting both metrics to the user.

  • Integrate with external orchestrators via MCP, enabling composable, multi-step scientific workflows beyond CFD.

  • Handle complex geometries via Gmsh, external meshes, and HPC execution, reducing end-to-end setup time by 2.1–14.5× compared to a senior human expert.

Abstract

Computational fluid dynamics (CFD) has been the main workhorse of computational physics, yet its steep learning curve and fragmented, multi-stage workflow create significant barriers to entry. We present Foam-Agent, a multi-agent framework that leverages large language models (LLMs) to automate the end-to-end CFD workflow in OpenFOAM from a single natural-language prompt. Foam-Agent rests on three methodological contributions. First, a multi-index retrieval scheme organizes domain knowledge along four complementary structural dimensions and selects indices by workflow stage, sharpening retrieval precision over conventional single-index retrieval-augmented generation. Second, dependency-aware file generation is formulated as a topological traversal of the OpenFOAM case dependency graph, so that each configuration file is synthesized in the context of its already-generated predecessors, enforcing cross-file consistency. Third, a trajectory-conditioned reviewer loop iteratively repairs failed runs by conditioning each correction on the accumulated error-and-diagnosis trajectory of its own previous attempts, applying a minimal configuration edit that targets a reduced solver-error set. Around these contributions, six specialist agents span planning, meshing, file writing, execution, review, and visualization; Foam-Agent additionally exposes its capabilities through the Model Context Protocol as a deployment surface for external orchestrators. On FoamBench, Foam-Agent achieves an 88.2% execution success rate on the 110 Basic-tier tasks and 62.5% on the out-of-distribution Advanced tier, all without expert intervention. These results show how strategic harnessing of specialized multi-agent systems can reduce expertise barriers while preserving the rigor of solver-based simulation workflows.

Sources

Related papers