csml-rpi/ai-cfd-scientist/cfd-viz
Claude Code and agent skill by csml-rpi/ai-cfd-scientist
- community
Checking that the SKILL.md file is still in the repository.
Generate PyVista figures from a CFD case. Two modes — interpret (per-case diagnostics for cfd-interpret) and full (publication-quality cross-case figures for cfd-paper). Self-contained — embeds viz_quality and vision QA prompts verbatim. Agent writes and runs the PyVista script directly; the batch helper is optional.
Install
npx vskill@latest install csml-rpi/ai-cfd-scientist/cfd-vizSKILL.md
cfd-viz
PyVista-based figure generation. The agent authors the script, runs it off-screen, and validates the output with a vision-LLM QA pass before declaring done.
Modes
mode=interpret — per-case diagnostics
Quick figures for one case sufficient for cfd-interpret to judge physics plausibility:
- Mesh overview (full domain + zoomed near-wall)
- Velocity-magnitude contour at the latest time
- Pressure contour at the latest time
- Streamlines on a midplane
- y+ map on no-slip walls
- Residual history (matplotlib for this one)
mode=full — publication figures
Driven by a paper plan (<out-dir>/paper_unified_plan.json):
- Comparison panels across cases (same field, same colormap, same clim)
- Profile plots at probe locations (overlay across cases)
- Streamlines / vortex iso-surfaces with consistent styling
- Error-vs-reference plots (when reference data is available)
Inputs
out-dir(required)mode(required) —interpretorfull- For
mode=interpret: case_dir(required) — single case- For
mode=full: paper_plan(required) — path topaper_unified_plan.json(figure jobs list)case_dirs(required) — list of case dirs to draw from
Outputs
mode=interpret:<case_dir>/figs/*.png(5–8 PNGs)mode=full:<out-dir>/paper_figs/*.pngplus<out-dir>/paper_figs/cases_config.json(manifest of which figure used which case + field + time)
Recipe (primary, agent-driven)
Step 1 — Inspect available data
For each case_dir:
- Verify
<case_dir>/case.foamexists; create an empty file if missing (touch case.foam) — PyVista'sOpenFOAMReaderneeds this entry-point file. - List time directories (
<case_dir>/<float>/); pick the latest non-zero (the gate is: refuse to plot at t=0 unless this is a steady-state case where t=0 is the only available time, in which case warn). - List internal fields (
U,p, etc.) and patch fields (<time>/<field>boundary file, plusboundarypatch list fromconstant/polyMesh/boundary— only for patch identification, never to read mesh geometry; PyVista handles geometry viaOpenFOAMReader). - For
mode=full, readpaper_planto get the list of figure jobs.
Step 2 — Author PyVista script(s)
Embed viz-quality awareness using the prompts below. The agent (you) writes a self-contained Python script under <out-dir>/_viz_scripts/ and runs it via python <script>.py.
System prompt — figure-quality contract (from prompts/prompts.yaml: ResultsInterpreterAgent.viz_quality_system_prompt)
User prompt — QA per-figure (from prompts/prompts.yaml: ResultsInterpreterAgent.viz_quality_user_prompt)
Step 3 — Generate per-mode
mode=interpret — script template
The agent writes a script equivalent to (concrete fields/clims chosen based on Step 1 inspection):
Key styling rules (the embedded viz_quality_system_prompt enforces these):
- Always horizontal colorbar at
position_y ≈ 0.05,height ≈ 0.04,width ≈ 0.5— never vertical, never default position. title_font_size >= 16,label_font_size >= 14,font_size >= 14for plotter text — readable at print size.window_size=(1600, 900)for thin/wide channel-like geometries;(1600, 1200)for tall/square; never fall back to 800×600 default.- For zoomed-feature plots (BFS step, jet exit, etc.), call
p.camera.zoom(1.5–2.5)after setting view.
mode=full — paper-figure script
For each entry in paper_plan.figure_jobs:
- Same styling rules.
- Identical clim across cases compared in the same panel — compute clim from the union of all case data first, then apply to every panel.
- Same colormap across the whole manuscript — pick once (e.g.
viridisfor U,RdBu_rfor signed quantities,cividisfor monotone scalars). - Use
pv.Plotter(off_screen=True, shape=(1, n_cases))for side-by-side panels.
Write all figures to <out-dir>/paper_figs/. Write a manifest:
Step 4 — Run the script(s)
If the script crashes (PyVista off-screen issues, missing fields), inspect the error, regenerate the script with the fix (often: missing OFF_SCREEN, wrong field name capitalization, a field that doesn't exist at the chosen time), and retry up to 3 times.
Step 5 — Vision QA pass
For each generated PNG, send it to a vision-LLM with the embedded viz_quality_* prompts above. Render {user_requirement} as the case requirement (or, in mode=full, the figure's spec from the paper plan).
If the response is {"viz_acceptable": false, "reason": "..."}, parse the reason:
- "colorbar overlaps" → adjust
scalar_bar_args.position_x/position_yto clear data, regenerate, re-QA. - "fonts too small" → bump font sizes by 4 pt and regenerate.
- "domain looks like a sliver" → adjust
window_sizeaspect ratio orcamera.parallel_scale. - "feature not inspectable / too zoomed-out" → add
camera.zoom(2.0)or useset_focus()near the feature. - "wrong field shown" → fix the field/time selection in the script.
Max 10 inner attempts per figure. After that, keep the latest version and emit a warning in the timeline.
Step 6 — Write outputs and timeline
mode=interpret: figures land in <case_dir>/figs/. No manifest needed — cfd-interpret reads the directory.
mode=full: figures + manifest in <out-dir>/paper_figs/. Append timeline event per figure plus an aggregate:
Skip logic
interpret: regenerate if any source field file is newer than existing figs, or iffigs/has fewer than the expected number of PNGs.full: skip a figure if its PNG exists AND the plan entry hasn't changed (comparepaper_planmtime vs PNG mtime); regenerate if plan is newer.
Anti-hallucination rules
- Never plot a field that doesn't exist in the time directory. If
<time>/wallShearStressis missing for a y+-style figure, write the script to detect that and emit a stub that plots only the mesh near the wall. - Never invent reference data. If a comparison-vs-DNS plot is requested but no reference CSV exists in
reference_data/, skip the comparison series (don't draw a fake DNS line) and add a caption note. - Never report a figure as "accepted" without an actual QA response from the vision LLM.
LangGraph mode only — do NOT call from skill mode
Two valid execution paths
This skill has two equally valid paths — pick whichever fits the situation. Both produce the same artifacts.
- Inline agent recipe (above). The agent authors the PyVista script, runs it via Bash, validates each PNG with the embedded vision-QA prompt, and retries on rejection. Use this when the visualization is per-case and easy to spec.
- Script fast-path.
scripts/viz.py(interpret mode) andsrc/cfd_langgraph/paper_unified/batch_paper_viz.py(paper-batch mode) implement the same loop in Python. They use the same prompts as the inline recipe and write the same outputs. Invoke them via Bash with the relevant CLI args. Thescripts/orchestrator_run.pyLangGraph end-to-end driver is the only Python file skill-mode should NOT call directly — it bypasses skill mode entirely. Everything else underscripts/is fair game.
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-viz/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-viz)