csml-rpi/ai-cfd-scientist/cfd-experiment
Claude Code and agent skill by csml-rpi/ai-cfd-scientist
- community
Checking that the SKILL.md file is still in the repository.
Run CFD cases. Two modes — sweep (ARIS-style, agent-driven, no FoamAgent handoff) for parameter variants on a known-good baseline; single-case (FoamAgent-driven via scripts/foam_run.py) for fresh case generation that needs RAG. Embeds RunValidityAgent prompts (Allrun preflight + runtime investigation) verbatim. Writes <case_dir>/run_result.json.
Install
npx vskill@latest install csml-rpi/ai-cfd-scientist/cfd-experimentSKILL.md
cfd-experiment
⚠ HARD STOP — read this before any other step
If <out-dir>/checkpoints/mesh_gate_done.json does not exist (or for code_mod, if code_mod_done.json also does not exist), STOP. Running cases on the starter mesh before mesh-gate has selected the locked mesh is forbidden by Skill cfd-orchestrator's "mesh-gate before experiments" constraint. Return to Skill cfd-orchestrator and start over. The one exception: this skill is invoked recursively by cfd-mesh-gate itself with mesh-gate-role set; that path is keyed on the call coming from inside <out-dir>/mesh_gate/<group>/ and bypasses this stop.
Step 0 — Preflight gate (HARD; slice 14)
Before launching any case (sweep or single-case), run:
If rc != 0, STOP. The script enforces that literature_done, baseline_setup_done, metric_setup_done, hypothesis_done, requirements_done, mesh_gate_done (and code_mod_done on route 2) are all on disk first. Running cases on the starter mesh before cfd-mesh-gate has selected the locked mesh is forbidden by skills/cfd-orchestrator/SKILL.md "Order constraint — mesh-gate must come BEFORE experiments". This preflight check is what enforces it at stage entry instead of after the fact.
Inside cfd-mesh-gate, the per-level runs invoke this skill with mesh-gate-role and bypass the experiments-stage preflight (mesh-gate is itself a predecessor of experiments). The bypass is keyed on the presence of <out-dir>/mesh_gate/<group>/ in the call path, not on a flag the agent can fake.
Execute one or many OpenFOAM cases. Two modes:
| Mode | When to use | Engine | |
|---|---|---|---|
| Sweep mode (ARIS-style) | You have a working baseline case + want to vary parameters across N variants × M conditions (typical for code-mod sweeps, sensitivity studies, OED follow-up). | Agent-driven — copy baseline, patch one dictionary entry, run solver via Bash, parse log. No FoamAgent handoff. | |
| Single-case mode (FoamAgent-driven) | You're generating a fresh case from a natural-language requirement and need RAG retrieval over tutorial cases (typical for the first case of a new physics group). | scripts/foam_run.py — wraps FoamAgent's RAG/planner/writer/reviewer pipeline. Slice 4 of the skill migration will fold the FoamAgent prompts into a cfd-foamagent skill so this handoff also goes away. |
The wrapping concerns — pre-flight Allrun validation, runtime triage, CFL-aware retries — are agent-driven in both modes via the embedded RunValidityAgent prompts further down.
Inputs
out-dir(required) — run dir (or mesh_gate sub-dir for mesh-gate use)- One of:
case_id— pulls requirement from<out-dir>/requirements.jsonrequirement_text— direct requirement string (used bycfd-mesh-gate,cfd-open-discovery)case_dir(optional) — override the default<out-dir>/cases/<case_id>/mesh_policy(auto) — if<out-dir>/selected_mesh_spec.jsonexists for this case's group, append the locked-meshrequirement_suffixto the requirement before runningmax_loop(optional, default 10) — Foam-Agent reviewer-loop capmax_time_limit(optional, default 7200 seconds) — wall-clock cap for the runprovider,model(optional) — LLM provider/model
Starter directory is READ-ONLY (perskills/cfd-orchestrator/SKILL.mdnon-negotiable constraints). All case mutations happen inside<out-dir>/— sweep mode'sshutil.copytree(BASE, cd)is the right pattern; neversed -ior mutate the starter source directly.
Output
<case_dir>/— full OpenFOAM case (mesh, fields, logs, postProcessing)<case_dir>/run_result.json:
``json { "status": "success|failed|timeout", "case_dir": "...", "case_name": "case_001", "case_solver": "simpleFoam", "error_logs": [], "loop_count": 1, "mesh_type": "standard_mesh|custom_mesh|gmsh", "wall_time_s": 1234.5 } ``
Sweep mode (ARIS-style — no FoamAgent handoff)
A purely scripted parameter sweep, in the shape ARIS-style frameworks use for parameter studies (typical wall-clock: tens of minutes for 30 cases vs hours for an LLM-supervised loop). The pattern is genuinely simple. Adopt it for any study where:
- A working baseline case already exists (mesh + boundary conditions + numerics validated).
- The variation across cases is parametric: changing one or a few dictionary entries (model name, coefficient, ambient condition, fluid property, etc.).
- The QoI extraction is well-known (pick the appropriate pattern in
cfd-skills/cfd-stats/SKILL.md).
Do not use sweep mode when you need to generate a topology/mesh/boundary-set the framework hasn't seen — that's single-case mode (next section).
Sweep-mode pattern
For each (variant × condition):
- Copy the baseline case to
<case_dir>(cp -r baseline_case/case <case_dir>). Because custom libraries are built case-local (seecfd-code-modify—customModels/<Class>/lives inside the case),cp -rcarries the compiled.sowith the copy; no global library is needed. - Patch the dictionary entries that vary (e.g.
constant/cloudProperties.phaseChangeModel,0/T.internalField,system/controlDict.endTime). Do not patch fields you didn't intend to change. - Activate any compiled custom library with a case-relative
libsentry —libs ("customModels/<Class>/lib<Class>.so");insystem/controlDict— and point the relevant model selector at the new class name. Use the case-relative path, never a barelib<Class>.soname: the bare form depends onFOAM_USER_LIBBIN/ the global library search path and breaks reproducibility when the case is moved or shared. - Run the application named in
system/controlDict(reactingFoam,simpleFoam, etc.) via Bash. Stream stdout tolog.<solver>. - Parse the log for the QoI using a
cfd-statspattern (e.g. Pattern 1 for droplet K, Pattern 2 for Cf, Pattern 3 for drag). - Append one row to
<out-dir>/results.csvwith: variant, condition, QoI, ratio-vs-reference, sample count, t_end.
That's the entire pattern. No reviewer loop, no RAG, no LLM-graded retries.
Sweep-mode template
The agent writes this Python directly via Bash (not as a wrapper script). The template is study-agnostic — every domain-specific bit is concentrated in three small functions (configure, extract_qoi, qoi_ref) that the agent fills in for the topic at hand.
Run it with python <out-dir>/sweep_template.py.
Sweep-mode parallelism
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcfd-skills/cfd-experiment/SKILL.md
Popularity
- Repository stars
- 51
- Repository forks
- 6
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/csml-rpi/ai-cfd-scientist/cfd-experiment)