科研 Skill

应力场代理模型预测

stress-field-surrogate

Predicts full 2D von Mises stress fields from geometry, supports, and loads in milliseconds using a trained diffusion or regression surrogate. Use for fast stress-field design iteration.

发布者 Codar安全审核通过v0.1.0更新于 2026-11-18

SKILL.md

Stress-field surrogate (StressD)

StressD (Jadhav et al., CMAME 416 (2023) 116343) generates von Mises stress maps from a 5-channel input: geometry, support x/y and load x/y. It has two parts:

  • a conditional diffusion model that produces the field normalised per sample;
  • an auxiliary network that predicts the scale.

On Nie et al.'s cantilever dataset it cut MAE by about 78% compared with StressNet and StressGAN. scripts/stressd.py reproduces the pipeline and adds a FEM data generator, so you can train on your own part family. It needs numpy and scipy; the models need PyTorch. Paper numbers and the split caveat are in references/paper-notes.md.

Workflow

  1. Data. python scripts/stressd.py dataset --out cant.npz [--geoms 80 --angles 72 --mags 20]
    • Generates cantilever geometries in 6 families (plain, holes, notches, tapered, slots, truss openings) on a 32 × 24 grid, clamped on the left and loaded at a tip pad over 0–355° and 5–100 N.
    • The plane-stress Q4 FEM uses E = 200 GPa, ν = 0.3, t = 1 mm, 1 mm elements. It is linear, so each geometry costs 2 solves however many load cases you want.
    • The FEM matches Euler–Bernoulli bending stress within 1% on slender strips (tested).
    • For your own parts, replace random_geometry with your parametric family, or rasterise CAD sections.
  2. Train.
    • train --data cant.npz --model diffusion --out sd.pt is StressD: cosine schedule, T = 500, L1 noise loss, and a ViT scale network on 4 × 4 patches.
    • --model regression is a direct U-Net baseline (StressNet-like).
    • Use --split geometry (the default). The paper's 80/20 random split shares geometries between train and test. Since stress is linear in load, a geometry seen under other loads is nearly free to predict. Only unseen geometries test a design surrogate.
  3. Predict and score.
    python scripts/stressd.py predict --model sd.pt --data cant.npz --out pred.npz --steps 50
    python scripts/stressd.py metrics --pred pred.npz      # MAE, MSE, peak-stress abs. error, MAPE (paper's metrics)
    python scripts/stressd.py plot --pred pred.npz --out cases.png
    
  4. Use in design. Screen many candidate shapes with the surrogate, then confirm the winner with real FEA (quick-fea).
    • Peak stresses near notches and holes are where surrogates err most. Report the peak error alongside the mean.
    • Don't use surrogate output for a safety factor.

Notes

  • The diffusion sampler is stochastic. Average a few samples, or report spread, for critical regions; the paper averages 3 runs.
  • fem runs a single solve for any 32 × 24 mask image, which is handy for spot checks.

Cite: Jadhav et al., StressD, Comput. Methods Appl. Mech. Engrg. 416 (2023) 116343.

示例提示词

帮我用代理模型快速预测这个几何在给定载荷下的von Mises应力场。

所属插件

机械设计与先进制造面向机械设计与制造研究:文本/草图生成 CAD、FreeCAD/SolidWorks 参数化建模、机构综合与零件选型、公差与 GD&T、DFM 与设计评审、快速有限元与应力代理模型、增材制造工艺与缺陷预测、疲劳断裂寿命。

安装该插件会一并获得同领域的 35 个 Skill / MCP。

同插件的其他科研 Skill

常见问题

应力场代理模型预测能做什么?

Predicts full 2D von Mises stress fields from geometry, supports, and loads in milliseconds using a trained diffusion or regression surrogate. Use for fast stress-field design iteration。

如何安装应力场代理模型预测?

在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「应力场代理模型预测」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。

应力场代理模型预测需要哪些权限?

该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。

应力场代理模型预测经过官方审核吗?

是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。