abaqus-odb-to-grid-csv

Convert Abaqus FEA case outputs into ML-ready wide-table CSVs (X, Y). Maps displacements from irregular FEA mesh nodes onto a regular N×N grid via direct binning (structured grid) or bilinear resampling, selects the final frame as the deformation target, and aggregates multiple cases into X_amplitude.csv (design vectors) and Y_grid_uz.csv (flattened grid displacements). Intended for users who have completed FEA case folders and want to train agent models (e.g., Ridge, MLP, or Gaussian Process) on the input→displacement-field mapping.

Last repository push
GitHub Stars
208
Forks
43
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "abaqus-odb-to-grid-csv" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-8bade95e60895c7b808cc3ab63e7fdf3a569f1b55d450785e9a84345eb51b26b. Verify the upstream source and version against https://github.com/theneoai/awesome-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Convert Abaqus FEA case outputs into ML-ready wide-table CSVs (X, Y). Maps displacements from irregular FEA mesh nodes onto a regular N×N grid via direct binning (structured grid) or bilinear resampling, selects the final frame as the deformation target, and aggregates multiple cases into X_amplitude.csv (design vectors) and Y_grid_uz.csv (flattened grid displacements). Intended for users who have completed FEA case folders and want to train agent models (e.g., Ridge, MLP, or Gaussian Process) on the input→displacement-field mapping.

0 Downloads

Introduction source: third_party · theneoai · 0.0.1 Reference

SkillPi interpretation

Tasks
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 folder of completed FEA cases and wants to train a Ridge / MLP / Gaussian Process surrogate on the (input → displacement field) mapping.
Audience
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)
Inputs and outputs
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 us
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: abaqus-odb-to-grid-csv
description: 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 folder of completed FEA cases and wants to train a Ridge / MLP / Gaussian Process surrogate on the (input → displacement field) mapping.
difficulty: intermediate
category: engineering-simulation
tags: [abaqus, fea, finite-element, simulation, machine-learning, data-pipeline, mesh-resampling]
platforms: [claude, openclaw, opencode, cursor, codex, cline]
quality: community
allowed-tools:
  - Read
  - Write
  - Edit
  - Glob
  - Grep
  - Bash

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

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

Reject the run if < 80% of planned cases completed — surface the failure rate to the user.

Step 2 — Detect mesh structure (one-time)

Open the first completed case's node_displacement.csv. Count unique x0 and y0 (rounded to 2 decimals to absorb floating-point noise). If len(unique_x) * len(unique_y) == NODES_PER_FRAME, the mesh is structured (Path A). Otherwise unstructured (Path B).

Step 3 — Per-case extraction

For each completed case (in parallel via ThreadPoolExecutor or serially):

  1. Read input vector → shape (D,)
  2. Read final frame from node_displacement.csv:
    • Fast path: tail -NODES_PER_FRAME (Linux/macOS) or read whole file + filter by frame_id == max_frame_id
  3. Extract (x0, y0, uz) columns
  4. Apply Path A or Path B to produce (target_N, target_N) displacement field
  5. Flatten row-major to (target_N²,)
  6. Append to in-memory accumulator

Step 4 — Aggregate + deduplicate

  • Stack all input vectors into X of shape (N_completed, D)
  • Stack all flattened grids into Y of shape (N_completed, target_N²)
  • Optional: deduplicate identical input vectors using numpy.unique with return_index=True. Why dedupe: identical inputs but slightly different outputs (numerical noise) can confuse the regularization; pick one representative per input.
  • Write CSVs:
    • X_amplitude.csv — header sample_id, amplitude_0000, ..., amplitude_(D-1)
    • Y_grid_uz.csv — header sample_id, uz_0000, ..., uz_(target_N²-1)
    • sample_meta.csv — sample_id, source_dataset, source_case, length, width, thickness, mesh_n, frame_id for provenance

Step 5 — Quick QC

Print:

  • N_completed = ?, N_dedup = ?
  • Y percentiles: p1, p50, p99 — sanity check the displacement range is reasonable (no nan / inf)
  • Top-5 largest |uz| cases — visually inspect to make sure they aren't obviously diverged

Critical Implementation Details

1. Node coordinates may not align exactly across cases

Floating-point: a node nominally at x = 1.0 may show up as 0.99999998 in one case and 1.00000002 in another. Always round x0, y0 to the nearest mesh_pitch / 100 (e.g. np.round(x0, 2) for mm-scale meshes). Otherwise the unique-coordinate detection will fail.

2. The final frame is not always the last row

Some Abaqus output configurations write the initial (zero) frame at the start, the loading frames, and a final equilibrium frame. Always select by max(frame_id), not by tail-N.

3. Bilinear resample weights are precomputable

For a fixed MESH_N → target_N mapping, the per-target-cell (idx0, idx1, frac) weights only depend on the grid sizes. Precompute once and reuse for all cases:

