arXiv:2501.02199math.NAcs.AI2025-01被引 18

用ChatGPT生成岩土工程有限元代码,验证其可行性与局限性。

Can ChatGPT implement finite element models for geotechnical engineering applications?

  • 通过提示工程引导ChatGPT编写有限元代码,结合FEniCS与MATLAB两种环境。
  • FEniCS环境下代码修改少,MATLAB需大量人工干预和提示优化。
  • 适合熟悉数值方法的工程师快速原型开发,非完全替代编程者。

本研究评估了ChatGPT在岩土工程中生成有限元代码的能力。针对三个不同初值边值问题,采用非饱和土水-力耦合模型:一维孔隙水压力消散、条形基础时变沉降、重力驱动渗流。每个案例均通过提供平衡方程、本构关系、几何、初始/边界条件、材料参数及时空离散策略等信息进行初始提示。对错误或异常结果通过提示增强逐步修正,直至代码通过验证/验证测试。结果表明,使用FEniCS有限元库时,代码只需少量修改,因其高阶接口支持高效编程;而基于MATLAB的代码则需大量提示优化和人工干预,因涉及形状函数构造、全局矩阵组装等底层编程。由于该任务需掌握数学公式与数值技术,研究认为大语言模型尚无法取代人类程序员,但可显著辅助数值模型实现。

原文摘要 · Abstract (English)

This study assesses the capability of ChatGPT to generate finite element code for geotechnical engineering applications from a set of prompts. We tested three different initial boundary value problems using a hydro-mechanically coupled formulation for unsaturated soils, including the dissipation of excess pore water pressure through fluid mass diffusion in one-dimensional space, time-dependent differential settlement of a strip footing, and gravity-driven seepage. For each case, initial prompting involved providing ChatGPT with necessary information for finite element implementation, such as balance and constitutive equations, problem geometry, initial and boundary conditions, material properties, and spatiotemporal discretization and solution strategies. Any errors and unexpected results were further addressed through prompt augmentation processes until the ChatGPT-generated finite element code passed the verification/validation test. Our results demonstrate that ChatGPT required minimal code revisions when using the FEniCS finite element library, owing to its high-level interfaces that enable efficient programming. In contrast, the MATLAB code generated by ChatGPT necessitated extensive prompt augmentations and/or direct human intervention, as it involves a significant amount of low-level programming required for finite element analysis, such as constructing shape functions or assembling global matrices. Given that prompt engineering for this task requires an understanding of the mathematical formulation and numerical techniques, this study suggests that while a large language model may not yet replace human programmers, it can greatly assist in the implementation of numerical models.

有限元ChatGPT岩土工程代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。