MetaOpenFOAM 2.0: Automating CFD Workflows
- MetaOpenFOAM 2.0 is an LLM-driven system that automates CFD simulation and post-processing workflows through a modular, multi-agent pipeline.
- It employs chain-of-thought decomposition and an iterative verification loop to break down complex tasks and ensure numerical and physical accuracy.
- Benchmark results demonstrate improved executability, reduced token usage, and lower costs, making it ideal for rapid, cost-efficient CFD prototyping.
MetaOpenFOAM 2.0 is a LLM-driven system for automating computational fluid dynamics (CFD) simulation and post-processing workflows based on OpenFOAM. It integrates chain-of-thought (COT) decomposition, retrieval-augmented generation (RAG), and iterative verification mechanisms to convert natural language requirements into executable CFD tasks for both simulations and complex post-processing. MetaOpenFOAM 2.0 demonstrates improved automation, accuracy, and cost-efficiency compared to previous approaches, significantly outperforming its predecessor across a standardized benchmark suite (Chen et al., 1 Feb 2025).
1. System Architecture
MetaOpenFOAM 2.0 features a multi-agent, modular pipeline that orchestrates automation of CFD workflows in the following stages:
- Natural-Language Parser: Normalizes free-form user requirements for downstream processing.
- Retrieval-Augmented Generation (RAG): Embeds the normalized requirement in a FAISS vector store, retrieving the top- OpenFOAM tutorial/case exemplars to ground subsequent reasoning.
- QDCOT Decomposer: Applies a hierarchical, two-stage question decomposition, first partitioning the requirement into coarse tasks (simulation and post-processing), then further dividing into granular subtasks specific to OpenFOAM or post-processing routines.
- Iterative COT (ICOT) Loop: For each subtask, iterates between three agents—InputWriter (generates/edits inputs/scripts), Runner (executes shell commands, captures outputs/errors), and Reviewer (inspects, comments, triggers rewrites)—until the subtask is resolved or a maximum iteration cap is reached.
- LLM-Assisted Final Verifier: Checks global physical and numerical validity, verifying satisfaction of user intent, boundary conditions, flow characteristics, convergence, and physical consistency.
The backbone of the system is concisely presented in Algorithm 1:
8
Here, denotes task-level decomposition, subtask-level decomposition, and the final verification step (Chen et al., 1 Feb 2025).
2. Chain-of-Thought (COT) Decomposition
COT in MetaOpenFOAM 2.0 is realized as a structured, two-level hierarchy:
- Task-Level Decomposition : The requirement is divided into where is “CFD simulation,” is “CFD post-processing.”
- Subtask-Level Decomposition : Each 0 maps to an ordered list 1, e.g., 2write controlDict, run pimpleFoam, check convergence3 and 4run post-process commands, convert to VTK, run Python script5.
This explicit task-subtask breakdown, summarized as 6, localizes computational and logical errors and mitigates cross-domain propagation between simulators, shell, and Python subsystems.
3. Iterative Verification and Correction Mechanism
Each subtask 7 undergoes an Iterative Chain-of-Thought (ICOT) refinement loop defined as follows:
Given an initial state 8, at each iteration 9: 0
The loop continues until either 1 or 2 saturates 3 (default 10). Upon subtask completion, the LLM-driven FinalVerifier checks assembled outputs for requirement satisfaction, physical and numerical accuracy (e.g., 4 range, convergence), and boundary consistency. Detected errors route the process back to the offending subtask (Chen et al., 1 Feb 2025).
4. Benchmarking and Metrics
MetaOpenFOAM 2.0’s assessment employs a 13-task benchmark suite with seven simulation cases (e.g., incompressible RANS flows, DNS-HIT, reactingFoam) and six post-processing cases (extractions like max 5, TKE, plus visualization outputs).
Key metrics include:
- Executability 6: Ranging from simulation-only completion (0–3), through mix CLI/Python post-processing (4–5), numerical/physical validation (6), to human-judged flawless execution (7).
- Cost Metrics: Total agent iterations 7, token usage 8, and USD-equivalent cost (average \$0.15/case).
- Pass@k: Fraction of 9 generated samples with 0 among the top-1, e.g., for 2, 3 represents single-shot success: 4
This evaluation framework quantifies both accuracy and cost-efficiency (Chen et al., 1 Feb 2025).
5. Experimental Performance and Ablation Studies
MetaOpenFOAM 2.0 demonstrates significant gains over MetaOpenFOAM 1.0 in all core metrics. Averaged across 13 tasks and 10 runs, the results are:
| Metric | MetaOpenFOAM 1.0 | MetaOpenFOAM 2.0 |
|---|---|---|
| Executability 5 | 2.1/7 | 6.3/7 |
| Pass@1 (%) | 0% | 86.9% |
| Avg. token usage | 47,426 | 36,448 |
| Avg. cost (USD) | \$V$60.15 | |
| Avg. iterations | 6.7 | 3.7 |
Ablation results underscore that both COT decompositions and ICOT iterative correction are essential. Removal of CLI/Python post-processing in the QDCOT ablations drops $V$7 to around 2.1, while omitting the ICOT reviewer loop reduces $V$8 to 1.4. Full system synergy provides a $V$9+4 increase in $(φ)$0 over monolithic (non-modular) approaches. Simulation-only tasks typically reach $(φ)$1 in near-minimal ICOT iterations, whereas more challenging DNS or complex post-processing tasks achieve lower, but still robust scores (Chen et al., 1 Feb 2025).
6. Post-Training Scaling Laws
The system exhibits two post-training scaling regularities:
- Executability versus QDCOT steps $(φ)$2: $(φ)$3; token usage also increases sublinearly $(φ)$4.
- Executability versus ICOT iterations $(φ)$5: $(φ)$6, with $(φ)0.15/case) prototyping for parameter studies.
Current limitations include an assumption of pre-meshed geometries, a lack of full pre-processing automation (mesh generation), and constraints to single-physics OpenFOAM examples. Multi-physics coupling and real-time physics selection are not addressed.
Planned future developments include:
- Integration of mesh generation and geometry parametricization within the COT framework.
- Extensions to multi-phase and fluid–structure interaction solvers.
- Use of reinforcement learning fine-tuning on CFD case libraries for improved COT efficiency.
- Development of lightweight, domain-specific LLMs to lower operational costs.
MetaOpenFOAM 2.0’s documented methodology and codebase are available at https://github.com/Terry-cyx/MetaOpenFOAM (Chen et al., 1 Feb 2025).