科研 Skill

LLM迭代桁架优化设计

llm-mechanical-designer

Designs and optimizes 2D trusses with an LLM-in-the-loop FEM workflow where proposed members are scored by an exact truss FEM. Use for iterative truss topology or sizing optimization.

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

SKILL.md

LLM Agent as a Mechanical Designer (truss design loop)

Paper: Y. Jadhav, A. Barati Farimani, Large Language Model Agent as a Mechanical Designer, J. Engineering Design (2026), arXiv:2404.17525. Reference code: github.com/BaratiLab/LLLM-Agent-Mechanical-Designer. You are the LLM in the loop. The FEM is code (scripts/truss_fem.py), and its stresses match the paper's reference code to 1e-4.

When to use

  • "Design a truss that carries X with max stress Y and mass under Z."
  • "Minimize the stress-to-weight ratio of this bracket truss."
  • Reproducing or teaching Task 1 / Task 2 from the paper (t1v1–t1v3, t2v1–t2v3).
  • Any 2-D pin-jointed structure with discrete section sizes. Write the task as JSON with the same keys as scripts/tasks.py and pass --custom-task task.json.

Workflow

  1. Start a run.
    python scripts/design_loop.py init --task t1v1 --run runs/t1v1
    
    This writes runs/t1v1/prompt_next.md (the INITIAL prompt).
  2. Answer the prompt yourself. Work through the scratchpad sections in order (they're there so the geometry reasoning happens before the numbers), then save only the JSON block to design.json. Keep fixed nodes exactly where they are, and use area IDs from the table.
  3. Evaluate. Never estimate stresses yourself.
    python scripts/design_loop.py eval --run runs/t1v1 design.json
    
    The output gives the FEM result, the critical members, the ranked history, and mode_next: OPTIMIZE if the design is feasible, CONSTRAINT if not. It also writes the next prompt.
  4. Repeat steps 2–3 using prompt_next.md. Change a few things per iteration. In OPTIMIZE mode, set "stop": true once improvements fall below about 2%; stopping is refused while the design is infeasible. The budget is 25 iterations.
  5. Report.
    python scripts/design_loop.py best --run runs/t1v1     # best_design.json + best.png
    
    Report the best design table (nodes, members, area IDs, member stresses), max |σ|, mass, and SWR against the limits, the number of iterations and FEM calls, and the plot. A good comparison point from the paper: the LLM loop needed tens of FEM calls, where NSGA-II used 500 generations × 100 population.

Design heuristics the paper's best runs used

  • Deepen the truss over the load node; raising an apex cuts chord forces.
  • Put a direct diagonal from the load node to each support.
  • Size by force: big areas on the 2–3 critical members, IDs 1–2 elsewhere.
  • Fewer members is often better. Minimal triangulated layouts sat on the low-mass Pareto edge.
  • Keep coordinates simple (two decimals), since LLMs are weak at fine floating-point tuning. Refine positions in small, deliberate steps.

Conventions (identical to the reference code)

Load [m, a] → Fx = m·cos a, Fy = m·sin a (so [-10, -45] points up-left). A pinned support fixes x and y; a roller fixes y. Stress is axial, tension positive, with E = 29.6e6. Mass = Σ L·A(area id). Units follow the paper ("Pa", "m").

Limits

2-D, linear-elastic, pin-jointed. No buckling check: add an Euler check for compression members if the user needs one (P_cr = π²EI/L²). The prompt templates are re-written from the paper's structure, not copied verbatim.

示例提示词

帮我用LLM配合FEM迭代优化这个2D桁架的节点和截面设计。

所属插件

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

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

同插件的其他科研 Skill

常见问题

LLM迭代桁架优化设计能做什么?

Designs and optimizes 2D trusses with an LLM-in-the-loop FEM workflow where proposed members are scored by an exact truss FEM. Use for iterative truss topology or sizing optimization。

如何安装LLM迭代桁架优化设计?

在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「LLM迭代桁架优化设计」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。

LLM迭代桁架优化设计需要哪些权限?

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

LLM迭代桁架优化设计经过官方审核吗?

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