csml-rpi/ai-cfd-scientist/cfd-stats
Claude Code and agent skill by csml-rpi/ai-cfd-scientist
- community
Checking that the SKILL.md file is still in the repository.
Numerical analysis patterns for OpenFOAM run outputs — log parsing, D²-law fits, slope/RMSE/Richardson extrapolation, residual-plateau checks, drift checks. Self-contained — the agent writes 30-line Python snippets via Bash using these patterns. No Python wrapper.
Install
npx vskill@latest install csml-rpi/ai-cfd-scientist/cfd-statsSKILL.md
cfd-stats
A reference book of small, well-tested numerical patterns. Each pattern is a self-contained recipe for the agent to drop into a Python snippet and run via Bash. No Python framework code, no helper imports beyond numpy/scipy.
When invoked, the agent picks the patterns it needs, composes them into a single Python script, runs it, and writes the result as JSON in the case or run directory. This skill is consulted by cfd-interpret, cfd-analyze, cfd-mesh-gate, cfd-open-discovery, and cfd-paper.
Inputs (per pattern)
Each pattern declares its own inputs. Most patterns take one or more of:
- A path to
log.<solver>for time-series extraction - A path to a
postProcessing/<functionObject>/<time>/<file>table - A path to
cloudOutputPropertiesor other Lagrangian outputs - Reference data CSV/JSON paths
Outputs
Each pattern returns a small JSON dict (numbers, units, fit quality). The agent persists it to <case_dir>/<pattern>_result.json or <run_dir>/<pattern>_summary.json.
Pattern 1 — Droplet K from log mass-history (D²-law)
Use when: measuring evaporation-rate constant K [mm²/s] of a single suspended Lagrangian droplet vs a topic-supplied reference correlation K_ref(T_inf) (linear in T, tabulated, or otherwise). Do NOT read `cloud:rhoTrans_*` Eulerian source fields or `cloudOutputProperties.massInjected` — both are constant by design at write times (see anti-patterns at the bottom of this skill).
Why log-parsing: log.<solver> writes Time = X followed by Current mass in system = Y at every solver timestep (typically 50–200 samples/s). This is the live droplet mass — captured at every solver step, not just at write times. Works on any solver that runs an OpenFOAM Lagrangian cloud (e.g., reactingFoam, sprayFoam).
Snippet template:
Compare to reference: ratio = K_measured / K_ref(condition), where the condition (typically T_inf) is read from the case (0/T, constant/<dict>, etc.) and K_ref is the topic-supplied correlation or DNS table.
Anti-failure-mode notes:
- If
Current mass in systemlines are absent, the solver isn't a Lagrangian solver or wasn't compiled with cloud reporting — fall back to integrated species mass: read the gas-phase fuel field across all timesteps, integrateρ·Y_<species>over the domain, take the time derivative. - If fewer than 5 samples and
t_end < expected_lifetime, the solver crashed early — don't attempt the fit; flagsolver_crashed: true. - Always parameterize
D₀fromconstant/cloudProperties. HardcodingD₀² = 0.25 mm²(i.e.D₀ = 0.5 mm) is a common copy-paste bug across studies with different droplet sizes.
Pattern 2 — Wall-shear-stress / Cf extraction
Use when: computing skin-friction coefficient Cf = τ_w / (½·ρ·U_∞²) along a no-slip wall.
Source (good): <case_dir>/postProcessing/wallShearStress/<time>/wallShearStress.dat (function-object output, table format).
Source (bad): Eulerian volume fields at cell centers — boundary wallShearStress field at the wall patch is the right read but only via PyVista's OpenFOAMReader with Read All Patch Arrays enabled.
Snippet template (function-object):
If the function-object isn't configured, switch to PyVista on the wall patch (cfd-viz pattern). Don't try to integrate from cell-center fields with finite-difference — accuracy is poor.
Pattern 3 — Drag / lift via forceCoeffs
Use when: scoring force coefficients on a body (cylinder, airfoil, etc.).
Source: <case_dir>/postProcessing/forceCoeffs/<time>/forceCoeffs.dat — header lists Time Cd Cs Cl CmRoll CmPitch CmYaw Cd(f) Cd(r) Cs(f) ....
Snippet:
Pattern 4 — Residual plateau check
Use when: judging whether the simulation reached steady-state (or quasi-steady periodicity for transient cases).
Source: log.<solver> lines like DILUPBiCGStab: Solving for Ux, Initial residual = 0.0123, Final residual = 1.2e-9.
Snippet:
Pattern 5 — QoI drift check (transient cases)
Use when: verifying that endTime was sufficient — last 10% of QoI history shouldn't be drifting more than tolerance.
Snippet:
Threshold guidance: |drift| < 5% is the default mesh-gate convention. Stricter (1%) for steady-state convergence judgments.
Pattern 6 — Mesh-independence / Richardson extrapolation (GCI)
Use when: triggered by cfd-mesh-gate STEP D when the simple 5%-threshold test fails.
Inputs: at least 3 mesh refinements with QoI values phi_1 (coarsest), phi_2, phi_3 (finest), and refinement ratios r_21 = h_2/h_1, r_32 = h_3/h_2. Typically uniform: r_21 = r_32 = r.
Snippet:
Reference: ASME V&V 20-2009 / Roache 1994 / Celik et al. 2008.
Pattern 7 — Two-extractor agreement check
Use when: verifying a comparator's output against an independent data path. This is the verification pattern from `cfd-open-discovery`.
Recipe:
- Comparator-A reads via path A (e.g.
log.<solver>text parsing). - Comparator-B reads via path B (e.g. PyVista on Eulerian fields, or function-object output).
- If
|A - B| / max(|A|, |B|, ε) > tolerance(default 0.5), neither passes selftest. The two extractors must agree to within 50% relative error before the comparator is bound.
Why the high tolerance: A and B are unlikely to agree better than ~10% in practice (different time integration, different averaging windows). 50% catches gross blind-spot failures (one returns 0, other returns 0.13) without flagging legitimate methodological differences.
Snippet:
Pattern 8 — Two-sided ratio metric
Use when: scoring "how close is K_pred to K_ref?" — common for code-mod studies that want to minimize mean over-prediction.
Form:
Reporting: publish both mean_ratio (so reviewers see direction of bias) and mean_abs_ratio_error (the loss to minimize). A sub-1.10 mean_ratio paired with a sub-0.20 mean_abs_ratio_error is typical of a well-tuned correction.
Anti-patterns (do NOT use these)
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-stats/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-stats)