def precompute_bilinear_weights(src_n, dst_n):
    indices_0 = np.empty(dst_n, dtype=np.int32)
    indices_1 = np.empty(dst_n, dtype=np.int32)
    fracs = np.empty(dst_n, dtype=np.float64)
    for i in range(dst_n):
        s = i * (src_n - 1) / (dst_n - 1)
        i0 = int(s)
        i1 = min(i0 + 1, src_n - 1)
        indices_0[i] = i0
        indices_1[i] = i1
        fracs[i] = s - i0
    return indices_0, indices_1, fracs

Then per-case bilinear is a vectorized numpy operation, no Python loop over grid cells.

4. Handle large node_displacement.csv files efficiently

Each file is per-frame × per-node × 12 columns. For 81×81 mesh × 20 frames × 12 cols × ~30 bytes ≈ 47 MB per case. Reading the full file with csv.DictReader is slow.

Fast read: skip to the last NODES_PER_FRAME lines via subprocess.run(["tail", "-N", path]) (Linux/macOS only). On Windows, use numpy.genfromtxt with skip_header= set to (num_frames - 1) * NODES_PER_FRAME + 1. Even faster: have the FEA solver script output ONLY the final frame to a separate file like final_frame.csv, eliminating the parse step.

5. Memory budget

  • Y for 1000 samples × 21×21 grid = 1000 × 441 × 8 bytes = 3.5 MB → fine in memory
  • Y for 10,000 samples × 81×81 grid = 10000 × 6561 × 8 bytes = 525 MB → still in memory, but write CSV incrementally
  • For larger sizes: write each row to disk immediately (no in-memory accumulator)

6. Failure modes

  • Mismatched dimensions: a case has len(unique_x) != MESH_N — log and skip, don't crash
  • NaN in uz: solver diverged silently. Should never happen if dataset_index.csv says "completed", but check np.isfinite(uz).all() per case anyway
  • Missing input_vector.csv: fall back to parsing ForceAmplitude.dat directly (the *Amplitude value lines)

Reference Implementation

references/extract_grid.py (~250 lines) — full pipeline as a CLI:

python extract_grid.py \
    --dataset-root ./datasets/lhs_20260427_120000 \
    --output-dir ./aggregated/v1 \
    --target-grid-n 21 \
    --frame final \
    --dedupe-by-input

references/grid_resample.py — bilinear resample with precomputed weights, structured-mesh detection, and unstructured-mesh fallback (scipy-only).

Output Schema

output_dir/
├ X_amplitude.csv         # sample_id, amplitude_0000..(D-1)
├ Y_grid_uz.csv           # sample_id, uz_0000..(N²-1)
├ sample_meta.csv         # sample_id, source_case, mesh_n, frame_id, max_abs_uz, ...
└ aggregate_summary.csv   # n_total, n_completed, n_dedup, mesh_n, target_n, dedupe_method, ...

Extension Hooks

The skill is written for uz (out-of-plane displacement) but extending to other fields is mechanical:

  • In-plane displacement: read ux, uy columns instead → produce Y_grid_ux.csv + Y_grid_uy.csv
  • Stress: requires the FEA solver script to output element stress (e.g. S22, Mises) at element centroids, then the same binning + resampling pattern
  • Time-series targets: instead of selecting max(frame_id), keep all frames and produce Y_grid_uz_t<frame_id>.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.

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决工程仿真后处理到机器学习训练数据转换的高频刚需问题
  • 功能闭环完整,支持结构化/非结构化网格两种路径,覆盖主流 FEA 输出场景
  • 明确面向代理模型训练(Ridge/MLP/Gaussian Process),实用价值高
Trigger Precision95/100

Highlights

  • 触发条件描述精准:明确要求已完成 FEA 案例文件夹及 ML 训练意图
  • 边界清晰:排除单案例检查、时间序列需求、应力场提取等不适用场景
  • When to Use This Skill 章节有效补充触发上下文
Structure and Standards93/100

Areas to improve

  • 文档长度接近上限 Reported severity: Minor

    skill_body 约450行,虽未超过500行限制但接近上限

    Recommendation: 可考虑将部分实现细节移至独立参考文件,保持主文档简洁

Highlights

  • Phase/步骤清晰:Scan→Detect→Extract→Aggregate→QC 五阶段流程
  • 含端到端 CLI 示例和完整输出 Schema 说明
  • Critical Implementation Details 覆盖关键技术陷阱(浮点对齐、帧选择、内存预算等)
Execution Reliability88/100

Areas to improve

  • description 位置 Reported severity: Minor

    description 内容仅存在于 frontmatter,skill_body 内未重复

    Recommendation: 建议在 skill_body 开头补充简要 description 以增强可读性

Highlights

  • 异常处理全面:完成率检查、浮点噪声处理、NaN/inf 检测、维度不匹配容错
  • 性能优化建议具体:预计算双线性权重、tail 快速读取、内存预算评估
  • 工具链明确:依赖标准 Python 生态(pandas/numpy/scipy)及 Bash 工具
Evidence Verifiability (mean of the first four)92/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Invoke commands or scripts

    Read the script and arguments first. Use ordinary privileges and a scoped directory; confirm installation or execution in your host tool.

    Mentioned in main document · lines 156

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.