Finite element (FE) analysis guides the design and verification of nearly all manufactured objects. It is at the core of computational engineering, enabling simulation of complex physical systems, from fluids and solids to multiphysics systems. However, implementing FE codes and analyzing simulation results demands expertise across numerical analysis, continuum mechanics, and programming. Conventional Large Language Models (LLMs) can generate FE code, but they hallucinate, lack awareness of variational structures, and cannot close the loop from problem statement to a verified solution. Here, we propose ALL-FEM, an autonomous simulation system that integrates agentic AI with domain-specific, fine-tuned LLMs for FEniCS code generation across solid, fluid, and multiphysics applications. We construct a corpus of 1000+ verified FEniCS scripts by combining 500+ curated expert codes with a retrieval-augmented, multi-LLM pipeline that generates and filters codes for diverse PDEs, geometries, and boundary conditions. We used the corpus to fine-tune LLMs with 3B to 120B parameters. Our agentic framework orchestrates specialized agents, powered by fine-tuned LLMs, to formulate problems as PDEs, generate and debug code and visualize the results. We evaluated the system on 39 benchmarks that include problems of linear/nonlinear elasticity, plasticity, Newtonian/non-Newtonian flow, thermofluids, fluid-structure interaction, phase separation, and transport on moving domains. Embedded in a multi-agent workflow with runtime feedback, the best fine-tuned model (GPT OSS 120B) achieves code-level success of 71.79%, outperforming a non-agentic deployment of GPT 5 Thinking. By showing that relatively small, fine-tuned LLMs, orchestrated through agentic frameworks, can automate FE workflows, ALL-FEM offers a blueprint for autonomous simulation systems in computational science and engineering.
翻译:有限元分析指导着几乎所有制造物体的设计与验证。它是计算工程的核心,能够模拟从流体、固体到多物理场系统等复杂物理系统。然而,实现有限元代码和分析仿真结果需要数值分析、连续介质力学和编程方面的专业知识。传统大型语言模型可以生成有限元代码,但存在幻觉现象、缺乏变分结构意识,且无法完成从问题陈述到验证解的闭环。本文提出ALL-FEM——一种自主仿真系统,它将智能代理AI与面向固体、流体及多物理场应用中的FEniCS代码生成任务的领域特定微调大型语言模型相结合。我们通过500多个精选专家代码与检索增强的多语言模型流水线相结合,构建了包含1000多个经过验证的FEniCS脚本的语料库,该流水线可针对不同偏微分方程、几何形状和边界条件生成并筛选代码。我们利用该语料库对参数规模从3B到120B的大型语言模型进行微调。我们的智能代理框架协调由微调大型语言模型驱动的专门代理,以将问题表述为偏微分方程、生成并调试代码以及可视化结果。我们在39个基准测试上评估了该系统,这些测试涵盖线/非线性弹性、塑性、牛顿/非牛顿流动、热流体、流固耦合、相分离以及移动域输运等问题。在包含运行时反馈的多智能体工作流程中,最佳微调模型(GPT OSS 120B)实现了71.79%的代码级成功率,超越了非智能部署的GPT 5 Thinking。通过证明参数相对较小的微调大型语言模型在智能代理框架的协调下能够自动化有限元工作流程,ALL-FEM为计算科学与工程领域的自主仿真系统提供了一种蓝图。