Table of Contents
Fetching ...

ChatCFD: An LLM-Driven Agent for End-to-End CFD Automation with Structured Knowledge and Reasoning

E Fan, Kang Hu, Zhuowen Wu, Jiangyang Ge, Jiawei Miao, Yuzhi Zhang, He Sun, Weizong Wang, Tianhan Zhang

TL;DR

This work introduces ChatCFD, an LLM-driven multi-agent system for end-to-end CFD automation with OpenFOAM, grounded in structured domain knowledge and iterative error correction. By combining DeepSeek-R1/V3 reasoning with modular retrieval and a Physics Interpreter, ChatCFD achieves 82.1% execution success and 68.12% physical fidelity across 315 benchmark cases, while maintaining high efficiency (~192.1k tokens and $0.208 per case). Ablation and flexibility studies identify the Error Locator and Solver Template DB as critical components and demonstrate robust generalization across regimes and turbulence models. The framework, complemented by MCP compatibility, points toward scalable, collaborative AI-driven CFD workflows capable of reproducing literature cases and accelerating scientific discovery while highlighting current LLM limitations in enforcing tightly coupled physical constraints.

Abstract

Computational Fluid Dynamics (CFD) is critical for scientific advancement but is hindered by operational complexity and high expertise barriers. This paper introduces ChatCFD, a Large Language Model (LLM)-driven multi-agent system designed for end-to-end CFD automation using OpenFOAM. Powered by DeepSeek-R1/V3, ChatCFD integrates structured domain knowledge bases, a precise error locator, and iterative reflection to dramatically outperform existing methods. On 315 benchmark cases, ChatCFD achieves 82.1% execution success (vs. 6.2% for MetaOpenFOAM and 42.3% for Foam-Agent) and 68.12% physical fidelity - a novel metric assessing scientific meaningfulness beyond mere runnability. A dedicated Physics Interpreter attains 97.4% summary fidelity, bridging the gap between narrative fluency and the enforcement of tight physical constraints. Resource analysis confirms efficiency, averaging 192.1k tokens and $0.208 per case, significantly lower than baseline costs. Ablation studies identify the Error Locator and Solver Template DB as critical, with the latter's removal collapsing accuracy to 48%. The system exhibits robust flexibility, achieving 95.23% success in autonomous solver selection and 100% in turbulence modeling, while successfully reproducing complex literature cases (e.g., NACA0012, supersonic nozzle) with 60-80% success rates where baselines failed. Featuring a modular, MCP-compatible design, ChatCFD facilitates scalable, collaborative AI-driven CFD. Code is available at: https://github.com/ConMoo/ChatCFD

ChatCFD: An LLM-Driven Agent for End-to-End CFD Automation with Structured Knowledge and Reasoning

TL;DR

This work introduces ChatCFD, an LLM-driven multi-agent system for end-to-end CFD automation with OpenFOAM, grounded in structured domain knowledge and iterative error correction. By combining DeepSeek-R1/V3 reasoning with modular retrieval and a Physics Interpreter, ChatCFD achieves 82.1% execution success and 68.12% physical fidelity across 315 benchmark cases, while maintaining high efficiency (~192.1k tokens and $0.208 per case). Ablation and flexibility studies identify the Error Locator and Solver Template DB as critical components and demonstrate robust generalization across regimes and turbulence models. The framework, complemented by MCP compatibility, points toward scalable, collaborative AI-driven CFD workflows capable of reproducing literature cases and accelerating scientific discovery while highlighting current LLM limitations in enforcing tightly coupled physical constraints.

Abstract

Computational Fluid Dynamics (CFD) is critical for scientific advancement but is hindered by operational complexity and high expertise barriers. This paper introduces ChatCFD, a Large Language Model (LLM)-driven multi-agent system designed for end-to-end CFD automation using OpenFOAM. Powered by DeepSeek-R1/V3, ChatCFD integrates structured domain knowledge bases, a precise error locator, and iterative reflection to dramatically outperform existing methods. On 315 benchmark cases, ChatCFD achieves 82.1% execution success (vs. 6.2% for MetaOpenFOAM and 42.3% for Foam-Agent) and 68.12% physical fidelity - a novel metric assessing scientific meaningfulness beyond mere runnability. A dedicated Physics Interpreter attains 97.4% summary fidelity, bridging the gap between narrative fluency and the enforcement of tight physical constraints. Resource analysis confirms efficiency, averaging 192.1k tokens and $0.208 per case, significantly lower than baseline costs. Ablation studies identify the Error Locator and Solver Template DB as critical, with the latter's removal collapsing accuracy to 48%. The system exhibits robust flexibility, achieving 95.23% success in autonomous solver selection and 100% in turbulence modeling, while successfully reproducing complex literature cases (e.g., NACA0012, supersonic nozzle) with 60-80% success rates where baselines failed. Featuring a modular, MCP-compatible design, ChatCFD facilitates scalable, collaborative AI-driven CFD. Code is available at: https://github.com/ConMoo/ChatCFD

Paper Structure

This paper contains 23 sections, 19 figures, 2 tables.

Figures (19)

  • Figure 1: Overview of the ChatCFD automated agent system for streamlining CFD simulations within the OpenFOAM framework. ChatCFD enables researchers and engineers to configure and execute simulations with minimal CFD or OpenFOAM expertise. The system comprises three core components: (1) an interactive chat interface for users to input case descriptions or upload mesh files, (2) a thinking system, the core decision-making module (detailed in Figure \ref{['fig_chatcfd_framework']}), and (3) a simulation engine that executes cases, collects error logs, and delivers final results.
  • Figure 2: Architecture of the ChatCFD framework for automated CFD simulations, illustrating the four-stage workflow and agent structure. The stages are: (1) Knowledge Base Construction, creating a JSON database from OpenFOAM manuals and tutorials; (2) User Input Processing, enabling user interaction via natural language or document and mesh uploads; (3) Case File Generation, generating OpenFOAM case files using the knowledge base; and (4) Execution and Error Reflection, running simulations, converting meshes with fluentMeshToFoam, and resolving errors (dimension mismatches, missing files, persistent errors, general issues) using RAG-based modules ReferenceRetriever and ContextRetriever. The agent structure integrates DeepSeek-R1 and DeepSeek-V3 for intelligent processing, with iterative error correction.
  • Figure 3: Based on the knowledge base constructed from the contents such as the OpenFOAM manual and OpenFOAM tutorials, and how it functions within the ChatCFD framework
  • Figure 4: Comparison of success rates across three CFD agents (ChatCFD, MetaOpenFOAM, Foam-Agent) for 205 benchmark and 110 perturbed OpenFOAM tutorial cases. (a) Success rates by case category. (b) Distribution of test cases across categories. (c) Overall success rate comparison.
  • Figure 5: Performance statistics for different agents across 205 benchmark tutorial cases. (a) Average token consumption per case. (b) Distribution of token consumption. (c) Average number of reflection iterations per case. (d) Average token consumption per reflection iteration. (e) Average computational cost (in monetary terms). (f) Distribution of reflection iteration ratios, excluding zero and limit-reaching cases.
  • ...and 14 more figures