Foam-Agent: A Multi-Agent Framework for Automating OpenFOAM-based CFD Simulation
Abstract
Agentic systems powered by large language models (LLMs) are increasingly reshaping scientific workflows by automating tasks that traditionally required expert intervention. In Computational Fluid Dynamics (CFD), the steep learning curve of simulation software and the complexity of multistage workflows present major barriers to accessibility and productivity. Hence, we introduce Foam-Agent, a multi-agent framework that automates the end-to-end OpenFOAM workflow from a single natural language prompt. Foam-Agent offers key innovations targeting realistic deployment scenarios through End-to-end workflow automation that spans 1) external mesh file import and text-to-mesh generation via the Gmsh library; 2) automatic HPC job submission and execution; and 3) post-simulation visualization, all implemented within a decomposable service architecture built on the Model Context Protocol (MCP) and high-fidelity generation through hierarchical retrieval across case metadata (e.g., case name, domain, category, solver etc.) and dependency-aware file ordering, ensuring core files are produced first and supporting files follow in the correct sequence. On a benchmark of 110 CFD cases across 11 physics scenarios, Foam-Agent achieves an 88.2% success rate, surpassing existing frameworks by a large margin. By substantially lowering the expertise barrier for CFD, Foam-Agent demonstrates how specialized multi-agent systems can democratize complex scientific computing. The code is open-sourced at https://anonymous.4open.science/r/Foam-Agent-FC56.