基于AI Vibe Coding的有限元软件开发研究——以Bathe-Ramaswamy本构向OpenSees集成为例

AI VIBE CODING-ASSISTED DEVELOPMENT OF FINITE ELEMENT SOFTWARE: A CASE STUDY ON INTEGRATING THE BATHE–RAMASWAMY CONSTITUTIVE MODEL TO OPENSEES

  • 摘要: 工业有限元软件开发中,“集成既有理论与代码到新平台”是最常见的研发形态,但该过程需要遗产代码解读、接口适配、数值稳定性保障与系统化验证等交叉能力,长期依赖稀缺复合型人才。该文旨在以可检验的工程案例,论证AI vibe coding在工业有限元本构集成开发中的可行性,并给出可复现的方法学流程与关键数值修正策略。以Bathe-Ramaswamy平面应力混凝土本构从ADINA集成到OpenSees为例,提出“AI生成—Standalone测试驱动—渐进迭代”的开发方法;采用Cursor与Claude Opus 4.6等大模型,AI自动完成OpenSees PlaneStressUserMaterial接口下约1250行Fortran 90子程序开发,并构建78项以上Standalone单元测试与结构级校验。结果表明:AI可高效生成本构代码框架,但在裂缝开合状态转换的边界条件、切线—应力一致性、平面应力耦合项与失效判据阈值等关键数值细节上存在可归类的系统性错误;针对上述问题,进一步提出并验证了渐进混合法、基于应变的压碎判据与双轴包络抗拉强度下限保护等策略,使单轴压缩峰后软化支路连续、Newton-Raphson迭代稳定,并在剪力墙往复加载中获得与参考模型相近的承载与滞回响应。开发总耗时约2天,大模型调用约1.2×108 token,直接成本约100美元。研究表明:在严格对照源程序与“测试前置”的验证体系约束下,AI vibe coding可显著降低本构集成开发的人力与时间成本。本文提出的错误模式归类与数值修正策略可为同类工业有限元软件开发提供可复现的工程方法学参考。

     

    Abstract: Integrating existing theories and legacy code into a new platform is a common task in industrial finite element software development. However, this process requires interdisciplinary expertise in legacy-code comprehension, interface adaptation, numerical stability control, and systematic verification, and has long relied on scarce multidisciplinary talents. This study uses a verifiable engineering case to evaluate the feasibility of AI vibe coding for constitutive model integration and implementation, and to present a reproducible workflow together with key numerical correction strategies. Specifically, the integration of Bathe–Ramaswamy plane-stress concrete constitutive model from ADINA into OpenSees is taken as a case study, and an "AI generation–standalone test-driven–progressive iteration" development workflow is proposed. Using an AI coding assistant powered by large language models (e.g., Claude Opus 4.6 via Cursor), we develop an approximately 1,250-line Fortran 90 user-material subroutine for the OpenSees PlaneStressUserMaterial interface and built more than 78 standalone elemental-level tests, together with structural-level validations. The results show that AI can efficiently generate the overall code framework while producing classifiable systematic errors in key numerical details, including boundary conditions for crack-opening/closure transitions, stress–tangent consistency, plane-stress coupling terms, and threshold settings in failure criteria. To address these issues, we further propose and validate several correction strategies, including a progressive mixing scheme, a strain-based crushing criterion, and a lower-bound protection for tensile strength under a biaxial envelope. These strategies ensure the continuity of the post-peak softening branch in uniaxial compression, stabilize the Newton–Raphson iterations, and yield load-carrying capacity and hysteretic responses comparable to those of the reference model in cyclic shear-wall simulations. The total development time is approximately two days, with about 1.2×108 tokens consumed and a direct cost of about USD 100. The results indicate that, under strict source-code cross-checking and test-first verification regime, AI vibe coding can substantially reduce the manpower and time costs of constitutive integration. The categorized error patterns and numerical correction strategies reported in this study provide a reproducible engineering methodology for similar industrial finite element software development tasks.

     

/

返回文章
返回