# Abaqus Odb To Grid Csv

> Convert per-case Abaqus FEA outputs into ML-ready (X, Y) wide-table CSVs. Pivots irregular FEA mesh node displacements onto a regular N×N grid via direct binning (structured mesh) or bilinear resampling, picks the final frame as the deformation target, and aggregates across many cases into X_amplitude.csv (design vectors) + Y_grid_uz.csv (flattened grid displacement). Use when the user has a fold…

- **Type:** Skill
- **Install:** `agentstack add skill-haibarakiku-abaqus-ml-skills-abaqus-odb-to-grid-csv`
- **Verified:** Pending review
- **Seller:** [Haibarakiku](https://agentstack.voostack.com/s/haibarakiku)
- **Installs:** 0
- **Category:** [Data & Analytics](https://agentstack.voostack.com/c/data-and-analytics)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Haibarakiku](https://github.com/Haibarakiku)
- **Source:** https://github.com/Haibarakiku/abaqus-ml-skills/tree/main/skills/abaqus-odb-to-grid-csv

## Install

```sh
agentstack add skill-haibarakiku-abaqus-ml-skills-abaqus-odb-to-grid-csv
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Abaqus ODB → ML-Ready Grid CSV

The post-processing half of a surrogate-model pipeline. Takes a folder of completed Abaqus FEA cases (typically produced by the **abaqus-lhs-batch-dataset** skill) and produces two flat CSVs ready for `numpy.loadtxt` / `pandas.read_csv` / scikit-learn:

- **`X_amplitude.csv`** — `sample_id, amplitude_0000, amplitude_0001, ..., amplitude_(D-1)` — the input design vectors
- **`Y_grid_uz.csv`** — `sample_id, uz_0000, uz_0001, ..., uz_(N²-1)` — the resulting deformation field flattened from N×N grid (row-major)

These are the two matrices a surrogate model trains on: shape `(N_samples, D)` and `(N_samples, N²)`.

## When to Use This Skill

Activate when the user wants to:
- Convert a directory of `sample_*/Membrane2D1.odb` (or `node_displacement.csv`) cases into ML-ready training matrices
- Resample a fine FEA mesh (e.g. 81×81) onto a coarser learning grid (e.g. 41×41 or 21×21)
- Aggregate multiple dataset runs and deduplicate by input vector
- Inspect / validate a dataset before training

Do NOT use this skill for:
- Single-case ODB inspection (use `abaqus-odb` instead)
- Time-series outputs where you need every frame (this skill takes the **final frame** by default)
- Stress / strain field extraction (this skill is targeted at displacement; extending to other fields is straightforward, see below)

## The Two Mesh-to-Grid Paths

### Path A — Structured FEA mesh (preferred, fast)

The FEA mesh is a regular grid (e.g. 81×81 nodes for a square membrane), and you want to either keep it or downsample to a smaller learning grid. This is the case for membrane / plate problems where you set the mesh seed to give exact node spacing.

**Steps:**
1. Detect mesh size: `unique(x0)` and `unique(y0)` from `node_displacement.csv` give `MESH_N`
2. Use rounded `(x0, y0)` as a hash key → directly bin each node into a `(MESH_N, MESH_N)` array
3. If `target_N != MESH_N`: bilinear resample to `(target_N, target_N)` using **precomputed** weights (10-100× faster than `scipy.interpolate`)
4. Flatten row-major to length `target_N²`

**Latency:** ~50 ms / case. 1000 cases = ~1 minute.

### Path B — Unstructured FEA mesh (fallback)

The FEA mesh is unstructured (tet / triangular / mixed). Need scattered interpolation.

**Steps:**
1. Stack `(x0, y0, uz)` from final frame
2. Build a regular target grid: `linspace(x_min, x_max, N)` × `linspace(y_min, y_max, N)`
3. `scipy.interpolate.griddata((x0, y0), uz, (xq, yq), method="linear")`
4. Fill NaNs (outside-hull points) with 0 or nearest-neighbor value
5. Flatten row-major

**Latency:** ~1-3 s / case. 1000 cases = ~30 minutes. Requires scipy.

## Required Inputs

The user must provide:

1. **Dataset root** — A folder produced by a batch FEA run, with subfolders `sample_*/` each containing:
   - `node_displacement.csv` — produced by the Abaqus solver script. Schema: `frame_id, time, node_id, x0, y0, z0, ux, uy, uz, x_def, y_def, z_def`
   - `input_vector.csv` (or `ForceAmplitude.dat`) — the design vector for that case
   - `dataset_index.csv` (at the dataset root) — the per-case status log; only `status == "completed"` cases are processed

2. **Target grid size `N`** — typically 21, 41, or 81 nodes per side. If `N` matches the FEA mesh, no resampling is done.

3. **Frame selection** — by default, the last frame (final deformed state). For dynamic problems, the user may want a specific time or all frames.

## Workflow Steps

### Step 1 — Scan and validate

```python
dataset_root = Path(...)
index = pd.read_csv(dataset_root / "dataset_index.csv")
completed = index[index["status"] == "completed"]
```

Reject the run if `.csv` per frame
- **Multi-target stacking**: concatenate `[Y_grid_ux, Y_grid_uy, Y_grid_uz]` column-wise → 3N² output dim

## Quick Sanity Checks

After producing `X_amplitude.csv` and `Y_grid_uz.csv`:

1. **Shape match**: `len(X) == len(Y)` and both index by the same `sample_id`
2. **Y range**: `Y.abs().max()` between sane bounds (not `inf`, not `0`)
3. **Linear fit baseline**: train a Ridge with `alpha=1.0` and check `R²` on a 80/20 split. Should be > 0.9 for well-behaved problems. R² < 0.5 implies the design space is too noisy or the FEA setup is suspect — surface this to the user.
4. **Dedup ratio**: if `n_dedup / n_total < 0.7`, the design space sampler is producing too many duplicates — narrow the precision threshold or use a different sampler.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Haibarakiku](https://github.com/Haibarakiku)
- **Source:** [Haibarakiku/abaqus-ml-skills](https://github.com/Haibarakiku/abaqus-ml-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** yes
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-haibarakiku-abaqus-ml-skills-abaqus-odb-to-grid-csv
- Seller: https://agentstack.voostack.com/s/haibarakiku
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
