Table of Contents
Fetching ...

OpenFOAMGPT: a RAG-Augmented LLM Agent for OpenFOAM-Based Computational Fluid Dynamics

Sandeep Pandey, Ran Xu, Wenkang Wang, Xu Chu

TL;DR

OpenFOAMGPT addresses the need to automate CFD workflows by combining LLMs with retrieval-augmented generation to guide OpenFOAM simulations. The approach leverages GPT-4o for general understanding and o1 with chain-of-thought for enhanced reasoning, coupled with a RAG backend built on OpenFOAM tutorials. Results indicate that o1-CoT achieves superior handling of complex tasks such as zero-shot case setup, boundary-condition edits, turbulence-model changes, and cross-version code translation, at higher token costs. The framework demonstrates strong potential to accelerate CFD research and industrial workflows, with domain-specific RAG and human oversight mitigating risks and enabling adaptation to other solvers.

Abstract

This work presents a large language model (LLM)-based agent OpenFOAMGPT tailored for OpenFOAM-centric computational fluid dynamics (CFD) simulations, leveraging two foundation models from OpenAI: the GPT-4o and a chain-of-thought (CoT)-enabled o1 preview model. Both agents demonstrate success across multiple tasks. While the price of token with o1 model is six times as that of GPT-4o, it consistently exhibits superior performance in handling complex tasks, from zero-shot case setup to boundary condition modifications, turbulence model adjustments, and code translation. Through an iterative correction loop, the agent efficiently addressed single- and multi-phase flow, heat transfer, RANS, LES, and other engineering scenarios, often converging in a limited number of iterations at low token costs. To embed domain-specific knowledge, we employed a retrieval-augmented generation (RAG) pipeline, demonstrating how preexisting simulation setups can further specialize the agent for sub-domains such as energy and aerospace. Despite the great performance of the agent, human oversight remains crucial for ensuring accuracy and adapting to shifting contexts. Fluctuations in model performance over time suggest the need for monitoring in mission-critical applications. Although our demonstrations focus on OpenFOAM, the adaptable nature of this framework opens the door to developing LLM-driven agents into a wide range of solvers and codes. By streamlining CFD simulations, this approach has the potential to accelerate both fundamental research and industrial engineering advancements.

OpenFOAMGPT: a RAG-Augmented LLM Agent for OpenFOAM-Based Computational Fluid Dynamics

TL;DR

OpenFOAMGPT addresses the need to automate CFD workflows by combining LLMs with retrieval-augmented generation to guide OpenFOAM simulations. The approach leverages GPT-4o for general understanding and o1 with chain-of-thought for enhanced reasoning, coupled with a RAG backend built on OpenFOAM tutorials. Results indicate that o1-CoT achieves superior handling of complex tasks such as zero-shot case setup, boundary-condition edits, turbulence-model changes, and cross-version code translation, at higher token costs. The framework demonstrates strong potential to accelerate CFD research and industrial workflows, with domain-specific RAG and human oversight mitigating risks and enabling adaptation to other solvers.

Abstract

This work presents a large language model (LLM)-based agent OpenFOAMGPT tailored for OpenFOAM-centric computational fluid dynamics (CFD) simulations, leveraging two foundation models from OpenAI: the GPT-4o and a chain-of-thought (CoT)-enabled o1 preview model. Both agents demonstrate success across multiple tasks. While the price of token with o1 model is six times as that of GPT-4o, it consistently exhibits superior performance in handling complex tasks, from zero-shot case setup to boundary condition modifications, turbulence model adjustments, and code translation. Through an iterative correction loop, the agent efficiently addressed single- and multi-phase flow, heat transfer, RANS, LES, and other engineering scenarios, often converging in a limited number of iterations at low token costs. To embed domain-specific knowledge, we employed a retrieval-augmented generation (RAG) pipeline, demonstrating how preexisting simulation setups can further specialize the agent for sub-domains such as energy and aerospace. Despite the great performance of the agent, human oversight remains crucial for ensuring accuracy and adapting to shifting contexts. Fluctuations in model performance over time suggest the need for monitoring in mission-critical applications. Although our demonstrations focus on OpenFOAM, the adaptable nature of this framework opens the door to developing LLM-driven agents into a wide range of solvers and codes. By streamlining CFD simulations, this approach has the potential to accelerate both fundamental research and industrial engineering advancements.
Paper Structure (9 sections, 3 figures, 5 tables)

This paper contains 9 sections, 3 figures, 5 tables.

Figures (3)

  • Figure 1: The design of the agent structure
  • Figure 2: The structure of RAG
  • Figure 3: Case simulation results. (a) Cavity flow (b) PitzDaily (c) Hotroom (d) Dambreak (e) Particle column (f) Mixed vessel.