How yygroup/autocfd works
This repository automates CFD simulations from a configured natural-language request: a multi-agent workflow checks the request and mesh, generates OpenFOAM inputs, runs the case, and iteratively corrects failures. The butterfly package supplies OpenFOAM case, mesh, dictionary, and parsing abstractions; statistics track execution outcomes. The README documents the workflow and correction loop. Some implementation details, especially post-processing and unsampled agent actions, are not shown, so their relationships are omitted rather than inferred.
Main entry points: main.py Workflow entry · RunnerAction.py Simulation runner · qa_module.py Async LLM clients · PrecheckerAction.py Input precheck
Components 20
Agent workflow
- Workflow entry
src/main.py - Input precheck
src/actions/PrecheckerAction.py - Input generation
src/actions/InputWriterAction.py - Simulation runner
src/actions/RunnerAction.py - Error correction
src/actions/CorrectorAction.py - Prechecker agent
src/roles/Prechecker.py - Writer agent
src/roles/InputWriter.py - Runner agent
src/roles/Runner.py - Corrector agent
src/roles/Corrector.py - Run configuration
src/config_path.py
LLM services
- Async LLM clients
src/qa_module.py
OpenFOAM tooling
- Case assembly
src/utils/butterfly/case.py - Geometry and mesh
src/utils/butterfly/geometry.py - Foam dictionaries
src/utils/butterfly/foamfile.py - Dictionary parser
src/utils/butterfly/parser.py - Mesh dictionaries
src/utils/butterfly/blockMeshDict.py
Results and metrics
- Post-processing
src/openfoam_postprocess.py - Run statistics
src/Statistics.py
Other components
- User request
- OpenFOAM runtime
Connections 24
- User request → Workflow entry: starts run
README.md - Workflow entry → Prechecker agent: publishes request
src/main.py - Workflow entry → Writer agent: registers agent
src/main.py - Workflow entry → Runner agent: registers agent
src/main.py - Workflow entry → Corrector agent: registers agent
src/main.py - Prechecker agent → Input precheck: runs action
src/roles/Prechecker.py - Writer agent → Input generation: runs action
src/roles/InputWriter.py - Runner agent → Simulation runner: runs action
src/roles/Runner.py - Corrector agent → Error correction: runs action
src/roles/Corrector.py - Input precheck → Async LLM clients: asks model
src/actions/PrecheckerAction.py - Input generation → Async LLM clients: generates inputs
src/actions/InputWriterAction.py - Error correction → Async LLM clients: requests fixes
src/actions/CorrectorAction.py - Input precheck → Dictionary parser: parses dictionaries
src/actions/PrecheckerAction.py - Input generation → Dictionary parser: parses response
src/actions/InputWriterAction.py - Simulation runner → OpenFOAM runtime: executes case
src/actions/RunnerAction.py - Corrector agent → Simulation runner: reruns case
src/roles/Corrector.py - Case assembly → Foam dictionaries: uses dictionaries
src/utils/butterfly/case.py - Case assembly → Geometry and mesh: uses geometry
src/utils/butterfly/case.py - Geometry and mesh → Mesh dictionaries: uses mesh definitions
src/utils/butterfly/geometry.py - Foam dictionaries → Dictionary parser: parses files
src/utils/butterfly/foamfile.py - Workflow entry → Run configuration: reads settings
src/main.py - Workflow entry → Run statistics: records runs
src/main.py - Simulation runner → Run statistics: updates outcome
src/actions/RunnerAction.py - Async LLM clients → Run statistics: counts tokens
src/qa_module.py