🤖 AI Summary
This study systematically evaluates ChatGPT’s capability to generate numerical modeling code for multi-physics geotechnical engineering problems, specifically unsaturated soil hydro-mechanical coupling. Using progressive prompt engineering, the model is guided to produce implementations—first in FEniCS and then in MATLAB—for three canonical boundary-value problems: one-dimensional consolidation, strip-foundation settlement, and gravity-driven seepage. This work provides the first empirical validation of large language models (LLMs) in generating complex coupled constitutive models and finite element implementations: the FEniCS code passed numerical verification with minimal modification, whereas the MATLAB implementation required substantial human intervention. Results demonstrate that LLMs can significantly accelerate domain-specific modeling, yet their effectiveness critically depends on synergistic integration of prompt design and deep geotechnical expertise. The study establishes a methodological framework and an empirical benchmark for AI-augmented geotechnical numerical simulation.
📝 Abstract
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.