csml-rpi/Foam-Agent
À propos
Foam-Agent: A large language model-based multi-agent framework for automating computational fluid dynamics workflows. Published in Computer Methods in Applied Mechanics and Engineering (CMAME).
IA et apprentissage automatiqueProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +9
- in 15 days
- +13
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalFoam-Agent 
Foam-Agent automates OpenFOAM simulations from a natural language prompt or an existing case. Its agents plan the case, prepare meshes and input files, review them before execution, run locally or through Slurm, repair errors, and visually review the resulting physics. Additional presentation plots are optional.
- OpenFOAM targets: Foundation v10 by default, with a separate native ESI/OpenCFD v2006 target.
- Tutorial retrieval: FAISS indices provide references from the selected target's tutorials.
- Model choice: OpenAI, Codex subscription, Anthropic, Bedrock, Ollama, and DeepSeek backends.
- MCP integration: Tools for Claude Code, Cursor, and other MCP clients.
Quick Start (Recommended: Docker)
Docker bundles Foundation OpenFOAM v10, Python dependencies, tutorial indices, and the default Qwen 0.6B embedding weights. No host Conda, OpenFOAM, or GPU is needed. Configure an API-key provider or a Codex subscription using the authentication guide. For Ollama, follow the local setup: it requires optional Python packages and a running Ollama service, which the default images do not include.
| Your environment | Installation |
|---|---|
| A host with Docker | Use the Docker steps below |
| An existing container or OpenFOAM installation | Local Python installation |
| Native ESI/OpenCFD v2006 | Build its matching image |
Build the current source on Linux amd64 (or an amd64 Docker VM):
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/csml-rpi/Foam-Agent.git
cd Foam-Agent
git lfs install
git lfs pull --include="database/foundation-v10/raw/*,database/foundation-v10/faiss/Qwen_Qwen3-Embedding-0.6B/**,examples/tandem-wing/*.msh"
docker build --platform linux/amd64 -f docker/Dockerfile -t foamagent:local .
cp .env.example .env
Edit .env with your provider, model and API key. Then check the installation
and run the bundled example, keeping results on the host:
mkdir -p output
docker run --rm --env-file .env foamagent:local \
python scripts/doctor.py --check-embedding --check-llm
docker run --rm --env-file .env \
-v "$PWD/output:/home/openfoam/Foam-Agent/output" \
foamagent:local bash examples/quickstart/run.sh
The diagnostic checks LLM access with a small request; the example uses the existing
user_requirement.txt. Files and logs are saved to output/quickstart/.
Use a fresh output directory for another run. See authentication
for a Codex subscription or another provider.
Open .foamagent/workflow_report.html in the generated case directory to explore
the execution steps, decisions and repairs. See workflow reports.
Locally built images run their bundled code and assets without startup updates. See Docker builds for native targets and older image compatibility.
To use your own prompt, mount its directory read-only and pass the container path:
docker run --rm --env-file .env \
-v "$PWD/inputs:/inputs:ro" \
-v "$PWD/output:/home/openfoam/Foam-Agent/output" \
foamagent:local python foambench_main.py \
--prompt_path /inputs/requirements.txt --output ./output/my-case
An existing directory or ZIP is also supported with
--case_path. Foam-Agent keeps an original/ copy and runs in work/.
Configuration
| Environment variable | Purpose | Default |
|---|---|---|
FOAMAGENT_MODEL_PROVIDER |
LLM backend | openai-codex |
FOAMAGENT_MODEL_VERSION |
Model identifier for that backend | gpt-5.3-codex |
FOAMAGENT_EMBEDDING_PROVIDER |
Tutorial embedding backend | huggingface |
FOAMAGENT_EMBEDDING_MODEL |
Model identity matching the FAISS indices | Qwen/Qwen3-Embedding-0.6B |
FOAMAGENT_EMBEDDING_MODEL_PATH |
Optional local copy of that Hugging Face model | Unset |
FOAMAGENT_OPENFOAM_TARGET |
Native target: foundation-v10 or esi-v2006 |
Unset; Foundation v10 |
The default LLM uses a Codex OAuth cache. An API key requires selecting its provider and model explicitly, as in Quick Start. Docker builds bundle the default embedding weights. Local Python installations may download them on first use; prebuilt tutorial indices come through Git LFS and must match the embedding model. See installation checks and offline setup.
Choose an execution mode with --execution_mode (or Config.execution_mode):
| Mode | File generation | Before each stage's first execution |
|---|---|---|
careful (default) |
Sequential in planned dependency order | Mesh/solver LLM static review |
fast |
Independent parallel generation | Run directly |
Both modes repair runtime errors. Static review requests only definite, necessary
corrections, with --max_static_review_retries 10 repair rounds shared by both
initial stages, separate from runtime max_loop. A later stage still reviews when
no repairs remain. Reaching the limit or making no edits proceeds to native
execution checks; review service failures stop. Later attempts use runtime review only.
--input_writer_generation_mode sequential_dependency|parallel_no_context
overrides generation independently. See configuration and reports.
Settings live in src/config.py; see configuration for credentials, the legacy ESI translation switch, and retry limits. Native ESI v2006 requires its matching runtime/image and corpus.
MCP Integration
After local installation, register the server with Claude Code:
claude mcp add foamagent -- foamagent-mcp
The repository also includes the /foam Claude Code skill. See the MCP guide for other clients, HTTP/Docker setup, tool arguments, and workflow limits.
Usage and Project Layout
- Usage guide: configuration, existing cases, custom meshes, native targets, Slurm, and Docker builds.
- MCP guide: client setup and available tools.
- DeepWiki: project introduction and interactive questions.
| Directory | Contents |
|---|---|
src/ |
Workflow, services, model clients, and MCP server |
database/ |
Target-specific tutorial corpora, FAISS indices, and builders |
examples/ |
Sample inputs, including the tandem-wing mesh and prompt |
docs/ |
User guides and illustrations |
scripts/ |
Corpus checks and translation verification tools |
tests/ |
Automated regression tests |
docker/ |
Runtime images and entrypoints |
Reported Benchmark Results
The table shows results for the latest Foam-Agent main and the earlier Luna baseline on the full FoamBench suite from CFDLLMBench V2.
Both runs used OpenFOAM Foundation v10 and ran five cases in parallel in careful mode, with sequential input generation and Visual Review enabled.
The limits were 15 runtime repair rounds, five visual reruns, one hour per solver attempt, and four hours per case.
Raising the runtime repair limit to 25 rounds may improve success rates by giving difficult cases more opportunities to recover.
| Scope | Model | Execution success rate | Mean FoamBench NMSE grade | Physical success rate |
|---|---|---|---|---|
| Basic (110 cases) | gpt-6-luna |
98.18% | 86.82% | 80.91% |
| Basic (110 cases) | gpt-6.2-sol |
99.09% | 90.00% | 84.55% |
| Advanced (16 cases) | gpt-6-luna |
68.75% | 62.50% | 56.25% |
| Advanced (16 cases) | gpt-6.2-sol |
68.75% | 84.38% | 62.50% |
| Overall (126 cases) | gpt-6-luna |
94.44% | 83.73% | 77.78% |
| Overall (126 cases) | gpt-6.2-sol |
95.24% | 89.29% | 81.75% |
FoamBench assigns a grade of 1 for NMSE < 0.1, 0.5 for 0.1 ≤ NMSE < 0.3, and 0 otherwise.
Physical success requires successful execution and a grade of 1. Each benchmark score includes every case in its scope.
Text tokens per case
| Model | Min | 25% | 50% | 75% | Max |
|---|---|---|---|---|---|
gpt-6-luna |
168k | 525k | 821k | 1,246k | 5,607k |
gpt-6.2-sol |
179k | 526k | 812k | 1,334k | 10,366k |
Values estimate prompt and response tokens per case across the full suite.
Community
Chinese-speaking users can add ZDSJTUCFD on WeChat to request an invitation to the Foam-Agent community.
Citation
If you use Foam-Agent or CFDLLMBench in your research, please cite the corresponding paper.
@article{yue2025foam,
title = {Foam-Agent: A large language model-based multi-agent framework for automating computational fluid dynamics workflows},
journal = {Computer Methods in Applied Mechanics and Engineering},
volume = {461},
pages = {119271},
year = {2026},
issn = {0045-7825},
author = {Ling Yue and Nithin Somasekharan and Tingwen Zhang and Yadi Cao and Zhangze Chen and Shimin Di and Shaowu Pan}
}
@article{somasekharan2025cfdllmbench,
title = {{CFDLLMBench}: A Benchmark Suite for Evaluating Large Language Models in Computational Fluid Dynamics},
author = {Somasekharan, Nithin and Yue, Ling and Cao, Yadi and Li, Weichao and Emami, Patrick and Bhargav, Pochinapeddi Sai and Acharya, Anurag and Xie, Xingyu and Pan, Shaowu},
journal = {Journal of Data-centric Machine Learning Research},
volume = {3},
number = {13},
pages = {1--40},
year = {2026},
month = {2},
publisher = {JMLR.org},
url = {https://openreview.net/forum?id=kTcH1MnkjY}
}
Explorer des projets similaires
Chargement…