ai-modcon/dsagt/xgc-ai-training
Claude Code and agent skill by ai-modcon/dsagt
- community
Checking that the SKILL.md file is still in the repository.
Convert XGC plasma turbulence simulation data (ADIOS2 BP5 format) into GNN-ready npz files and a PyTorch Dataset for AI/surrogate model training. Use when the user asks to preprocess XGC data, create training datasets from XGC simulations, or prepare fusion simulation data for machine learning.
Install
npx vskill@latest install ai-modcon/dsagt/xgc-ai-trainingSKILL.md
XGC → AI Training Pipeline
Converts raw XGC simulation directories into graph-structured training data for MeshGraphNets-style surrogate models of plasma turbulence.
Variable reference: `references/xgc_fields.md`
Pipeline Checklist
Copy and track progress:
Stage 1 — Check XGC Structure (check)
Run before preprocessing. Verifies mesh file, counts 3d/f3d steps, detects nphi and axis order, flags inconsistencies.
| Parameter | Required | Description | |
|---|---|---|---|
case_dir | yes | XGC simulation directory | |
--output | no | Save JSON report to file (audit trail) |
Expect: "status": "ok" and all checks passed before proceeding. Watch for: missing xgc.mesh.bp, axis order (first vs last), f3d alignment.
Stage 2 — Physics Summary (operation → audit)
Reads mesh and field files; emits structured JSON with node counts, field names, physical parameters, and time range.
| Parameter | Required | Description | |
|---|---|---|---|
case_dir | yes | XGC simulation directory | |
--output | no | Save JSON report to file |
Key output fields: mesh.n_nodes, mesh.n_edges, fields_3d.phi_field_names, fields_f3d.phi_field_names, physical_params.sml_dt.
Stage 3 — Preprocess BP → npz (operation)
Reads all xgc.3d.*.bp (and xgc.f3d.*.bp where available). Normalizes axis order to [nphi, n_nodes] float32. Writes mesh.npz, step_NNNNN.npz, and meta.json under out_dir.
| Parameter | Required | Default | Description | |
|---|---|---|---|---|
case_dir | yes | — | XGC simulation directory | |
out_dir | yes | — | Output directory (created if absent) | |
--fields_3d | no | dpot,eden,iden | Fields to read from xgc.3d files | |
--fields_f3d | no | all 8 fluid moments | Fields to read from xgc.f3d files | |
--no_f3d | no | false | Skip f3d files entirely | |
--steps | no | all | Comma-separated step indices to process | |
--overwrite | no | false | Overwrite existing npz files | |
--output | no | — | Save JSON status to file |
Output layout:
Typical run times (KSTART, 45K nodes, all 99 steps): ~5 min on login node.
Stage 4 — Validate Preprocessed Output (check)
Run after preprocessing. Spot-checks 5 step files for shape, dtype, field completeness, and time monotonicity.
| Parameter | Required | Description | |
|---|---|---|---|
out_dir | yes | Directory produced by xgc_preprocess.py | |
--output | no | Save JSON report to file |
Expect: "status": "ok", all shapes [nphi, n_nodes], dtype float32.
Stage 5 — Dataset Class (library)
scripts/xgc_dataset.py provides XGCGraphDataset, a PyTorch Dataset subclassing BaseCFDGraphDataset from the MATEY project. That module (graph_datasets) is not publicly available; without it, stop after Stage 4 and report the validated npz directory as the deliverable.
On first use it builds a cached topology.pt (edge_index, edge_attr, static node context) then reads npz files at getitem time — efficient for large meshes.
Smoke test:
Decisions the Agent Must Confirm With the User
- Which fields to include — at minimum
dpot; add fluid moments if f3d
files are present and downstream model needs them.
- Which steps to process — all (default) or a subset for a quick test.
- Output directory — where the npz files will be written.
- `n_steps` and `leadtime_max` — depend on the downstream GNN architecture.
Notes
- ITER (1.28M nodes) is large; preprocessing all 99 steps takes ~30 min.
Use --steps 10,20,30 for a fast sanity check first.
- NSTX has axis order
[n_nodes, nphi];xgc_preprocess.pynormalizes
automatically (verified by check_xgc_preprocessed.py).
- f3d files in KSTART appear every 10 steps; 3d every 2 steps. Steps without
f3d will only have dpot, eden, iden.
meta.jsonrecordsfield_availabilityper field so the dataset class can
automatically filter to steps where all requested fields are present.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinguse_cases/plasma_turbulence/skills/xgc-ai-training/SKILL.md
Popularity
- 7-day trend score
- 0
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/ai-modcon/dsagt/xgc-ai-training)