# Fine-tuning a Large Language Model for Automating Computational Fluid Dynamics Simulations

arXiv: https://arxiv.org/abs/2504.09602 · HTML: https://mlsanity.com/paper/2504.09602/

## Key facts

- Cited by 18 papers in the map (data through 14 Oct 2026).
- Builds on 18 of its 31 references that are in the map.
- First posted on arXiv 13 Apr 2025.

## Builds on (most cited first, 18 of 18)

- [Training language models to follow instructions with human feedback](https://mlsanity.com/paper/2203.02155/) (2022)
- [The Llama 3 Herd of Models](https://mlsanity.com/paper/2407.21783/) (2024)
- [LoRA: Low-Rank Adaptation of Large Language Models](https://mlsanity.com/paper/2106.09685/) (2021)
- [Chain-of-Thought Prompting Elicits Reasoning in Large Language Models](https://mlsanity.com/paper/2201.11903/) (2022)
- [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://mlsanity.com/paper/2005.11401/) (2020)
- [Evaluating Large Language Models Trained on Code](https://mlsanity.com/paper/2107.03374/) (2021)
- [Finetuned Language Models Are Zero-Shot Learners](https://mlsanity.com/paper/2109.01652/) (2021)
- [Retrieval-Augmented Generation for Large Language Models: A Survey](https://mlsanity.com/paper/2312.10997/) (2023)
- [Fine-Tuning Language Models from Human Preferences](https://mlsanity.com/paper/1909.08593/) (2019)
- [LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models](https://mlsanity.com/paper/2403.13372/) (2024)
- [MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models](https://mlsanity.com/paper/2309.12284/) (2023)
- [Llemma: An Open Language Model For Mathematics](https://mlsanity.com/paper/2310.10631/) (2023)
- [RAFT: Adapting Language Model to Domain Specific RAG](https://mlsanity.com/paper/2403.10131/) (2024)
- [Improving the Domain Adaptation of Retrieval Augmented Generation (RAG) Models for Open Domain Question Answering](https://mlsanity.com/paper/2210.02627/) (2022)
- [CRUD-RAG: A Comprehensive Chinese Benchmark for Retrieval-Augmented Generation of Large Language Models](https://mlsanity.com/paper/2401.17043/) (2024)
- [MetaOpenFOAM: an LLM-based multi-agent framework for CFD](https://mlsanity.com/paper/2407.21320/) (2024)
- [MetaOpenFOAM 2.0: Large Language Model Driven Chain of Thought for Automating CFD Simulation and Post-Processing](https://mlsanity.com/paper/2502.00498/) (2025)
- [A Status Quo Investigation of Large Language Models towards Cost-Effective CFD Automation with OpenFOAMGPT: ChatGPT vs. Qwen vs. Deepseek](https://mlsanity.com/paper/2504.02888/) (2025)

## Built on by (most cited first, 18 of 18)

- [ALL-FEM: Agentic Large Language models Fine-tuned for Finite Element Methods](https://mlsanity.com/paper/2603.21011/) (2026)
- [MDAgent2: Large Language Model for Code Generation and Knowledge Q&A in Molecular Dynamics](https://mlsanity.com/paper/2601.02075/) (2026)
- [Agentic Scientific Simulation: Execution-Grounded Model Construction and Reconstruction](https://mlsanity.com/paper/2603.00214/) (2026)
- [Engineering.ai: A Platform for Teams of AI Engineers in Computational Design](https://mlsanity.com/paper/2511.00122/) (2025)
- [Towards LLM-enabled autonomous combustion research: A literature-aware agent for self-corrective modeling workflows](https://mlsanity.com/paper/2601.01357/) (2026)
- [COSMO-Agent: Tool-Augmented Agent for Closed-loop Optimization,Simulation,and Modeling Orchestration](https://mlsanity.com/paper/2604.05547/) (2026)
- [AI CFD Scientist: Toward Open-Ended Computational Fluid Dynamics Discovery with Physics-Aware AI Agents](https://mlsanity.com/paper/2605.06607/) (2026)
- [SCICONVBENCH: Benchmarking LLMs on Multi-Turn Clarification for Task Formulation in Computational Science](https://mlsanity.com/paper/2605.18630/) (2026)
- [CFD-copilot: leveraging domain-adapted large language model and model context protocol to enhance simulation automation](https://mlsanity.com/paper/2512.07917/) (2025)
- [Perceptual Self-Reflection in Agentic Physics Simulation Code Generation](https://mlsanity.com/paper/2602.12311/) (2026)
- [Foundation-Model-Based Agents in Industrial Automation: Purposes, Capabilities, and Open Challenges](https://mlsanity.com/paper/2605.02592/) (2026)
- [A Multi-AI-agent Framework Enabling End-to-end Finite Element Analysis for Solid Mechanics Problems](https://mlsanity.com/paper/2606.00138/) (2026)
- [Simulation Code Generation for Fluid Systems using Large Language Models: Benchmarking Models and Prompting Strategies](https://mlsanity.com/paper/2607.29389/) (2026)
- [A unified foundational framework for knowledge injection and evaluation of Large Language Models in Combustion Science](https://mlsanity.com/paper/2603.04452/) (2026)
- [Tool-Augmented Agent for Closed-loop Optimization,Simulation,and Modeling Orchestration](https://mlsanity.com/paper/2605.20190/) (2026)
- [Automating structural reliability analysis with a multi-agent large language model framework](https://mlsanity.com/paper/2607.16580/) (2026)
- [Large language models for partial differential equation workflows](https://mlsanity.com/paper/2608.03600/) (2026)
- [LLM Agents Perform Controlled Experiments Using Simulation Models](https://mlsanity.com/paper/2608.23622/) (2026)

## Abstract (arXiv)

Configuring computational fluid dynamics (CFD) simulations typically demands extensive domain expertise, limiting broader access. Although large language models (LLMs) have advanced scientific computing, their use in automating CFD workflows is underdeveloped. We introduce a novel approach centered on domain-specific LLM adaptation. By fine-tuning Qwen2.5-7B-Instruct on NL2FOAM, our custom dataset of 28716 natural language-to-OpenFOAM configuration pairs with chain-of-thought (CoT) annotations, we enable direct translation from natural language descriptions to executable CFD setups. A multi-agent framework orchestrates the process, autonomously verifying inputs, generating configurations, running simulations, and correcting errors. Evaluation on a benchmark of 21 diverse flow cases demonstrates state-of-the-art performance, achieving 88.7% solution accuracy and 82.6% first-attempt success rate. This significantly outperforms larger general-purpose models like Qwen2.5-72B-Instruct, DeepSeek-R1, and Llama3.3-70B-Instruct, while also requiring fewer correction iterations and maintaining high computational efficiency. The results highlight the critical role of domain-specific adaptation in deploying LLM assistants for complex engineering workflows. Our code and fine-tuned model have been deposited at https://github.com/YYgroup/AutoCFD.
