-
User inputs a detailed CFD simulation request.
-
Foam-Agent backend starts processing the request.
-
Foam-Agent generates the simulation's directory structure and files.
-
Multiphase simulation of a dam break with an obstacle, showing the water phase (alpha.water).
-
LES simulation of flow over a cylinder, showing velocity magnitude.
-
k-omega SST simulation showing vortex shedding past a rectangular obstacle.
Inspiration
Computational Fluid Dynamics (CFD) is one of the most powerful tools in engineering and science, but it is locked behind a "steep learning curve". Manually setting up a simulation in OpenFOAM is a "tedious and error-prone process", where simple mistakes can lead to complete simulation failure.
We were inspired by the recent Foam-Agent paper, which introduces a state-of-the-art multi-agent framework that automates the entire end-to-end OpenFOAM workflow from a single natural language prompt. This system achieves an 88.2% success rate, massively outperforming previous methods.
Our inspiration was to build OpenCFD: a web platform that takes this powerful, open-source AI framework and makes it accessible to everyone, truly "democratizing complex scientific computing".
What it does
OpenCFD is a web-based platform that uses the open-source Foam-Agent framework to run end-to-end CFD simulations from a single text prompt.
A user simply types what they want to simulate (e.g., "Simulate incompressible flow over a circular cylinder... using gmsh to create the mesh"). Our backend, powered by Foam-Agent, then orchestrates a team of specialized AI agents to handle the entire complex workflow:
- Architect Agent: First, this agent plans the entire simulation, defining the required directory structure and file dependencies.
- Meshing Agent: This agent automatically generates the computational mesh. It is incredibly versatile, supporting text-to-mesh generation via the Gmsh library, importing external user-provided meshes, or using OpenFOAM's native tools.
- Input Writer Agent: This agent generates all the complex OpenFOAM configuration files. Crucially, it writes them in a "dependency-aware sequence" (e.g.,
systemfiles first, thenconstant, then0files) to ensure consistency and reduce errors. - Runner Agent: This agent executes the simulation. For this hackathon, we run it locally, but the framework is designed to automatically generate Slurm scripts and submit jobs to HPC clusters.
- Reviewer Agent: This is the most critical part. If the simulation fails, the Runner Agent extracts the error logs. The Reviewer Agent then analyzes the error and automatically proposes a fix. The system then re-runs the simulation in an iterative loop until it succeeds.
- Visualization Agent: Finally, this agent generates plots and visualizations (like velocity fields) from the results, again based on the user's prompt.
How we built it
Our project is a full-stack application built on top of the open-source Foam-Agent.
- AI Backend: We deployed the Foam-Agent framework, which is built on LangGraph. This graph-based structure is what allows the system to manage the complex, stateful, and iterative workflow between all the different agents (Architect, Writer, Runner, Reviewer, etc.).
- Frontend: We built a clean user interface using Chainlit that allows a user to submit their prompt and see the final results.
- API / Orchestration: We created a Flask API that acts as the "orchestrator". Our website doesn't just call a single AI; it uses the Model Context Protocol (MCP) provided by Foam-Agent to call its specific, "atomic" functions (like
generate_mesh(),generate_file_content(),run_simulation(),review_and_suggest_fix()) in the correct sequence.
Challenges we ran into
- "Deploying the full Foam-Agent framework was a major challenge. It's not a single model but a complex multi-agent system built on LangGraph with many dependencies like Gmsh and FAISS for retrieval."
- "We first tried to run the workflow without the
Reviewer Agentto save time. As the ablation studies in the paper predicted, our success rate was poor (around 57%). Implementing the full iterative error-correction loop was essential and a huge 'a-ha' moment."
Accomplishments that we're proud of
- "We successfully built a true end-to-end application. We can take a single natural language prompt and deliver a final visualization, automating every step in between."
- "Our project showcases the power of a decomposable, agentic architecture. We aren't just calling a single LLM; we are orchestrating a team of specialized agents."
What we learned
- "For complex scientific tasks, iterative self-correction is not optional. The
Reviewer Agentwas the single most important component, responsible for a 30.9% jump in success rates. This is the future of reliable AI."
What's next for OpenCFD
This hackathon proved the core concept works. Next, we will leverage the full power of the Foam-Agent framework:
- Enable HPC Submission: Integrate the
Runner Agent's ability to generate Slurm scripts and submit jobs directly to HPC clusters from our website. - Expand the Knowledge Base: Use the Hierarchical Multi-Index RAG to add more simulation cases, improving the agent's accuracy on a wider range of physics.
- Build an Expert UI: Create a "Pro Mode" that exposes the individual MCP functions so expert users can build their own custom, automated workflows using our platform.
Log in or sign up for Devpost to join the conversation.