科研 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.
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.pyand pass--custom-task task.json.
Workflow
- Start a run.
This writespython scripts/design_loop.py init --task t1v1 --run runs/t1v1runs/t1v1/prompt_next.md(the INITIAL prompt). - 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. - Evaluate. Never estimate stresses yourself.
The output gives the FEM result, the critical members, the ranked history, andpython scripts/design_loop.py eval --run runs/t1v1 design.jsonmode_next: OPTIMIZE if the design is feasible, CONSTRAINT if not. It also writes the next prompt. - Repeat steps 2–3 using
prompt_next.md. Change a few things per iteration. In OPTIMIZE mode, set"stop": trueonce improvements fall below about 2%; stopping is refused while the design is infeasible. The budget is 25 iterations. - Report.
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.python scripts/design_loop.py best --run runs/t1v1 # best_design.json + best.png
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桁架的节点和截面设计。
所属插件
安装该插件会一并获得同领域的 35 个 Skill / MCP。
同插件的其他科研 Skill
- FDM增材制造可制造性设计Checks an existing STEP part for FDM printability with the AgentsCAD method: overhang detection, reorientation, chamfers, and kernel plus visual verification. Use for DFAM review before 3D printing.
- 激光粉末床合金可打印性筛选Screens metal alloy compositions for laser powder bed fusion printability using CALPHAD or built-in thermophysical data and Rosenthal melt pools. Use when choosing or qualifying an AM alloy.
- 增材制造文献问答检索Answers additive-manufacturing questions from the user’s own PDF library with page-cited evidence via retrieval. Use for literature-grounded AM questions instead of relying on memory.
- CADSmith文本生成CADGenerates dimensionally exact CadQuery CAD from natural language using the CADSmith plan-code-validate-refine loop. Use when the user describes a part in words and wants a CAD model.
- OpenFOAM CFD仿真自动搭建Sets up, runs, diagnoses, and reports OpenFOAM CFD cases from a plain-language request using registered flow families and deterministic accept/reject validators. Use for guided OpenFOAM case setup.
- 机械设计评审文档汇编Assembles a mechanical design-review package: requirements traceability, design FMEA with RPN, costed multi-level BOM, risk register, and a PDR/CDR checklist. Use when preparing a design review.
- 面向制造的可制造性评审Reviews a part or assembly for CNC machining, sheet metal, injection molding, casting, or 3D printing manufacturability, flagging rule violations. Use when the user asks for a DFM/DFMA check.
- 工程图纸与GD&T审查Reviews mechanical drawings (PDF, image, or DXF) for dimensioning errors, GD&T misuse, datum problems, and ASME Y14.5/ISO GPS compliance. Use when checking a drawing before release.
- 工程计算报告生成Turns engineering calculations or scripts into a formal calculation report with objective, assumptions, equations, and unit-checked results. Use for a calc report ready for sign-off.
- LLM-SR方程发现Discovers interpretable equations from engineering data with the LLM-SR loop: skeleton proposals, constant fitting, and out-of-domain scoring. Use for symbolic regression on experimental data.
- 疲劳断裂寿命分析Estimates fatigue life and crack-growth life for metal parts from S-N data, load histories, and fracture-mechanics inputs. Use for Miner’s-rule damage, rainflow counting, or Paris-law crack growth.
- 图像直接生成FDM G代码Converts a photo, sketch, or slice image of a flat or near-flat part directly into FDM G-code without CAD, via silhouette and toolpath extraction. Use for sketch-to-print without modeling.
- 点阵结构刚度逆向设计Designs 3D-printable lattice unit cells for a target stiffness using TPMS cells, printability checks, and voxel homogenization. Use for lattice infill or metamaterial design.
- 平面连杆机构综合Synthesizes planar four-bar or six-bar linkages whose end-effector traces a target curve, using graph-based topology and forward-kinematics search. Use for mechanism path-generation problems.
- LLM驱动FDM打印逐层监控Monitors an FDM print layer by layer through Klipper/Moonraker, diagnosing defects from camera images and applying safety-bounded G-code corrections. Use to watch or fix a live 3D print.
- L-PBF缺陷区间预测Predicts L-PBF defect regime (keyholing, lack of fusion, balling, or none) from process parameters and checks melt-pool dimensions against standard criteria. Use when selecting LPBF parameters.
- L-PBF熔池图像超分辨率Upscales low-cost webcam images of an L-PBF build plate to high resolution via registration and a trained diffusion or CNN model. Use for in-situ L-PBF monitoring with cheap cameras.
- 机械零件强度校核Sizes and checks machine elements: bolted joints, shafts for fatigue, bearings for L10 life, springs, welds, and gears, with shown work and safety factors. Use to size or verify a machine element.
- Ashby材料选型Selects engineering materials with the Ashby method: translate function and constraints into a performance index, then screen and rank a shortlist. Use when choosing between candidate materials.
- 产品逆向拆解分析Reverse-engineers a physical product as an engineering system: function structure, costed BOM, DFA index, should-cost, FMEA, and a printable HTML report. Use when asked to tear down a product.
- 力学教学图绘制Produces mechanics teaching figures such as Mohr’s circle, shear/moment diagrams, S-N curves, and free-body diagrams as PNG/SVG. Use when asked to draw or plot a mechanics concept.
- 增材制造熔池几何预测Predicts metal AM melt-pool depth, width, length, and mode (keyhole, lack of fusion, balling, desirable) from laser power, speed, and beam size. Use for LPBF parameter prediction.
- 自然语言参数化CAD建模Turns a plain-English or dimensioned part description into a parametric CadQuery script and exports STEP, STL, and a mass/volume report. Use when asked to model or generate a CAD part.
- FreeCAD自然语言建模Generates FreeCAD models from natural-language queries using the Query2CAD self-refinement loop: macro generation, error repair, and image-text scoring. Use for text-to-CAD in FreeCAD.
常见问题
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 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。