Skip to content

CHOSENX-GPU/chatcfd-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatCFD Skill

An AI agent skill for running OpenFOAM CFD simulations, adapted for macOS and Linux cross-platform support.

This is NOT an original work. This skill is based on ConMoo/ChatCFD by @ConMoo. The contribution here is macOS native OpenFOAM adaptation (via openfoam-app) and packaging as an installable agent skill.

What this skill does

  • Converts meshes (Fluent .msh or polyMesh) into OpenFOAM format
  • Extracts boundary names and types
  • Looks up required files for a given solver + turbulence model
  • Sets CFL / time controls in controlDict
  • Runs OpenFOAM solvers and captures logs
  • Analyzes solver errors with rule-based pattern matching
  • Prepares LLM-assisted correction tasks

What this fork adds

  • macOS native OpenFOAM support via the openfoam2406 Homebrew wrapper
  • Auto-detection cascade: OPENFOAM_PATH env var > macOS openfoam2406 wrapper > Linux default path
  • Portable bash resolution (shutil.which) in Python
  • python3 instead of python in all scripts
  • Packaged as an agent skill installable via npx skills add

Install

Via npx skills (recommended)

npx skills add CHOSENX-GPU/chatcfd-skill

This installs the skill into your agent's skill directory (e.g. ~/.agents/skills/chatcfd/, ~/.claude/skills/chatcfd/, etc.).

Manual install

Clone into your agent's skill directory:

# For Cursor
git clone https://github.com/CHOSENX-GPU/chatcfd-skill.git ~/.agents/skills/chatcfd

# For Claude Code
git clone https://github.com/CHOSENX-GPU/chatcfd-skill.git ~/.claude/skills/chatcfd

# For Codex
git clone https://github.com/CHOSENX-GPU/chatcfd-skill.git ~/.codex/skills/chatcfd

Prerequisites

OpenFOAM 2406

macOS (Apple Silicon):

brew install gerlero/openfoam/openfoam@2406

See openfoam-app for details.

Linux (Debian/Ubuntu):

curl -s https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get update
sudo apt-get install -y openfoam2406-default
source /usr/lib/openfoam/openfoam2406/etc/bashrc

Custom install path:

export OPENFOAM_PATH=/your/openfoam/path

Python 3 + PyFoam

pip install PyFoam

Quick start

After installing the skill and OpenFOAM, verify the environment:

bash scripts/check_env.sh

Run a case:

bash scripts/run_cli.sh \
  --case /path/to/case \
  --mesh /path/to/mesh.msh \
  --grid-type msh \
  --turbulence-model kOmegaSST

See SKILL.md for the full CLI reference and workflow documentation.

Platform support

Platform OpenFOAM source Detection method
macOS (Apple Silicon) brew install gerlero/openfoam/openfoam@2406 openfoam2406 wrapper auto-detected
Linux (Debian/Ubuntu) apt install openfoam2406-default Default path /usr/lib/openfoam/openfoam2406
Linux (other distros) Manual build or package Set OPENFOAM_PATH env var
Custom install Any Set OPENFOAM_PATH env var

Project structure

chatcfd-skill/
├── SKILL.md                  # Agent skill definition (read by AI agents)
├── README.md                 # This file
├── scripts/
│   ├── check_env.sh          # Environment verification
│   ├── run_cli.sh            # Main CLI entry point
│   └── rerun_case.sh         # Quick re-run helper
├── src/
│   ├── runner.py             # Runtime orchestration
│   ├── mesh_utils.py         # Mesh conversion + boundary extraction
│   ├── control_utils.py      # CFL / time control setup
│   ├── case_catalog.py       # Required-files lookup
│   ├── case_corrector.py     # Error analysis + correction tasks
│   ├── case_summary.py       # Case content dump
│   └── reflection_task.py    # Reflection prompt builder
├── database_OFv24/           # OpenFOAM v2406 reference data
│   ├── OF_bc_entry.json
│   ├── OF_case_dimensions.json
│   ├── final_OF_solver_required_files.json
│   ├── final_OF_turbulence_required_files.json
│   └── processed_merged_OF_cases.json
└── error_knowledge/
    └── error_patterns.json   # Rule-based error patterns

Credits

License

MIT

Disclaimer

OPENFOAM is a registered trade mark of OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com. This project is not approved or endorsed by OpenCFD Limited.

About

ChatCFD OpenFOAM skill for AI agents (macOS + Linux). Adapted from ConMoo/ChatCFD with native macOS support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors